From 9826fcd3a4175d7834d5465c4848b7af4c813dc5 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 2 Aug 2018 17:28:40 +0800 Subject: [PATCH] Comply EIP210 with the current spec --- ethcore/src/engines/mod.rs | 2 +- ethcore/src/externalities.rs | 1 - ethcore/src/tests/evm.rs | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 8f67a039f56..7cf7f98a070 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -60,7 +60,7 @@ use types::ancestry_action::AncestryAction; /// Default EIP-210 contract code. /// As defined in https://github.com/ethereum/EIPs/pull/210 -pub const DEFAULT_BLOCKHASH_CONTRACT: &'static str = "73fffffffffffffffffffffffffffffffffffffffe33141561006a5760014303600035610100820755610100810715156100455760003561010061010083050761010001555b6201000081071515610064576000356101006201000083050761020001555b5061013e565b4360003512151561008457600060405260206040f361013d565b61010060003543031315156100a857610100600035075460605260206060f361013c565b6101006000350715156100c55762010000600035430313156100c8565b60005b156100ea576101006101006000350507610100015460805260206080f361013b565b620100006000350715156101095763010000006000354303131561010c565b60005b1561012f57610100620100006000350507610200015460a052602060a0f361013a565b600060c052602060c0f35b5b5b5b5b"; +pub const DEFAULT_BLOCKHASH_CONTRACT: &'static str = "600073fffffffffffffffffffffffffffffffffffffffe33141561005957600143035b60011561005357600035610100820683015561010081061561004057005b6101008104905061010082019150610022565b506100e0565b4360003512156100d4576000356001814303035b61010081121515610085576000610100830614610088565b60005b156100a75761010083019250610100820491506101008104905061006d565b610100811215156100bd57600060a052602060a0f35b610100820683015460c052602060c0f350506100df565b600060e052602060e0f35b5b50"; /// Fork choice. #[derive(Debug, PartialEq, Eq)] diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index 68d2c0817f0..adc40cbe0aa 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -613,7 +613,6 @@ mod tests { let address = { let mut ext = Externalities::new(state, &setup.env_info, &setup.machine, &setup.schedule, 0, get_test_origin(), &mut setup.sub_state, OutputPolicy::InitContract(None), &mut tracer, &mut vm_tracer, false); - match ext.create(&U256::max_value(), &U256::zero(), &[], CreateContractAddress::FromSenderSaltAndCodeHash(H256::default())) { ContractCreateResult::Created(address, _) => address, _ => panic!("Test create failed; expected Created, got Failed/Reverted."), diff --git a/ethcore/src/tests/evm.rs b/ethcore/src/tests/evm.rs index 239905facf4..fad1f8cb136 100644 --- a/ethcore/src/tests/evm.rs +++ b/ethcore/src/tests/evm.rs @@ -35,8 +35,8 @@ evm_test!{test_blockhash_eip210: test_blockhash_eip210_int} fn test_blockhash_eip210(factory: Factory) { let get_prev_hash_code = Arc::new("600143034060205260206020f3".from_hex().unwrap()); // this returns previous block hash let get_prev_hash_code_hash = keccak(get_prev_hash_code.as_ref()); - // This is same as DEFAULT_BLOCKHASH_CONTRACT except for metropolis transition block check removed. - let test_blockhash_contract = "73fffffffffffffffffffffffffffffffffffffffe33141561007a57600143036020526000356101006020510755600061010060205107141561005057600035610100610100602051050761010001555b6000620100006020510714156100755760003561010062010000602051050761020001555b61014a565b4360003512151561009057600060405260206040f35b610100600035430312156100b357610100600035075460605260206060f3610149565b62010000600035430312156100d157600061010060003507146100d4565b60005b156100f6576101006101006000350507610100015460805260206080f3610148565b630100000060003543031215610116576000620100006000350714610119565b60005b1561013c57610100620100006000350507610200015460a052602060a0f3610147565b600060c052602060c0f35b5b5b5b5b"; + // This is same as DEFAULT_BLOCKHASH_CONTRACT + let test_blockhash_contract = "600073fffffffffffffffffffffffffffffffffffffffe33141561005957600143035b60011561005357600035610100820683015561010081061561004057005b6101008104905061010082019150610022565b506100e0565b4360003512156100d4576000356001814303035b61010081121515610085576000610100830614610088565b60005b156100a75761010083019250610100820491506101008104905061006d565b610100811215156100bd57600060a052602060a0f35b610100820683015460c052602060c0f350506100df565b600060e052602060e0f35b5b50"; let blockhash_contract_code = Arc::new(test_blockhash_contract.from_hex().unwrap()); let blockhash_contract_code_hash = keccak(blockhash_contract_code.as_ref()); let machine = ::ethereum::new_constantinople_test_machine();