Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Update Ethereum tests to release 9.0.2 #5

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ethjson/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ethjson/src/test_helpers/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct MultiTransaction {
/// Gas limit set.
pub gas_limit: Vec<Uint>,
/// Gas price.
pub gas_price: Uint,
pub gas_price: Option<Uint>,
/// Nonce.
pub nonce: Uint,
/// Secret key.
Expand All @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion jsontests/res/ethtests
9 changes: 7 additions & 2 deletions jsontests/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
},
};
Expand Down
16 changes: 15 additions & 1 deletion jsontests/tests/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand All @@ -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") }
Expand Down Expand Up @@ -79,11 +80,24 @@ 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") }
#[test] fn st_zero_calls_revert() { run("res/ethtests/GeneralStateTests/stZeroCallsRevert"); }
#[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"); }
}
24 changes: 12 additions & 12 deletions jsontests/tests/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"); }