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

Commit

Permalink
Add subroutine json tests. Fix gas tier.
Browse files Browse the repository at this point in the history
  • Loading branch information
adria0 committed May 26, 2020
1 parent 4f8b425 commit 138dbfc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "ethcore/res/ethereum/tests"]
path = ethcore/res/ethereum/tests
url = https://github.com/ethereum/tests.git
branch = v7.0.0
branch = develop
[submodule "ethcore/res/wasm-tests"]
path = ethcore/res/wasm-tests
url = https://github.com/openethereum/wasm-tests
4 changes: 2 additions & 2 deletions ethcore/evm/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ lazy_static! {
arr[LOG3 as usize] = Some(InstructionInfo::new("LOG3", 5, 0, GasPriceTier::Special));
arr[LOG4 as usize] = Some(InstructionInfo::new("LOG4", 6, 0, GasPriceTier::Special));
arr[BEGINSUB as usize] = Some(InstructionInfo::new("BEGINSUB", 0, 0, GasPriceTier::Base));
arr[JUMPSUB as usize] = Some(InstructionInfo::new("JUMPSUB", 1, 0, GasPriceTier::Low));
arr[RETURNSUB as usize] = Some(InstructionInfo::new("RETURNSUB", 0, 0, GasPriceTier::VeryLow));
arr[JUMPSUB as usize] = Some(InstructionInfo::new("JUMPSUB", 1, 0, GasPriceTier::Mid));
arr[RETURNSUB as usize] = Some(InstructionInfo::new("RETURNSUB", 0, 0, GasPriceTier::Base));
arr[CREATE as usize] = Some(InstructionInfo::new("CREATE", 3, 1, GasPriceTier::Special));
arr[CALL as usize] = Some(InstructionInfo::new("CALL", 7, 1, GasPriceTier::Special));
arr[CALLCODE as usize] = Some(InstructionInfo::new("CALLCODE", 7, 1, GasPriceTier::Special));
Expand Down
16 changes: 8 additions & 8 deletions ethcore/evm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ fn test_subs_simple(factory: super::Factory) {
let code = hex!("6004b300b2b7").to_vec();

let mut params = ActionParams::default();
params.gas = U256::from(11);
params.gas = U256::from(13);
params.code = Some(Arc::new(code));
let mut ext = FakeExt::new_berlin();

Expand All @@ -808,10 +808,10 @@ fn test_subs_simple(factory: super::Factory) {
evm_test!{test_subs_two_levels: test_subs_two_levels_int}
fn test_subs_two_levels(factory: super::Factory) {
// as defined in https://eips.ethereum.org/EIPS/eip-2315
let code = hex!("6801000000000000000cb300b26011b3b7b2b7").to_vec();
let code = hex!("6800000000000000000cb300b26011b3b7b2b7").to_vec();

let mut params = ActionParams::default();
params.gas = U256::from(22);
params.gas = U256::from(26);
params.code = Some(Arc::new(code));
let mut ext = FakeExt::new_berlin();

Expand Down Expand Up @@ -890,7 +890,7 @@ fn test_subs_substack_limit(factory: super::Factory) {
test_finalize(vm.exec(&mut ext).ok().unwrap()).unwrap()
};

assert_eq!(gas_left, U256::from(964_164));
assert_eq!(gas_left, U256::from(961_095));
}

evm_test!{test_subs_substack_out: test_subs_substack_out_int}
Expand All @@ -917,7 +917,7 @@ fn test_subs_sub_at_end(factory: super::Factory) {
let code = hex!("600556b2b75b6003b3").to_vec();

let mut params = ActionParams::default();
params.gas = U256::from(23);
params.gas = U256::from(25);
params.code = Some(Arc::new(code));
let mut ext = FakeExt::new_berlin();

Expand All @@ -929,9 +929,9 @@ fn test_subs_sub_at_end(factory: super::Factory) {
assert_eq!(gas_left, U256::from(0));
}

evm_test!{test_subs_oog_on_exec_beginsub: test_subs_oog_on_exec_beginsub_int}
fn test_subs_oog_on_exec_beginsub(factory: super::Factory) {
let code = hex!("b200").to_vec();
evm_test!{test_subs_walk_into_subroutine: test_subs_walk_into_subroutine_int}
fn test_subs_walk_into_subroutine(factory: super::Factory) {
let code = hex!("b2").to_vec();

let mut params = ActionParams::default();
params.gas = U256::from(100);
Expand Down
2 changes: 1 addition & 1 deletion ethcore/res/ethereum/tests
Submodule tests updated 6084 files
1 change: 1 addition & 0 deletions ethcore/src/json_tests/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ mod block_tests {
declare_test!{BlockchainTests_GeneralStateTest_stSStoreTest, "BlockchainTests/GeneralStateTests/stSStoreTest/"}
declare_test!{BlockchainTests_GeneralStateTest_stStackTests, "BlockchainTests/GeneralStateTests/stStackTests/"}
declare_test!{BlockchainTests_GeneralStateTest_stStaticCall, "BlockchainTests/GeneralStateTests/stStaticCall/"}
declare_test!{BlockchainTests_GeneralStateTest_stSubroutine, "BlockchainTests/GeneralStateTests/stSubroutine/"}
declare_test!{BlockchainTests_GeneralStateTest_stSystemOperationsTest, "BlockchainTests/GeneralStateTests/stSystemOperationsTest/"}
declare_test!{BlockchainTests_GeneralStateTest_stTimeConsuming, "BlockchainTests/GeneralStateTests/stTimeConsuming/"}
declare_test!{BlockchainTests_GeneralStateTest_stTransactionTest, "BlockchainTests/GeneralStateTests/stTransactionTest/"}
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/json_tests/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ mod state_tests {
declare_test!{GeneralStateTest_stSStoreTest, "GeneralStateTests/stSStoreTest/"}
declare_test!{GeneralStateTest_stStackTests, "GeneralStateTests/stStackTests/"}
declare_test!{GeneralStateTest_stStaticCall, "GeneralStateTests/stStaticCall/"}
declare_test!{GeneralStateTest_stSubroutine, "GeneralStateTests/stSubroutine/"}
declare_test!{GeneralStateTest_stSystemOperationsTest, "GeneralStateTests/stSystemOperationsTest/"}
declare_test!{GeneralStateTest_stTimeConsuming, "GeneralStateTests/stTimeConsuming/"}
declare_test!{GeneralStateTest_stTransactionTest, "GeneralStateTests/stTransactionTest/"}
Expand Down

0 comments on commit 138dbfc

Please sign in to comment.