allow config NextFreeParaId in genesis (#3781)

* allow config NextFreeParaId in genesis

* update westend chain spec
This commit is contained in:
Xiliang Chen
2021-09-07 07:42:34 +12:00
committed by GitHub
parent 4b928b0f22
commit 4d2e94f7ce
4 changed files with 33 additions and 2 deletions
+12
View File
@@ -534,6 +534,9 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
config: default_parachains_host_configuration(), config: default_parachains_host_configuration(),
}, },
paras: Default::default(), paras: Default::default(),
registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
},
} }
} }
@@ -1027,6 +1030,9 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
configuration: rococo_runtime::ConfigurationConfig { configuration: rococo_runtime::ConfigurationConfig {
config: default_parachains_host_configuration(), config: default_parachains_host_configuration(),
}, },
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
},
// bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig { // bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
// owner: Some(endowed_accounts[0].clone()), // owner: Some(endowed_accounts[0].clone()),
// ..Default::default() // ..Default::default()
@@ -1456,6 +1462,9 @@ pub fn westend_testnet_genesis(
config: default_parachains_host_configuration(), config: default_parachains_host_configuration(),
}, },
paras: Default::default(), paras: Default::default(),
registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
},
} }
} }
@@ -1526,6 +1535,9 @@ pub fn rococo_testnet_genesis(
}, },
hrmp: Default::default(), hrmp: Default::default(),
paras: rococo_runtime::ParasConfig { paras: vec![] }, paras: rococo_runtime::ParasConfig { paras: vec![] },
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
},
// bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig { // bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
// owner: Some(root_key.clone()), // owner: Some(root_key.clone()),
// ..Default::default() // ..Default::default()
@@ -175,6 +175,25 @@ pub mod pallet {
#[pallet::storage] #[pallet::storage]
pub type NextFreeParaId<T> = StorageValue<_, ParaId, ValueQuery>; pub type NextFreeParaId<T> = StorageValue<_, ParaId, ValueQuery>;
#[pallet::genesis_config]
pub struct GenesisConfig {
pub next_free_para_id: ParaId,
}
#[cfg(feature = "std")]
impl Default for GenesisConfig {
fn default() -> Self {
GenesisConfig { next_free_para_id: LOWEST_PUBLIC_ID }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
fn build(&self) {
NextFreeParaId::<T>::put(self.next_free_para_id);
}
}
#[pallet::hooks] #[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {} impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
+1 -1
View File
@@ -226,7 +226,7 @@ construct_runtime! {
ParasDisputes: parachains_disputes::{Pallet, Storage, Event<T>}, ParasDisputes: parachains_disputes::{Pallet, Storage, Event<T>},
// Parachain Onboarding Pallets // Parachain Onboarding Pallets
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>}, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config},
Auctions: auctions::{Pallet, Call, Storage, Event<T>}, Auctions: auctions::{Pallet, Call, Storage, Event<T>},
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>}, Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>},
Slots: slots::{Pallet, Call, Storage, Event<T>}, Slots: slots::{Pallet, Call, Storage, Event<T>},
+1 -1
View File
@@ -1047,7 +1047,7 @@ construct_runtime! {
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 52, ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 52,
// Parachain Onboarding Pallets. Start indices at 60 to leave room. // Parachain Onboarding Pallets. Start indices at 60 to leave room.
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>} = 60, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config} = 60,
Slots: slots::{Pallet, Call, Storage, Event<T>} = 61, Slots: slots::{Pallet, Call, Storage, Event<T>} = 61,
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62, ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62,
Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 63, Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 63,