Extract snapshot to own crate (#11010)

* 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
This commit is contained in:
David
2019-09-03 11:29:25 +02:00
committed by GitHub
parent 396ccdbcc1
commit d193ddde19
68 changed files with 627 additions and 486 deletions

View File

@@ -25,16 +25,13 @@ use network::{NetworkProtocolHandler, NetworkContext, PeerId, ProtocolId,
NetworkConfiguration as BasicNetworkConfiguration, NonReservedPeerMode, Error,
ConnectionFilter};
use network::client_version::ClientVersion;
use types::pruning_info::PruningInfo;
use ethereum_types::{H256, H512, U256};
use futures::sync::mpsc as futures_mpsc;
use futures::Stream;
use io::{TimerToken};
use ethkey::Secret;
use ethcore::client::{ChainNotify, NewBlocks, ChainMessageType};
use client_traits::BlockChainClient;
use ethcore::snapshot::SnapshotService;
use client_traits::{BlockChainClient, ChainNotify};
use snapshot::SnapshotService;
use ethcore_private_tx::PrivateStateDB;
use types::BlockNumber;
use sync_io::NetSyncIo;
@@ -55,7 +52,11 @@ use parity_runtime::Executor;
use std::sync::atomic::{AtomicBool, Ordering};
use network::IpFilter;
use private_tx::PrivateTxHandler;
use types::transaction::UnverifiedTransaction;
use types::{
chain_notify::{NewBlocks, ChainMessageType},
pruning_info::PruningInfo,
transaction::UnverifiedTransaction,
};
use super::light_sync::SyncInfo;

View File

@@ -23,10 +23,12 @@ use hash::keccak;
use network::PeerId;
use network::client_version::ClientVersion;
use rlp::Rlp;
use snapshot::ChunkType;
use crate::{
snapshot_sync::ChunkType,
sync_io::SyncIo,
};
use std::time::Instant;
use std::{mem, cmp};
use sync_io::SyncIo;
use types::{
BlockNumber,
block_status::BlockStatus,
@@ -711,7 +713,7 @@ impl SyncHandler {
Err(e) => {
trace!(target: "privatetx", "Ignoring the message, error queueing: {}", e);
}
}
}
Ok(())
}
@@ -739,7 +741,7 @@ impl SyncHandler {
Err(e) => {
trace!(target: "privatetx", "Ignoring the message, error queueing: {}", e);
}
}
}
Ok(())
}

View File

@@ -109,11 +109,13 @@ use rlp::{RlpStream, DecoderError};
use network::{self, PeerId, PacketId};
use network::client_version::ClientVersion;
use client_traits::BlockChainClient;
use sync_io::SyncIo;
use crate::{
sync_io::SyncIo,
snapshot_sync::Snapshot,
};
use super::{WarpSync, SyncConfig};
use block_sync::{BlockDownloader, DownloadAction};
use rand::{Rng, seq::SliceRandom};
use snapshot::{Snapshot};
use api::{EthProtocolInfo as PeerInfoDigest, WARP_SYNC_PROTOCOL_ID, PriorityTask};
use private_tx::PrivateTxHandler;
use transactions_stats::{TransactionsStats, Stats as TransactionStats};

View File

@@ -27,19 +27,20 @@ extern crate ethcore;
extern crate ethcore_io as io;
extern crate ethcore_network as network;
extern crate ethcore_network_devp2p as devp2p;
extern crate ethcore_private_tx;
extern crate ethereum_types;
extern crate ethkey;
extern crate ethstore;
extern crate fastmap;
extern crate futures;
extern crate keccak_hash as hash;
extern crate parity_bytes as bytes;
extern crate parity_runtime;
extern crate parking_lot;
extern crate ethcore_private_tx;
extern crate rand;
extern crate rlp;
extern crate snapshot;
extern crate triehash_ethereum;
extern crate futures;
extern crate ethcore_light as light;
@@ -69,7 +70,7 @@ mod blocks;
mod block_sync;
mod sync_io;
mod private_tx;
mod snapshot;
mod snapshot_sync;
mod transactions_stats;
pub mod light_sync;

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
use ethcore::snapshot::SnapshotService;
use snapshot::SnapshotService;
use ethereum_types::H256;
use hash::keccak;
use types::snapshot::ManifestData;

View File

@@ -23,7 +23,7 @@ use bytes::Bytes;
use client_traits::BlockChainClient;
use ethcore_private_tx::PrivateStateDB;
use types::BlockNumber;
use ethcore::snapshot::SnapshotService;
use snapshot::SnapshotService;
use parking_lot::RwLock;
/// IO interface for the syncing handler.

View File

@@ -22,11 +22,17 @@ use bytes::Bytes;
use network::{self, PeerId, ProtocolId, PacketId, SessionInfo};
use network::client_version::ClientVersion;
use tests::snapshot::*;
use types::io_message::ClientIoMessage;
use client_traits::BlockChainClient;
use ethcore::client::{TestBlockChainClient, Client as EthcoreClient,
ClientConfig, ChainNotify, NewBlocks, ChainMessageType};
use ethcore::snapshot::SnapshotService;
use types::{
chain_notify::{NewBlocks, ChainMessageType},
io_message::ClientIoMessage,
};
use client_traits::{BlockChainClient, ChainNotify};
use ethcore::client::{
TestBlockChainClient,
Client as EthcoreClient,
ClientConfig,
};
use snapshot::SnapshotService;
use spec::{self, Spec};
use ethcore_private_tx::PrivateStateDB;
use ethcore::miner::Miner;

View File

@@ -20,7 +20,7 @@ use hash::keccak;
use ethereum_types::H256;
use parking_lot::Mutex;
use bytes::Bytes;
use ethcore::snapshot::SnapshotService;
use snapshot::SnapshotService;
use ethcore::client::EachBlockWith;
use types::{
BlockNumber,