mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Replicate e2e integration test as emulated (#2958)
* Allow functions to work over both parachains and relay chains * additional references * import * backup * refactoring para and relay traits * use runtime crates to build types * decouple ProcessMessage * decouple ProcessMessage 2 * dmp and xcmp handlers decouple * backup * refactor done * common int values working * added global ext with mutex * works for two mutex * single mutex and remove condvar * global test ext done * failing moving test_ext because relay block num * relay_block_number issue fixed * backup * Test working with assertions * assertions get Test as arg * DispatchArgs as generic * clean up * backup * teleports for asset-hub-kusama done * improve assert_expected_events macro * rename Test generics * check assertions for tuples * test assertions redone * reserve_transfer_assets done * send transact done * hrmp test for paras * hrmp channels test done * hrmp channels test done 2 * before modifying test dispatch * reserve tests done & Test dispatch fixed * reserve transfer local asset * force_create_and_mint_asset * force create and mint done * tests done * fix imports in common * common events refactored * add option to events attributes * asset-hub-polkadot tests done * asset-hub-westend half done * relay chain events move to common * remove failing send tests for asset-hub-westend * added events to bridge-hub-rococo * added events to collectives-polkadot * cargo clean up * fix asset-hub-westend tests * ".git/.scripts/commands/fmt/fmt.sh" * fix clippy * ".git/.scripts/commands/fmt/fmt.sh" * Removed unnecessary deps * Extracted some commonality for Kusama/Polkadot (which will be reused also for BridgeHubs) (#2971) * Extracted some commonality for Kusama/Polkadot (which will be reused also for BridgeHubs) * AssetHubRococo should better use AssetHubKusama runtime * add fund_account --------- Co-authored-by: NachoPal <ignacio.palacios.santos@gmail.com> * address comments * rename event assertion helpers * clean comments * address comments 2 * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: Giles Cope <gilescope@gmail.com> Co-authored-by: command-bot <> Co-authored-by: Branislav Kontur <bkontur@gmail.com>
This commit is contained in:
@@ -29,7 +29,7 @@ pallet-xcm = { default-features = false, git = "https://github.com/paritytech/po
|
||||
# Cumulus
|
||||
parachains-common = { path = "../../../../common" }
|
||||
cumulus-pallet-xcmp-queue = { default-features = false, path = "../../../../../pallets/xcmp-queue" }
|
||||
bridge-hub-rococo-runtime = { path = "../../../../runtimes/bridge-hubs/bridge-hub-rococo" }
|
||||
cumulus-pallet-parachain-system = { path = "../../../../../pallets/parachain-system" }
|
||||
pallet-bridge-messages = { default-features = false, path = "../../../../../bridges/modules/messages" }
|
||||
bp-messages = { default-features = false, path = "../../../../../bridges/primitives/messages" }
|
||||
|
||||
|
||||
+51
-11
@@ -16,33 +16,73 @@
|
||||
|
||||
pub use bp_messages::LaneId;
|
||||
pub use codec::Encode;
|
||||
pub use frame_support::{assert_ok, pallet_prelude::Weight};
|
||||
pub use frame_support::{
|
||||
assert_err, assert_ok,
|
||||
instances::Instance1,
|
||||
pallet_prelude::Weight,
|
||||
sp_runtime::{AccountId32, DispatchError, DispatchResult, MultiAddress},
|
||||
traits::{fungibles::Inspect, OriginTrait},
|
||||
};
|
||||
pub use integration_tests_common::{
|
||||
constants::{
|
||||
accounts::{ALICE, BOB},
|
||||
rococo::{ED as ROCOCO_ED, ED as WOCOCO_ED},
|
||||
asset_hub_kusama::ED as ASSET_HUB_ROCOCO_ED,
|
||||
kusama::ED as ROCOCO_ED,
|
||||
PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3,
|
||||
},
|
||||
AccountId, AssetHubWococo, BridgeHubPolkadot, BridgeHubPolkadotPallet,
|
||||
BridgeHubPolkadotReceiver, BridgeHubPolkadotSender, BridgeHubRococo, BridgeHubRococoPallet,
|
||||
BridgeHubRococoReceiver, BridgeHubRococoSender, BridgeHubWococo, Collectives,
|
||||
CollectivesPallet, CollectivesReceiver, CollectivesSender, Kusama, KusamaPallet,
|
||||
PenpalPolkadot, PenpalPolkadotReceiver, PenpalPolkadotSender, Polkadot, PolkadotMockNet,
|
||||
PolkadotPallet, PolkadotReceiver, PolkadotSender, Rococo, RococoMockNet, RococoPallet,
|
||||
RococoReceiver, RococoSender,
|
||||
lazy_static::lazy_static,
|
||||
xcm_transact_paid_execution, xcm_transact_unpaid_execution, AssetHubRococo,
|
||||
AssetHubRococoPallet, AssetHubRococoReceiver, AssetHubRococoSender, AssetHubWococo,
|
||||
AssetHubWococoPallet, AssetHubWococoReceiver, AssetHubWococoSender, BridgeHubRococo,
|
||||
BridgeHubRococoPallet, BridgeHubRococoReceiver, BridgeHubRococoSender, BridgeHubWococo,
|
||||
BridgeHubWococoPallet, BridgeHubWococoReceiver, BridgeHubWococoSender, Collectives,
|
||||
CollectivesPallet, CollectivesReceiver, CollectivesSender, PenpalRococoA, PenpalRococoAPallet,
|
||||
PenpalRococoAReceiver, PenpalRococoASender, Rococo, RococoMockNet, RococoPallet,
|
||||
RococoReceiver, RococoSender, Wococo, WococoMockNet, WococoPallet, WococoReceiver,
|
||||
WococoSender,
|
||||
};
|
||||
// pub use polkadot_core_primitives::InboundDownwardMessage;
|
||||
pub use parachains_common::{AccountId, Balance};
|
||||
pub use polkadot_core_primitives::InboundDownwardMessage;
|
||||
pub use polkadot_parachain::primitives::{HrmpChannelId, Id};
|
||||
pub use polkadot_runtime_parachains::inclusion::{AggregateMessageOrigin, UmpQueueId};
|
||||
pub use xcm::{
|
||||
prelude::*,
|
||||
v3::{
|
||||
Error,
|
||||
NetworkId::{Rococo as RococoId, Wococo as WococoId},
|
||||
},
|
||||
DoubleEncoded,
|
||||
};
|
||||
pub use xcm_emulator::{
|
||||
assert_expected_events, bx, cumulus_pallet_dmp_queue, helpers::weight_within_threshold,
|
||||
Parachain as Para, RelayChain as Relay, TestExt,
|
||||
AccountId32Junction, Chain, ParaId, Parachain as Para, RelayChain as Relay, Test, TestArgs,
|
||||
TestContext, TestExt, TestExternalities,
|
||||
};
|
||||
|
||||
pub const ASSET_ID: u32 = 1;
|
||||
pub const ASSET_MIN_BALANCE: u128 = 1000;
|
||||
pub const ASSETS_PALLET_ID: u8 = 50;
|
||||
|
||||
pub type RelayToSystemParaTest = Test<Rococo, AssetHubRococo>;
|
||||
pub type SystemParaToRelayTest = Test<AssetHubRococo, Rococo>;
|
||||
pub type SystemParaToParaTest = Test<AssetHubRococo, PenpalRococoA>;
|
||||
|
||||
/// Returns a `TestArgs` instance to de used for the Relay Chain accross integraton tests
|
||||
pub fn relay_test_args(amount: Balance) -> TestArgs {
|
||||
TestArgs {
|
||||
dest: Rococo::child_location_of(AssetHubRococo::para_id()),
|
||||
beneficiary: AccountId32Junction {
|
||||
network: None,
|
||||
id: AssetHubRococoReceiver::get().into(),
|
||||
}
|
||||
.into(),
|
||||
amount,
|
||||
assets: (Here, amount).into(),
|
||||
asset_id: None,
|
||||
fee_asset_item: 0,
|
||||
weight_limit: WeightLimit::Unlimited,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ use crate::*;
|
||||
fn example() {
|
||||
// Init tests variables
|
||||
// XcmPallet send arguments
|
||||
let sudo_origin = <Rococo as Relay>::RuntimeOrigin::root();
|
||||
let sudo_origin = <Rococo as Chain>::RuntimeOrigin::root();
|
||||
let destination = Rococo::child_location_of(BridgeHubRococo::para_id()).into();
|
||||
let weight_limit = WeightLimit::Unlimited;
|
||||
let check_origin = None;
|
||||
@@ -45,7 +45,7 @@ fn example() {
|
||||
bx!(xcm),
|
||||
));
|
||||
|
||||
type RuntimeEvent = <Rococo as Relay>::RuntimeEvent;
|
||||
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
|
||||
|
||||
assert_expected_events!(
|
||||
Rococo,
|
||||
@@ -56,7 +56,7 @@ fn example() {
|
||||
});
|
||||
// Receive XCM message in Bridge Hub source Parachain
|
||||
BridgeHubRococo::execute_with(|| {
|
||||
type RuntimeEvent = <BridgeHubRococo as Para>::RuntimeEvent;
|
||||
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
|
||||
|
||||
assert_expected_events!(
|
||||
BridgeHubRococo,
|
||||
@@ -76,7 +76,7 @@ fn example() {
|
||||
// Wococo GLobal Consensus
|
||||
// Receive XCM message in Bridge Hub target Parachain
|
||||
BridgeHubWococo::execute_with(|| {
|
||||
type RuntimeEvent = <BridgeHubWococo as Para>::RuntimeEvent;
|
||||
type RuntimeEvent = <BridgeHubWococo as Chain>::RuntimeEvent;
|
||||
|
||||
assert_expected_events!(
|
||||
BridgeHubWococo,
|
||||
@@ -87,7 +87,7 @@ fn example() {
|
||||
});
|
||||
// Receive embeded XCM message within `ExportMessage` in Parachain destination
|
||||
AssetHubWococo::execute_with(|| {
|
||||
type RuntimeEvent = <AssetHubWococo as Para>::RuntimeEvent;
|
||||
type RuntimeEvent = <AssetHubWococo as Chain>::RuntimeEvent;
|
||||
|
||||
assert_expected_events!(
|
||||
AssetHubWococo,
|
||||
|
||||
Reference in New Issue
Block a user