unify loading spec && further spec cleanups (#10948)
* bundle_* macros for spec * fixed failing tests * renamed bundle.rs to chain.rs * removed unused derives * updated spec/chain.rs description
This commit is contained in:
@@ -899,7 +899,7 @@ impl Drop for Service {
|
||||
mod tests {
|
||||
use client::ClientIoMessage;
|
||||
use io::{IoService};
|
||||
use spec::Spec;
|
||||
use crate::spec;
|
||||
use journaldb::Algorithm;
|
||||
use snapshot::{ManifestData, RestorationStatus, SnapshotService};
|
||||
use super::*;
|
||||
@@ -909,9 +909,9 @@ mod tests {
|
||||
#[test]
|
||||
fn sends_async_messages() {
|
||||
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
|
||||
let client = generate_dummy_client_with_spec_and_data(Spec::new_null, 400, 5, &gas_prices);
|
||||
let client = generate_dummy_client_with_spec_and_data(spec::new_null, 400, 5, &gas_prices);
|
||||
let service = IoService::<ClientIoMessage>::start().unwrap();
|
||||
let spec = Spec::new_test();
|
||||
let spec = spec::new_test();
|
||||
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let dir = tempdir.path().join("snapshot");
|
||||
@@ -952,7 +952,7 @@ mod tests {
|
||||
use ethereum_types::H256;
|
||||
use kvdb_rocksdb::DatabaseConfig;
|
||||
|
||||
let spec = Spec::new_test();
|
||||
let spec = spec::new_test();
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
|
||||
let state_hashes: Vec<_> = (0..5).map(|_| H256::random()).collect();
|
||||
|
||||
@@ -29,6 +29,7 @@ use parking_lot::Mutex;
|
||||
use snappy;
|
||||
use kvdb::DBTransaction;
|
||||
use test_helpers;
|
||||
use crate::spec;
|
||||
|
||||
const SNAPSHOT_MODE: ::snapshot::PowSnapshot = ::snapshot::PowSnapshot { blocks: 30000, max_restore_blocks: 30000 };
|
||||
|
||||
@@ -38,7 +39,7 @@ fn chunk_and_restore(amount: u64) {
|
||||
let generator = BlockGenerator::new(vec![rest]);
|
||||
let genesis = genesis.last();
|
||||
|
||||
let engine = ::spec::Spec::new_test().engine;
|
||||
let engine = spec::new_test().engine;
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let snapshot_path = tempdir.path().join("SNAP");
|
||||
|
||||
@@ -128,7 +129,7 @@ fn checks_flag() {
|
||||
let chunk = stream.out();
|
||||
|
||||
let db = test_helpers::new_db();
|
||||
let engine = ::spec::Spec::new_test().engine;
|
||||
let engine = spec::new_test().engine;
|
||||
let chain = BlockChain::new(Default::default(), genesis.last().encoded().raw(), db.clone());
|
||||
|
||||
let manifest = ::snapshot::ManifestData {
|
||||
|
||||
@@ -27,7 +27,7 @@ use types::ids::BlockId;
|
||||
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
||||
use snapshot::service::{Service, ServiceParams};
|
||||
use snapshot::{chunk_state, chunk_secondary, ManifestData, Progress, SnapshotService, RestorationStatus};
|
||||
use spec::Spec;
|
||||
use crate::spec;
|
||||
use test_helpers::{new_db, new_temp_db, generate_dummy_client_with_spec_and_data, restoration_db_handler};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
@@ -43,7 +43,7 @@ fn restored_is_equivalent() {
|
||||
const TX_PER: usize = 5;
|
||||
|
||||
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
|
||||
let client = generate_dummy_client_with_spec_and_data(Spec::new_null, NUM_BLOCKS, TX_PER, &gas_prices);
|
||||
let client = generate_dummy_client_with_spec_and_data(spec::new_null, NUM_BLOCKS, TX_PER, &gas_prices);
|
||||
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let client_db = tempdir.path().join("client_db");
|
||||
@@ -53,7 +53,7 @@ fn restored_is_equivalent() {
|
||||
let restoration = restoration_db_handler(db_config);
|
||||
let blockchain_db = restoration.open(&client_db).unwrap();
|
||||
|
||||
let spec = Spec::new_null();
|
||||
let spec = spec::new_null();
|
||||
let client2 = Client::new(
|
||||
Default::default(),
|
||||
&spec,
|
||||
@@ -107,9 +107,9 @@ fn restored_is_equivalent() {
|
||||
#[test]
|
||||
fn guards_delete_folders() {
|
||||
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
|
||||
let client = generate_dummy_client_with_spec_and_data(Spec::new_null, 400, 5, &gas_prices);
|
||||
let client = generate_dummy_client_with_spec_and_data(spec::new_null, 400, 5, &gas_prices);
|
||||
|
||||
let spec = Spec::new_null();
|
||||
let spec = spec::new_null();
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let service_params = ServiceParams {
|
||||
engine: spec.engine.clone(),
|
||||
@@ -165,7 +165,7 @@ fn keep_ancient_blocks() {
|
||||
|
||||
// Generate blocks
|
||||
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
|
||||
let spec_f = Spec::new_null;
|
||||
let spec_f = spec::new_null;
|
||||
let spec = spec_f();
|
||||
let client = generate_dummy_client_with_spec_and_data(spec_f, NUM_BLOCKS as u32, 5, &gas_prices);
|
||||
|
||||
@@ -276,9 +276,9 @@ fn recover_aborted_recovery() {
|
||||
|
||||
const NUM_BLOCKS: u32 = 400;
|
||||
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
|
||||
let client = generate_dummy_client_with_spec_and_data(Spec::new_null, NUM_BLOCKS, 5, &gas_prices);
|
||||
let client = generate_dummy_client_with_spec_and_data(spec::new_null, NUM_BLOCKS, 5, &gas_prices);
|
||||
|
||||
let spec = Spec::new_null();
|
||||
let spec = spec::new_null();
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
let client_db = new_db();
|
||||
|
||||
Reference in New Issue
Block a user