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

Update JSON tests to d4f86ecf4aa7c #11054

Merged
merged 30 commits into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b745fa3
new ethereum consensus tests, #10908
debris Jul 28, 2019
bd0f53a
Merge branch 'master' into dp/chore/new-ethereum-consensus-tests
dvdplm Sep 13, 2019
9339d0d
Update JSON tests to 725dbc73a
dvdplm Sep 13, 2019
c9b638f
Update json test commit to 1dc9d20e97165708f7db0bbf2d1a87a6b4285827
dvdplm Sep 16, 2019
3d3b666
Fail with error message
dvdplm Sep 16, 2019
1c68b36
Handle missing r, s, v params in json tests
dvdplm Sep 18, 2019
1ab7ec6
Merge branch 'master' into dp/chore/new-ethereum-consensus-tests
dvdplm Sep 18, 2019
63bb992
Include the path to the test file
dvdplm Sep 18, 2019
6986fe8
Handle new `postState` format: string or map
dvdplm Sep 18, 2019
4fe800c
WIP
dvdplm Sep 19, 2019
21af38b
Include test-helpers from ethjson
dvdplm Sep 19, 2019
2f5de24
Sort out new paths
dvdplm Sep 19, 2019
8804d3f
Remove dead code
dvdplm Sep 19, 2019
b8bab18
Fix warnings stemming from code called only from macros
dvdplm Sep 19, 2019
7c78c84
Skip all failing tests
dvdplm Sep 19, 2019
ad68b3c
Document the single-test-skipping madness
dvdplm Sep 20, 2019
dfaee44
Merge branch 'master' into dp/chore/new-ethereum-consensus-tests
dvdplm Sep 20, 2019
c93f96e
Update tests to latest commit on the `develop` branch
dvdplm Sep 20, 2019
c9ae32e
Rename test skipping types to reflect actual purpose
dvdplm Sep 20, 2019
1a4c417
Switch to skipping individual tests in currents.json
dvdplm Sep 20, 2019
ff47886
Fix rpc test by curve fitting to new json test source file
dvdplm Sep 20, 2019
ef7675f
Add refs to all issues for fixing failing&skipped json tests
dvdplm Sep 20, 2019
1756291
Sort out the need for Clone for tests
dvdplm Sep 21, 2019
8d80635
[json-tests] populate state from genesis pod state (#11083)
Sep 23, 2019
70c45b1
Update ethcore/src/json_tests/chain.rs
dvdplm Sep 23, 2019
025e323
Add issue numbers to TODOs
dvdplm Sep 23, 2019
56a1069
Merge branch 'dp/chore/new-ethereum-consensus-tests' of github.com:pa…
dvdplm Sep 23, 2019
fa9f02a
Apply @ordians fix for wrong state_root
dvdplm Sep 23, 2019
8716813
Warn on invalid RLP
dvdplm Sep 23, 2019
eae76c6
Remove the `ci-skip-tests` feature
dvdplm Sep 23, 2019
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ default = ["accounts"]
accounts = ["ethcore-accounts", "parity-rpc/accounts"]
miner-debug = ["ethcore/miner-debug"]
json-tests = ["ethcore/json-tests"]
ci-skip-tests = ["ethcore/ci-skip-tests"]
test-heavy = ["ethcore/test-heavy"]
evm-debug = ["ethcore/evm-debug"]
evm-debug-tests = ["ethcore/evm-debug-tests"]
Expand Down
4 changes: 1 addition & 3 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,13 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"]
slow-blocks = []
# Run JSON consensus tests.
json-tests = ["env_logger", "test-helpers", "lazy_static", "machine/test-helpers"]
# Skip JSON consensus tests with pending issues.
ci-skip-tests = []
# Run memory/cpu heavy tests.
test-heavy = []
# Compile test helpers
# note[dvdplm]: "basic-authority/test-helpers" is needed so that `generate_dummy_client_with_spec` works
test-helpers = [
"blooms-db",
"ethjson",
"ethjson/test-helpers",
"ethkey",
"kvdb-memorydb",
"kvdb-rocksdb",
Expand Down
2 changes: 1 addition & 1 deletion ethcore/account-state/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ impl<B: Backend> State<B> {
/// Propagate local cache into shared canonical state cache.
fn propagate_to_global_cache(&mut self) {
let mut addresses = self.cache.borrow_mut();
trace!("Committing cache {:?} entries", addresses.len());
trace!(target: "state", "Committing cache {:?} entries", addresses.len());
for (address, a) in addresses.drain().filter(|&(_, ref a)| a.state == AccountState::Committed || a.state == AccountState::CleanFresh) {
self.db.add_to_account_cache(address, a.account, a.state == AccountState::Committed);
}
Expand Down
2 changes: 1 addition & 1 deletion ethcore/res/ethereum/tests
Submodule tests updated from 725dbc to d4f86e
57 changes: 55 additions & 2 deletions ethcore/res/ethereum/tests-issues/currents.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,57 @@
{
"block": [],
"state": []
"block": [
{
"reference": "Issue https://github.com/paritytech/parity-ethereum/issues/11073 (also see https://github.com/paritytech/parity-ethereum/pull/10923)",
"failing": "stRevertTest",
"subtests": [
"RevertPrecompiledTouch_d0g0v0_Byzantium",
"RevertPrecompiledTouch_d0g0v0_Constantinople",
"RevertPrecompiledTouch_d0g0v0_ConstantinopleFix",
"RevertPrecompiledTouch_d0g0v0_EIP158",
"RevertPrecompiledTouch_d3g0v0_ConstantinopleFix",
"RevertPrecompiledTouchCC_d0g0v0_Byzantium",
"RevertPrecompiledTouchCC_d0g0v0_Constantinople",
"RevertPrecompiledTouchCC_d0g0v0_EIP158",
"RevertPrecompiledTouchDC_d0g0v0_Byzantium",
"RevertPrecompiledTouchDC_d0g0v0_Constantinople",
"RevertPrecompiledTouchDC_d0g0v0_EIP158",
"RevertPrecompiledTouchExactOOG_d7g1v0_ConstantinopleFix",
"RevertPrecompiledTouchExactOOG_d31g1v0_ConstantinopleFix",
"RevertPrecompiledTouch_storage_d3g0v0_ConstantinopleFix",
"RevertPrecompiledTouch_storage_d0g0v0_ConstantinopleFix"
]
}
],
"state": [
{
"reference": "Issue https://github.com/paritytech/parity-ethereum/issues/11078 (also see https://github.com/paritytech/parity-ethereum/pull/10923)",
"failing": "stRevertTest",
"subtests": {
"RevertPrecompiledTouch_storage": {
"subnumbers": ["1", "2"],
"chain": "St. Peter's (test)"
}
}
},
{
"reference": "Issue https://github.com/paritytech/parity-ethereum/issues/11079 (also see https://github.com/paritytech/parity-ethereum/pull/10923)",
"failing": "stRevertTest",
"subtests": {
"RevertPrecompiledTouchExactOOG": {
"subnumbers": ["61", "64"],
"chain": "St. Peter's (test)"
}
}
},
{
"reference": "Issue https://github.com/paritytech/parity-ethereum/issues/11080 (also see https://github.com/paritytech/parity-ethereum/pull/10923)",
"failing": "stRevertTest",
"subtests": {
"RevertPrecompiledTouch": {
"subnumbers": ["1", "2"],
"chain": "St. Peter's (test)"
}
}
}
]
}
1 change: 1 addition & 0 deletions ethcore/spec/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use keccak_hash::KECCAK_NULL_RLP;
use crate::seal::Seal;

/// Genesis components.
#[derive(Debug)]
pub struct Genesis {
/// Seal.
pub seal: Seal,
Expand Down
5 changes: 5 additions & 0 deletions ethcore/spec/src/seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use ethereum_types::{H64, H256, H520};
use ethjson;

/// Classic ethereum seal.
#[derive(Debug)]
pub struct Ethereum {
/// Seal nonce.
pub nonce: H64,
Expand All @@ -37,6 +38,7 @@ impl Into<Generic> for Ethereum {
}

/// AuthorityRound seal.
#[derive(Debug)]
pub struct AuthorityRound {
/// Seal step.
pub step: usize,
Expand All @@ -45,6 +47,7 @@ pub struct AuthorityRound {
}

/// Tendermint seal.
#[derive(Debug)]
pub struct Tendermint {
/// Seal round.
pub round: usize,
Expand Down Expand Up @@ -73,9 +76,11 @@ impl Into<Generic> for Tendermint {
}
}

#[derive(Debug)]
pub struct Generic(pub Vec<u8>);

/// Genesis seal type.
#[derive(Debug)]
pub enum Seal {
/// Classic ethereum seal.
Ethereum(Ethereum),
Expand Down
90 changes: 45 additions & 45 deletions ethcore/spec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ use crate::{
seal::Generic as GenericSeal,
};




/// Runtime parameters for the spec that are related to how the software should run the chain,
/// rather than integral properties of the chain itself.
pub struct SpecParams<'a> {
Expand Down Expand Up @@ -134,53 +131,56 @@ fn run_constructors<T: Backend>(
let start_nonce = engine.account_start_nonce(0);

let mut state = State::from_existing(db, root, start_nonce, factories.clone())?;

// Execute contract constructors.
let env_info = EnvInfo {
number: 0,
author,
timestamp,
difficulty,
last_hashes: Default::default(),
gas_used: U256::zero(),
gas_limit: U256::max_value(),
};

let from = Address::zero();
for &(ref address, ref constructor) in constructors.iter() {
trace!(target: "spec", "run_constructors: Creating a contract at {}.", address);
trace!(target: "spec", " .. root before = {}", state.root());
let params = ActionParams {
code_address: address.clone(),
code_hash: Some(keccak(constructor)),
code_version: U256::zero(),
address: address.clone(),
sender: from.clone(),
origin: from.clone(),
gas: U256::max_value(),
gas_price: Default::default(),
value: ActionValue::Transfer(Default::default()),
code: Some(Arc::new(constructor.clone())),
data: None,
call_type: CallType::None,
params_type: ParamsType::Embedded,
if constructors.is_empty() {
state.populate_from(genesis_state.clone());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it should be called only in case of empty constructors

let _ = state.commit()?;
} else {
// Execute contract constructors.
let env_info = EnvInfo {
number: 0,
author,
timestamp,
difficulty,
last_hashes: Default::default(),
gas_used: U256::zero(),
gas_limit: U256::max_value(),
};

let mut substate = Substate::new();
let from = Address::zero();
for &(ref address, ref constructor) in constructors.iter() {
trace!(target: "spec", "run_constructors: Creating a contract at {}.", address);
trace!(target: "spec", " .. root before = {}", state.root());
let params = ActionParams {
code_address: address.clone(),
code_hash: Some(keccak(constructor)),
code_version: U256::zero(),
address: address.clone(),
sender: from.clone(),
origin: from.clone(),
gas: U256::max_value(),
gas_price: Default::default(),
value: ActionValue::Transfer(Default::default()),
code: Some(Arc::new(constructor.clone())),
data: None,
call_type: CallType::None,
params_type: ParamsType::Embedded,
};

let mut substate = Substate::new();

{
let machine = engine.machine();
let schedule = machine.schedule(env_info.number);
let mut exec = Executive::new(&mut state, &env_info, &machine, &schedule);
// failing create is not a bug
if let Err(e) = exec.create(params, &mut substate, &mut NoopTracer, &mut NoopVMTracer) {
warn!(target: "spec", "Genesis constructor execution at {} failed: {}.", address, e);
{
let machine = engine.machine();
let schedule = machine.schedule(env_info.number);
let mut exec = Executive::new(&mut state, &env_info, &machine, &schedule);
// failing create is not a bug
if let Err(e) = exec.create(params, &mut substate, &mut NoopTracer, &mut NoopVMTracer) {
warn!(target: "spec", "Genesis constructor execution at {} failed: {}.", address, e);
}
}
}

let _ = state.commit()?;
let _ = state.commit()?;
}
}

Ok(state.drop())
}

Expand Down Expand Up @@ -219,7 +219,7 @@ pub struct Spec {
pub hardcoded_sync: Option<SpecHardcodedSync>,
/// Contract constructors to be executed on genesis.
pub constructors: Vec<(Address, Bytes)>,
/// May be prepopulated if we know this in advance.
/// May be pre-populated if we know this in advance.
pub state_root: H256,
/// Genesis state as plain old data.
pub genesis_state: PodState,
Expand Down
Loading