From b69cd7751dcf0475d2ca3dfa70e46fa48fb606da Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Thu, 9 Jun 2022 14:34:19 +0000
Subject: [PATCH 1/8] CallDispatcher trait
---
runtime/kusama/src/xcm_config.rs | 2 ++
runtime/polkadot/src/xcm_config.rs | 2 ++
runtime/rococo/src/xcm_config.rs | 3 ++-
runtime/westend/src/xcm_config.rs | 3 ++-
xcm/xcm-executor/src/config.rs | 7 ++++++-
xcm/xcm-executor/src/lib.rs | 4 ++--
xcm/xcm-executor/src/traits/conversion.rs | 22 ++++++++++++++++++++++
xcm/xcm-executor/src/traits/mod.rs | 2 +-
8 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs
index e273bc36e638..cf3267f55671 100644
--- a/runtime/kusama/src/xcm_config.rs
+++ b/runtime/kusama/src/xcm_config.rs
@@ -35,6 +35,7 @@ use xcm_builder::{
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WeightInfoBounds,
};
+use xcm_executor::traits::JustDispatch;
parameter_types! {
/// The location of the KSM token, from the context of this chain. Since this token is native to this
@@ -161,6 +162,7 @@ impl xcm_executor::Config for XcmConfig {
// No bridges yet...
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = JustDispatch;
}
parameter_types! {
diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs
index f8f22149ab52..fefd4c567339 100644
--- a/runtime/polkadot/src/xcm_config.rs
+++ b/runtime/polkadot/src/xcm_config.rs
@@ -34,6 +34,7 @@ use xcm_builder::{
IsConcrete, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
TakeWeightCredit, UsingComponents,
};
+use xcm_executor::traits::JustDispatch;
parameter_types! {
/// The location of the DOT token, from the context of this chain. Since this token is native to this
@@ -158,6 +159,7 @@ impl xcm_executor::Config for XcmConfig {
// No bridges yet...
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = JustDispatch;
}
parameter_types! {
diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs
index 8e71ca8daffe..91b80e290c3d 100644
--- a/runtime/rococo/src/xcm_config.rs
+++ b/runtime/rococo/src/xcm_config.rs
@@ -34,7 +34,7 @@ use xcm_builder::{
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents,
};
-use xcm_executor::XcmExecutor;
+use xcm_executor::{traits::JustDispatch, XcmExecutor};
parameter_types! {
pub const TokenLocation: MultiLocation = Here.into_location();
@@ -144,6 +144,7 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = JustDispatch;
}
parameter_types! {
diff --git a/runtime/westend/src/xcm_config.rs b/runtime/westend/src/xcm_config.rs
index ecf1a8be21bb..eb4abb004eb4 100644
--- a/runtime/westend/src/xcm_config.rs
+++ b/runtime/westend/src/xcm_config.rs
@@ -34,7 +34,7 @@ use xcm_builder::{
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WeightInfoBounds,
};
-use xcm_executor::XcmExecutor;
+use xcm_executor::{traits::JustDispatch, XcmExecutor};
parameter_types! {
pub const TokenLocation: MultiLocation = Here.into_location();
@@ -123,6 +123,7 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = JustDispatch;
}
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
diff --git a/xcm/xcm-executor/src/config.rs b/xcm/xcm-executor/src/config.rs
index 1184f77c6712..e5b80ea33968 100644
--- a/xcm/xcm-executor/src/config.rs
+++ b/xcm/xcm-executor/src/config.rs
@@ -15,7 +15,7 @@
// along with Polkadot. If not, see .
use crate::traits::{
- AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, DropAssets, ExportXcm, FeeManager,
+ CallDispatcher, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, DropAssets, ExportXcm, FeeManager,
OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds, WeightTrader,
};
use frame_support::{
@@ -94,4 +94,9 @@ pub trait Config {
/// The origin locations and specific universal junctions to which they are allowed to elevate
/// themselves.
type UniversalAliases: Contains<(MultiLocation, Junction)>;
+
+ /// How calls are dispatched from XCM.
+ /// Allows to modify the origin and/or the call based on the other.
+ /// To simply do `call.dispatch(origin)`, use `JustDispatch`.
+ type CallDispatcher: CallDispatcher;
}
diff --git a/xcm/xcm-executor/src/lib.rs b/xcm/xcm-executor/src/lib.rs
index 9c6843b8b6a2..79de6841235a 100644
--- a/xcm/xcm-executor/src/lib.rs
+++ b/xcm/xcm-executor/src/lib.rs
@@ -30,7 +30,7 @@ use xcm::latest::prelude::*;
pub mod traits;
use traits::{
- validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, DropAssets, Enact,
+ CallDispatcher, validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, DropAssets, Enact,
ExportXcm, FeeManager, FeeReason, OnResponse, ShouldExecute, TransactAsset,
VersionChangeNotifier, WeightBounds, WeightTrader,
};
@@ -512,7 +512,7 @@ impl XcmExecutor {
.map_err(|_| XcmError::BadOrigin)?;
let weight = message_call.get_dispatch_info().weight;
ensure!(weight <= require_weight_at_most, XcmError::MaxWeightInvalid);
- let maybe_actual_weight = match message_call.dispatch(dispatch_origin) {
+ let maybe_actual_weight = match Config::CallDispatcher::dispatch(message_call, dispatch_origin) {
Ok(post_info) => {
self.transact_status = MaybeErrorCode::Success;
post_info.actual_weight
diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs
index ee5c84f2c78b..3413ca7b602b 100644
--- a/xcm/xcm-executor/src/traits/conversion.rs
+++ b/xcm/xcm-executor/src/traits/conversion.rs
@@ -15,6 +15,7 @@
// along with Polkadot. If not, see .
use parity_scale_codec::{Decode, Encode};
+use sp_runtime::{traits::Dispatchable, DispatchErrorWithPostInfo};
use sp_std::{borrow::Borrow, prelude::*, result::Result};
use xcm::latest::prelude::*;
@@ -203,3 +204,24 @@ impl ConvertOrigin for Tuple {
Err(origin)
}
}
+
+/// Defines how a call is dispatched with given origin.
+/// Allows to customize call dispatch, such as adapting the origin based on the call
+/// or modifying the call.
+pub trait CallDispatcher {
+ fn dispatch(
+ call: Call,
+ origin: Call::Origin,
+ ) -> Result>;
+}
+
+/// Just call `call.dispatch(origin)`.
+pub struct JustDispatch;
+impl CallDispatcher for JustDispatch {
+ fn dispatch(
+ call: Call,
+ origin: Call::Origin,
+ ) -> Result> {
+ call.dispatch(origin)
+ }
+}
diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs
index ead19f79eea5..14fb47448a21 100644
--- a/xcm/xcm-executor/src/traits/mod.rs
+++ b/xcm/xcm-executor/src/traits/mod.rs
@@ -17,7 +17,7 @@
//! Various traits used in configuring the executor.
mod conversion;
-pub use conversion::{Convert, ConvertOrigin, Decoded, Encoded, Identity, JustTry};
+pub use conversion::{CallDispatcher, JustDispatch, Convert, ConvertOrigin, Decoded, Encoded, Identity, JustTry};
mod drop_assets;
pub use drop_assets::{ClaimAssets, DropAssets};
mod asset_lock;
From acd1974b7f61a973add4277d5cc7831852198c5b Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Fri, 10 Jun 2022 12:36:02 +0000
Subject: [PATCH 2/8] fmt
---
xcm/xcm-executor/src/config.rs | 5 +++--
xcm/xcm-executor/src/lib.rs | 25 +++++++++++++------------
xcm/xcm-executor/src/traits/mod.rs | 4 +++-
3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/xcm/xcm-executor/src/config.rs b/xcm/xcm-executor/src/config.rs
index e5b80ea33968..66c3c5161717 100644
--- a/xcm/xcm-executor/src/config.rs
+++ b/xcm/xcm-executor/src/config.rs
@@ -15,8 +15,9 @@
// along with Polkadot. If not, see .
use crate::traits::{
- CallDispatcher, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, DropAssets, ExportXcm, FeeManager,
- OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds, WeightTrader,
+ AssetExchange, AssetLock, CallDispatcher, ClaimAssets, ConvertOrigin, DropAssets, ExportXcm,
+ FeeManager, OnResponse, ShouldExecute, TransactAsset, VersionChangeNotifier, WeightBounds,
+ WeightTrader,
};
use frame_support::{
dispatch::{Dispatchable, Parameter},
diff --git a/xcm/xcm-executor/src/lib.rs b/xcm/xcm-executor/src/lib.rs
index 79de6841235a..461ecfab03a2 100644
--- a/xcm/xcm-executor/src/lib.rs
+++ b/xcm/xcm-executor/src/lib.rs
@@ -30,8 +30,8 @@ use xcm::latest::prelude::*;
pub mod traits;
use traits::{
- CallDispatcher, validate_export, AssetExchange, AssetLock, ClaimAssets, ConvertOrigin, DropAssets, Enact,
- ExportXcm, FeeManager, FeeReason, OnResponse, ShouldExecute, TransactAsset,
+ validate_export, AssetExchange, AssetLock, CallDispatcher, ClaimAssets, ConvertOrigin,
+ DropAssets, Enact, ExportXcm, FeeManager, FeeReason, OnResponse, ShouldExecute, TransactAsset,
VersionChangeNotifier, WeightBounds, WeightTrader,
};
@@ -512,16 +512,17 @@ impl XcmExecutor {
.map_err(|_| XcmError::BadOrigin)?;
let weight = message_call.get_dispatch_info().weight;
ensure!(weight <= require_weight_at_most, XcmError::MaxWeightInvalid);
- let maybe_actual_weight = match Config::CallDispatcher::dispatch(message_call, dispatch_origin) {
- Ok(post_info) => {
- self.transact_status = MaybeErrorCode::Success;
- post_info.actual_weight
- },
- Err(error_and_info) => {
- self.transact_status = error_and_info.error.encode().into();
- error_and_info.post_info.actual_weight
- },
- };
+ let maybe_actual_weight =
+ match Config::CallDispatcher::dispatch(message_call, dispatch_origin) {
+ Ok(post_info) => {
+ self.transact_status = MaybeErrorCode::Success;
+ post_info.actual_weight
+ },
+ Err(error_and_info) => {
+ self.transact_status = error_and_info.error.encode().into();
+ error_and_info.post_info.actual_weight
+ },
+ };
let actual_weight = maybe_actual_weight.unwrap_or(weight);
let surplus = weight.saturating_sub(actual_weight);
// We assume that the `Config::Weigher` will counts the `require_weight_at_most`
diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs
index 14fb47448a21..ef6b7fc8d292 100644
--- a/xcm/xcm-executor/src/traits/mod.rs
+++ b/xcm/xcm-executor/src/traits/mod.rs
@@ -17,7 +17,9 @@
//! Various traits used in configuring the executor.
mod conversion;
-pub use conversion::{CallDispatcher, JustDispatch, Convert, ConvertOrigin, Decoded, Encoded, Identity, JustTry};
+pub use conversion::{
+ CallDispatcher, Convert, ConvertOrigin, Decoded, Encoded, Identity, JustDispatch, JustTry,
+};
mod drop_assets;
pub use drop_assets::{ClaimAssets, DropAssets};
mod asset_lock;
From d0475e9707a547b98e60b4a1466bf0d56ec477d8 Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Fri, 10 Jun 2022 12:49:45 +0000
Subject: [PATCH 3/8] unused import
---
xcm/xcm-executor/src/lib.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xcm/xcm-executor/src/lib.rs b/xcm/xcm-executor/src/lib.rs
index 461ecfab03a2..e0f9d5a85347 100644
--- a/xcm/xcm-executor/src/lib.rs
+++ b/xcm/xcm-executor/src/lib.rs
@@ -17,7 +17,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::{
- dispatch::{Dispatchable, Weight},
+ dispatch::Weight,
ensure,
traits::{Contains, ContainsPair, Get, PalletsInfoAccess},
weights::GetDispatchInfo,
From 4b21ed4ec4fbf3e07bdb1e8a1b49e31cd6685156 Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Fri, 10 Jun 2022 13:08:44 +0000
Subject: [PATCH 4/8] fix test-runtime
---
runtime/test-runtime/src/xcm_config.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/runtime/test-runtime/src/xcm_config.rs b/runtime/test-runtime/src/xcm_config.rs
index 284a1d3dc21b..4ed91543b561 100644
--- a/runtime/test-runtime/src/xcm_config.rs
+++ b/runtime/test-runtime/src/xcm_config.rs
@@ -22,7 +22,7 @@ use frame_support::{
use xcm::latest::prelude::*;
use xcm_builder::{AllowUnpaidExecutionFrom, FixedWeightBounds, SignedToAccountId32};
use xcm_executor::{
- traits::{TransactAsset, WeightTrader},
+ traits::{JustDispatch, TransactAsset, WeightTrader},
Assets,
};
@@ -103,4 +103,5 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = JustDispatch;
}
From ca22fea337db2ed51f1e9912888a6e2eab7c463a Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Mon, 13 Jun 2022 09:27:58 +0000
Subject: [PATCH 5/8] remove JustDispatch type
---
runtime/kusama/src/xcm_config.rs | 3 +--
runtime/polkadot/src/xcm_config.rs | 3 +--
runtime/rococo/src/xcm_config.rs | 4 ++--
runtime/test-runtime/src/xcm_config.rs | 4 ++--
runtime/westend/src/xcm_config.rs | 4 ++--
xcm/xcm-executor/src/config.rs | 7 ++++---
xcm/xcm-executor/src/traits/conversion.rs | 6 +++---
xcm/xcm-executor/src/traits/mod.rs | 4 +---
8 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs
index cf3267f55671..fca3d5390b2d 100644
--- a/runtime/kusama/src/xcm_config.rs
+++ b/runtime/kusama/src/xcm_config.rs
@@ -35,7 +35,6 @@ use xcm_builder::{
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WeightInfoBounds,
};
-use xcm_executor::traits::JustDispatch;
parameter_types! {
/// The location of the KSM token, from the context of this chain. Since this token is native to this
@@ -162,7 +161,7 @@ impl xcm_executor::Config for XcmConfig {
// No bridges yet...
type MessageExporter = ();
type UniversalAliases = Nothing;
- type CallDispatcher = JustDispatch;
+ type CallDispatcher = Call;
}
parameter_types! {
diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs
index fefd4c567339..0fa2963d7bc6 100644
--- a/runtime/polkadot/src/xcm_config.rs
+++ b/runtime/polkadot/src/xcm_config.rs
@@ -34,7 +34,6 @@ use xcm_builder::{
IsConcrete, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
TakeWeightCredit, UsingComponents,
};
-use xcm_executor::traits::JustDispatch;
parameter_types! {
/// The location of the DOT token, from the context of this chain. Since this token is native to this
@@ -159,7 +158,7 @@ impl xcm_executor::Config for XcmConfig {
// No bridges yet...
type MessageExporter = ();
type UniversalAliases = Nothing;
- type CallDispatcher = JustDispatch;
+ type CallDispatcher = Call;
}
parameter_types! {
diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs
index 91b80e290c3d..c2625cc78e80 100644
--- a/runtime/rococo/src/xcm_config.rs
+++ b/runtime/rococo/src/xcm_config.rs
@@ -34,7 +34,7 @@ use xcm_builder::{
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents,
};
-use xcm_executor::{traits::JustDispatch, XcmExecutor};
+use xcm_executor::XcmExecutor;
parameter_types! {
pub const TokenLocation: MultiLocation = Here.into_location();
@@ -144,7 +144,7 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
- type CallDispatcher = JustDispatch;
+ type CallDispatcher = Call;
}
parameter_types! {
diff --git a/runtime/test-runtime/src/xcm_config.rs b/runtime/test-runtime/src/xcm_config.rs
index 4ed91543b561..254c7c27e86b 100644
--- a/runtime/test-runtime/src/xcm_config.rs
+++ b/runtime/test-runtime/src/xcm_config.rs
@@ -22,7 +22,7 @@ use frame_support::{
use xcm::latest::prelude::*;
use xcm_builder::{AllowUnpaidExecutionFrom, FixedWeightBounds, SignedToAccountId32};
use xcm_executor::{
- traits::{JustDispatch, TransactAsset, WeightTrader},
+ traits::{TransactAsset, WeightTrader},
Assets,
};
@@ -103,5 +103,5 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
- type CallDispatcher = JustDispatch;
+ type CallDispatcher = Call;
}
diff --git a/runtime/westend/src/xcm_config.rs b/runtime/westend/src/xcm_config.rs
index eb4abb004eb4..4ea6c7e0e58d 100644
--- a/runtime/westend/src/xcm_config.rs
+++ b/runtime/westend/src/xcm_config.rs
@@ -34,7 +34,7 @@ use xcm_builder::{
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WeightInfoBounds,
};
-use xcm_executor::{traits::JustDispatch, XcmExecutor};
+use xcm_executor::XcmExecutor;
parameter_types! {
pub const TokenLocation: MultiLocation = Here.into_location();
@@ -123,7 +123,7 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
- type CallDispatcher = JustDispatch;
+ type CallDispatcher = Call;
}
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
diff --git a/xcm/xcm-executor/src/config.rs b/xcm/xcm-executor/src/config.rs
index 66c3c5161717..165a98875061 100644
--- a/xcm/xcm-executor/src/config.rs
+++ b/xcm/xcm-executor/src/config.rs
@@ -96,8 +96,9 @@ pub trait Config {
/// themselves.
type UniversalAliases: Contains<(MultiLocation, Junction)>;
- /// How calls are dispatched from XCM.
- /// Allows to modify the origin and/or the call based on the other.
- /// To simply do `call.dispatch(origin)`, use `JustDispatch`.
+ /// The call dispatcher used by XCM.
+ ///
+ /// XCM will use this to dispatch any calls. When no special call dispatcher is required,
+ /// this can be set to the same type as `Self::Call`.
type CallDispatcher: CallDispatcher;
}
diff --git a/xcm/xcm-executor/src/traits/conversion.rs b/xcm/xcm-executor/src/traits/conversion.rs
index 3413ca7b602b..512cf3c05093 100644
--- a/xcm/xcm-executor/src/traits/conversion.rs
+++ b/xcm/xcm-executor/src/traits/conversion.rs
@@ -215,9 +215,9 @@ pub trait CallDispatcher {
) -> Result>;
}
-/// Just call `call.dispatch(origin)`.
-pub struct JustDispatch;
-impl CallDispatcher for JustDispatch {
+// We implement it for every calls so they can dispatch themselves
+// (without any change).
+impl CallDispatcher for Call {
fn dispatch(
call: Call,
origin: Call::Origin,
diff --git a/xcm/xcm-executor/src/traits/mod.rs b/xcm/xcm-executor/src/traits/mod.rs
index ef6b7fc8d292..989c9d4e0006 100644
--- a/xcm/xcm-executor/src/traits/mod.rs
+++ b/xcm/xcm-executor/src/traits/mod.rs
@@ -17,9 +17,7 @@
//! Various traits used in configuring the executor.
mod conversion;
-pub use conversion::{
- CallDispatcher, Convert, ConvertOrigin, Decoded, Encoded, Identity, JustDispatch, JustTry,
-};
+pub use conversion::{CallDispatcher, Convert, ConvertOrigin, Decoded, Encoded, Identity, JustTry};
mod drop_assets;
pub use drop_assets::{ClaimAssets, DropAssets};
mod asset_lock;
From b036bdd2e2472d82248275d13e4ed12d0a74defa Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Mon, 13 Jun 2022 15:53:24 +0000
Subject: [PATCH 6/8] fix typo in test-runtime
---
runtime/test-runtime/src/xcm_config.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runtime/test-runtime/src/xcm_config.rs b/runtime/test-runtime/src/xcm_config.rs
index 254c7c27e86b..001f6b81e17e 100644
--- a/runtime/test-runtime/src/xcm_config.rs
+++ b/runtime/test-runtime/src/xcm_config.rs
@@ -103,5 +103,5 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
- type CallDispatcher = Call;
+ type CallDispatcher = super::Call;
}
From 15f67d7398b0da7c4fb9a3b84a49aeed71c426f0 Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Fri, 17 Jun 2022 08:04:32 +0000
Subject: [PATCH 7/8] missing CallDispatcher
---
xcm/xcm-builder/src/tests/mock.rs | 1 +
xcm/xcm-simulator/example/src/parachain.rs | 1 +
xcm/xcm-simulator/example/src/relay_chain.rs | 1 +
xcm/xcm-simulator/fuzzer/src/parachain.rs | 1 +
xcm/xcm-simulator/fuzzer/src/relay_chain.rs | 1 +
5 files changed, 5 insertions(+)
diff --git a/xcm/xcm-builder/src/tests/mock.rs b/xcm/xcm-builder/src/tests/mock.rs
index dc5b427e9674..1b8aeb2f679e 100644
--- a/xcm/xcm-builder/src/tests/mock.rs
+++ b/xcm/xcm-builder/src/tests/mock.rs
@@ -608,6 +608,7 @@ impl Config for TestConfig {
type FeeManager = TestFeeManager;
type UniversalAliases = TestUniversalAliases;
type MessageExporter = TestMessageExporter;
+ type CallDispatcher = TestCall;
}
pub fn fungible_multi_asset(location: MultiLocation, amount: u128) -> MultiAsset {
diff --git a/xcm/xcm-simulator/example/src/parachain.rs b/xcm/xcm-simulator/example/src/parachain.rs
index 77dfa962bf37..5a4127eda074 100644
--- a/xcm/xcm-simulator/example/src/parachain.rs
+++ b/xcm/xcm-simulator/example/src/parachain.rs
@@ -236,6 +236,7 @@ impl Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = Call;
}
#[frame_support::pallet]
diff --git a/xcm/xcm-simulator/example/src/relay_chain.rs b/xcm/xcm-simulator/example/src/relay_chain.rs
index b7a7a13f0bf6..da9ff4384ba2 100644
--- a/xcm/xcm-simulator/example/src/relay_chain.rs
+++ b/xcm/xcm-simulator/example/src/relay_chain.rs
@@ -180,6 +180,7 @@ impl Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = Call;
}
pub type LocalOriginToLocation = SignedToAccountId32;
diff --git a/xcm/xcm-simulator/fuzzer/src/parachain.rs b/xcm/xcm-simulator/fuzzer/src/parachain.rs
index 11eacc7f5963..67a941d45925 100644
--- a/xcm/xcm-simulator/fuzzer/src/parachain.rs
+++ b/xcm/xcm-simulator/fuzzer/src/parachain.rs
@@ -155,6 +155,7 @@ impl Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = Call;
}
#[frame_support::pallet]
diff --git a/xcm/xcm-simulator/fuzzer/src/relay_chain.rs b/xcm/xcm-simulator/fuzzer/src/relay_chain.rs
index 4a0267214a8a..e6c10533e8e2 100644
--- a/xcm/xcm-simulator/fuzzer/src/relay_chain.rs
+++ b/xcm/xcm-simulator/fuzzer/src/relay_chain.rs
@@ -147,6 +147,7 @@ impl Config for XcmConfig {
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = Call;
}
pub type LocalOriginToLocation = SignedToAccountId32;
From be9a7147a18e3464b373d9351092309a624fc6cb Mon Sep 17 00:00:00 2001
From: nanocryk <6422796+nanocryk@users.noreply.github.com>
Date: Fri, 17 Jun 2022 08:24:58 +0000
Subject: [PATCH 8/8] more missing CallDispatcher
---
bridges/bin/rialto-parachain/runtime/src/lib.rs | 1 +
xcm/pallet-xcm-benchmarks/src/fungible/mock.rs | 1 +
xcm/pallet-xcm-benchmarks/src/generic/mock.rs | 1 +
xcm/pallet-xcm/src/mock.rs | 1 +
xcm/xcm-builder/tests/mock/mod.rs | 1 +
5 files changed, 5 insertions(+)
diff --git a/bridges/bin/rialto-parachain/runtime/src/lib.rs b/bridges/bin/rialto-parachain/runtime/src/lib.rs
index 4e4c7d3cf212..218387490402 100644
--- a/bridges/bin/rialto-parachain/runtime/src/lib.rs
+++ b/bridges/bin/rialto-parachain/runtime/src/lib.rs
@@ -384,6 +384,7 @@ impl Config for XcmConfig {
type AssetExchanger = ();
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
+ type CallDispatcher = Call;
}
/// No local origins on this chain are allowed to dispatch XCM sends/executions.
diff --git a/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs b/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs
index 8a657c5163bf..1e7b65bf2a4f 100644
--- a/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs
+++ b/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs
@@ -153,6 +153,7 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = Call;
}
impl crate::Config for Test {
diff --git a/xcm/pallet-xcm-benchmarks/src/generic/mock.rs b/xcm/pallet-xcm-benchmarks/src/generic/mock.rs
index 26b69fc527aa..bb798cf94890 100644
--- a/xcm/pallet-xcm-benchmarks/src/generic/mock.rs
+++ b/xcm/pallet-xcm-benchmarks/src/generic/mock.rs
@@ -129,6 +129,7 @@ impl xcm_executor::Config for XcmConfig {
// No bridges yet...
type MessageExporter = ();
type UniversalAliases = TestUniversalAliases;
+ type CallDispatcher = Call;
}
impl crate::Config for Test {
diff --git a/xcm/pallet-xcm/src/mock.rs b/xcm/pallet-xcm/src/mock.rs
index 2a6018ac35f1..5ca57c1d3e98 100644
--- a/xcm/pallet-xcm/src/mock.rs
+++ b/xcm/pallet-xcm/src/mock.rs
@@ -300,6 +300,7 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = Call;
}
pub type LocalOriginToLocation = SignedToAccountId32;
diff --git a/xcm/xcm-builder/tests/mock/mod.rs b/xcm/xcm-builder/tests/mock/mod.rs
index b3e078b50f49..9da95f42b85a 100644
--- a/xcm/xcm-builder/tests/mock/mod.rs
+++ b/xcm/xcm-builder/tests/mock/mod.rs
@@ -195,6 +195,7 @@ impl xcm_executor::Config for XcmConfig {
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
+ type CallDispatcher = Call;
}
pub type LocalOriginToLocation = SignedToAccountId32;