mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +00:00
Sanitize UniversalLocation witth GlobalConsensus + XCM small nits and improvements (#4238)
This PR: - sanitizes all `UniversalLocation`s with `GlobalConsensus` (when possible) - addressing [comment](https://github.com/paritytech/polkadot-sdk/pull/4025#discussion_r1557361473) - adds `DefaultConfig` for `pallet-xcm-benchmarks` for `system`
This commit is contained in:
Generated
-1
@@ -11777,7 +11777,6 @@ dependencies = [
|
||||
"polkadot-primitives",
|
||||
"polkadot-runtime-common",
|
||||
"scale-info",
|
||||
"sp-core",
|
||||
"sp-io",
|
||||
"sp-runtime",
|
||||
"sp-std 14.0.0",
|
||||
|
||||
@@ -51,9 +51,9 @@ use xcm_executor::XcmExecutor;
|
||||
|
||||
parameter_types! {
|
||||
pub const RelayLocation: Location = Location::parent();
|
||||
pub const RelayNetwork: Option<NetworkId> = None;
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Rococo;
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
pub const ExecutiveBody: BodyId = BodyId::Executive;
|
||||
pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating();
|
||||
pub RelayTreasuryLocation: Location = (Parent, PalletInstance(rococo_runtime_constants::TREASURY_PALLET_ID)).into();
|
||||
|
||||
@@ -30,8 +30,8 @@ use xcm_builder::{
|
||||
|
||||
parameter_types! {
|
||||
pub const WestendLocation: Location = Location::parent();
|
||||
pub const WestendNetwork: Option<NetworkId> = Some(NetworkId::Westend);
|
||||
pub UniversalLocation: InteriorLocation = [Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
pub const WestendNetwork: NetworkId = NetworkId::Westend;
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(WestendNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
}
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
|
||||
|
||||
@@ -30,8 +30,8 @@ use xcm_builder::{
|
||||
|
||||
parameter_types! {
|
||||
pub const RococoLocation: Location = Location::parent();
|
||||
pub const RococoNetwork: Option<NetworkId> = Some(NetworkId::Rococo);
|
||||
pub UniversalLocation: InteriorLocation = [Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
pub const RococoNetwork: NetworkId = NetworkId::Rococo;
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RococoNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
}
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
|
||||
|
||||
@@ -327,9 +327,9 @@ impl cumulus_pallet_aura_ext::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
pub const RocLocation: Location = Location::parent();
|
||||
pub const RococoNetwork: Option<NetworkId> = Some(NetworkId::Rococo);
|
||||
pub const RococoNetwork: NetworkId = NetworkId::Rococo;
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorLocation = [Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RococoNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ log = { workspace = true, default-features = true }
|
||||
[dev-dependencies]
|
||||
pallet-balances = { path = "../../../substrate/frame/balances" }
|
||||
pallet-assets = { path = "../../../substrate/frame/assets" }
|
||||
sp-core = { path = "../../../substrate/primitives/core" }
|
||||
sp-tracing = { path = "../../../substrate/primitives/tracing" }
|
||||
xcm = { package = "staging-xcm", path = ".." }
|
||||
# temp
|
||||
|
||||
@@ -20,11 +20,8 @@ use crate::{fungible as xcm_balances_benchmark, mock::*};
|
||||
use frame_benchmarking::BenchmarkError;
|
||||
use frame_support::{
|
||||
derive_impl, parameter_types,
|
||||
traits::{ConstU32, Everything, Nothing},
|
||||
weights::Weight,
|
||||
traits::{Everything, Nothing},
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::traits::{BlakeTwo256, IdentityLookup};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{AllowUnpaidExecutionFrom, FrameTransactionalProcessor, MintLocation};
|
||||
|
||||
@@ -40,37 +37,10 @@ frame_support::construct_runtime!(
|
||||
}
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub BlockWeights: frame_system::limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, u64::MAX));
|
||||
}
|
||||
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = Everything;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Nonce = u64;
|
||||
type Hash = H256;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hashing = BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = pallet_balances::AccountData<u64>;
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -21,10 +21,8 @@ use codec::Decode;
|
||||
use frame_support::{
|
||||
derive_impl, parameter_types,
|
||||
traits::{Contains, Everything, OriginTrait},
|
||||
weights::Weight,
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput};
|
||||
use sp_runtime::traits::TrailingZeroInput;
|
||||
use xcm_builder::{
|
||||
test_utils::{
|
||||
AssetsInHolding, TestAssetExchanger, TestAssetLocker, TestAssetTrap,
|
||||
@@ -45,37 +43,10 @@ frame_support::construct_runtime!(
|
||||
}
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub BlockWeights: frame_system::limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, u64::MAX));
|
||||
}
|
||||
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = Everything;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Nonce = u64;
|
||||
type Hash = H256;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hashing = BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = pallet_balances::AccountData<u64>;
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
/// The benchmarks in this pallet should never need an asset transactor to begin with.
|
||||
|
||||
@@ -58,7 +58,7 @@ impl xcm_executor::traits::ConvertLocation<u64> for AccountIdConverter {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub UniversalLocation: InteriorLocation = Junction::Parachain(101).into();
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(ByGenesis([1; 32])), Junction::Parachain(101)].into();
|
||||
pub UnitWeightCost: Weight = Weight::from_parts(10, 10);
|
||||
pub WeightPrice: (AssetId, u128, u128) = (AssetId(Here.into()), 1_000_000, 1024);
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ parameter_types! {
|
||||
)),
|
||||
};
|
||||
pub const AnyNetwork: Option<NetworkId> = None;
|
||||
pub UniversalLocation: InteriorLocation = Here;
|
||||
pub UniversalLocation: InteriorLocation = GlobalConsensus(ByGenesis([0; 32])).into();
|
||||
pub UnitWeightCost: u64 = 1_000;
|
||||
pub CheckingAccount: AccountId = XcmPallet::check_account();
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ pub fn forward_id_for(original_id: &XcmHash) -> XcmHash {
|
||||
/// end with the `SetTopic` instruction.
|
||||
///
|
||||
/// In the case that the message ends with a `SetTopic(T)` (as should be the case if the top-level
|
||||
/// router is `EnsureUniqueTopic`), then the forwarding message (i.e. the one carrying the
|
||||
/// router is `WithUniqueTopic`), then the forwarding message (i.e. the one carrying the
|
||||
/// export instruction *to* the bridge in local consensus) will also end with a `SetTopic` whose
|
||||
/// inner is `forward_id_for(T)`. If this is not the case then the onward message will not be given
|
||||
/// the `SetTopic` afterword.
|
||||
@@ -254,7 +254,7 @@ impl<Bridges: ExporterFor, Router: SendXcm, UniversalLocation: Get<InteriorLocat
|
||||
/// end with the `SetTopic` instruction.
|
||||
///
|
||||
/// In the case that the message ends with a `SetTopic(T)` (as should be the case if the top-level
|
||||
/// router is `EnsureUniqueTopic`), then the forwarding message (i.e. the one carrying the
|
||||
/// router is `WithUniqueTopic`), then the forwarding message (i.e. the one carrying the
|
||||
/// export instruction *to* the bridge in local consensus) will also end with a `SetTopic` whose
|
||||
/// inner is `forward_id_for(T)`. If this is not the case then the onward message will not be given
|
||||
/// the `SetTopic` afterword.
|
||||
|
||||
@@ -137,7 +137,7 @@ impl configuration::Config for Runtime {
|
||||
parameter_types! {
|
||||
pub const KsmLocation: Location = Location::here();
|
||||
pub const KusamaNetwork: NetworkId = NetworkId::Kusama;
|
||||
pub UniversalLocation: InteriorLocation = Here;
|
||||
pub UniversalLocation: InteriorLocation = KusamaNetwork::get().into();
|
||||
pub CheckAccount: (AccountId, MintLocation) = (XcmPallet::check_account(), MintLocation::Local);
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ parameter_types! {
|
||||
parameter_types! {
|
||||
pub const KsmLocation: Location = Location::parent();
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
|
||||
pub UniversalLocation: InteriorLocation = Parachain(MsgQueue::parachain_id().into()).into();
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Parachain(MsgQueue::parachain_id().into())].into();
|
||||
}
|
||||
|
||||
pub type LocationToAccountId = (
|
||||
|
||||
@@ -131,7 +131,7 @@ parameter_types! {
|
||||
pub const TokenLocation: Location = Here.into_location();
|
||||
pub RelayNetwork: NetworkId = ByGenesis([0; 32]);
|
||||
pub const AnyNetwork: Option<NetworkId> = None;
|
||||
pub UniversalLocation: InteriorLocation = Here;
|
||||
pub UniversalLocation: InteriorLocation = RelayNetwork::get().into();
|
||||
pub UnitWeightCost: u64 = 1_000;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ parameter_types! {
|
||||
parameter_types! {
|
||||
pub const KsmLocation: Location = Location::parent();
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
|
||||
pub UniversalLocation: InteriorLocation = Parachain(MsgQueue::parachain_id().into()).into();
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Parachain(MsgQueue::parachain_id().into())].into();
|
||||
}
|
||||
|
||||
pub type LocationToAccountId = (
|
||||
|
||||
@@ -104,7 +104,7 @@ parameter_types! {
|
||||
pub const TokenLocation: Location = Here.into_location();
|
||||
pub const ThisNetwork: NetworkId = NetworkId::ByGenesis([0; 32]);
|
||||
pub const AnyNetwork: Option<NetworkId> = None;
|
||||
pub const UniversalLocation: InteriorLocation = Here;
|
||||
pub UniversalLocation: InteriorLocation = ThisNetwork::get().into();
|
||||
}
|
||||
|
||||
pub type SovereignAccountOf =
|
||||
|
||||
@@ -144,7 +144,7 @@ parameter_types! {
|
||||
pub const KsmLocation: Location = Location::parent();
|
||||
pub const TokenLocation: Location = Here.into_location();
|
||||
pub const RelayNetwork: NetworkId = ByGenesis([0; 32]);
|
||||
pub UniversalLocation: InteriorLocation = Parachain(MsgQueue::parachain_id().into()).into();
|
||||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Parachain(MsgQueue::parachain_id().into())].into();
|
||||
}
|
||||
|
||||
pub type XcmOriginToCallOrigin = (
|
||||
|
||||
@@ -107,7 +107,7 @@ impl configuration::Config for Runtime {
|
||||
parameter_types! {
|
||||
pub RelayNetwork: NetworkId = ByGenesis([0; 32]);
|
||||
pub const TokenLocation: Location = Here.into_location();
|
||||
pub UniversalLocation: InteriorLocation = Here;
|
||||
pub UniversalLocation: InteriorLocation = RelayNetwork::get().into();
|
||||
pub UnitWeightCost: u64 = 1_000;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ parameter_types! {
|
||||
pub const RelayLocation: Location = Location::parent();
|
||||
pub const RelayNetwork: Option<NetworkId> = None;
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
// For the real deployment, it is recommended to set `RelayNetwork` according to the relay chain
|
||||
// and prepend `UniversalLocation` with `GlobalConsensus(RelayNetwork::get())`.
|
||||
pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user