Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
ddeef45
Add client-traits crate
dvdplm Aug 6, 2019
0d49c45
New crate `machine`
dvdplm Aug 6, 2019
0465e6b
Use new machine and client-traits crates in ethcore
dvdplm Aug 6, 2019
50ca45a
Use new crates machine and client-traits instead of ethcore where app…
dvdplm Aug 6, 2019
29d4095
Fix tests
dvdplm Aug 6, 2019
cd6e0e2
Don't re-export so many types from ethcore::client
dvdplm Aug 6, 2019
2477cbd
Fixing more fallout from removing re-export
dvdplm Aug 6, 2019
51ba2f4
Merge branch 'master' into dp/chore/move-machine-to-own-crate
dvdplm Aug 6, 2019
c84a01f
fix test
dvdplm Aug 7, 2019
f2497f4
More fallout from not re-exporting types
dvdplm Aug 7, 2019
1e43534
Add some docs
dvdplm Aug 7, 2019
6d83cf2
cleanup
dvdplm Aug 7, 2019
e04d188
import the macro edition style
dvdplm Aug 7, 2019
b6e91de
Merge branch 'master' into dp/chore/move-machine-to-own-crate
dvdplm Aug 7, 2019
bac7268
Tweak docs
dvdplm Aug 7, 2019
978eb88
Add missing import
dvdplm Aug 7, 2019
d6273a7
Merge branch 'master' into dp/chore/move-machine-to-own-crate
dvdplm Aug 8, 2019
18d6a94
remove unused ethabi_derive imports
dvdplm Aug 8, 2019
d5700d9
Use latest ethabi-contract
dvdplm Aug 8, 2019
83bb140
Move many traits from ethcore/client/traits to client-traits crate
dvdplm Aug 9, 2019
d96fff3
Move snapshot related traits to the engine crate (eew)
dvdplm Aug 9, 2019
33aa152
Move a few snapshot related types to common_types
dvdplm Aug 9, 2019
9b70856
fix warning
dvdplm Aug 9, 2019
f76e5ed
Gradually introduce new engine crate: snapshot
dvdplm Aug 9, 2019
5b3a8ca
ethcore typechecks with new engine crate
dvdplm Aug 9, 2019
cecd69c
Sort out types outside ethcore
dvdplm Aug 10, 2019
c5ab534
Add an EpochVerifier to ethash and use that in Engine.epoch_verifier()
dvdplm Aug 10, 2019
45c0497
Document pub members
dvdplm Aug 10, 2019
b11a21f
Sort out tests
dvdplm Aug 10, 2019
af485cc
Add test-helpers feature and move EngineSigner impl to the right place
dvdplm Aug 10, 2019
f617bcb
Sort out tests
dvdplm Aug 10, 2019
64b5c60
Sort out tests and refactor verification types
dvdplm Aug 10, 2019
b1b6b46
Fix missing traits
dvdplm Aug 10, 2019
881b71f
More missing traits
dvdplm Aug 10, 2019
ddca9ee
Fix tests and cleanup
dvdplm Aug 10, 2019
d7d3f4b
cleanup
dvdplm Aug 10, 2019
b2f8be6
Put back needed logger import
dvdplm Aug 10, 2019
8ab2a02
Don't rexport common_types from ethcore/src/client
dvdplm Aug 10, 2019
4aef5f2
Remove files no longer used
dvdplm Aug 10, 2019
951f63e
Get rid of itertools
dvdplm Aug 10, 2019
1c42cc1
Move a few more traits from ethcore to client-traits: BlockChainReset…
dvdplm Aug 10, 2019
07b1c2d
Move ProvingBlockChainClient to client-traits
dvdplm Aug 10, 2019
7e5e4bc
Don't re-export ForkChoice and Transition from ethcore
dvdplm Aug 10, 2019
b244bfb
Address grumbles: sort imports, remove commented out code
dvdplm Aug 13, 2019
37be7b2
Merge branch 'master' into dp/chore/extract-engine-trait
dvdplm Aug 13, 2019
88cfa7f
Fix merge resolution error
dvdplm Aug 13, 2019
f4c9b9c
Extract the Clique engine to own crate
dvdplm Aug 13, 2019
5e307ab
Extract NullEngine and the block_reward module from ethcore
dvdplm Aug 13, 2019
db12d1b
Extract InstantSeal engine to own crate
dvdplm Aug 13, 2019
e9e9d62
Extract remaining engines
dvdplm Aug 14, 2019
0f5e970
Extract executive_state to own crate so it can be used by engine crates
dvdplm Aug 14, 2019
e7ba4a5
Remove snapshot stuff from the engine crate
dvdplm Aug 14, 2019
c9dca59
Put snapshot traits back in ethcore
dvdplm Aug 14, 2019
6e3b365
cleanup
dvdplm Aug 14, 2019
c92751a
Remove stuff from ethcore
dvdplm Aug 14, 2019
61b0dd6
Don't use itertools
dvdplm Aug 14, 2019
c79b7e2
itertools in aura is legit-ish
dvdplm Aug 15, 2019
42e1d57
Merge branch 'master' into dp/chore/extract-clique
dvdplm Aug 15, 2019
663f13e
More post-merge fixes
dvdplm Aug 15, 2019
0bd9176
Re-export less types in client
dvdplm Aug 16, 2019
0bd3713
cleanup
dvdplm Aug 16, 2019
7adcba0
Extract spec to own crate
dvdplm Aug 16, 2019
43206dd
Put back the test-helpers from basic-authority
dvdplm Aug 16, 2019
4f76b1e
Fix ethcore benchmarks
dvdplm Aug 16, 2019
9a53c45
Reduce the public api of ethcore/verification
dvdplm Aug 16, 2019
5acd488
WIP
dvdplm Aug 19, 2019
77e03ae
Add Cargo.toml
dvdplm Aug 19, 2019
d17ab43
Fix compilation outside ethcore
dvdplm Aug 19, 2019
208a3eb
Audit uses of import_verified_blocks() and remove unneeded calls
dvdplm Aug 19, 2019
2ba0a5d
cleanup
dvdplm Aug 19, 2019
acc461f
Remove unused imports from ethcore
dvdplm Aug 19, 2019
b164c4b
Cleanup
dvdplm Aug 19, 2019
b38ae1c
remove double semi-colons
dvdplm Aug 20, 2019
79e6000
Merge branch 'master' into dp/chore/extract-spec-from-ethcore
dvdplm Aug 20, 2019
6cd8b0d
Merge branch 'master' into dp/chore/sort-out-ClientIoMessage
dvdplm Aug 20, 2019
451f540
Add missing generic param
dvdplm Aug 20, 2019
0c4991a
More missing generics
dvdplm Aug 21, 2019
fbe0365
Update ethcore/block-reward/Cargo.toml
dvdplm Aug 21, 2019
fdd35c7
Update ethcore/engines/basic-authority/Cargo.toml
dvdplm Aug 21, 2019
0be9f98
Update ethcore/engines/ethash/Cargo.toml
dvdplm Aug 21, 2019
8fc5929
Update ethcore/engines/clique/src/lib.rs
dvdplm Aug 21, 2019
8077b51
signers is already a ref
dvdplm Aug 21, 2019
7f5c4d3
Add an EngineType enum to tighten up Engine.name()
dvdplm Aug 21, 2019
a22870d
Introduce Snapshotting enum to distinguish the type of snapshots a ch…
dvdplm Aug 21, 2019
791e99a
Rename supports_warp to snapshot_mode
dvdplm Aug 21, 2019
77e76f1
Missing import
dvdplm Aug 21, 2019
ad35cb1
Update ethcore/src/snapshot/consensus/mod.rs
dvdplm Aug 21, 2019
081e40e
Merge branch 'master' into dp/chore/extract-clique
dvdplm Aug 21, 2019
792e84e
Merge branch 'master' into dp/chore/extract-clique
dvdplm Aug 22, 2019
70a5f87
Merge branch 'dp/chore/extract-clique' into dp/chore/extract-spec-fro…
dvdplm Aug 22, 2019
94c0a67
missing import
dvdplm Aug 22, 2019
567d96c
Fix import
dvdplm Aug 22, 2019
c49895c
Merge branch 'master' into dp/chore/extract-spec-from-ethcore
dvdplm Aug 22, 2019
b34cfc4
double semi
dvdplm Aug 23, 2019
8a8e90a
Merge branch 'dp/chore/extract-spec-from-ethcore' into dp/chore/sort-…
dvdplm Aug 23, 2019
3f8aecd
Fix merge problem
dvdplm Aug 23, 2019
3ca11c0
Merge branch 'master' into dp/chore/sort-out-ClientIoMessage
dvdplm Aug 25, 2019
fa9cf5d
cleanup
dvdplm Aug 26, 2019
7f4c7e5
Parametrise `ClientIoMessage` with `()` for the light client
dvdplm Aug 26, 2019
0c8cb9e
Add impl Tick for ()
dvdplm Aug 26, 2019
23a832c
Address review feedback
dvdplm Aug 27, 2019
0dfe3c9
Move ClientIoMessage to common-types
dvdplm Aug 27, 2019
1e9f93a
Merge branch 'master' into dp/chore/sort-out-ClientIoMessage
dvdplm Aug 27, 2019
4e8ab46
remove superseeded fixme
dvdplm Aug 27, 2019
22df32b
Merge branch 'master' into dp/chore/sort-out-ClientIoMessage
dvdplm Aug 27, 2019
ad1999f
fix merge conflict errors
dvdplm Aug 27, 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
37 changes: 34 additions & 3 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ spec = { path = "ethcore/spec" }
term_size = "0.3"
textwrap = "0.9"
toml = "0.4"
verification = { path = "ethcore/verification" }

[build-dependencies]
rustc_version = "0.2"
Expand Down
19 changes: 10 additions & 9 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ evm = { path = "evm" }
executive-state = { path = "executive-state" }
futures = "0.1"
hash-db = "0.15.0"
parity-util-mem = "0.2.0"
itertools = "0.5"
journaldb = { path = "../util/journaldb" }
keccak-hash = "0.2.0"
keccak-hasher = { path = "../util/keccak-hasher" }
kvdb = "0.1"
kvdb-memorydb = "0.1"
kvdb-memorydb = { version = "0.1", optional = true }
kvdb-rocksdb = { version = "0.1.3", optional = true }
lazy_static = "1.3.0"
len-caching-lock = { path = "../util/len-caching-lock" }
lazy_static = { version = "1.3", optional = true }
log = "0.4"
macros = { path = "../util/macros", optional = true }
machine = { path = "./machine" }
Expand All @@ -61,20 +59,19 @@ rand_xorshift = "0.1.1"
rayon = "1.1"
rlp = "0.4.0"
rlp_derive = { path = "../util/rlp-derive" }
rustc-hex = "1.0"
rustc-hex = { version = "1", optional = true }
serde = "1.0"
serde_derive = "1.0"
spec = { path = "spec" }
state-db = { path = "state-db" }
stats = { path = "../util/stats" }
tempdir = { version = "0.3", optional = true }
time-utils = { path = "../util/time-utils" }
trace = { path = "trace" }
trace-time = "0.1"
trie-vm-factories = { path = "trie-vm-factories" }
triehash-ethereum = { version = "0.2", path = "../util/triehash-ethereum" }
unexpected = { path = "../util/unexpected" }
using_queue = { path = "../miner/using-queue" }
verification = { path = "./verification" }
vm = { path = "vm" }

[dev-dependencies]
Expand All @@ -88,14 +85,18 @@ ethcore-accounts = { path = "../accounts" }
ethjson = { path = "../json" }
ethkey = { path = "../accounts/ethkey" }
fetch = { path = "../util/fetch" }
kvdb-memorydb = "0.1"
kvdb-rocksdb = "0.1.3"
lazy_static = { version = "1.3" }
machine = { path = "./machine", features = ["test-helpers"] }
macros = { path = "../util/macros" }
null-engine = { path = "./engines/null-engine" }
parity-runtime = { path = "../util/runtime" }
pod = { path = "pod" }
rlp_compress = { path = "../util/rlp-compress" }
rustc-hex = "1"
serde_json = "1.0"
stats = { path = "../util/stats" }
tempdir = "0.3"
trie-standardmap = "0.15.0"

Expand All @@ -121,14 +122,14 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"]
# EVM debug traces are printed.
slow-blocks = []
# Run JSON consensus tests.
json-tests = ["env_logger", "test-helpers", "machine/test-helpers"]
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 = ["tempdir", "kvdb-rocksdb", "blooms-db", "ethash", "ethjson", "ethkey", "macros", "pod", "basic-authority/test-helpers"]
test-helpers = ["tempdir", "kvdb-memorydb", "kvdb-rocksdb", "blooms-db", "ethash", "ethjson", "ethkey", "macros", "pod", "rustc-hex", "basic-authority/test-helpers"]

[[bench]]
name = "builtin"
Expand Down
55 changes: 53 additions & 2 deletions ethcore/client-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use common_types::{
client_types::Mode,
encoded,
engines::{epoch::Transition as EpochTransition, machine::Executed},
errors::EthcoreResult,
errors::{EthcoreError, EthcoreResult},
filter::Filter,
header::Header,
ids::{BlockId, TransactionId, TraceId, UncleId},
Expand All @@ -56,6 +56,8 @@ use trace::{
};
use vm::{LastHashes, Schedule};

use common_types::snapshot::Progress;

/// State information to be used during client query
pub enum StateOrBlock {
/// State to be used, may be pending
Expand Down Expand Up @@ -168,11 +170,14 @@ pub trait EngineClient: Sync + Send + ChainInfo {
fn block_header(&self, id: BlockId) -> Option<encoded::Header>;
}

// FIXME Why these methods belong to BlockChainClient and not MiningBlockChainClient?
/// Provides methods to import block into blockchain
pub trait ImportBlock {
/// Import a block into the blockchain.
fn import_block(&self, block: Unverified) -> EthcoreResult<H256>;

/// Triggered by a message from a block queue when the block is ready for insertion.
/// Returns the number of blocks imported.
fn import_verified_blocks(&self) -> usize;
}

/// IO operations that should off-load heavy work to another thread.
Expand All @@ -187,6 +192,14 @@ pub trait IoClient: Sync + Send {
fn queue_consensus_message(&self, message: Bytes);
}

/// Implement this for clients that need logic to decide when/how to advance.
pub trait Tick {
Comment thread
dvdplm marked this conversation as resolved.
/// Tick the client
fn tick(&self, _prevent_sleep: bool) {}
}

impl Tick for () {}

/// Provides recently seen bad blocks.
pub trait BadBlocks {
/// Returns a list of blocks that were recently not imported because they were invalid.
Expand Down Expand Up @@ -377,6 +390,9 @@ pub trait BlockChainClient : Sync + Send + AccountData + BlockChain + CallContra
pub trait BlockChainReset {
/// reset to best_block - n
fn reset(&self, num: u32) -> Result<(), String>;

/// Number of eras kept in a journal before they are pruned
fn pruning_history(&self) -> u64;
}


Expand Down Expand Up @@ -423,3 +439,38 @@ pub trait ProvingBlockChainClient: BlockChainClient {
/// Get an epoch change signal by block hash.
fn epoch_signal(&self, hash: H256) -> Option<Vec<u8>>;
}

/// External database restoration handler
pub trait DatabaseRestore: Send + Sync {
/// Restart with a new backend. Takes ownership of passed database and moves it to a new location.
fn restore_db(&self, new_db: &str) -> Result<(), EthcoreError>;
}

/// Snapshot related functionality
pub trait SnapshotClient: BlockChainClient + BlockInfo + DatabaseRestore + BlockChainReset {
/// Take a snapshot at the given block.
/// If the ID given is "latest", this will default to 1000 blocks behind.
fn take_snapshot<W: SnapshotWriter + Send>(
Comment thread
dvdplm marked this conversation as resolved.
&self,
writer: W,
at: BlockId,
p: &Progress,
) -> Result<(), EthcoreError>;
}


// todo[dvdplm] move this back to snapshot once extracted from ethcore
/// Something which can write snapshots.
/// Writing the same chunk multiple times will lead to implementation-defined
/// behavior, and is not advised.
pub trait SnapshotWriter {
/// Write a compressed state chunk.
fn write_state_chunk(&mut self, hash: H256, chunk: &[u8]) -> std::io::Result<()>;

/// Write a compressed block chunk.
fn write_block_chunk(&mut self, hash: H256, chunk: &[u8]) -> std::io::Result<()>;

/// Complete writing. The manifest's chunk lists must be consistent
/// with the chunks written.
fn finish(self, manifest: common_types::snapshot::ManifestData) -> std::io::Result<()> where Self: Sized;
}
2 changes: 1 addition & 1 deletion ethcore/light/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ client-traits = { path = "../client-traits" }
common-types = { path = "../types" }
derive_more = "0.14.0"
engine = { path = "../engine" }
ethcore = { path = ".."}
ethcore-db = { path = "../db" }
ethcore-blockchain = { path = "../blockchain" }
ethereum-types = "0.6.0"
Expand Down Expand Up @@ -49,6 +48,7 @@ kvdb = "0.1"
memory-cache = { path = "../../util/memory-cache" }
error-chain = { version = "0.12", default-features = false }
journaldb = { path = "../../util/journaldb" }
verification = { path = "../verification" }

[dev-dependencies]
ethcore = { path = "..", features = ["test-helpers"] }
Expand Down
11 changes: 7 additions & 4 deletions ethcore/light/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
use std::sync::{Weak, Arc};

use engine::{Engine, EpochChange, Proof};
use ethcore::client::{ClientReport, ClientIoMessage};
use ethcore::verification::queue::{self, HeaderQueue};
use verification::queue::{self, HeaderQueue};
use spec::{Spec, SpecHardcodedSync};
use io::IoChannel;
use parking_lot::{Mutex, RwLock};
Expand All @@ -30,12 +29,14 @@ use common_types::{
BlockNumber,
block_status::BlockStatus,
blockchain_info::BlockChainInfo,
client_types::ClientReport,
encoded,
engines::epoch::{Transition as EpochTransition, PendingTransition},
errors::EthcoreError as Error,
errors::EthcoreResult,
header::Header,
ids::BlockId,
io_message::ClientIoMessage,
verification::VerificationQueueInfo as BlockQueueInfo,
};
use kvdb::KeyValueDB;
Expand Down Expand Up @@ -162,7 +163,7 @@ impl<T: LightChainClient> AsLightClient for T {

/// Light client implementation.
pub struct Client<T> {
queue: HeaderQueue,
queue: HeaderQueue<()>,
engine: Arc<dyn Engine>,
chain: HeaderChain,
report: RwLock<ClientReport>,
Expand All @@ -183,7 +184,7 @@ impl<T: ChainDataFetcher> Client<T> {
chain_col: Option<u32>,
spec: &Spec,
fetcher: T,
io_channel: IoChannel<ClientIoMessage>,
io_channel: IoChannel<ClientIoMessage<()>>,
cache: Arc<Mutex<Cache>>
) -> Result<Self, Error> {
Ok(Self {
Expand Down Expand Up @@ -649,3 +650,5 @@ impl<T: ChainDataFetcher> client_traits::EngineClient for Client<T> {
Client::block_header(self, id)
}
}

impl<T> client_traits::Tick for Client<T> {}
Loading