Integrate a governance XCM origin (#407)

* Introduce the converter into the hub

* Parachain recognises Rococo governance body as admin

* Whitespace

* Use UsingComponents for fee payment in XCM

* Fixes

* Fixes for XCM permissions

* Remove encode_call test

* Fixes

* Fixes

* Fixes
This commit is contained in:
Gavin Wood
2021-04-28 14:41:18 +02:00
committed by GitHub
parent b03d11b8e0
commit fc82a611ce
8 changed files with 235 additions and 98 deletions
@@ -48,6 +48,7 @@ pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features
[dev-dependencies]
hex = "0.4.3"
hex-literal = "0.3.1"
[build-dependencies]
substrate-wasm-builder = "3.0.0"
@@ -27,7 +27,7 @@ use sp_api::impl_runtime_apis;
use sp_core::OpaqueMetadata;
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{BlakeTwo256, Block as BlockT, IdentityLookup},
traits::{BlakeTwo256, Block as BlockT, AccountIdLookup},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult,
};
@@ -65,18 +65,16 @@ use xcm_builder::{
};
use xcm_executor::{Config, XcmExecutor};
pub type SessionHandlers = ();
impl_opaque_keys! {
pub struct SessionKeys {}
}
/// This runtime version.
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("cumulus-test-parachain"),
impl_name: create_runtime_str!("cumulus-test-parachain"),
spec_name: create_runtime_str!("shell"),
impl_name: create_runtime_str!("shell"),
authoring_version: 1,
spec_version: 18,
spec_version: 2,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@@ -96,12 +94,6 @@ pub const DAYS: BlockNumber = HOURS * 24;
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
#[derive(codec::Encode, codec::Decode)]
pub enum XCMPMessage<XAccountId, XBalance> {
/// Transfer tokens to the given account from the Parachain account.
TransferToken(XAccountId, XBalance),
}
/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
@@ -152,7 +144,7 @@ impl frame_system::Config for Runtime {
/// The aggregated dispatch type that is available for extrinsics.
type Call = Call;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = IdentityLookup<AccountId>;
type Lookup = AccountIdLookup<AccountId, ()>;
/// The index type for storing how many extrinsics an account has signed.
type Index = Index;
/// The index type for blocks.
@@ -232,11 +224,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type Event = Event;
type OnValidationData = ();
type SelfParaId = parachain_info::Module<Runtime>;
type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<
MaxDownwardMessageWeight,
XcmExecutor<XcmConfig>,
Call,
>;
type DownwardMessageHandlers = CumulusXcm;
type OutboundXcmpMessageSource = XcmpQueue;
type XcmpMessageHandler = XcmpQueue;
type ReservedXcmpWeight = ReservedXcmpWeight;
@@ -356,7 +344,11 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>;
}
impl cumulus_pallet_xcm::Config for Runtime {}
impl cumulus_pallet_xcm::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
type MaxWeight = MaxDownwardMessageWeight;
}
impl cumulus_pallet_xcmp_queue::Config for Runtime {
type Event = Event;
@@ -380,13 +372,13 @@ construct_runtime! {
// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>},
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
CumulusXcm: cumulus_pallet_xcm::{Pallet, Origin},
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
}
}
/// The address format for describing accounts.
pub type Address = AccountId;
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.