diff --git a/polkadot/node/service/src/chain_spec.rs b/polkadot/node/service/src/chain_spec.rs index 6a52cdeec7..c0e225666e 100644 --- a/polkadot/node/service/src/chain_spec.rs +++ b/polkadot/node/service/src/chain_spec.rs @@ -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() diff --git a/polkadot/runtime/common/src/paras_registrar.rs b/polkadot/runtime/common/src/paras_registrar.rs index c914bcdb22..3c9e809932 100644 --- a/polkadot/runtime/common/src/paras_registrar.rs +++ b/polkadot/runtime/common/src/paras_registrar.rs @@ -175,6 +175,25 @@ pub mod pallet { #[pallet::storage] pub type NextFreeParaId = 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 GenesisBuild for GenesisConfig { + fn build(&self) { + NextFreeParaId::::put(self.next_free_para_id); + } + } + #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 247e1ae56b..c0d67e1eae 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -226,7 +226,7 @@ construct_runtime! { ParasDisputes: parachains_disputes::{Pallet, Storage, Event}, // Parachain Onboarding Pallets - Registrar: paras_registrar::{Pallet, Call, Storage, Event}, + Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config}, Auctions: auctions::{Pallet, Call, Storage, Event}, Crowdloan: crowdloan::{Pallet, Call, Storage, Event}, Slots: slots::{Pallet, Call, Storage, Event}, diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 519176f01b..0f255e3a0d 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -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} = 60, + Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config} = 60, Slots: slots::{Pallet, Call, Storage, Event} = 61, ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62, Auctions: auctions::{Pallet, Call, Storage, Event} = 63,