mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 14:31:02 +00:00
Improve Penpal runtime + emulated tests (#3543)
Issues addressed in this PR: - Improve *Penpal* runtime: - Properly handled received assets. Previously, it treated `(1, Here)` as the local native currency, whereas it should be treated as a `ForeignAsset`. This wasn't a great example of standard Parachain behaviour, as no Parachain treats the system asset as the local currency. - Remove `AllowExplicitUnpaidExecutionFrom` the system. Again, this wasn't a great example of standard Parachain behaviour. - Move duplicated `ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger` to `assets_common` crate. - Improve emulated tests: - Update *Penpal* tests to new runtime. - To simplify tests, register the reserve transferred, teleported, and system assets in *Penpal* and *AssetHub* genesis. This saves us from having to create the assets repeatedly for each test - Add missing test case: `reserve_transfer_assets_from_para_to_system_para`. - Cleanup. - Prevent integration tests crates imports from being re-exported, as they were polluting the `polkadot-sdk` docs. There is still a test case missing for reserve transfers: - Reserve transfer of system asset from *Parachain* to *Parachain* trough *AssetHub*. - This is not yet possible with `pallet-xcm` due to the reasons explained in https://github.com/paritytech/polkadot-sdk/pull/3339 --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -21,17 +21,19 @@ pub use xcm_emulator;
|
||||
|
||||
// Substrate
|
||||
use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId;
|
||||
use frame_support::parameter_types;
|
||||
use grandpa::AuthorityId as GrandpaId;
|
||||
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
|
||||
use sp_consensus_babe::AuthorityId as BabeId;
|
||||
use sp_core::{sr25519, storage::Storage, Pair, Public};
|
||||
use sp_runtime::{
|
||||
traits::{IdentifyAccount, Verify},
|
||||
traits::{AccountIdConversion, IdentifyAccount, Verify},
|
||||
BuildStorage, MultiSignature,
|
||||
};
|
||||
|
||||
// Polakdot
|
||||
use parachains_common::BlockNumber;
|
||||
use polkadot_parachain_primitives::primitives::Sibling;
|
||||
use polkadot_runtime_parachains::configuration::HostConfiguration;
|
||||
|
||||
// Cumulus
|
||||
@@ -49,6 +51,25 @@ pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
|
||||
|
||||
type AccountPublic = <MultiSignature as Verify>::Signer;
|
||||
|
||||
// This asset is added to AH as Asset and reserved transfer between Parachain and AH
|
||||
pub const RESERVABLE_ASSET_ID: u32 = 1;
|
||||
// This asset is added to AH as ForeignAsset and teleported between Penpal and AH
|
||||
pub const TELEPORTABLE_ASSET_ID: u32 = 2;
|
||||
|
||||
pub const PENPAL_ID: u32 = 2000;
|
||||
pub const ASSETS_PALLET_ID: u8 = 50;
|
||||
|
||||
parameter_types! {
|
||||
pub PenpalTeleportableAssetLocation: xcm::v3::Location
|
||||
= xcm::v3::Location::new(1, [
|
||||
xcm::v3::Junction::Parachain(PENPAL_ID),
|
||||
xcm::v3::Junction::PalletInstance(ASSETS_PALLET_ID),
|
||||
xcm::v3::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
|
||||
]
|
||||
);
|
||||
pub PenpalSiblingSovereigAccount: AccountId = Sibling::from(PENPAL_ID).into_account_truncating();
|
||||
}
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
|
||||
Reference in New Issue
Block a user