From 0097dd978d27a55b9475be017b6a4c5a0935218c Mon Sep 17 00:00:00 2001 From: Dino Pacandi Date: Mon, 28 Aug 2023 17:23:59 +0200 Subject: [PATCH] Derived remote account scheme update --- runtime/astar/src/xcm_config.rs | 17 ++++++++++------- runtime/shibuya/src/xcm_config.rs | 1 - runtime/shiden/src/xcm_config.rs | 1 - 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/runtime/astar/src/xcm_config.rs b/runtime/astar/src/xcm_config.rs index 5c86c9e93f..3b50863c1e 100644 --- a/runtime/astar/src/xcm_config.rs +++ b/runtime/astar/src/xcm_config.rs @@ -33,12 +33,12 @@ use sp_runtime::traits::Convert; // Polkadot imports use xcm::latest::prelude::*; use xcm_builder::{ - Account32Hash, AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, + AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, IsConcrete, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, }; use xcm_executor::{ traits::{Convert as XcmConvert, JustTry, WithOriginFilter}, @@ -50,8 +50,9 @@ use orml_xcm_support::DisabledParachainFee; // Astar imports use astar_primitives::xcm::{ - AbsoluteAndRelativeReserveProvider, AccountIdToMultiLocation, FixedRateOfForeignAsset, - ReserveAssetFilter, XcmFungibleFeeHandler, + AbsoluteAndRelativeReserveProvider, AccountIdToMultiLocation, DescribeAllTerminal, + DescribeFamily, FixedRateOfForeignAsset, HashedDescription, ReserveAssetFilter, + XcmFungibleFeeHandler, }; parameter_types! { @@ -73,8 +74,9 @@ pub type LocationToAccountId = ( SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, - // Derives a private `Account32` by hashing `("multiloc", received multilocation)` - Account32Hash, + // Generates private `AccountId`s from `MultiLocation`s, in a stable & safe way. + // Replaces the old `Account32Hash` approach. + HashedDescription>, ); /// Means for transacting the native currency on this chain. @@ -222,7 +224,8 @@ impl Contains for SafeCallFilter { pub type XcmBarrier = ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, + // This will first calculate the derived origin, before checking it against the barrier implementation + WithComputedOrigin, UniversalLocation, ConstU32<8>>, // Parent and its plurality get free execution AllowUnpaidExecutionFrom, // Expected responses are OK. diff --git a/runtime/shibuya/src/xcm_config.rs b/runtime/shibuya/src/xcm_config.rs index 3848b0bd1a..c14c1611dc 100644 --- a/runtime/shibuya/src/xcm_config.rs +++ b/runtime/shibuya/src/xcm_config.rs @@ -152,7 +152,6 @@ match_types! { pub type XcmBarrier = ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, // This will first calculate the derived origin, before checking it against the barrier implementation WithComputedOrigin, UniversalLocation, ConstU32<8>>, // Parent and its plurality get free execution diff --git a/runtime/shiden/src/xcm_config.rs b/runtime/shiden/src/xcm_config.rs index 981c906c5c..8a32b813bc 100644 --- a/runtime/shiden/src/xcm_config.rs +++ b/runtime/shiden/src/xcm_config.rs @@ -224,7 +224,6 @@ impl Contains for SafeCallFilter { pub type XcmBarrier = ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, // This will first calculate the derived origin, before checking it against the barrier implementation WithComputedOrigin, UniversalLocation, ConstU32<8>>, // Parent and its plurality get free execution