Skip to content

Commit a072ce8

Browse files
authored
asset-hubs: simplify xcm-config (#6222)
`ForeignCreatorsSovereignAccountOf` is used by `ForeignCreators` filter to convert location to `AccountId`, _after_ `ForeignCreators::IsForeign` filter passes for an (asset, location) pair. The `IsForeign` filter is the actual differentiator, so if a location passes it, we should support converting it to an `AccountId`. As such, this commit replaces `ForeignCreatorsSovereignAccountOf` converter with the more general `LocationToAccountId` converter. Signed-off-by: Adrian Catangiu <adrian@parity.io>
1 parent efd6603 commit a072ce8

File tree

6 files changed

+14
-31
lines changed

6 files changed

+14
-31
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ use parachains_common::{
8282
use sp_runtime::{Perbill, RuntimeDebug};
8383
use testnet_parachains_constants::rococo::{consensus::*, currency::*, fee::WeightToFee, time::*};
8484
use xcm_config::{
85-
ForeignAssetsConvertedConcreteId, ForeignCreatorsSovereignAccountOf, GovernanceLocation,
85+
ForeignAssetsConvertedConcreteId, GovernanceLocation, LocationToAccountId,
8686
PoolAssetsConvertedConcreteId, TokenLocation, TrustBackedAssetsConvertedConcreteId,
8787
TrustBackedAssetsPalletLocation,
8888
};
@@ -424,7 +424,7 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
424424
FromNetwork<xcm_config::UniversalLocation, EthereumNetwork, xcm::v4::Location>,
425425
xcm_config::bridging::to_westend::WestendOrEthereumAssetFromAssetHubWestend,
426426
),
427-
ForeignCreatorsSovereignAccountOf,
427+
LocationToAccountId,
428428
AccountId,
429429
xcm::v4::Location,
430430
>;

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -512,14 +512,6 @@ impl cumulus_pallet_xcm::Config for Runtime {
512512
type XcmExecutor = XcmExecutor<XcmConfig>;
513513
}
514514

515-
pub type ForeignCreatorsSovereignAccountOf = (
516-
SiblingParachainConvertsVia<Sibling, AccountId>,
517-
AccountId32Aliases<RelayNetwork, AccountId>,
518-
ParentIsPreset<AccountId>,
519-
GlobalConsensusEthereumConvertsFor<AccountId>,
520-
GlobalConsensusParachainConvertsFor<UniversalLocation, AccountId>,
521-
);
522-
523515
/// Simple conversion of `u32` into an `AssetId` for use in benchmarking.
524516
pub struct XcmBenchmarkHelper;
525517
#[cfg(feature = "runtime-benchmarks")]

cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use asset_hub_rococo_runtime::{
2121
xcm_config,
2222
xcm_config::{
2323
bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount,
24-
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf,
25-
LocationToAccountId, StakingPot, TokenLocation, TrustBackedAssetsPalletLocation, XcmConfig,
24+
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, LocationToAccountId, StakingPot,
25+
TokenLocation, TrustBackedAssetsPalletLocation, XcmConfig,
2626
},
2727
AllPalletsWithoutSystem, AssetConversion, AssetDeposit, Assets, Balances, CollatorSelection,
2828
ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase,
@@ -941,7 +941,7 @@ asset_test_utils::include_teleports_for_foreign_assets_works!(
941941
CheckingAccount,
942942
WeightToFee,
943943
ParachainSystem,
944-
ForeignCreatorsSovereignAccountOf,
944+
LocationToAccountId,
945945
ForeignAssetsInstance,
946946
collator_session_keys(),
947947
slot_durations(),
@@ -1015,7 +1015,7 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p
10151015
Runtime,
10161016
XcmConfig,
10171017
WeightToFee,
1018-
ForeignCreatorsSovereignAccountOf,
1018+
LocationToAccountId,
10191019
ForeignAssetsInstance,
10201020
Location,
10211021
WithLatestLocationConverter<Location>,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ use testnet_parachains_constants::westend::{
7979
consensus::*, currency::*, fee::WeightToFee, snowbridge::EthereumNetwork, time::*,
8080
};
8181
use xcm_config::{
82-
ForeignAssetsConvertedConcreteId, ForeignCreatorsSovereignAccountOf,
83-
PoolAssetsConvertedConcreteId, TrustBackedAssetsConvertedConcreteId,
84-
TrustBackedAssetsPalletLocation, WestendLocation, XcmOriginToTransactDispatchOrigin,
82+
ForeignAssetsConvertedConcreteId, LocationToAccountId, PoolAssetsConvertedConcreteId,
83+
TrustBackedAssetsConvertedConcreteId, TrustBackedAssetsPalletLocation, WestendLocation,
84+
XcmOriginToTransactDispatchOrigin,
8585
};
8686

8787
#[cfg(any(feature = "std", test))]
@@ -423,7 +423,7 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
423423
FromNetwork<xcm_config::UniversalLocation, EthereumNetwork, xcm::v4::Location>,
424424
xcm_config::bridging::to_rococo::RococoAssetFromAssetHubRococo,
425425
),
426-
ForeignCreatorsSovereignAccountOf,
426+
LocationToAccountId,
427427
AccountId,
428428
xcm::v4::Location,
429429
>;

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -535,14 +535,6 @@ impl cumulus_pallet_xcm::Config for Runtime {
535535
type XcmExecutor = XcmExecutor<XcmConfig>;
536536
}
537537

538-
pub type ForeignCreatorsSovereignAccountOf = (
539-
SiblingParachainConvertsVia<Sibling, AccountId>,
540-
AccountId32Aliases<RelayNetwork, AccountId>,
541-
ParentIsPreset<AccountId>,
542-
GlobalConsensusEthereumConvertsFor<AccountId>,
543-
GlobalConsensusParachainConvertsFor<UniversalLocation, AccountId>,
544-
);
545-
546538
/// Simple conversion of `u32` into an `AssetId` for use in benchmarking.
547539
pub struct XcmBenchmarkHelper;
548540
#[cfg(feature = "runtime-benchmarks")]

cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ use asset_hub_westend_runtime::{
2121
xcm_config,
2222
xcm_config::{
2323
bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount,
24-
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf,
25-
LocationToAccountId, StakingPot, TrustBackedAssetsPalletLocation, WestendLocation,
26-
XcmConfig,
24+
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, LocationToAccountId, StakingPot,
25+
TrustBackedAssetsPalletLocation, WestendLocation, XcmConfig,
2726
},
2827
AllPalletsWithoutSystem, Assets, Balances, ExistentialDeposit, ForeignAssets,
2928
ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem,
@@ -966,7 +965,7 @@ asset_test_utils::include_teleports_for_foreign_assets_works!(
966965
CheckingAccount,
967966
WeightToFee,
968967
ParachainSystem,
969-
ForeignCreatorsSovereignAccountOf,
968+
LocationToAccountId,
970969
ForeignAssetsInstance,
971970
collator_session_keys(),
972971
slot_durations(),
@@ -1044,7 +1043,7 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p
10441043
Runtime,
10451044
XcmConfig,
10461045
WeightToFee,
1047-
ForeignCreatorsSovereignAccountOf,
1046+
LocationToAccountId,
10481047
ForeignAssetsInstance,
10491048
xcm::v4::Location,
10501049
WithLatestLocationConverter<xcm::v4::Location>,

0 commit comments

Comments
 (0)