From 630d5b333486751a48cb7e4e865d0b205c5f0b0b Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 6 May 2024 18:36:58 +0400 Subject: [PATCH 1/2] fix: genesis config --- Cargo.lock | 1 + Cargo.toml | 1 + node/src/chain_spec.rs | 10 +++++----- runtime/Cargo.toml | 1 + runtime/src/lib.rs | 25 ++++++++++++++++--------- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da96f1c30..1ec387f2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4689,6 +4689,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 7c0821a45..a1df677ff 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 4e8e34383..ae848ea99 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 } 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, From ef2ade3760803e4be78c320dd00ead3f033b03c2 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 6 May 2024 18:41:23 +0400 Subject: [PATCH 2/2] fix: zepter --- runtime/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index ae848ea99..2e5762ce5 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -140,7 +140,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",