Commit 4405ea9f authored by Cheng JIANG's avatar Cheng JIANG
Browse files

add generic parameter to support different runtimes

parent dd097415
Pipeline #163048 canceled with stages
in 3 minutes and 4 seconds
...@@ -558,7 +558,10 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi ...@@ -558,7 +558,10 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
registrar: westend_runtime::RegistrarConfig { registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: westend_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: westend_runtime::XcmPalletConfig {
safe_xcm_version: Some(2),
..Default::default()
},
} }
} }
...@@ -756,7 +759,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC ...@@ -756,7 +759,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
}, },
gilt: Default::default(), gilt: Default::default(),
paras: Default::default(), paras: Default::default(),
xcm_pallet: kusama::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: kusama::XcmPalletConfig { safe_xcm_version: Some(2), ..Default::default() },
} }
} }
...@@ -1056,7 +1059,10 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: ...@@ -1056,7 +1059,10 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
registrar: rococo_runtime::RegistrarConfig { registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: rococo_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: rococo_runtime::XcmPalletConfig {
safe_xcm_version: Some(2),
..Default::default()
},
// 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()
...@@ -1414,7 +1420,7 @@ pub fn kusama_testnet_genesis( ...@@ -1414,7 +1420,7 @@ pub fn kusama_testnet_genesis(
}, },
gilt: Default::default(), gilt: Default::default(),
paras: Default::default(), paras: Default::default(),
xcm_pallet: kusama::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: kusama::XcmPalletConfig { safe_xcm_version: Some(2), ..Default::default() },
} }
} }
...@@ -1496,7 +1502,10 @@ pub fn westend_testnet_genesis( ...@@ -1496,7 +1502,10 @@ pub fn westend_testnet_genesis(
registrar: westend_runtime::RegistrarConfig { registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: westend_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: westend_runtime::XcmPalletConfig {
safe_xcm_version: Some(2),
..Default::default()
},
} }
} }
...@@ -1573,7 +1582,10 @@ pub fn rococo_testnet_genesis( ...@@ -1573,7 +1582,10 @@ pub fn rococo_testnet_genesis(
registrar: rococo_runtime::RegistrarConfig { registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: rococo_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: rococo_runtime::XcmPalletConfig {
safe_xcm_version: Some(2),
..Default::default()
},
// 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()
......
...@@ -1521,7 +1521,7 @@ construct_runtime! { ...@@ -1521,7 +1521,7 @@ construct_runtime! {
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 73, Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 73,
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
} }
} }
......
...@@ -255,7 +255,7 @@ construct_runtime! { ...@@ -255,7 +255,7 @@ construct_runtime! {
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>}, Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>},
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
} }
} }
......
...@@ -1101,7 +1101,7 @@ construct_runtime! { ...@@ -1101,7 +1101,7 @@ construct_runtime! {
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 64, Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 64,
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
} }
} }
......
...@@ -388,20 +388,21 @@ pub mod pallet { ...@@ -388,20 +388,21 @@ pub mod pallet {
StorageValue<_, VersionMigrationStage, OptionQuery>; StorageValue<_, VersionMigrationStage, OptionQuery>;
#[pallet::genesis_config] #[pallet::genesis_config]
pub struct GenesisConfig { pub struct GenesisConfig<T: Config> {
/// The default version to encode outgoing XCM messages with. /// The default version to encode outgoing XCM messages with.
pub safe_xcm_version: Option<XcmVersion>, pub safe_xcm_version: Option<XcmVersion>,
pub phantom: sp_std::marker::PhantomData<T>,
} }
#[cfg(feature = "std")] #[cfg(feature = "std")]
impl Default for GenesisConfig { impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self { fn default() -> Self {
Self { safe_xcm_version: Some(XCM_VERSION) } Self { safe_xcm_version: Some(XCM_VERSION), phantom: Default::default() }
} }
} }
#[pallet::genesis_build] #[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig { impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
SafeXcmVersion::<T>::set(self.safe_xcm_version); SafeXcmVersion::<T>::set(self.safe_xcm_version);
} }
......
...@@ -324,6 +324,10 @@ pub(crate) fn new_test_ext_with_balances( ...@@ -324,6 +324,10 @@ pub(crate) fn new_test_ext_with_balances(
.assimilate_storage(&mut t) .assimilate_storage(&mut t)
.unwrap(); .unwrap();
pallet_xcm::GenesisConfig::<Test> { safe_xcm_version: Some(2), ..Default::default() }
.assimilate_storage(&mut t)
.unwrap();
let mut ext = sp_io::TestExternalities::new(t); let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| System::set_block_number(1)); ext.execute_with(|| System::set_block_number(1));
ext ext
......
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