Unverified Commit 12a3e03f authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

XCM revamp (#2836)



* Remove unused relaying XCM

* Aggregate HRMP (XCMP/HMP) messages. Payloads for spambot.

* Revert lock

* Fix

* Broken example

* Introduce fee payment mechanics into XCM.

* Weight limitations on XCM execution

* Mock environment for tests and the first test

* Tests for XCM and a few refactors.

* Remove code that's not ready

* Fix for an XCM and an additional test

* Query response system

* XCMP message dispatch system reimagining

- Moved most of the logic into xcm-handler pallet
- Altered the outgoing XCMP API from push to pull
- Changed underlying outgoing queue data structures to avoid multi-page read/writes
- Introduced queuing for incoming messages
- Introduced signal messages as a flow-control sub-stream
- Introduced flow-control with basic threshold back-pressure
- Introduced overall weight limitation on messages executed
- Additonal alterations to XCM APIs for the new system

* Some build fixes

* Remove the Encode bounds sprayed around

* More faff

* Fix bounds amek use latest scale codec.

* remove println

* fixes

* Fix XcmExecutor Tests

* Fix XCM bounds using derivative crate

* Refactor names of XcmGeneric &c into Xcm

* Repot the xcm-executor into xcm-builder

* Docs

* Docs

* Fixes

* Update xcm/src/lib.rs
Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>

* Fixes

* Docs

* Update runtime/parachains/src/ump.rs
Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>

* Docs

* Fixes

* Fixes

* Fixes

* Docs

* Fixes

* Fixes

* Introduce transfer_asset specialisation.

* Fixes

* Fixes
Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>
parent 5288ca3c
Pipeline #133243 failed with stages
in 32 minutes and 18 seconds
...@@ -160,6 +160,12 @@ version = "0.5.2" ...@@ -160,6 +160,12 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrayvec"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7"
[[package]] [[package]]
name = "asn1_der" name = "asn1_der"
version = "0.6.3" version = "0.6.3"
...@@ -1320,6 +1326,17 @@ dependencies = [ ...@@ -1320,6 +1326,17 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.11" version = "0.99.11"
...@@ -5054,11 +5071,11 @@ dependencies = [ ...@@ -5054,11 +5071,11 @@ dependencies = [
[[package]] [[package]]
name = "parity-scale-codec" name = "parity-scale-codec"
version = "2.0.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75c823fdae1bb5ff5708ee61a62697e6296175dc671710876871c853f48592b3" checksum = "731f4d179ed52b1c7eeb29baf29c604ea9301b889b23ce93660220a5465d5c6f"
dependencies = [ dependencies = [
"arrayvec 0.5.2", "arrayvec 0.7.0",
"bitvec", "bitvec",
"byte-slice-cast", "byte-slice-cast",
"parity-scale-codec-derive", "parity-scale-codec-derive",
...@@ -5067,9 +5084,9 @@ dependencies = [ ...@@ -5067,9 +5084,9 @@ dependencies = [
[[package]] [[package]]
name = "parity-scale-codec-derive" name = "parity-scale-codec-derive"
version = "2.0.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9029e65297c7fd6d7013f0579e193ec2b34ae78eabca854c9417504ad8a2d214" checksum = "f44c5f94427bd0b5076e8f7e15ca3f60a4d8ac0077e4793884e6fdfd8915344e"
dependencies = [ dependencies = [
"proc-macro-crate 0.1.5", "proc-macro-crate 0.1.5",
"proc-macro2", "proc-macro2",
...@@ -11307,6 +11324,7 @@ dependencies = [ ...@@ -11307,6 +11324,7 @@ dependencies = [
name = "xcm" name = "xcm"
version = "0.8.30" version = "0.8.30"
dependencies = [ dependencies = [
"derivative",
"parity-scale-codec", "parity-scale-codec",
] ]
......
...@@ -109,7 +109,7 @@ decl_module! { ...@@ -109,7 +109,7 @@ decl_module! {
/// The given parachain should exist and the payload should not exceed the preconfigured size /// The given parachain should exist and the payload should not exceed the preconfigured size
/// `config.max_downward_message_size`. /// `config.max_downward_message_size`.
#[weight = (1_000, DispatchClass::Operational)] #[weight = (1_000, DispatchClass::Operational)]
pub fn sudo_queue_downward_xcm(origin, id: ParaId, xcm: xcm::VersionedXcm) -> DispatchResult { pub fn sudo_queue_downward_xcm(origin, id: ParaId, xcm: xcm::opaque::VersionedXcm) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
ensure!(<paras::Module<T>>::is_valid_para(id), Error::<T>::ParaDoesntExist); ensure!(<paras::Module<T>>::is_valid_para(id), Error::<T>::ParaDoesntExist);
let config = <configuration::Module<T>>::config(); let config = <configuration::Module<T>>::config();
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
use parity_scale_codec::Encode; use parity_scale_codec::Encode;
use sp_std::marker::PhantomData; use sp_std::marker::PhantomData;
use xcm::{VersionedXcm, v0::{SendXcm, MultiLocation, Junction, Xcm, Result, Error}}; use xcm::opaque::{VersionedXcm, v0::{SendXcm, MultiLocation, Junction, Xcm, Result, Error}};
use runtime_parachains::{configuration, dmp}; use runtime_parachains::{configuration, dmp};
/// Xcm sender for relay chain. It only sends downward message. /// Xcm sender for relay chain. It only sends downward message.
...@@ -36,7 +36,7 @@ impl<T: configuration::Config + dmp::Config> SendXcm for RelayChainXcmSender<T> ...@@ -36,7 +36,7 @@ impl<T: configuration::Config + dmp::Config> SendXcm for RelayChainXcmSender<T>
).map_err(Into::<Error>::into)?; ).map_err(Into::<Error>::into)?;
Ok(()) Ok(())
} else { } else {
Err(Error::CannotReachDestination) Err(Error::CannotReachDestination("UnsupportedDestination"))
} }
} }
} }
...@@ -995,7 +995,7 @@ impl<T: Config> Module<T> { ...@@ -995,7 +995,7 @@ impl<T: Config> Module<T> {
<Self as Store>::HrmpOpenChannelRequestsList::append(channel_id); <Self as Store>::HrmpOpenChannelRequestsList::append(channel_id);
let notification_bytes = { let notification_bytes = {
use xcm::{v0::Xcm, VersionedXcm}; use xcm::opaque::{v0::Xcm, VersionedXcm};
use parity_scale_codec::Encode as _; use parity_scale_codec::Encode as _;
VersionedXcm::from(Xcm::HrmpNewChannelOpenRequest { VersionedXcm::from(Xcm::HrmpNewChannelOpenRequest {
...@@ -1061,7 +1061,7 @@ impl<T: Config> Module<T> { ...@@ -1061,7 +1061,7 @@ impl<T: Config> Module<T> {
let notification_bytes = { let notification_bytes = {
use parity_scale_codec::Encode as _; use parity_scale_codec::Encode as _;
use xcm::{v0::Xcm, VersionedXcm}; use xcm::opaque::{v0::Xcm, VersionedXcm};
VersionedXcm::from(Xcm::HrmpChannelAccepted { VersionedXcm::from(Xcm::HrmpChannelAccepted {
recipient: u32::from(origin), recipient: u32::from(origin),
...@@ -1104,7 +1104,7 @@ impl<T: Config> Module<T> { ...@@ -1104,7 +1104,7 @@ impl<T: Config> Module<T> {
let config = <configuration::Module<T>>::config(); let config = <configuration::Module<T>>::config();
let notification_bytes = { let notification_bytes = {
use parity_scale_codec::Encode as _; use parity_scale_codec::Encode as _;
use xcm::{v0::Xcm, VersionedXcm}; use xcm::opaque::{v0::Xcm, VersionedXcm};
VersionedXcm::from(Xcm::HrmpChannelClosing { VersionedXcm::from(Xcm::HrmpChannelClosing {
initiator: u32::from(origin), initiator: u32::from(origin),
......
...@@ -20,6 +20,7 @@ use crate::{ ...@@ -20,6 +20,7 @@ use crate::{
}; };
use sp_std::{fmt, prelude::*}; use sp_std::{fmt, prelude::*};
use sp_std::collections::{btree_map::BTreeMap, vec_deque::VecDeque}; use sp_std::collections::{btree_map::BTreeMap, vec_deque::VecDeque};
use sp_runtime::traits::Zero;
use frame_support::{decl_module, decl_storage, StorageMap, StorageValue, weights::Weight, traits::Get}; use frame_support::{decl_module, decl_storage, StorageMap, StorageValue, weights::Weight, traits::Get};
use primitives::v1::{Id as ParaId, UpwardMessage}; use primitives::v1::{Id as ParaId, UpwardMessage};
...@@ -65,15 +66,15 @@ impl<Config: xcm_executor::Config> UmpSink for XcmSink<Config> { ...@@ -65,15 +66,15 @@ impl<Config: xcm_executor::Config> UmpSink for XcmSink<Config> {
use xcm::v0::{Junction, MultiLocation, ExecuteXcm}; use xcm::v0::{Junction, MultiLocation, ExecuteXcm};
use xcm_executor::XcmExecutor; use xcm_executor::XcmExecutor;
let weight: Weight = 0; // TODO: #2841 #UMPQUEUE Get a proper weight limit here. Probably from Relay Chain Config
let weight_limit = Weight::max_value();
if let Ok(versioned_xcm_message) = VersionedXcm::decode(&mut &msg[..]) { let weight = if let Ok(versioned_xcm_message) = VersionedXcm::decode(&mut &msg[..]) {
match versioned_xcm_message { match versioned_xcm_message {
VersionedXcm::V0(xcm_message) => { VersionedXcm::V0(xcm_message) => {
let xcm_junction: Junction = Junction::Parachain { id: origin.into() }; let xcm_junction: Junction = Junction::Parachain { id: origin.into() };
let xcm_location: MultiLocation = xcm_junction.into(); let xcm_location: MultiLocation = xcm_junction.into();
// TODO: Do something with result. let result = XcmExecutor::<Config>::execute_xcm(xcm_location, xcm_message, weight_limit);
let _result = XcmExecutor::<Config>::execute_xcm(xcm_location, xcm_message); result.weight_used()
} }
} }
} else { } else {
...@@ -81,11 +82,12 @@ impl<Config: xcm_executor::Config> UmpSink for XcmSink<Config> { ...@@ -81,11 +82,12 @@ impl<Config: xcm_executor::Config> UmpSink for XcmSink<Config> {
target: LOG_TARGET, target: LOG_TARGET,
"Failed to decode versioned XCM from upward message.", "Failed to decode versioned XCM from upward message.",
); );
} Weight::zero()
};
// TODO: to be sound, this implementation must ensure that returned (and thus consumed) // TODO: #2841 #UMPQUEUE to be sound, this implementation must ensure that returned (and thus consumed)
// weight is limited to some small portion of the total block weight (as a ballpark, 1/4, 1/8 // weight is limited to some small portion of the total block weight (as a ballpark, 1/4, 1/8
// or lower). // or lower).
weight weight
} }
} }
......
...@@ -81,11 +81,11 @@ pub use pallet_balances::Call as BalancesCall; ...@@ -81,11 +81,11 @@ pub use pallet_balances::Call as BalancesCall;
use polkadot_parachain::primitives::Id as ParaId; use polkadot_parachain::primitives::Id as ParaId;
use xcm::v0::{MultiLocation, NetworkId}; use xcm::v0::{MultiLocation, NetworkId};
use xcm_executor::traits::IsConcrete;
use xcm_builder::{ use xcm_builder::{
AccountId32Aliases, ChildParachainConvertsVia, SovereignSignedViaLocation, AccountId32Aliases, ChildParachainConvertsVia, SovereignSignedViaLocation,
CurrencyAdapter as XcmCurrencyAdapter, ChildParachainAsNative, CurrencyAdapter as XcmCurrencyAdapter, ChildParachainAsNative,
SignedAccountId32AsNative, ChildSystemParachainAsSuperuser, LocationInverter, SignedAccountId32AsNative, ChildSystemParachainAsSuperuser, LocationInverter,
IsConcrete, FixedWeightBounds, FixedRateOfConcreteFungible,
}; };
use constants::{time::*, currency::*, fee::*}; use constants::{time::*, currency::*, fee::*};
use frame_support::traits::InstanceFilter; use frame_support::traits::InstanceFilter;
...@@ -616,6 +616,11 @@ type LocalOriginConverter = ( ...@@ -616,6 +616,11 @@ type LocalOriginConverter = (
ChildSystemParachainAsSuperuser<ParaId, Origin>, ChildSystemParachainAsSuperuser<ParaId, Origin>,
); );
parameter_types! {
pub const BaseXcmWeight: Weight = 100_000;
pub const RocFee: (MultiLocation, u128) = (RocLocation::get(), 1 * CENTS);
}
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type Call = Call;
...@@ -625,6 +630,10 @@ impl xcm_executor::Config for XcmConfig { ...@@ -625,6 +630,10 @@ impl xcm_executor::Config for XcmConfig {
type IsReserve = (); type IsReserve = ();
type IsTeleporter = (); type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = ();
type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
type Trader = FixedRateOfConcreteFungible<RocFee>;
type ResponseHandler = ();
} }
impl parachains_session_info::Config for Runtime {} impl parachains_session_info::Config for Runtime {}
......
...@@ -7,6 +7,7 @@ edition = "2018" ...@@ -7,6 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
parity-scale-codec = { version = "2.0.0", default-features = false, features = [ "derive" ] } parity-scale-codec = { version = "2.0.0", default-features = false, features = [ "derive" ] }
derivative = {version = "2.2.0", default-features = false, features = [ "use_core" ] }
[features] [features]
default = ["std"] default = ["std"]
......
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use alloc::vec::Vec;
use parity_scale_codec::{Encode, Decode};
#[derive(Encode, Decode)]
#[codec(encode_bound())]
#[codec(decode_bound())]
pub struct DoubleEncoded<T> {
encoded: Vec<u8>,
#[codec(skip)]
decoded: Option<T>,
}
impl<T> Clone for DoubleEncoded<T> {
fn clone(&self) -> Self { Self { encoded: self.encoded.clone(), decoded: None } }
}
impl<T> Eq for DoubleEncoded<T> {
}
impl<T> PartialEq for DoubleEncoded<T> {
fn eq(&self, other: &Self) -> bool { self.encoded.eq(&other.encoded) }
}
impl<T> core::fmt::Debug for DoubleEncoded<T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { self.encoded.fmt(f) }
}
impl<T> From<Vec<u8>> for DoubleEncoded<T> {
fn from(encoded: Vec<u8>) -> Self {
Self { encoded, decoded: None }
}
}
impl<T> DoubleEncoded<T> {
pub fn into<S>(self) -> DoubleEncoded<S> { DoubleEncoded::from(self) }
pub fn from<S>(e: DoubleEncoded<S>) -> Self {
Self {
encoded: e.encoded,
decoded: None,
}
}
pub fn as_ref(&self) -> Option<&T> {
self.decoded.as_ref()
}
}
impl<T: Decode> DoubleEncoded<T> {
pub fn ensure_decoded(&mut self) -> Result<&T, ()> {
if self.decoded.is_none() {
self.decoded = T::decode(&mut &self.encoded[..]).ok();
}
self.decoded.as_ref().ok_or(())
}
pub fn take_decoded(&mut self) -> Result<T, ()> {
self.decoded.take().or_else(|| T::decode(&mut &self.encoded[..]).ok()).ok_or(())
}
pub fn try_into(mut self) -> Result<T, ()> {
self.ensure_decoded()?;
self.decoded.ok_or(())
}
}
...@@ -24,13 +24,32 @@ ...@@ -24,13 +24,32 @@
extern crate alloc; extern crate alloc;
use parity_scale_codec::{Encode, Decode}; use parity_scale_codec::{Encode, Decode};
use derivative::Derivative;
pub mod v0; pub mod v0;
mod double_encoded;
pub use double_encoded::DoubleEncoded;
/// A single XCM message, together with its version code. /// A single XCM message, together with its version code.
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug)] #[derive(Derivative, Encode, Decode)]
pub enum VersionedXcm { #[derivative(Clone(bound=""), Eq(bound=""), PartialEq(bound=""), Debug(bound=""))]
V0(v0::Xcm), #[codec(encode_bound())]
#[codec(decode_bound())]
pub enum VersionedXcm<Call> {
V0(v0::Xcm<Call>),
}
pub mod opaque {
pub mod v0 {
// Everything from v0
pub use crate::v0::*;
// Then override with the opaque types in v0
pub use crate::v0::opaque::{Xcm, Order};
}
/// The basic VersionedXcm type which just uses the `Vec<u8>` as an encoded call.
pub type VersionedXcm = super::VersionedXcm<()>;
} }
/// A versioned multi-location, a relative location of a cross-consensus system identifier. /// A versioned multi-location, a relative location of a cross-consensus system identifier.
......
...@@ -45,6 +45,10 @@ pub enum Junction { ...@@ -45,6 +45,10 @@ pub enum Junction {
/// An indexed parachain belonging to and operated by the context. /// An indexed parachain belonging to and operated by the context.
/// ///
/// Generally used when the context is a Polkadot Relay-chain. /// Generally used when the context is a Polkadot Relay-chain.
///
/// There is also `Parachain` which can be used in tests to avoid the faffy `{ id: ... }` syntax. Production
/// code should use this.
// TODO: parity-scale-codec#262: Change to be `Parachain(#[codec(compact)] u32)`
Parachain { #[codec(compact)] id: u32 }, Parachain { #[codec(compact)] id: u32 },
/// A 32-byte identifier for an account of a specific network that is respected as a sovereign endpoint within /// A 32-byte identifier for an account of a specific network that is respected as a sovereign endpoint within
/// the context. /// the context.
...@@ -64,7 +68,7 @@ pub enum Junction { ...@@ -64,7 +68,7 @@ pub enum Junction {
/// An instanced, indexed pallet that forms a constituent part of the context. /// An instanced, indexed pallet that forms a constituent part of the context.
/// ///
/// Generally used when the context is a Frame-based chain. /// Generally used when the context is a Frame-based chain.
PalletInstance { id: u8 }, PalletInstance(u8),
/// A non-descript index within the context location. /// A non-descript index within the context location.
/// ///
/// Usage will vary widely owing to its generality. /// Usage will vary widely owing to its generality.
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
//! Version 0 of the Cross-Consensus Message format data structures. //! Version 0 of the Cross-Consensus Message format data structures.
use core::{result, convert::TryFrom}; use core::{result, convert::TryFrom, fmt::Debug};
use alloc::{boxed::Box, vec::Vec}; use derivative::Derivative;
use alloc::vec::Vec;
use parity_scale_codec::{self, Encode, Decode}; use parity_scale_codec::{self, Encode, Decode};
use super::{VersionedXcm, VersionedMultiAsset}; use crate::{VersionedMultiAsset, DoubleEncoded, VersionedXcm};
mod junction; mod junction;
mod multi_asset; mod multi_asset;
...@@ -31,10 +31,10 @@ pub use junction::{Junction, NetworkId}; ...@@ -31,10 +31,10 @@ pub use junction::{Junction, NetworkId};
pub use multi_asset::{MultiAsset, AssetInstance}; pub use multi_asset::{MultiAsset, AssetInstance};
pub use multi_location::MultiLocation; pub use multi_location::MultiLocation;
pub use order::Order; pub use order::Order;
pub use traits::{Error, Result, SendXcm, ExecuteXcm}; pub use traits::{Error, Result, SendXcm, ExecuteXcm, Outcome};
// TODO: Efficient encodings for Vec<MultiAsset>, Vec<Order>, using initial byte values 128+ to encode the number of // TODO: #2841 #XCMENCODE Efficient encodings for Vec<MultiAsset>, Vec<Order>, using initial byte values 128+ to encode
// items in the vector. // the number of items in the vector.
/// Basically just the XCM (more general) version of `ParachainDispatchOrigin`. /// Basically just the XCM (more general) version of `ParachainDispatchOrigin`.
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, Debug)]
...@@ -52,6 +52,13 @@ pub enum OriginKind { ...@@ -52,6 +52,13 @@ pub enum OriginKind {
Superuser, Superuser,
} }
/// Response data to a query.
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug)]
pub enum Response {
/// Some assets.
Assets(Vec<MultiAsset>),
}
/// Cross-Consensus Message: A message from one consensus system to another. /// Cross-Consensus Message: A message from one consensus system to another.
/// ///
/// Consensus systems that may send and receive messages include blockchains and smart contracts. /// Consensus systems that may send and receive messages include blockchains and smart contracts.
...@@ -60,8 +67,11 @@ pub enum OriginKind { ...@@ -60,8 +67,11 @@ pub enum OriginKind {
/// ///
/// This is the inner XCM format and is version-sensitive. Messages are typically passed using the outer /// This is the inner XCM format and is version-sensitive. Messages are typically passed using the outer
/// XCM format, known as `VersionedXcm`. /// XCM format, known as `VersionedXcm`.
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug)] #[derive(Derivative, Encode, Decode)]
pub enum Xcm { #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())]
#[codec(decode_bound())]
pub enum Xcm<Call> {
/// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into `holding`. Execute the /// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into `holding`. Execute the
/// orders (`effects`). /// orders (`effects`).
/// ///
...@@ -71,7 +81,8 @@ pub enum Xcm { ...@@ -71,7 +81,8 @@ pub enum Xcm {
/// Kind: *Instruction*. /// Kind: *Instruction*.
/// ///
/// Errors: /// Errors:
WithdrawAsset { assets: Vec<MultiAsset>, effects: Vec<Order> }, #[codec(index = 0)]
WithdrawAsset { assets: Vec<MultiAsset>, effects: Vec<Order<Call>> },
/// Asset(s) (`assets`) have been received into the ownership of this system on the `origin` system. /// Asset(s) (`assets`) have been received into the ownership of this system on the `origin` system.
/// ///
...@@ -87,7 +98,8 @@ pub enum Xcm { ...@@ -87,7 +98,8 @@ pub enum Xcm {
/// Kind: *Trusted Indication*. /// Kind: *Trusted Indication*.
/// ///
/// Errors: /// Errors:
ReserveAssetDeposit { assets: Vec<MultiAsset>, effects: Vec<Order> }, #[codec(index = 1)]
ReserveAssetDeposit { assets: Vec<MultiAsset>, effects: Vec<Order<Call>> },
/// Asset(s) (`assets`) have been destroyed on the `origin` system and equivalent assets should be /// Asset(s) (`assets`) have been destroyed on the `origin` system and equivalent assets should be
/// created on this system. /// created on this system.
...@@ -104,7 +116,8 @@ pub enum Xcm { ...@@ -104,7 +116,8 @@ pub enum Xcm {
/// Kind: *Trusted Indication*. /// Kind: *Trusted Indication*.
/// ///
/// Errors: /// Errors:
TeleportAsset { assets: Vec<MultiAsset>, effects: Vec<Order> }, #[codec(index = 2)]
TeleportAsset { assets: Vec<MultiAsset>, effects: Vec<Order<Call>> },
/// Indication of the contents of the holding account corresponding to the `QueryHolding` order of `query_id`. /// Indication of the contents of the holding account corresponding to the `QueryHolding` order of `query_id`.
/// ///
...@@ -116,48 +129,56 @@ pub enum Xcm { ...@@ -116,48 +129,56 @@ pub enum Xcm {
/// Kind: *Information*. /// Kind: *Information*.
/// ///
/// Errors: /// Errors:
Balances { #[codec(compact)] query_id: u64, assets: Vec<MultiAsset> }, #[codec(index = 3)]
QueryResponse { #[codec(compact)] query_id: u64, response: Response },
/// Apply the encoded transaction `call`, whose dispatch-origin should be `origin` as expressed by the kind /// Withdraw asset(s) (`assets`) from the ownership of `origin` and place equivalent assets under the
/// of origin `origin_type`. /// ownership of `dest` within this consensus system.
/// ///
/// - `origin_type`: The means of expressing the message origin as a dispatch origin. /// - `assets`: The asset(s) to be withdrawn.
/// - `call`: The encoded transaction to be applied. /// - `dest`: The new owner for the assets.
/// ///
/// Safety: No concerns. /// Safety: No concerns.
/// ///
/// Kind: *Instruction*. /// Kind: *Instruction*.
/// ///
/// Errors: /// Errors:
Transact { origin_type: OriginKind, call: Vec<u8> }, #[codec(index = 4)]
TransferAsset { assets: Vec<MultiAsset>, dest: MultiLocation },
/// Relay an inner message (`inner`) to a locally reachable destination ID `dest`. /// Withdraw asset(s) (`assets`) from the ownership of `origin` and place equivalent assets under the
/// ownership of `dest` within this consensus system.
/// ///
/// The message sent to the destination will be wrapped into a `RelayedFrom` message, with the /// Send an onward XCM message to `dest` of `ReserveAssetDeposit` with the given `effects`.
/// `superorigin` being this location.
///