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

Extract verification from ethcore #10862

Closed
wants to merge 98 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
f144f88
WIP move errors, pod_account and state account to own crates
dvdplm Jul 3, 2019
c8bf87f
Sort out dependencies, fix broken code and tests
dvdplm Jul 4, 2019
47bc6fb
remove template line
dvdplm Jul 4, 2019
f8756bb
fix review feedback
dvdplm Jul 4, 2019
d54ebab
Remove test-only AccountDBMut::new
dvdplm Jul 4, 2019
7792810
Extract AccountDB to account-db
dvdplm Jul 4, 2019
a55ca1e
Move Substate to state-account – wip
dvdplm Jul 4, 2019
201dac7
Add lib.rs
dvdplm Jul 4, 2019
e23acad
cleanup
dvdplm Jul 4, 2019
b7c7aae
Merge branch 'master' into dp/chore/extricate-account-db-into-own-crate
dvdplm Jul 4, 2019
e0701e4
test failure
dvdplm Jul 4, 2019
b42d16a
test failure 2
dvdplm Jul 4, 2019
e45d13f
third time's the charm
dvdplm Jul 4, 2019
9553c8c
Merge branch 'dp/chore/extricate-account-db-into-own-crate' into dp/c…
dvdplm Jul 4, 2019
9b60a57
Merge branch 'master' into dp/chore/extricate-state-backend
dvdplm Jul 4, 2019
c55e6b1
Merge branch 'master' into dp/chore/extricate-state-backend
dvdplm Jul 4, 2019
1c0722b
Add factories crate
dvdplm Jul 4, 2019
2114c12
Use new factories crate
dvdplm Jul 4, 2019
80ededa
Use factories crate
dvdplm Jul 4, 2019
d9ceaa6
Extract trace
dvdplm Jul 4, 2019
9f3aa73
Fix tests
dvdplm Jul 4, 2019
a6a25ba
Sort out parity-util-mem and parking_lot
dvdplm Jul 4, 2019
44a0904
cleanup
dvdplm Jul 4, 2019
ce3a211
WIP port over the rest of state from ethcore
dvdplm Jul 4, 2019
9ed1d47
Collect all impls for Machine
dvdplm Jul 5, 2019
67332d7
some notes
dvdplm Jul 5, 2019
0a42ea8
Rename pod-account to pod
dvdplm Jul 5, 2019
d9ce43d
Move PodState to pod crate
dvdplm Jul 5, 2019
aebee1d
Use PodState from pod crate
dvdplm Jul 5, 2019
6344f9d
Fix use clause for json tests
dvdplm Jul 5, 2019
63564de
Sort out evmbin
dvdplm Jul 5, 2019
147bde5
Add missing code and use PodState
dvdplm Jul 5, 2019
ceda5f8
Move code that depends on Machine and Executive to own module
dvdplm Jul 5, 2019
fefd892
Sort out cloning errors, fix ethcore to use new state crate
dvdplm Jul 5, 2019
d41f5d4
Do without funky From impls
dvdplm Jul 5, 2019
ffec0b0
Fix ethcore tests
dvdplm Jul 5, 2019
849c73f
Fixes around the project to use new state crate
dvdplm Jul 5, 2019
c772639
Add back the more specific impls of StateOrBlock From conversions
dvdplm Jul 5, 2019
ffda775
Move execute to freestanding function and remove it from trait
dvdplm Jul 5, 2019
2f9526b
cleanup
dvdplm Jul 5, 2019
6f8a1a7
Fix "error: enum variants on type aliases are experimental"
dvdplm Jul 5, 2019
b11e078
Bring back the state tests
dvdplm Jul 5, 2019
06a37ba
remove ethcore/state/mod.rs
dvdplm Jul 5, 2019
10ab382
cleanup
dvdplm Jul 5, 2019
cff4280
cleanup
dvdplm Jul 5, 2019
cf4d8d5
Cleanup state-account errors
dvdplm Jul 5, 2019
e4a5176
Fix more todos
dvdplm Jul 5, 2019
618276d
Add error.rs
dvdplm Jul 5, 2019
4be6fe0
Merge branch 'master' into dp/chore/extricate-state-backend
dvdplm Jul 5, 2019
3a0db5e
Fixup Cargo.lock
dvdplm Jul 5, 2019
a61f135
Smaller ethcore API is fine
dvdplm Jul 5, 2019
14e475f
Add `to-pod-full` feature to state-account
dvdplm Jul 5, 2019
6d0df41
Fix a few more test failures
dvdplm Jul 5, 2019
5363b45
Fix RPC test build
dvdplm Jul 6, 2019
234e986
Baptize the new trait
dvdplm Jul 6, 2019
7eb04e0
Remove resolved TODOs
dvdplm Jul 6, 2019
0cab314
Rename state-account to account-state
dvdplm Jul 6, 2019
a42720b
Do not re-export the trace crate
dvdplm Jul 6, 2019
515abdf
Don't export state_db from ethcore
dvdplm Jul 6, 2019
e3d98b7
Merge branch 'master' into dp/chore/extricate-state-backend
dvdplm Jul 6, 2019
081e678
Let private-tx use StateDB. :(
dvdplm Jul 6, 2019
659440a
Remove ethcore/src/pod_state.rs
dvdplm Jul 6, 2019
2f839f8
Inner type does not need to be pub/pub(crate)
dvdplm Jul 7, 2019
df23dcc
optimise imports
dvdplm Jul 7, 2019
e23cb6a
Revert "Inner type does not need to be pub/pub(crate)"
dvdplm Jul 7, 2019
de2aa80
Move DatabaseExtras to ethcore-blockchain
dvdplm Jul 7, 2019
b4ea86a
Add database_extra module to ethcore-blockchain
dvdplm Jul 7, 2019
1cf8254
Merge branch 'master' into dp/chore/extricate-state-backend
dvdplm Jul 7, 2019
a57517c
Remove to-pod-full feature
dvdplm Jul 7, 2019
5a28340
cosmetics
dvdplm Jul 8, 2019
40aef44
New crate: state-db
dvdplm Jul 8, 2019
0b1a692
Add new crate
dvdplm Jul 8, 2019
90de4d2
Move PreverifiedBlock and BlockError to types
dvdplm Jul 8, 2019
75efc47
Merge branch 'master' into dp/chore/extricate-state-backend
dvdplm Jul 8, 2019
994424e
Sort out the merge
dvdplm Jul 8, 2019
cd9167e
Merge branch 'dp/chore/extricate-state-backend' into dp/chore/extract…
dvdplm Jul 8, 2019
f30f63b
Merge branch 'dp/chore/extract-state-db' into dp/chore/extract-verifi…
dvdplm Jul 8, 2019
4fe6f55
Add missing `license` meta data keys
dvdplm Jul 8, 2019
a3f08ca
wip
dvdplm Jul 8, 2019
eb57f24
wip client-traits
dvdplm Jul 8, 2019
2c86e2b
Merge branch 'master' into dp/chore/extract-verification
dvdplm Jul 9, 2019
cdbab8c
merge conflict
dvdplm Jul 9, 2019
62dcb77
verification crate type checks
dvdplm Jul 9, 2019
8d86b85
Move impls for CommonParams to common_types
dvdplm Jul 9, 2019
e7c32fc
Fix tests
dvdplm Jul 9, 2019
e022516
Implement VerifyingEngine for all engines except Ethash
dvdplm Jul 9, 2019
3037cbc
Split Engine in two and move code around
dvdplm Jul 9, 2019
183e6e1
cleanup
dvdplm Jul 9, 2019
196605f
verification: don't rexport common_types
dvdplm Jul 10, 2019
28f282a
Use error from common_types
dvdplm Jul 10, 2019
7cadd54
Consolidate error types
dvdplm Jul 10, 2019
0c09315
VerifyingEngine use Errors from common_types
dvdplm Jul 10, 2019
35037f8
verification: Use error type from common_types
dvdplm Jul 10, 2019
0305525
SnapshotError moved to common_types
dvdplm Jul 10, 2019
55f0b73
Move more code from Engne to VerifyingEngine
dvdplm Jul 10, 2019
2157d81
Add MAX_UNCLE_AGE const
dvdplm Jul 10, 2019
74b48fd
Port over remaining code from ethcore/verification
dvdplm Jul 10, 2019
fcd75fc
Use errors from common_types
dvdplm Jul 10, 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
68 changes: 54 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,7 @@ members = [
"util/patricia-trie-ethereum",
"util/fastmap",
"util/time-utils",

"ethcore/verification",
"ethcore/client-traits",
]
3 changes: 3 additions & 0 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ using_queue = { path = "../miner/using-queue" }
vm = { path = "vm" }
rand_xorshift = "0.1.1"

client-traits = { path = "client-traits" }
verification = { path = "verification" }

[dev-dependencies]
blooms-db = { path = "../util/blooms-db" }
criterion = "0.2"
Expand Down
5 changes: 3 additions & 2 deletions ethcore/account-db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
description = "DB backend wrapper for Account trie"
name = "account-db"
version = "0.1.0"
description = "DB backend wrapper for Account trie"
authors = ["Parity Technologies <[email protected]>"]
license = "GPL-3.0"
version = "0.1.0"
edition = "2018"

[dependencies]
Expand Down
5 changes: 3 additions & 2 deletions ethcore/account-state/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
description = "Ethereum accounts, keeps track of changes to the code and storage"
name = "account-state"
version = "0.1.0"
description = "Ethereum accounts, keeps track of changes to the code and storage"
authors = ["Parity Technologies <[email protected]>"]
license = "GPL-3.0"
version = "0.1.0"
edition = "2018"

[dependencies]
Expand Down
1 change: 0 additions & 1 deletion ethcore/account-state/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use lru_cache::LruCache;
use parity_bytes::{Bytes, ToPretty};
use rlp::{DecoderError, encode};
use trie_db::{Recorder, Trie};

use common_types::basic_account::BasicAccount;
use ethtrie::{Result as TrieResult, SecTrieDB, TrieDB, TrieFactory};
use keccak_hasher::KeccakHasher;
Expand Down
3 changes: 1 addition & 2 deletions ethcore/account-state/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use hash_db::{AsHashDB, EMPTY_PREFIX, HashDB, Prefix};
use kvdb::DBValue;
use memory_db::{HashKey, MemoryDB};
use parking_lot::Mutex;

use journaldb::AsKeyedHashDB;
use keccak_hasher::KeccakHasher;

Expand Down Expand Up @@ -222,7 +221,7 @@ impl<H: AsHashDB<KeccakHasher, DBValue>> Proving<H> {
/// This will store all values ever fetched from that base.
pub fn new(base: H) -> Self {
Proving {
base: base,
base,
changed: journaldb::new_memory_db(),
proof: Mutex::new(HashSet::new()),
}
Expand Down
2 changes: 0 additions & 2 deletions ethcore/account-state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ pub mod account;
pub mod backend;
pub mod substate;
pub mod state;
pub mod error;

pub use {
account::Account,
backend::Backend,
error::Error,
substate::Substate,
state::{State, CleanupMode},
};
2 changes: 1 addition & 1 deletion ethcore/account-state/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use std::{
use common_types::{
state_diff::StateDiff,
basic_account::BasicAccount,
errors::EthcoreError as Error,
};
use ethereum_types::{Address, H256, U256};
use ethtrie::{TrieDB, Result as TrieResult};
Expand All @@ -46,7 +47,6 @@ use pod::{self, PodAccount, PodState};
use trie_db::{Trie, TrieError, Recorder};

use crate::{
Error,
account::Account,
backend::Backend,
};
Expand Down
12 changes: 12 additions & 0 deletions ethcore/client-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "client-traits"
version = "0.1.0"
edition = "2018"


[dependencies]
call-contract = { package = "ethcore-call-contract", path = "../call-contract" }
common-types = { path = "../types" }
derive_more = "0.15.0"
ethereum-types = "0.6"
rlp = "0.4.0" # todo: only needed for `DecoderError` – fix
57 changes: 57 additions & 0 deletions ethcore/client-traits/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.

// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity Ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.

//! State related errors

use derive_more::{Display, From};
use common_types::{
engines::EngineError,
block::{BlockError, ImportError},
transaction::Error as TransactionError,
};
use rlp::DecoderError;

#[derive(Debug, Display, From)]
pub enum Error {
/// todo: what errors do I need?
Block(BlockError),
Import(ImportError),
Engine(EngineError),
Decoder(DecoderError),
Transaction(TransactionError),
State(String), // todo: move account-state errors to `common_types`?
Other(String)
}

impl std::error::Error for Error {}

impl From<&str> for Error {
fn from(s: &str) -> Self {
Error::Other(s.into())
}
}

impl From<String> for Error {
fn from(s: String) -> Self {
Error::Other(s)
}
}

impl<E> From<Box<E>> for Error where Error: From<E> {
fn from(err: Box<E>) -> Self {
Error::from(*err)
}
}
Loading