Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add safe_xcm_version to Genesis Specs (#743) (#904)
Browse files Browse the repository at this point in the history
* Add safe_xcm_version to Genesis Specs (#743)

* add safe_xcm_version to genesis specs

* cargo +nightly fmt

* Point to xcm latest version

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
  • Loading branch information
gilescope and apopiak committed Jan 26, 2022
1 parent a963055 commit 88928d0
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions parachain-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "maste
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
6 changes: 6 additions & 0 deletions parachain-template/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
pub type ChainSpec =
sc_service::GenericChainSpec<parachain_template_runtime::GenesisConfig, Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

/// Helper function to generate a crypto pair from seed
pub fn get_public_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
Expand Down Expand Up @@ -211,5 +214,8 @@ fn testnet_genesis(
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: parachain_template_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
}
}
2 changes: 1 addition & 1 deletion parachain-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ construct_runtime!(

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 31,
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin, Config} = 31,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,

Expand Down
1 change: 1 addition & 0 deletions polkadot-parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch =
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
1 change: 1 addition & 0 deletions polkadot-parachains/rococo-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ std = [
"pallet-sudo/std",
"pallet-transaction-payment/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-xcm/std",
"parachain-info/std",
"parachains-common/std",
"cumulus-pallet-aura-ext/std",
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/rococo-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ construct_runtime! {

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin, Config} = 51,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,

Expand Down
15 changes: 15 additions & 0 deletions polkadot-parachains/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ pub type ShellChainSpec = sc_service::GenericChainSpec<shell_runtime::GenesisCon
pub type SeedlingChainSpec =
sc_service::GenericChainSpec<seedling_runtime::GenesisConfig, Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
Expand Down Expand Up @@ -189,6 +192,9 @@ fn testnet_genesis(
aura: rococo_parachain_runtime::AuraConfig { authorities: initial_authorities },
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: rococo_parachain_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
}
}

Expand Down Expand Up @@ -454,6 +460,9 @@ fn statemint_genesis(
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: statemint_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
}
}

Expand Down Expand Up @@ -638,6 +647,9 @@ fn statemine_genesis(
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: statemine_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
}
}

Expand Down Expand Up @@ -817,5 +829,8 @@ fn westmint_genesis(
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: westmint_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
}
}
1 change: 1 addition & 0 deletions polkadot-parachains/statemine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ std = [
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm/std",
"parachain-info/std",
"cumulus-pallet-aura-ext/std",
"pallet-asset-tx-payment/std",
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ construct_runtime!(

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin} = 31,
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 31,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,

Expand Down
1 change: 1 addition & 0 deletions polkadot-parachains/statemint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ std = [
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm/std",
"parachain-info/std",
"cumulus-pallet-aura-ext/std",
"pallet-asset-tx-payment/std",
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/statemint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ construct_runtime!(

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin} = 31,
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 31,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,

Expand Down
1 change: 1 addition & 0 deletions polkadot-parachains/westmint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ std = [
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm/std",
"parachain-info/std",
"cumulus-pallet-aura-ext/std",
"pallet-asset-tx-payment/std",
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/westmint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ construct_runtime!(

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin} = 31,
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 31,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,

Expand Down

0 comments on commit 88928d0

Please sign in to comment.