Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate integration tests to paseo #139

Merged
merged 6 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
269 changes: 161 additions & 108 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ substrate-wasm-builder = "18.0.1"
substrate-build-script-utils = "11.0.0"

# Local
pop-runtime-devnet = { path = "runtime/devnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-testnet = { path = "runtime/testnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-devnet = { path = "runtime/devnet", default-features = true, features = ["experimental"] } # default-features=true required for `-p pop-node` builds
pop-runtime-testnet = { path = "runtime/testnet", default-features = true, features = ["experimental"] } # default-features=true required for `-p pop-node` builds
pop-runtime-common = { path = "runtime/common", default-features = false }
pop-primitives = { path = "./primitives", default-features = false }

Expand Down Expand Up @@ -131,14 +131,11 @@ polkadot-parachain-primitives = { version = "7.0.0", default-features = false }
polkadot-runtime-parachains = { version = "8.0.3", default-features = false }
polkadot-primitives = { version = "8.0.1", default-features = false }
polkadot-runtime-common = { version = "8.0.3", default-features = false }
rococo-runtime-constants = { version = "8.0.0", default-features = false }
rococo-runtime = { version = "8.0.1", default-features = false }
xcm = { package = "staging-xcm", version = "8.0.1", default-features = false }
xcm-builder = { package = "staging-xcm-builder", version = "8.0.3", default-features = false }
xcm-executor = { package = "staging-xcm-executor", version = "8.0.2", default-features = false }

# Cumulus
asset-hub-rococo-runtime = { version = "0.12.3", default-features = false }
asset-test-utils = { version = "8.0.1", default-features = false }
cumulus-pallet-aura-ext = { version = "0.8.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.8.1", default-features = false, features = ["parameterized-consensus-hook"] }
Expand All @@ -160,4 +157,9 @@ cumulus-client-collator = "0.8.0"
cumulus-client-consensus-aura = "0.8.0"
cumulus-client-consensus-common = "0.8.0"
cumulus-client-consensus-proposer = "0.8.0"
cumulus-client-service = "0.8.0"
cumulus-client-service = "0.8.0"

# Paseo
asset-hub-paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false }
paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false }
paseo-runtime-constants = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false }
24 changes: 14 additions & 10 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,50 @@ pallet-balances.workspace = true
pallet-message-queue.workspace = true
sp-core.workspace = true
sp-authority-discovery.workspace = true
sp-consensus-aura.workspace = true
sp-consensus-babe.workspace = true
sp-consensus-beefy.workspace = true
sp-consensus-grandpa.workspace = true
sp-runtime.workspace = true

# Polkadot
polkadot-primitives.workspace = true
rococo-runtime-constants.workspace = true
rococo-runtime.workspace = true
xcm.workspace = true
xcm-executor.workspace = true
polkadot-runtime-parachains.workspace = true
pallet-xcm.workspace = true

# Cumulus
asset-hub-rococo-runtime.workspace = true
asset-test-utils.workspace = true
cumulus-primitives-core.workspace = true
emulated-integration-tests-common.workspace = true

# Paseo
asset-hub-paseo-runtime.workspace = true
paseo-runtime.workspace = true
paseo-runtime-constants.workspace = true

# Local
pop-runtime-devnet.workspace = true
pop-runtime-common.workspace = true

[features]
default = ["std"]
std = [
"asset-hub-rococo-runtime/std",
"asset-hub-paseo-runtime/std",
"cumulus-primitives-core/std",
"frame-support/std",
"pallet-assets/std",
"pallet-balances/std",
"pallet-message-queue/std",
"pallet-xcm/std",
"paseo-runtime/std",
"paseo-runtime-constants/std",
"polkadot-primitives/std",
"polkadot-runtime-parachains/std",
"pop-runtime-devnet/std",
"rococo-runtime-constants/std",
"rococo-runtime/std",
"sp-authority-discovery/std",
"sp-consensus-aura/std",
"sp-consensus-babe/std",
"sp-consensus-beefy/std",
"sp-consensus-grandpa/std",
Expand All @@ -67,26 +71,26 @@ std = [
]

runtime-benchmarks = [
"asset-hub-rococo-runtime/runtime-benchmarks",
"asset-hub-paseo-runtime/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"paseo-runtime/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"pop-runtime-devnet/runtime-benchmarks",
"rococo-runtime/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]

try-runtime = [
"asset-hub-rococo-runtime/try-runtime",
"asset-hub-paseo-runtime/try-runtime",
"frame-support/try-runtime",
"pallet-assets/try-runtime",
"pallet-balances/std",
"pallet-message-queue/try-runtime",
"paseo-runtime/try-runtime",
"pop-runtime-devnet/try-runtime",
"rococo-runtime/try-runtime",
"sp-runtime/try-runtime",
]
60 changes: 60 additions & 0 deletions integration-tests/src/chains/asset_hub_paseo/genesis.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
use emulated_integration_tests_common::{
accounts, build_genesis_storage, get_account_id_from_seed, get_from_seed, SAFE_XCM_VERSION,
};
use polkadot_primitives::{AccountId, Balance};
use sp_core::{sr25519, storage::Storage};

pub(crate) const PARA_ID: u32 = 1000;
pub(crate) const ED: Balance = paseo_runtime_constants::currency::EXISTENTIAL_DEPOSIT / 10;

pub(crate) fn genesis() -> Storage {
let genesis_config = asset_hub_paseo_runtime::RuntimeGenesisConfig {
system: asset_hub_paseo_runtime::SystemConfig::default(),
balances: asset_hub_paseo_runtime::BalancesConfig {
balances: accounts::init_balances()
.iter()
.cloned()
.map(|k| (k, ED * 4096 * 4096))
.collect(),
},
parachain_info: asset_hub_paseo_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
..Default::default()
},
collator_selection: asset_hub_paseo_runtime::CollatorSelectionConfig {
invulnerables: invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: asset_hub_paseo_runtime::SessionConfig {
keys: invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
asset_hub_paseo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: asset_hub_paseo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
..Default::default()
};

build_genesis_storage(
&genesis_config,
asset_hub_paseo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
)
}

type AuraId = sp_consensus_aura::ed25519::AuthorityId;
pub fn invulnerables() -> Vec<(AccountId, AuraId)> {
vec![
(get_account_id_from_seed::<sr25519::Public>("Alice"), get_from_seed::<AuraId>("Alice")),
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_from_seed::<AuraId>("Bob")),
]
}
39 changes: 39 additions & 0 deletions integration-tests/src/chains/asset_hub_paseo/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
pub(crate) mod genesis;

use crate::chains::paseo::Paseo;
use emulated_integration_tests_common::{
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain,
impl_xcm_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
};
use frame_support::traits::OnInitialize;

// AssetHubPaseo Parachain declaration
decl_test_parachains! {
pub struct AssetHubPaseo {
genesis = genesis::genesis(),
on_init = {
asset_hub_paseo_runtime::AuraExt::on_initialize(1);
},
runtime = asset_hub_paseo_runtime,
core = {
XcmpMessageHandler: asset_hub_paseo_runtime::XcmpQueue,
LocationToAccountId: asset_hub_paseo_runtime::xcm_config::LocationToAccountId,
ParachainInfo: asset_hub_paseo_runtime::ParachainInfo,
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
},
pallets = {
PolkadotXcm: asset_hub_paseo_runtime::PolkadotXcm,
Assets: asset_hub_paseo_runtime::Assets,
ForeignAssets: asset_hub_paseo_runtime::ForeignAssets,
Balances: asset_hub_paseo_runtime::Balances,
}
},
}

// AssetHubPaseo implementation
impl_accounts_helpers_for_parachain!(AssetHubPaseo);
impl_assert_events_helpers_for_parachain!(AssetHubPaseo);
impl_assets_helpers_for_parachain!(AssetHubPaseo, Paseo);
impl_foreign_assets_helpers_for_parachain!(AssetHubPaseo, Paseo);
impl_xcm_helpers_for_parachain!(AssetHubPaseo);
52 changes: 0 additions & 52 deletions integration-tests/src/chains/asset_hub_rococo/genesis.rs

This file was deleted.

39 changes: 0 additions & 39 deletions integration-tests/src/chains/asset_hub_rococo/mod.rs

This file was deleted.

4 changes: 2 additions & 2 deletions integration-tests/src/chains/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub(crate) mod asset_hub_rococo;
pub(crate) mod asset_hub_paseo;
pub(crate) mod paseo;
pub(crate) mod pop_network;
pub(crate) mod rococo;
Loading
Loading