Skip to content

Commit a7414f5

Browse files
ozgunozerkfranciscoaguirrebkonturacatangiu
authored andcommitted
relax XcmFeeToAccount trait bound on AccountId (paritytech#4959)
Fixes paritytech#4960 Configuring `FeeManager` enforces the boundary `Into<[u8; 32]>` for the `AccountId` type. Here is how it works currently: Configuration: ```rust type FeeManager = XcmFeeManagerFromComponents< IsChildSystemParachain<primitives::Id>, XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>, >; ``` `XcmToFeeAccount` struct: ```rust /// A `HandleFee` implementation that simply deposits the fees into a specific on-chain /// `ReceiverAccount`. /// /// It reuses the `AssetTransactor` configured on the XCM executor to deposit fee assets. If /// the `AssetTransactor` returns an error while calling `deposit_asset`, then a warning will be /// logged and the fee burned. pub struct XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount>( PhantomData<(AssetTransactor, AccountId, ReceiverAccount)>, ); impl< AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 32]>, ReceiverAccount: Get<AccountId>, > HandleFee for XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount> { fn handle_fee(fee: Assets, context: Option<&XcmContext>, _reason: FeeReason) -> Assets { deposit_or_burn_fee::<AssetTransactor, _>(fee, context, ReceiverAccount::get()); Assets::new() } } ``` `deposit_or_burn_fee()` function: ```rust /// Try to deposit the given fee in the specified account. /// Burns the fee in case of a failure. pub fn deposit_or_burn_fee<AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 32]>>( fee: Assets, context: Option<&XcmContext>, receiver: AccountId, ) { let dest = AccountId32 { network: None, id: receiver.into() }.into(); for asset in fee.into_inner() { if let Err(e) = AssetTransactor::deposit_asset(&asset, &dest, context) { log::trace!( target: "xcm::fees", "`AssetTransactor::deposit_asset` returned error: {:?}. Burning fee: {:?}. \ They might be burned.", e, asset, ); } } } ``` --- In order to use **another** `AccountId` type (for example, 20 byte addresses for compatibility with Ethereum or Bitcoin), one has to duplicate the code as the following (roughly changing every `32` to `20`): ```rust /// A `HandleFee` implementation that simply deposits the fees into a specific on-chain /// `ReceiverAccount`. /// /// It reuses the `AssetTransactor` configured on the XCM executor to deposit fee assets. If /// the `AssetTransactor` returns an error while calling `deposit_asset`, then a warning will be /// logged and the fee burned. pub struct XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount>( PhantomData<(AssetTransactor, AccountId, ReceiverAccount)>, ); impl< AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 20]>, ReceiverAccount: Get<AccountId>, > HandleFee for XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount> { fn handle_fee(fee: XcmAssets, context: Option<&XcmContext>, _reason: FeeReason) -> XcmAssets { deposit_or_burn_fee::<AssetTransactor, _>(fee, context, ReceiverAccount::get()); XcmAssets::new() } } pub fn deposit_or_burn_fee<AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 20]>>( fee: XcmAssets, context: Option<&XcmContext>, receiver: AccountId, ) { let dest = AccountKey20 { network: None, key: receiver.into() }.into(); for asset in fee.into_inner() { if let Err(e) = AssetTransactor::deposit_asset(&asset, &dest, context) { log::trace!( target: "xcm::fees", "`AssetTransactor::deposit_asset` returned error: {:?}. Burning fee: {:?}. \ They might be burned.", e, asset, ); } } } ``` --- This results in code duplication, which can be avoided simply by relaxing the trait enforced by `XcmFeeToAccount`. In this PR, I propose to introduce a new trait called `IntoLocation` to be able to express both `Into<[u8; 32]>` and `Into<[u8; 20]>` should be accepted (and every other `AccountId` type as long as they implement this trait). Currently, `deposit_or_burn_fee()` function converts the `receiver: AccountId` to a location. I think converting an account to `Location` should not be the responsibility of `deposit_or_burn_fee()` function. This trait also decouples the conversion of `AccountId` to `Location`, from `deposit_or_burn_fee()` function. And exposes `IntoLocation` trait. Thus, allowing everyone to come up with their `AccountId` type and make it compatible for configuring `FeeManager`. --- Note 1: if there is a better file/location to put `IntoLocation`, I'm all ears Note 2: making `deposit_or_burn_fee` or `XcmToFeeAccount` generic was not possible from what I understood, due to Rust currently do not support a way to express the generic should implement either `trait A` or `trait B` (since the compiler cannot guarantee they won't overlap). In this case, they are `Into<[u8; 32]>` and `Into<[u8; 20]>`. See [this](rust-lang/rust#20400) and [this](rust-lang/rfcs#1672 (comment)). Note 3: I should also submit a PR to `frontier` that implements `IntoLocation` for `AccountId20` if this PR gets accepted. ### Summary this new trait: - decouples the conversion of `AccountId` to `Location`, from `deposit_or_burn_fee()` function - makes `XcmFeeToAccount` accept every possible `AccountId` type as long as they they implement `IntoLocation` - backwards compatible - keeps the API simple and clean while making it less restrictive @franciscoaguirre and @gupnik are already aware of the issue, so tagging them here for visibility. --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: Adrian Catangiu <adrian@parity.io> Co-authored-by: command-bot <>
1 parent 13dd252 commit a7414f5

File tree

20 files changed

+172
-88
lines changed

20 files changed

+172
-88
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ use xcm_builder::{
5555
EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter,
5656
GlobalConsensusParachainConvertsFor, HashedDescription, IsConcrete, LocalMint,
5757
NetworkExportTableItem, NoChecking, NonFungiblesAdapter, ParentAsSuperuser, ParentIsPreset,
58-
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
58+
RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
5959
SignedAccountId32AsNative, SignedToAccountId32, SovereignPaidRemoteExporter,
6060
SovereignSignedViaLocation, StartsWith, StartsWithExplicitGlobalConsensus, TakeWeightCredit,
6161
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
62-
XcmFeeManagerFromComponents, XcmFeeToAccount,
62+
XcmFeeManagerFromComponents,
6363
};
6464
use xcm_executor::XcmExecutor;
6565

@@ -413,7 +413,7 @@ impl xcm_executor::Config for XcmConfig {
413413
type AssetExchanger = ();
414414
type FeeManager = XcmFeeManagerFromComponents<
415415
WaivedLocations,
416-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
416+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
417417
>;
418418
type MessageExporter = ();
419419
type UniversalAliases =

cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ use xcm_builder::{
5151
EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter,
5252
GlobalConsensusParachainConvertsFor, HashedDescription, IsConcrete, LocalMint,
5353
NetworkExportTableItem, NoChecking, NonFungiblesAdapter, ParentAsSuperuser, ParentIsPreset,
54-
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
54+
RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
5555
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, StartsWith,
5656
StartsWithExplicitGlobalConsensus, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
5757
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
58-
XcmFeeToAccount,
5958
};
6059
use xcm_executor::XcmExecutor;
6160

@@ -429,7 +428,7 @@ impl xcm_executor::Config for XcmConfig {
429428
type AssetExchanger = ();
430429
type FeeManager = XcmFeeManagerFromComponents<
431430
WaivedLocations,
432-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
431+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
433432
>;
434433
type MessageExporter = ();
435434
type UniversalAliases = (bridging::to_rococo::UniversalAliases,);

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ use xcm_builder::{
4949
AllowHrmpNotificationsFromRelayChain, AllowKnownQueryResponses, AllowSubscriptionsFrom,
5050
AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin,
5151
FrameTransactionalProcessor, FungibleAdapter, HandleFee, IsConcrete, ParentAsSuperuser,
52-
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
53-
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
54-
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
55-
XcmFeeToAccount,
52+
ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative,
53+
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
54+
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
55+
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
5656
};
5757
use xcm_executor::{
5858
traits::{FeeManager, FeeReason, FeeReason::Export, TransactAsset},
@@ -223,7 +223,7 @@ impl xcm_executor::Config for XcmConfig {
223223
Self::AssetTransactor,
224224
crate::EthereumOutboundQueue,
225225
>,
226-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
226+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
227227
),
228228
>;
229229
type MessageExporter = (
@@ -354,24 +354,27 @@ impl<
354354
match asset.fun {
355355
Fungible(total_fee) => {
356356
let source_fee = total_fee / 2;
357-
deposit_or_burn_fee::<AssetTransactor, _>(
357+
deposit_or_burn_fee::<AssetTransactor>(
358358
Asset { id: asset.id.clone(), fun: Fungible(source_fee) }.into(),
359359
maybe_context,
360-
source_para_account.clone(),
360+
AccountId32 { network: None, id: source_para_account.clone().into() }
361+
.into(),
361362
);
362363

363364
let dest_fee = total_fee - source_fee;
364-
deposit_or_burn_fee::<AssetTransactor, _>(
365+
deposit_or_burn_fee::<AssetTransactor>(
365366
Asset { id: asset.id, fun: Fungible(dest_fee) }.into(),
366367
maybe_context,
367-
dest_para_account.clone(),
368+
AccountId32 { network: None, id: dest_para_account.clone().into() }
369+
.into(),
368370
);
369371
},
370372
NonFungible(_) => {
371-
deposit_or_burn_fee::<AssetTransactor, _>(
373+
deposit_or_burn_fee::<AssetTransactor>(
372374
asset.into(),
373375
maybe_context,
374-
source_para_account.clone(),
376+
AccountId32 { network: None, id: source_para_account.clone().into() }
377+
.into(),
375378
);
376379
},
377380
}

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/xcm_config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ use xcm_builder::{
4242
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
4343
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor,
4444
FungibleAdapter, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
45-
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
46-
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
47-
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
48-
XcmFeeManagerFromComponents, XcmFeeToAccount,
45+
SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
46+
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
47+
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
48+
XcmFeeManagerFromComponents,
4949
};
5050
use xcm_executor::XcmExecutor;
5151

@@ -195,7 +195,7 @@ impl xcm_executor::Config for XcmConfig {
195195
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
196196
type FeeManager = XcmFeeManagerFromComponents<
197197
WaivedLocations,
198-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
198+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
199199
>;
200200
type MessageExporter = (crate::bridge_to_rococo_config::ToBridgeHubRococoHaulBlobExporter,);
201201
type UniversalAliases = Nothing;

cumulus/parachains/runtimes/collectives/collectives-westend/src/xcm_config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ use xcm_builder::{
4040
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds,
4141
FrameTransactionalProcessor, FungibleAdapter, IsConcrete, LocatableAssetId,
4242
OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
43-
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
44-
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
45-
UsingComponents, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
46-
XcmFeeToAccount,
43+
SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
44+
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
45+
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
46+
XcmFeeManagerFromComponents,
4747
};
4848
use xcm_executor::XcmExecutor;
4949

@@ -209,7 +209,7 @@ impl xcm_executor::Config for XcmConfig {
209209
type AssetExchanger = ();
210210
type FeeManager = XcmFeeManagerFromComponents<
211211
WaivedLocations,
212-
XcmFeeToAccount<Self::AssetTransactor, AccountId, WestendTreasuryAccount>,
212+
SendXcmFeeToAccount<Self::AssetTransactor, WestendTreasuryAccount>,
213213
>;
214214
type MessageExporter = ();
215215
type UniversalAliases = Nothing;

cumulus/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ use xcm_builder::{
4242
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
4343
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds,
4444
FrameTransactionalProcessor, FungibleAdapter, IsConcrete, NativeAsset, ParentAsSuperuser,
45-
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
46-
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
47-
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
48-
XcmFeeManagerFromComponents, XcmFeeToAccount,
45+
ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative,
46+
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
47+
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
48+
WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
4949
};
5050
use xcm_executor::XcmExecutor;
5151

@@ -191,7 +191,7 @@ impl xcm_executor::Config for XcmConfig {
191191
type AssetExchanger = ();
192192
type FeeManager = XcmFeeManagerFromComponents<
193193
WaivedLocations,
194-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
194+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
195195
>;
196196
type MessageExporter = ();
197197
type UniversalAliases = Nothing;

cumulus/parachains/runtimes/coretime/coretime-rococo/src/xcm_config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ use xcm_builder::{
4343
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
4444
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor,
4545
FungibleAdapter, IsConcrete, NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset,
46-
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
46+
RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
4747
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
4848
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
49-
XcmFeeManagerFromComponents, XcmFeeToAccount,
49+
XcmFeeManagerFromComponents,
5050
};
5151
use xcm_executor::XcmExecutor;
5252

@@ -213,7 +213,7 @@ impl xcm_executor::Config for XcmConfig {
213213
type AssetExchanger = ();
214214
type FeeManager = XcmFeeManagerFromComponents<
215215
WaivedLocations,
216-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
216+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
217217
>;
218218
type MessageExporter = ();
219219
type UniversalAliases = Nothing;

cumulus/parachains/runtimes/coretime/coretime-westend/src/xcm_config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ use xcm_builder::{
4343
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
4444
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor,
4545
FungibleAdapter, IsConcrete, NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset,
46-
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
46+
RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
4747
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
4848
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
49-
XcmFeeManagerFromComponents, XcmFeeToAccount,
49+
XcmFeeManagerFromComponents,
5050
};
5151
use xcm_executor::XcmExecutor;
5252

@@ -221,7 +221,7 @@ impl xcm_executor::Config for XcmConfig {
221221
type AssetExchanger = ();
222222
type FeeManager = XcmFeeManagerFromComponents<
223223
WaivedLocations,
224-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
224+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
225225
>;
226226
type MessageExporter = ();
227227
type UniversalAliases = Nothing;

cumulus/parachains/runtimes/people/people-rococo/src/xcm_config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ use xcm_builder::{
4040
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
4141
DenyReserveTransferToRelayChain, DenyThenTry, DescribeTerminus, EnsureXcmOrigin,
4242
FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete, ParentAsSuperuser,
43-
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
44-
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
45-
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
46-
XcmFeeManagerFromComponents, XcmFeeToAccount,
43+
ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative,
44+
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
45+
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
46+
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
4747
};
4848
use xcm_executor::XcmExecutor;
4949

@@ -219,7 +219,7 @@ impl xcm_executor::Config for XcmConfig {
219219
type AssetExchanger = ();
220220
type FeeManager = XcmFeeManagerFromComponents<
221221
WaivedLocations,
222-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
222+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
223223
>;
224224
type MessageExporter = ();
225225
type UniversalAliases = Nothing;

cumulus/parachains/runtimes/people/people-westend/src/xcm_config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ use xcm_builder::{
4040
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
4141
DenyReserveTransferToRelayChain, DenyThenTry, DescribeTerminus, EnsureXcmOrigin,
4242
FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete, ParentAsSuperuser,
43-
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
44-
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
45-
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
46-
XcmFeeManagerFromComponents, XcmFeeToAccount,
43+
ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative,
44+
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
45+
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
46+
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
4747
};
4848
use xcm_executor::XcmExecutor;
4949

@@ -227,7 +227,7 @@ impl xcm_executor::Config for XcmConfig {
227227
type AssetExchanger = ();
228228
type FeeManager = XcmFeeManagerFromComponents<
229229
WaivedLocations,
230-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
230+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
231231
>;
232232
type MessageExporter = ();
233233
type UniversalAliases = Nothing;

cumulus/parachains/runtimes/testing/penpal/src/xcm_config.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ use xcm_builder::{
4747
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex,
4848
ConvertedConcreteId, EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor,
4949
FungibleAdapter, FungiblesAdapter, IsConcrete, LocalMint, NativeAsset, NoChecking,
50-
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
51-
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
52-
SovereignSignedViaLocation, StartsWith, TakeWeightCredit, TrailingSetTopicAsId,
53-
UsingComponents, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
54-
XcmFeeToAccount,
50+
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount,
51+
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
52+
SignedToAccountId32, SovereignSignedViaLocation, StartsWith, TakeWeightCredit,
53+
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
54+
XcmFeeManagerFromComponents,
5555
};
5656
use xcm_executor::{traits::JustTry, XcmExecutor};
5757

@@ -351,7 +351,7 @@ impl xcm_executor::Config for XcmConfig {
351351
type AssetExchanger = ();
352352
type FeeManager = XcmFeeManagerFromComponents<
353353
(),
354-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
354+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
355355
>;
356356
type MessageExporter = ();
357357
type UniversalAliases = Nothing;

polkadot/runtime/rococo/src/xcm_config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ use xcm_builder::{
4141
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
4242
ChildParachainConvertsVia, DescribeAllTerminal, DescribeFamily, FixedWeightBounds,
4343
FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsChildSystemParachain,
44-
IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative,
45-
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
46-
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
47-
XcmFeeManagerFromComponents, XcmFeeToAccount,
44+
IsConcrete, MintLocation, OriginToPluralityVoice, SendXcmFeeToAccount,
45+
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
46+
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
47+
XcmFeeManagerFromComponents,
4848
};
4949
use xcm_executor::XcmExecutor;
5050

@@ -213,7 +213,7 @@ impl xcm_executor::Config for XcmConfig {
213213
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
214214
type FeeManager = XcmFeeManagerFromComponents<
215215
WaivedLocations,
216-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
216+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
217217
>;
218218
type MessageExporter = ();
219219
type UniversalAliases = Nothing;

polkadot/runtime/westend/src/xcm_config.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ use xcm_builder::{
4242
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
4343
ChildParachainConvertsVia, DescribeAllTerminal, DescribeFamily, FrameTransactionalProcessor,
4444
FungibleAdapter, HashedDescription, IsChildSystemParachain, IsConcrete, MintLocation,
45-
OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
45+
OriginToPluralityVoice, SendXcmFeeToAccount, SignedAccountId32AsNative, SignedToAccountId32,
4646
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
4747
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
48-
XcmFeeToAccount,
4948
};
5049
use xcm_executor::XcmExecutor;
5150

@@ -211,7 +210,7 @@ impl xcm_executor::Config for XcmConfig {
211210
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
212211
type FeeManager = XcmFeeManagerFromComponents<
213212
WaivedLocations,
214-
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
213+
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
215214
>;
216215
type MessageExporter = ();
217216
type UniversalAliases = Nothing;

polkadot/xcm/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ impl-trait-for-tuples = { workspace = true }
1717
log = { workspace = true }
1818
codec = { features = ["derive", "max-encoded-len"], workspace = true }
1919
scale-info = { features = ["derive", "serde"], workspace = true }
20+
sp-runtime = { workspace = true }
2021
sp-weights = { features = ["serde"], workspace = true }
2122
serde = { features = ["alloc", "derive", "rc"], workspace = true }
2223
schemars = { default-features = true, optional = true, workspace = true }
@@ -38,6 +39,11 @@ std = [
3839
"log/std",
3940
"scale-info/std",
4041
"serde/std",
42+
"sp-runtime/std",
4143
"sp-weights/std",
4244
]
43-
json-schema = ["bounded-collections/json-schema", "dep:schemars", "sp-weights/json-schema"]
45+
json-schema = [
46+
"bounded-collections/json-schema",
47+
"dep:schemars",
48+
"sp-weights/json-schema",
49+
]

polkadot/xcm/pallet-xcm/src/mock.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ use xcm_builder::{
3535
AllowTopLevelPaidExecutionFrom, Case, ChildParachainAsNative, ChildParachainConvertsVia,
3636
ChildSystemParachainAsSuperuser, DescribeAllTerminal, EnsureDecodableXcm, FixedRateOfFungible,
3737
FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter,
38-
HashedDescription, IsConcrete, MatchedConvertedConcreteId, NoChecking,
38+
HashedDescription, IsConcrete, MatchedConvertedConcreteId, NoChecking, SendXcmFeeToAccount,
3939
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
40-
XcmFeeManagerFromComponents, XcmFeeToAccount,
40+
XcmFeeManagerFromComponents,
4141
};
4242
use xcm_executor::{
4343
traits::{Identity, JustTry},
@@ -504,7 +504,7 @@ impl xcm_executor::Config for XcmConfig {
504504
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
505505
type FeeManager = XcmFeeManagerFromComponents<
506506
EverythingBut<XcmFeesNotWaivedLocations>,
507-
XcmFeeToAccount<Self::AssetTransactor, AccountId, XcmFeesTargetAccount>,
507+
SendXcmFeeToAccount<Self::AssetTransactor, XcmFeesTargetAccount>,
508508
>;
509509
type MessageExporter = ();
510510
type UniversalAliases = Nothing;

0 commit comments

Comments
 (0)