mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 09:51: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:
@@ -35,7 +35,6 @@ use assets_common::{
|
||||
};
|
||||
use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
|
||||
use cumulus_primitives_core::AggregateMessageOrigin;
|
||||
use parachains_common::rococo::snowbridge::EthereumNetwork;
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||
use sp_runtime::{
|
||||
@@ -44,6 +43,7 @@ use sp_runtime::{
|
||||
transaction_validity::{TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult, Permill,
|
||||
};
|
||||
use testnet_parachains_constants::rococo::snowbridge::EthereumNetwork;
|
||||
|
||||
use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -74,12 +74,12 @@ use pallet_nfts::PalletFeatures;
|
||||
use parachains_common::{
|
||||
impls::DealWithFees,
|
||||
message_queue::{NarrowOriginToSibling, ParaIdToSibling},
|
||||
rococo::{consensus::*, currency::*, fee::WeightToFee},
|
||||
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, CollectionId, Hash,
|
||||
Header, ItemId, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS,
|
||||
NORMAL_DISPATCH_RATIO,
|
||||
};
|
||||
use sp_runtime::{Perbill, RuntimeDebug};
|
||||
use testnet_parachains_constants::rococo::{consensus::*, currency::*, fee::WeightToFee};
|
||||
use xcm_config::{
|
||||
ForeignAssetsConvertedConcreteId, ForeignCreatorsSovereignAccountOf, GovernanceLocation,
|
||||
PoolAssetsConvertedConcreteId, TokenLocation, TokenLocationV3,
|
||||
@@ -1721,9 +1721,9 @@ fn ensure_key_ss58() {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{CENTS, MILLICENTS};
|
||||
use parachains_common::rococo::fee;
|
||||
use sp_runtime::traits::Zero;
|
||||
use sp_weights::WeightToFee;
|
||||
use testnet_parachains_constants::rococo::fee;
|
||||
|
||||
/// We can fit at least 1000 transfers in a block.
|
||||
#[test]
|
||||
|
||||
@@ -21,7 +21,6 @@ use super::{
|
||||
XcmpQueue,
|
||||
};
|
||||
use assets_common::{
|
||||
local_and_foreign_assets::MatchesLocalAndForeignAssetsLocation,
|
||||
matching::{FromNetwork, FromSiblingParachain, IsForeignConcreteAsset},
|
||||
TrustBackedAssetsAsLocation,
|
||||
};
|
||||
@@ -36,7 +35,6 @@ use frame_system::EnsureRoot;
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use parachains_common::{
|
||||
impls::ToStakingPot,
|
||||
rococo::snowbridge::EthereumNetwork,
|
||||
xcm_config::{
|
||||
AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier,
|
||||
ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains,
|
||||
@@ -47,6 +45,9 @@ use polkadot_parachain_primitives::primitives::Sibling;
|
||||
use polkadot_runtime_common::xcm_sender::ExponentialPrice;
|
||||
use snowbridge_router_primitives::inbound::GlobalConsensusEthereumConvertsFor;
|
||||
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
|
||||
use testnet_parachains_constants::rococo::snowbridge::{
|
||||
EthereumNetwork, INBOUND_QUEUE_PALLET_INDEX,
|
||||
};
|
||||
use xcm::latest::prelude::*;
|
||||
#[allow(deprecated)]
|
||||
use xcm_builder::CurrencyAdapter;
|
||||
@@ -229,30 +230,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.
|
||||
@@ -875,7 +852,7 @@ pub mod bridging {
|
||||
1,
|
||||
[
|
||||
Parachain(SiblingBridgeHubParaId::get()),
|
||||
PalletInstance(parachains_common::rococo::snowbridge::INBOUND_QUEUE_PALLET_INDEX)
|
||||
PalletInstance(INBOUND_QUEUE_PALLET_INDEX)
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user