difftreelog
fix use ChainSpecBuilder
in: master
8 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6380,6 +6380,7 @@
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
+ "sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -10261,6 +10262,7 @@
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
+ "sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -15134,6 +15136,7 @@
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
+ "sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -181,6 +181,7 @@
sp-trie = { default-features = false, version = "32.0.0" }
sp-version = { default-features = false, version = "32.0.0" }
sp-weights = { default-features = false, version = "30.0.0" }
+sp-genesis-builder = { default-features = false, version = "0.10.0" }
staging-parachain-info = { default-features = false, version = "0.10.0" }
staging-xcm = { default-features = false, version = "10.0.0" }
staging-xcm-builder = { default-features = false, version = "10.0.0" }
@@ -217,4 +218,5 @@
log = { version = "0.4.20", default-features = false }
num_enum = { version = "0.7.0", default-features = false }
serde = { default-features = false, features = ['derive'], version = "1.0.188" }
+serde_json = "1"
smallvec = "1.11.1"
node/cli/src/chain_spec.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use std::collections::BTreeMap;1819use default_runtime::WASM_BINARY;20#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]21pub use opal_runtime as default_runtime;22#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]23pub use quartz_runtime as default_runtime;24use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};25use sc_service::ChainType;26use serde::{Deserialize, Serialize};27use serde_json::map::Map;28use sp_core::{sr25519, Pair, Public};29use sp_runtime::traits::{IdentifyAccount, Verify};30#[cfg(feature = "unique-runtime")]31pub use unique_runtime as default_runtime;32use up_common::types::opaque::*;3334/// The `ChainSpec` parameterized for the unique runtime.35#[cfg(feature = "unique-runtime")]36pub type UniqueChainSpec =37 sc_service::GenericChainSpec<unique_runtime::RuntimeGenesisConfig, Extensions>;3839/// The `ChainSpec` parameterized for the quartz runtime.40#[cfg(feature = "quartz-runtime")]41pub type QuartzChainSpec =42 sc_service::GenericChainSpec<quartz_runtime::RuntimeGenesisConfig, Extensions>;4344/// The `ChainSpec` parameterized for the opal runtime.45pub type OpalChainSpec =46 sc_service::GenericChainSpec<opal_runtime::RuntimeGenesisConfig, Extensions>;4748#[cfg(feature = "unique-runtime")]49pub type DefaultChainSpec = UniqueChainSpec;5051#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]52pub type DefaultChainSpec = QuartzChainSpec;5354#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]55pub type DefaultChainSpec = OpalChainSpec;5657#[cfg(not(feature = "unique-runtime"))]58/// PARA_ID for Opal/Sapphire/Quartz59const PARA_ID: u32 = 2095;6061#[cfg(feature = "unique-runtime")]62/// PARA_ID for Unique63const PARA_ID: u32 = 2037;6465pub trait RuntimeIdentification {66 fn runtime_id(&self) -> RuntimeId;67}6869impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {70 fn runtime_id(&self) -> RuntimeId {71 #[cfg(feature = "unique-runtime")]72 if self.id().starts_with("unique") || self.id().starts_with("unq") {73 return RuntimeId::Unique;74 }7576 #[cfg(feature = "quartz-runtime")]77 if self.id().starts_with("quartz")78 || self.id().starts_with("qtz")79 || self.id().starts_with("sapphire")80 {81 return RuntimeId::Quartz;82 }8384 if self.id().starts_with("opal") || self.id() == "dev" || self.id() == "local_testnet" {85 return RuntimeId::Opal;86 }8788 RuntimeId::Unknown(self.id().into())89 }90}9192pub enum ServiceId {93 Prod,94 Dev,95}9697pub trait ServiceIdentification {98 fn service_id(&self) -> ServiceId;99}100101impl ServiceIdentification for Box<dyn sc_service::ChainSpec> {102 fn service_id(&self) -> ServiceId {103 if self.id().ends_with("dev") {104 ServiceId::Dev105 } else {106 ServiceId::Prod107 }108 }109}110111/// Helper function to generate a crypto pair from seed112pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {113 TPublic::Pair::from_string(&format!("//{seed}"), None)114 .expect("static values are valid; qed")115 .public()116}117118/// The extensions for the [`DefaultChainSpec`].119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]120#[serde(deny_unknown_fields)]121pub struct Extensions {122 /// The relay chain of the Parachain.123 pub relay_chain: String,124 /// The id of the Parachain.125 pub para_id: u32,126}127128impl Extensions {129 /// Try to get the extension from the given `ChainSpec`.130 pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {131 sc_chain_spec::get_extension(chain_spec.extensions())132 }133}134135type AccountPublic = <Signature as Verify>::Signer;136137/// Helper function to generate an account ID from seed138pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId139where140 AccountPublic: From<<TPublic::Pair as Pair>::Public>,141{142 AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()143}144145#[cfg(not(feature = "unique-runtime"))]146macro_rules! testnet_genesis {147 (148 $runtime:path,149 $root_key:expr,150 $initial_invulnerables:expr,151 $endowed_accounts:expr,152 $id:expr153 ) => {{154 use $runtime::*;155156 RuntimeGenesisConfig {157 system: Default::default(),158 balances: BalancesConfig {159 balances: $endowed_accounts160 .iter()161 .cloned()162 // 1e13 UNQ163 .map(|k| (k, 1 << 100))164 .collect(),165 },166 sudo: SudoConfig {167 key: Some($root_key),168 },169170 vesting: VestingConfig { vesting: vec![] },171 parachain_info: ParachainInfoConfig {172 parachain_id: $id.into(),173 ..Default::default()174 },175 collator_selection: CollatorSelectionConfig {176 invulnerables: $initial_invulnerables177 .iter()178 .cloned()179 .map(|(acc, _)| acc)180 .collect(),181 },182 session: SessionConfig {183 keys: $initial_invulnerables184 .into_iter()185 .map(|(acc, aura)| {186 (187 acc.clone(), // account id188 acc, // validator id189 SessionKeys { aura }, // session keys190 )191 })192 .collect(),193 },194 evm: EVMConfig {195 accounts: BTreeMap::new(),196 ..Default::default()197 },198 ..Default::default()199 }200 }};201}202203#[cfg(feature = "unique-runtime")]204macro_rules! testnet_genesis {205 (206 $runtime:path,207 $root_key:expr,208 $initial_invulnerables:expr,209 $endowed_accounts:expr,210 $id:expr211 ) => {{212 use $runtime::*;213214 RuntimeGenesisConfig {215 system: Default::default(),216 balances: BalancesConfig {217 balances: $endowed_accounts218 .iter()219 .cloned()220 // 1e13 UNQ221 .map(|k| (k, 1 << 100))222 .collect(),223 },224 sudo: SudoConfig {225 key: Some($root_key),226 },227 vesting: VestingConfig { vesting: vec![] },228 parachain_info: ParachainInfoConfig {229 parachain_id: $id.into(),230 ..Default::default()231 },232 aura: AuraConfig {233 authorities: $initial_invulnerables234 .into_iter()235 .map(|(_, aura)| aura)236 .collect(),237 },238 evm: EVMConfig {239 accounts: BTreeMap::new(),240 ..Default::default()241 },242 ..Default::default()243 }244 }};245}246247pub fn development_config() -> DefaultChainSpec {248 let mut properties = Map::new();249 properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());250 properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());251 properties.insert(252 "ss58Format".into(),253 default_runtime::SS58Prefix::get().into(),254 );255256 DefaultChainSpec::from_genesis(257 // Name258 format!(259 "{}{}",260 default_runtime::VERSION.spec_name.to_uppercase(),261 if cfg!(feature = "unique-runtime") {262 ""263 } else {264 " by UNIQUE"265 }266 )267 .as_str(),268 // ID269 format!("{}_dev", default_runtime::VERSION.spec_name).as_str(),270 ChainType::Local,271 move || {272 testnet_genesis!(273 default_runtime,274 // Sudo account275 get_account_id_from_seed::<sr25519::Public>("Alice"),276 [277 (278 get_account_id_from_seed::<sr25519::Public>("Alice"),279 get_from_seed::<AuraId>("Alice"),280 ),281 (282 get_account_id_from_seed::<sr25519::Public>("Bob"),283 get_from_seed::<AuraId>("Bob"),284 ),285 ],286 // Pre-funded accounts287 vec![288 get_account_id_from_seed::<sr25519::Public>("Alice"),289 get_account_id_from_seed::<sr25519::Public>("Bob"),290 get_account_id_from_seed::<sr25519::Public>("Charlie"),291 get_account_id_from_seed::<sr25519::Public>("Dave"),292 get_account_id_from_seed::<sr25519::Public>("Eve"),293 get_account_id_from_seed::<sr25519::Public>("Ferdie"),294 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),295 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),296 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),297 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),298 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),299 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),300 ],301 PARA_ID302 )303 },304 // Bootnodes305 vec![],306 // Telemetry307 None,308 // Protocol ID309 None,310 None,311 // Properties312 Some(properties),313 // Extensions314 Extensions {315 relay_chain: "rococo-dev".into(),316 para_id: PARA_ID,317 },318 WASM_BINARY.expect("WASM binary was not build, please build it!"),319 )320}321322pub fn local_testnet_config() -> DefaultChainSpec {323 let mut properties = Map::new();324 properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());325 properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());326 properties.insert(327 "ss58Format".into(),328 default_runtime::SS58Prefix::get().into(),329 );330331 DefaultChainSpec::from_genesis(332 // Name333 format!(334 "{}{}",335 default_runtime::VERSION.impl_name.to_uppercase(),336 if cfg!(feature = "unique-runtime") {337 ""338 } else {339 " by UNIQUE"340 }341 )342 .as_str(),343 // ID344 format!("{}_local", default_runtime::VERSION.spec_name).as_str(),345 ChainType::Local,346 move || {347 testnet_genesis!(348 default_runtime,349 // Sudo account350 get_account_id_from_seed::<sr25519::Public>("Alice"),351 [352 (353 get_account_id_from_seed::<sr25519::Public>("Alice"),354 get_from_seed::<AuraId>("Alice"),355 ),356 (357 get_account_id_from_seed::<sr25519::Public>("Bob"),358 get_from_seed::<AuraId>("Bob"),359 ),360 ],361 // Pre-funded accounts362 vec![363 get_account_id_from_seed::<sr25519::Public>("Alice"),364 get_account_id_from_seed::<sr25519::Public>("Bob"),365 get_account_id_from_seed::<sr25519::Public>("Charlie"),366 get_account_id_from_seed::<sr25519::Public>("Dave"),367 get_account_id_from_seed::<sr25519::Public>("Eve"),368 get_account_id_from_seed::<sr25519::Public>("Ferdie"),369 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),370 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),371 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),372 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),373 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),374 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),375 ],376 PARA_ID377 )378 },379 // Bootnodes380 vec![],381 // Telemetry382 None,383 // Protocol ID384 None,385 None,386 // Properties387 Some(properties),388 // Extensions389 Extensions {390 relay_chain: "westend-local".into(),391 para_id: PARA_ID,392 },393 WASM_BINARY.expect("WASM binary was not build, please build it!"),394 )395}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use default_runtime::WASM_BINARY;18#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]19pub use opal_runtime as default_runtime;20#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]21pub use quartz_runtime as default_runtime;22use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};23use sc_service::ChainType;24use serde::{Deserialize, Serialize};25use serde_json::{json, map::Map};26use sp_core::{sr25519, Pair, Public};27use sp_runtime::traits::{IdentifyAccount, Verify};28#[cfg(feature = "unique-runtime")]29pub use unique_runtime as default_runtime;30use up_common::types::opaque::*;3132/// The `ChainSpec` parameterized for the unique runtime.33#[cfg(feature = "unique-runtime")]34pub type UniqueChainSpec =35 sc_service::GenericChainSpec<unique_runtime::RuntimeGenesisConfig, Extensions>;3637/// The `ChainSpec` parameterized for the quartz runtime.38#[cfg(feature = "quartz-runtime")]39pub type QuartzChainSpec =40 sc_service::GenericChainSpec<quartz_runtime::RuntimeGenesisConfig, Extensions>;4142/// The `ChainSpec` parameterized for the opal runtime.43pub type OpalChainSpec =44 sc_service::GenericChainSpec<opal_runtime::RuntimeGenesisConfig, Extensions>;4546#[cfg(feature = "unique-runtime")]47pub type DefaultChainSpec = UniqueChainSpec;4849#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]50pub type DefaultChainSpec = QuartzChainSpec;5152#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]53pub type DefaultChainSpec = OpalChainSpec;5455#[cfg(not(feature = "unique-runtime"))]56/// PARA_ID for Opal/Sapphire/Quartz57const PARA_ID: u32 = 2095;5859#[cfg(feature = "unique-runtime")]60/// PARA_ID for Unique61const PARA_ID: u32 = 2037;6263pub trait RuntimeIdentification {64 fn runtime_id(&self) -> RuntimeId;65}6667impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {68 fn runtime_id(&self) -> RuntimeId {69 #[cfg(feature = "unique-runtime")]70 if self.id().starts_with("unique") || self.id().starts_with("unq") {71 return RuntimeId::Unique;72 }7374 #[cfg(feature = "quartz-runtime")]75 if self.id().starts_with("quartz")76 || self.id().starts_with("qtz")77 || self.id().starts_with("sapphire")78 {79 return RuntimeId::Quartz;80 }8182 if self.id().starts_with("opal") || self.id() == "dev" || self.id() == "local_testnet" {83 return RuntimeId::Opal;84 }8586 RuntimeId::Unknown(self.id().into())87 }88}8990pub enum ServiceId {91 Prod,92 Dev,93}9495pub trait ServiceIdentification {96 fn service_id(&self) -> ServiceId;97}9899impl ServiceIdentification for Box<dyn sc_service::ChainSpec> {100 fn service_id(&self) -> ServiceId {101 if self.id().ends_with("dev") {102 ServiceId::Dev103 } else {104 ServiceId::Prod105 }106 }107}108109/// Helper function to generate a crypto pair from seed110pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {111 TPublic::Pair::from_string(&format!("//{seed}"), None)112 .expect("static values are valid; qed")113 .public()114}115116/// The extensions for the [`DefaultChainSpec`].117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]118#[serde(deny_unknown_fields)]119pub struct Extensions {120 /// The relay chain of the Parachain.121 pub relay_chain: String,122 /// The id of the Parachain.123 pub para_id: u32,124}125126impl Extensions {127 /// Try to get the extension from the given `ChainSpec`.128 pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {129 sc_chain_spec::get_extension(chain_spec.extensions())130 }131}132133type AccountPublic = <Signature as Verify>::Signer;134135/// Helper function to generate an account ID from seed136pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId137where138 AccountPublic: From<<TPublic::Pair as Pair>::Public>,139{140 AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()141}142143pub fn test_config(chain_id: &str, relay_chain: &str) -> DefaultChainSpec {144 DefaultChainSpec::builder(145 WASM_BINARY.expect("WASM binary was not build, please build it!"),146 Extensions {147 relay_chain: relay_chain.into(),148 para_id: PARA_ID,149 },150 )151 .with_id(&format!(152 "{}_{}",153 default_runtime::VERSION.spec_name,154 chain_id155 ))156 .with_name(&format!(157 "{}{}",158 default_runtime::VERSION.spec_name.to_uppercase(),159 if cfg!(feature = "unique-runtime") {160 ""161 } else {162 " by UNIQUE"163 }164 ))165 .with_properties(chain_properties())166 .with_chain_type(ChainType::Development)167 .with_genesis_config_patch(genesis_patch())168 .build()169}170171fn genesis_patch() -> serde_json::Value {172 use default_runtime::*;173174 let invulnerables = ["Alice", "Bob"];175176 #[allow(unused_mut)]177 let mut patch = json!({178 "parachainInfo": {179 "parachainId": PARA_ID,180 },181182 "aura": {183 "authorities": invulnerables.into_iter()184 .map(|name| get_from_seed::<AuraId>(name))185 .collect::<Vec<_>>(),186 },187188 "session": {189 "keys": invulnerables.into_iter()190 .map(|name| {191 let account = get_account_id_from_seed::<sr25519::Public>(name);192 let aura = get_from_seed::<AuraId>(name);193194 (195 /* account id: */ account.clone(),196 /* validator id: */ account,197 /* session keys: */ SessionKeys { aura },198 )199 })200 .collect::<Vec<_>>()201 },202203 "sudo": {204 "key": get_account_id_from_seed::<sr25519::Public>("Alice"),205 },206207 "balances": {208 "balances": &[209 get_account_id_from_seed::<sr25519::Public>("Alice"),210 get_account_id_from_seed::<sr25519::Public>("Bob"),211 get_account_id_from_seed::<sr25519::Public>("Charlie"),212 get_account_id_from_seed::<sr25519::Public>("Dave"),213 get_account_id_from_seed::<sr25519::Public>("Eve"),214 get_account_id_from_seed::<sr25519::Public>("Ferdie"),215 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),216 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),217 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),218 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),219 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),220 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),221 ].into_iter()222 .map(|k| (k, /* ~1.2e+12 UNQ */ 1u128 << 100))223 .collect::<Vec<_>>(),224 },225 });226227 #[cfg(feature = "unique-runtime")]228 {229 patch230 .as_object_mut()231 .expect("the genesis patch is always an object; qed")232 .remove("session");233 }234235 patch236}237238fn chain_properties() -> sc_chain_spec::Properties {239 let mut properties = Map::new();240 properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());241 properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());242 properties.insert(243 "ss58Format".into(),244 default_runtime::SS58Prefix::get().into(),245 );246247 properties248}node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -49,9 +49,7 @@
use crate::{
chain_spec::{self, RuntimeIdentification, ServiceId, ServiceIdentification},
cli::{Cli, RelayChainCli, Subcommand},
- service::{
- new_partial, start_dev_node, start_node, OpalRuntimeExecutor, ParachainHostFunctions,
- },
+ service::{new_partial, start_dev_node, start_node, OpalRuntimeExecutor},
};
macro_rules! no_runtime_err {
@@ -65,8 +63,8 @@
fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
- "dev" => Box::new(chain_spec::development_config()),
- "" | "local" => Box::new(chain_spec::local_testnet_config()),
+ "dev" => Box::new(chain_spec::test_config("dev", "rococo-dev")),
+ "" | "local" => Box::new(chain_spec::test_config("local", "westend-local")),
path => {
let path = std::path::PathBuf::from(path);
#[allow(clippy::redundant_clone)]
@@ -352,6 +350,8 @@
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use polkadot_cli::Block;
+ use crate::service::ParachainHostFunctions;
+
type Header = <Block as sp_runtime::traits::Block>::Header;
type Hasher = <Header as sp_runtime::traits::Header>::Hashing;
@@ -403,7 +403,7 @@
use std::{future::Future, pin::Pin};
use polkadot_cli::Block;
- use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
+ use sc_executor::NativeExecutionDispatch;
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
let runner = cli.create_runner(cmd)?;
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -43,6 +43,7 @@
ApplyExtrinsicResult, DispatchError, ExtrinsicInclusionMode,
};
use frame_support::{
+ genesis_builder_helper::{build_config, create_default_config},
pallet_prelude::Weight,
traits::OnFinalize,
};
@@ -710,6 +711,16 @@
)
}
}
+
+ impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
+ fn create_default_config() -> Vec<u8> {
+ create_default_config::<RuntimeGenesisConfig>()
+ }
+
+ fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
+ build_config::<RuntimeGenesisConfig>(config)
+ }
+ }
}
}
}
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -146,6 +146,7 @@
'sp-storage/std',
'sp-transaction-pool/std',
'sp-version/std',
+ 'sp-genesis-builder/std',
'staging-parachain-info/std',
'staging-xcm-builder/std',
'staging-xcm-executor/std',
@@ -295,6 +296,7 @@
sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
+sp-genesis-builder = { workspace = true }
staging-parachain-info = { workspace = true }
staging-xcm = { workspace = true }
staging-xcm-builder = { workspace = true }
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -145,6 +145,7 @@
'sp-std/std',
'sp-transaction-pool/std',
'sp-version/std',
+ 'sp-genesis-builder/std',
'staging-parachain-info/std',
'staging-xcm-builder/std',
'staging-xcm-executor/std',
@@ -283,6 +284,7 @@
sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
+sp-genesis-builder = { workspace = true }
staging-parachain-info = { workspace = true }
staging-xcm = { workspace = true }
staging-xcm-builder = { workspace = true }
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -143,6 +143,7 @@
'sp-std/std',
'sp-transaction-pool/std',
'sp-version/std',
+ 'sp-genesis-builder/std',
'staging-parachain-info/std',
'staging-xcm-builder/std',
'staging-xcm-executor/std',
@@ -287,6 +288,7 @@
sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
+sp-genesis-builder = { workspace = true }
staging-parachain-info = { workspace = true }
staging-xcm = { workspace = true }
staging-xcm-builder = { workspace = true }