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 1/4] 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! { From a9eea3e3e11c8445b2ebdf551eb950eefa2c8baf Mon Sep 17 00:00:00 2001 From: Gabriel Facco de Arruda Date: Sat, 24 Feb 2024 11:06:27 -0700 Subject: [PATCH 2/4] Bump runtime version --- runtime/basilisk/Cargo.toml | 2 +- runtime/basilisk/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index 22f196eb96..46667c1f37 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "basilisk-runtime" -version = "109.0.0" +version = "110.0.0" authors = ["GalacticCouncil"] edition = "2021" homepage = "https://github.com/galacticcouncil/Basilisk-node" diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 91515b5cfb..c82927dcd1 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -102,7 +102,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 109, + spec_version: 110, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 3b23b334f177c64e646ec3f8e285831cf20f8531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20P=C3=A1nik?= Date: Mon, 26 Feb 2024 17:54:46 +0100 Subject: [PATCH 3/4] bump --- Cargo.lock | 2 +- runtime/basilisk/Cargo.toml | 2 +- runtime/basilisk/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8ee8e4092..62f6e87982 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,7 +871,7 @@ dependencies = [ [[package]] name = "basilisk-runtime" -version = "110.0.0" +version = "111.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index 46667c1f37..70eda5f940 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "basilisk-runtime" -version = "110.0.0" +version = "111.0.0" authors = ["GalacticCouncil"] edition = "2021" homepage = "https://github.com/galacticcouncil/Basilisk-node" diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 6656fe443f..df468dacc0 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -102,7 +102,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 110, + spec_version: 111, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 23d269a29ea0a877b9d9c26ab2699408fa4eca65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20P=C3=A1nik?= Date: Mon, 26 Feb 2024 18:27:22 +0100 Subject: [PATCH 4/4] clippy --- runtime/basilisk/src/xcm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 58f83eda0f..6defe9fb96 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -374,7 +374,7 @@ 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, + _ => None, } } }