From 88099f35c3a10cc294f475a4d4e454d15e257ec5 Mon Sep 17 00:00:00 2001 From: Gabriel Facco de Arruda Date: Thu, 15 Feb 2024 20:03:03 -0300 Subject: [PATCH] Add HashedDescription XCM location converter and remove TinkernetMultisig configs --- Cargo.lock | 21 --------------------- Cargo.toml | 3 --- runtime/basilisk/Cargo.toml | 3 --- runtime/basilisk/src/xcm.rs | 25 ++++++++++++++++++------- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4a7c6b026..d25fc0d64a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -900,7 +900,6 @@ dependencies = [ "orml-unknown-tokens", "orml-vesting", "orml-xcm", - "orml-xcm-builder-kusama", "orml-xcm-support", "orml-xtokens", "pallet-asset-registry", @@ -6281,26 +6280,6 @@ dependencies = [ "staging-xcm", ] -[[package]] -name = "orml-xcm-builder-kusama" -version = "1.0.0" -source = "git+https://github.com/open-web3-stack/orml-xcm-builder?rev=32f0b3f1cbe77d4d330e07c7d4fcc3ebd669db77#32f0b3f1cbe77d4d330e07c7d4fcc3ebd669db77" -dependencies = [ - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-weights", - "staging-xcm", - "staging-xcm-executor", -] - [[package]] name = "orml-xcm-support" version = "0.4.1-dev" diff --git a/Cargo.toml b/Cargo.toml index 83922f852b..14ef6374fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -223,9 +223,6 @@ orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-libra orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -# InvArch Tinkernet Multisig dependencies -orml-xcm-builder-kusama = { git = "https://github.com/open-web3-stack/orml-xcm-builder", rev = "32f0b3f1cbe77d4d330e07c7d4fcc3ebd669db77", default-features = false } - [patch."https://github.com/paritytech/polkadot-sdk"] frame-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index 8020c2580c..eafa5d32ef 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -125,9 +125,6 @@ sp-staking = { workspace = true } sp-trie = { workspace = true } sp-io = { workspace = true } -# InvArch Tinkernet Multisig dependencies -orml-xcm-builder-kusama = { workspace = true } - [features] default = ["std"] runtime-benchmarks = [ diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 96a1459909..58f83eda0f 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -42,9 +42,9 @@ use primitives::AssetId; use scale_info::TypeInfo; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, - EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, - TakeWeightCredit, WithComputedOrigin, + DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FixedWeightBounds, HashedDescription, ParentIsPreset, + RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, WithComputedOrigin, }; use xcm_executor::{Config, XcmExecutor}; @@ -104,8 +104,6 @@ pub type XcmOriginToCallOrigin = ( SignedAccountId32AsNative, // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. XcmPassthrough, - // Derives signed AccountId32 origins for Tinkernet multisigs. - orml_xcm_builder_kusama::TinkernetMultisigAsNativeOrigin, ); parameter_types! { @@ -370,6 +368,18 @@ pub type XcmRouter = ( XcmpQueue, ); +// TODO: Remove after upgrading to `polkadot-v1.2.0` and replace types from xcm-builder. +pub struct DescribeBodyTerminal; +impl xcm_builder::DescribeLocation for DescribeBodyTerminal { + fn describe_location(l: &MultiLocation) -> Option> { + match (l.parents, &l.interior) { + (0, X1(Plurality { id, part })) => Some((b"Body", id, part).encode()), + _ => return None, + } + } +} +pub type DescribeAllTerminalAndBody = (DescribeAllTerminal, DescribeBodyTerminal); + /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. @@ -380,8 +390,9 @@ pub type LocationToAccountId = ( SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, - // Mapping Tinkernet multisig to the correctly derived AccountId32. - orml_xcm_builder_kusama::TinkernetMultisigAsAccountId, + // TODO: Replace DescribeAllTerminalAndBody with DescribeAllTerminal after upgrading to `polkadot-v1.2.0`. + // Foreign locations alias into accounts according to a hash of their standard description. + HashedDescription>, ); parameter_types! {