mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
[testnet] Align testnet system parachain runtimes using RelayTreasuryLocation and SystemParachains in the same way (#2023)
This PR addresses several issues: - simplify referencing `RelayTreasuryLocation` without needing additional `RelayTreasury` struct - fix for referencing `SystemParachains` from parachain with `parents: 1` instead of `parents: 0` - removed hard-coded constants and fix tests for `asset-hub-rococo` which was merged to master after https://github.com/paritytech/polkadot-sdk/pull/1726 --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -29,7 +29,7 @@ use crate::{
|
||||
};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
traits::{ConstU32, Contains, Everything, Nothing},
|
||||
traits::{ConstU32, Contains, Equals, Everything, Nothing},
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
@@ -40,7 +40,7 @@ use parachains_common::{
|
||||
};
|
||||
use polkadot_parachain_primitives::primitives::Sibling;
|
||||
use polkadot_runtime_common::xcm_sender::ExponentialPrice;
|
||||
use rococo_runtime_constants::system_parachain::SystemParachains;
|
||||
use rococo_runtime_constants::system_parachain;
|
||||
use sp_core::Get;
|
||||
use sp_runtime::traits::AccountIdConversion;
|
||||
use xcm::latest::prelude::*;
|
||||
@@ -67,6 +67,7 @@ parameter_types! {
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
pub TreasuryAccount: Option<AccountId> = Some(TREASURY_PALLET_ID.into_account_truncating());
|
||||
pub RelayTreasuryLocation: MultiLocation = (Parent, PalletInstance(rococo_runtime_constants::TREASURY_PALLET_ID)).into();
|
||||
}
|
||||
|
||||
/// Adapter for resolving `NetworkId` based on `pub storage Flavor: RuntimeFlavor`.
|
||||
@@ -222,8 +223,12 @@ pub type Barrier = TrailingSetTopicAsId<
|
||||
// If the message is one that immediately attempts to pay for execution, then
|
||||
// allow it.
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||
// Parent, its pluralities (i.e. governance bodies) and relay treasury pallet
|
||||
// get free execution.
|
||||
AllowExplicitUnpaidExecutionFrom<(
|
||||
ParentOrParentsPlurality,
|
||||
Equals<RelayTreasuryLocation>,
|
||||
)>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
||||
),
|
||||
@@ -234,22 +239,25 @@ pub type Barrier = TrailingSetTopicAsId<
|
||||
>,
|
||||
>;
|
||||
|
||||
parameter_types! {
|
||||
pub RelayTreasuryLocation: MultiLocation = (Parent, PalletInstance(rococo_runtime_constants::TREASURY_PALLET_ID)).into();
|
||||
}
|
||||
|
||||
pub struct RelayTreasury;
|
||||
impl Contains<MultiLocation> for RelayTreasury {
|
||||
fn contains(location: &MultiLocation) -> bool {
|
||||
let relay_treasury_location = RelayTreasuryLocation::get();
|
||||
*location == relay_treasury_location
|
||||
}
|
||||
match_types! {
|
||||
pub type SystemParachains: impl Contains<MultiLocation> = {
|
||||
MultiLocation {
|
||||
parents: 1,
|
||||
interior: X1(Parachain(
|
||||
system_parachain::ASSET_HUB_ID |
|
||||
system_parachain::BRIDGE_HUB_ID |
|
||||
system_parachain::CONTRACTS_ID |
|
||||
system_parachain::ENCOINTER_ID
|
||||
)),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Locations that will not be charged fees in the executor,
|
||||
/// either execution or delivery.
|
||||
/// We only waive fees for system functions, which these locations represent.
|
||||
pub type WaivedLocations = (RelayOrOtherSystemParachains<SystemParachains, Runtime>, RelayTreasury);
|
||||
pub type WaivedLocations =
|
||||
(RelayOrOtherSystemParachains<SystemParachains, Runtime>, Equals<RelayTreasuryLocation>);
|
||||
|
||||
/// Cases where a remote origin is accepted as trusted Teleporter for a given asset:
|
||||
/// - NativeToken with the parent Relay Chain and sibling parachains.
|
||||
|
||||
Reference in New Issue
Block a user