Skip to content

Commit

Permalink
Add HashedDescription XCM location converter and remove TinkernetMult…
Browse files Browse the repository at this point in the history
…isig configs
  • Loading branch information
arrudagates committed Feb 15, 2024
1 parent c722cfd commit 88099f3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 34 deletions.
21 changes: 0 additions & 21 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
3 changes: 0 additions & 3 deletions runtime/basilisk/Cargo.toml
Original file line number Diff line number Diff line change
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
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()),
_ => 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.
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 88099f3

Please sign in to comment.