mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
[cumulus] parachains-common testnet constants cleaning (#3134)
The `parachains-common` contains a lots of constants and type definitions which are used for `polkadot-sdk`'s testnet runtimes and also for `polkadot-fellows`'s production [SP runtimes](https://github.com/polkadot-fellows/runtimes/tree/main/system-parachains/constants). This PR cleans `parachains-common` module to contain only common and generic functionality. Testnet-specific constants have been moved to the separate module dedicated just for testnets: `polkadot-sdk/cumulus/parachains/runtimes/constants/` Part of: https://github.com/paritytech/polkadot-sdk/issues/3054 --------- Co-authored-by: georgepisaltu <george.pisaltu@parity.io>
This commit is contained in:
@@ -77,7 +77,8 @@ cumulus-primitives-core = { path = "../../../../primitives/core", default-featur
|
||||
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { package = "staging-parachain-info", path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false, features = ["westend"] }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
testnet-parachains-constants = { path = "../../constants", default-features = false, features = ["westend"] }
|
||||
assets-common = { path = "../common", default-features = false }
|
||||
|
||||
# Bridges
|
||||
@@ -226,6 +227,7 @@ std = [
|
||||
"sp-transaction-pool/std",
|
||||
"sp-version/std",
|
||||
"substrate-wasm-builder",
|
||||
"testnet-parachains-constants/std",
|
||||
"westend-runtime-constants/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
|
||||
@@ -56,12 +56,9 @@ use pallet_asset_conversion_tx_payment::AssetConversionAdapter;
|
||||
use pallet_nfts::{DestroyWitness, PalletFeatures};
|
||||
use pallet_xcm::EnsureXcm;
|
||||
use parachains_common::{
|
||||
impls::DealWithFees,
|
||||
message_queue::*,
|
||||
westend::{consensus::*, currency::*, fee::WeightToFee},
|
||||
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, CollectionId, Hash,
|
||||
Header, ItemId, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS,
|
||||
MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||
impls::DealWithFees, message_queue::*, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance,
|
||||
BlockNumber, CollectionId, Hash, Header, ItemId, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
|
||||
DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||
};
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||
@@ -75,6 +72,7 @@ use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_version::NativeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
use testnet_parachains_constants::westend::{consensus::*, currency::*, fee::WeightToFee};
|
||||
use xcm_config::{
|
||||
ForeignAssetsConvertedConcreteId, PoolAssetsConvertedConcreteId,
|
||||
TrustBackedAssetsConvertedConcreteId, TrustBackedAssetsPalletLocationV3, WestendLocation,
|
||||
|
||||
@@ -21,7 +21,6 @@ use super::{
|
||||
XcmpQueue,
|
||||
};
|
||||
use assets_common::{
|
||||
local_and_foreign_assets::MatchesLocalAndForeignAssetsLocation,
|
||||
matching::{FromSiblingParachain, IsForeignConcreteAsset},
|
||||
TrustBackedAssetsAsLocation,
|
||||
};
|
||||
@@ -224,31 +223,6 @@ pub type AssetTransactors = (
|
||||
UniquesTransactor,
|
||||
);
|
||||
|
||||
/// Simple `Location` matcher for Local and Foreign asset `Location`.
|
||||
pub struct LocalAndForeignAssetsLocationMatcher;
|
||||
impl MatchesLocalAndForeignAssetsLocation<xcm::v3::Location>
|
||||
for LocalAndForeignAssetsLocationMatcher
|
||||
{
|
||||
fn is_local(location: &xcm::v3::Location) -> bool {
|
||||
use assets_common::fungible_conversion::MatchesLocation;
|
||||
let latest_location: Location =
|
||||
if let Ok(location) = (*location).try_into() { location } else { return false };
|
||||
TrustBackedAssetsConvertedConcreteId::contains(&latest_location)
|
||||
}
|
||||
|
||||
fn is_foreign(location: &xcm::v3::Location) -> bool {
|
||||
use assets_common::fungible_conversion::MatchesLocation;
|
||||
let latest_location: Location =
|
||||
if let Ok(location) = (*location).try_into() { location } else { return false };
|
||||
ForeignAssetsConvertedConcreteId::contains(&latest_location)
|
||||
}
|
||||
}
|
||||
impl Contains<xcm::v3::Location> for LocalAndForeignAssetsLocationMatcher {
|
||||
fn contains(location: &xcm::v3::Location) -> bool {
|
||||
Self::is_local(location) || Self::is_foreign(location)
|
||||
}
|
||||
}
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
|
||||
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
|
||||
/// biases the kind of local `Origin` it will become.
|
||||
|
||||
@@ -47,13 +47,13 @@ use frame_support::{
|
||||
},
|
||||
weights::{Weight, WeightToFee as WeightToFeeT},
|
||||
};
|
||||
use parachains_common::{
|
||||
westend::{consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, currency::UNITS, fee::WeightToFee},
|
||||
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, SLOT_DURATION,
|
||||
};
|
||||
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, SLOT_DURATION};
|
||||
use sp_consensus_aura::SlotDuration;
|
||||
use sp_runtime::traits::MaybeEquivalence;
|
||||
use std::convert::Into;
|
||||
use testnet_parachains_constants::westend::{
|
||||
consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, currency::UNITS, fee::WeightToFee,
|
||||
};
|
||||
use xcm::latest::prelude::{Assets as XcmAssets, *};
|
||||
use xcm_builder::V4V3LocationConverter;
|
||||
use xcm_executor::traits::{JustTry, WeightTrader};
|
||||
|
||||
Reference in New Issue
Block a user