Unverified Commit 84a3962e authored by Xiliang Chen's avatar Xiliang Chen Committed by GitHub
Browse files

allow config NextFreeParaId in genesis (#3781)

* allow config NextFreeParaId in genesis

* update westend chain spec
parent d0b0c0f9
Pipeline #155772 passed with stages
in 43 minutes and 56 seconds
......@@ -534,6 +534,9 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
config: default_parachains_host_configuration(),
},
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 {
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 {
// owner: Some(endowed_accounts[0].clone()),
// ..Default::default()
......@@ -1456,6 +1462,9 @@ pub fn westend_testnet_genesis(
config: default_parachains_host_configuration(),
},
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(),
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 {
// owner: Some(root_key.clone()),
// ..Default::default()
......
......@@ -175,6 +175,25 @@ pub mod pallet {
#[pallet::storage]
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]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
......
......@@ -226,7 +226,7 @@ construct_runtime! {
ParasDisputes: parachains_disputes::{Pallet, Storage, Event<T>},
// 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>},
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>},
Slots: slots::{Pallet, Call, Storage, Event<T>},
......
......@@ -1047,7 +1047,7 @@ construct_runtime! {
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 52,
// 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,
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62,
Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 63,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment