chore: move genesis block builder to chain-spec crate. (#13427)

* chore: move genesis block builder to block builder crate.

* add missing file

* chore: move genesis block builder to sc-chain-spec

* Update client/chain-spec/src/genesis.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update test-utils/runtime/src/genesismap.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update test-utils/runtime/client/src/lib.rs

* fix warnings

* fix warnings

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
yjh
2023-03-01 03:50:57 +08:00
committed by GitHub
parent 1ef9c473e7
commit 20bf3c938e
12 changed files with 88 additions and 74 deletions
+7 -10
View File
@@ -30,6 +30,8 @@ pub use substrate_test_runtime as runtime;
pub use self::block_builder_ext::BlockBuilderExt;
use sc_chain_spec::construct_genesis_block;
use sp_api::StateVersion;
use sp_core::{
sr25519,
storage::{ChildInfo, Storage, StorageChild},
@@ -122,7 +124,7 @@ impl GenesisParameters {
}
}
impl substrate_test_client::GenesisInit for GenesisParameters {
impl GenesisInit for GenesisParameters {
fn genesis_storage(&self) -> Storage {
use codec::Encode;
@@ -148,7 +150,7 @@ impl substrate_test_client::GenesisInit for GenesisParameters {
storage.top.clone().into_iter().chain(child_roots).collect(),
sp_runtime::StateVersion::V1,
);
let block: runtime::Block = client::genesis::construct_genesis_block(state_root);
let block: runtime::Block = construct_genesis_block(state_root, StateVersion::V1);
storage.top.extend(additional_storage_with_genesis(&block));
storage
@@ -260,7 +262,7 @@ impl<B> TestClientBuilderExt<B>
client::LocalCallExecutor<
substrate_test_runtime::Block,
B,
sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch>,
NativeElseWasmExecutor<LocalExecutorDispatch>,
>,
B,
> where
@@ -288,11 +290,6 @@ pub fn new() -> Client<Backend> {
}
/// Create a new native executor.
pub fn new_native_executor() -> sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch> {
sc_executor::NativeElseWasmExecutor::new(
sc_executor::WasmExecutionMethod::Interpreted,
None,
8,
2,
)
pub fn new_native_executor() -> NativeElseWasmExecutor<LocalExecutorDispatch> {
NativeElseWasmExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8, 2)
}