Skip to content

Commit

Permalink
[integration-tests] align integration tests with latest vogue + split…
Browse files Browse the repository at this point in the history
…: `common` to `common` and `chains`

chore: Cargo.lock after encointer bump (wip)
  • Loading branch information
bkontur committed Jan 12, 2024
1 parent 3672de9 commit caca3b9
Show file tree
Hide file tree
Showing 27 changed files with 2,853 additions and 1,582 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
**/.criterion/
**/*.rs.bk
**/chains/
!integration-tests/emulated/chains
**/hfuzz_target/
**/hfuzz_workspace/
**/node_modules
Expand Down
66 changes: 61 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ members = [
"system-parachains/gluttons/glutton-kusama",
"integration-tests/emulated/assets/asset-hub-kusama",
"integration-tests/emulated/assets/asset-hub-polkadot",
"integration-tests/emulated/chains",
"integration-tests/emulated/common",
]

[profile.release]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,26 @@ frame-system = { version = "27.0.0" }
pallet-assets = { version = "28.0.0" }
pallet-balances = { version = "27.0.0" }
pallet-asset-conversion = { version = "9.0.0" }
pallet-message-queue = { version = "30.0.0" }

# Polkadot
polkadot-core-primitives = { version = "6.0.0" }
polkadot-parachain-primitives = { version = "5.0.0" }
polkadot-runtime-parachains = { version = "6.0.0" }
xcm = { package = "staging-xcm", version = "6.0.0" }
xcm-executor = { package = "staging-xcm-executor", default-features = false, version = "6.0.0" }
pallet-xcm = { version = "6.0.0" }

# Cumulus
parachains-common = { version = "6.0.0" }
xcm-emulator = { version = "0.4.0" }
asset-hub-kusama-runtime = { path = "../../../../system-parachains/asset-hubs/asset-hub-kusama" }
asset-test-utils = { version = "6.0.0" }

# Local
emulated-chains = { path = "../../chains" }
integration-tests-common = { path = "../../common" }
asset-hub-kusama-runtime = { path = "../../../../system-parachains/asset-hubs/asset-hub-kusama" }
kusama-runtime = { package = "staging-kusama-runtime", path = "../../../../relay/kusama" }

[features]
runtime-benchmarks = [
Expand Down
52 changes: 31 additions & 21 deletions integration-tests/emulated/assets/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,32 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg(not(feature = "runtime-benchmarks"))]

pub use asset_test_utils::xcm_helpers;
pub use codec::Encode;
pub use emulated_chains::{
asset_hub_kusama::ED as ASSET_HUB_KUSAMA_ED, kusama::ED as KUSAMA_ED,
AssetHubKusamaPara as AssetHubKusama, AssetHubKusamaParaPallet as AssetHubKusamaPallet,
AssetHubKusamaParaReceiver as AssetHubKusamaReceiver,
AssetHubKusamaParaSender as AssetHubKusamaSender, BridgeHubKusamaPara as BridgeHubKusama,
BridgeHubKusamaParaReceiver as BridgeHubKusamaReceiver, KusamaRelay as Kusama,
KusamaRelayPallet as KusamaPallet, KusamaRelayReceiver as KusamaReceiver,
KusamaRelaySender as KusamaSender, PenpalKusamaAPara as PenpalKusamaA,
PenpalKusamaAParaPallet as PenpalKusamaAPallet,
PenpalKusamaAParaReceiver as PenpalKusamaAReceiver,
PenpalKusamaAParaSender as PenpalKusamaASender, PenpalKusamaBPara as PenpalKusamaB,
PenpalKusamaBParaPallet as PenpalKusamaBPallet, PenpalLocalTeleportableToAssetHub,
PenpalXcmConfig,
};
pub use frame_support::{
assert_err, assert_ok,
pallet_prelude::Weight,
sp_runtime::{AccountId32, DispatchError, DispatchResult},
traits::fungibles::Inspect,
};
pub use integration_tests_common::{
constants::{
asset_hub_kusama::ED as ASSET_HUB_KUSAMA_ED, kusama::ED as KUSAMA_ED, PROOF_SIZE_THRESHOLD,
REF_TIME_THRESHOLD, XCM_V3,
},
xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
AssetHubKusama, AssetHubKusamaPallet, AssetHubKusamaReceiver, AssetHubKusamaSender, Kusama,
KusamaPallet, KusamaReceiver, KusamaSender, PenpalKusamaA, PenpalKusamaAPallet,
PenpalKusamaAReceiver, PenpalKusamaASender, PenpalKusamaB, PenpalKusamaBPallet,
test_parachain_is_trusted_teleporter,
xcm_helpers::{non_fee_asset, xcm_transact_paid_execution, xcm_transact_unpaid_execution},
PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3,
};
pub use parachains_common::{AccountId, Balance};
pub use xcm::{
Expand All @@ -48,18 +56,20 @@ pub const ASSET_MIN_BALANCE: u128 = 1000;
pub const ASSETS_PALLET_ID: u8 = 50;

pub type RelayToSystemParaTest = Test<Kusama, AssetHubKusama>;
pub type RelayToParaTest = Test<Kusama, PenpalKusamaA>;
pub type SystemParaToRelayTest = Test<AssetHubKusama, Kusama>;
pub type SystemParaToParaTest = Test<AssetHubKusama, PenpalKusamaA>;
pub type ParaToSystemParaTest = Test<PenpalKusamaA, AssetHubKusama>;

/// Returns a `TestArgs` instance to be used for the Relay Chain across integration tests
pub fn relay_test_args(amount: Balance) -> TestArgs {
pub fn relay_test_args(
dest: MultiLocation,
beneficiary_id: AccountId32,
amount: Balance,
) -> TestArgs {
TestArgs {
dest: Kusama::child_location_of(AssetHubKusama::para_id()),
beneficiary: AccountId32Junction {
network: None,
id: AssetHubKusamaReceiver::get().into(),
}
.into(),
dest,
beneficiary: AccountId32Junction { network: None, id: beneficiary_id.into() }.into(),
amount,
assets: (Here, amount).into(),
asset_id: None,
Expand All @@ -68,25 +78,25 @@ pub fn relay_test_args(amount: Balance) -> TestArgs {
}
}

/// Returns a `TestArgs` instance to be used for the System Parachain across integration tests
pub fn system_para_test_args(
/// Returns a `TestArgs` instance to be used by parachains across integration tests
pub fn para_test_args(
dest: MultiLocation,
beneficiary_id: AccountId32,
amount: Balance,
assets: MultiAssets,
asset_id: Option<u32>,
fee_asset_item: u32,
) -> TestArgs {
TestArgs {
dest,
beneficiary: AccountId32Junction { network: None, id: beneficiary_id.into() }.into(),
amount,
assets,
asset_id,
fee_asset_item: 0,
fee_asset_item,
weight_limit: WeightLimit::Unlimited,
}
}

#[cfg(test)]
#[cfg(not(feature = "runtime-benchmarks"))]
mod tests;
Loading

0 comments on commit caca3b9

Please sign in to comment.