Upgrade ethereum types (#10670)
* cargo upgrade "ethereum-types" --all --allow-prerelease * [ethash] fix compilation errors * [ethkey] fix compilation errors * [journaldb] fix compilation errors * [dir] fix compilation errors * [ethabi] update to 0.7 * wip * [eip-712] fix compilation errors * [ethjson] fix compilation errors * [Cargo.toml] add TODO to remove patches * [ethstore] fix compilation errors * use patched keccak-hash with new primitive-types * wip * [ethcore-network-devp2p] fix compilation errors * [vm] fix compilation errors * [common-types, evm, wasm] fix compilation errors * [ethcore-db] Require AsRef instead of Deref for keys * [ethcore-blockchain] fix some compilation errors * [blooms-db] fix compilation errors Thanks a lot @dvdplm :) * we don't need no rlp ethereum feature * [ethcore] fix some compilation errors * [parity-ipfs-api] fix compilation error * [ethcore-light] fix compilation errors * [Cargo.lock] update parity-common * [ethcore-private-tx] fix some compilation errors * wip * [ethcore-private-tx] fix compilation errors * [parity-updater] fix compilation errors * [parity-rpc] fix compilation errors * [parity-bin] fix other compilation errors * update to new ethereum-types * update keccak-hash * [fastmap] fix compilation in tests * [blooms-db] fix compilation in tests * [common-types] fix compilation in tests * [triehash-ethereum] fix compilation in tests * [ethkey] fix compilation in tests * [pwasm-run-test] fix compilation errors * [wasm] fix compilation errors * [ethjson] fix compilation in tests * [eip-712] fix compilation in tests * [ethcore-blockchain] fix compilation in tests * [ethstore] fix compilation in tests * [ethstore-accounts] fix compilation in tests * [parity-hash-fetch] fix compilation in tests * [parity-whisper] fix compilation in tests * [ethcore-miner] fix compilation in tests * [ethcore-network-devp2p] fix compilation in tests * [*] upgrade rand to 0.6 * [evm] get rid of num-bigint conversions * [ethcore] downgrade trie-standardmap and criterion * [ethcore] fix some warnings * [ethcore] fix compilation in tests * [evmbin] fix compilation in tests * [updater] fix compilation in tests * [ethash] fix compilation in tests * [ethcore-secretstore] fix compilation in tests * [ethcore-sync] fix compilation in tests * [parity-rpc] fix compilation in tests * [ethcore] finally fix compilation in tests FUCK YEAH!!! * [ethstore] lazy_static is unused * [ethcore] fix test * fix up bad merge * [Cargo.toml] remove unused patches * [*] replace some git dependencies with crates.io * [Cargo.toml] remove unused lazy_static * [*] clean up * [ethcore] fix transaction_filter_deprecated test * [private-tx] fix serialization tests * fix more serialization tests * [ethkey] fix smoky test * [rpc] fix tests, please? * [ethcore] remove commented out code * Apply suggestions from code review Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * [ethstore] remove unused dev-dependency * [ethcore] remove resolved TODO * [*] resolve keccak-hash TODO * [*] s/Address::default()/Address::zero() * [rpc] remove Subscribers::new_test * [rpc] remove EthPubSubClient::new_test * [ethcore] use trie-standardmap from crates.io * [dir] fix db_root_path * [ethcore] simplify snapshot::tests::helpers::fill_storage * Apply suggestions from code review Co-Authored-By: David <dvdplm@gmail.com> * [ethcore-secretstore] resolve TODO in serialization * [ethcore-network-devp2p] resolve TODO in save_key * [Cargo.lock] update triehash * [*] use ethabi from crates.io * [ethkey] use secp256k1 from master branch * [Cargo.lock] update eth-secp256k1
This commit is contained in:
@@ -76,6 +76,7 @@ mod tests {
|
||||
use hash::Address;
|
||||
use spec::validator_set::ValidatorSet;
|
||||
use spec::authority_round::AuthorityRound;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn authority_round_deserialization() {
|
||||
@@ -95,7 +96,10 @@ mod tests {
|
||||
|
||||
let deserialized: AuthorityRound = serde_json::from_str(s).unwrap();
|
||||
assert_eq!(deserialized.params.step_duration, Uint(U256::from(0x02)));
|
||||
assert_eq!(deserialized.params.validators, ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]));
|
||||
assert_eq!(
|
||||
deserialized.params.validators,
|
||||
ValidatorSet::List(vec![Address(H160::from_str("c6d9d2cd449a754c494264e1809c50e34d64562b").unwrap())]),
|
||||
);
|
||||
assert_eq!(deserialized.params.start_step, Some(Uint(U256::from(24))));
|
||||
assert_eq!(deserialized.params.immediate_transitions, None);
|
||||
assert_eq!(deserialized.params.maximum_uncle_count_transition, Some(Uint(10_000_000.into())));
|
||||
|
||||
@@ -46,6 +46,7 @@ mod tests {
|
||||
use hash::Address;
|
||||
use spec::basic_authority::BasicAuthority;
|
||||
use spec::validator_set::ValidatorSet;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn basic_authority_deserialization() {
|
||||
@@ -61,7 +62,7 @@ mod tests {
|
||||
let deserialized: BasicAuthority = serde_json::from_str(s).unwrap();
|
||||
|
||||
assert_eq!(deserialized.params.duration_limit, Uint(U256::from(0x0d)));
|
||||
let vs = ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]);
|
||||
let vs = ValidatorSet::List(vec![Address(H160::from_str("c6d9d2cd449a754c494264e1809c50e34d64562b").unwrap())]);
|
||||
assert_eq!(deserialized.params.validators, vs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ pub struct Clique {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json;
|
||||
use uint::Uint;
|
||||
use ethereum_types::U256;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -115,6 +115,7 @@ mod tests {
|
||||
use ethereum_types::{H160, U256};
|
||||
use hash::Address;
|
||||
use spec::ethash::{Ethash, EthashParams, BlockReward};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn ethash_deserialization() {
|
||||
@@ -171,28 +172,28 @@ mod tests {
|
||||
block_reward_contract_code: None,
|
||||
block_reward_contract_transition: None,
|
||||
dao_hardfork_transition: Some(Uint(U256::from(0x08))),
|
||||
dao_hardfork_beneficiary: Some(Address(H160::from("0xabcabcabcabcabcabcabcabcabcabcabcabcabca"))),
|
||||
dao_hardfork_beneficiary: Some(Address(H160::from_str("abcabcabcabcabcabcabcabcabcabcabcabcabca").unwrap())),
|
||||
dao_hardfork_accounts: Some(vec![
|
||||
Address(H160::from("0x304a554a310c7e546dfe434669c62820b7d83490")),
|
||||
Address(H160::from("0x914d1b8b43e92723e64fd0a06f5bdb8dd9b10c79")),
|
||||
Address(H160::from("0xfe24cdd8648121a43a7c86d289be4dd2951ed49f")),
|
||||
Address(H160::from("0x17802f43a0137c506ba92291391a8a8f207f487d")),
|
||||
Address(H160::from("0xb136707642a4ea12fb4bae820f03d2562ebff487")),
|
||||
Address(H160::from("0xdbe9b615a3ae8709af8b93336ce9b477e4ac0940")),
|
||||
Address(H160::from("0xf14c14075d6c4ed84b86798af0956deef67365b5")),
|
||||
Address(H160::from("0xca544e5c4687d109611d0f8f928b53a25af72448")),
|
||||
Address(H160::from("0xaeeb8ff27288bdabc0fa5ebb731b6f409507516c")),
|
||||
Address(H160::from("0xcbb9d3703e651b0d496cdefb8b92c25aeb2171f7")),
|
||||
Address(H160::from("0xaccc230e8a6e5be9160b8cdf2864dd2a001c28b6")),
|
||||
Address(H160::from("0x2b3455ec7fedf16e646268bf88846bd7a2319bb2")),
|
||||
Address(H160::from("0x4613f3bca5c44ea06337a9e439fbc6d42e501d0a")),
|
||||
Address(H160::from("0xd343b217de44030afaa275f54d31a9317c7f441e")),
|
||||
Address(H160::from("0x84ef4b2357079cd7a7c69fd7a37cd0609a679106")),
|
||||
Address(H160::from("0xda2fef9e4a3230988ff17df2165440f37e8b1708")),
|
||||
Address(H160::from("0xf4c64518ea10f995918a454158c6b61407ea345c")),
|
||||
Address(H160::from("0x7602b46df5390e432ef1c307d4f2c9ff6d65cc97")),
|
||||
Address(H160::from("0xbb9bc244d798123fde783fcc1c72d3bb8c189413")),
|
||||
Address(H160::from("0x807640a13483f8ac783c557fcdf27be11ea4ac7a")),
|
||||
Address(H160::from_str("304a554a310c7e546dfe434669c62820b7d83490").unwrap()),
|
||||
Address(H160::from_str("914d1b8b43e92723e64fd0a06f5bdb8dd9b10c79").unwrap()),
|
||||
Address(H160::from_str("fe24cdd8648121a43a7c86d289be4dd2951ed49f").unwrap()),
|
||||
Address(H160::from_str("17802f43a0137c506ba92291391a8a8f207f487d").unwrap()),
|
||||
Address(H160::from_str("b136707642a4ea12fb4bae820f03d2562ebff487").unwrap()),
|
||||
Address(H160::from_str("dbe9b615a3ae8709af8b93336ce9b477e4ac0940").unwrap()),
|
||||
Address(H160::from_str("f14c14075d6c4ed84b86798af0956deef67365b5").unwrap()),
|
||||
Address(H160::from_str("ca544e5c4687d109611d0f8f928b53a25af72448").unwrap()),
|
||||
Address(H160::from_str("aeeb8ff27288bdabc0fa5ebb731b6f409507516c").unwrap()),
|
||||
Address(H160::from_str("cbb9d3703e651b0d496cdefb8b92c25aeb2171f7").unwrap()),
|
||||
Address(H160::from_str("accc230e8a6e5be9160b8cdf2864dd2a001c28b6").unwrap()),
|
||||
Address(H160::from_str("2b3455ec7fedf16e646268bf88846bd7a2319bb2").unwrap()),
|
||||
Address(H160::from_str("4613f3bca5c44ea06337a9e439fbc6d42e501d0a").unwrap()),
|
||||
Address(H160::from_str("d343b217de44030afaa275f54d31a9317c7f441e").unwrap()),
|
||||
Address(H160::from_str("84ef4b2357079cd7a7c69fd7a37cd0609a679106").unwrap()),
|
||||
Address(H160::from_str("da2fef9e4a3230988ff17df2165440f37e8b1708").unwrap()),
|
||||
Address(H160::from_str("f4c64518ea10f995918a454158c6b61407ea345c").unwrap()),
|
||||
Address(H160::from_str("7602b46df5390e432ef1c307d4f2c9ff6d65cc97").unwrap()),
|
||||
Address(H160::from_str("bb9bc244d798123fde783fcc1c72d3bb8c189413").unwrap()),
|
||||
Address(H160::from_str("807640a13483f8ac783c557fcdf27be11ea4ac7a").unwrap()),
|
||||
]),
|
||||
difficulty_hardfork_transition: Some(Uint(U256::from(0x59d9))),
|
||||
difficulty_hardfork_bound_divisor: Some(Uint(U256::from(0x0200))),
|
||||
|
||||
@@ -82,19 +82,19 @@ mod tests {
|
||||
let deserialized: Genesis = serde_json::from_str(s).unwrap();
|
||||
assert_eq!(deserialized, Genesis {
|
||||
seal: Seal::Ethereum(Ethereum {
|
||||
nonce: H64(Eth64::from("0x00006d6f7264656e")),
|
||||
mix_hash: H256(Eth256::from("0x0000000000000000000000000000000000000000000000000000000000000000"))
|
||||
nonce: H64(Eth64::from_str("00006d6f7264656e").unwrap()),
|
||||
mix_hash: H256(Eth256::from_str("0000000000000000000000000000000000000000000000000000000000000000").unwrap())
|
||||
}),
|
||||
difficulty: Uint(U256::from(0x400000000u64)),
|
||||
author: Some(Address(H160::from("0x1000000000000000000000000000000000000001"))),
|
||||
author: Some(Address(H160::from_str("1000000000000000000000000000000000000001").unwrap())),
|
||||
timestamp: Some(Uint(U256::from(0x07))),
|
||||
parent_hash: Some(H256(Eth256::from("0x9000000000000000000000000000000000000000000000000000000000000000"))),
|
||||
parent_hash: Some(H256(Eth256::from_str("9000000000000000000000000000000000000000000000000000000000000000").unwrap())),
|
||||
gas_limit: Uint(U256::from(0x1388)),
|
||||
transactions_root: None,
|
||||
receipts_root: None,
|
||||
state_root: Some(H256(Eth256::from("0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"))),
|
||||
state_root: Some(H256(Eth256::from_str("d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544").unwrap())),
|
||||
gas_used: None,
|
||||
extra_data: Some(Bytes::from_str("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa").unwrap()),
|
||||
extra_data: Some(Bytes::from_str("11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa").unwrap()),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ mod tests {
|
||||
use ethereum_types::{U256, H256 as Eth256};
|
||||
use hash::H256;
|
||||
use spec::hardcoded_sync::HardcodedSync;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn hardcoded_sync_deserialization() {
|
||||
@@ -56,8 +57,8 @@ mod tests {
|
||||
header: String::from("f901f9a0d405da4e66f1445d455195229624e133f5baafe72b5cf7b3c36c12c8146e98b7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a05fb2b4bfdef7b314451cb138a534d225c922fc0e5fbe25e451142732c3e25c25a088d2ec6b9860aae1a2c3b299f72b6a5d70d7f7ba4722c78f2c49ba96273c2158a007c6fdfa8eea7e86b81f5b0fc0f78f90cc19f4aa60d323151e0cac660199e9a1b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefba82524d84568e932a80a0a0349d8c3df71f1a48a9df7d03fd5f14aeee7d91332c009ecaff0a71ead405bd88ab4e252a7e8c2a23"),
|
||||
total_difficulty: Uint(U256::from(0x400000000u64)),
|
||||
chts: vec![
|
||||
H256(Eth256::from("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa")),
|
||||
H256(Eth256::from("0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544")),
|
||||
H256(Eth256::from_str("11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa").unwrap()),
|
||||
H256(Eth256::from_str("d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544").unwrap()),
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ mod tests {
|
||||
use uint::Uint;
|
||||
use ethereum_types::{U256, H64 as Eth64, H256 as Eth256, H520 as Eth520};
|
||||
use spec::{Ethereum, AuthorityRoundSeal, TendermintSeal, Seal};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn seal_deserialization() {
|
||||
@@ -106,8 +107,8 @@ mod tests {
|
||||
|
||||
// [0]
|
||||
assert_eq!(deserialized[0], Seal::Ethereum(Ethereum {
|
||||
nonce: H64(Eth64::from("0x0000000000000042")),
|
||||
mix_hash: H256(Eth256::from("0x1000000000000000000000000000000000000000000000000000000000000001"))
|
||||
nonce: H64(Eth64::from_str("0000000000000042").unwrap()),
|
||||
mix_hash: H256(Eth256::from_str("1000000000000000000000000000000000000000000000000000000000000001").unwrap())
|
||||
}));
|
||||
|
||||
// [1]
|
||||
@@ -118,14 +119,14 @@ mod tests {
|
||||
// [2]
|
||||
assert_eq!(deserialized[2], Seal::AuthorityRound(AuthorityRoundSeal {
|
||||
step: Uint(U256::from(0x0)),
|
||||
signature: H520(Eth520::from("0x2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002"))
|
||||
signature: H520(Eth520::from_str("2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002").unwrap())
|
||||
}));
|
||||
|
||||
// [3]
|
||||
assert_eq!(deserialized[3], Seal::Tendermint(TendermintSeal {
|
||||
round: Uint(U256::from(0x3)),
|
||||
proposal: H520(Eth520::from("0x3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003")),
|
||||
precommits: vec![H520(Eth520::from("0x4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004"))]
|
||||
proposal: H520(Eth520::from_str("3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003").unwrap()),
|
||||
precommits: vec![H520(Eth520::from_str("4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004").unwrap())]
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ mod tests {
|
||||
use ethereum_types::{H160, U256};
|
||||
use hash::Address;
|
||||
use spec::validator_set::ValidatorSet;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn validator_set_deserialization() {
|
||||
@@ -62,9 +63,9 @@ mod tests {
|
||||
let deserialized: Vec<ValidatorSet> = serde_json::from_str(s).unwrap();
|
||||
assert_eq!(deserialized.len(), 4);
|
||||
|
||||
assert_eq!(deserialized[0], ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]));
|
||||
assert_eq!(deserialized[1], ValidatorSet::SafeContract(Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))));
|
||||
assert_eq!(deserialized[2], ValidatorSet::Contract(Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))));
|
||||
assert_eq!(deserialized[0], ValidatorSet::List(vec![Address(H160::from_str("c6d9d2cd449a754c494264e1809c50e34d64562b").unwrap())]));
|
||||
assert_eq!(deserialized[1], ValidatorSet::SafeContract(Address(H160::from_str("c6d9d2cd449a754c494264e1809c50e34d64562b").unwrap())));
|
||||
assert_eq!(deserialized[2], ValidatorSet::Contract(Address(H160::from_str("c6d9d2cd449a754c494264e1809c50e34d64562b").unwrap())));
|
||||
match deserialized[3] {
|
||||
ValidatorSet::Multi(ref map) => {
|
||||
assert_eq!(map.len(), 3);
|
||||
|
||||
Reference in New Issue
Block a user