add asserts in ethash.rs
This commit is contained in:
parent
73ad575306
commit
d35da909db
@ -131,7 +131,11 @@ pub struct Ethash {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json;
|
||||
use spec::ethash::Ethash;
|
||||
use uint::Uint;
|
||||
use util::U256;
|
||||
use hash::Address;
|
||||
use util::hash::H160;
|
||||
use spec::ethash::{Ethash, EthashParams};
|
||||
|
||||
#[test]
|
||||
fn ethash_deserialization() {
|
||||
@ -170,17 +174,71 @@ mod tests {
|
||||
],
|
||||
"difficultyHardforkTransition": "0x59d9",
|
||||
"difficultyHardforkBoundDivisor": "0x0200",
|
||||
"bombDefuseTransition": "0x42",
|
||||
"bombDefuseTransition": "0x41",
|
||||
"eip100bTransition": "0x42",
|
||||
"eip150Transition": "0x42",
|
||||
"eip155Transition": "0x42",
|
||||
"eip160Transition": "0x42",
|
||||
"eip161abcTransition": "0x42",
|
||||
"eip161dTransition": "0x42"
|
||||
"eip150Transition": "0x43",
|
||||
"eip155Transition": "0x44",
|
||||
"eip160Transition": "0x45",
|
||||
"eip161abcTransition": "0x46",
|
||||
"eip161dTransition": "0x47"
|
||||
}
|
||||
}"#;
|
||||
|
||||
let _deserialized: Ethash = serde_json::from_str(s).unwrap();
|
||||
let deserialized: Ethash = serde_json::from_str(s).unwrap();
|
||||
|
||||
assert_eq!(deserialized, Ethash{
|
||||
params: EthashParams{
|
||||
gas_limit_bound_divisor: Uint(U256::from(0x0400)),
|
||||
minimum_difficulty: Uint(U256::from(0x020000)),
|
||||
difficulty_bound_divisor: Uint(U256::from(0x0800)),
|
||||
difficulty_increment_divisor: None,
|
||||
metropolis_difficulty_increment_divisor: None,
|
||||
duration_limit: Uint(U256::from(0x0d)),
|
||||
block_reward: Uint(U256::from(0x4563918244F40000u64)),
|
||||
registrar: Some(Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))),
|
||||
homestead_transition: Some(Uint(U256::from(0x42))),
|
||||
dao_hardfork_transition: Some(Uint(U256::from(0x08))),
|
||||
dao_hardfork_beneficiary: Some(Address(H160::from("0xabcabcabcabcabcabcabcabcabcabcabcabcabca"))),
|
||||
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")),
|
||||
]),
|
||||
difficulty_hardfork_transition: Some(Uint(U256::from(0x59d9))),
|
||||
difficulty_hardfork_bound_divisor: Some(Uint(U256::from(0x0200))),
|
||||
bomb_defuse_transition: Some(Uint(U256::from(0x41))),
|
||||
eip100b_transition: Some(Uint(U256::from(0x42))),
|
||||
eip150_transition: Some(Uint(U256::from(0x43))),
|
||||
eip155_transition: Some(Uint(U256::from(0x44))),
|
||||
eip160_transition: Some(Uint(U256::from(0x45))),
|
||||
eip161abc_transition: Some(Uint(U256::from(0x46))),
|
||||
eip161d_transition: Some(Uint(U256::from(0x47))),
|
||||
ecip1010_pause_transition: None,
|
||||
ecip1010_continue_transition: None,
|
||||
max_code_size: None,
|
||||
max_gas_limit_transition: None,
|
||||
max_gas_limit: None,
|
||||
min_gas_price_transition: None,
|
||||
min_gas_price: None,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -195,6 +253,38 @@ mod tests {
|
||||
}
|
||||
}"#;
|
||||
|
||||
let _deserialized: Ethash = serde_json::from_str(s).unwrap();
|
||||
let deserialized: Ethash = serde_json::from_str(s).unwrap();
|
||||
assert_eq!(deserialized, Ethash{
|
||||
params: EthashParams{
|
||||
gas_limit_bound_divisor: Uint(U256::from(0x0400)),
|
||||
minimum_difficulty: Uint(U256::from(0x020000)),
|
||||
difficulty_bound_divisor: Uint(U256::from(0x0800)),
|
||||
difficulty_increment_divisor: None,
|
||||
metropolis_difficulty_increment_divisor: None,
|
||||
duration_limit: Uint(U256::from(0x0d)),
|
||||
block_reward: Uint(U256::from(0x4563918244F40000u64)),
|
||||
registrar: None,
|
||||
homestead_transition: None,
|
||||
dao_hardfork_transition: None,
|
||||
dao_hardfork_beneficiary: None,
|
||||
dao_hardfork_accounts: None,
|
||||
difficulty_hardfork_transition: None,
|
||||
difficulty_hardfork_bound_divisor: None,
|
||||
bomb_defuse_transition: None,
|
||||
eip100b_transition: None,
|
||||
eip150_transition: None,
|
||||
eip155_transition: None,
|
||||
eip160_transition: None,
|
||||
eip161abc_transition: None,
|
||||
eip161d_transition: None,
|
||||
ecip1010_pause_transition: None,
|
||||
ecip1010_continue_transition: None,
|
||||
max_code_size: None,
|
||||
max_gas_limit_transition: None,
|
||||
max_gas_limit: None,
|
||||
min_gas_price_transition: None,
|
||||
min_gas_price: None,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user