Skip to content

Commit

Permalink
Merge pull request #655 from arrudagates/master
Browse files Browse the repository at this point in the history
feat: Add HashedDescription XCM converter and remove TinkernetMultisig configs
  • Loading branch information
green-jay authored Mar 12, 2024
2 parents b9c609a + 23d269a commit 48e2486
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 37 deletions.
23 changes: 1 addition & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
5 changes: 1 addition & 4 deletions runtime/basilisk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion runtime/basilisk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
25 changes: 18 additions & 7 deletions runtime/basilisk/src/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -104,8 +104,6 @@ pub type XcmOriginToCallOrigin = (
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
XcmPassthrough<RuntimeOrigin>,
// Derives signed AccountId32 origins for Tinkernet multisigs.
orml_xcm_builder_kusama::TinkernetMultisigAsNativeOrigin<RuntimeOrigin>,
);

parameter_types! {
Expand Down Expand Up @@ -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<Vec<u8>> {
match (l.parents, &l.interior) {
(0, X1(Plurality { id, part })) => Some((b"Body", id, part).encode()),
_ => 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.
Expand All @@ -380,8 +390,9 @@ pub type LocationToAccountId = (
SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
AccountId32Aliases<RelayNetwork, AccountId>,
// Mapping Tinkernet multisig to the correctly derived AccountId32.
orml_xcm_builder_kusama::TinkernetMultisigAsAccountId<AccountId>,
// 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<AccountId, DescribeFamily<DescribeAllTerminalAndBody>>,
);

parameter_types! {
Expand Down

0 comments on commit 48e2486

Please sign in to comment.