mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 01:01:01 +00:00
Implement AliasOrigin processing in XCVM (#7245)
* Implement AliasOrigin processing in XCVM * add builder types and first test * switch to more general builder types * clone target for RemovePrefixAccountId32 * change builder types * change AliasForeignAccountId32 and add test for AliasCase * add Aliasers type to xcm configs * add benchmark * benchmark fix * add benchmark function for runtimes * fix alias_origin result types * fix benchmark test * add runtime-benchmarks feature in pallet-xcm-benchmarks * fmt * remove AliasCase, add test and fmt * address feedback * ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::generic * ".git/.scripts/commands/bench/bench.sh" xcm westend pallet_xcm_benchmarks::generic * ".git/.scripts/commands/bench/bench.sh" xcm rococo pallet_xcm_benchmarks::generic * address feedback * lock * ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::generic * ".git/.scripts/commands/bench/bench.sh" xcm westend pallet_xcm_benchmarks::generic * ".git/.scripts/commands/bench/bench.sh" xcm rococo pallet_xcm_benchmarks::generic * change doc * fmt --------- Co-authored-by: Just van Stam <just.van.stam@gmail.com> Co-authored-by: Just van Stam <vstam1@users.noreply.github.com> Co-authored-by: command-bot <>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Polkadot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Implementation for ContainsPair<MultiLocation, MultiLocation>.
|
||||
|
||||
use frame_support::traits::{Contains, ContainsPair};
|
||||
use sp_std::marker::PhantomData;
|
||||
use xcm::latest::prelude::*;
|
||||
|
||||
/// Alias a Foreign AccountId32 with a local AccountId32 if the Foreign AccountId32 matches the `Prefix` pattern.
|
||||
///
|
||||
/// Requires that the prefixed origin AccountId32 matches the target AccountId32.
|
||||
pub struct AliasForeignAccountId32<Prefix>(PhantomData<Prefix>);
|
||||
impl<Prefix: Contains<MultiLocation>> ContainsPair<MultiLocation, MultiLocation>
|
||||
for AliasForeignAccountId32<Prefix>
|
||||
{
|
||||
fn contains(origin: &MultiLocation, target: &MultiLocation) -> bool {
|
||||
if let (prefix, Some(account_id @ AccountId32 { .. })) = origin.split_last_interior() {
|
||||
return Prefix::contains(&prefix) &&
|
||||
*target == MultiLocation { parents: 0, interior: X1(account_id) }
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user