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

Commit 0c00368

Browse files
chemeandresilva
authored andcommitted
Add constantinople conf to EvmTestClient. (#9570)
* Add constantinople conf to EvmTestClient. * Skip some test to update submodule etheureum/tests submodule to latest. * Put skipping 'under issue' test behind a feature. * Change blockReward for const-test to pass ethereum/tests * Update tests to new constantinple definition (change of reward at block 5). Switch 'reference' to string, that way we can include issues from others repo (more flexible)Update tests to new constantinple definition (change of reward at block 5). Switch 'reference' to string, that way we can include issues from others repo (more flexible). * Fix modexp and bn128_mul gas prices in chain config * Changes `run_test_path` method to append its directory results (without that it stop testing at the first file failure). Add some missing tests. Add skip for those (block create2 is one hundred percent false but on hive we can see that geth and aleth got similar issue for this item). * retab current.json * Update reference to parity issue for failing tests.
1 parent 6e5646d commit 0c00368

File tree

12 files changed

+173
-108
lines changed

12 files changed

+173
-108
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ daemonize = { git = "https://github.com/paritytech/daemonize" }
8989
[features]
9090
miner-debug = ["ethcore/miner-debug"]
9191
json-tests = ["ethcore/json-tests"]
92+
ci-skip-issue = ["ethcore/ci-skip-issue"]
9293
test-heavy = ["ethcore/test-heavy"]
9394
evm-debug = ["ethcore/evm-debug"]
9495
evm-debug-tests = ["ethcore/evm-debug-tests"]

ethcore/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"]
102102
slow-blocks = []
103103
# Run JSON consensus tests.
104104
json-tests = ["ethcore-transaction/json-tests", "test-helpers", "tempdir"]
105+
# Skip JSON consensus tests with pending issues.
106+
ci-skip-issue = []
105107
# Run memory/cpu heavy tests.
106108
test-heavy = []
107109
# Compile benches

ethcore/res/ethereum/constantinople_test.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"minimumDifficulty": "0x020000",
77
"difficultyBoundDivisor": "0x0800",
88
"durationLimit": "0x0d",
9-
"blockReward": "0x1BC16D674EC80000",
9+
"blockReward": "0x29A2241AF62C0000",
1010
"homesteadTransition": "0x0",
1111
"eip100bTransition": "0x0",
12-
"eip649Transition": "0x0",
12+
"eip649Transition": "0x5",
1313
"eip649Reward": "0x1BC16D674EC80000",
14-
"eip1234Transition": "0x0",
14+
"eip1234Transition": "0x5",
1515
"eip1234Reward": "0x1BC16D674EC80000"
1616
}
1717
}
@@ -59,9 +59,9 @@
5959
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
6060
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
6161
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
62-
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x00", "pricing": { "modexp": { "divisor": 100 } } } },
62+
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x00", "pricing": { "modexp": { "divisor": 20 } } } },
6363
"0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": "0x00", "pricing": { "linear": { "base": 500, "word": 0 } } } },
64-
"0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": "0x00", "pricing": { "linear": { "base": 2000, "word": 0 } } } },
64+
"0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": "0x00", "pricing": { "linear": { "base": 40000, "word": 0 } } } },
6565
"0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": "0x00", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } }
6666
}
6767
}

ethcore/res/ethereum/tests-issues/currents.json

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -365,104 +365,6 @@
365365
"chain": "Constantinople (test)"
366366
}
367367
}
368-
},
369-
{
370-
"reference": "9590",
371-
"failing": "stCreate2Test",
372-
"subtests": {
373-
"call_then_create2_successful_then_returndatasize": {
374-
"subnumbers": ["1"],
375-
"chain": "Constantinople (test)"
376-
},
377-
"returndatacopy_afterFailing_create": {
378-
"subnumbers": ["1"],
379-
"chain": "Constantinople (test)"
380-
},
381-
"create2checkFieldsInInitcode": {
382-
"subnumbers": ["1","2","3","5","6","7"],
383-
"chain": "Constantinople (test)"
384-
},
385-
"Create2Recursive": {
386-
"subnumbers": ["*"],
387-
"chain": "Constantinople (test)"
388-
},
389-
"create2collisionBalance": {
390-
"subnumbers": ["2","3"],
391-
"chain": "Constantinople (test)"
392-
},
393-
"create2InitCodes": {
394-
"subnumbers": ["1","5","6","7","8","9"],
395-
"chain": "Constantinople (test)"
396-
},
397-
"Create2OOGafterInitCode": {
398-
"subnumbers": ["2"],
399-
"chain": "Constantinople (test)"
400-
},
401-
"CreateMessageRevertedOOGInInit": {
402-
"subnumbers": ["2"],
403-
"chain": "Constantinople (test)"
404-
},
405-
"returndatacopy_following_revert_in_create": {
406-
"subnumbers": ["*"],
407-
"chain": "Constantinople (test)"
408-
},
409-
"create2collisionSelfdestructed": {
410-
"subnumbers": ["2"],
411-
"chain": "Constantinople (test)"
412-
},
413-
"returndatacopy_0_0_following_successful_create": {
414-
"subnumbers": ["*"],
415-
"chain": "Constantinople (test)"
416-
},
417-
"Create2OnDepth1023": {
418-
"subnumbers": ["*"],
419-
"chain": "Constantinople (test)"
420-
},
421-
"Create2OOGafterInitCodeReturndata2": {
422-
"subnumbers": ["2"],
423-
"chain": "Constantinople (test)"
424-
},
425-
"RevertOpcodeInCreateReturns": {
426-
"subnumbers": ["*"],
427-
"chain": "Constantinople (test)"
428-
},
429-
"CREATE2_ContractSuicideDuringInit_ThenStoreThenReturn": {
430-
"subnumbers": ["*"],
431-
"chain": "Constantinople (test)"
432-
},
433-
"returndatasize_following_successful_create": {
434-
"subnumbers": ["*"],
435-
"chain": "Constantinople (test)"
436-
},
437-
"call_outsize_then_create2_successful_then_returndatasize": {
438-
"subnumbers": ["*"],
439-
"chain": "Constantinople (test)"
440-
},
441-
"CreateMessageReverted": {
442-
"subnumbers": ["2"],
443-
"chain": "Constantinople (test)"
444-
},
445-
"CREATE2_Suicide": {
446-
"subnumbers": ["*"],
447-
"chain": "Constantinople (test)"
448-
},
449-
"Create2OOGafterInitCodeRevert": {
450-
"subnumbers": ["*"],
451-
"chain": "Constantinople (test)"
452-
},
453-
"Create2OnDepth1024": {
454-
"subnumbers": ["*"],
455-
"chain": "Constantinople (test)"
456-
},
457-
"create2collisionStorage": {
458-
"subnumbers": ["2","3"],
459-
"chain": "Constantinople (test)"
460-
},
461-
"create2callPrecompiles": {
462-
"subnumbers": ["*"],
463-
"chain": "Constantinople (test)"
464-
}
465-
}
466368
}
467369
]
468370
}

ethcore/src/client/evm_test_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ impl<'a> EvmTestClient<'a> {
8686
ForkSpec::EIP150 => Some(ethereum::new_eip150_test()),
8787
ForkSpec::EIP158 => Some(ethereum::new_eip161_test()),
8888
ForkSpec::Byzantium => Some(ethereum::new_byzantium_test()),
89+
ForkSpec::Constantinople => Some(ethereum::new_constantinople_test()),
8990
ForkSpec::EIP158ToByzantiumAt5 => Some(ethereum::new_transition_test()),
9091
ForkSpec::FrontierToHomesteadAt5 | ForkSpec::HomesteadToDaoAt5 | ForkSpec::HomesteadToEIP150At5 => None,
91-
_ => None,
9292
}
9393
}
9494

ethcore/src/json_tests/chain.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use ethjson;
2323
use miner::Miner;
2424
use io::IoChannel;
2525
use test_helpers;
26+
use super::SKIP_TEST_STATE;
2627

2728
use super::HookType;
2829

@@ -36,12 +37,20 @@ pub fn run_test_file<H: FnMut(&str, HookType)>(p: &Path, h: &mut H) {
3637
::json_tests::test_common::run_test_file(p, json_chain_test, h)
3738
}
3839

40+
fn skip_test(name: &String) -> bool {
41+
SKIP_TEST_STATE.block.iter().any(|block_test|block_test.subtests.contains(name))
42+
}
43+
3944
pub fn json_chain_test<H: FnMut(&str, HookType)>(json_data: &[u8], start_stop_hook: &mut H) -> Vec<String> {
4045
::ethcore_logger::init_log();
4146
let tests = ethjson::blockchain::Test::load(json_data).unwrap();
4247
let mut failed = Vec::new();
4348

4449
for (name, blockchain) in tests.into_iter() {
50+
if skip_test(&name) {
51+
println!(" - {} | {:?} Ignoring tests because in skip list", name, blockchain.network);
52+
continue;
53+
}
4554
start_stop_hook(&name, HookType::OnStart);
4655

4756
let mut fail = false;
@@ -122,19 +131,24 @@ mod block_tests {
122131
declare_test!{BlockchainTests_bcInvalidHeaderTest, "BlockchainTests/bcInvalidHeaderTest"}
123132
declare_test!{BlockchainTests_bcMultiChainTest, "BlockchainTests/bcMultiChainTest"}
124133
declare_test!{BlockchainTests_bcRandomBlockhashTest, "BlockchainTests/bcRandomBlockhashTest"}
134+
declare_test!{BlockchainTests_bcStateTest, "BlockchainTests/bcStateTests"}
125135
declare_test!{BlockchainTests_bcTotalDifficultyTest, "BlockchainTests/bcTotalDifficultyTest"}
126136
declare_test!{BlockchainTests_bcUncleHeaderValidity, "BlockchainTests/bcUncleHeaderValidity"}
127137
declare_test!{BlockchainTests_bcUncleTest, "BlockchainTests/bcUncleTest"}
128138
declare_test!{BlockchainTests_bcValidBlockTest, "BlockchainTests/bcValidBlockTest"}
129139
declare_test!{BlockchainTests_bcWalletTest, "BlockchainTests/bcWalletTest"}
130140

141+
declare_test!{BlockchainTests_GeneralStateTest_stArgsZeroOneBalance, "BlockchainTests/GeneralStateTests/stArgsZeroOneBalance/"}
131142
declare_test!{BlockchainTests_GeneralStateTest_stAttackTest, "BlockchainTests/GeneralStateTests/stAttackTest/"}
132143
declare_test!{BlockchainTests_GeneralStateTest_stBadOpcodeTest, "BlockchainTests/GeneralStateTests/stBadOpcode/"}
144+
declare_test!{BlockchainTests_GeneralStateTest_stBugsTest, "BlockchainTests/GeneralStateTests/stBugs/"}
133145
declare_test!{BlockchainTests_GeneralStateTest_stCallCodes, "BlockchainTests/GeneralStateTests/stCallCodes/"}
146+
declare_test!{BlockchainTests_GeneralStateTest_stCallCreateCallCodeTest, "BlockchainTests/GeneralStateTests/stCallCreateCallCodeTest/"}
134147
declare_test!{BlockchainTests_GeneralStateTest_stCallDelegateCodesCallCodeHomestead, "BlockchainTests/GeneralStateTests/stCallDelegateCodesCallCodeHomestead/"}
135148
declare_test!{BlockchainTests_GeneralStateTest_stCallDelegateCodesHomestead, "BlockchainTests/GeneralStateTests/stCallDelegateCodesHomestead/"}
136149
declare_test!{BlockchainTests_GeneralStateTest_stChangedEIP150, "BlockchainTests/GeneralStateTests/stChangedEIP150/"}
137150
declare_test!{BlockchainTests_GeneralStateTest_stCodeSizeLimit, "BlockchainTests/GeneralStateTests/stCodeSizeLimit/"}
151+
declare_test!{BlockchainTests_GeneralStateTest_stCreate2, "BlockchainTests/GeneralStateTests/stCreate2/"}
138152
declare_test!{BlockchainTests_GeneralStateTest_stCreateTest, "BlockchainTests/GeneralStateTests/stCreateTest/"}
139153
declare_test!{BlockchainTests_GeneralStateTest_stDelegatecallTestHomestead, "BlockchainTests/GeneralStateTests/stDelegatecallTestHomestead/"}
140154
declare_test!{BlockchainTests_GeneralStateTest_stEIP150singleCodeGasPrices, "BlockchainTests/GeneralStateTests/stEIP150singleCodeGasPrices/"}
@@ -149,12 +163,15 @@ mod block_tests {
149163
declare_test!{BlockchainTests_GeneralStateTest_stMemoryTest, "BlockchainTests/GeneralStateTests/stMemoryTest/"}
150164
declare_test!{BlockchainTests_GeneralStateTest_stNonZeroCallsTest, "BlockchainTests/GeneralStateTests/stNonZeroCallsTest/"}
151165
declare_test!{BlockchainTests_GeneralStateTest_stPreCompiledContracts, "BlockchainTests/GeneralStateTests/stPreCompiledContracts/"}
166+
declare_test!{BlockchainTests_GeneralStateTest_stPreCompiledContracts2, "BlockchainTests/GeneralStateTests/stPreCompiledContracts2/"}
152167
declare_test!{heavy => BlockchainTests_GeneralStateTest_stQuadraticComplexityTest, "BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/"}
153168
declare_test!{BlockchainTests_GeneralStateTest_stRandom, "BlockchainTests/GeneralStateTests/stRandom/"}
169+
declare_test!{BlockchainTests_GeneralStateTest_stRandom2, "BlockchainTests/GeneralStateTests/stRandom2/"}
154170
declare_test!{BlockchainTests_GeneralStateTest_stRecursiveCreate, "BlockchainTests/GeneralStateTests/stRecursiveCreate/"}
155171
declare_test!{BlockchainTests_GeneralStateTest_stRefundTest, "BlockchainTests/GeneralStateTests/stRefundTest/"}
156172
declare_test!{BlockchainTests_GeneralStateTest_stReturnDataTest, "BlockchainTests/GeneralStateTests/stReturnDataTest/"}
157173
declare_test!{BlockchainTests_GeneralStateTest_stRevertTest, "BlockchainTests/GeneralStateTests/stRevertTest/"}
174+
declare_test!{BlockchainTests_GeneralStateTest_stShift, "BlockchainTests/GeneralStateTests/stShift/"}
158175
declare_test!{BlockchainTests_GeneralStateTest_stSolidityTest, "BlockchainTests/GeneralStateTests/stSolidityTest/"}
159176
declare_test!{BlockchainTests_GeneralStateTest_stSpecialTest, "BlockchainTests/GeneralStateTests/stSpecialTest/"}
160177
declare_test!{BlockchainTests_GeneralStateTest_stStackTests, "BlockchainTests/GeneralStateTests/stStackTests/"}
@@ -166,6 +183,7 @@ mod block_tests {
166183
declare_test!{BlockchainTests_GeneralStateTest_stZeroCallsRevert, "BlockchainTests/GeneralStateTests/stZeroCallsRevert/"}
167184
declare_test!{BlockchainTests_GeneralStateTest_stZeroCallsTest, "BlockchainTests/GeneralStateTests/stZeroCallsTest/"}
168185
declare_test!{BlockchainTests_GeneralStateTest_stZeroKnowledge, "BlockchainTests/GeneralStateTests/stZeroKnowledge/"}
186+
declare_test!{BlockchainTests_GeneralStateTest_stZeroKnowledge2, "BlockchainTests/GeneralStateTests/stZeroKnowledge2/"}
169187

170188
declare_test!{BlockchainTests_TransitionTests_bcEIP158ToByzantium, "BlockchainTests/TransitionTests/bcEIP158ToByzantium/"}
171189
declare_test!{BlockchainTests_TransitionTests_bcFrontierToHomestead, "BlockchainTests/TransitionTests/bcFrontierToHomestead/"}

ethcore/src/json_tests/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ mod executive;
2424
mod state;
2525
mod chain;
2626
mod trie;
27+
mod skip;
2728

2829
#[cfg(test)]
2930
mod difficulty;
3031

32+
3133
pub use self::test_common::HookType;
3234

3335
pub use self::transaction::run_test_path as run_transaction_test_path;
@@ -42,3 +44,4 @@ pub use self::trie::run_generic_test_path as run_generic_trie_test_path;
4244
pub use self::trie::run_generic_test_file as run_generic_trie_test_file;
4345
pub use self::trie::run_secure_test_path as run_secure_trie_test_path;
4446
pub use self::trie::run_secure_test_file as run_secure_trie_test_file;
47+
use self::skip::SKIP_TEST_STATE;

ethcore/src/json_tests/skip.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
2+
// This file is part of Parity.
3+
4+
// Parity is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Parity is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
16+
17+
//! State tests to skip.
18+
19+
use ethjson;
20+
21+
#[cfg(all(not(test), feature = "ci-skip-tests"))]
22+
compile_error!("ci-skip-tests can only be enabled for testing builds.");
23+
24+
#[cfg(feature="ci-skip-issue")]
25+
lazy_static!{
26+
pub static ref SKIP_TEST_STATE: ethjson::test::SkipStates = {
27+
let skip_data = include_bytes!("../../res/ethereum/tests-issues/currents.json");
28+
ethjson::test::SkipStates::load(&skip_data[..]).expect("No invalid json allowed")
29+
};
30+
}
31+
32+
#[cfg(not(feature="ci-skip-issue"))]
33+
lazy_static!{
34+
pub static ref SKIP_TEST_STATE: ethjson::test::SkipStates = {
35+
ethjson::test::SkipStates::empty()
36+
};
37+
}

ethcore/src/json_tests/state.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use client::{EvmTestClient, EvmTestError, TransactResult};
2222
use ethjson;
2323
use transaction::SignedTransaction;
2424
use vm::EnvInfo;
25-
25+
use super::SKIP_TEST_STATE;
2626
use super::HookType;
2727

2828
/// Run state jsontests on a given folder.
@@ -35,6 +35,18 @@ pub fn run_test_file<H: FnMut(&str, HookType)>(p: &Path, h: &mut H) {
3535
::json_tests::test_common::run_test_file(p, json_chain_test, h)
3636
}
3737

38+
fn skip_test(subname: &str, chain: &String, number: usize) -> bool {
39+
SKIP_TEST_STATE.state.iter().any(|state_test|{
40+
if let Some(subtest) = state_test.subtests.get(subname) {
41+
chain == &subtest.chain &&
42+
(subtest.subnumbers[0] == "*"
43+
|| subtest.subnumbers.contains(&number.to_string()))
44+
} else {
45+
false
46+
}
47+
})
48+
}
49+
3850
pub fn json_chain_test<H: FnMut(&str, HookType)>(json_data: &[u8], start_stop_hook: &mut H) -> Vec<String> {
3951
::ethcore_logger::init_log();
4052
let tests = ethjson::state::test::Test::load(json_data).unwrap();
@@ -60,6 +72,10 @@ pub fn json_chain_test<H: FnMut(&str, HookType)>(json_data: &[u8], start_stop_ho
6072

6173
for (i, state) in states.into_iter().enumerate() {
6274
let info = format!(" - {} | {:?} ({}/{}) ...", name, spec_name, i + 1, total);
75+
if skip_test(&name, &spec.name, i + 1) {
76+
println!("{} in skip list : SKIPPED", info);
77+
continue;
78+
}
6379

6480
let post_root: H256 = state.hash.into();
6581
let transaction: SignedTransaction = multitransaction.select(&state.indexes).into();
@@ -125,11 +141,13 @@ mod state_tests {
125141
declare_test!{GeneralStateTest_stChangedEIP150, "GeneralStateTests/stChangedEIP150/"}
126142
declare_test!{GeneralStateTest_stCodeCopyTest, "GeneralStateTests/stCodeCopyTest/"}
127143
declare_test!{GeneralStateTest_stCodeSizeLimit, "GeneralStateTests/stCodeSizeLimit/"}
144+
declare_test!{GeneralStateTest_stCreate2Test, "GeneralStateTests/stCreate2/"}
128145
declare_test!{GeneralStateTest_stCreateTest, "GeneralStateTests/stCreateTest/"}
129146
declare_test!{GeneralStateTest_stDelegatecallTestHomestead, "GeneralStateTests/stDelegatecallTestHomestead/"}
130147
declare_test!{GeneralStateTest_stEIP150singleCodeGasPrices, "GeneralStateTests/stEIP150singleCodeGasPrices/"}
131148
declare_test!{GeneralStateTest_stEIP150Specific, "GeneralStateTests/stEIP150Specific/"}
132149
declare_test!{GeneralStateTest_stEIP158Specific, "GeneralStateTests/stEIP158Specific/"}
150+
declare_test!{GeneralStateTest_stEWASMTests, "GeneralStateTests/stEWASMTests/"}
133151
declare_test!{GeneralStateTest_stExample, "GeneralStateTests/stExample/"}
134152
declare_test!{GeneralStateTest_stHomesteadSpecific, "GeneralStateTests/stHomesteadSpecific/"}
135153
declare_test!{GeneralStateTest_stInitCodeTest, "GeneralStateTests/stInitCodeTest/"}

0 commit comments

Comments
 (0)