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

Commit

Permalink
Extract snapshot to own crate (#11010)
Browse files Browse the repository at this point in the history
* Move snapshot to own crate
Sort out imports

* WIP cargo toml

* Make snapshotting generic over the client
Sort out tests

* Sort out types from blockchain and client

* Sort out sync

* Sort out imports and generics

* Sort out main binary

* Fix sync test-helpers

* Sort out import for secret-store

* Sort out more imports

* Fix easy todos

* cleanup

* Cleanup

* remove unneded workspace member

* cleanup

* Sort out test-helpers dependency on account-db

* Update ethcore/client-traits/src/lib.rs

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Update ethcore/snapshot/Cargo.toml
  • Loading branch information
dvdplm authored Sep 3, 2019
1 parent 396ccdb commit d193ddd
Show file tree
Hide file tree
Showing 68 changed files with 620 additions and 479 deletions.
58 changes: 53 additions & 5 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 @@ -69,6 +69,7 @@ semver = "0.9"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
snapshot = { path = "ethcore/snapshot" }
spec = { path = "ethcore/spec" }
term_size = "0.3"
textwrap = "0.9"
Expand Down
24 changes: 17 additions & 7 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ version = "1.12.0"
authors = ["Parity Technologies <admin@parity.io>"]

[dependencies]
account-db = { path = "account-db" }
account-db = { path = "account-db", optional = true }
account-state = { path = "account-state" }
ansi_term = "0.11"
basic-authority = { path = "./engines/basic-authority", optional = true} # used by test-helpers feature
blooms-db = { path = "../util/blooms-db", optional = true }
client-traits = { path = "./client-traits" }
common-types = { path = "types" }
crossbeam-utils = "0.6"
engine = { path = "./engine" }
env_logger = { version = "0.5", optional = true }
ethabi = "8.0"
Expand All @@ -24,7 +23,6 @@ ethash = { path = "../ethash", optional = true }
ethjson = { path = "../json", optional = true }
ethkey = { path = "../accounts/ethkey", optional = true }
ethcore-blockchain = { path = "./blockchain" }
ethcore-bloom-journal = { path = "../util/bloom" }
ethcore-call-contract = { path = "./call-contract" }
ethcore-db = { path = "./db" }
ethcore-io = { path = "../util/io" }
Expand All @@ -38,7 +36,6 @@ hash-db = "0.15.0"
itertools = "0.5"
journaldb = { path = "../util/journaldb" }
keccak-hash = "0.2.0"
keccak-hasher = { path = "../util/keccak-hasher" }
kvdb = "0.1"
kvdb-memorydb = { version = "0.1", optional = true }
kvdb-rocksdb = { version = "0.1.3", optional = true }
Expand All @@ -47,9 +44,7 @@ log = "0.4"
macros = { path = "../util/macros", optional = true }
machine = { path = "./machine" }
memory-cache = { path = "../util/memory-cache" }
num_cpus = "1.2"
parity-bytes = "0.1"
parity-snappy = "0.1"
parking_lot = "0.8"
pod = { path = "pod", optional = true }
trie-db = "0.15.0"
Expand All @@ -62,6 +57,7 @@ rlp_derive = { path = "../util/rlp-derive" }
rustc-hex = { version = "1", optional = true }
serde = "1.0"
serde_derive = "1.0"
snapshot = { path = "snapshot" }
spec = { path = "spec" }
state-db = { path = "state-db" }
tempdir = { version = "0.3", optional = true }
Expand All @@ -75,6 +71,7 @@ verification = { path = "./verification" }
vm = { path = "vm" }

[dev-dependencies]
account-db = { path = "account-db" }
blooms-db = { path = "../util/blooms-db" }
ethcore-builtin = { path = "./builtin" }
criterion = "0.2"
Expand Down Expand Up @@ -129,7 +126,20 @@ ci-skip-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-memorydb", "kvdb-rocksdb", "blooms-db", "ethash", "ethjson", "ethkey", "macros", "pod", "rustc-hex", "basic-authority/test-helpers"]
test-helpers = [
"account-db",
"blooms-db",
"ethash",
"ethjson",
"ethkey",
"kvdb-memorydb",
"kvdb-rocksdb",
"macros",
"pod",
"rustc-hex",
"tempdir",
"basic-authority/test-helpers"
]

[[bench]]
name = "builtin"
Expand Down
54 changes: 0 additions & 54 deletions ethcore/blockchain/src/block_info.rs

This file was deleted.

31 changes: 17 additions & 14 deletions ethcore/blockchain/src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ use std::sync::Arc;

use ansi_term::Colour;
use blooms_db;
use common_types::BlockNumber;
use common_types::blockchain_info::BlockChainInfo;
use common_types::encoded;
use common_types::engines::ForkChoice;
use common_types::engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
use common_types::header::{Header, ExtendedHeader};
use common_types::log_entry::{LogEntry, LocalizedLogEntry};
use common_types::receipt::Receipt;
use common_types::transaction::LocalizedTransaction;
use common_types::tree_route::TreeRoute;
use common_types::view;
use common_types::views::{BlockView, HeaderView};
use common_types::{
BlockNumber,
blockchain_info::BlockChainInfo,
block::{BlockInfo, BlockLocation, BranchBecomingCanonChainData},
encoded,
engines::ForkChoice,
engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition},
header::{Header, ExtendedHeader},
import_route::ImportRoute,
log_entry::{LogEntry, LocalizedLogEntry},
receipt::Receipt,
transaction::LocalizedTransaction,
tree_route::TreeRoute,
view,
views::{BlockView, HeaderView},
};
use ethcore_db::cache_manager::CacheManager;
use ethcore_db::keys::{BlockReceipts, BlockDetails, TransactionAddress, EPOCH_KEY_PREFIX, EpochTransitions};
use ethcore_db::{self as db, Writable, Readable, CacheUpdatePolicy};
Expand All @@ -50,9 +54,8 @@ use rlp::RlpStream;
use rlp_compress::{compress, decompress, blocks_swapper};

use crate::best_block::{BestBlock, BestAncientBlock};
use crate::block_info::{BlockInfo, BlockLocation, BranchBecomingCanonChainData};
use crate::update::{ExtrasUpdate, ExtrasInsert};
use crate::{CacheSize, ImportRoute, Config};
use crate::{CacheSize, Config};

/// Database backing `BlockChain`.
pub trait BlockChainDB: Send + Sync {
Expand Down
3 changes: 0 additions & 3 deletions ethcore/blockchain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ extern crate parity_util_mem as util_mem;
extern crate parity_util_mem as malloc_size_of;

mod best_block;
mod block_info;
mod blockchain;
mod cache;
mod config;
mod import_route;
mod update;

pub mod generator;
Expand All @@ -35,7 +33,6 @@ pub use crate::{
blockchain::{BlockProvider, BlockChain, BlockChainDB, BlockChainDBHandler},
cache::CacheSize,
config::Config,
import_route::ImportRoute,
update::ExtrasInsert,
};
pub use ethcore_db::keys::{BlockReceipts, BlockDetails, TransactionAddress, BlockNumberKey};
Expand Down
11 changes: 6 additions & 5 deletions ethcore/blockchain/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

use std::collections::HashMap;

use common_types::BlockNumber;
use common_types::encoded::Block;
use common_types::engines::ForkChoice;
use common_types::{
BlockNumber,
encoded::Block,
engines::ForkChoice,
block::BlockInfo,
};
use ethcore_db::keys::{BlockDetails, BlockReceipts, TransactionAddress};
use ethereum_types::{H256, Bloom};

use crate::block_info::BlockInfo;

/// Block extras update info.
pub struct ExtrasUpdate {
/// Block info.
Expand Down
Loading

0 comments on commit d193ddd

Please sign in to comment.