diff --git a/ethjson/src/spec/spec.rs b/ethjson/src/spec/spec.rs index 182bf95..8862634 100644 --- a/ethjson/src/spec/spec.rs +++ b/ethjson/src/spec/spec.rs @@ -40,8 +40,10 @@ pub enum ForkSpec { ConstantinopleFix, /// Istanbul (#9,069,000, 2019-12-08) Istanbul, - /// Berlin (To be announced) + /// Berlin (#12,244,000, 2021-04-15) Berlin, + /// London (To be announced) + London, /// Byzantium transition test-net EIP158ToByzantiumAt5, /// Homestead transition test-net diff --git a/ethjson/src/test_helpers/state.rs b/ethjson/src/test_helpers/state.rs index 170366e..651645f 100644 --- a/ethjson/src/test_helpers/state.rs +++ b/ethjson/src/test_helpers/state.rs @@ -55,7 +55,7 @@ pub struct MultiTransaction { /// Gas limit set. pub gas_limit: Vec, /// Gas price. - pub gas_price: Uint, + pub gas_price: Option, /// Nonce. pub nonce: Uint, /// Secret key. @@ -73,7 +73,7 @@ impl MultiTransaction { Transaction { data: self.data[indexes.data as usize].clone(), gas_limit: self.gas_limit[indexes.gas as usize], - gas_price: self.gas_price, + gas_price: self.gas_price.expect("transaction formats without gasPrice are not supported yet"), nonce: self.nonce, to: self.to.clone(), value: self.value[indexes.value as usize], diff --git a/jsontests/res/ethtests b/jsontests/res/ethtests index 63c2b72..5d65138 160000 --- a/jsontests/res/ethtests +++ b/jsontests/res/ethtests @@ -1 +1 @@ -Subproject commit 63c2b72ff9d81a07c03dac46977218156cd136bf +Subproject commit 5d651381daf9d12cc663a7326b3b16d7bb4c1aa0 diff --git a/jsontests/src/state.rs b/jsontests/src/state.rs index 58c5eca..c758a68 100644 --- a/jsontests/src/state.rs +++ b/jsontests/src/state.rs @@ -27,7 +27,7 @@ impl Test { pub fn unwrap_to_vicinity(&self) -> MemoryVicinity { MemoryVicinity { - gas_price: self.0.transaction.gas_price.clone().into(), + gas_price: self.0.transaction.gas_price.as_ref().unwrap().clone().into(), origin: self.unwrap_caller(), block_hashes: Vec::new(), block_number: self.0.env.number.clone().into(), @@ -95,11 +95,16 @@ pub fn test(name: &str, test: Test) { } pub fn test_run(name: &str, test: Test) { + if test.0.transaction.gas_price.is_none() { + println!("Skip {}: transaction without gasPrice", name); + return; + } + for (spec, states) in &test.0.post_states { let (gasometer_config, precompile, delete_empty) = match spec { ethjson::spec::ForkSpec::Istanbul => (Config::istanbul(), istanbul_precompile, true), spec => { - println!("Skip spec {:?}", spec); + println!("Skip {}:{:?}", name, spec); continue }, }; diff --git a/jsontests/tests/state.rs b/jsontests/tests/state.rs index 1624400..25d2e3f 100644 --- a/jsontests/tests/state.rs +++ b/jsontests/tests/state.rs @@ -41,7 +41,6 @@ pub fn run(dir: &str) { #[test] fn st_call_delegate_codes_call_code_homestead() { run("res/ethtests/GeneralStateTests/stCallDelegateCodesCallCodeHomestead") } #[test] fn st_call_delegate_codes_homestead() { run("res/ethtests/GeneralStateTests/stCallDelegateCodesHomestead") } #[test] fn st_chain_id() { run("res/ethtests/GeneralStateTests/stChainId") } -#[test] fn st_changed_eip150() { run("res/ethtests/GeneralStateTests/stChangedEIP150") } #[test] fn st_code_copy() { run("res/ethtests/GeneralStateTests/stCodeCopyTest") } #[test] fn st_code_size_limit() { run("res/ethtests/GeneralStateTests/stCodeSizeLimit") } #[test] #[ignore] fn st_create2() { run("res/ethtests/GeneralStateTests/stCreate2") } @@ -50,6 +49,8 @@ pub fn run(dir: &str) { #[test] fn st_eip150_single_code_gas_prices() { run("res/ethtests/GeneralStateTests/stEIP150singleCodeGasPrices") } #[test] fn st_eip150_specific() { run("res/ethtests/GeneralStateTests/stEIP150Specific") } #[test] fn st_eip158_specific() { run("res/ethtests/GeneralStateTests/stEIP158Specific") } +#[test] fn st_eip1559() { run("res/ethtests/GeneralStateTests/stEIP1559") } +#[test] fn st_eip2930() { run("res/ethtests/GeneralStateTests/stEIP2930") } #[test] fn st_example() { run("res/ethtests/GeneralStateTests/stExample") } #[test] fn st_ext_code_hash() { run("res/ethtests/GeneralStateTests/stExtCodeHash") } #[test] fn st_homestead_specific() { run("res/ethtests/GeneralStateTests/stHomesteadSpecific") } @@ -79,7 +80,9 @@ pub fn run(dir: &str) { #[test] #[ignore] fn st_sstore() { run("res/ethtests/GeneralStateTests/stSStoreTest") } #[test] fn st_stack() { run("res/ethtests/GeneralStateTests/stStackTests") } #[test] #[ignore] fn st_static_call() { run("res/ethtests/GeneralStateTests/stStaticCall") } +#[test] fn st_static_flag_enabled() { run("res/ethtests/GeneralStateTests/stStaticFlagEnabled") } #[test] fn st_system_operations() { run("res/ethtests/GeneralStateTests/stSystemOperationsTest") } +#[test] #[ignore] fn st_time_consuming() { run("res/ethtests/GeneralStateTests/stTimeConsuming") } #[test] fn st_transaction() { run("res/ethtests/GeneralStateTests/stTransactionTest") } #[test] fn st_transition() { run("res/ethtests/GeneralStateTests/stTransitionTest") } #[test] fn st_wallet() { run("res/ethtests/GeneralStateTests/stWalletTest") } @@ -87,3 +90,14 @@ pub fn run(dir: &str) { #[test] fn st_zero_calls() { run("res/ethtests/GeneralStateTests/stZeroCallsTest") } #[test] fn st_zero_knowledge() { run("res/ethtests/GeneralStateTests/stZeroKnowledge") } #[test] fn st_zero_knowledge2() { run("res/ethtests/GeneralStateTests/stZeroKnowledge2") } + +mod vm { + use super::*; + + #[test] fn vm_arithmetic() { run("res/ethtests/GeneralStateTests/VMTests/vmArithmeticTest"); } + #[test] fn vm_bitwise_logic() { run("res/ethtests/GeneralStateTests/VMTests/vmBitwiseLogicOperation"); } + #[test] fn vm_io_and_flow() { run("res/ethtests/GeneralStateTests/VMTests/vmIOandFlowOperations"); } + #[test] fn vm_log() { run("res/ethtests/GeneralStateTests/VMTests/vmLogTest"); } + #[test] #[ignore] fn vm_performance() { run("res/ethtests/GeneralStateTests/VMTests/vmPerformance"); } + #[test] fn vm_other() { run("res/ethtests/GeneralStateTests/VMTests/vmTests"); } +} diff --git a/jsontests/tests/vm.rs b/jsontests/tests/vm.rs index 9d5ff75..30808b0 100644 --- a/jsontests/tests/vm.rs +++ b/jsontests/tests/vm.rs @@ -26,15 +26,15 @@ pub fn run(dir: &str) { } } -#[test] fn vm_arithmetic() { run("res/ethtests/VMTests/vmArithmeticTest"); } -#[test] fn vm_bitwise_logic() { run("res/ethtests/VMTests/vmBitwiseLogicOperation"); } -#[test] fn vm_block_info() { run("res/ethtests/VMTests/vmBlockInfoTest"); } -#[test] fn vm_environmental_info() { run("res/ethtests/VMTests/vmEnvironmentalInfo"); } -#[test] fn vm_io_and_flow() { run("res/ethtests/VMTests/vmIOandFlowOperations"); } -#[test] fn vm_log() { run("res/ethtests/VMTests/vmLogTest"); } -#[test] #[ignore] fn vm_performance() { run("res/ethtests/VMTests/vmPerformance"); } -#[test] fn vm_push_dup_swap() { run("res/ethtests/VMTests/vmPushDupSwapTest"); } -#[test] fn vm_random() { run("res/ethtests/VMTests/vmRandomTest"); } -#[test] fn vm_sha3() { run("res/ethtests/VMTests/vmSha3Test"); } -#[test] fn vm_system() { run("res/ethtests/VMTests/vmSystemOperations"); } -#[test] fn vm_other() { run("res/ethtests/VMTests/vmTests"); } +#[test] fn vm_arithmetic() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmArithmeticTest"); } +#[test] fn vm_bitwise_logic() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmBitwiseLogicOperation"); } +#[test] fn vm_block_info() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmBlockInfoTest"); } +#[test] fn vm_environmental_info() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmEnvironmentalInfo"); } +#[test] fn vm_io_and_flow() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmIOandFlowOperations"); } +#[test] fn vm_log() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmLogTest"); } +#[test] #[ignore] fn vm_performance() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmPerformance"); } +#[test] fn vm_push_dup_swap() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmPushDupSwapTest"); } +#[test] fn vm_random() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmRandomTest"); } +#[test] fn vm_sha3() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmSha3Test"); } +#[test] fn vm_system() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmSystemOperations"); } +#[test] fn vm_other() { run("res/ethtests/LegacyTests/Constantinople/VMTests/vmTests"); }