[dependencies]: unify rustc-hex (#11506)

* [dependency]: unify `rustc-hex`

* [private tx]: fix upgrade to `rustc hex 2.1.0`
This commit is contained in:
Niklas Adolfsson 2020-02-21 15:10:00 +01:00 committed by GitHub
parent bec867be03
commit 2018f5b0ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 355 additions and 357 deletions

41
Cargo.lock generated
View File

@ -1136,12 +1136,13 @@ dependencies = [
"criterion", "criterion",
"either", "either",
"ethereum-types", "ethereum-types",
"hex-literal",
"keccak-hash", "keccak-hash",
"log", "log",
"memmap", "memmap",
"parking_lot 0.10.0", "parking_lot 0.10.0",
"primal", "primal",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde_json", "serde_json",
"static_assertions", "static_assertions",
"tempdir", "tempdir",
@ -1293,7 +1294,7 @@ dependencies = [
"rlp", "rlp",
"rlp-derive", "rlp-derive",
"rlp_compress", "rlp_compress",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"tempdir", "tempdir",
"triehash-ethereum", "triehash-ethereum",
] ]
@ -1453,7 +1454,7 @@ dependencies = [
"price-info", "price-info",
"registrar", "registrar",
"rlp", "rlp",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -1492,6 +1493,7 @@ dependencies = [
"ethcore-io", "ethcore-io",
"ethcore-network", "ethcore-network",
"ethereum-types", "ethereum-types",
"hex-literal",
"igd", "igd",
"ipnetwork", "ipnetwork",
"keccak-hash", "keccak-hash",
@ -1507,7 +1509,6 @@ dependencies = [
"parking_lot 0.10.0", "parking_lot 0.10.0",
"rand 0.7.2", "rand 0.7.2",
"rlp", "rlp",
"rustc-hex 1.0.0",
"serde", "serde",
"serde_json", "serde_json",
"slab 0.2.0", "slab 0.2.0",
@ -1551,7 +1552,7 @@ dependencies = [
"registrar", "registrar",
"rlp", "rlp",
"rlp-derive", "rlp-derive",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -1636,7 +1637,7 @@ dependencies = [
"rand 0.7.2", "rand 0.7.2",
"rand_xorshift 0.2.0", "rand_xorshift 0.2.0",
"rlp", "rlp",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"snapshot", "snapshot",
"spec", "spec",
"trace-time", "trace-time",
@ -1677,7 +1678,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"ethereum-types", "ethereum-types",
"maplit", "maplit",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_json", "serde_json",
] ]
@ -1704,7 +1705,7 @@ dependencies = [
"panic_hook", "panic_hook",
"parity-crypto", "parity-crypto",
"parity-wordlist", "parity-wordlist",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_derive", "serde_derive",
"threadpool", "threadpool",
@ -1724,7 +1725,7 @@ dependencies = [
"parity-wordlist", "parity-wordlist",
"parking_lot 0.10.0", "parking_lot 0.10.0",
"rand 0.7.2", "rand 0.7.2",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -1747,7 +1748,7 @@ dependencies = [
"panic_hook", "panic_hook",
"parity-crypto", "parity-crypto",
"parking_lot 0.10.0", "parking_lot 0.10.0",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_derive", "serde_derive",
"tempdir", "tempdir",
@ -1768,7 +1769,6 @@ dependencies = [
"parity-bytes", "parity-bytes",
"parity-util-mem", "parity-util-mem",
"parking_lot 0.10.0", "parking_lot 0.10.0",
"rustc-hex 1.0.0",
"vm", "vm",
] ]
@ -1785,10 +1785,11 @@ dependencies = [
"ethereum-types", "ethereum-types",
"ethjson", "ethjson",
"evm", "evm",
"hex-literal",
"panic_hook", "panic_hook",
"parity-bytes", "parity-bytes",
"pod", "pod",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_json", "serde_json",
"spec", "spec",
@ -1809,6 +1810,7 @@ dependencies = [
"ethereum-types", "ethereum-types",
"evm", "evm",
"hash-db", "hash-db",
"hex-literal",
"keccak-hash", "keccak-hash",
"keccak-hasher 0.1.1", "keccak-hasher 0.1.1",
"kvdb", "kvdb",
@ -1818,7 +1820,6 @@ dependencies = [
"parity-crypto", "parity-crypto",
"patricia-trie-ethereum", "patricia-trie-ethereum",
"pod", "pod",
"rustc-hex 1.0.0",
"spec", "spec",
"trace", "trace",
"trie-db", "trie-db",
@ -2770,6 +2771,7 @@ dependencies = [
"ethereum-types", "ethereum-types",
"ethjson", "ethjson",
"evm", "evm",
"hex-literal",
"keccak-hash", "keccak-hash",
"log", "log",
"lru-cache", "lru-cache",
@ -2777,7 +2779,6 @@ dependencies = [
"parity-crypto", "parity-crypto",
"parking_lot 0.10.0", "parking_lot 0.10.0",
"rlp", "rlp",
"rustc-hex 1.0.0",
"spec", "spec",
"state-db", "state-db",
"tempdir", "tempdir",
@ -3298,7 +3299,7 @@ dependencies = [
"registrar", "registrar",
"rlp", "rlp",
"rpassword", "rpassword",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"rustc_version", "rustc_version",
"semver", "semver",
"serde", "serde",
@ -3336,7 +3337,7 @@ dependencies = [
"parking_lot 0.10.0", "parking_lot 0.10.0",
"rand 0.7.2", "rand 0.7.2",
"registrar", "registrar",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
] ]
[[package]] [[package]]
@ -3431,7 +3432,7 @@ dependencies = [
"rand 0.7.2", "rand 0.7.2",
"rand_xorshift 0.2.0", "rand_xorshift 0.2.0",
"rlp", "rlp",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"semver", "semver",
"serde", "serde",
"serde_derive", "serde_derive",
@ -3787,7 +3788,7 @@ dependencies = [
"parity-bytes", "parity-bytes",
"patricia-trie-ethereum", "patricia-trie-ethereum",
"rlp", "rlp",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"trie-db", "trie-db",
"triehash-ethereum", "triehash-ethereum",
@ -3926,7 +3927,7 @@ dependencies = [
"env_logger 0.5.13", "env_logger 0.5.13",
"ethereum-types", "ethereum-types",
"ethjson", "ethjson",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -5595,7 +5596,7 @@ dependencies = [
"parity-util-mem", "parity-util-mem",
"parking_lot 0.10.0", "parking_lot 0.10.0",
"rlp", "rlp",
"rustc-hex 1.0.0", "rustc-hex 2.1.0",
"spec", "spec",
"triehash-ethereum", "triehash-ethereum",
"unexpected", "unexpected",

View File

@ -66,7 +66,7 @@ regex = "1.0"
registrar = { path = "util/registrar" } registrar = { path = "util/registrar" }
rlp = "0.4.0" rlp = "0.4.0"
rpassword = "1.0" rpassword = "1.0"
rustc-hex = "1.0" rustc-hex = "2.1.0"
semver = "0.9" semver = "0.9"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"

View File

@ -11,7 +11,7 @@ ethkey = { path = "../" }
panic_hook = { path = "../../../util/panic-hook" } panic_hook = { path = "../../../util/panic-hook" }
parity-crypto = { version = "0.5.0", features = ["publickey"] } parity-crypto = { version = "0.5.0", features = ["publickey"] }
parity-wordlist= "1.3.1" parity-wordlist= "1.3.1"
rustc-hex = "1.0" rustc-hex = "2.1.0"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
threadpool = "1.7" threadpool = "1.7"

View File

@ -218,7 +218,7 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
(Random.generate(), None) (Random.generate(), None)
} }
} else if args.cmd_prefix { } else if args.cmd_prefix {
let prefix = args.arg_prefix.from_hex()?; let prefix: Vec<_> = args.arg_prefix.from_hex()?;
let brain = args.flag_brain; let brain = args.flag_brain;
in_threads(move || { in_threads(move || {
let iterations = 1024; let iterations = 1024;

View File

@ -12,7 +12,7 @@ ethkey = { path = "../ethkey" }
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
rustc-hex = "1.0" rustc-hex = "2.1.0"
tiny-keccak = "1.4" tiny-keccak = "1.4"
time = "0.1.34" time = "0.1.34"
parking_lot = "0.10.0" parking_lot = "0.10.0"

View File

@ -8,7 +8,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
docopt = "1.0" docopt = "1.0"
env_logger = "0.5" env_logger = "0.5"
num_cpus = "1.6" num_cpus = "1.6"
rustc-hex = "1.0" rustc-hex = "2.1.0"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
parking_lot = "0.10.0" parking_lot = "0.10.0"

View File

@ -43,7 +43,7 @@ impl<'a> Deserialize<'a> for Bytes {
impl Serialize for Bytes { impl Serialize for Bytes {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
serializer.serialize_str(&self.0.to_hex()) serializer.serialize_str(&self.0.to_hex::<String>())
} }
} }

View File

@ -49,8 +49,9 @@ macro_rules! impl_hash {
impl Serialize for $name { impl Serialize for $name {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer
serializer.serialize_str(&self.0.to_hex()) {
serializer.serialize_str(&self.0.to_hex::<String>())
} }
} }
@ -83,7 +84,7 @@ macro_rules! impl_hash {
type Err = Error; type Err = Error;
fn from_str(value: &str) -> Result<Self, Self::Err> { fn from_str(value: &str) -> Result<Self, Self::Err> {
match value.from_hex() { match value.from_hex::<Vec<u8>>() {
Ok(ref hex) if hex.len() == $size => { Ok(ref hex) if hex.len() == $size => {
let mut hash = [0u8; $size]; let mut hash = [0u8; $size];
hash.clone_from_slice(hex); hash.clone_from_slice(hex);

View File

@ -15,6 +15,7 @@
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>. // along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
//! Universaly unique identifier. //! Universaly unique identifier.
use std::{fmt, str}; use std::{fmt, str};
use rustc_hex::{ToHex, FromHex}; use rustc_hex::{ToHex, FromHex};
use serde::{Deserialize, Serialize, Deserializer, Serializer}; use serde::{Deserialize, Serialize, Deserializer, Serializer};
@ -62,7 +63,7 @@ impl fmt::Display for Uuid {
} }
fn copy_into(from: &str, into: &mut [u8]) -> Result<(), Error> { fn copy_into(from: &str, into: &mut [u8]) -> Result<(), Error> {
let from = from.from_hex().map_err(|_| Error::InvalidUuid)?; let from: Vec<u8> = from.from_hex().map_err(|_| Error::InvalidUuid)?;
if from.len() != into.len() { if from.len() != into.len() {
return Err(Error::InvalidUuid); return Err(Error::InvalidUuid);

View File

@ -17,7 +17,8 @@ static_assertions = "1.1.0"
[dev-dependencies] [dev-dependencies]
criterion = "0.3" criterion = "0.3"
rustc-hex = "1.0" hex-literal = "0.2.1"
rustc-hex = "2.1.0"
serde_json = "1.0" serde_json = "1.0"
tempdir = "0.3" tempdir = "0.3"

View File

@ -1,15 +1,17 @@
#[macro_use] #[macro_use]
extern crate criterion; extern crate criterion;
extern crate ethash;
extern crate rustc_hex; #[macro_use]
extern crate tempdir; extern crate hex_literal;
extern crate common_types; extern crate common_types;
extern crate ethash;
extern crate tempdir;
use criterion::Criterion; use criterion::Criterion;
use ethash::progpow; use ethash::progpow;
use tempdir::TempDir; use tempdir::TempDir;
use rustc_hex::FromHex;
use ethash::NodeCacheBuilder; use ethash::NodeCacheBuilder;
use ethash::compute::light_compute; use ethash::compute::light_compute;
use common_types::engines::OptimizeFor; use common_types::engines::OptimizeFor;
@ -18,7 +20,7 @@ fn bench_hashimoto_light(c: &mut Criterion) {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap(); let tempdir = TempDir::new("").unwrap();
let light = builder.light(&tempdir.path(), 1); let light = builder.light(&tempdir.path(), 1);
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap(); let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
let mut hash = [0; 32]; let mut hash = [0; 32];
hash.copy_from_slice(&h); hash.copy_from_slice(&h);
@ -32,7 +34,7 @@ fn bench_progpow_light(c: &mut Criterion) {
let tempdir = TempDir::new("").unwrap(); let tempdir = TempDir::new("").unwrap();
let cache = builder.new_cache(tempdir.into_path(), 0); let cache = builder.new_cache(tempdir.into_path(), 0);
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap(); let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
let mut hash = [0; 32]; let mut hash = [0; 32];
hash.copy_from_slice(&h); hash.copy_from_slice(&h);
@ -56,7 +58,7 @@ fn bench_progpow_optimal_light(c: &mut Criterion) {
let cache = builder.new_cache(tempdir.into_path(), 0); let cache = builder.new_cache(tempdir.into_path(), 0);
let c_dag = progpow::generate_cdag(cache.as_ref()); let c_dag = progpow::generate_cdag(cache.as_ref());
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap(); let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
let mut hash = [0; 32]; let mut hash = [0; 32];
hash.copy_from_slice(&h); hash.copy_from_slice(&h);

View File

@ -26,6 +26,10 @@ extern crate log;
#[macro_use] #[macro_use]
extern crate static_assertions; extern crate static_assertions;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)] #[cfg(test)]
extern crate rustc_hex; extern crate rustc_hex;
@ -35,6 +39,7 @@ extern crate serde_json;
#[cfg(test)] #[cfg(test)]
extern crate tempdir; extern crate tempdir;
#[cfg(feature = "bench")] #[cfg(feature = "bench")]
pub mod compute; pub mod compute;
#[cfg(not(feature = "bench"))] #[cfg(not(feature = "bench"))]

View File

@ -431,7 +431,7 @@ mod test {
use super::*; use super::*;
fn h256(hex: &str) -> H256 { fn h256(hex: &str) -> H256 {
let bytes = FromHex::from_hex(hex).unwrap(); let bytes: Vec<u8> = FromHex::from_hex(hex).unwrap();
let mut res = [0; 32]; let mut res = [0; 32];
res.copy_from_slice(&bytes); res.copy_from_slice(&bytes);
res res
@ -549,8 +549,8 @@ mod test {
&c_dag, &c_dag,
); );
let expected_digest = FromHex::from_hex("b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02").unwrap(); let expected_digest = hex!("b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02");
let expected_result = FromHex::from_hex("f4ac202715ded4136e72887c39e63a4738331c57fd9eb79f6ec421c281aa8743").unwrap(); let expected_result = hex!("f4ac202715ded4136e72887c39e63a4738331c57fd9eb79f6ec421c281aa8743");
assert_eq!( assert_eq!(
digest.to_vec(), digest.to_vec(),

View File

@ -30,6 +30,6 @@ triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" }
[dev-dependencies] [dev-dependencies]
env_logger = "0.5" env_logger = "0.5"
parity-crypto = { version = "0.5.0", features = ["publickey"] } parity-crypto = { version = "0.5.0", features = ["publickey"] }
rustc-hex = "1.0" rustc-hex = "2.1.0"
tempdir = "0.3" tempdir = "0.3"
kvdb-memorydb = "0.4.0" kvdb-memorydb = "0.4.0"

View File

@ -36,9 +36,9 @@ call-contract = { package = "ethcore-call-contract", path = "../../call-contract
engine = { path = "../../engine", features = ["test-helpers"] } engine = { path = "../../engine", features = ["test-helpers"] }
env_logger = "0.6.2" env_logger = "0.6.2"
ethcore = { path = "../..", features = ["test-helpers"] } ethcore = { path = "../..", features = ["test-helpers"] }
parity-crypto = { version = "0.5.0", features = ["publickey"] } rustc-hex = "2.1.0"
keccak-hash = "0.4.0" keccak-hash = "0.4.0"
rustc-hex = "1.0" parity-crypto = { version = "0.5.0", features = ["publickey"] }
spec = { path = "../../spec" } spec = { path = "../../spec" }
[features] [features]

View File

@ -17,9 +17,8 @@ parking_lot = "0.10.0"
memory-cache = { path = "../../util/memory-cache" } memory-cache = { path = "../../util/memory-cache" }
[dev-dependencies] [dev-dependencies]
rustc-hex = "1.0"
criterion = "0.3" criterion = "0.3"
hex-literal = "0.2.0" hex-literal = "0.2.1"
[features] [features]
evm-debug = [] evm-debug = []

View File

@ -18,26 +18,29 @@
#[macro_use] #[macro_use]
extern crate criterion; extern crate criterion;
#[macro_use]
extern crate hex_literal;
extern crate bit_set; extern crate bit_set;
extern crate ethereum_types; extern crate ethereum_types;
extern crate parking_lot;
extern crate parity_util_mem as mem;
extern crate vm;
extern crate evm; extern crate evm;
extern crate keccak_hash as hash; extern crate keccak_hash as hash;
extern crate memory_cache; extern crate memory_cache;
extern crate parity_bytes as bytes; extern crate parity_bytes as bytes;
extern crate rustc_hex; extern crate parity_util_mem as mem;
extern crate parking_lot;
extern crate vm;
use criterion::{Criterion, Bencher, black_box};
use std::str::FromStr; use std::str::FromStr;
use std::sync::Arc; use std::sync::Arc;
use criterion::{Criterion, Bencher, black_box};
use bytes::Bytes; use bytes::Bytes;
use ethereum_types::{U256, Address}; use ethereum_types::{U256, Address};
use vm::{ActionParams, Result, GasLeft, Ext}; use vm::{ActionParams, Result, GasLeft, Ext};
use vm::tests::FakeExt; use vm::tests::FakeExt;
use evm::Factory; use evm::Factory;
use rustc_hex::FromHex;
criterion_group!( criterion_group!(
basic, basic,
@ -91,9 +94,7 @@ fn simple_loop_log0(gas: U256, b: &mut Bencher) {
let mut ext = FakeExt::new(); let mut ext = FakeExt::new();
let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
let code = black_box( let code = black_box(hex!("62ffffff5b600190036000600fa0600357").to_vec());
"62ffffff5b600190036000600fa0600357".from_hex().unwrap()
);
b.iter(|| { b.iter(|| {
let mut params = ActionParams::default(); let mut params = ActionParams::default();
@ -109,7 +110,7 @@ fn simple_loop_log0(gas: U256, b: &mut Bencher) {
fn mem_gas_calculation_same_usize(b: &mut Criterion) { fn mem_gas_calculation_same_usize(b: &mut Criterion) {
b.bench_function("mem_gas_calculation_same_usize", |b| { b.bench_function("mem_gas_calculation_same_usize", |b| {
mem_gas_calculation_same(U256::from(::std::usize::MAX), b); mem_gas_calculation_same(U256::from(std::usize::MAX), b);
}); });
} }
@ -127,7 +128,7 @@ fn mem_gas_calculation_same(gas: U256, b: &mut Bencher) {
b.iter(|| { b.iter(|| {
let code = black_box( let code = black_box(
"6110006001556001546000555b610fff805560016000540380600055600c57".from_hex().unwrap() hex!("6110006001556001546000555b610fff805560016000540380600055600c57").to_vec()
); );
let mut params = ActionParams::default(); let mut params = ActionParams::default();
@ -143,7 +144,7 @@ fn mem_gas_calculation_same(gas: U256, b: &mut Bencher) {
fn mem_gas_calculation_increasing_usize(b: &mut Criterion) { fn mem_gas_calculation_increasing_usize(b: &mut Criterion) {
b.bench_function("mem_gas_calculation_increasing_usize", |b| { b.bench_function("mem_gas_calculation_increasing_usize", |b| {
mem_gas_calculation_increasing(U256::from(::std::usize::MAX), b); mem_gas_calculation_increasing(U256::from(std::usize::MAX), b);
}); });
} }
@ -161,7 +162,7 @@ fn mem_gas_calculation_increasing(gas: U256, b: &mut Bencher) {
b.iter(|| { b.iter(|| {
let code = black_box( let code = black_box(
"6110006001556001546000555b610fff60005401805560016000540380600055600c57".from_hex().unwrap() hex!("6110006001556001546000555b610fff60005401805560016000540380600055600c57").to_vec()
); );
let mut params = ActionParams::default(); let mut params = ActionParams::default();
@ -184,7 +185,7 @@ fn blockhash_mulmod_small(b: &mut Criterion) {
b.iter(|| { b.iter(|| {
let code = black_box( let code = black_box(
"6080604052348015600f57600080fd5b5060005a90505b60c881111560de5760017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8009505a90506016565b506035806100ed6000396000f3fe6080604052600080fdfea165627a7a72305820bde4a0ac6d0fac28fc879244baf8a6a0eda514bc95fb7ecbcaaebf2556e2687c0029".from_hex().unwrap() hex!("6080604052348015600f57600080fd5b5060005a90505b60c881111560de5760017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8009505a90506016565b506035806100ed6000396000f3fe6080604052600080fdfea165627a7a72305820bde4a0ac6d0fac28fc879244baf8a6a0eda514bc95fb7ecbcaaebf2556e2687c0029").to_vec()
); );
let mut params = ActionParams::default(); let mut params = ActionParams::default();
@ -208,7 +209,7 @@ fn blockhash_mulmod_large(b: &mut Criterion) {
b.iter(|| { b.iter(|| {
let code = black_box( let code = black_box(
"608060405234801561001057600080fd5b5060005a90505b60c8811115610177577efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009505a9050610017565b506035806101866000396000f3fe6080604052600080fdfea165627a7a72305820dcaec306f67bb96f3044fff25c9af2ec66f01d0954d0656964f046f42f2780670029".from_hex().unwrap() hex!("608060405234801561001057600080fd5b5060005a90505b60c8811115610177577efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009505a9050610017565b506035806101866000396000f3fe6080604052600080fdfea165627a7a72305820dcaec306f67bb96f3044fff25c9af2ec66f01d0954d0656964f046f42f2780670029").to_vec()
); );
let mut params = ActionParams::default(); let mut params = ActionParams::default();
@ -248,56 +249,56 @@ fn run_code(b: &mut Bencher, code: Bytes) {
/// Compute mulmod(U256::MAX, U256::MAX, 1) 500 times. /// Compute mulmod(U256::MAX, U256::MAX, 1) 500 times.
fn mulmod1_500(b: &mut Criterion) { fn mulmod1_500(b: &mut Criterion) {
b.bench_function("mulmod modulo 1, 500 times", |b| { b.bench_function("mulmod modulo 1, 500 times", |b| {
run_code(b, "6101f45b6001900360017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b6001900360017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
/// Compute mulmod(U256::MAX, U256::MAX, 1) 1000 times. /// Compute mulmod(U256::MAX, U256::MAX, 1) 1000 times.
fn mulmod1_1000(b: &mut Criterion) { fn mulmod1_1000(b: &mut Criterion) {
b.bench_function("mulmod modulo 1, 1000 times", |b| { b.bench_function("mulmod modulo 1, 1000 times", |b| {
run_code(b, "6103e85b6001900360017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b6001900360017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
/// Compute mulmod(U256::MAX, U256::MAX, 5) 500 times. /// Compute mulmod(U256::MAX, U256::MAX, 5) 500 times.
fn mulmod5_500(b: &mut Criterion) { fn mulmod5_500(b: &mut Criterion) {
b.bench_function("mulmod modulo 5, 500 times", |b| { b.bench_function("mulmod modulo 5, 500 times", |b| {
run_code(b, "6101f45b6001900360057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b6001900360057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
/// Compute mulmod(U256::MAX, U256::MAX, 5) 1000 times. /// Compute mulmod(U256::MAX, U256::MAX, 5) 1000 times.
fn mulmod5_1000(b: &mut Criterion) { fn mulmod5_1000(b: &mut Criterion) {
b.bench_function("mulmod modulo 5, 1000 times", |b| { b.bench_function("mulmod modulo 5, 1000 times", |b| {
run_code(b, "6103e85b6001900360057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b6001900360057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
/// Compute mulmod(U256::MAX, U256::MAX, 11) 500 times. /// Compute mulmod(U256::MAX, U256::MAX, 11) 500 times.
fn mulmod11_500(b: &mut Criterion) { fn mulmod11_500(b: &mut Criterion) {
b.bench_function("mulmod modulo 11, 500 times", |b| { b.bench_function("mulmod modulo 11, 500 times", |b| {
run_code(b, "6101f45b60019003600b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b60019003600b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
/// Compute mulmod(U256::MAX, U256::MAX, 11) 1000 times. /// Compute mulmod(U256::MAX, U256::MAX, 11) 1000 times.
fn mulmod11_1000(b: &mut Criterion) { fn mulmod11_1000(b: &mut Criterion) {
b.bench_function("mulmod modulo 11, 1000 times", |b| { b.bench_function("mulmod modulo 11, 1000 times", |b| {
run_code(b, "6103e85b60019003600b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b60019003600b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
/// Compute mulmod(U256::MAX, U256::MAX, 0x58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd591) 500 times. /// Compute mulmod(U256::MAX, U256::MAX, 0x58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd591) 500 times.
fn mulmod_big_500(b: &mut Criterion) { fn mulmod_big_500(b: &mut Criterion) {
b.bench_function("mulmod modulo random 256-bit number, 500 times", |b| { b.bench_function("mulmod modulo random 256-bit number, 500 times", |b| {
run_code(b, "6101f45b600190037f58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd5917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037f58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd5917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
/// Compute mulmod(U256::MAX, U256::MAX, 0x58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd591) 1000 times. /// Compute mulmod(U256::MAX, U256::MAX, 0x58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd591) 1000 times.
fn mulmod_big_1000(b: &mut Criterion) { fn mulmod_big_1000(b: &mut Criterion) {
b.bench_function("mulmod modulo random 256-bit number, 1000 times", |b| { b.bench_function("mulmod modulo random 256-bit number, 1000 times", |b| {
run_code(b, "6103e85b600190037f58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd5917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037f58bca9711298bc76cd73f173352c8bc1d1640f977c1ec9a849dfde6fdbfbd5917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095080600357").to_vec());
}); });
} }
@ -321,97 +322,97 @@ fn mulmod_big_1000(b: &mut Criterion) {
/// ``` /// ```
fn mulmod500(b: &mut Criterion) { fn mulmod500(b: &mut Criterion) {
b.bench_function("mulmod randomly generated ints, 500 times", |b| { b.bench_function("mulmod randomly generated ints, 500 times", |b| {
run_code(b, "6101f45b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca095080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca095080600357").to_vec());
}); });
} }
/// Compute mulmod(a, b, c) for random 256-bit a, b and c. Iterate 1000 times. /// Compute mulmod(a, b, c) for random 256-bit a, b and c. Iterate 1000 times.
fn mulmod1000(b: &mut Criterion) { fn mulmod1000(b: &mut Criterion) {
b.bench_function("mulmod randomly generated ints, 1000 times", |b| { b.bench_function("mulmod randomly generated ints, 1000 times", |b| {
run_code(b, "6103e85b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca095080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca095080600357").to_vec());
}); });
} }
/// Compute addmod(a, b, c) for random 256-bit a, b and c. Iterate 500 times. /// Compute addmod(a, b, c) for random 256-bit a, b and c. Iterate 500 times.
fn addmod500(b: &mut Criterion) { fn addmod500(b: &mut Criterion) {
b.bench_function("addmod randomly generated ints, 500 times", |b| { b.bench_function("addmod randomly generated ints, 500 times", |b| {
run_code(b, "6101f45b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca085080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca085080600357").to_vec());
}); });
} }
/// Compute addmod(a, b, c) for random 256-bit a, b and c. Iterate 1000 times. /// Compute addmod(a, b, c) for random 256-bit a, b and c. Iterate 1000 times.
fn addmod1000(b: &mut Criterion) { fn addmod1000(b: &mut Criterion) {
b.bench_function("addmod randomly generated ints, 1000 times", |b| { b.bench_function("addmod randomly generated ints, 1000 times", |b| {
run_code(b, "6103e85b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca085080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037f5ed6db9489224124a1a4110ec8bec8b01369c8b549a4b8c4388a1796dc35a9377fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca085080600357").to_vec());
}); });
} }
/// Compute mul(a, b) for random 256-bit a and b. Iterate 500 times. /// Compute mul(a, b) for random 256-bit a and b. Iterate 500 times.
fn mul500(b: &mut Criterion) { fn mul500(b: &mut Criterion) {
b.bench_function("mul randomly generated ints, 500 times", |b| { b.bench_function("mul randomly generated ints, 500 times", |b| {
run_code(b, "6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca025080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca025080600357").to_vec());
}); });
} }
/// Compute mul(a, b) for random 256-bit a and b. Iterate 1000 times. /// Compute mul(a, b) for random 256-bit a and b. Iterate 1000 times.
fn mul1000(b: &mut Criterion) { fn mul1000(b: &mut Criterion) {
b.bench_function("mul randomly generated ints, 1000 times", |b| { b.bench_function("mul randomly generated ints, 1000 times", |b| {
run_code(b, "6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca025080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca025080600357").to_vec());
}); });
} }
/// Compute div(a, b) for random 256-bit a and b. Iterate 500 times. /// Compute div(a, b) for random 256-bit a and b. Iterate 500 times.
fn div500(b: &mut Criterion) { fn div500(b: &mut Criterion) {
b.bench_function("div randomly generated ints, 500 times", |b| { b.bench_function("div randomly generated ints, 500 times", |b| {
run_code(b, "6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca045080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca045080600357").to_vec());
}); });
} }
/// Compute div(a, b) for random 256-bit a and b. Iterate 1000 times. /// Compute div(a, b) for random 256-bit a and b. Iterate 1000 times.
fn div1000(b: &mut Criterion) { fn div1000(b: &mut Criterion) {
b.bench_function("div randomly generated ints, 1000 times", |b| { b.bench_function("div randomly generated ints, 1000 times", |b| {
run_code(b, "6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca045080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca045080600357").to_vec());
}); });
} }
/// Compute sdiv(a, b) for random 256-bit a and b. Iterate 500 times. /// Compute sdiv(a, b) for random 256-bit a and b. Iterate 500 times.
fn sdiv500(b: &mut Criterion) { fn sdiv500(b: &mut Criterion) {
b.bench_function("sdiv randomly generated ints, 500 times", |b| { b.bench_function("sdiv randomly generated ints, 500 times", |b| {
run_code(b, "6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca055080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca055080600357").to_vec());
}); });
} }
/// Compute sdiv(a, b) for random 256-bit a and b. Iterate 1000 times. /// Compute sdiv(a, b) for random 256-bit a and b. Iterate 1000 times.
fn sdiv1000(b: &mut Criterion) { fn sdiv1000(b: &mut Criterion) {
b.bench_function("sdiv randomly generated ints, 1000 times", |b| { b.bench_function("sdiv randomly generated ints, 1000 times", |b| {
run_code(b, "6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca055080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca055080600357").to_vec());
}); });
} }
/// Compute mod(a, b) for random 256-bit a and b. Iterate 500 times. /// Compute mod(a, b) for random 256-bit a and b. Iterate 500 times.
fn mod500(b: &mut Criterion) { fn mod500(b: &mut Criterion) {
b.bench_function("mod randomly generated ints, 500 times", |b| { b.bench_function("mod randomly generated ints, 500 times", |b| {
run_code(b, "6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca065080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca065080600357").to_vec());
}); });
} }
/// Compute mod(a, b) for random 256-bit a and b. Iterate 1000 times. /// Compute mod(a, b) for random 256-bit a and b. Iterate 1000 times.
fn mod1000(b: &mut Criterion) { fn mod1000(b: &mut Criterion) {
b.bench_function("mod randomly generated ints, 1000 times", |b| { b.bench_function("mod randomly generated ints, 1000 times", |b| {
run_code(b, "6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca065080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca065080600357").to_vec());
}); });
} }
/// Compute smod(a, b) for random 256-bit a and b. Iterate 500 times. /// Compute smod(a, b) for random 256-bit a and b. Iterate 500 times.
fn smod500(b: &mut Criterion) { fn smod500(b: &mut Criterion) {
b.bench_function("smod randomly generated ints, 500 times", |b| { b.bench_function("smod randomly generated ints, 500 times", |b| {
run_code(b, "6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca075080600357".from_hex().unwrap()); run_code(b, hex!("6101f45b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca075080600357").to_vec());
}); });
} }
/// Compute smod(a, b) for random 256-bit a and b. Iterate 1000 times. /// Compute smod(a, b) for random 256-bit a and b. Iterate 1000 times.
fn smod1000(b: &mut Criterion) { fn smod1000(b: &mut Criterion) {
b.bench_function("smod randomly generated ints, 1000 times", |b| { b.bench_function("smod randomly generated ints, 1000 times", |b| {
run_code(b, "6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca075080600357".from_hex().unwrap()); run_code(b, hex!("6103e85b600190037fb8e0a2b6b1587398c28bf9e9d34ea24ba34df308eec2acedca363b2fce2c25db7fcc2de1f8ec6cc9a24ed2c48b856637f9e45f0a5feee21a196aa42a290ef454ca075080600357").to_vec());
}); });
} }

View File

@ -31,7 +31,6 @@ use hash::keccak;
use bytes::Bytes; use bytes::Bytes;
use ethereum_types::{U256, U512, H256, Address, BigEndianHash}; use ethereum_types::{U256, U512, H256, Address, BigEndianHash};
use vm::{ use vm::{
self, ActionParams, ParamsType, ActionValue, ActionType, MessageCallResult, self, ActionParams, ParamsType, ActionValue, ActionType, MessageCallResult,
ContractCreateResult, CreateContractAddress, ReturnData, GasLeft, Schedule, ContractCreateResult, CreateContractAddress, ReturnData, GasLeft, Schedule,
@ -1221,7 +1220,6 @@ fn address_to_u256(value: Address) -> U256 {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::sync::Arc; use std::sync::Arc;
use rustc_hex::FromHex;
use factory::Factory; use factory::Factory;
use vm::{self, Exec, ActionParams, ActionValue}; use vm::{self, Exec, ActionParams, ActionValue};
use vm::tests::{FakeExt, test_finalize}; use vm::tests::{FakeExt, test_finalize};
@ -1233,7 +1231,7 @@ mod tests {
#[test] #[test]
fn should_not_fail_on_tracing_mem() { fn should_not_fail_on_tracing_mem() {
let code = "7feeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006000527faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020526000620f120660406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f1600055".from_hex().unwrap(); let code = hex!("7feeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006000527faaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa6020526000620f120660406000601773945304eb96065b2a98b57a48a06ae28d285a71b56101f4f1600055").to_vec();
let mut params = ActionParams::default(); let mut params = ActionParams::default();
params.address = Address::from_low_u64_be(5); params.address = Address::from_low_u64_be(5);
@ -1256,7 +1254,7 @@ mod tests {
#[test] #[test]
fn should_not_overflow_returndata() { fn should_not_overflow_returndata() {
let code = "6001600160000360003e00".from_hex().unwrap(); let code = hex!("6001600160000360003e00").to_vec();
let mut params = ActionParams::default(); let mut params = ActionParams::default();
params.address = Address::from_low_u64_be(5); params.address = Address::from_low_u64_be(5);

View File

@ -101,9 +101,8 @@ impl Default for SharedCache {
#[test] #[test]
fn test_find_jump_destinations() { fn test_find_jump_destinations() {
use rustc_hex::FromHex;
// given // given
let code = "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b01600055".from_hex().unwrap(); let code = hex!("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b01600055");
// when // when
let valid_jump_destinations = SharedCache::find_jump_destinations(&code); let valid_jump_destinations = SharedCache::find_jump_destinations(&code);

View File

@ -32,8 +32,7 @@ extern crate lazy_static;
extern crate log; extern crate log;
#[cfg(test)] #[cfg(test)]
extern crate rustc_hex; #[macro_use]
#[cfg(test)]
extern crate hex_literal; extern crate hex_literal;
pub mod evm; pub mod evm;

View File

@ -28,7 +28,7 @@ parity-crypto = { version = "0.5.0", features = ["publickey"] }
evm = { path = "../evm" } evm = { path = "../evm" }
keccak-hash = "0.4.0" keccak-hash = "0.4.0"
pod = { path = "../pod" } pod = { path = "../pod" }
rustc-hex = "1.0" hex-literal = "0.2.1"
spec = { path = "../spec" } spec = { path = "../spec" }
trie-db = "0.20.0" trie-db = "0.20.0"
ethtrie = { package = "patricia-trie-ethereum", path = "../../util/patricia-trie-ethereum" } ethtrie = { package = "patricia-trie-ethereum", path = "../../util/patricia-trie-ethereum" }

View File

@ -266,17 +266,13 @@ mod tests {
use account_state::{Account, CleanupMode}; use account_state::{Account, CleanupMode};
use common_types::transaction::*; use common_types::transaction::*;
use ethereum_types::{H256, U256, Address, BigEndianHash};
use ethcore::test_helpers::{get_temp_state, get_temp_state_db};
use hex_literal::hex;
use keccak_hash::{keccak, KECCAK_NULL_RLP}; use keccak_hash::{keccak, KECCAK_NULL_RLP};
use parity_crypto::publickey::Secret; use parity_crypto::publickey::Secret;
use ethereum_types::{H256, U256, Address, BigEndianHash};
use ethcore::{
test_helpers::{get_temp_state, get_temp_state_db}
};
use ethtrie;
use machine::Machine; use machine::Machine;
use pod::{self, PodAccount, PodState}; use pod::{PodAccount, PodState};
use rustc_hex::FromHex;
use spec;
use ::trace::{FlatTrace, TraceError, trace}; use ::trace::{FlatTrace, TraceError, trace};
use trie_db::{TrieFactory, TrieSpec}; use trie_db::{TrieFactory, TrieSpec};
use vm::EnvInfo; use vm::EnvInfo;
@ -307,7 +303,7 @@ mod tests {
gas: 100_000.into(), gas: 100_000.into(),
action: Action::Create, action: Action::Create,
value: 100.into(), value: 100.into(),
data: FromHex::from_hex("601080600c6000396000f3006000355415600957005b60203560003555").unwrap(), data: hex!("601080600c6000396000f3006000355415600957005b60203560003555").to_vec(),
}.sign(&secret(), None); }.sign(&secret(), None);
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
@ -366,7 +362,7 @@ mod tests {
gas: 100_000.into(), gas: 100_000.into(),
action: Action::Create, action: Action::Create,
value: 100.into(), value: 100.into(),
data: FromHex::from_hex("5b600056").unwrap(), data: hex!("5b600056").to_vec(),
}.sign(&secret(), None); }.sign(&secret(), None);
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
@ -406,7 +402,7 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("6000").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("6000").to_vec()).unwrap();
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -530,7 +526,7 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("600060006000600060006001610be0f1").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("600060006000600060006001610be0f1").to_vec()).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -572,8 +568,8 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("60006000600060006000600b611000f2").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("60006000600060006000600b611000f2").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xb), FromHex::from_hex("6000").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xb), hex!("6000").to_vec()).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -631,8 +627,8 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("6000600060006000600b618000f4").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("6000600060006000600b618000f4").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xb), FromHex::from_hex("60056000526001601ff3").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xb), hex!("60056000526001601ff3").to_vec()).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -689,7 +685,7 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("5b600056").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("5b600056").to_vec()).unwrap();
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -728,8 +724,8 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("60006000600060006000600b602b5a03f1").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xb), FromHex::from_hex("6000").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xb), hex!("6000").to_vec()).unwrap();
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
@ -787,7 +783,7 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("60006000600060006045600b6000f1").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("60006000600060006045600b6000f1").to_vec()).unwrap();
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -841,7 +837,7 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("600060006000600060ff600b6000f1").unwrap()).unwrap(); // not enough funds. state.init_code(&Address::from_low_u64_be(0xa), hex!("600060006000600060ff600b6000f1").to_vec()).unwrap(); // not enough funds.
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -883,8 +879,8 @@ mod tests {
data: vec![],//600480600b6000396000f35b600056 data: vec![],//600480600b6000396000f35b600056
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("60006000600060006000600b602b5a03f1").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xb), FromHex::from_hex("5b600056").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xb), hex!("5b600056").to_vec()).unwrap();
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -938,9 +934,9 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("60006000600060006000600b602b5a03f1").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xb), FromHex::from_hex("60006000600060006000600c602b5a03f1").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xb), hex!("60006000600060006000600c602b5a03f1").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xc), FromHex::from_hex("6000").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xc), hex!("6000").to_vec()).unwrap();
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
let expected_trace = vec![FlatTrace { let expected_trace = vec![FlatTrace {
@ -1012,9 +1008,9 @@ mod tests {
data: vec![],//600480600b6000396000f35b600056 data: vec![],//600480600b6000396000f35b600056
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("60006000600060006000600b602b5a03f1").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xb), FromHex::from_hex("60006000600060006000600c602b5a03f1505b601256").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xb), hex!("60006000600060006000600c602b5a03f1505b601256").to_vec()).unwrap();
state.init_code(&Address::from_low_u64_be(0xc), FromHex::from_hex("6000").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xc), hex!("6000").to_vec()).unwrap();
state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &(100.into()), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();
@ -1084,7 +1080,7 @@ mod tests {
data: vec![], data: vec![],
}.sign(&secret(), None); }.sign(&secret(), None);
state.init_code(&Address::from_low_u64_be(0xa), FromHex::from_hex("73000000000000000000000000000000000000000bff").unwrap()).unwrap(); state.init_code(&Address::from_low_u64_be(0xa), hex!("73000000000000000000000000000000000000000bff").to_vec()).unwrap();
state.add_balance(&Address::from_low_u64_be(0xa), &50.into(), CleanupMode::NoEmpty).unwrap(); state.add_balance(&Address::from_low_u64_be(0xa), &50.into(), CleanupMode::NoEmpty).unwrap();
state.add_balance(&t.sender(), &100.into(), CleanupMode::NoEmpty).unwrap(); state.add_balance(&t.sender(), &100.into(), CleanupMode::NoEmpty).unwrap();
let result = state.apply(&info, &machine, &t, true).unwrap(); let result = state.apply(&info, &machine, &t, true).unwrap();

View File

@ -44,7 +44,7 @@ ethcore = { path = "../", features = ["test-helpers"] }
ethcore-io = { path = "../../util/io" } ethcore-io = { path = "../../util/io" }
ethjson = { path = "../../json" } ethjson = { path = "../../json" }
parity-crypto = { version = "0.5.0", features = ["publickey"] } parity-crypto = { version = "0.5.0", features = ["publickey"] }
rustc-hex = "1.0" hex-literal = "0.2.1"
spec = { path = "../spec" } spec = { path = "../spec" }
tempdir = "0.3" tempdir = "0.3"
trace = { path = "../trace" } trace = { path = "../trace" }

View File

@ -1223,16 +1223,15 @@ mod tests {
collections::HashSet, collections::HashSet,
}; };
use rustc_hex::FromHex;
use ethereum_types::{H256, U256, U512, Address, BigEndianHash};
use account_state::CleanupMode; use account_state::CleanupMode;
use common_types::{ use common_types::{
errors::ExecutionError, errors::ExecutionError,
transaction::{Action, Transaction}, transaction::{Action, Transaction},
}; };
use parity_crypto::publickey::{Generator, Random}; use ethereum_types::{H256, U256, U512, Address, BigEndianHash};
use evm::{Factory, evm_test, evm_test_ignore}; use evm::{Factory, evm_test, evm_test_ignore};
use hex_literal::hex;
use parity_crypto::publickey::{Generator, Random};
use vm::{ActionParams, ActionValue, EnvInfo, CreateContractAddress}; use vm::{ActionParams, ActionValue, EnvInfo, CreateContractAddress};
use ::trace::{ use ::trace::{
trace, trace,
@ -1309,7 +1308,7 @@ mod tests {
params.address = address.clone(); params.address = address.clone();
params.sender = sender.clone(); params.sender = sender.clone();
params.gas = U256::from(100_000); params.gas = U256::from(100_000);
params.code = Some(Arc::new("3331600055".from_hex().unwrap())); params.code = Some(Arc::new(hex!("3331600055").to_vec()));
params.value = ActionValue::Transfer(U256::from(0x7)); params.value = ActionValue::Transfer(U256::from(0x7));
let mut state = get_temp_state_with_factory(factory); let mut state = get_temp_state_with_factory(factory);
state.add_balance(&sender, &U256::from(0x100u64), CleanupMode::NoEmpty).unwrap(); state.add_balance(&sender, &U256::from(0x100u64), CleanupMode::NoEmpty).unwrap();
@ -1356,7 +1355,8 @@ mod tests {
// 60 00 - push 0 // 60 00 - push 0
// f3 - return // f3 - return
let code = "7c601080600c6000396000f3006000355415600957005b60203560003555600052601d60036017f0600055".from_hex().unwrap(); let code =
hex!("7c601080600c6000396000f3006000355415600957005b60203560003555600052601d60036017f0600055").to_vec();
let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
@ -1399,7 +1399,7 @@ mod tests {
// 61 ffff - push fff gas // 61 ffff - push fff gas
// f1 - CALL // f1 - CALL
let code = "60006000600060006001600361fffff1".from_hex().unwrap(); let code = hex!("60006000600060006001600361fffff1").to_vec();
let sender = Address::from_str("4444444444444444444444444444444444444444").unwrap(); let sender = Address::from_str("4444444444444444444444444444444444444444").unwrap();
let address = Address::from_str("5555555555555555555555555555555555555555").unwrap(); let address = Address::from_str("5555555555555555555555555555555555555555").unwrap();
@ -1481,7 +1481,7 @@ mod tests {
// 60 00 - push 0 // 60 00 - push 0
// f3 - return // f3 - return
let code = "7c601080600c6000396000f3006000355415600957005b60203560003555600052601d60036017f0600055".from_hex().unwrap(); let code = hex!("7c601080600c6000396000f3006000355415600957005b60203560003555600052601d60036017f0600055").to_vec();
let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
@ -1600,7 +1600,7 @@ mod tests {
// 60 00 // 60 00
// fd - revert // fd - revert
let code = "6460016000fd6000526005601b6017f0600055".from_hex().unwrap(); let code = hex!("6460016000fd6000526005601b6017f0600055").to_vec();
let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
@ -1673,7 +1673,7 @@ mod tests {
// 60 00 - push 0 // 60 00 - push 0
// f3 - return // f3 - return
let code = "601080600c6000396000f3006000355415600957005b60203560003555".from_hex().unwrap(); let code = hex!("601080600c6000396000f3006000355415600957005b60203560003555").to_vec();
let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
@ -1762,7 +1762,7 @@ mod tests {
// 60 00 - push 0 // 60 00 - push 0
// f3 - return // f3 - return
let code = "7c601080600c6000396000f3006000355415600957005b60203560003555600052601d600360e6f0600055".from_hex().unwrap(); let code = hex!("7c601080600c6000396000f3006000355415600957005b60203560003555600052601d600360e6f0600055").to_vec();
let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
@ -1815,7 +1815,7 @@ mod tests {
// 60 00 - push 0 // 60 00 - push 0
// f3 - return // f3 - return
let code = "7c601080600c6000396000f3006000355415600957005b60203560003555600052601d60036017f0".from_hex().unwrap(); let code = hex!("7c601080600c6000396000f3006000355415600957005b60203560003555600052601d60036017f0").to_vec();
let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
@ -1858,7 +1858,7 @@ mod tests {
// 58 - get PC // 58 - get PC
// 55 - sstore // 55 - sstore
let code_a = "6000600060006000601873945304eb96065b2a98b57a48a06ae28d285a71b56103e8f15855".from_hex().unwrap(); let code_a = hex!("6000600060006000601873945304eb96065b2a98b57a48a06ae28d285a71b56103e8f15855").to_vec();
// 60 00 - push 0 // 60 00 - push 0
// 60 00 - push 0 // 60 00 - push 0
@ -1872,7 +1872,7 @@ mod tests {
// 01 - add // 01 - add
// 58 - get PC // 58 - get PC
// 55 - sstore // 55 - sstore
let code_b = "60006000600060006017730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66101f4f16001015855".from_hex().unwrap(); let code_b = hex!("60006000600060006017730f572e5295c57f15886f9b263e2f6d2d6c7b5ec66101f4f16001015855").to_vec();
let address_a = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); let address_a = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
let address_b = Address::from_str("945304eb96065b2a98b57a48a06ae28d285a71b5" ).unwrap(); let address_b = Address::from_str("945304eb96065b2a98b57a48a06ae28d285a71b5" ).unwrap();
@ -1933,7 +1933,7 @@ mod tests {
// 60 01 - push 1 // 60 01 - push 1
// 55 - sstore // 55 - sstore
let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let code = "600160005401600055600060006000600060003060e05a03f1600155".from_hex().unwrap(); let code = hex!("600160005401600055600060006000600060003060e05a03f1600155").to_vec();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
let mut params = ActionParams::default(); let mut params = ActionParams::default();
params.address = address.clone(); params.address = address.clone();
@ -1964,7 +1964,7 @@ mod tests {
let t = Transaction { let t = Transaction {
action: Action::Create, action: Action::Create,
value: U256::from(17), value: U256::from(17),
data: "3331600055".from_hex().unwrap(), data: hex!("3331600055").to_vec(),
gas: U256::from(100_000), gas: U256::from(100_000),
gas_price: U256::zero(), gas_price: U256::zero(),
nonce: U256::zero() nonce: U256::zero()
@ -2003,7 +2003,7 @@ mod tests {
let t = Transaction { let t = Transaction {
action: Action::Create, action: Action::Create,
value: U256::from(17), value: U256::from(17),
data: "3331600055".from_hex().unwrap(), data: hex!("3331600055").to_vec(),
gas: U256::from(100_000), gas: U256::from(100_000),
gas_price: U256::zero(), gas_price: U256::zero(),
nonce: U256::one() nonce: U256::one()
@ -2036,7 +2036,7 @@ mod tests {
let t = Transaction { let t = Transaction {
action: Action::Create, action: Action::Create,
value: U256::from(17), value: U256::from(17),
data: "3331600055".from_hex().unwrap(), data: hex!("3331600055").to_vec(),
gas: U256::from(80_001), gas: U256::from(80_001),
gas_price: U256::zero(), gas_price: U256::zero(),
nonce: U256::zero() nonce: U256::zero()
@ -2071,7 +2071,7 @@ mod tests {
let t = Transaction { let t = Transaction {
action: Action::Create, action: Action::Create,
value: U256::from(18), value: U256::from(18),
data: "3331600055".from_hex().unwrap(), data: hex!("3331600055").to_vec(),
gas: U256::from(100_000), gas: U256::from(100_000),
gas_price: U256::one(), gas_price: U256::one(),
nonce: U256::zero() nonce: U256::zero()
@ -2100,7 +2100,7 @@ mod tests {
evm_test!{test_keccak: test_keccak_int} evm_test!{test_keccak: test_keccak_int}
fn test_keccak(factory: Factory) { fn test_keccak(factory: Factory) {
let code = "6064640fffffffff20600055".from_hex().unwrap(); let code = hex!("6064640fffffffff20600055").to_vec();
let sender = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); let sender = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0; let address = contract_address(CreateContractAddress::FromSenderAndNonce, &sender, &U256::zero(), &[]).0;
@ -2136,8 +2136,8 @@ mod tests {
let contract_address = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap(); let contract_address = Address::from_str("cd1722f3947def4cf144679da39c4c32bdc35681").unwrap();
let sender = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); let sender = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
// EIP-140 test case // EIP-140 test case
let code = "6c726576657274656420646174616000557f726576657274206d657373616765000000000000000000000000000000000000600052600e6000fd".from_hex().unwrap(); let code = hex!("6c726576657274656420646174616000557f726576657274206d657373616765000000000000000000000000000000000000600052600e6000fd").to_vec();
let returns = "726576657274206d657373616765".from_hex().unwrap(); let returns = hex!("726576657274206d657373616765").to_vec();
let mut state = get_temp_state_with_factory(factory.clone()); let mut state = get_temp_state_with_factory(factory.clone());
state.add_balance(&sender, &U256::from_str("152d02c7e14af68000000").unwrap(), CleanupMode::NoEmpty).unwrap(); state.add_balance(&sender, &U256::from_str("152d02c7e14af68000000").unwrap(), CleanupMode::NoEmpty).unwrap();
state.commit().unwrap(); state.commit().unwrap();
@ -2177,13 +2177,13 @@ mod tests {
let mut state = get_temp_state_with_factory(factory.clone()); let mut state = get_temp_state_with_factory(factory.clone());
state.new_contract(&x1, U256::zero(), U256::from(1), U256::zero()).unwrap(); state.new_contract(&x1, U256::zero(), U256::from(1), U256::zero()).unwrap();
state.init_code(&x1, "600160005560006000556001600055".from_hex().unwrap()).unwrap(); state.init_code(&x1, hex!("600160005560006000556001600055").to_vec()).unwrap();
state.new_contract(&x2, U256::zero(), U256::from(1), U256::zero()).unwrap(); state.new_contract(&x2, U256::zero(), U256::from(1), U256::zero()).unwrap();
state.init_code(&x2, "600060005560016000556000600055".from_hex().unwrap()).unwrap(); state.init_code(&x2, hex!("600060005560016000556000600055").to_vec()).unwrap();
state.new_contract(&y1, U256::zero(), U256::from(1), U256::zero()).unwrap(); state.new_contract(&y1, U256::zero(), U256::from(1), U256::zero()).unwrap();
state.init_code(&y1, "600060006000600061100062fffffff4".from_hex().unwrap()).unwrap(); state.init_code(&y1, hex!("600060006000600061100062fffffff4").to_vec()).unwrap();
state.new_contract(&y2, U256::zero(), U256::from(1), U256::zero()).unwrap(); state.new_contract(&y2, U256::zero(), U256::from(1), U256::zero()).unwrap();
state.init_code(&y2, "600060006000600061100162fffffff4".from_hex().unwrap()).unwrap(); state.init_code(&y2, hex!("600060006000600061100162fffffff4").to_vec()).unwrap();
let info = EnvInfo::default(); let info = EnvInfo::default();
let machine = new_constantinople_test_machine(); let machine = new_constantinople_test_machine();
@ -2194,7 +2194,7 @@ mod tests {
let (FinalizationResult { gas_left, .. }, refund, gas) = { let (FinalizationResult { gas_left, .. }, refund, gas) = {
let gas = U256::from(0xffffffffffu64); let gas = U256::from(0xffffffffffu64);
let mut params = ActionParams::default(); let mut params = ActionParams::default();
params.code = Some(Arc::new("6001600055600060006000600061200163fffffffff4".from_hex().unwrap())); params.code = Some(Arc::new(hex!("6001600055600060006000600061200163fffffffff4").to_vec()));
params.gas = gas; params.gas = gas;
let mut substate = Substate::new(); let mut substate = Substate::new();
let mut ex = Executive::new(&mut state, &info, &machine, &schedule); let mut ex = Executive::new(&mut state, &info, &machine, &schedule);
@ -2212,7 +2212,7 @@ mod tests {
let (FinalizationResult { gas_left, .. }, refund, gas) = { let (FinalizationResult { gas_left, .. }, refund, gas) = {
let gas = U256::from(0xffffffffffu64); let gas = U256::from(0xffffffffffu64);
let mut params = ActionParams::default(); let mut params = ActionParams::default();
params.code = Some(Arc::new("6001600055600060006000600061200263fffffffff4".from_hex().unwrap())); params.code = Some(Arc::new(hex!("6001600055600060006000600061200263fffffffff4").to_vec()));
params.gas = gas; params.gas = gas;
let mut substate = Substate::new(); let mut substate = Substate::new();
let mut ex = Executive::new(&mut state, &info, &machine, &schedule); let mut ex = Executive::new(&mut state, &info, &machine, &schedule);
@ -2228,9 +2228,7 @@ mod tests {
fn wasm_sample_code() -> Arc<Vec<u8>> { fn wasm_sample_code() -> Arc<Vec<u8>> {
Arc::new( Arc::new(
"0061736d01000000010d0360027f7f0060017f0060000002270303656e7603726574000003656e760673656e646572000103656e76066d656d6f727902010110030201020404017000000501000708010463616c6c00020901000ac10101be0102057f017e4100410028020441c0006b22043602042004412c6a41106a220041003602002004412c6a41086a22014200370200200441186a41106a22024100360200200441186a41086a220342003703002004420037022c2004410036021c20044100360218200441186a1001200020022802002202360200200120032903002205370200200441106a2002360200200441086a200537030020042004290318220537022c200420053703002004411410004100200441c0006a3602040b0b0a010041040b0410c00000" hex!("0061736d01000000010d0360027f7f0060017f0060000002270303656e7603726574000003656e760673656e646572000103656e76066d656d6f727902010110030201020404017000000501000708010463616c6c00020901000ac10101be0102057f017e4100410028020441c0006b22043602042004412c6a41106a220041003602002004412c6a41086a22014200370200200441186a41106a22024100360200200441186a41086a220342003703002004420037022c2004410036021c20044100360218200441186a1001200020022802002202360200200120032903002205370200200441106a2002360200200441086a200537030020042004290318220537022c200420053703002004411410004100200441c0006a3602040b0b0a010041040b0410c00000").to_vec()
.from_hex()
.unwrap()
) )
} }

View File

@ -407,8 +407,8 @@ fn round_block_gas_limit(gas_limit: U256, lower_limit: U256, upper_limit: U256)
mod tests { mod tests {
use std::str::FromStr; use std::str::FromStr;
use common_types::header::Header; use common_types::header::Header;
use hex_literal::hex;
use super::*; use super::*;
use spec;
fn get_default_ethash_extensions() -> EthashExtensions { fn get_default_ethash_extensions() -> EthashExtensions {
EthashExtensions { EthashExtensions {
@ -421,8 +421,8 @@ mod tests {
#[test] #[test]
fn should_disallow_unsigned_transactions() { fn should_disallow_unsigned_transactions() {
let rlp = "ea80843b9aca0083015f90948921ebb5f79e9e3920abe571004d0b1d5119c154865af3107a400080038080"; let rlp = hex!("ea80843b9aca0083015f90948921ebb5f79e9e3920abe571004d0b1d5119c154865af3107a400080038080").to_vec();
let transaction: UnverifiedTransaction = ::rlp::decode(&::rustc_hex::FromHex::from_hex(rlp).unwrap()).unwrap(); let transaction: UnverifiedTransaction = rlp::decode(&rlp).unwrap();
assert_eq!( assert_eq!(
transaction::Error::from(transaction.verify_unordered().unwrap_err()), transaction::Error::from(transaction.verify_unordered().unwrap_err()),
transaction::Error::InvalidSignature("invalid EC signature".into()), transaction::Error::InvalidSignature("invalid EC signature".into()),

View File

@ -19,7 +19,7 @@ kvdb = "0.4.0"
log = "0.4" log = "0.4"
parity-bytes = "0.1.0" parity-bytes = "0.1.0"
rlp = "0.4" rlp = "0.4"
rustc-hex = "1.0" rustc-hex = "2.1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
trie-db = "0.20.0" trie-db = "0.20.0"
triehash = { package = "triehash-ethereum", version = "0.2", path = "../../util/triehash-ethereum" } triehash = { package = "triehash-ethereum", version = "0.2", path = "../../util/triehash-ethereum" }

View File

@ -53,7 +53,7 @@ pub struct PodAccount {
fn opt_bytes_to_hex<S>(opt_bytes: &Option<Bytes>, serializer: S) -> Result<S::Ok, S::Error> fn opt_bytes_to_hex<S>(opt_bytes: &Option<Bytes>, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer where S: Serializer
{ {
let readable = opt_bytes.as_ref().map(|b| b.to_hex()).unwrap_or_default(); let readable: String = opt_bytes.as_ref().map(|b| b.to_hex()).unwrap_or_default();
serializer.collect_str(&format_args!("0x{}", readable)) serializer.collect_str(&format_args!("0x{}", readable))
} }

View File

@ -38,7 +38,7 @@ patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
registrar = { path = "../../util/registrar" } registrar = { path = "../../util/registrar" }
rlp = "0.4.0" rlp = "0.4.0"
rlp-derive = "0.1" rlp-derive = "0.1"
rustc-hex = "1.0" rustc-hex = "2.1.0"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"

View File

@ -105,13 +105,13 @@ fn private_contract() {
query_tx.nonce = 1.into(); query_tx.nonce = 1.into();
let query_tx = query_tx.sign(&key1.secret(), chain_id); let query_tx = query_tx.sign(&key1.secret(), chain_id);
let result = pm.private_call(BlockId::Latest, &query_tx).unwrap(); let result = pm.private_call(BlockId::Latest, &query_tx).unwrap();
assert_eq!(&result.output[..], &("0000000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap()[..])); assert_eq!(&result.output[..], &("0000000000000000000000000000000000000000000000000000000000000000".from_hex::<Vec<u8>>().unwrap()[..]));
assert_eq!(pm.get_validators(BlockId::Latest, &address).unwrap(), validators); assert_eq!(pm.get_validators(BlockId::Latest, &address).unwrap(), validators);
trace!("Modifying private state"); trace!("Modifying private state");
let mut private_tx = Transaction::default(); let mut private_tx = Transaction::default();
private_tx.action = Action::Call(address.clone()); private_tx.action = Action::Call(address.clone());
private_tx.data = "bc64b76d2a00000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap(); //setX(42) private_tx.data = "bc64b76d2a00000000000000000000000000000000000000000000000000000000000000".from_hex::<Vec<u8>>().unwrap(); //setX(42)
private_tx.gas = 120000.into(); private_tx.gas = 120000.into();
private_tx.nonce = 1.into(); private_tx.nonce = 1.into();
let private_tx = private_tx.sign(&key1.secret(), None); let private_tx = private_tx.sign(&key1.secret(), None);
@ -132,7 +132,7 @@ fn private_contract() {
query_tx.nonce = 2.into(); query_tx.nonce = 2.into();
let query_tx = query_tx.sign(&key1.secret(), chain_id); let query_tx = query_tx.sign(&key1.secret(), chain_id);
let result = pm.private_call(BlockId::Latest, &query_tx).unwrap(); let result = pm.private_call(BlockId::Latest, &query_tx).unwrap();
assert_eq!(&result.output[..], &("2a00000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap()[..])); assert_eq!(&result.output[..], &("2a00000000000000000000000000000000000000000000000000000000000000".from_hex::<Vec<u8>>().unwrap()[..]));
assert_eq!(pm.get_validators(BlockId::Latest, &address).unwrap(), validators); assert_eq!(pm.get_validators(BlockId::Latest, &address).unwrap(), validators);
// Now try modification with just one signature // Now try modification with just one signature
@ -159,7 +159,7 @@ fn private_contract() {
query_tx.nonce = 3.into(); query_tx.nonce = 3.into();
let query_tx = query_tx.sign(&key1.secret(), chain_id); let query_tx = query_tx.sign(&key1.secret(), chain_id);
let result = pm.private_call(BlockId::Latest, &query_tx).unwrap(); let result = pm.private_call(BlockId::Latest, &query_tx).unwrap();
assert_eq!(result.output, "2a00000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap()); assert_eq!(result.output, "2a00000000000000000000000000000000000000000000000000000000000000".from_hex::<Vec<u8>>().unwrap());
} }
#[test] #[test]
@ -241,7 +241,7 @@ fn call_other_private_contract() {
trace!("Creating private contract B"); trace!("Creating private contract B");
// Build constructor data // Build constructor data
let mut deploy_data = "6060604052341561000f57600080fd5b6040516020806101c583398101604052808051906020019091905050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505061014a8061007b6000396000f300606060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680635197c7aa14610046575b600080fd5b341561005157600080fd5b61005961006f565b6040518082815260200191505060405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630c55699c6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156100fe57600080fd5b6102c65a03f1151561010f57600080fd5b505050604051805190509050905600a165627a7a723058207f8994e02725b47d76ec73e5c54a338d27b306dd1c830276bff2d75fcd1a5c920029000000000000000000000000".to_string(); let mut deploy_data = "6060604052341561000f57600080fd5b6040516020806101c583398101604052808051906020019091905050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505061014a8061007b6000396000f300606060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680635197c7aa14610046575b600080fd5b341561005157600080fd5b61005961006f565b6040518082815260200191505060405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630c55699c6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156100fe57600080fd5b6102c65a03f1151561010f57600080fd5b505050604051805190509050905600a165627a7a723058207f8994e02725b47d76ec73e5c54a338d27b306dd1c830276bff2d75fcd1a5c920029000000000000000000000000".to_string();
deploy_data.push_str(&address_a.as_bytes().to_vec().to_hex()); deploy_data.push_str(&address_a.as_bytes().to_hex::<String>());
let private_contract_b_test = deploy_data.from_hex().unwrap(); let private_contract_b_test = deploy_data.from_hex().unwrap();
let mut private_create_tx2 = Transaction::default(); let mut private_create_tx2 = Transaction::default();
private_create_tx2.action = Action::Create; private_create_tx2.action = Action::Create;
@ -283,5 +283,5 @@ fn call_other_private_contract() {
query_tx.nonce = 3.into(); query_tx.nonce = 3.into();
let query_tx = query_tx.sign(&key1.secret(), chain_id); let query_tx = query_tx.sign(&key1.secret(), chain_id);
let result = pm.private_call(BlockId::Latest, &query_tx).unwrap(); let result = pm.private_call(BlockId::Latest, &query_tx).unwrap();
assert_eq!(&result.output[..], &("2a00000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap()[..])); assert_eq!(&result.output[..], &("2a00000000000000000000000000000000000000000000000000000000000000".from_hex::<Vec<u8>>().unwrap()[..]));
} }

View File

@ -43,5 +43,5 @@ ethcore-io = { path = "../../util/io", features = ["mio"] }
kvdb-memorydb = "0.4.0" kvdb-memorydb = "0.4.0"
machine = { path = "../machine" } machine = { path = "../machine" }
rand_xorshift = "0.2" rand_xorshift = "0.2"
rustc-hex = "1.0" rustc-hex = "2.1.0"
spec = { path = "../spec" } spec = { path = "../spec" }

View File

@ -14,7 +14,7 @@ vm = { path = "../../vm" }
wasm = { path = "../" } wasm = { path = "../" }
clap = "2.24" clap = "2.24"
env_logger = "0.5" env_logger = "0.5"
rustc-hex = "1.0" rustc-hex = "2.1.0"
[features] [features]
default = ["ethereum-types/std"] default = ["ethereum-types/std"]

View File

@ -73,9 +73,9 @@ impl fmt::Display for Fail {
write!( write!(
f, f,
"Expected to return result: 0x{} ({} bytes), but got 0x{} ({} bytes)", "Expected to return result: 0x{} ({} bytes), but got 0x{} ({} bytes)",
expected.to_hex(), expected.to_hex::<String>(),
expected.len(), expected.len(),
actual.to_hex(), actual.to_hex::<String>(),
actual.len() actual.len()
), ),
@ -95,17 +95,17 @@ impl fmt::Display for Fail {
write!( write!(
f, f,
"Storage key {} value mismatch, expected {}, got: {}", "Storage key {} value mismatch, expected {}, got: {}",
key.as_bytes().to_vec().to_hex(), key.as_bytes().to_hex::<String>(),
expected.as_bytes().to_vec().to_hex(), expected.as_bytes().to_hex::<String>(),
actual.as_bytes().to_vec().to_hex(), actual.as_bytes().to_hex::<String>(),
), ),
StorageMismatch { ref key, ref expected, actual: None} => StorageMismatch { ref key, ref expected, actual: None} =>
write!( write!(
f, f,
"No expected storage value for key {} found, expected {}", "No expected storage value for key {} found, expected {}",
key.as_bytes().to_vec().to_hex(), key.as_bytes().to_hex::<String>(),
expected.as_bytes().to_vec().to_hex(), expected.as_bytes().to_hex::<String>(),
), ),
Nonconformity(SpecNonconformity::Address) => Nonconformity(SpecNonconformity::Address) =>

View File

@ -21,7 +21,7 @@ evm = { path = "../ethcore/evm" }
panic_hook = { path = "../util/panic-hook" } panic_hook = { path = "../util/panic-hook" }
parity-bytes = "0.1" parity-bytes = "0.1"
pod = { path = "../ethcore/pod" } pod = { path = "../ethcore/pod" }
rustc-hex = "1.0" rustc-hex = "2.1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
spec = { path = "../ethcore/spec" } spec = { path = "../ethcore/spec" }
@ -30,6 +30,7 @@ vm = { path = "../ethcore/vm" }
[dev-dependencies] [dev-dependencies]
criterion = "0.3" criterion = "0.3"
hex-literal = "0.2.1"
tempdir = "0.3" tempdir = "0.3"
[features] [features]

View File

@ -22,10 +22,13 @@
#[macro_use] #[macro_use]
extern crate criterion; extern crate criterion;
#[macro_use]
extern crate hex_literal;
extern crate ethcore; extern crate ethcore;
extern crate evm; extern crate evm;
extern crate ethereum_types; extern crate ethereum_types;
extern crate rustc_hex;
extern crate vm; extern crate vm;
use std::sync::Arc; use std::sync::Arc;
@ -33,7 +36,6 @@ use criterion::{Criterion, black_box};
use ethereum_types::U256; use ethereum_types::U256;
use evm::Factory; use evm::Factory;
use rustc_hex::FromHex;
use vm::tests::FakeExt; use vm::tests::FakeExt;
use vm::{ActionParams, Ext}; use vm::{ActionParams, Ext};
@ -56,7 +58,7 @@ fn bench_simple_loop_u256(c: &mut Criterion) {
fn simple_loop(gas: U256, c: &mut Criterion, bench_id: &str) { fn simple_loop(gas: U256, c: &mut Criterion, bench_id: &str) {
let code = black_box( let code = black_box(
"606060405260005b620042408112156019575b6001016007565b600081905550600680602b6000396000f3606060405200".from_hex().unwrap() hex!("606060405260005b620042408112156019575b6001016007565b600081905550600680602b6000396000f3606060405200").to_vec()
); );
c.bench_function(bench_id, move |b| { c.bench_function(bench_id, move |b| {
@ -82,7 +84,7 @@ fn bench_rng_u256(c: &mut Criterion) {
fn rng(gas: U256, c: &mut Criterion, bench_id: &str) { fn rng(gas: U256, c: &mut Criterion, bench_id: &str) {
let code = black_box( let code = black_box(
"6060604052600360056007600b60005b62004240811215607f5767ffe7649d5eca84179490940267f47ed85c4b9a6379019367f8e5dd9a5c994bba9390930267f91d87e4b8b74e55019267ff97f6f3b29cda529290920267f393ada8dd75c938019167fe8d437c45bb3735830267f47d9a7b5428ffec019150600101600f565b838518831882186000555050505050600680609a6000396000f3606060405200".from_hex().unwrap() hex!("6060604052600360056007600b60005b62004240811215607f5767ffe7649d5eca84179490940267f47ed85c4b9a6379019367f8e5dd9a5c994bba9390930267f91d87e4b8b74e55019267ff97f6f3b29cda529290920267f393ada8dd75c938019167fe8d437c45bb3735830267f47d9a7b5428ffec019150600101600f565b838518831882186000555050505050600680609a6000396000f3606060405200").to_vec()
); );
c.bench_function(bench_id, move |b| { c.bench_function(bench_id, move |b| {

View File

@ -7,7 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
ethereum-types = "0.8.0" ethereum-types = "0.8.0"
rustc-hex = "1.0" rustc-hex = "2.1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"

View File

@ -40,7 +40,7 @@ transaction-pool = "2.0.1"
[dev-dependencies] [dev-dependencies]
env_logger = "0.5" env_logger = "0.5"
parity-crypto = { version = "0.5.0", features = ["publickey"] } parity-crypto = { version = "0.5.0", features = ["publickey"] }
rustc-hex = "1.0" rustc-hex = "2.1.0"
[features] [features]
work-notify = ["ethash", "fetch", "hyper", "url"] work-notify = ["ethash", "fetch", "hyper", "url"]

View File

@ -16,7 +16,7 @@ multihash = "0.8"
order-stat = "0.1" order-stat = "0.1"
rand = "0.7" rand = "0.7"
rand_xorshift = "0.2" rand_xorshift = "0.2"
rustc-hex = "1.0" rustc-hex = "2.1.0"
semver = "0.9" semver = "0.9"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"

View File

@ -513,7 +513,7 @@ pub fn vm(error: &VMError, output: &[u8]) -> Error {
use rustc_hex::ToHex; use rustc_hex::ToHex;
let data = match error { let data = match error {
&VMError::Reverted => format!("{} 0x{}", VMError::Reverted, output.to_hex()), &VMError::Reverted => format!("{} 0x{}", VMError::Reverted, output.to_hex::<String>()),
error => format!("{}", error), error => format!("{}", error),
}; };

View File

@ -564,12 +564,11 @@ fn rpc_eth_transaction_count_by_number_pending() {
#[test] #[test]
fn rpc_eth_pending_transaction_by_hash() { fn rpc_eth_pending_transaction_by_hash() {
use ethereum_types::H256; use ethereum_types::H256;
use rlp;
use types::transaction::SignedTransaction; use types::transaction::SignedTransaction;
let tester = EthTester::default(); let tester = EthTester::default();
{ {
let bytes = FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap(); let bytes: Vec<u8> = FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap();
let tx = rlp::decode(&bytes).expect("decoding failure"); let tx = rlp::decode(&bytes).expect("decoding failure");
let tx = SignedTransaction::new(tx).unwrap(); let tx = SignedTransaction::new(tx).unwrap();
tester.miner.pending_transactions.lock().insert(H256::zero(), tx); tester.miner.pending_transactions.lock().insert(H256::zero(), tx);
@ -913,7 +912,7 @@ fn rpc_eth_send_raw_transaction() {
let signature = tester.accounts_provider.sign(address, None, t.hash(None)).unwrap(); let signature = tester.accounts_provider.sign(address, None, t.hash(None)).unwrap();
let t = t.with_signature(signature, None); let t = t.with_signature(signature, None);
let rlp = rlp::encode(&t).to_hex(); let rlp: String = rlp::encode(&t).to_hex();
let req = r#"{ let req = r#"{
"jsonrpc": "2.0", "jsonrpc": "2.0",

View File

@ -166,7 +166,7 @@ fn rpc_parity_set_extra_data() {
let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#; let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#;
assert_eq!(io.handle_request_sync(request), Some(response.to_owned())); assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
assert_eq!(miner.authoring_params().extra_data, "cd1722f3947def4cf144679da39c4c32bdc35681".from_hex().unwrap()); assert_eq!(miner.authoring_params().extra_data, "cd1722f3947def4cf144679da39c4c32bdc35681".from_hex::<Vec<u8>>().unwrap());
} }
#[test] #[test]

View File

@ -368,8 +368,8 @@ fn sign_eip191_with_validator() {
data: keccak("hello world").as_bytes().to_vec().into() data: keccak("hello world").as_bytes().to_vec().into()
}).unwrap(); }).unwrap();
let result = eip191::hash_message(EIP191Version::PresignedTransaction, with_validator).unwrap(); let result = eip191::hash_message(EIP191Version::PresignedTransaction, with_validator).unwrap();
let result = tester.accounts.sign(address, Some("password123".into()), result).unwrap().into_electrum(); let result: String = tester.accounts.sign(address, Some("password123".into()), result).unwrap().into_electrum().to_hex();
let expected = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{}", result.to_hex()) + r#"","id":1}"#; let expected = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{}", result) + r#"","id":1}"#;
let response = tester.io.handle_request_sync(&request).unwrap(); let response = tester.io.handle_request_sync(&request).unwrap();
assert_eq!(response, expected) assert_eq!(response, expected)
} }

View File

@ -87,13 +87,10 @@ fn eth_signing(signing_queue_enabled: bool) -> SigningTester {
#[test] #[test]
fn rpc_eth_sign() { fn rpc_eth_sign() {
use rustc_hex::FromHex;
let tester = eth_signing(true); let tester = eth_signing(true);
let account = tester.accounts.insert_account(Secret::from([69u8; 32]), &"abcd".into()).unwrap(); let account = tester.accounts.insert_account(Secret::from([69u8; 32]), &"abcd".into()).unwrap();
tester.accounts.unlock_account_permanently(account, "abcd".into()).unwrap(); tester.accounts.unlock_account_permanently(account, "abcd".into()).unwrap();
let _message = "0cc175b9c0f1b6a831c399e26977266192eb5ffee6ae2fec3ad71c777531578f".from_hex().unwrap();
let req = r#"{ let req = r#"{
"jsonrpc": "2.0", "jsonrpc": "2.0",

View File

@ -165,10 +165,10 @@ fn rpc_eth_sign_transaction() {
let signature = tester.accounts_provider.sign(address, None, t.hash(None)).unwrap(); let signature = tester.accounts_provider.sign(address, None, t.hash(None)).unwrap();
let t = t.with_signature(signature, None); let t = t.with_signature(signature, None);
let signature = t.signature(); let signature = t.signature();
let rlp = rlp::encode(&t); let rlp: String = rlp::encode(&t).to_hex();
let response = r#"{"jsonrpc":"2.0","result":{"#.to_owned() + let response = r#"{"jsonrpc":"2.0","result":{"#.to_owned() +
r#""raw":"0x"# + &rlp.to_hex() + r#"","# + r#""raw":"0x"# + &rlp + r#"","# +
r#""tx":{"# + r#""tx":{"# +
r#""blockHash":null,"blockNumber":null,"# + r#""blockHash":null,"blockNumber":null,"# +
&format!("\"chainId\":{},", t.chain_id().map_or("null".to_owned(), |n| format!("{}", n))) + &format!("\"chainId\":{},", t.chain_id().map_or("null".to_owned(), |n| format!("{}", n))) +
@ -180,7 +180,7 @@ fn rpc_eth_sign_transaction() {
r#""nonce":"0x1","# + r#""nonce":"0x1","# +
&format!("\"publicKey\":\"0x{:x}\",", t.recover_public().unwrap()) + &format!("\"publicKey\":\"0x{:x}\",", t.recover_public().unwrap()) +
&format!("\"r\":\"0x{:x}\",", U256::from(signature.r())) + &format!("\"r\":\"0x{:x}\",", U256::from(signature.r())) +
&format!("\"raw\":\"0x{}\",", rlp.to_hex()) + &format!("\"raw\":\"0x{}\",", rlp) +
&format!("\"s\":\"0x{:x}\",", U256::from(signature.s())) + &format!("\"s\":\"0x{:x}\",", U256::from(signature.s())) +
&format!("\"standardV\":\"0x{:x}\",", U256::from(t.standard_v())) + &format!("\"standardV\":\"0x{:x}\",", U256::from(t.standard_v())) +
r#""to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionIndex":null,"# + r#""to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionIndex":null,"# +

View File

@ -50,9 +50,10 @@ impl Into<Vec<u8>> for Bytes {
impl Serialize for Bytes { impl Serialize for Bytes {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer
{
let mut serialized = "0x".to_owned(); let mut serialized = "0x".to_owned();
serialized.push_str(self.0.to_hex().as_ref()); serialized.push_str(self.0.to_hex::<String>().as_ref());
serializer.serialize_str(serialized.as_ref()) serializer.serialize_str(serialized.as_ref())
} }
} }
@ -89,7 +90,6 @@ impl<'a> Visitor<'a> for BytesVisitor {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use serde_json;
use rustc_hex::FromHex; use rustc_hex::FromHex;
#[test] #[test]

View File

@ -103,7 +103,7 @@ mod tests {
gas_price: Some(U256::from_str("9184e72a000").unwrap()), gas_price: Some(U256::from_str("9184e72a000").unwrap()),
gas: Some(U256::from_str("76c0").unwrap()), gas: Some(U256::from_str("76c0").unwrap()),
value: Some(U256::from_str("9184e72a").unwrap()), value: Some(U256::from_str("9184e72a").unwrap()),
data: Some("d46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675".from_hex().unwrap().into()), data: Some("d46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675".from_hex::<Vec<u8>>().unwrap().into()),
nonce: None nonce: None
}); });
} }

View File

@ -186,7 +186,7 @@ mod tests {
gas_price: Some(U256::from_str("9184e72a000").unwrap()), gas_price: Some(U256::from_str("9184e72a000").unwrap()),
gas: Some(U256::from_str("76c0").unwrap()), gas: Some(U256::from_str("76c0").unwrap()),
value: Some(U256::from_str("9184e72a").unwrap()), value: Some(U256::from_str("9184e72a").unwrap()),
data: Some("d46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675".from_hex().unwrap().into()), data: Some("d46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675".from_hex::<Vec<u8>>().unwrap().into()),
nonce: None, nonce: None,
condition: None, condition: None,
}); });

View File

@ -13,7 +13,7 @@ log = "0.4"
mime = "0.3" mime = "0.3"
mime_guess = "2.0.1" mime_guess = "2.0.1"
rand = "0.7" rand = "0.7"
rustc-hex = "1.0" rustc-hex = "2.1.0"
fetch = { path = "../../util/fetch" } fetch = { path = "../../util/fetch" }
parity-bytes = "0.1" parity-bytes = "0.1"
ethereum-types = "0.8.0" ethereum-types = "0.8.0"

View File

@ -203,8 +203,8 @@ mod tests {
fn registrar() -> FakeRegistrar { fn registrar() -> FakeRegistrar {
let mut registrar = FakeRegistrar::new(); let mut registrar = FakeRegistrar::new();
registrar.responses = Mutex::new(vec![ registrar.responses = Mutex::new(vec![
Ok(format!("000000000000000000000000{}", URLHINT).from_hex().unwrap()), Ok(format!("000000000000000000000000{}", URLHINT).from_hex::<Vec<u8>>().unwrap()),
Ok("00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000deadcafebeefbeefcafedeaddeedfeedffffffff000000000000000000000000000000000000000000000000000000000000003c68747470733a2f2f7061726974792e696f2f6173736574732f696d616765732f657468636f72652d626c61636b2d686f72697a6f6e74616c2e706e6700000000".from_hex().unwrap()), Ok("00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000deadcafebeefbeefcafedeaddeedfeedffffffff000000000000000000000000000000000000000000000000000000000000003c68747470733a2f2f7061726974792e696f2f6173736574732f696d616765732f657468636f72652d626c61636b2d686f72697a6f6e74616c2e706e6700000000".from_hex::<Vec<u8>>().unwrap()),
]); ]);
registrar registrar
} }

View File

@ -52,7 +52,7 @@ impl GithubApp {
pub fn url(&self) -> String { pub fn url(&self) -> String {
// Since https fetcher doesn't support redirections we use direct link // Since https fetcher doesn't support redirections we use direct link
// format!("https://github.com/{}/{}/archive/{}.zip", self.account, self.repo, self.commit.to_hex()) // format!("https://github.com/{}/{}/archive/{}.zip", self.account, self.repo, self.commit.to_hex())
format!("https://codeload.github.com/{}/{}/zip/{}", self.account, self.repo, self.commit.to_hex()) format!("https://codeload.github.com/{}/{}/zip/{}", self.account, self.repo, self.commit.to_hex::<String>())
} }
fn commit(bytes: &[u8]) -> Option<[u8;COMMIT_LEN]> { fn commit(bytes: &[u8]) -> Option<[u8;COMMIT_LEN]> {
@ -313,11 +313,13 @@ pub mod tests {
// when // when
let res = urlhint.resolve(h256_from_short_str("test")).unwrap(); let res = urlhint.resolve(h256_from_short_str("test")).unwrap();
let c: Vec<u8> = "ec4c1fe06c808fe3739858c347109b1f5f1ed4b5".from_hex().unwrap();
// then // then
assert_eq!(res, Some(URLHintResult::Dapp(GithubApp { assert_eq!(res, Some(URLHintResult::Dapp(GithubApp {
account: "ethcore".into(), account: "ethcore".into(),
repo: "dao.claim".into(), repo: "dao.claim".into(),
commit: GithubApp::commit(&"ec4c1fe06c808fe3739858c347109b1f5f1ed4b5".from_hex().unwrap()).unwrap(), commit: GithubApp::commit(&c).unwrap(),
owner: Address::from_str("deadcafebeefbeefcafedeaddeedfeedffffffff").unwrap(), owner: Address::from_str("deadcafebeefbeefcafedeaddeedfeedffffffff").unwrap(),
}))) })))
} }

View File

@ -8,36 +8,36 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
log = "0.4"
mio = "0.6.8"
bytes = "0.4"
rand = "0.7"
tiny-keccak = "1.4"
slab = "0.2"
igd = "0.10.0"
libc = "0.2.7"
parking_lot = "0.10.0"
ansi_term = "0.11" ansi_term = "0.11"
rustc-hex = "1.0" bytes = "0.4"
ethcore-io = { path = "../io", features = ["mio"] } ethcore-io = { path = "../io", features = ["mio"] }
parity-bytes = "0.1"
parity-crypto = { version = "0.5.0", features = ["publickey"] }
network = { package = "ethcore-network", path = "../network" }
ethereum-types = "0.8.0" ethereum-types = "0.8.0"
rlp = "0.4.0" igd = "0.10.0"
parity-path = "0.1"
ipnetwork = "0.12.6" ipnetwork = "0.12.6"
keccak-hash = "0.4.0" keccak-hash = "0.4.0"
libc = "0.2.7"
log = "0.4"
lru-cache = "0.1"
mio = "0.6.8"
natpmp = "0.2"
network = { package = "ethcore-network", path = "../network" }
parity-bytes = "0.1"
parity-crypto = { version = "0.5.0", features = ["publickey"] }
parity-path = "0.1"
parity-snappy = "0.1" parity-snappy = "0.1"
parking_lot = "0.10.0"
rand = "0.7"
rlp = "0.4.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
lru-cache = "0.1" slab = "0.2"
natpmp = "0.2" tiny-keccak = "1.4"
[dev-dependencies] [dev-dependencies]
env_logger = "0.5"
tempdir = "0.3"
assert_matches = "1.2" assert_matches = "1.2"
env_logger = "0.5"
hex-literal = "0.2.1"
tempdir = "0.3"
[features] [features]
default = [] default = []

View File

@ -899,12 +899,10 @@ mod tests {
use std::net::{IpAddr, Ipv4Addr}; use std::net::{IpAddr, Ipv4Addr};
use std::str::FromStr; use std::str::FromStr;
use rustc_hex::FromHex; use hex_literal::hex;
use parity_crypto::publickey::{Generator, Random}; use parity_crypto::publickey::{Generator, Random};
use crate::node_table::{Node, NodeEndpoint, NodeId}; use crate::node_table::{Node, NodeEndpoint, NodeId};
use super::*; use super::*;
#[test] #[test]
@ -1197,60 +1195,60 @@ mod tests {
discovery.check_timestamps = false; discovery.check_timestamps = false;
let from = SocketAddr::from_str("99.99.99.99:40445").unwrap(); let from = SocketAddr::from_str("99.99.99.99:40445").unwrap();
let packet = "\ let packet = hex!("
e9614ccfd9fc3e74360018522d30e1419a143407ffcce748de3e22116b7e8dc92ff74788c0b6663a\ e9614ccfd9fc3e74360018522d30e1419a143407ffcce748de3e22116b7e8dc92ff74788c0b6663a
aa3d67d641936511c8f8d6ad8698b820a7cf9e1be7155e9a241f556658c55428ec0563514365799a\ aa3d67d641936511c8f8d6ad8698b820a7cf9e1be7155e9a241f556658c55428ec0563514365799a
4be2be5a685a80971ddcfa80cb422cdd0101ec04cb847f000001820cfa8215a8d790000000000000\ 4be2be5a685a80971ddcfa80cb422cdd0101ec04cb847f000001820cfa8215a8d790000000000000
000000000000000000018208ae820d058443b9a3550102\ 000000000000000000018208ae820d058443b9a3550102
".from_hex().unwrap(); ").to_vec();
let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok");
let packet = "\ let packet = hex!("
577be4349c4dd26768081f58de4c6f375a7a22f3f7adda654d1428637412c3d7fe917cadc56d4e5e\ 577be4349c4dd26768081f58de4c6f375a7a22f3f7adda654d1428637412c3d7fe917cadc56d4e5e
7ffae1dbe3efffb9849feb71b262de37977e7c7a44e677295680e9e38ab26bee2fcbae207fba3ff3\ 7ffae1dbe3efffb9849feb71b262de37977e7c7a44e677295680e9e38ab26bee2fcbae207fba3ff3
d74069a50b902a82c9903ed37cc993c50001f83e82022bd79020010db83c4d001500000000abcdef\ d74069a50b902a82c9903ed37cc993c50001f83e82022bd79020010db83c4d001500000000abcdef
12820cfa8215a8d79020010db885a308d313198a2e037073488208ae82823a8443b9a355c5010203\ 12820cfa8215a8d79020010db885a308d313198a2e037073488208ae82823a8443b9a355c5010203
040531b9019afde696e582a78fa8d95ea13ce3297d4afb8ba6433e4154caa5ac6431af1b80ba7602\ 040531b9019afde696e582a78fa8d95ea13ce3297d4afb8ba6433e4154caa5ac6431af1b80ba7602
3fa4090c408f6b4bc3701562c031041d4702971d102c9ab7fa5eed4cd6bab8f7af956f7d565ee191\ 3fa4090c408f6b4bc3701562c031041d4702971d102c9ab7fa5eed4cd6bab8f7af956f7d565ee191
7084a95398b6a21eac920fe3dd1345ec0a7ef39367ee69ddf092cbfe5b93e5e568ebc491983c09c7\ 7084a95398b6a21eac920fe3dd1345ec0a7ef39367ee69ddf092cbfe5b93e5e568ebc491983c09c7
6d922dc3\ 6d922dc3
".from_hex().unwrap(); ").to_vec();
let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok");
let packet = "\ let packet = hex!("
09b2428d83348d27cdf7064ad9024f526cebc19e4958f0fdad87c15eb598dd61d08423e0bf66b206\ 09b2428d83348d27cdf7064ad9024f526cebc19e4958f0fdad87c15eb598dd61d08423e0bf66b206
9869e1724125f820d851c136684082774f870e614d95a2855d000f05d1648b2d5945470bc187c2d2\ 9869e1724125f820d851c136684082774f870e614d95a2855d000f05d1648b2d5945470bc187c2d2
216fbe870f43ed0909009882e176a46b0102f846d79020010db885a308d313198a2e037073488208\ 216fbe870f43ed0909009882e176a46b0102f846d79020010db885a308d313198a2e037073488208
ae82823aa0fbc914b16819237dcd8801d7e53f69e9719adecb3cc0e790c57e91ca4461c9548443b9\ ae82823aa0fbc914b16819237dcd8801d7e53f69e9719adecb3cc0e790c57e91ca4461c9548443b9
a355c6010203c2040506a0c969a58f6f9095004c0177a6b47f451530cab38966a25cca5cb58f0555 a355c6010203c2040506a0c969a58f6f9095004c0177a6b47f451530cab38966a25cca5cb58f0555
42124e\ 42124e
".from_hex().unwrap(); ").to_vec();
let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok");
let packet = "\ let packet = hex!("
c7c44041b9f7c7e41934417ebac9a8e1a4c6298f74553f2fcfdcae6ed6fe53163eb3d2b52e39fe91\ c7c44041b9f7c7e41934417ebac9a8e1a4c6298f74553f2fcfdcae6ed6fe53163eb3d2b52e39fe91
831b8a927bf4fc222c3902202027e5e9eb812195f95d20061ef5cd31d502e47ecb61183f74a504fe\ 831b8a927bf4fc222c3902202027e5e9eb812195f95d20061ef5cd31d502e47ecb61183f74a504fe
04c51e73df81f25c4d506b26db4517490103f84eb840ca634cae0d49acb401d8a4c6b6fe8c55b70d\ 04c51e73df81f25c4d506b26db4517490103f84eb840ca634cae0d49acb401d8a4c6b6fe8c55b70d
115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be0081290476\ 115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be0081290476
7bf5ccd1fc7f8443b9a35582999983999999280dc62cc8255c73471e0a61da0c89acdc0e035e260a\ 7bf5ccd1fc7f8443b9a35582999983999999280dc62cc8255c73471e0a61da0c89acdc0e035e260a
dd7fc0c04ad9ebf3919644c91cb247affc82b69bd2ca235c71eab8e49737c937a2c396\ dd7fc0c04ad9ebf3919644c91cb247affc82b69bd2ca235c71eab8e49737c937a2c396
".from_hex().unwrap(); ").to_vec();
let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok");
let packet = "\ let packet = hex!("
c679fc8fe0b8b12f06577f2e802d34f6fa257e6137a995f6f4cbfc9ee50ed3710faf6e66f932c4c8\ c679fc8fe0b8b12f06577f2e802d34f6fa257e6137a995f6f4cbfc9ee50ed3710faf6e66f932c4c8
d81d64343f429651328758b47d3dbc02c4042f0fff6946a50f4a49037a72bb550f3a7872363a83e1\ d81d64343f429651328758b47d3dbc02c4042f0fff6946a50f4a49037a72bb550f3a7872363a83e1
b9ee6469856c24eb4ef80b7535bcf99c0004f9015bf90150f84d846321163782115c82115db84031\ b9ee6469856c24eb4ef80b7535bcf99c0004f9015bf90150f84d846321163782115c82115db84031
55e1427f85f10a5c9a7755877748041af1bcd8d474ec065eb33df57a97babf54bfd2103575fa8291\ 55e1427f85f10a5c9a7755877748041af1bcd8d474ec065eb33df57a97babf54bfd2103575fa8291
15d224c523596b401065a97f74010610fce76382c0bf32f84984010203040101b840312c55512422\ 15d224c523596b401065a97f74010610fce76382c0bf32f84984010203040101b840312c55512422
cf9b8a4097e9a6ad79402e87a15ae909a4bfefa22398f03d20951933beea1e4dfa6f968212385e82\ cf9b8a4097e9a6ad79402e87a15ae909a4bfefa22398f03d20951933beea1e4dfa6f968212385e82
9f04c2d314fc2d4e255e0d3bc08792b069dbf8599020010db83c4d001500000000abcdef12820d05\ 9f04c2d314fc2d4e255e0d3bc08792b069dbf8599020010db83c4d001500000000abcdef12820d05
820d05b84038643200b172dcfef857492156971f0e6aa2c538d8b74010f8e140811d53b98c765dd2\ 820d05b84038643200b172dcfef857492156971f0e6aa2c538d8b74010f8e140811d53b98c765dd2
d96126051913f44582e8c199ad7c6d6819e9a56483f637feaac9448aacf8599020010db885a308d3\ d96126051913f44582e8c199ad7c6d6819e9a56483f637feaac9448aacf8599020010db885a308d3
13198a2e037073488203e78203e8b8408dcab8618c3253b558d459da53bd8fa68935a719aff8b811\ 13198a2e037073488203e78203e8b8408dcab8618c3253b558d459da53bd8fa68935a719aff8b811
197101a4b2b47dd2d47295286fc00cc081bb542d760717d1bdd6bec2c37cd72eca367d6dd3b9df73\ 197101a4b2b47dd2d47295286fc00cc081bb542d760717d1bdd6bec2c37cd72eca367d6dd3b9df73
8443b9a355010203b525a138aa34383fec3d2719a0\ 8443b9a355010203b525a138aa34383fec3d2719a0
".from_hex().unwrap(); ").to_vec();
let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok"); let _ = discovery.on_packet(&packet, from.clone()).expect("packet to be ok");
} }

View File

@ -323,11 +323,10 @@ impl Handshake {
mod test { mod test {
use std::str::FromStr; use std::str::FromStr;
use ethereum_types::{H256, H512};
use mio::tcp::TcpStream;
use rustc_hex::FromHex;
use ethcore_io::*; use ethcore_io::*;
use ethereum_types::{H256, H512};
use hex_literal::hex;
use mio::tcp::TcpStream;
use parity_crypto::publickey::Public; use parity_crypto::publickey::Public;
use super::*; use super::*;
@ -370,16 +369,16 @@ mod test {
let mut h = create_handshake(None); let mut h = create_handshake(None);
let secret = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291".parse().unwrap(); let secret = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291".parse().unwrap();
let auth = let auth =
"\ hex!("
048ca79ad18e4b0659fab4853fe5bc58eb83992980f4c9cc147d2aa31532efd29a3d3dc6a3d89eaf\ 048ca79ad18e4b0659fab4853fe5bc58eb83992980f4c9cc147d2aa31532efd29a3d3dc6a3d89eaf
913150cfc777ce0ce4af2758bf4810235f6e6ceccfee1acc6b22c005e9e3a49d6448610a58e98744\ 913150cfc777ce0ce4af2758bf4810235f6e6ceccfee1acc6b22c005e9e3a49d6448610a58e98744
ba3ac0399e82692d67c1f58849050b3024e21a52c9d3b01d871ff5f210817912773e610443a9ef14\ ba3ac0399e82692d67c1f58849050b3024e21a52c9d3b01d871ff5f210817912773e610443a9ef14
2e91cdba0bd77b5fdf0769b05671fc35f83d83e4d3b0b000c6b2a1b1bba89e0fc51bf4e460df3105\ 2e91cdba0bd77b5fdf0769b05671fc35f83d83e4d3b0b000c6b2a1b1bba89e0fc51bf4e460df3105
c444f14be226458940d6061c296350937ffd5e3acaceeaaefd3c6f74be8e23e0f45163cc7ebd7622\ c444f14be226458940d6061c296350937ffd5e3acaceeaaefd3c6f74be8e23e0f45163cc7ebd7622
0f0128410fd05250273156d548a414444ae2f7dea4dfca2d43c057adb701a715bf59f6fb66b2d1d2\ 0f0128410fd05250273156d548a414444ae2f7dea4dfca2d43c057adb701a715bf59f6fb66b2d1d2
0f2c703f851cbf5ac47396d9ca65b6260bd141ac4d53e2de585a73d1750780db4c9ee4cd4d225173\ 0f2c703f851cbf5ac47396d9ca65b6260bd141ac4d53e2de585a73d1750780db4c9ee4cd4d225173
a4592ee77e2bd94d0be3691f3b406f9bba9b591fc63facc016bfa8\ a4592ee77e2bd94d0be3691f3b406f9bba9b591fc63facc016bfa8
".from_hex().unwrap(); ").to_vec();
h.read_auth(&test_io(), &secret, &auth).unwrap(); h.read_auth(&test_io(), &secret, &auth).unwrap();
assert_eq!(h.state, super::HandshakeState::StartSession); assert_eq!(h.state, super::HandshakeState::StartSession);
@ -391,19 +390,19 @@ mod test {
let mut h = create_handshake(None); let mut h = create_handshake(None);
let secret = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291".parse().unwrap(); let secret = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291".parse().unwrap();
let auth = let auth =
"\ hex!("
01b304ab7578555167be8154d5cc456f567d5ba302662433674222360f08d5f1534499d3678b513b\ 01b304ab7578555167be8154d5cc456f567d5ba302662433674222360f08d5f1534499d3678b513b
0fca474f3a514b18e75683032eb63fccb16c156dc6eb2c0b1593f0d84ac74f6e475f1b8d56116b84\ 0fca474f3a514b18e75683032eb63fccb16c156dc6eb2c0b1593f0d84ac74f6e475f1b8d56116b84
9634a8c458705bf83a626ea0384d4d7341aae591fae42ce6bd5c850bfe0b999a694a49bbbaf3ef6c\ 9634a8c458705bf83a626ea0384d4d7341aae591fae42ce6bd5c850bfe0b999a694a49bbbaf3ef6c
da61110601d3b4c02ab6c30437257a6e0117792631a4b47c1d52fc0f8f89caadeb7d02770bf999cc\ da61110601d3b4c02ab6c30437257a6e0117792631a4b47c1d52fc0f8f89caadeb7d02770bf999cc
147d2df3b62e1ffb2c9d8c125a3984865356266bca11ce7d3a688663a51d82defaa8aad69da39ab6\ 147d2df3b62e1ffb2c9d8c125a3984865356266bca11ce7d3a688663a51d82defaa8aad69da39ab6
d5470e81ec5f2a7a47fb865ff7cca21516f9299a07b1bc63ba56c7a1a892112841ca44b6e0034dee\ d5470e81ec5f2a7a47fb865ff7cca21516f9299a07b1bc63ba56c7a1a892112841ca44b6e0034dee
70c9adabc15d76a54f443593fafdc3b27af8059703f88928e199cb122362a4b35f62386da7caad09\ 70c9adabc15d76a54f443593fafdc3b27af8059703f88928e199cb122362a4b35f62386da7caad09
c001edaeb5f8a06d2b26fb6cb93c52a9fca51853b68193916982358fe1e5369e249875bb8d0d0ec3\ c001edaeb5f8a06d2b26fb6cb93c52a9fca51853b68193916982358fe1e5369e249875bb8d0d0ec3
6f917bc5e1eafd5896d46bd61ff23f1a863a8a8dcd54c7b109b771c8e61ec9c8908c733c0263440e\ 6f917bc5e1eafd5896d46bd61ff23f1a863a8a8dcd54c7b109b771c8e61ec9c8908c733c0263440e
2aa067241aaa433f0bb053c7b31a838504b148f570c0ad62837129e547678c5190341e4f1693956c\ 2aa067241aaa433f0bb053c7b31a838504b148f570c0ad62837129e547678c5190341e4f1693956c
3bf7678318e2d5b5340c9e488eefea198576344afbdf66db5f51204a6961a63ce072c8926c\ 3bf7678318e2d5b5340c9e488eefea198576344afbdf66db5f51204a6961a63ce072c8926c
".from_hex().unwrap(); ").to_vec();
h.read_auth(&test_io(), &secret, &auth[0..super::V4_AUTH_PACKET_SIZE]).unwrap(); h.read_auth(&test_io(), &secret, &auth[0..super::V4_AUTH_PACKET_SIZE]).unwrap();
assert_eq!(h.state, super::HandshakeState::ReadingAuthEip8); assert_eq!(h.state, super::HandshakeState::ReadingAuthEip8);
@ -417,20 +416,19 @@ mod test {
let mut h = create_handshake(None); let mut h = create_handshake(None);
let secret = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291".parse().unwrap(); let secret = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291".parse().unwrap();
let auth = let auth =
"\ hex!("
01b8044c6c312173685d1edd268aa95e1d495474c6959bcdd10067ba4c9013df9e40ff45f5bfd6f7\ 01b8044c6c312173685d1edd268aa95e1d495474c6959bcdd10067ba4c9013df9e40ff45f5bfd6f7
2471f93a91b493f8e00abc4b80f682973de715d77ba3a005a242eb859f9a211d93a347fa64b597bf\ 2471f93a91b493f8e00abc4b80f682973de715d77ba3a005a242eb859f9a211d93a347fa64b597bf
280a6b88e26299cf263b01b8dfdb712278464fd1c25840b995e84d367d743f66c0e54a586725b7bb\ 280a6b88e26299cf263b01b8dfdb712278464fd1c25840b995e84d367d743f66c0e54a586725b7bb
f12acca27170ae3283c1073adda4b6d79f27656993aefccf16e0d0409fe07db2dc398a1b7e8ee93b\ f12acca27170ae3283c1073adda4b6d79f27656993aefccf16e0d0409fe07db2dc398a1b7e8ee93b
cd181485fd332f381d6a050fba4c7641a5112ac1b0b61168d20f01b479e19adf7fdbfa0905f63352\ cd181485fd332f381d6a050fba4c7641a5112ac1b0b61168d20f01b479e19adf7fdbfa0905f63352
bfc7e23cf3357657455119d879c78d3cf8c8c06375f3f7d4861aa02a122467e069acaf513025ff19\ bfc7e23cf3357657455119d879c78d3cf8c8c06375f3f7d4861aa02a122467e069acaf513025ff19
6641f6d2810ce493f51bee9c966b15c5043505350392b57645385a18c78f14669cc4d960446c1757\ 6641f6d2810ce493f51bee9c966b15c5043505350392b57645385a18c78f14669cc4d960446c1757
1b7c5d725021babbcd786957f3d17089c084907bda22c2b2675b4378b114c601d858802a55345a15\ 1b7c5d725021babbcd786957f3d17089c084907bda22c2b2675b4378b114c601d858802a55345a15
116bc61da4193996187ed70d16730e9ae6b3bb8787ebcaea1871d850997ddc08b4f4ea668fbf3740\ 116bc61da4193996187ed70d16730e9ae6b3bb8787ebcaea1871d850997ddc08b4f4ea668fbf3740
7ac044b55be0908ecb94d4ed172ece66fd31bfdadf2b97a8bc690163ee11f5b575a4b44e36e2bfb2\ 7ac044b55be0908ecb94d4ed172ece66fd31bfdadf2b97a8bc690163ee11f5b575a4b44e36e2bfb2
f0fce91676fd64c7773bac6a003f481fddd0bae0a1f31aa27504e2a533af4cef3b623f4791b2cca6\ f0fce91676fd64c7773bac6a003f481fddd0bae0a1f31aa27504e2a533af4cef3b623f4791b2cca6
d490\ d490").to_vec();
".from_hex().unwrap();
h.read_auth(&test_io(), &secret, &auth[0..super::V4_AUTH_PACKET_SIZE]).unwrap(); h.read_auth(&test_io(), &secret, &auth[0..super::V4_AUTH_PACKET_SIZE]).unwrap();
assert_eq!(h.state, super::HandshakeState::ReadingAuthEip8); assert_eq!(h.state, super::HandshakeState::ReadingAuthEip8);
@ -448,14 +446,14 @@ mod test {
let mut h = create_handshake(Some(&remote)); let mut h = create_handshake(Some(&remote));
let secret = "49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee".parse().unwrap(); let secret = "49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee".parse().unwrap();
let ack = let ack =
"\ hex!("
049f8abcfa9c0dc65b982e98af921bc0ba6e4243169348a236abe9df5f93aa69d99cadddaa387662\ 049f8abcfa9c0dc65b982e98af921bc0ba6e4243169348a236abe9df5f93aa69d99cadddaa387662
b0ff2c08e9006d5a11a278b1b3331e5aaabf0a32f01281b6f4ede0e09a2d5f585b26513cb794d963\ b0ff2c08e9006d5a11a278b1b3331e5aaabf0a32f01281b6f4ede0e09a2d5f585b26513cb794d963
5a57563921c04a9090b4f14ee42be1a5461049af4ea7a7f49bf4c97a352d39c8d02ee4acc416388c\ 5a57563921c04a9090b4f14ee42be1a5461049af4ea7a7f49bf4c97a352d39c8d02ee4acc416388c
1c66cec761d2bc1c72da6ba143477f049c9d2dde846c252c111b904f630ac98e51609b3b1f58168d\ 1c66cec761d2bc1c72da6ba143477f049c9d2dde846c252c111b904f630ac98e51609b3b1f58168d
dca6505b7196532e5f85b259a20c45e1979491683fee108e9660edbf38f3add489ae73e3dda2c71b\ dca6505b7196532e5f85b259a20c45e1979491683fee108e9660edbf38f3add489ae73e3dda2c71b
d1497113d5c755e942d1\ d1497113d5c755e942d1
".from_hex().unwrap(); ").to_vec();
h.read_ack(&secret, &ack).unwrap(); h.read_ack(&secret, &ack).unwrap();
assert_eq!(h.state, super::HandshakeState::StartSession); assert_eq!(h.state, super::HandshakeState::StartSession);
@ -468,21 +466,21 @@ mod test {
let mut h = create_handshake(Some(&remote)); let mut h = create_handshake(Some(&remote));
let secret = "49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee".parse().unwrap(); let secret = "49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee".parse().unwrap();
let ack = let ack =
"\ hex!("
01ea0451958701280a56482929d3b0757da8f7fbe5286784beead59d95089c217c9b917788989470\ 01ea0451958701280a56482929d3b0757da8f7fbe5286784beead59d95089c217c9b917788989470
b0e330cc6e4fb383c0340ed85fab836ec9fb8a49672712aeabbdfd1e837c1ff4cace34311cd7f4de\ b0e330cc6e4fb383c0340ed85fab836ec9fb8a49672712aeabbdfd1e837c1ff4cace34311cd7f4de
05d59279e3524ab26ef753a0095637ac88f2b499b9914b5f64e143eae548a1066e14cd2f4bd7f814\ 05d59279e3524ab26ef753a0095637ac88f2b499b9914b5f64e143eae548a1066e14cd2f4bd7f814
c4652f11b254f8a2d0191e2f5546fae6055694aed14d906df79ad3b407d94692694e259191cde171\ c4652f11b254f8a2d0191e2f5546fae6055694aed14d906df79ad3b407d94692694e259191cde171
ad542fc588fa2b7333313d82a9f887332f1dfc36cea03f831cb9a23fea05b33deb999e85489e645f\ ad542fc588fa2b7333313d82a9f887332f1dfc36cea03f831cb9a23fea05b33deb999e85489e645f
6aab1872475d488d7bd6c7c120caf28dbfc5d6833888155ed69d34dbdc39c1f299be1057810f34fb\ 6aab1872475d488d7bd6c7c120caf28dbfc5d6833888155ed69d34dbdc39c1f299be1057810f34fb
e754d021bfca14dc989753d61c413d261934e1a9c67ee060a25eefb54e81a4d14baff922180c395d\ e754d021bfca14dc989753d61c413d261934e1a9c67ee060a25eefb54e81a4d14baff922180c395d
3f998d70f46f6b58306f969627ae364497e73fc27f6d17ae45a413d322cb8814276be6ddd13b885b\ 3f998d70f46f6b58306f969627ae364497e73fc27f6d17ae45a413d322cb8814276be6ddd13b885b
201b943213656cde498fa0e9ddc8e0b8f8a53824fbd82254f3e2c17e8eaea009c38b4aa0a3f306e8\ 201b943213656cde498fa0e9ddc8e0b8f8a53824fbd82254f3e2c17e8eaea009c38b4aa0a3f306e8
797db43c25d68e86f262e564086f59a2fc60511c42abfb3057c247a8a8fe4fb3ccbadde17514b7ac\ 797db43c25d68e86f262e564086f59a2fc60511c42abfb3057c247a8a8fe4fb3ccbadde17514b7ac
8000cdb6a912778426260c47f38919a91f25f4b5ffb455d6aaaf150f7e5529c100ce62d6d92826a7\ 8000cdb6a912778426260c47f38919a91f25f4b5ffb455d6aaaf150f7e5529c100ce62d6d92826a7
1778d809bdf60232ae21ce8a437eca8223f45ac37f6487452ce626f549b3b5fdee26afd2072e4bc7\ 1778d809bdf60232ae21ce8a437eca8223f45ac37f6487452ce626f549b3b5fdee26afd2072e4bc7
5833c2464c805246155289f4\ 5833c2464c805246155289f4
".from_hex().unwrap(); ").to_vec();
h.read_ack(&secret, &ack[0..super::V4_ACK_PACKET_SIZE]).unwrap(); h.read_ack(&secret, &ack[0..super::V4_ACK_PACKET_SIZE]).unwrap();
assert_eq!(h.state, super::HandshakeState::ReadingAckEip8); assert_eq!(h.state, super::HandshakeState::ReadingAckEip8);
@ -497,21 +495,21 @@ mod test {
let mut h = create_handshake(Some(&remote)); let mut h = create_handshake(Some(&remote));
let secret = "49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee".parse().unwrap(); let secret = "49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee".parse().unwrap();
let ack = let ack =
"\ hex!("
01f004076e58aae772bb101ab1a8e64e01ee96e64857ce82b1113817c6cdd52c09d26f7b90981cd7\ 01f004076e58aae772bb101ab1a8e64e01ee96e64857ce82b1113817c6cdd52c09d26f7b90981cd7
ae835aeac72e1573b8a0225dd56d157a010846d888dac7464baf53f2ad4e3d584531fa203658fab0\ ae835aeac72e1573b8a0225dd56d157a010846d888dac7464baf53f2ad4e3d584531fa203658fab0
3a06c9fd5e35737e417bc28c1cbf5e5dfc666de7090f69c3b29754725f84f75382891c561040ea1d\ 3a06c9fd5e35737e417bc28c1cbf5e5dfc666de7090f69c3b29754725f84f75382891c561040ea1d
dc0d8f381ed1b9d0d4ad2a0ec021421d847820d6fa0ba66eaf58175f1b235e851c7e2124069fbc20\ dc0d8f381ed1b9d0d4ad2a0ec021421d847820d6fa0ba66eaf58175f1b235e851c7e2124069fbc20
2888ddb3ac4d56bcbd1b9b7eab59e78f2e2d400905050f4a92dec1c4bdf797b3fc9b2f8e84a482f3\ 2888ddb3ac4d56bcbd1b9b7eab59e78f2e2d400905050f4a92dec1c4bdf797b3fc9b2f8e84a482f3
d800386186712dae00d5c386ec9387a5e9c9a1aca5a573ca91082c7d68421f388e79127a5177d4f8\ d800386186712dae00d5c386ec9387a5e9c9a1aca5a573ca91082c7d68421f388e79127a5177d4f8
590237364fd348c9611fa39f78dcdceee3f390f07991b7b47e1daa3ebcb6ccc9607811cb17ce51f1\ 590237364fd348c9611fa39f78dcdceee3f390f07991b7b47e1daa3ebcb6ccc9607811cb17ce51f1
c8c2c5098dbdd28fca547b3f58c01a424ac05f869f49c6a34672ea2cbbc558428aa1fe48bbfd6115\ c8c2c5098dbdd28fca547b3f58c01a424ac05f869f49c6a34672ea2cbbc558428aa1fe48bbfd6115
8b1b735a65d99f21e70dbc020bfdface9f724a0d1fb5895db971cc81aa7608baa0920abb0a565c9c\ 8b1b735a65d99f21e70dbc020bfdface9f724a0d1fb5895db971cc81aa7608baa0920abb0a565c9c
436e2fd13323428296c86385f2384e408a31e104670df0791d93e743a3a5194ee6b076fb6323ca59\ 436e2fd13323428296c86385f2384e408a31e104670df0791d93e743a3a5194ee6b076fb6323ca59
3011b7348c16cf58f66b9633906ba54a2ee803187344b394f75dd2e663a57b956cb830dd7a908d4f\ 3011b7348c16cf58f66b9633906ba54a2ee803187344b394f75dd2e663a57b956cb830dd7a908d4f
39a2336a61ef9fda549180d4ccde21514d117b6c6fd07a9102b5efe710a32af4eeacae2cb3b1dec0\ 39a2336a61ef9fda549180d4ccde21514d117b6c6fd07a9102b5efe710a32af4eeacae2cb3b1dec0
35b9593b48b9d3ca4c13d245d5f04169b0b1\ 35b9593b48b9d3ca4c13d245d5f04169b0b1
".from_hex().unwrap(); ").to_vec();
h.read_ack(&secret, &ack[0..super::V4_ACK_PACKET_SIZE]).unwrap(); h.read_ack(&secret, &ack[0..super::V4_ACK_PACKET_SIZE]).unwrap();
assert_eq!(h.state, super::HandshakeState::ReadingAckEip8); assert_eq!(h.state, super::HandshakeState::ReadingAckEip8);