diff --git a/Cargo.lock b/Cargo.lock index 258143df6..17e18432c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4690,6 +4690,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-aura", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-offchain", diff --git a/Cargo.toml b/Cargo.toml index fd23bb95e..7a0ddb7b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,6 +82,7 @@ sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = sp-consensus = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0", default-features = false } sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" } +sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0", default-features = false } sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0", default-features = false } sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0", default-features = false } sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0", default-features = false } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 1eaed26fc..1ca9be776 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -129,7 +129,7 @@ pub fn finney_mainnet_config() -> Result { .with_name("Bittensor") .with_id("bittensor") .with_chain_type(ChainType::Live) - .with_genesis_config(finney_genesis( + .with_genesis_config_patch(finney_genesis( // Initial PoA authorities (Validators) // aura | grandpa vec![ @@ -292,7 +292,7 @@ pub fn finney_testnet_config() -> Result { .with_name("Bittensor") .with_id("bittensor") .with_chain_type(ChainType::Development) - .with_genesis_config(testnet_genesis( + .with_genesis_config_patch(testnet_genesis( // Initial PoA authorities (Validators) // aura | grandpa vec![ @@ -349,7 +349,7 @@ pub fn localnet_config() -> Result { .with_name("Bittensor") .with_id("bittensor") .with_chain_type(ChainType::Development) - .with_genesis_config(localnet_genesis( + .with_genesis_config_patch(localnet_genesis( // Initial PoA authorities (Validators) // aura | grandpa vec![ @@ -430,10 +430,10 @@ fn localnet_genesis( "sudo": { "key": Some(get_account_id_from_seed::("Alice")) }, - "triumvirate_members": { + "triumvirateMembers": { "members": trimvirate_members }, - "senate_members": { + "senateMembers": { "members": senate_members, }, }) diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 08f4f0746..1ad9d636b 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -41,6 +41,7 @@ sp-block-builder = { workspace = true } sp-consensus-aura = { workspace = true } sp-core = { workspace = true } sp-storage = { workspace = true } +sp-genesis-builder = { workspace = true } sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } @@ -140,7 +141,8 @@ std = [ "sp-io/std", "sp-tracing/std", "log/std", - "sp-storage/std" + "sp-storage/std", + "sp-genesis-builder/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d2b273eec..2522b0ad7 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -9,20 +9,18 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod migrations; use codec::{Decode, Encode, MaxEncodedLen}; - -use migrations::{account_data_migration, init_storage_versions}; -use pallet_commitments::CanCommit; -use pallet_grandpa::{ - fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, -}; - use frame_support::{ dispatch::DispatchResultWithPostInfo, + genesis_builder_helper::{build_config, create_default_config}, pallet_prelude::{DispatchError, Get}, traits::{fungible::HoldConsideration, LinearStoragePrice, OnRuntimeUpgrade}, }; use frame_system::{EnsureNever, EnsureRoot, RawOrigin}; - +use migrations::{account_data_migration, init_storage_versions}; +use pallet_commitments::CanCommit; +use pallet_grandpa::{ + fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, +}; use pallet_registry::CanRegisterIdentity; use scale_info::TypeInfo; use smallvec::smallvec; @@ -37,7 +35,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, MultiSignature, }; - use sp_std::cmp::Ordering; use sp_std::prelude::*; #[cfg(feature = "std")] @@ -1277,6 +1274,16 @@ impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( source: TransactionSource,