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

Commit

Permalink
Fix compile, use a shortcut for check, and remove ignored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sorpaas committed Dec 14, 2018
1 parent 311c53e commit 95e3e32
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 45 deletions.
44 changes: 3 additions & 41 deletions ethcore/res/ethereum/tests-issues/currents.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,4 @@
{ "block":
[
{
"reference": "None",
"comment": "This failing test is deemed skippable. Could not happen on a mainnet.",
"failing": "GeneralStateTest_stCreate2",
"subtests": ["RevertInCreateInInitCreate2_d0g0v0_Constantinople"]
},
{
"reference": "None",
"comment": "This failing test is deemed skippable. Could not happen on a mainnet.",
"failing": "GeneralStateTest_stRevertTest",
"subtests": ["RevertInCreateInInit_d0g0v0_Constantinople"]
}
],
"state":
[
{
"reference": "None",
"comment": "This failing test is deemed skippable. Could not happen on a mainnet.",
"failing": "stCreate2Test",
"subtests": {
"RevertInCreateInInitCreate2": {
"subnumbers": ["1"],
"chain": "Constantinople (test)"
}
}
},
{
"reference": "None",
"comment": "This failing test is deemed skippable. Could not happen on a mainnet.",
"failing": "stRevertTest",
"subtests": {
"RevertInCreateInInit": {
"subnumbers": ["1"],
"chain": "Constantinople (test)"
}
}
}

]
{
"block": [],
"state": []
}
6 changes: 5 additions & 1 deletion ethcore/src/externalities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
where T: Tracer, V: VMTracer, B: StateBackend
{
fn initial_storage_at(&self, key: &H256) -> vm::Result<H256> {
self.state.checkpoint_storage_at(0, &self.origin_info.address, key).map(|v| v.unwrap_or(H256::zero())).map_err(Into::into)
if self.state.is_base_storage_root_unchanged(&self.origin_info.address)? {
self.state.checkpoint_storage_at(0, &self.origin_info.address, key).map(|v| v.unwrap_or(H256::zero())).map_err(Into::into)
} else {
Ok(H256::zero())
}
}

fn storage_at(&self, key: &H256) -> vm::Result<H256> {
Expand Down
5 changes: 5 additions & 0 deletions ethcore/src/state/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,11 @@ impl Account {
}
}

/// Whether the base storage root of this account is unchanged.
pub fn is_base_storage_root_unchanged(&self) -> bool {
self.original_storage_cache.is_none()
}

/// Storage root where the account changes are based upon.
pub fn base_storage_root(&self) -> H256 {
self.storage_root
Expand Down
6 changes: 3 additions & 3 deletions ethcore/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,9 @@ impl<B: Backend> State<B> {

/// Whether the base storage root of an account remains unchanged.
pub fn is_base_storage_root_unchanged(&self, a: &Address) -> TrieResult<bool> {
self.ensure_cached(a, RequireCache::None, true,
|a| a.as_ref().and_then(|account| account.base_storage_root() == account.original_storage_root))?
.unwrap_or(true)
Ok(self.ensure_cached(a, RequireCache::None, true,
|a| a.as_ref().map(|account| account.is_base_storage_root_unchanged()))?
.unwrap_or(true))
}

/// Get the storage root of account `a`.
Expand Down

0 comments on commit 95e3e32

Please sign in to comment.