diff --git a/Cargo.lock b/Cargo.lock index 9fdb0d1c..9b0a66f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -425,16 +425,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] -name = "asset-hub-rococo-runtime" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af52c4d3011936f615f3469b3c20f8b13b861f4c06d097bc1922200ce44781d9" +name = "asset-hub-paseo-runtime" +version = "1.0.0" +source = "git+https://github.com/paseo-network/runtimes/?tag=v1.2.5-system-chains#e7265b10b28d8b82c3146e72c98895dac2b55729" dependencies = [ "assets-common", - "bp-asset-hub-rococo", - "bp-asset-hub-westend", - "bp-bridge-hub-rococo", - "bp-bridge-hub-westend", + "bp-asset-hub-paseo", + "bp-bridge-hub-paseo", "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", "cumulus-pallet-session-benchmarking", @@ -462,12 +459,10 @@ dependencies = [ "pallet-collator-selection", "pallet-message-queue", "pallet-multisig", - "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-proxy", "pallet-session", - "pallet-state-trie-migration", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -478,10 +473,11 @@ dependencies = [ "pallet-xcm-bridge-hub-router", "parachains-common", "parity-scale-codec", + "paseo-runtime-constants", + "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-runtime-common", "primitive-types", - "rococo-runtime-constants", "scale-info", "snowbridge-router-primitives", "sp-api", @@ -490,6 +486,7 @@ dependencies = [ "sp-core", "sp-genesis-builder", "sp-inherents", + "sp-io", "sp-offchain", "sp-runtime", "sp-session", @@ -503,7 +500,7 @@ dependencies = [ "staging-xcm-builder", "staging-xcm-executor", "substrate-wasm-builder", - "testnet-parachains-constants", + "system-parachains-constants", ] [[package]] @@ -1081,27 +1078,14 @@ dependencies = [ ] [[package]] -name = "bp-asset-hub-rococo" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbc4a97cc234685179ffb0b756e6a906acdae59e749e7b2202872da2c08478" -dependencies = [ - "bp-xcm-bridge-hub-router", - "frame-support", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "bp-asset-hub-westend" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eebe84c84f20d5147df985ff74d47f264628e14614c836e1230c688b9476462" +name = "bp-asset-hub-paseo" +version = "1.0.0" +source = "git+https://github.com/paseo-network/runtimes/?tag=v1.2.5-system-chains#e7265b10b28d8b82c3146e72c98895dac2b55729" dependencies = [ - "bp-xcm-bridge-hub-router", "frame-support", - "parity-scale-codec", - "scale-info", + "sp-std", + "staging-xcm", + "system-parachains-constants", ] [[package]] @@ -1121,33 +1105,21 @@ dependencies = [ ] [[package]] -name = "bp-bridge-hub-rococo" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a9fd41ffa36ae08acf7da242a023703a7a6162d8aa2b8c06593f48f0c6c771" -dependencies = [ - "bp-bridge-hub-cumulus", - "bp-messages", - "bp-runtime", - "frame-support", - "sp-api", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "bp-bridge-hub-westend" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b65039a3c5aa8652f3dad6a2d6dc3948eff24333a30f2528bc34fc406e38819" +name = "bp-bridge-hub-paseo" +version = "1.0.0" +source = "git+https://github.com/paseo-network/runtimes/?tag=v1.2.5-system-chains#e7265b10b28d8b82c3146e72c98895dac2b55729" dependencies = [ "bp-bridge-hub-cumulus", "bp-messages", "bp-runtime", "frame-support", + "parity-scale-codec", + "scale-info", + "snowbridge-core", "sp-api", "sp-runtime", "sp-std", + "staging-xcm", ] [[package]] @@ -4510,7 +4482,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -4723,7 +4695,7 @@ dependencies = [ name = "integration-tests" version = "0.0.0" dependencies = [ - "asset-hub-rococo-runtime", + "asset-hub-paseo-runtime", "asset-test-utils", "cumulus-primitives-core", "emulated-integration-tests-common", @@ -4733,13 +4705,14 @@ dependencies = [ "pallet-message-queue", "pallet-xcm", "parity-scale-codec", + "paseo-runtime", + "paseo-runtime-constants", "polkadot-primitives", "polkadot-runtime-parachains", "pop-runtime-common", "pop-runtime-devnet", - "rococo-runtime", - "rococo-runtime-constants", "sp-authority-discovery", + "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", @@ -7431,9 +7404,9 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" -version = "26.0.0" +version = "26.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f14519c1c613d2f8c95c27015864c11a37969a23deeba9f6dbaff4276e1b81c" +checksum = "b62091305ec7426e71c3da2b0944c2df5a804109ee4d2e8f4fe34865e049f8ac" dependencies = [ "frame-support", "frame-system", @@ -7758,9 +7731,9 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" -version = "15.0.0" +version = "15.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237d7b5a10cb6cba727c3e957fb241776302aa3cce589e6759ba53f50129c1a5" +checksum = "e47c73850103db30b61ef170107afe1ef0dab6905c495bd6dfb57b3c1dd81bc7" dependencies = [ "parity-scale-codec", "sp-api", @@ -8131,9 +8104,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -8146,11 +8119,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ - "proc-macro-crate 2.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 1.0.109", @@ -8257,6 +8230,116 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156" +[[package]] +name = "paseo-runtime" +version = "1.2.5" +source = "git+https://github.com/paseo-network/runtimes/?tag=v1.2.5-system-chains#e7265b10b28d8b82c3146e72c98895dac2b55729" +dependencies = [ + "binary-merkle-tree", + "frame-benchmarking", + "frame-election-provider-support", + "frame-executive", + "frame-metadata-hash-extension", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "log", + "pallet-asset-rate", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-bags-list", + "pallet-balances", + "pallet-beefy", + "pallet-beefy-mmr", + "pallet-bounties", + "pallet-child-bounties", + "pallet-conviction-voting", + "pallet-election-provider-multi-phase", + "pallet-election-provider-support-benchmarking", + "pallet-fast-unstake", + "pallet-grandpa", + "pallet-identity", + "pallet-indices", + "pallet-message-queue", + "pallet-mmr", + "pallet-multisig", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", + "pallet-offences", + "pallet-offences-benchmarking", + "pallet-preimage", + "pallet-proxy", + "pallet-referenda", + "pallet-scheduler", + "pallet-session", + "pallet-session-benchmarking", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-staking-reward-fn", + "pallet-staking-runtime-api", + "pallet-state-trie-migration", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-whitelist", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parity-scale-codec", + "paseo-runtime-constants", + "polkadot-primitives", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-authority-discovery", + "sp-block-builder", + "sp-consensus-babe", + "sp-consensus-beefy", + "sp-core", + "sp-debug-derive", + "sp-genesis-builder", + "sp-inherents", + "sp-io", + "sp-npos-elections", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "paseo-runtime-constants" +version = "1.0.0" +source = "git+https://github.com/paseo-network/runtimes/?tag=v1.2.5-system-chains#e7265b10b28d8b82c3146e72c98895dac2b55729" +dependencies = [ + "frame-support", + "polkadot-primitives", + "polkadot-runtime-common", + "smallvec", + "sp-core", + "sp-runtime", + "sp-weights", + "staging-xcm-builder", +] + [[package]] name = "paste" version = "1.0.14" @@ -9974,15 +10057,6 @@ dependencies = [ "toml_edit 0.19.15", ] -[[package]] -name = "proc-macro-crate" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" -dependencies = [ - "toml_edit 0.20.7", -] - [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -14420,6 +14494,20 @@ dependencies = [ "libc", ] +[[package]] +name = "system-parachains-constants" +version = "1.0.0" +source = "git+https://github.com/paseo-network/runtimes/?tag=v1.2.5-system-chains#e7265b10b28d8b82c3146e72c98895dac2b55729" +dependencies = [ + "frame-support", + "parachains-common", + "paseo-runtime-constants", + "polkadot-core-primitives", + "polkadot-primitives", + "smallvec", + "sp-runtime", +] + [[package]] name = "tap" version = "1.0.1" @@ -14469,21 +14557,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" -[[package]] -name = "testnet-parachains-constants" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ff23c25f39d64b930ab9d721643d0c780a66201c7f1da34fac6982752626bf5" -dependencies = [ - "frame-support", - "polkadot-core-primitives", - "rococo-runtime-constants", - "smallvec", - "sp-runtime", - "staging-xcm", - "westend-runtime-constants", -] - [[package]] name = "thiserror" version = "1.0.58" @@ -14768,17 +14841,6 @@ dependencies = [ "winnow 0.5.40", ] -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.2.6", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.21.1" @@ -15911,7 +15973,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core 0.51.1", + "windows-core", "windows-targets 0.48.5", ] @@ -15924,15 +15986,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.4", -] - [[package]] name = "windows-sys" version = "0.45.0" diff --git a/Cargo.toml b/Cargo.toml index 7d2795fd..1b1bcd7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 } @@ -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"] } @@ -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" \ No newline at end of file +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 } \ No newline at end of file diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 03178735..0a427f8a 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -17,6 +17,7 @@ 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 @@ -24,19 +25,21 @@ 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 @@ -44,19 +47,20 @@ 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", @@ -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", ] diff --git a/integration-tests/src/chains/asset_hub_paseo/genesis.rs b/integration-tests/src/chains/asset_hub_paseo/genesis.rs new file mode 100644 index 00000000..5d73eb3b --- /dev/null +++ b/integration-tests/src/chains/asset_hub_paseo/genesis.rs @@ -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::("Alice"), get_from_seed::("Alice")), + (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), + ] +} diff --git a/integration-tests/src/chains/asset_hub_paseo/mod.rs b/integration-tests/src/chains/asset_hub_paseo/mod.rs new file mode 100644 index 00000000..51dae063 --- /dev/null +++ b/integration-tests/src/chains/asset_hub_paseo/mod.rs @@ -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); diff --git a/integration-tests/src/chains/asset_hub_rococo/genesis.rs b/integration-tests/src/chains/asset_hub_rococo/genesis.rs deleted file mode 100644 index a6a36edf..00000000 --- a/integration-tests/src/chains/asset_hub_rococo/genesis.rs +++ /dev/null @@ -1,52 +0,0 @@ -use emulated_integration_tests_common::{ - accounts, build_genesis_storage, collators, SAFE_XCM_VERSION, -}; -use pop_runtime_common::Balance; -use sp_core::storage::Storage; - -pub(crate) const PARA_ID: u32 = 1000; -pub(crate) const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT / 10; - -pub(crate) fn genesis() -> Storage { - let genesis_config = asset_hub_rococo_runtime::RuntimeGenesisConfig { - system: asset_hub_rococo_runtime::SystemConfig::default(), - balances: asset_hub_rococo_runtime::BalancesConfig { - balances: accounts::init_balances() - .iter() - .cloned() - .map(|k| (k, ED * 4096 * 4096)) - .collect(), - }, - parachain_info: asset_hub_rococo_runtime::ParachainInfoConfig { - parachain_id: PARA_ID.into(), - ..Default::default() - }, - collator_selection: asset_hub_rococo_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: ED * 16, - ..Default::default() - }, - session: asset_hub_rococo_runtime::SessionConfig { - keys: collators::invulnerables() - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - asset_hub_rococo_runtime::SessionKeys { aura }, // session keys - ) - }) - .collect(), - }, - polkadot_xcm: asset_hub_rococo_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - ..Default::default() - }, - ..Default::default() - }; - - build_genesis_storage( - &genesis_config, - asset_hub_rococo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"), - ) -} diff --git a/integration-tests/src/chains/asset_hub_rococo/mod.rs b/integration-tests/src/chains/asset_hub_rococo/mod.rs deleted file mode 100644 index 4f119eaa..00000000 --- a/integration-tests/src/chains/asset_hub_rococo/mod.rs +++ /dev/null @@ -1,39 +0,0 @@ -pub(crate) mod genesis; - -use crate::chains::rococo::Rococo; -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; - -// AssetHubRococo Parachain declaration -decl_test_parachains! { - pub struct AssetHubRococo { - genesis = genesis::genesis(), - on_init = { - asset_hub_rococo_runtime::AuraExt::on_initialize(1); - }, - runtime = asset_hub_rococo_runtime, - core = { - XcmpMessageHandler: asset_hub_rococo_runtime::XcmpQueue, - LocationToAccountId: asset_hub_rococo_runtime::xcm_config::LocationToAccountId, - ParachainInfo: asset_hub_rococo_runtime::ParachainInfo, - MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, - }, - pallets = { - PolkadotXcm: asset_hub_rococo_runtime::PolkadotXcm, - Assets: asset_hub_rococo_runtime::Assets, - ForeignAssets: asset_hub_rococo_runtime::ForeignAssets, - Balances: asset_hub_rococo_runtime::Balances, - } - }, -} - -// AssetHubRococo implementation -impl_accounts_helpers_for_parachain!(AssetHubRococo); -impl_assert_events_helpers_for_parachain!(AssetHubRococo); -impl_assets_helpers_for_parachain!(AssetHubRococo, Rococo); -impl_foreign_assets_helpers_for_parachain!(AssetHubRococo, Rococo); -impl_xcm_helpers_for_parachain!(AssetHubRococo); diff --git a/integration-tests/src/chains/mod.rs b/integration-tests/src/chains/mod.rs index e9c4a651..429c6691 100644 --- a/integration-tests/src/chains/mod.rs +++ b/integration-tests/src/chains/mod.rs @@ -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; diff --git a/integration-tests/src/chains/rococo/genesis.rs b/integration-tests/src/chains/paseo/genesis.rs similarity index 64% rename from integration-tests/src/chains/rococo/genesis.rs rename to integration-tests/src/chains/paseo/genesis.rs index 9db707c4..d4c29ca2 100644 --- a/integration-tests/src/chains/rococo/genesis.rs +++ b/integration-tests/src/chains/paseo/genesis.rs @@ -2,16 +2,16 @@ use emulated_integration_tests_common::{ accounts, build_genesis_storage, get_account_id_from_seed, get_from_seed, get_host_config, validators, }; +use paseo_runtime_constants::currency::UNITS as PAS; use polkadot_primitives::{AssignmentId, Balance, ValidatorId}; -use rococo_runtime_constants::currency::UNITS as ROC; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, storage::Storage}; -pub(crate) const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; -const ENDOWMENT: u128 = 1_000_000 * ROC; +pub(crate) const ED: Balance = paseo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; +const ENDOWMENT: u128 = 1_000_000 * PAS; fn session_keys( babe: BabeId, @@ -20,8 +20,8 @@ fn session_keys( para_assignment: AssignmentId, authority_discovery: AuthorityDiscoveryId, beefy: BeefyId, -) -> rococo_runtime::SessionKeys { - rococo_runtime::SessionKeys { +) -> paseo_runtime::SessionKeys { + paseo_runtime::SessionKeys { babe, grandpa, para_validator, @@ -32,12 +32,12 @@ fn session_keys( } pub(crate) fn genesis() -> Storage { - let genesis_config = rococo_runtime::RuntimeGenesisConfig { - system: rococo_runtime::SystemConfig::default(), - balances: rococo_runtime::BalancesConfig { + let genesis_config = paseo_runtime::RuntimeGenesisConfig { + system: paseo_runtime::SystemConfig::default(), + balances: paseo_runtime::BalancesConfig { balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(), }, - session: rococo_runtime::SessionConfig { + session: paseo_runtime::SessionConfig { keys: validators::initial_authorities() .iter() .map(|x| { @@ -56,21 +56,21 @@ pub(crate) fn genesis() -> Storage { }) .collect::>(), }, - babe: rococo_runtime::BabeConfig { + babe: paseo_runtime::BabeConfig { authorities: Default::default(), - epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), + epoch_config: Some(paseo_runtime::BABE_GENESIS_EPOCH_CONFIG), ..Default::default() }, - sudo: rococo_runtime::SudoConfig { + sudo: paseo_runtime::SudoConfig { key: Some(get_account_id_from_seed::("Alice")), }, - configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() }, - registrar: rococo_runtime::RegistrarConfig { + configuration: paseo_runtime::ConfigurationConfig { config: get_host_config() }, + registrar: paseo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, ..Default::default() }, ..Default::default() }; - build_genesis_storage(&genesis_config, rococo_runtime::WASM_BINARY.unwrap()) + build_genesis_storage(&genesis_config, paseo_runtime::WASM_BINARY.unwrap()) } diff --git a/integration-tests/src/chains/paseo/mod.rs b/integration-tests/src/chains/paseo/mod.rs new file mode 100644 index 00000000..735807e5 --- /dev/null +++ b/integration-tests/src/chains/paseo/mod.rs @@ -0,0 +1,32 @@ +pub(crate) mod genesis; + +use emulated_integration_tests_common::{ + impl_accounts_helpers_for_relay_chain, impl_assert_events_helpers_for_relay_chain, + impl_hrmp_channels_helpers_for_relay_chain, impl_send_transact_helpers_for_relay_chain, + xcm_emulator::decl_test_relay_chains, +}; + +// Paseo declaration +decl_test_relay_chains! { + #[api_version(10)] + pub struct Paseo { + genesis = genesis::genesis(), + on_init = (), + runtime = paseo_runtime, + core = { + SovereignAccountOf: paseo_runtime::xcm_config::SovereignAccountOf, + }, + pallets = { + XcmPallet: paseo_runtime::XcmPallet, + Sudo: paseo_runtime::Sudo, + Balances: paseo_runtime::Balances, + Hrmp: paseo_runtime::Hrmp, + } + }, +} + +// Paseo implementation +impl_accounts_helpers_for_relay_chain!(Paseo); +impl_assert_events_helpers_for_relay_chain!(Paseo); +impl_hrmp_channels_helpers_for_relay_chain!(Paseo); +impl_send_transact_helpers_for_relay_chain!(Paseo); diff --git a/integration-tests/src/chains/pop_network/mod.rs b/integration-tests/src/chains/pop_network/mod.rs index bec90394..42b2cc2e 100644 --- a/integration-tests/src/chains/pop_network/mod.rs +++ b/integration-tests/src/chains/pop_network/mod.rs @@ -1,6 +1,6 @@ pub(crate) mod genesis; -use crate::chains::rococo::Rococo; +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_xcm_helpers_for_parachain, impls::Parachain, @@ -33,5 +33,5 @@ decl_test_parachains! { // PopNetwork implementation impl_accounts_helpers_for_parachain!(PopNetwork); impl_assert_events_helpers_for_parachain!(PopNetwork); -impl_assets_helpers_for_parachain!(PopNetwork, Rococo); +impl_assets_helpers_for_parachain!(PopNetwork, Paseo); impl_xcm_helpers_for_parachain!(PopNetwork); diff --git a/integration-tests/src/chains/rococo/mod.rs b/integration-tests/src/chains/rococo/mod.rs deleted file mode 100644 index 71d6f1ef..00000000 --- a/integration-tests/src/chains/rococo/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -pub(crate) mod genesis; - -use emulated_integration_tests_common::{ - impl_accounts_helpers_for_relay_chain, impl_assert_events_helpers_for_relay_chain, - impl_hrmp_channels_helpers_for_relay_chain, impl_send_transact_helpers_for_relay_chain, - xcm_emulator::decl_test_relay_chains, -}; - -// Rococo declaration -decl_test_relay_chains! { - #[api_version(10)] - pub struct Rococo { - genesis = genesis::genesis(), - on_init = (), - runtime = rococo_runtime, - core = { - SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, - }, - pallets = { - XcmPallet: rococo_runtime::XcmPallet, - Sudo: rococo_runtime::Sudo, - Balances: rococo_runtime::Balances, - Hrmp: rococo_runtime::Hrmp, - } - }, -} - -// Rococo implementation -impl_accounts_helpers_for_relay_chain!(Rococo); -impl_assert_events_helpers_for_relay_chain!(Rococo); -impl_hrmp_channels_helpers_for_relay_chain!(Rococo); -impl_send_transact_helpers_for_relay_chain!(Rococo); diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index 31e9860b..c42035f9 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -1,13 +1,13 @@ #![cfg(test)] use crate::chains::{ - asset_hub_rococo::{genesis::ED as ASSET_HUB_ROCOCO_ED, AssetHubRococoParaPallet}, + asset_hub_paseo::{genesis::ED as ASSET_HUB_PASEO_ED, AssetHubPaseoParaPallet}, + paseo::{genesis::ED as PASEO_ED, PaseoRelayPallet}, pop_network::PopNetworkParaPallet, - rococo::{genesis::ED as ROCOCO_ED, RococoRelayPallet}, }; -use asset_hub_rococo_runtime::xcm_config::XcmConfig as AssetHubRococoXcmConfig; +use asset_hub_paseo_runtime::xcm_config::XcmConfig as AssetHubPaseoXcmConfig; use asset_test_utils::xcm_helpers; -use chains::{asset_hub_rococo::AssetHubRococo, pop_network::PopNetwork, rococo::Rococo}; +use chains::{asset_hub_paseo::AssetHubPaseo, paseo::Paseo, pop_network::PopNetwork}; use emulated_integration_tests_common::{ accounts::{ALICE, BOB}, xcm_emulator::{ @@ -16,27 +16,20 @@ use emulated_integration_tests_common::{ RelayChain as Relay, Test, TestArgs, TestContext, TestExt, }, }; -use frame_support::{ - dispatch::RawOrigin, pallet_prelude::Weight, sp_runtime::traits::Dispatchable, - sp_runtime::DispatchResult, -}; -use polkadot_runtime_parachains::assigner_on_demand; +use frame_support::{pallet_prelude::Weight, sp_runtime::DispatchResult}; +use paseo_runtime::xcm_config::XcmConfig as PaseoXcmConfig; use pop_runtime_common::Balance; -use pop_runtime_devnet as pop_runtime; use pop_runtime_devnet::config::xcm::XcmConfig as PopNetworkXcmConfig; -use rococo_runtime::xcm_config::XcmConfig as RococoXcmConfig; -use sp_core::Encode; use xcm::prelude::*; -use xcm_executor::traits::QueryHandler; mod chains; decl_test_networks! { // `pub` mandatory for the macro - pub struct RococoMockNet { - relay_chain = Rococo, + pub struct PaseoMockNet { + relay_chain = Paseo, parachains = vec![ - AssetHubRococo, + AssetHubPaseo, PopNetwork, ], bridge = () @@ -44,28 +37,28 @@ decl_test_networks! { } decl_test_sender_receiver_accounts_parameter_types! { - RococoRelay { sender: ALICE, receiver: BOB }, - AssetHubRococoPara { sender: ALICE, receiver: BOB }, + PaseoRelay { sender: ALICE, receiver: BOB }, + AssetHubPaseoPara { sender: ALICE, receiver: BOB }, PopNetworkPara { sender: ALICE, receiver: BOB} } -type RelayToParaTest = Test; -type SystemParaToParaTest = Test; -type ParaToSystemParaTest = Test; -type ParaToRelayTest = Test; +type RelayToParaTest = Test; +type SystemParaToParaTest = Test; +type ParaToSystemParaTest = Test; +type ParaToRelayTest = Test; fn relay_to_para_sender_assertions(t: RelayToParaTest) { - type RuntimeEvent = ::RuntimeEvent; - RococoRelay::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8_799))); + type RuntimeEvent = ::RuntimeEvent; + PaseoRelay::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8_799))); assert_expected_events!( - RococoRelay, + PaseoRelay, vec![ // Amount to reserve transfer is transferred to Parachain's Sovereign account RuntimeEvent::Balances( pallet_balances::Event::Transfer { from, to, amount } ) => { from: *from == t.sender.account_id, - to: *to == RococoRelay::sovereign_account_id_of( + to: *to == PaseoRelay::sovereign_account_id_of( t.args.dest.clone() ), amount: *amount == t.args.amount, @@ -75,20 +68,20 @@ fn relay_to_para_sender_assertions(t: RelayToParaTest) { } fn system_para_to_para_sender_assertions(t: SystemParaToParaTest) { - type RuntimeEvent = ::RuntimeEvent; - AssetHubRococoPara::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts( + type RuntimeEvent = ::RuntimeEvent; + AssetHubPaseoPara::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts( 864_610_000, 8_799, ))); assert_expected_events!( - AssetHubRococoPara, + AssetHubPaseoPara, vec![ // Amount to reserve transfer is transferred to Parachain's Sovereign account RuntimeEvent::Balances( pallet_balances::Event::Transfer { from, to, amount } ) => { from: *from == t.sender.account_id, - to: *to == AssetHubRococoPara::sovereign_account_id_of( + to: *to == AssetHubPaseoPara::sovereign_account_id_of( t.args.dest.clone() ), amount: *amount == t.args.amount, @@ -151,21 +144,21 @@ fn para_to_relay_sender_assertions(t: ParaToRelayTest) { } fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) { - type RuntimeEvent = ::RuntimeEvent; - let sov_pop_net_on_ahr = AssetHubRococoPara::sovereign_account_id_of( - AssetHubRococoPara::sibling_location_of(PopNetworkPara::para_id()), + type RuntimeEvent = ::RuntimeEvent; + let sov_pop_net_on_ahr = AssetHubPaseoPara::sovereign_account_id_of( + AssetHubPaseoPara::sibling_location_of(PopNetworkPara::para_id()), ); assert_expected_events!( - AssetHubRococoPara, + AssetHubPaseoPara, vec![ // Amount to reserve transfer is withdrawn from Parachain's Sovereign account RuntimeEvent::Balances( - pallet_balances::Event::Withdraw { who, amount } + pallet_balances::Event::Burned { who, amount } ) => { who: *who == sov_pop_net_on_ahr.clone().into(), amount: *amount == t.args.amount, }, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {}, + RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {}, RuntimeEvent::MessageQueue( pallet_message_queue::Event::Processed { success: true, .. } ) => {}, @@ -174,21 +167,21 @@ fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) { } fn para_to_relay_receiver_assertions(t: ParaToRelayTest) { - type RuntimeEvent = ::RuntimeEvent; - let sov_pop_net_on_relay = RococoRelay::sovereign_account_id_of( - RococoRelay::child_location_of(PopNetworkPara::para_id()), - ); + type RuntimeEvent = ::RuntimeEvent; + let sov_pop_net_on_relay = PaseoRelay::sovereign_account_id_of(PaseoRelay::child_location_of( + PopNetworkPara::para_id(), + )); assert_expected_events!( - RococoRelay, + PaseoRelay, vec![ // Amount to reserve transfer is withdrawn from Parachain's Sovereign account RuntimeEvent::Balances( - pallet_balances::Event::Withdraw { who, amount } + pallet_balances::Event::Burned { who, amount } ) => { who: *who == sov_pop_net_on_relay.clone().into(), amount: *amount == t.args.amount, }, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {}, + RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {}, RuntimeEvent::MessageQueue( pallet_message_queue::Event::Processed { success: true, .. } ) => {}, @@ -197,7 +190,7 @@ fn para_to_relay_receiver_assertions(t: ParaToRelayTest) { } fn relay_to_para_reserve_transfer_assets(t: RelayToParaTest) -> DispatchResult { - ::XcmPallet::limited_reserve_transfer_assets( + ::XcmPallet::limited_reserve_transfer_assets( t.signed_origin, bx!(t.args.dest.into()), bx!(t.args.beneficiary.into()), @@ -208,7 +201,7 @@ fn relay_to_para_reserve_transfer_assets(t: RelayToParaTest) -> DispatchResult { } fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> DispatchResult { - ::PolkadotXcm::limited_reserve_transfer_assets( + ::PolkadotXcm::limited_reserve_transfer_assets( t.signed_origin, bx!(t.args.dest.into()), bx!(t.args.beneficiary.into()), @@ -246,7 +239,7 @@ fn fund_pop_from_relay( amount_to_send: Balance, beneficiary: sp_runtime::AccountId32, ) { - let destination = RococoRelay::child_location_of(PopNetworkPara::para_id()); + let destination = PaseoRelay::child_location_of(PopNetworkPara::para_id()); let test_args = TestContext { sender, receiver: beneficiary.clone(), @@ -254,7 +247,7 @@ fn fund_pop_from_relay( }; let mut test = RelayToParaTest::new(test_args); - test.set_dispatchable::(relay_to_para_reserve_transfer_assets); + test.set_dispatchable::(relay_to_para_reserve_transfer_assets); test.assert(); } @@ -265,7 +258,7 @@ fn fund_pop_from_system_para( beneficiary: sp_runtime::AccountId32, assets: Assets, ) { - let destination = AssetHubRococoPara::sibling_location_of(PopNetworkPara::para_id()); + let destination = AssetHubPaseoPara::sibling_location_of(PopNetworkPara::para_id()); let test_args = TestContext { sender, receiver: beneficiary.clone(), @@ -273,7 +266,7 @@ fn fund_pop_from_system_para( }; let mut test = SystemParaToParaTest::new(test_args); - test.set_dispatchable::(system_para_to_para_reserve_transfer_assets); + test.set_dispatchable::(system_para_to_para_reserve_transfer_assets); test.assert(); } @@ -283,12 +276,12 @@ fn reserve_transfer_native_asset_from_relay_to_para() { init_tracing(); // Init values for Relay - let destination = RococoRelay::child_location_of(PopNetworkPara::para_id()); + let destination = PaseoRelay::child_location_of(PopNetworkPara::para_id()); let beneficiary_id = PopNetworkParaReceiver::get(); - let amount_to_send: Balance = ROCOCO_ED * 1000; + let amount_to_send: Balance = PASEO_ED * 1000; let test_args = TestContext { - sender: RococoRelaySender::get(), + sender: PaseoRelaySender::get(), receiver: PopNetworkParaReceiver::get(), args: TestArgs::new_relay(destination, beneficiary_id, amount_to_send), }; @@ -298,14 +291,14 @@ fn reserve_transfer_native_asset_from_relay_to_para() { let sender_balance_before = test.sender.balance; let receiver_balance_before = test.receiver.balance; - test.set_assertion::(relay_to_para_sender_assertions); + test.set_assertion::(relay_to_para_sender_assertions); test.set_assertion::(para_receiver_assertions); - test.set_dispatchable::(relay_to_para_reserve_transfer_assets); + test.set_dispatchable::(relay_to_para_reserve_transfer_assets); test.assert(); - let delivery_fees = RococoRelay::execute_with(|| { + let delivery_fees = PaseoRelay::execute_with(|| { xcm_helpers::transfer_assets_delivery_fees::< - ::XcmSender, + ::XcmSender, >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) }); @@ -329,18 +322,18 @@ fn reserve_transfer_native_asset_from_para_to_relay() { // Setup: reserve transfer from relay to Pop, so that sovereign account accurate for return // transfer - let amount_to_send: Balance = ROCOCO_ED * 1_000; - fund_pop_from_relay(RococoRelaySender::get(), amount_to_send, PopNetworkParaReceiver::get()); // alice on relay > bob on pop + let amount_to_send: Balance = PASEO_ED * 1_000; + fund_pop_from_relay(PaseoRelaySender::get(), amount_to_send, PopNetworkParaReceiver::get()); // alice on relay > bob on pop // Init values for Pop Network Parachain let destination = PopNetworkPara::parent_location(); // relay - let beneficiary_id = RococoRelayReceiver::get(); // bob on relay + let beneficiary_id = PaseoRelayReceiver::get(); // bob on relay let amount_to_send = PopNetworkPara::account_data_of(PopNetworkParaReceiver::get()).free; // bob on pop balance let assets = (Parent, amount_to_send).into(); let test_args = TestContext { sender: PopNetworkParaReceiver::get(), // bob on pop - receiver: RococoRelayReceiver::get(), // bob on relay + receiver: PaseoRelayReceiver::get(), // bob on relay args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0), }; @@ -350,7 +343,7 @@ fn reserve_transfer_native_asset_from_para_to_relay() { let receiver_balance_before = test.receiver.balance; test.set_assertion::(para_to_relay_sender_assertions); - test.set_assertion::(para_to_relay_receiver_assertions); + test.set_assertion::(para_to_relay_receiver_assertions); test.set_dispatchable::(para_to_relay_reserve_transfer_assets); test.assert(); @@ -379,13 +372,13 @@ fn reserve_transfer_native_asset_from_system_para_to_para() { init_tracing(); // Init values for System Parachain - let destination = AssetHubRococoPara::sibling_location_of(PopNetworkPara::para_id()); + let destination = AssetHubPaseoPara::sibling_location_of(PopNetworkPara::para_id()); let beneficiary_id = PopNetworkParaReceiver::get(); - let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000; + let amount_to_send: Balance = ASSET_HUB_PASEO_ED * 1000; let assets = (Parent, amount_to_send).into(); let test_args = TestContext { - sender: AssetHubRococoParaSender::get(), + sender: AssetHubPaseoParaSender::get(), receiver: PopNetworkParaReceiver::get(), args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0), }; @@ -395,17 +388,17 @@ fn reserve_transfer_native_asset_from_system_para_to_para() { let sender_balance_before = test.sender.balance; let receiver_balance_before = test.receiver.balance; - test.set_assertion::(system_para_to_para_sender_assertions); + test.set_assertion::(system_para_to_para_sender_assertions); test.set_assertion::(para_receiver_assertions); - test.set_dispatchable::(system_para_to_para_reserve_transfer_assets); + test.set_dispatchable::(system_para_to_para_reserve_transfer_assets); test.assert(); let sender_balance_after = test.sender.balance; let receiver_balance_after = test.receiver.balance; - let delivery_fees = AssetHubRococoPara::execute_with(|| { + let delivery_fees = AssetHubPaseoPara::execute_with(|| { xcm_helpers::transfer_assets_delivery_fees::< - ::XcmSender, + ::XcmSender, >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) }); @@ -425,23 +418,23 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { init_tracing(); // Setup: reserve transfer from AH to Pop, so that sovereign account accurate for return transfer - let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000; + let amount_to_send: Balance = ASSET_HUB_PASEO_ED * 1000; fund_pop_from_system_para( - AssetHubRococoParaSender::get(), + AssetHubPaseoParaSender::get(), amount_to_send, PopNetworkParaReceiver::get(), (Parent, amount_to_send).into(), ); // alice on asset hub > bob on pop // Init values for Pop Network Parachain - let destination = PopNetworkPara::sibling_location_of(AssetHubRococoPara::para_id()); - let beneficiary_id = AssetHubRococoParaReceiver::get(); // bob on asset hub + let destination = PopNetworkPara::sibling_location_of(AssetHubPaseoPara::para_id()); + let beneficiary_id = AssetHubPaseoParaReceiver::get(); // bob on asset hub let amount_to_send = PopNetworkPara::account_data_of(PopNetworkParaReceiver::get()).free; // bob on pop balance let assets = (Parent, amount_to_send).into(); let test_args = TestContext { - sender: PopNetworkParaReceiver::get(), // bob on pop - receiver: AssetHubRococoParaReceiver::get(), // bob on asset hub + sender: PopNetworkParaReceiver::get(), // bob on pop + receiver: AssetHubPaseoParaReceiver::get(), // bob on asset hub args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0), }; @@ -451,15 +444,15 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { let receiver_balance_before = test.receiver.balance; let pop_net_location_as_seen_by_ahr = - AssetHubRococoPara::sibling_location_of(PopNetworkPara::para_id()); + AssetHubPaseoPara::sibling_location_of(PopNetworkPara::para_id()); let sov_pop_net_on_ahr = - AssetHubRococoPara::sovereign_account_id_of(pop_net_location_as_seen_by_ahr); + AssetHubPaseoPara::sovereign_account_id_of(pop_net_location_as_seen_by_ahr); // fund Pop Network's SA on AHR with the native tokens held in reserve - AssetHubRococoPara::fund_accounts(vec![(sov_pop_net_on_ahr.into(), amount_to_send * 2)]); + AssetHubPaseoPara::fund_accounts(vec![(sov_pop_net_on_ahr.into(), amount_to_send * 2)]); test.set_assertion::(para_to_system_para_sender_assertions); - test.set_assertion::(para_to_system_para_receiver_assertions); + test.set_assertion::(para_to_system_para_receiver_assertions); test.set_dispatchable::(para_to_system_para_reserve_transfer_assets); test.assert(); @@ -482,105 +475,106 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { assert!(receiver_balance_after < receiver_balance_before + amount_to_send); } -#[test] -fn place_coretime_spot_order_from_para_to_relay() { - init_tracing(); - - let beneficiary: sp_runtime::AccountId32 = [1u8; 32].into(); - - // Setup: reserve transfer from relay to Pop, so that sovereign account accurate for return transfer - let amount_to_send: Balance = pop_runtime::UNIT * 1000; - fund_pop_from_relay(RococoRelaySender::get(), amount_to_send, beneficiary.clone()); - - let message = { - let assets: Asset = (Here, 10 * pop_runtime::UNIT).into(); - let beneficiary = AccountId32 { id: beneficiary.clone().into(), network: None }.into(); - let spot_order = ::RuntimeCall::OnDemandAssignmentProvider( - assigner_on_demand::Call::<::Runtime>::place_order_keep_alive { - max_amount: 1 * pop_runtime::UNIT, - para_id: AssetHubRococoPara::para_id().into(), - }, - ); - - // Set up transact status response handler - let query_id = PopNetworkPara::execute_with(|| { - as PopNetworkParaPallet>::PolkadotXcm::new_query( - PopNetworkPara::parent_location(), - // timeout in blocks - 10u32.into(), - Location::here(), - ) - }); - - let message = Xcm::builder() - .withdraw_asset(assets.clone().into()) - .buy_execution(assets.clone().into(), Unlimited) - .transact( - OriginKind::SovereignAccount, - Weight::from_parts(220_000_000, 15_000), - spot_order.encode().into(), - ) - .report_transact_status(QueryResponseInfo { - destination: RococoRelay::child_location_of(PopNetworkPara::para_id()), - query_id, - max_weight: Weight::from_parts(250_000_000, 10_000), - }) - .refund_surplus() - .deposit_asset(assets.into(), beneficiary) - .build(); - message - }; - - let destination = PopNetworkPara::parent_location().into_versioned(); - PopNetworkPara::execute_with(|| { - let res = ::RuntimeCall::PolkadotXcm(pallet_xcm::Call::< - ::Runtime, - >::send { - dest: bx!(destination), - message: bx!(VersionedXcm::V4(message)), - }) - // TODO: replace root with signed, currently prohibited by HashedDescription> (https://github.com/paritytech/polkadot-sdk/blob/a6713c55fd5082d333518c3ca13f2a4294726fcc/polkadot/runtime/rococo/src/xcm_config.rs#L67) rather than HashedDescription> (https://github.com/polkadot-fellows/runtimes/blob/e42821da8d85f721d0dd1670dfb23f4dd91bd3e8/relay/kusama/src/xcm_config.rs#L76) - //.dispatch(RawOrigin::Signed(beneficiary).into()); - .dispatch(RawOrigin::Root.into()); - - assert!(res.is_ok()); - type RuntimeEvent = ::RuntimeEvent; - // Check that the message was sent - assert_expected_events!( - PopNetworkPara, - vec![ - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent { .. }) => {}, - ] - ); - }); - - RococoRelay::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - assert_expected_events!( - RococoRelay, - vec![ - // We currently only check that the message was processed successfully - RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => {}, - // TODO: check order placed once we can have on-demand para id registered (probably via setting raw storage as a workaround) - // RuntimeEvent::OnDemandAssignmentProvider(assigner_on_demand::Event::OnDemandOrderPlaced { - // .. - // }) => {}, - ] - ); - }); - - PopNetworkPara::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - // Check that the reporting of the transact status message was sent - assert_expected_events!( - PopNetworkPara, - vec![ - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::ResponseReady { query_id: 0, .. }) => {}, - RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => {}, - ] - ); - }); -} +// Note: commented out until coretime added to Paseo +// #[test] +// fn place_coretime_spot_order_from_para_to_relay() { +// init_tracing(); +// +// let beneficiary: sp_runtime::AccountId32 = [1u8; 32].into(); +// +// // Setup: reserve transfer from relay to Pop, so that sovereign account accurate for return transfer +// let amount_to_send: Balance = pop_runtime::UNIT * 1000; +// fund_pop_from_relay(PaseoRelaySender::get(), amount_to_send, beneficiary.clone()); +// +// let message = { +// let assets: Asset = (Here, 10 * pop_runtime::UNIT).into(); +// let beneficiary = AccountId32 { id: beneficiary.clone().into(), network: None }.into(); +// let spot_order = ::RuntimeCall::OnDemandAssignmentProvider( +// assigner_on_demand::Call::<::Runtime>::place_order_keep_alive { +// max_amount: 1 * pop_runtime::UNIT, +// para_id: AssetHubPaseoPara::para_id().into(), +// }, +// ); +// +// // Set up transact status response handler +// let query_id = PopNetworkPara::execute_with(|| { +// as PopNetworkParaPallet>::PolkadotXcm::new_query( +// PopNetworkPara::parent_location(), +// // timeout in blocks +// 10u32.into(), +// Location::here(), +// ) +// }); +// +// let message = Xcm::builder() +// .withdraw_asset(assets.clone().into()) +// .buy_execution(assets.clone().into(), Unlimited) +// .transact( +// OriginKind::SovereignAccount, +// Weight::from_parts(220_000_000, 15_000), +// spot_order.encode().into(), +// ) +// .report_transact_status(QueryResponseInfo { +// destination: PaseoRelay::child_location_of(PopNetworkPara::para_id()), +// query_id, +// max_weight: Weight::from_parts(250_000_000, 10_000), +// }) +// .refund_surplus() +// .deposit_asset(assets.into(), beneficiary) +// .build(); +// message +// }; +// +// let destination = PopNetworkPara::parent_location().into_versioned(); +// PopNetworkPara::execute_with(|| { +// let res = ::RuntimeCall::PolkadotXcm(pallet_xcm::Call::< +// ::Runtime, +// >::send { +// dest: bx!(destination), +// message: bx!(VersionedXcm::V4(message)), +// }) +// // TODO: replace root with signed, currently prohibited by HashedDescription> (https://github.com/paritytech/polkadot-sdk/blob/a6713c55fd5082d333518c3ca13f2a4294726fcc/polkadot/runtime/rococo/src/xcm_config.rs#L67) rather than HashedDescription> (https://github.com/polkadot-fellows/runtimes/blob/e42821da8d85f721d0dd1670dfb23f4dd91bd3e8/relay/kusama/src/xcm_config.rs#L76) +// //.dispatch(RawOrigin::Signed(beneficiary).into()); +// .dispatch(RawOrigin::Root.into()); +// +// assert!(res.is_ok()); +// type RuntimeEvent = ::RuntimeEvent; +// // Check that the message was sent +// assert_expected_events!( +// PopNetworkPara, +// vec![ +// RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent { .. }) => {}, +// ] +// ); +// }); +// +// PaseoRelay::execute_with(|| { +// type RuntimeEvent = ::RuntimeEvent; +// assert_expected_events!( +// PaseoRelay, +// vec![ +// // We currently only check that the message was processed successfully +// RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => {}, +// // TODO: check order placed once we can have on-demand para id registered (probably via setting raw storage as a workaround) +// // RuntimeEvent::OnDemandAssignmentProvider(assigner_on_demand::Event::OnDemandOrderPlaced { +// // .. +// // }) => {}, +// ] +// ); +// }); +// +// PopNetworkPara::execute_with(|| { +// type RuntimeEvent = ::RuntimeEvent; +// // Check that the reporting of the transact status message was sent +// assert_expected_events!( +// PopNetworkPara, +// vec![ +// RuntimeEvent::PolkadotXcm(pallet_xcm::Event::ResponseReady { query_id: 0, .. }) => {}, +// RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => {}, +// ] +// ); +// }); +// } #[allow(dead_code)] static INIT: std::sync::Once = std::sync::Once::new(); diff --git a/runtime/devnet/src/config/xcm.rs b/runtime/devnet/src/config/xcm.rs index a210f7a4..b58baf2f 100644 --- a/runtime/devnet/src/config/xcm.rs +++ b/runtime/devnet/src/config/xcm.rs @@ -28,7 +28,8 @@ use xcm_executor::XcmExecutor; parameter_types! { pub const RelayLocation: Location = Location::parent(); pub AssetHub: Location = Location::new(1, [Parachain(1000)]); - pub const RelayNetwork: Option = None; + // Note: Paseo currently uses Polkadot https://github.com/paseo-network/runtimes/blob/abc4ae9c5ae8f0166aab7ef2b427b3c2c6d5ce5c/relay/paseo/src/xcm_config.rs#L56 + pub const RelayNetwork: Option = Some(Polkadot); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } diff --git a/runtime/testnet/src/config/xcm.rs b/runtime/testnet/src/config/xcm.rs index a210f7a4..b58baf2f 100644 --- a/runtime/testnet/src/config/xcm.rs +++ b/runtime/testnet/src/config/xcm.rs @@ -28,7 +28,8 @@ use xcm_executor::XcmExecutor; parameter_types! { pub const RelayLocation: Location = Location::parent(); pub AssetHub: Location = Location::new(1, [Parachain(1000)]); - pub const RelayNetwork: Option = None; + // Note: Paseo currently uses Polkadot https://github.com/paseo-network/runtimes/blob/abc4ae9c5ae8f0166aab7ef2b427b3c2c6d5ce5c/relay/paseo/src/xcm_config.rs#L56 + pub const RelayNetwork: Option = Some(Polkadot); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); }