ChainSpec extensions (#3692)

* Add some chainspec tests and make sure we validate it.

* Manual implementation of Extension + Forks definitions.

* Move chain spec to separate crate.

* Allow using ChainSpec with extensions.

* Renames.

* Implement Extension derive.

* Implement Extension for Forks.

* Support specifying fork blocks.

* make for_blocks work

* Support forks correctly.

* Add a bunch of docs.

* Make fork blocks optional.

* Add missing docs.

* Fix build.

* Use struct for check_block params.

* Fix tests?

* Clean up.
This commit is contained in:
Tomasz Drwięga
2019-09-28 19:05:36 +02:00
committed by Gavin Wood
parent c555b9bf88
commit 667ee95f5d
39 changed files with 1368 additions and 336 deletions
+3 -2
View File
@@ -40,7 +40,7 @@ use std::collections::{HashMap, HashSet};
use client::backend::NewBlockState;
use client::blockchain::{well_known_cache_keys, HeaderBackend};
use client::ExecutionStrategies;
use client::{ForkBlocks, ExecutionStrategies};
use client::backend::{StorageCollection, ChildStorageCollection};
use codec::{Decode, Encode};
use hash_db::{Hasher, Prefix};
@@ -206,6 +206,7 @@ pub fn new_client<E, S, Block, RA>(
settings: DatabaseSettings,
executor: E,
genesis_storage: S,
fork_blocks: ForkBlocks<Block>,
execution_strategies: ExecutionStrategies,
keystore: Option<primitives::traits::BareCryptoStorePtr>,
) -> Result<(
@@ -227,7 +228,7 @@ pub fn new_client<E, S, Block, RA>(
let backend = Arc::new(Backend::new(settings, CANONICALIZATION_DELAY)?);
let executor = client::LocalCallExecutor::new(backend.clone(), executor, keystore);
Ok((
client::Client::new(backend.clone(), executor, genesis_storage, execution_strategies)?,
client::Client::new(backend.clone(), executor, genesis_storage, fork_blocks, execution_strategies)?,
backend,
))
}