From d0855a414d9b9e9cc89786c342589b316159489f Mon Sep 17 00:00:00 2001 From: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:29:25 +0200 Subject: [PATCH 01/14] `im-online` cleanup: phase 1 (#267) This PR removes migrations and transient code connected with `im-online` removal. It introduces an offchain db cleanup migration that must be removed later. - [x] Does not require a CHANGELOG entry --- Cargo.lock | 2 ++ Cargo.toml | 1 + relay/kusama/Cargo.toml | 4 +++ relay/kusama/src/lib.rs | 60 ++++------------------------------ relay/polkadot/Cargo.toml | 4 +++ relay/polkadot/src/lib.rs | 69 ++++----------------------------------- 6 files changed, 23 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e57740176..34ff7ec38c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9720,6 +9720,7 @@ dependencies = [ "pallet-fast-unstake", "pallet-grandpa", "pallet-identity", + "pallet-im-online", "pallet-indices", "pallet-message-queue", "pallet-mmr", @@ -13959,6 +13960,7 @@ dependencies = [ "pallet-election-provider-support-benchmarking", "pallet-fast-unstake", "pallet-grandpa", + "pallet-im-online", "pallet-indices", "pallet-message-queue", "pallet-mmr", diff --git a/Cargo.toml b/Cargo.toml index 066fe70f4d..505e163b92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -120,6 +120,7 @@ pallet-fast-unstake = { version = "34.0.0", default-features = false } pallet-glutton = { version = "21.0.0", default-features = false } pallet-grandpa = { version = "35.0.0", default-features = false } pallet-identity = { version = "35.0.0", default-features = false } +pallet-im-online = { version = "34.0.0", default-features = false } pallet-indices = { version = "35.0.0", default-features = false } pallet-insecure-randomness-collective-flip = { version = "23.0.0", default-features = false } pallet-membership = { version = "35.0.0", default-features = false } diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml index b2df38038f..7c0cf5d39b 100644 --- a/relay/kusama/Cargo.toml +++ b/relay/kusama/Cargo.toml @@ -56,6 +56,7 @@ frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } pallet-grandpa = { workspace = true } pallet-nis = { workspace = true } +pallet-im-online = { workspace = true } pallet-indices = { workspace = true } pallet-message-queue = { workspace = true } pallet-mmr = { workspace = true } @@ -151,6 +152,7 @@ std = [ "pallet-election-provider-support-benchmarking?/std", "pallet-fast-unstake/std", "pallet-grandpa/std", + "pallet-im-online/std", "pallet-indices/std", "pallet-message-queue/std", "pallet-mmr/std", @@ -226,6 +228,7 @@ runtime-benchmarks = [ "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-fast-unstake/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", "pallet-mmr/runtime-benchmarks", @@ -280,6 +283,7 @@ try-runtime = [ "pallet-election-provider-multi-phase/try-runtime", "pallet-fast-unstake/try-runtime", "pallet-grandpa/try-runtime", + "pallet-im-online/try-runtime", "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", "pallet-mmr/try-runtime", diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 98a6447987..b2949c5585 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -1506,59 +1506,6 @@ impl pallet_asset_rate::Config for Runtime { type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments; } -// A mock pallet to keep `ImOnline` events decodable after pallet removal -pub mod pallet_im_online { - use frame_support::pallet_prelude::*; - pub use pallet::*; - - pub mod sr25519 { - mod app_sr25519 { - use sp_application_crypto::{app_crypto, key_types::IM_ONLINE, sr25519}; - app_crypto!(sr25519, IM_ONLINE); - } - pub type AuthorityId = app_sr25519::Public; - } - - #[frame_support::pallet] - pub mod pallet { - use super::*; - use frame_support::traits::{ValidatorSet, ValidatorSetWithIdentification}; - - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::config] - pub trait Config: frame_system::Config { - type RuntimeEvent: From> - + IsType<::RuntimeEvent>; - type ValidatorSet: ValidatorSetWithIdentification; - } - - pub type ValidatorId = <::ValidatorSet as ValidatorSet< - ::AccountId, - >>::ValidatorId; - - pub type IdentificationTuple = ( - ValidatorId, - <::ValidatorSet as ValidatorSetWithIdentification< - ::AccountId, - >>::Identification, - ); - - #[pallet::event] - pub enum Event { - HeartbeatReceived { authority_id: super::sr25519::AuthorityId }, - AllGood, - SomeOffline { offline: sp_std::vec::Vec> }, - } - } -} - -impl pallet_im_online::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ValidatorSet = Historical; -} - construct_runtime! { pub enum Runtime { @@ -1583,7 +1530,6 @@ construct_runtime! { Session: pallet_session = 8, Grandpa: pallet_grandpa = 10, - ImOnline: pallet_im_online::{Event} = 11, AuthorityDiscovery: pallet_authority_discovery = 12, // Governance stuff. @@ -1878,6 +1824,12 @@ sp_api::impl_runtime_apis! { impl sp_offchain::OffchainWorkerApi for Runtime { fn offchain_worker(header: &::Header) { + use sp_runtime::{traits::Header, DigestItem}; + + if header.digest().logs().iter().any(|di| di == &DigestItem::RuntimeEnvironmentUpdated) { + pallet_im_online::migration::clear_offchain_storage(Session::validators().len() as u32); + } + Executive::offchain_worker(header) } } diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index c7f8c92b6b..f11edec300 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -53,6 +53,7 @@ frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } pallet-grandpa = { workspace = true } pallet-identity = { workspace = true } +pallet-im-online = { workspace = true } pallet-indices = { workspace = true } pallet-message-queue = { workspace = true } pallet-mmr = { workspace = true } @@ -149,6 +150,7 @@ std = [ "pallet-fast-unstake/std", "pallet-grandpa/std", "pallet-identity/std", + "pallet-im-online/std", "pallet-indices/std", "pallet-message-queue/std", "pallet-mmr/std", @@ -224,6 +226,7 @@ runtime-benchmarks = [ "pallet-fast-unstake/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", "pallet-mmr/runtime-benchmarks", @@ -276,6 +279,7 @@ try-runtime = [ "pallet-fast-unstake/try-runtime", "pallet-grandpa/try-runtime", "pallet-identity/try-runtime", + "pallet-im-online/try-runtime", "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", "pallet-mmr/try-runtime", diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index cf6ad4efcd..b45360a8b7 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -1576,59 +1576,6 @@ impl pallet_asset_rate::Config for Runtime { type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments; } -// A mock pallet to keep `ImOnline` events decodable after pallet removal -pub mod pallet_im_online { - use frame_support::pallet_prelude::*; - pub use pallet::*; - - pub mod sr25519 { - mod app_sr25519 { - use sp_application_crypto::{app_crypto, key_types::IM_ONLINE, sr25519}; - app_crypto!(sr25519, IM_ONLINE); - } - pub type AuthorityId = app_sr25519::Public; - } - - #[frame_support::pallet] - pub mod pallet { - use super::*; - use frame_support::traits::{ValidatorSet, ValidatorSetWithIdentification}; - - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::config] - pub trait Config: frame_system::Config { - type RuntimeEvent: From> - + IsType<::RuntimeEvent>; - type ValidatorSet: ValidatorSetWithIdentification; - } - - pub type ValidatorId = <::ValidatorSet as ValidatorSet< - ::AccountId, - >>::ValidatorId; - - pub type IdentificationTuple = ( - ValidatorId, - <::ValidatorSet as ValidatorSetWithIdentification< - ::AccountId, - >>::Identification, - ); - - #[pallet::event] - pub enum Event { - HeartbeatReceived { authority_id: super::sr25519::AuthorityId }, - AllGood, - SomeOffline { offline: sp_std::vec::Vec> }, - } - } -} - -impl pallet_im_online::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ValidatorSet = Historical; -} - construct_runtime! { pub enum Runtime { @@ -1655,7 +1602,6 @@ construct_runtime! { Session: pallet_session = 9, Grandpa: pallet_grandpa = 11, - ImOnline: pallet_im_online::{Event} = 12, AuthorityDiscovery: pallet_authority_discovery = 13, // OpenGov stuff. @@ -1786,17 +1732,8 @@ pub type Migrations = (migrations::Unreleased, migrations::Permanent); pub mod migrations { use super::*; - parameter_types! { - pub const ImOnlinePalletName: &'static str = "ImOnline"; - } - /// Unreleased migrations. Add new ones here: pub type Unreleased = ( - // Remove `im-online` pallet on-chain storage - frame_support::migrations::RemovePallet< - ImOnlinePalletName, - ::DbWeight, - >, parachains_configuration::migration::v12::MigrateToV12, parachains_inclusion::migration::MigrateToV1, pallet_staking::migrations::v15::MigrateV14ToV15, @@ -1986,6 +1923,12 @@ sp_api::impl_runtime_apis! { impl sp_offchain::OffchainWorkerApi for Runtime { fn offchain_worker(header: &::Header) { + use sp_runtime::{traits::Header, DigestItem}; + + if header.digest().logs().iter().any(|di| di == &DigestItem::RuntimeEnvironmentUpdated) { + pallet_im_online::migration::clear_offchain_storage(Session::validators().len() as u32); + } + Executive::offchain_worker(header) } } From 7723274a2c5cbb10213379271094d5180716ca7d Mon Sep 17 00:00:00 2001 From: Francisco Aguirre Date: Mon, 22 Jul 2024 12:37:05 +0200 Subject: [PATCH 02/14] Add XcmPaymentApi and DryRunApi to all runtimes (#380) Adds the https://github.com/paritytech/polkadot-sdk/pull/3607 and https://github.com/paritytech/polkadot-sdk/pull/3872 to all runtimes. These APIs work together to allow dry running and estimating execution and delivery fees for XCMs. This PR doesn't allow querying the price in assets different than the relay token for asset hubs. Can be done in a following PR. Also tracking https://github.com/polkadot-fellows/runtimes/issues/388 and https://github.com/polkadot-fellows/runtimes/issues/389 for future improvemens. Old PR was https://github.com/polkadot-fellows/runtimes/pull/359, this one targets main already updated to Polkadot SDK 1.13. ## Dear reviewer Although there are a lot of changes, the main one is the addition of the two aforementioned APIs to all relays and system parachains. The rest of the files are tests, which all have the same format. --- CHANGELOG.md | 2 + Cargo.lock | 59 ++++ Cargo.toml | 4 + .../coretime/coretime-kusama/Cargo.toml | 22 ++ .../coretime/coretime-kusama/src/genesis.rs | 66 ++++ .../coretime/coretime-kusama/src/lib.rs | 50 +++ integration-tests/emulated/helpers/src/lib.rs | 160 ++++++++-- .../networks/kusama-system/Cargo.toml | 1 + .../networks/kusama-system/src/lib.rs | 6 +- .../tests/assets/asset-hub-kusama/Cargo.toml | 1 + .../assets/asset-hub-kusama/src/tests/mod.rs | 1 + .../src/tests/xcm_fee_estimation.rs | 301 +++++++++++++++++ .../assets/asset-hub-polkadot/Cargo.toml | 1 + .../asset-hub-polkadot/src/tests/mod.rs | 1 + .../src/tests/xcm_fee_estimation.rs | 302 ++++++++++++++++++ .../bridges/bridge-hub-kusama/Cargo.toml | 1 + .../bridges/bridge-hub-kusama/src/lib.rs | 2 +- .../src/tests/asset_transfers.rs | 128 +++++++- .../bridge-hub-kusama/src/tests/mod.rs | 31 +- .../bridge-hub-kusama/src/tests/teleport.rs | 30 ++ .../bridges/bridge-hub-polkadot/Cargo.toml | 1 + .../bridges/bridge-hub-polkadot/src/lib.rs | 1 + .../bridge-hub-polkadot/src/tests/teleport.rs | 30 ++ .../collectives-polkadot/Cargo.toml | 1 + .../src/tests/teleport.rs | 9 +- .../tests/coretime/coretime-kusama/Cargo.toml | 38 +++ .../tests/coretime/coretime-kusama/src/lib.rs | 55 ++++ .../coretime/coretime-kusama/src/tests/mod.rs | 16 + .../coretime-kusama/src/tests/teleport.rs | 46 +++ .../tests/people/people-kusama/Cargo.toml | 4 +- .../people-kusama/src/tests/teleport.rs | 172 ++-------- .../tests/people/people-polkadot/Cargo.toml | 4 +- .../people-polkadot/src/tests/teleport.rs | 172 ++-------- relay/kusama/Cargo.toml | 3 + relay/kusama/src/lib.rs | 53 ++- relay/polkadot/Cargo.toml | 3 + relay/polkadot/src/impls.rs | 1 - relay/polkadot/src/lib.rs | 53 ++- .../asset-hubs/asset-hub-kusama/Cargo.toml | 3 + .../asset-hubs/asset-hub-kusama/src/lib.rs | 53 ++- .../asset-hubs/asset-hub-polkadot/Cargo.toml | 3 + .../asset-hubs/asset-hub-polkadot/src/lib.rs | 53 ++- .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 5 +- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 48 ++- .../bridge-hub-polkadot/Cargo.toml | 5 +- .../bridge-hub-polkadot/src/lib.rs | 48 ++- .../collectives-polkadot/Cargo.toml | 3 + .../collectives-polkadot/src/lib.rs | 48 ++- .../coretime/coretime-kusama/Cargo.toml | 3 + .../coretime/coretime-kusama/src/lib.rs | 50 ++- system-parachains/encointer/Cargo.toml | 3 + system-parachains/encointer/src/lib.rs | 53 ++- .../people/people-kusama/Cargo.toml | 7 +- .../people/people-kusama/src/lib.rs | 55 +++- .../people/people-polkadot/Cargo.toml | 3 + .../people/people-polkadot/src/lib.rs | 53 ++- 56 files changed, 1950 insertions(+), 377 deletions(-) create mode 100644 integration-tests/emulated/chains/parachains/coretime/coretime-kusama/Cargo.toml create mode 100644 integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/genesis.rs create mode 100644 integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/lib.rs create mode 100644 integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs create mode 100644 integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs create mode 100644 integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml create mode 100644 integration-tests/emulated/tests/coretime/coretime-kusama/src/lib.rs create mode 100644 integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/mod.rs create mode 100644 integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index bfc50064b4..1c05a8ca37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added +- All runtimes: XcmPaymentApi and DryRunApi ([polkadot-fellows/runtimes#380](https://github.com/polkadot-fellows/runtimes/pull/380)) + #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): - Add `claim_assets` extrinsic to `pallet-xcm` ([SDK v1.9 #3403](https://github.com/paritytech/polkadot-sdk/pull/3403)). diff --git a/Cargo.lock b/Cargo.lock index 34ff7ec38c..94caf224ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -575,6 +575,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -663,6 +664,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -709,6 +711,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -794,6 +797,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -1668,6 +1672,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -1772,6 +1777,7 @@ dependencies = [ "substrate-wasm-builder", "system-parachains-constants", "tuplex", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -1821,6 +1827,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -1923,6 +1930,7 @@ dependencies = [ "substrate-wasm-builder", "system-parachains-constants", "tuplex", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -2357,6 +2365,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -2432,6 +2441,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -2570,6 +2580,44 @@ dependencies = [ "memchr", ] +[[package]] +name = "coretime-kusama-emulated-chain" +version = "0.0.0" +dependencies = [ + "coretime-kusama-runtime", + "cumulus-primitives-core", + "emulated-integration-tests-common", + "frame-support", + "parachains-common", + "sp-core 34.0.0", +] + +[[package]] +name = "coretime-kusama-integration-tests" +version = "1.0.0" +dependencies = [ + "asset-test-utils", + "coretime-kusama-runtime", + "cumulus-pallet-parachain-system", + "emulated-integration-tests-common", + "frame-support", + "integration-tests-helpers", + "kusama-runtime-constants", + "kusama-system-emulated-network", + "pallet-balances", + "pallet-identity", + "pallet-message-queue", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "polkadot-runtime-common", + "sp-runtime 38.0.0", + "staging-kusama-runtime", + "staging-xcm", + "staging-xcm-executor", + "xcm-fee-payment-runtime-api", +] + [[package]] name = "coretime-kusama-runtime" version = "1.0.0" @@ -2636,6 +2684,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -3826,6 +3875,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -5744,6 +5794,7 @@ version = "1.0.0" dependencies = [ "asset-hub-kusama-emulated-chain", "bridge-hub-kusama-emulated-chain", + "coretime-kusama-emulated-chain", "emulated-integration-tests-common", "kusama-emulated-chain", "penpal-emulated-chain", @@ -9282,6 +9333,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "emulated-integration-tests-common", "frame-support", + "integration-tests-helpers", "kusama-runtime-constants", "kusama-system-emulated-network", "pallet-balances", @@ -9296,6 +9348,7 @@ dependencies = [ "staging-kusama-runtime", "staging-xcm", "staging-xcm-executor", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -9364,6 +9417,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -9387,6 +9441,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "emulated-integration-tests-common", "frame-support", + "integration-tests-helpers", "pallet-balances", "pallet-identity", "pallet-message-queue", @@ -9401,6 +9456,7 @@ dependencies = [ "sp-runtime 38.0.0", "staging-xcm", "staging-xcm-executor", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -9467,6 +9523,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -9787,6 +9844,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "tokio", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -14027,6 +14085,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "tokio", + "xcm-fee-payment-runtime-api", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 505e163b92..6cfc0c6c6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ codec = { package = "parity-scale-codec", version = "3.6.9", default-features = collectives-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot" } collectives-polkadot-runtime = { path = "system-parachains/collectives/collectives-polkadot" } collectives-polkadot-runtime-constants = { path = "system-parachains/collectives/collectives-polkadot/constants" } +coretime-kusama-emulated-chain = { path = "integration-tests/emulated/chains/parachains/coretime/coretime-kusama" } coretime-kusama-runtime = { path = "system-parachains/coretime/coretime-kusama" } cumulus-pallet-aura-ext = { version = "0.14.0", default-features = false } cumulus-pallet-dmp-queue = { version = "0.14.0", default-features = false } @@ -235,6 +236,7 @@ xcm = { version = "14.0.0", default-features = false, package = "staging-xcm" } xcm-builder = { version = "14.0.0", default-features = false, package = "staging-xcm-builder" } xcm-emulator = { version = "0.12.0" } xcm-executor = { version = "14.0.0", default-features = false, package = "staging-xcm-executor" } +xcm-fee-payment-runtime-api = { version = "0.4.0", default-features = false } anyhow = { version = "1.0.82" } subxt = { version = "0.35.0", default-features = false } tracing-subscriber = { version = "0.3.18" } @@ -251,6 +253,7 @@ members = [ "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama", "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot", "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot", + "integration-tests/emulated/chains/parachains/coretime/coretime-kusama", "integration-tests/emulated/chains/parachains/people/people-kusama", "integration-tests/emulated/chains/parachains/people/people-polkadot", "integration-tests/emulated/chains/parachains/testing/penpal", @@ -265,6 +268,7 @@ members = [ "integration-tests/emulated/tests/bridges/bridge-hub-kusama", "integration-tests/emulated/tests/bridges/bridge-hub-polkadot", "integration-tests/emulated/tests/collectives/collectives-polkadot", + "integration-tests/emulated/tests/coretime/coretime-kusama", "integration-tests/emulated/tests/people/people-kusama", "integration-tests/emulated/tests/people/people-polkadot", "relay/kusama", diff --git a/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/Cargo.toml b/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/Cargo.toml new file mode 100644 index 0000000000..0c24f8320b --- /dev/null +++ b/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "coretime-kusama-emulated-chain" +version = "0.0.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +description = "Coretime Kusama emulated chain used for integration tests" +publish = false + +[dependencies] + +# Substrate +sp-core = { workspace = true, default-features = true } +frame-support = { workspace = true, default-features = true } + +# Cumulus +parachains-common = { workspace = true, default-features = true } +cumulus-primitives-core = { workspace = true, default-features = true } +emulated-integration-tests-common = { workspace = true } + +# Runtimes +coretime-kusama-runtime = { workspace = true } diff --git a/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/genesis.rs b/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/genesis.rs new file mode 100644 index 0000000000..1144e62497 --- /dev/null +++ b/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/genesis.rs @@ -0,0 +1,66 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Substrate +use sp_core::storage::Storage; + +// Cumulus +use emulated_integration_tests_common::{ + accounts, build_genesis_storage, collators, SAFE_XCM_VERSION, +}; +use parachains_common::Balance; + +pub const PARA_ID: u32 = 1001; +pub const ED: Balance = coretime_kusama_runtime::ExistentialDeposit::get(); + +pub fn genesis() -> Storage { + let genesis_config = coretime_kusama_runtime::RuntimeGenesisConfig { + system: coretime_kusama_runtime::SystemConfig::default(), + balances: coretime_kusama_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + parachain_info: coretime_kusama_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + ..Default::default() + }, + collator_selection: coretime_kusama_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: coretime_kusama_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + coretime_kusama_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + polkadot_xcm: coretime_kusama_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() + }, + ..Default::default() + }; + + build_genesis_storage( + &genesis_config, + coretime_kusama_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"), + ) +} diff --git a/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/lib.rs b/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/lib.rs new file mode 100644 index 0000000000..2876d1886b --- /dev/null +++ b/integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/lib.rs @@ -0,0 +1,50 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub mod genesis; + +// Substrate +use frame_support::traits::OnInitialize; + +// Cumulus +use emulated_integration_tests_common::{ + impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain, + impls::Parachain, xcm_emulator::decl_test_parachains, +}; + +// CollectivesPolkadot Parachain declaration +decl_test_parachains! { + pub struct CoretimeKusama { + genesis = genesis::genesis(), + on_init = { + coretime_kusama_runtime::AuraExt::on_initialize(1); + }, + runtime = coretime_kusama_runtime, + core = { + XcmpMessageHandler: coretime_kusama_runtime::XcmpQueue, + LocationToAccountId: coretime_kusama_runtime::xcm_config::LocationToAccountId, + ParachainInfo: coretime_kusama_runtime::ParachainInfo, + MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, + }, + pallets = { + PolkadotXcm: coretime_kusama_runtime::PolkadotXcm, + Balances: coretime_kusama_runtime::Balances, + } + }, +} + +// CoretimeKusama implementation +impl_accounts_helpers_for_parachain!(CoretimeKusama); +impl_assert_events_helpers_for_parachain!(CoretimeKusama); diff --git a/integration-tests/emulated/helpers/src/lib.rs b/integration-tests/emulated/helpers/src/lib.rs index 7f29c0e16b..096e91b3b7 100644 --- a/integration-tests/emulated/helpers/src/lib.rs +++ b/integration-tests/emulated/helpers/src/lib.rs @@ -40,7 +40,6 @@ macro_rules! test_relay_is_trusted_teleporter { let sender = [<$sender_relay Sender>]::get(); let mut relay_sender_balance_before = <$sender_relay as $crate::Chain>::account_data_of(sender.clone()).free; - let origin = <$sender_relay as $crate::Chain>::RuntimeOrigin::signed(sender.clone()); let fee_asset_item = 0; let weight_limit = $crate::WeightLimit::Unlimited; @@ -55,16 +54,50 @@ macro_rules! test_relay_is_trusted_teleporter { let beneficiary: Location = $crate::AccountId32 { network: None, id: receiver.clone().into() }.into(); - // Send XCM message from Relay + // Dry-run first. + let call = <$sender_relay as Chain>::RuntimeCall::XcmPallet(pallet_xcm::Call::limited_teleport_assets { + dest: bx!(para_destination.clone().into()), + beneficiary: bx!(beneficiary.clone().into()), + assets: bx!($assets.clone().into()), + fee_asset_item: fee_asset_item, + weight_limit: weight_limit.clone(), + }); + let mut delivery_fees_amount = 0; + let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + <$sender_relay>::execute_with(|| { + type Runtime = <$sender_relay as Chain>::Runtime; + type OriginCaller = <$sender_relay as Chain>::OriginCaller; + + let origin = OriginCaller::system(RawOrigin::Signed(sender.clone())); + let result = Runtime::dry_run_call(origin, call.clone()).unwrap(); + // We filter the result to get only the messages we are interested in. + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(0, [Parachain(<$receiver_para>::para_id().into())])) + }) + .unwrap(); + assert_eq!(messages_to_query.len(), 1); + remote_message = messages_to_query[0].clone(); + let delivery_fees = + Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) + .unwrap(); + let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); + let Fungible(inner_delivery_fees_amount) = latest_delivery_fees.inner()[0].fun else { + unreachable!("asset is fungible"); + }; + delivery_fees_amount = inner_delivery_fees_amount; + }); + + // Reset to send actual message. + <$sender_relay>::reset_ext(); + <$receiver_para>::reset_ext(); + + // Send XCM message from Relay. <$sender_relay>::execute_with(|| { - assert_ok!(<$sender_relay as [<$sender_relay Pallet>]>::XcmPallet::limited_teleport_assets( - origin.clone(), - bx!(para_destination.clone().into()), - bx!(beneficiary.clone().into()), - bx!($assets.clone().into()), - fee_asset_item, - weight_limit.clone(), - )); + let origin = <$sender_relay as Chain>::RuntimeOrigin::signed(sender.clone()); + assert_ok!(call.dispatch(origin)); type RuntimeEvent = <$sender_relay as $crate::Chain>::RuntimeEvent; @@ -106,13 +139,8 @@ macro_rules! test_relay_is_trusted_teleporter { <$sender_relay as $crate::Chain>::account_data_of(sender.clone()).free; let para_receiver_balance_after = <$receiver_para as $crate::Chain>::account_data_of(receiver.clone()).free; - let delivery_fees = <$sender_relay>::execute_with(|| { - $crate::asset_test_utils::xcm_helpers::teleport_assets_delivery_fees::< - <$sender_xcm_config as xcm_executor::Config>::XcmSender, - >($assets.clone(), fee_asset_item, weight_limit.clone(), beneficiary, para_destination) - }); - assert_eq!(relay_sender_balance_before - $amount - delivery_fees, relay_sender_balance_after); + assert_eq!(relay_sender_balance_before - $amount - delivery_fees_amount, relay_sender_balance_after); assert!(para_receiver_balance_after > para_receiver_balance_before); // Update sender balance @@ -129,6 +157,13 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay { $crate::paste::paste! { // init Origin variables let sender = [<$sender_para Sender>]::get(); + // Mint assets to `$sender_para` to succeed with teleport. + <$sender_para>::execute_with(|| { + assert_ok!(<$sender_para as [<$sender_para Pallet>]>::Balances::mint_into( + &sender, + $amount + 10_000_000_000, // Some extra for delivery fees. + )); + }); let mut para_sender_balance_before = <$sender_para as $crate::Chain>::account_data_of(sender.clone()).free; let origin = <$sender_para as $crate::Chain>::RuntimeOrigin::signed(sender.clone()); @@ -136,7 +171,19 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay { let fee_asset_item = 0; let weight_limit = $crate::WeightLimit::Unlimited; - // init Destination variables + // We need to mint funds into the checking account of `$receiver_relay` + // for it to accept a teleport from `$sender_para`. + // Else we'd get a `NotWithdrawable` error since it tries to reduce the check account balance, which + // would be 0. + <$receiver_relay>::execute_with(|| { + let check_account = <$receiver_relay as [<$receiver_relay Pallet>]>::XcmPallet::check_account(); + assert_ok!(<$receiver_relay as [<$receiver_relay Pallet>]>::Balances::mint_into( + &check_account, + $amount, + )); + }); + + // Init destination variables. let receiver = [<$receiver_relay Receiver>]::get(); let relay_receiver_balance_before = <$receiver_relay as $crate::Chain>::account_data_of(receiver.clone()).free; @@ -144,16 +191,72 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay { let beneficiary: Location = $crate::AccountId32 { network: None, id: receiver.clone().into() }.into(); - // Send XCM message from Parachain + // Dry-run first. + let call = <$sender_para as Chain>::RuntimeCall::PolkadotXcm(pallet_xcm::Call::limited_teleport_assets { + dest: bx!(relay_destination.clone().into()), + beneficiary: bx!(beneficiary.clone().into()), + assets: bx!(assets.clone().into()), + fee_asset_item: fee_asset_item, + weight_limit: weight_limit.clone(), + }); + // These will be filled in the closure. + let mut delivery_fees_amount = 0; + let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); <$sender_para>::execute_with(|| { - assert_ok!(<$sender_para as [<$sender_para Pallet>]>::PolkadotXcm::limited_teleport_assets( - origin.clone(), - bx!(relay_destination.clone().into()), - bx!(beneficiary.clone().into()), - bx!(assets.clone().into()), - fee_asset_item, - weight_limit.clone(), + type Runtime = <$sender_para as Chain>::Runtime; + type OriginCaller = <$sender_para as Chain>::OriginCaller; + + let origin = OriginCaller::system(RawOrigin::Signed(sender.clone())); + let result = Runtime::dry_run_call(origin, call.clone()).unwrap(); + // We filter the result to get only the messages we are interested in. + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(1, [])) + }) + .unwrap(); + assert_eq!(messages_to_query.len(), 1); + remote_message = messages_to_query[0].clone(); + let delivery_fees = + Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) + .unwrap(); + let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); + delivery_fees_amount = if let Some(first_asset) = latest_delivery_fees.inner().first() { + let Fungible(inner_delivery_fees_amount) = first_asset.fun else { + unreachable!("asset is fungible"); + }; + inner_delivery_fees_amount + } else { + 0 + } + }); + + // Reset to send actual message. + <$sender_para>::reset_ext(); + <$receiver_relay>::reset_ext(); + + // Mint assets to `$sender_para` to succeed with teleport. + <$sender_para>::execute_with(|| { + assert_ok!(<$sender_para as [<$sender_para Pallet>]>::Balances::mint_into( + &sender, + $amount + 10_000_000_000, // Some extra for delivery fees. + )); + }); + + // Since we reset everything, we need to mint funds into the checking account again. + <$receiver_relay>::execute_with(|| { + let check_account = <$receiver_relay as [<$receiver_relay Pallet>]>::XcmPallet::check_account(); + assert_ok!(<$receiver_relay as [<$receiver_relay Pallet>]>::Balances::mint_into( + &check_account, + $amount, )); + }); + + // Send XCM message from Parachain. + <$sender_para>::execute_with(|| { + let origin = <$sender_para as Chain>::RuntimeOrigin::signed(sender.clone()); + assert_ok!(call.dispatch(origin)); type RuntimeEvent = <$sender_para as $crate::Chain>::RuntimeEvent; @@ -195,13 +298,8 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay { <$sender_para as $crate::Chain>::account_data_of(sender.clone()).free; let relay_receiver_balance_after = <$receiver_relay as $crate::Chain>::account_data_of(receiver.clone()).free; - let delivery_fees = <$sender_para>::execute_with(|| { - $crate::asset_test_utils::xcm_helpers::teleport_assets_delivery_fees::< - <$sender_xcm_config as xcm_executor::Config>::XcmSender, - >(assets, fee_asset_item, weight_limit.clone(), beneficiary, relay_destination) - }); - assert_eq!(para_sender_balance_before - $amount - delivery_fees, para_sender_balance_after); + assert_eq!(para_sender_balance_before - $amount - delivery_fees_amount, para_sender_balance_after); assert!(relay_receiver_balance_after > relay_receiver_balance_before); // Update sender balance diff --git a/integration-tests/emulated/networks/kusama-system/Cargo.toml b/integration-tests/emulated/networks/kusama-system/Cargo.toml index 50f09c6512..4f8c90bded 100644 --- a/integration-tests/emulated/networks/kusama-system/Cargo.toml +++ b/integration-tests/emulated/networks/kusama-system/Cargo.toml @@ -18,3 +18,4 @@ bridge-hub-kusama-emulated-chain = { workspace = true } kusama-emulated-chain = { workspace = true } penpal-emulated-chain = { workspace = true } people-kusama-emulated-chain = { workspace = true } +coretime-kusama-emulated-chain = { workspace = true } diff --git a/integration-tests/emulated/networks/kusama-system/src/lib.rs b/integration-tests/emulated/networks/kusama-system/src/lib.rs index 775d7ece4e..ed785d60af 100644 --- a/integration-tests/emulated/networks/kusama-system/src/lib.rs +++ b/integration-tests/emulated/networks/kusama-system/src/lib.rs @@ -15,12 +15,14 @@ pub use asset_hub_kusama_emulated_chain; pub use bridge_hub_kusama_emulated_chain; +pub use coretime_kusama_emulated_chain; pub use kusama_emulated_chain; pub use penpal_emulated_chain; pub use people_kusama_emulated_chain; use asset_hub_kusama_emulated_chain::AssetHubKusama; use bridge_hub_kusama_emulated_chain::BridgeHubKusama; +use coretime_kusama_emulated_chain::CoretimeKusama; use kusama_emulated_chain::Kusama; use penpal_emulated_chain::{PenpalA, PenpalB}; use people_kusama_emulated_chain::PeopleKusama; @@ -40,6 +42,7 @@ decl_test_networks! { PenpalA, PenpalB, PeopleKusama, + CoretimeKusama, ], bridge = () }, @@ -51,5 +54,6 @@ decl_test_sender_receiver_accounts_parameter_types! { BridgeHubKusamaPara { sender: ALICE, receiver: BOB }, PenpalAPara { sender: ALICE, receiver: BOB }, PenpalBPara { sender: ALICE, receiver: BOB }, - PeopleKusamaPara { sender: ALICE, receiver: BOB } + PeopleKusamaPara { sender: ALICE, receiver: BOB }, + CoretimeKusamaPara { sender: ALICE, receiver: BOB } } diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml b/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml index 18fdb9675a..e858c2ffe2 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml @@ -26,6 +26,7 @@ xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true } pallet-xcm = { workspace = true, default-features = true } polkadot-runtime-common = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } # Cumulus parachains-common = { workspace = true, default-features = true } diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/mod.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/mod.rs index 8fffec23d7..88fa379c40 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/mod.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/mod.rs @@ -21,3 +21,4 @@ mod set_xcm_versions; mod swap; mod teleport; mod treasury; +mod xcm_fee_estimation; diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs new file mode 100644 index 0000000000..eebb6b9cb4 --- /dev/null +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs @@ -0,0 +1,301 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Tests for XCM fee estimation in the runtime. + +use crate::{ + assert_expected_events, bx, AssetHubKusama, Chain, ParaToParaThroughAHTest, PenpalA, + PenpalAPallet, PenpalASender, PenpalAssetOwner, PenpalB, PenpalBPallet, PenpalBReceiver, + TestArgs, TestContext, TransferType, +}; +use emulated_integration_tests_common::impls::{Parachain, TestExt}; +use frame_support::{ + dispatch::RawOrigin, + sp_runtime::{traits::Dispatchable, DispatchResult}, + traits::fungibles::Inspect, +}; +use xcm::prelude::*; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; + +/// We are able to dry-run and estimate the fees for a multi-hop XCM journey. +/// Scenario: Alice on PenpalA has some DOTs and wants to send them to PenpalB. +/// We want to know the fees using the `DryRunApi` and `XcmPaymentApi`. +#[test] +fn multi_hop_works() { + let destination = PenpalA::sibling_location_of(PenpalB::para_id()); + let sender = PenpalASender::get(); + let amount_to_send = 1_000_000_000_000; + let asset_owner = PenpalAssetOwner::get(); + let assets: Assets = (Parent, amount_to_send).into(); + let relay_native_asset_location = Location::parent(); + let sender_as_seen_by_ah = AssetHubKusama::sibling_location_of(PenpalA::para_id()); + let sov_of_sender_on_ah = AssetHubKusama::sovereign_account_id_of(sender_as_seen_by_ah.clone()); + + // fund Parachain's sender account + PenpalA::mint_foreign_asset( + ::RuntimeOrigin::signed(asset_owner.clone()), + relay_native_asset_location.clone(), + sender.clone(), + amount_to_send * 2, + ); + + // fund the Parachain Origin's SA on AssetHub with the native tokens held in reserve. + AssetHubKusama::fund_accounts(vec![(sov_of_sender_on_ah.clone(), amount_to_send * 2)]); + + // Init values for Parachain Destination + let beneficiary_id = PenpalBReceiver::get(); + + let test_args = TestContext { + sender: PenpalASender::get(), // Bob in PenpalB. + receiver: PenpalBReceiver::get(), // Alice. + args: TestArgs::new_para( + destination, + beneficiary_id.clone(), + amount_to_send, + assets, + None, + 0, + ), + }; + let mut test = ParaToParaThroughAHTest::new(test_args); + + // We get them from the PenpalA closure. + let mut delivery_fees_amount = 0; + let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + ::execute_with(|| { + type Runtime = ::Runtime; + type OriginCaller = ::OriginCaller; + + let call = transfer_assets_para_to_para_through_ah_call(test.clone()); + let origin = OriginCaller::system(RawOrigin::Signed(sender.clone())); + let result = Runtime::dry_run_call(origin, call).unwrap(); + // We filter the result to get only the messages we are interested in. + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(1, [Parachain(1000)])) + }) + .unwrap(); + assert_eq!(messages_to_query.len(), 1); + remote_message = messages_to_query[0].clone(); + let delivery_fees = + Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) + .unwrap(); + delivery_fees_amount = get_amount_from_versioned_assets(delivery_fees); + }); + + // These are set in the AssetHub closure. + let mut intermediate_execution_fees = 0; + let mut intermediate_delivery_fees_amount = 0; + let mut intermediate_remote_message = VersionedXcm::V4(Xcm::<()>(Vec::new())); + ::execute_with(|| { + type Runtime = ::Runtime; + type RuntimeCall = ::RuntimeCall; + + // First we get the execution fees. + let weight = Runtime::query_xcm_weight(remote_message.clone()).unwrap(); + intermediate_execution_fees = Runtime::query_weight_to_asset_fee( + weight, + VersionedAssetId::V4(Location::new(1, []).into()), + ) + .unwrap(); + + // We have to do this to turn `VersionedXcm<()>` into `VersionedXcm`. + let xcm_program = + VersionedXcm::V4(Xcm::::from(remote_message.clone().try_into().unwrap())); + + // Now we get the delivery fees to the final destination. + let result = + Runtime::dry_run_xcm(sender_as_seen_by_ah.clone().into(), xcm_program).unwrap(); + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(1, [Parachain(2001)])) + }) + .unwrap(); + // There's actually two messages here. + // One created when the message we sent from PenpalA arrived and was executed. + // The second one when we dry-run the xcm. + // We could've gotten the message from the queue without having to dry-run, but + // offchain applications would have to dry-run, so we do it here as well. + intermediate_remote_message = messages_to_query[0].clone(); + let delivery_fees = Runtime::query_delivery_fees( + destination_to_query.clone(), + intermediate_remote_message.clone(), + ) + .unwrap(); + intermediate_delivery_fees_amount = get_amount_from_versioned_assets(delivery_fees); + }); + + // Get the final execution fees in the destination. + let mut final_execution_fees = 0; + ::execute_with(|| { + type Runtime = ::Runtime; + + let weight = Runtime::query_xcm_weight(intermediate_remote_message.clone()).unwrap(); + final_execution_fees = + Runtime::query_weight_to_asset_fee(weight, VersionedAssetId::V4(Parent.into())) + .unwrap(); + }); + + // Dry-running is done. + PenpalA::reset_ext(); + AssetHubKusama::reset_ext(); + PenpalB::reset_ext(); + + // Fund accounts again. + PenpalA::mint_foreign_asset( + ::RuntimeOrigin::signed(asset_owner), + relay_native_asset_location.clone(), + sender.clone(), + amount_to_send * 2, + ); + AssetHubKusama::fund_accounts(vec![(sov_of_sender_on_ah, amount_to_send * 2)]); + + // Actually run the extrinsic. + let sender_assets_before = PenpalA::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location.clone(), &sender) + }); + let receiver_assets_before = PenpalB::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location.clone(), &beneficiary_id) + }); + + test.set_assertion::(sender_assertions); + test.set_assertion::(hop_assertions); + test.set_assertion::(receiver_assertions); + test.set_dispatchable::(transfer_assets_para_to_para_through_ah_dispatchable); + test.assert(); + + let sender_assets_after = PenpalA::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location.clone(), &sender) + }); + let receiver_assets_after = PenpalB::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location, &beneficiary_id) + }); + + // We know the exact fees on every hop. + assert_eq!( + sender_assets_after, + sender_assets_before - amount_to_send - delivery_fees_amount /* This is charged directly + * from the sender's + * account. */ + ); + assert_eq!( + receiver_assets_after, + receiver_assets_before + amount_to_send - + intermediate_execution_fees - + intermediate_delivery_fees_amount - + final_execution_fees + ); +} + +fn sender_assertions(test: ParaToParaThroughAHTest) { + type RuntimeEvent = ::RuntimeEvent; + PenpalA::assert_xcm_pallet_attempted_complete(None); + + assert_expected_events!( + PenpalA, + vec![ + RuntimeEvent::ForeignAssets( + pallet_assets::Event::Burned { asset_id, owner, balance } + ) => { + asset_id: *asset_id == Location::new(1, []), + owner: *owner == test.sender.account_id, + balance: *balance == test.args.amount, + }, + ] + ); +} + +fn hop_assertions(test: ParaToParaThroughAHTest) { + type RuntimeEvent = ::RuntimeEvent; + AssetHubKusama::assert_xcmp_queue_success(None); + + assert_expected_events!( + AssetHubKusama, + vec![ + RuntimeEvent::Balances( + pallet_balances::Event::Burned { amount, .. } + ) => { + amount: *amount == test.args.amount, + }, + ] + ); +} + +fn receiver_assertions(test: ParaToParaThroughAHTest) { + type RuntimeEvent = ::RuntimeEvent; + PenpalB::assert_xcmp_queue_success(None); + + assert_expected_events!( + PenpalB, + vec![ + RuntimeEvent::ForeignAssets( + pallet_assets::Event::Issued { asset_id, owner, .. } + ) => { + asset_id: *asset_id == Location::new(1, []), + owner: *owner == test.receiver.account_id, + }, + ] + ); +} + +fn get_amount_from_versioned_assets(assets: VersionedAssets) -> u128 { + let latest_assets: Assets = assets.try_into().unwrap(); + let Fungible(amount) = latest_assets.inner()[0].fun else { + unreachable!("asset is fungible"); + }; + amount +} + +fn transfer_assets_para_to_para_through_ah_dispatchable( + test: ParaToParaThroughAHTest, +) -> DispatchResult { + let call = transfer_assets_para_to_para_through_ah_call(test.clone()); + match call.dispatch(test.signed_origin) { + Ok(_) => Ok(()), + Err(error_with_post_info) => Err(error_with_post_info.error), + } +} + +fn transfer_assets_para_to_para_through_ah_call( + test: ParaToParaThroughAHTest, +) -> ::RuntimeCall { + type RuntimeCall = ::RuntimeCall; + + let asset_hub_location: Location = PenpalB::sibling_location_of(AssetHubKusama::para_id()); + let custom_xcm_on_dest = Xcm::<()>(vec![DepositAsset { + assets: Wild(AllCounted(test.args.assets.len() as u32)), + beneficiary: test.args.beneficiary, + }]); + RuntimeCall::PolkadotXcm(pallet_xcm::Call::transfer_assets_using_type_and_then { + dest: bx!(test.args.dest.into()), + assets: bx!(test.args.assets.clone().into()), + assets_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.clone().into())), + remote_fees_id: bx!(VersionedAssetId::V4(AssetId(Location::new(1, [])))), + fees_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.into())), + custom_xcm_on_dest: bx!(VersionedXcm::from(custom_xcm_on_dest)), + weight_limit: test.args.weight_limit, + }) +} diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml index 3c15a06834..3b6420f7a6 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml @@ -25,6 +25,7 @@ polkadot-runtime-common = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } # Cumulus asset-test-utils = { workspace = true } diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/mod.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/mod.rs index 564257ab0d..73b73b239a 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/mod.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/mod.rs @@ -22,3 +22,4 @@ mod set_xcm_versions; mod swap; mod teleport; mod treasury; +mod xcm_fee_estimation; diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs new file mode 100644 index 0000000000..8588e60846 --- /dev/null +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs @@ -0,0 +1,302 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Tests for XCM fee estimation in the runtime. + +use crate::{ + assert_expected_events, bx, AssetHubPolkadot, Chain, ParaToParaThroughAHTest, PenpalA, + PenpalAPallet, PenpalAReceiver, PenpalAssetOwner, PenpalB, PenpalBPallet, PenpalBSender, + TestArgs, TestContext, TransferType, +}; +use emulated_integration_tests_common::impls::{Parachain, TestExt}; +use frame_support::{ + dispatch::RawOrigin, + sp_runtime::{traits::Dispatchable, DispatchResult}, + traits::fungibles::Inspect, +}; +use xcm::prelude::*; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; + +/// We are able to dry-run and estimate the fees for a multi-hop XCM journey. +/// Scenario: Alice on PenpalB has some DOTs and wants to send them to PenpalA. +/// We want to know the fees using the `DryRunApi` and `XcmPaymentApi`. +#[test] +fn multi_hop_works() { + let destination = PenpalB::sibling_location_of(PenpalA::para_id()); + let sender = PenpalBSender::get(); + let amount_to_send = 1_000_000_000_000; // One DOT is 10 decimals but it's configured in Penpal as 12. + let asset_owner = PenpalAssetOwner::get(); + let assets: Assets = (Parent, amount_to_send).into(); + let relay_native_asset_location = Location::parent(); + let sender_as_seen_by_ah = AssetHubPolkadot::sibling_location_of(PenpalB::para_id()); + let sov_of_sender_on_ah = + AssetHubPolkadot::sovereign_account_id_of(sender_as_seen_by_ah.clone()); + + // fund Parachain's sender account + PenpalB::mint_foreign_asset( + ::RuntimeOrigin::signed(asset_owner.clone()), + relay_native_asset_location.clone(), + sender.clone(), + amount_to_send * 2, + ); + + // fund the Parachain Origin's SA on AssetHub with the native tokens held in reserve. + AssetHubPolkadot::fund_accounts(vec![(sov_of_sender_on_ah.clone(), amount_to_send * 2)]); + + // Init values for Parachain Destination + let beneficiary_id = PenpalAReceiver::get(); + + let test_args = TestContext { + sender: PenpalBSender::get(), // Bob in PenpalB. + receiver: PenpalAReceiver::get(), // Alice. + args: TestArgs::new_para( + destination, + beneficiary_id.clone(), + amount_to_send, + assets, + None, + 0, + ), + }; + let mut test = ParaToParaThroughAHTest::new(test_args); + + // We get them from the PenpalB closure. + let mut delivery_fees_amount = 0; + let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + ::execute_with(|| { + type Runtime = ::Runtime; + type OriginCaller = ::OriginCaller; + + let call = transfer_assets_para_to_para_through_ah_call(test.clone()); + let origin = OriginCaller::system(RawOrigin::Signed(sender.clone())); + let result = Runtime::dry_run_call(origin, call).unwrap(); + // We filter the result to get only the messages we are interested in. + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(1, [Parachain(1000)])) + }) + .unwrap(); + assert_eq!(messages_to_query.len(), 1); + remote_message = messages_to_query[0].clone(); + let delivery_fees = + Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) + .unwrap(); + delivery_fees_amount = get_amount_from_versioned_assets(delivery_fees); + }); + + // These are set in the AssetHub closure. + let mut intermediate_execution_fees = 0; + let mut intermediate_delivery_fees_amount = 0; + let mut intermediate_remote_message = VersionedXcm::V4(Xcm::<()>(Vec::new())); + ::execute_with(|| { + type Runtime = ::Runtime; + type RuntimeCall = ::RuntimeCall; + + // First we get the execution fees. + let weight = Runtime::query_xcm_weight(remote_message.clone()).unwrap(); + intermediate_execution_fees = Runtime::query_weight_to_asset_fee( + weight, + VersionedAssetId::V4(Location::new(1, []).into()), + ) + .unwrap(); + + // We have to do this to turn `VersionedXcm<()>` into `VersionedXcm`. + let xcm_program = + VersionedXcm::V4(Xcm::::from(remote_message.clone().try_into().unwrap())); + + // Now we get the delivery fees to the final destination. + let result = + Runtime::dry_run_xcm(sender_as_seen_by_ah.clone().into(), xcm_program).unwrap(); + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(1, [Parachain(2000)])) + }) + .unwrap(); + // There's actually two messages here. + // One created when the message we sent from PenpalA arrived and was executed. + // The second one when we dry-run the xcm. + // We could've gotten the message from the queue without having to dry-run, but + // offchain applications would have to dry-run, so we do it here as well. + intermediate_remote_message = messages_to_query[0].clone(); + let delivery_fees = Runtime::query_delivery_fees( + destination_to_query.clone(), + intermediate_remote_message.clone(), + ) + .unwrap(); + intermediate_delivery_fees_amount = get_amount_from_versioned_assets(delivery_fees); + }); + + // Get the final execution fees in the destination. + let mut final_execution_fees = 0; + ::execute_with(|| { + type Runtime = ::Runtime; + + let weight = Runtime::query_xcm_weight(intermediate_remote_message.clone()).unwrap(); + final_execution_fees = + Runtime::query_weight_to_asset_fee(weight, VersionedAssetId::V4(Parent.into())) + .unwrap(); + }); + + // Dry-running is done. + PenpalB::reset_ext(); + AssetHubPolkadot::reset_ext(); + PenpalA::reset_ext(); + + // Fund accounts again. + PenpalB::mint_foreign_asset( + ::RuntimeOrigin::signed(asset_owner), + relay_native_asset_location.clone(), + sender.clone(), + amount_to_send * 2, + ); + AssetHubPolkadot::fund_accounts(vec![(sov_of_sender_on_ah, amount_to_send * 2)]); + + // Actually run the extrinsic. + let sender_assets_before = PenpalB::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location.clone(), &sender) + }); + let receiver_assets_before = PenpalA::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location.clone(), &beneficiary_id) + }); + + test.set_assertion::(sender_assertions); + test.set_assertion::(hop_assertions); + test.set_assertion::(receiver_assertions); + test.set_dispatchable::(transfer_assets_para_to_para_through_ah_dispatchable); + test.assert(); + + let sender_assets_after = PenpalB::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location.clone(), &sender) + }); + let receiver_assets_after = PenpalA::execute_with(|| { + type ForeignAssets = ::ForeignAssets; + >::balance(relay_native_asset_location, &beneficiary_id) + }); + + // We know the exact fees on every hop. + assert_eq!( + sender_assets_after, + sender_assets_before - amount_to_send - delivery_fees_amount /* This is charged directly + * from the sender's + * account. */ + ); + assert_eq!( + receiver_assets_after, + receiver_assets_before + amount_to_send - + intermediate_execution_fees - + intermediate_delivery_fees_amount - + final_execution_fees + ); +} + +fn sender_assertions(test: ParaToParaThroughAHTest) { + type RuntimeEvent = ::RuntimeEvent; + PenpalB::assert_xcm_pallet_attempted_complete(None); + + assert_expected_events!( + PenpalB, + vec![ + RuntimeEvent::ForeignAssets( + pallet_assets::Event::Burned { asset_id, owner, balance } + ) => { + asset_id: *asset_id == Location::new(1, []), + owner: *owner == test.sender.account_id, + balance: *balance == test.args.amount, + }, + ] + ); +} + +fn hop_assertions(test: ParaToParaThroughAHTest) { + type RuntimeEvent = ::RuntimeEvent; + AssetHubPolkadot::assert_xcmp_queue_success(None); + + assert_expected_events!( + AssetHubPolkadot, + vec![ + RuntimeEvent::Balances( + pallet_balances::Event::Burned { amount, .. } + ) => { + amount: *amount == test.args.amount, + }, + ] + ); +} + +fn receiver_assertions(test: ParaToParaThroughAHTest) { + type RuntimeEvent = ::RuntimeEvent; + PenpalA::assert_xcmp_queue_success(None); + + assert_expected_events!( + PenpalA, + vec![ + RuntimeEvent::ForeignAssets( + pallet_assets::Event::Issued { asset_id, owner, .. } + ) => { + asset_id: *asset_id == Location::new(1, []), + owner: *owner == test.receiver.account_id, + }, + ] + ); +} + +fn get_amount_from_versioned_assets(assets: VersionedAssets) -> u128 { + let latest_assets: Assets = assets.try_into().unwrap(); + let Fungible(amount) = latest_assets.inner()[0].fun else { + unreachable!("asset is fungible"); + }; + amount +} + +fn transfer_assets_para_to_para_through_ah_dispatchable( + test: ParaToParaThroughAHTest, +) -> DispatchResult { + let call = transfer_assets_para_to_para_through_ah_call(test.clone()); + match call.dispatch(test.signed_origin) { + Ok(_) => Ok(()), + Err(error_with_post_info) => Err(error_with_post_info.error), + } +} + +fn transfer_assets_para_to_para_through_ah_call( + test: ParaToParaThroughAHTest, +) -> ::RuntimeCall { + type RuntimeCall = ::RuntimeCall; + + let asset_hub_location: Location = PenpalB::sibling_location_of(AssetHubPolkadot::para_id()); + let custom_xcm_on_dest = Xcm::<()>(vec![DepositAsset { + assets: Wild(AllCounted(test.args.assets.len() as u32)), + beneficiary: test.args.beneficiary, + }]); + RuntimeCall::PolkadotXcm(pallet_xcm::Call::transfer_assets_using_type_and_then { + dest: bx!(test.args.dest.into()), + assets: bx!(test.args.assets.clone().into()), + assets_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.clone().into())), + remote_fees_id: bx!(VersionedAssetId::V4(AssetId(Location::new(1, [])))), + fees_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.into())), + custom_xcm_on_dest: bx!(VersionedXcm::from(custom_xcm_on_dest)), + weight_limit: test.args.weight_limit, + }) +} diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml index b3385f8dfb..7076d34d39 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml @@ -25,6 +25,7 @@ pallet-message-queue = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } # Cumulus emulated-integration-tests-common = { workspace = true } diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/lib.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/lib.rs index c930e54f2c..674bf32bb9 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/lib.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/lib.rs @@ -15,7 +15,7 @@ // Substrate pub use frame_support::{assert_err, assert_ok, pallet_prelude::DispatchResult}; -pub use sp_runtime::DispatchError; +pub use sp_runtime::{traits::Dispatchable, DispatchError}; // Polkadot pub use xcm::{ diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs index 5c94dde5b2..9304093e39 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs @@ -14,7 +14,11 @@ // limitations under the License. use crate::tests::*; -use frame_support::traits::fungible::Mutate; +use frame_support::{dispatch::RawOrigin, traits::fungible::Mutate}; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; fn send_asset_from_asset_hub_kusama_to_asset_hub_polkadot(id: Location, amount: u128) { let destination = asset_hub_polkadot_location(); @@ -32,6 +36,113 @@ fn send_asset_from_asset_hub_kusama_to_asset_hub_polkadot(id: Location, amount: assert_bridge_hub_polkadot_message_received(); } +fn dry_run_send_asset_from_asset_hub_kusama_to_asset_hub_polkadot( + id: Location, + amount: u128, +) -> u128 { + let destination = asset_hub_polkadot_location(); + + // fund the AHK's SA on BHK for paying bridge transport fees + BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id(), 10_000_000_000_000u128); + + // set XCM versions + AssetHubKusama::force_xcm_version(destination.clone(), XCM_VERSION); + BridgeHubKusama::force_xcm_version(bridge_hub_polkadot_location(), XCM_VERSION); + + let beneficiary: Location = + AccountId32Junction { id: AssetHubPolkadotReceiver::get().into(), network: None }.into(); + let assets: Assets = (id, amount).into(); + let fee_asset_item = 0; + let call = + send_asset_from_asset_hub_kusama_call(destination, beneficiary, assets, fee_asset_item); + let mut delivery_fees_amount = 0; + let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + AssetHubKusama::execute_with(|| { + type Runtime = ::Runtime; + type OriginCaller = ::OriginCaller; + + let origin = OriginCaller::system(RawOrigin::Signed(AssetHubKusamaSender::get())); + let result = Runtime::dry_run_call(origin, call).unwrap(); + // We filter the result to get only the messages we are interested in. + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(1, [Parachain(1002)])) + }) + .unwrap(); + dbg!(&result.forwarded_xcms); + assert_eq!(messages_to_query.len(), 1); + remote_message = messages_to_query[0].clone(); + let delivery_fees = + Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) + .unwrap(); + let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); + let Fungible(inner_delivery_fees_amount) = latest_delivery_fees.inner()[0].fun else { + unreachable!("asset is fungible"); + }; + delivery_fees_amount = inner_delivery_fees_amount; + }); + + let mut intermediate_execution_fees = 0; + let mut intermediate_delivery_fees_amount = 0; + let mut intermediate_remote_message = VersionedXcm::V4(Xcm(Vec::new())); + BridgeHubKusama::execute_with(|| { + type Runtime = ::Runtime; + type RuntimeCall = ::RuntimeCall; + + // First we get the execution fees. + let weight = Runtime::query_xcm_weight(remote_message.clone()).unwrap(); + intermediate_execution_fees = + Runtime::query_weight_to_asset_fee(weight, VersionedAssetId::V4(Parent.into())) + .unwrap(); + + // We have to do this to turn `VersionedXcm<()>` into `VersionedXcm`. + let xcm_program = + VersionedXcm::V4(Xcm::::from(remote_message.clone().try_into().unwrap())); + + // Now we get the delivery fees to the final destination. + let asset_hub_as_seen_by_bridge_hub: Location = Location::new(1, [Parachain(1000)]); + let result = + Runtime::dry_run_xcm(asset_hub_as_seen_by_bridge_hub.clone().into(), xcm_program) + .unwrap(); + + // We filter the result to get only the messages we are interested in. + // dbg!(&result.forwarded_xcms); + let (destination_to_query, messages_to_query) = &result + .forwarded_xcms + .iter() + .find(|(destination, _)| { + *destination == VersionedLocation::V4(Location::new(1, [Parachain(1002)])) + }) + .unwrap(); + // There's actually two messages here. + // One created when the message we sent from PenpalA arrived and was executed. + // The second one when we dry-run the xcm. + // We could've gotten the message from the queue without having to dry-run, but + // offchain applications would have to dry-run, so we do it here as well. + intermediate_remote_message = messages_to_query[0].clone(); + let delivery_fees = + Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) + .unwrap(); + let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); + let Fungible(inner_delivery_fees_amount) = latest_delivery_fees.inner()[0].fun else { + unreachable!("asset is fungible"); + }; + intermediate_delivery_fees_amount = inner_delivery_fees_amount; + }); + + dbg!(&delivery_fees_amount); + dbg!(&intermediate_execution_fees); + dbg!(&intermediate_delivery_fees_amount); + + // After dry-running we reset. + AssetHubKusama::reset_ext(); + BridgeHubKusama::reset_ext(); + + delivery_fees_amount +} + #[test] fn send_ksms_from_asset_hub_kusama_to_asset_hub_polkadot() { let ksm_at_asset_hub_kusama: v3::Location = v3::Parent.into(); @@ -61,6 +172,12 @@ fn send_ksms_from_asset_hub_kusama_to_asset_hub_polkadot() { let ksm_at_asset_hub_kusama_latest: Location = ksm_at_asset_hub_kusama.try_into().unwrap(); let amount = ASSET_HUB_KUSAMA_ED * 1_000; + // First dry-run. + let delivery_fees = dry_run_send_asset_from_asset_hub_kusama_to_asset_hub_polkadot( + ksm_at_asset_hub_kusama_latest.clone(), + amount, + ); + // Then send. send_asset_from_asset_hub_kusama_to_asset_hub_polkadot(ksm_at_asset_hub_kusama_latest, amount); AssetHubPolkadot::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; @@ -89,8 +206,15 @@ fn send_ksms_from_asset_hub_kusama_to_asset_hub_polkadot() { let ksms_in_reserve_on_ahk_after = ::account_data_of(sov_ahp_on_ahk.clone()).free; + dbg!(&sender_ksms_after); + dbg!(&sender_ksms_before); + dbg!(&amount); + dbg!(&delivery_fees); + dbg!(&receiver_ksms_after); + dbg!(&receiver_ksms_before); + // Sender's balance is reduced - assert!(sender_ksms_before > sender_ksms_after); + assert_eq!(sender_ksms_after, sender_ksms_before - amount - delivery_fees); // Receiver's balance is increased assert!(receiver_ksms_after > receiver_ksms_before); // Reserve balance is reduced by sent amount diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs index 9d5d7a9f38..fee51267b6 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs @@ -49,17 +49,32 @@ pub(crate) fn send_asset_from_asset_hub_kusama( let fee_asset_item = 0; AssetHubKusama::execute_with(|| { - ::PolkadotXcm::limited_reserve_transfer_assets( - signed_origin, - bx!(destination.into()), - bx!(beneficiary.into()), - bx!(assets.into()), - fee_asset_item, - WeightLimit::Unlimited, - ) + let call = + send_asset_from_asset_hub_kusama_call(destination, beneficiary, assets, fee_asset_item); + match call.dispatch(signed_origin) { + Ok(_) => Ok(()), + Err(error_with_post_info) => Err(error_with_post_info.error), + } }) } +pub(crate) fn send_asset_from_asset_hub_kusama_call( + destination: Location, + beneficiary: Location, + assets: Assets, + fee_asset_item: u32, +) -> ::RuntimeCall { + ::RuntimeCall::PolkadotXcm( + pallet_xcm::Call::limited_reserve_transfer_assets { + dest: bx!(destination.into()), + beneficiary: bx!(beneficiary.into()), + assets: bx!(assets.into()), + fee_asset_item, + weight_limit: WeightLimit::Unlimited, + }, + ) +} + pub(crate) fn assert_bridge_hub_kusama_message_accepted(expected_processed: bool) { BridgeHubKusama::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs index c1aebaabfc..58179e8c53 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs @@ -15,6 +15,16 @@ use crate::*; use bridge_hub_kusama_runtime::xcm_config::XcmConfig; +use frame_support::{ + dispatch::RawOrigin, sp_runtime::traits::Dispatchable, traits::fungible::Mutate, +}; +use integration_tests_helpers::{ + test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, +}; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; #[test] fn teleport_to_other_system_parachains_works() { @@ -28,3 +38,23 @@ fn teleport_to_other_system_parachains_works() { (native_asset, amount) ); } + +#[test] +fn teleport_from_and_to_relay() { + let amount = KUSAMA_ED * 1000; + let native_asset: Assets = (Here, amount).into(); + + test_relay_is_trusted_teleporter!( + Kusama, + KusamaXcmConfig, + vec![BridgeHubKusama], + (native_asset, amount) + ); + + test_parachain_is_trusted_teleporter_for_relay!( + BridgeHubKusama, + BridgeHubKusamaXcmConfig, + Kusama, + amount + ); +} diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml index c4034d7913..bb9ffdf9bb 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml @@ -25,6 +25,7 @@ pallet-message-queue = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } # Cumulus emulated-integration-tests-common = { workspace = true } diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs index 9aefaed933..5ab2ff4e60 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs @@ -60,6 +60,7 @@ pub use kusama_polkadot_system_emulated_network::{ AssetHubPolkadotParaSender as AssetHubPolkadotSender, BridgeHubKusamaPara as BridgeHubKusama, BridgeHubPolkadotPara as BridgeHubPolkadot, BridgeHubPolkadotParaSender as BridgeHubPolkadotSender, PolkadotRelay as Polkadot, + PolkadotRelayReceiver as PolkadotReceiver, PolkadotRelaySender as PolkadotSender, }; pub use parachains_common::{AccountId, Balance}; pub use polkadot_system_emulated_network::{ diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs index 76eec63125..07664c0d28 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs @@ -15,6 +15,16 @@ use crate::*; use bridge_hub_polkadot_runtime::xcm_config::XcmConfig; +use frame_support::{ + dispatch::RawOrigin, sp_runtime::traits::Dispatchable, traits::fungible::Mutate, +}; +use integration_tests_helpers::{ + test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, +}; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; #[test] fn teleport_to_other_system_parachains_works() { @@ -28,3 +38,23 @@ fn teleport_to_other_system_parachains_works() { (native_asset, amount) ); } + +#[test] +fn teleport_from_and_to_relay() { + let amount = BRIDGE_HUB_POLKADOT_ED * 1000; + let native_asset: Assets = (Here, amount).into(); + + test_relay_is_trusted_teleporter!( + Polkadot, + PolkadotXcmConfig, + vec![BridgeHubPolkadot], + (native_asset, amount) + ); + + test_parachain_is_trusted_teleporter_for_relay!( + BridgeHubPolkadot, + BridgeHubPolkadotXcmConfig, + Polkadot, + amount + ); +} diff --git a/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml b/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml index 9888f770f9..6a9e80de9b 100644 --- a/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml @@ -28,6 +28,7 @@ polkadot-runtime-common = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } # Cumulus asset-test-utils = { workspace = true } diff --git a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs index 27ccd27b55..d292fd195b 100644 --- a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs @@ -16,11 +16,16 @@ use crate::*; use asset_hub_polkadot_runtime::xcm_config::XcmConfig as AssetHubPolkadotXcmConfig; use collectives_polkadot_runtime::xcm_config::XcmConfig as CollectivesPolkadotXcmConfig; -use frame_support::assert_ok; +use frame_support::{ + assert_ok, dispatch::RawOrigin, sp_runtime::traits::Dispatchable, traits::fungible::Mutate, +}; use integration_tests_helpers::{ test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, }; -use polkadot_runtime::xcm_config::XcmConfig as PolkadotXcmConfig; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; #[test] fn teleport_from_and_to_relay() { diff --git a/integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml b/integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml new file mode 100644 index 0000000000..45acad6728 --- /dev/null +++ b/integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "coretime-kusama-integration-tests" +version.workspace = true +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +description = "Coretime Kusama runtime integration tests with xcm-emulator" +publish = false + +[dependencies] +codec = { workspace = true, default-features = true } + +# Substrate +sp-runtime = { workspace = true, default-features = true } +frame-support = { workspace = true, default-features = true } +pallet-balances = { workspace = true, default-features = true } +pallet-message-queue = { workspace = true, default-features = true } +pallet-identity = { workspace = true, default-features = true } + +# Polkadot +polkadot-runtime-common = { workspace = true, default-features = true } +pallet-xcm = { workspace = true, default-features = true } +xcm = { workspace = true, default-features = true } +xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } + +# Cumulus +parachains-common = { workspace = true, default-features = true } +emulated-integration-tests-common = { workspace = true } +asset-test-utils = { workspace = true } +cumulus-pallet-parachain-system = { workspace = true, default-features = true } + +# Local +kusama-runtime-constants = { workspace = true, default-features = true } +kusama-runtime = { workspace = true } +integration-tests-helpers = { workspace = true } +coretime-kusama-runtime = { workspace = true } +kusama-system-emulated-network = { workspace = true } diff --git a/integration-tests/emulated/tests/coretime/coretime-kusama/src/lib.rs b/integration-tests/emulated/tests/coretime/coretime-kusama/src/lib.rs new file mode 100644 index 0000000000..0d3e3ac75c --- /dev/null +++ b/integration-tests/emulated/tests/coretime/coretime-kusama/src/lib.rs @@ -0,0 +1,55 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub use codec::Encode; + +// Substrate +pub use frame_support::{ + assert_err, assert_ok, + pallet_prelude::Weight, + sp_runtime::{AccountId32, DispatchError, DispatchResult}, + traits::fungibles::Inspect, +}; + +// Polkadot +pub use xcm::{ + prelude::{AccountId32 as AccountId32Junction, *}, + v3::{Error, NetworkId::Kusama as KusamaId}, +}; + +// Cumulus +pub use asset_test_utils::xcm_helpers; +pub use emulated_integration_tests_common::{ + xcm_emulator::{ + assert_expected_events, bx, helpers::weight_within_threshold, Chain, Parachain as Para, + RelayChain as Relay, Test, TestArgs, TestContext, TestExt, + }, + xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution}, + PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3, +}; +pub use kusama_system_emulated_network::{ + coretime_kusama_emulated_chain::{ + genesis::ED as CORETIME_KUSAMA_ED, CoretimeKusamaParaPallet as CoretimeKusamaPallet, + }, + kusama_emulated_chain::{genesis::ED as KUSAMA_ED, KusamaRelayPallet as KusamaPallet}, + CoretimeKusamaPara as CoretimeKusama, CoretimeKusamaParaReceiver as CoretimeKusamaReceiver, + CoretimeKusamaParaSender as CoretimeKusamaSender, KusamaRelay as Kusama, + KusamaRelayReceiver as KusamaReceiver, KusamaRelaySender as KusamaSender, + PenpalAPara as PenpalA, +}; +pub use parachains_common::{AccountId, Balance}; + +#[cfg(test)] +mod tests; diff --git a/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/mod.rs b/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/mod.rs new file mode 100644 index 0000000000..516ec37cc1 --- /dev/null +++ b/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/mod.rs @@ -0,0 +1,16 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +mod teleport; diff --git a/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs new file mode 100644 index 0000000000..0e36821279 --- /dev/null +++ b/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs @@ -0,0 +1,46 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::*; +use frame_support::{ + dispatch::RawOrigin, sp_runtime::traits::Dispatchable, traits::fungible::Mutate, +}; +use integration_tests_helpers::{ + test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, +}; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; + +#[test] +fn teleport_from_and_to_relay() { + let amount = KUSAMA_ED * 1000; + let native_asset: Assets = (Here, amount).into(); + + test_relay_is_trusted_teleporter!( + Kusama, + KusamaXcmConfig, + vec![CoretimeKusama], + (native_asset, amount) + ); + + test_parachain_is_trusted_teleporter_for_relay!( + CoretimeKusama, + CoretimeKusamaXcmConfig, + Kusama, + amount + ); +} diff --git a/integration-tests/emulated/tests/people/people-kusama/Cargo.toml b/integration-tests/emulated/tests/people/people-kusama/Cargo.toml index 58b1a66d8b..140732df73 100644 --- a/integration-tests/emulated/tests/people/people-kusama/Cargo.toml +++ b/integration-tests/emulated/tests/people/people-kusama/Cargo.toml @@ -19,9 +19,10 @@ pallet-identity = { workspace = true, default-features = true } # Polkadot polkadot-runtime-common = { workspace = true, default-features = true } -xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } +xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } # Cumulus parachains-common = { workspace = true, default-features = true } @@ -32,5 +33,6 @@ cumulus-pallet-parachain-system = { workspace = true, default-features = true } # Local kusama-runtime-constants = { workspace = true, default-features = true } kusama-runtime = { workspace = true } +integration-tests-helpers = { workspace = true } people-kusama-runtime = { workspace = true } kusama-system-emulated-network = { workspace = true } diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs index 33647a3c43..33eb8d2bb8 100644 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs @@ -14,52 +14,35 @@ // limitations under the License. use crate::*; -use kusama_runtime::xcm_config::XcmConfig as KusamaXcmConfig; +use frame_support::{ + dispatch::RawOrigin, sp_runtime::traits::Dispatchable, traits::fungible::Mutate, +}; +use integration_tests_helpers::{ + test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, +}; use people_kusama_runtime::xcm_config::XcmConfig as PeopleKusamaXcmConfig; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; -fn relay_origin_assertions(t: RelayToSystemParaTest) { - type RuntimeEvent = ::RuntimeEvent; - Kusama::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(627_959_000, 7_200))); +#[test] +fn teleport_from_and_to_relay() { + let amount = KUSAMA_ED * 1000; + let native_asset: Assets = (Here, amount).into(); - assert_expected_events!( + test_relay_is_trusted_teleporter!( Kusama, - vec![ - // Amount to teleport is withdrawn from Sender - RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => { - who: *who == t.sender.account_id, - amount: *amount == t.args.amount, - }, - // Amount to teleport is deposited in Relay's `CheckAccount` - RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount }) => { - who: *who == ::XcmPallet::check_account(), - amount: *amount == t.args.amount, - }, - ] - ); -} - -fn relay_dest_assertions(t: SystemParaToRelayTest) { - type RuntimeEvent = ::RuntimeEvent; - - Kusama::assert_ump_queue_processed( - true, - Some(PeopleKusama::para_id()), - Some(Weight::from_parts(304_266_000, 7_186)), + KusamaXcmConfig, + vec![PeopleKusama], + (native_asset, amount) ); - assert_expected_events!( + test_parachain_is_trusted_teleporter_for_relay!( + PeopleKusama, + PeopleKusamaXcmConfig, Kusama, - vec![ - // Amount is withdrawn from Relay Chain's `CheckAccount` - RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => { - who: *who == ::XcmPallet::check_account(), - amount: *amount == t.args.amount, - }, - // Amount minus fees are deposited in Receiver's account - RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => { - who: *who == t.receiver.account_id, - }, - ] + amount ); } @@ -93,33 +76,6 @@ fn para_origin_assertions(t: SystemParaToRelayTest) { ); } -fn para_dest_assertions(t: RelayToSystemParaTest) { - type RuntimeEvent = ::RuntimeEvent; - - PeopleKusama::assert_dmp_queue_complete(Some(Weight::from_parts(162_456_000, 0))); - - assert_expected_events!( - PeopleKusama, - vec![ - // Amount minus fees are deposited in Receiver's account - RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => { - who: *who == t.receiver.account_id, - }, - ] - ); -} - -fn relay_limited_teleport_assets(t: RelayToSystemParaTest) -> DispatchResult { - ::XcmPallet::limited_teleport_assets( - t.signed_origin, - bx!(t.args.dest.into()), - bx!(t.args.beneficiary.into()), - bx!(t.args.assets.into()), - t.args.fee_asset_item, - t.args.weight_limit, - ) -} - fn system_para_limited_teleport_assets(t: SystemParaToRelayTest) -> DispatchResult { ::PolkadotXcm::limited_teleport_assets( t.signed_origin, @@ -131,90 +87,6 @@ fn system_para_limited_teleport_assets(t: SystemParaToRelayTest) -> DispatchResu ) } -/// Limited Teleport of native asset from Relay Chain to the System Parachain should work -#[test] -fn limited_teleport_native_assets_from_relay_to_system_para_works() { - // Init values for Relay Chain - let amount_to_send: Balance = KUSAMA_ED * 1000; - let dest = Kusama::child_location_of(PeopleKusama::para_id()); - let beneficiary_id = PeopleKusamaReceiver::get(); - let test_args = TestContext { - sender: KusamaSender::get(), - receiver: PeopleKusamaReceiver::get(), - args: TestArgs::new_relay(dest, beneficiary_id, amount_to_send), - }; - - let mut test = RelayToSystemParaTest::new(test_args); - - let sender_balance_before = test.sender.balance; - let receiver_balance_before = test.receiver.balance; - - test.set_assertion::(relay_origin_assertions); - test.set_assertion::(para_dest_assertions); - test.set_dispatchable::(relay_limited_teleport_assets); - test.assert(); - - let delivery_fees = Kusama::execute_with(|| { - xcm_helpers::teleport_assets_delivery_fees::< - ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) - }); - - let sender_balance_after = test.sender.balance; - let receiver_balance_after = test.receiver.balance; - - // Sender's balance is reduced - assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after); - // Receiver's balance is increased - assert!(receiver_balance_after > receiver_balance_before); -} - -/// Limited Teleport of native asset from System Parachain to Relay Chain -/// should work when there is enough balance in Relay Chain's `CheckAccount` -#[test] -fn limited_teleport_native_assets_back_from_system_para_to_relay_works() { - // Dependency - Relay Chain's `CheckAccount` should have enough balance - limited_teleport_native_assets_from_relay_to_system_para_works(); - - let amount_to_send: Balance = PEOPLE_KUSAMA_ED * 1000; - let destination = PeopleKusama::parent_location(); - let beneficiary_id = KusamaReceiver::get(); - let assets = (Parent, amount_to_send).into(); - - // Fund a sender - PeopleKusama::fund_accounts(vec![(PeopleKusamaSender::get(), KUSAMA_ED * 2_000u128)]); - - let test_args = TestContext { - sender: PeopleKusamaSender::get(), - receiver: KusamaReceiver::get(), - args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0), - }; - - let mut test = SystemParaToRelayTest::new(test_args); - - let sender_balance_before = test.sender.balance; - let receiver_balance_before = test.receiver.balance; - - test.set_assertion::(para_origin_assertions); - test.set_assertion::(relay_dest_assertions); - test.set_dispatchable::(system_para_limited_teleport_assets); - test.assert(); - - let sender_balance_after = test.sender.balance; - let receiver_balance_after = test.receiver.balance; - - let delivery_fees = PeopleKusama::execute_with(|| { - xcm_helpers::teleport_assets_delivery_fees::< - ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) - }); - - // Sender's balance is reduced - assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after); - // Receiver's balance is increased - assert!(receiver_balance_after > receiver_balance_before); -} - /// Limited Teleport of native asset from System Parachain to Relay Chain /// should't work when there is not enough balance in Relay Chain's `CheckAccount` #[test] diff --git a/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml b/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml index 5276c94e56..de541e552b 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml @@ -19,9 +19,10 @@ pallet-identity = { workspace = true, default-features = true } # Polkadot polkadot-runtime-common = { workspace = true, default-features = true } -xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } +xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true, default-features = true } # Cumulus parachains-common = { workspace = true, default-features = true } @@ -32,5 +33,6 @@ cumulus-pallet-parachain-system = { workspace = true, default-features = true } # Local polkadot-runtime-constants = { workspace = true, default-features = true } polkadot-runtime = { workspace = true } +integration-tests-helpers = { workspace = true } people-polkadot-runtime = { workspace = true } polkadot-system-emulated-network = { workspace = true } diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs index 3907a941a5..1904e53405 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs @@ -14,52 +14,35 @@ // limitations under the License. use crate::*; +use frame_support::{ + dispatch::RawOrigin, sp_runtime::traits::Dispatchable, traits::fungible::Mutate, +}; +use integration_tests_helpers::{ + test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, +}; use people_polkadot_runtime::xcm_config::XcmConfig as PeoplePolkadotXcmConfig; -use polkadot_runtime::xcm_config::XcmConfig as PolkadotXcmConfig; +use xcm_fee_payment_runtime_api::{ + dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, + fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, +}; -fn relay_origin_assertions(t: RelayToSystemParaTest) { - type RuntimeEvent = ::RuntimeEvent; - Polkadot::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(627_959_000, 7_200))); +#[test] +fn teleport_from_and_to_relay() { + let amount = KUSAMA_ED * 1000; + let native_asset: Assets = (Here, amount).into(); - assert_expected_events!( + test_relay_is_trusted_teleporter!( Polkadot, - vec![ - // Amount to teleport is withdrawn from Sender - RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => { - who: *who == t.sender.account_id, - amount: *amount == t.args.amount, - }, - // Amount to teleport is deposited in Relay's `CheckAccount` - RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount }) => { - who: *who == ::XcmPallet::check_account(), - amount: *amount == t.args.amount, - }, - ] - ); -} - -fn relay_dest_assertions(t: SystemParaToRelayTest) { - type RuntimeEvent = ::RuntimeEvent; - - Polkadot::assert_ump_queue_processed( - true, - Some(PeoplePolkadot::para_id()), - Some(Weight::from_parts(304_266_000, 7_186)), + PolkadotXcmConfig, + vec![PeoplePolkadot], + (native_asset, amount) ); - assert_expected_events!( + test_parachain_is_trusted_teleporter_for_relay!( + PeoplePolkadot, + PeoplePolkadotXcmConfig, Polkadot, - vec![ - // Amount is withdrawn from Relay Chain's `CheckAccount` - RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => { - who: *who == ::XcmPallet::check_account(), - amount: *amount == t.args.amount, - }, - // Amount minus fees are deposited in Receiver's account - RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => { - who: *who == t.receiver.account_id, - }, - ] + amount ); } @@ -93,33 +76,6 @@ fn para_origin_assertions(t: SystemParaToRelayTest) { ); } -fn para_dest_assertions(t: RelayToSystemParaTest) { - type RuntimeEvent = ::RuntimeEvent; - - PeoplePolkadot::assert_dmp_queue_complete(Some(Weight::from_parts(162_456_000, 0))); - - assert_expected_events!( - PeoplePolkadot, - vec![ - // Amount minus fees are deposited in Receiver's account - RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => { - who: *who == t.receiver.account_id, - }, - ] - ); -} - -fn relay_limited_teleport_assets(t: RelayToSystemParaTest) -> DispatchResult { - ::XcmPallet::limited_teleport_assets( - t.signed_origin, - bx!(t.args.dest.into()), - bx!(t.args.beneficiary.into()), - bx!(t.args.assets.into()), - t.args.fee_asset_item, - t.args.weight_limit, - ) -} - fn system_para_limited_teleport_assets(t: SystemParaToRelayTest) -> DispatchResult { ::PolkadotXcm::limited_teleport_assets( t.signed_origin, @@ -131,90 +87,6 @@ fn system_para_limited_teleport_assets(t: SystemParaToRelayTest) -> DispatchResu ) } -/// Limited Teleport of native asset from Relay Chain to the System Parachain should work -#[test] -fn limited_teleport_native_assets_from_relay_to_system_para_works() { - // Init values for Relay Chain - let amount_to_send: Balance = KUSAMA_ED * 1000; - let dest = Polkadot::child_location_of(PeoplePolkadot::para_id()); - let beneficiary_id = PeoplePolkadotReceiver::get(); - let test_args = TestContext { - sender: PolkadotSender::get(), - receiver: PeoplePolkadotReceiver::get(), - args: TestArgs::new_relay(dest, beneficiary_id, amount_to_send), - }; - - let mut test = RelayToSystemParaTest::new(test_args); - - let sender_balance_before = test.sender.balance; - let receiver_balance_before = test.receiver.balance; - - test.set_assertion::(relay_origin_assertions); - test.set_assertion::(para_dest_assertions); - test.set_dispatchable::(relay_limited_teleport_assets); - test.assert(); - - let delivery_fees = Polkadot::execute_with(|| { - xcm_helpers::teleport_assets_delivery_fees::< - ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) - }); - - let sender_balance_after = test.sender.balance; - let receiver_balance_after = test.receiver.balance; - - // Sender's balance is reduced - assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after); - // Receiver's balance is increased - assert!(receiver_balance_after > receiver_balance_before); -} - -/// Limited Teleport of native asset from System Parachain to Relay Chain -/// should work when there is enough balance in Relay Chain's `CheckAccount` -#[test] -fn limited_teleport_native_assets_back_from_system_para_to_relay_works() { - // Dependency - Relay Chain's `CheckAccount` should have enough balance - limited_teleport_native_assets_from_relay_to_system_para_works(); - - let amount_to_send: Balance = PEOPLE_KUSAMA_ED * 1000; - let destination = PeoplePolkadot::parent_location(); - let beneficiary_id = PolkadotReceiver::get(); - let assets = (Parent, amount_to_send).into(); - - // Fund a sender - PeoplePolkadot::fund_accounts(vec![(PeoplePolkadotSender::get(), KUSAMA_ED * 2_000u128)]); - - let test_args = TestContext { - sender: PeoplePolkadotSender::get(), - receiver: PolkadotReceiver::get(), - args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0), - }; - - let mut test = SystemParaToRelayTest::new(test_args); - - let sender_balance_before = test.sender.balance; - let receiver_balance_before = test.receiver.balance; - - test.set_assertion::(para_origin_assertions); - test.set_assertion::(relay_dest_assertions); - test.set_dispatchable::(system_para_limited_teleport_assets); - test.assert(); - - let sender_balance_after = test.sender.balance; - let receiver_balance_after = test.receiver.balance; - - let delivery_fees = PeoplePolkadot::execute_with(|| { - xcm_helpers::teleport_assets_delivery_fees::< - ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) - }); - - // Sender's balance is reduced - assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after); - // Receiver's balance is increased - assert!(receiver_balance_after > receiver_balance_before); -} - /// Limited Teleport of native asset from System Parachain to Relay Chain /// should't work when there is not enough balance in Relay Chain's `CheckAccount` #[test] diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml index 7c0cf5d39b..e5c7b53bcb 100644 --- a/relay/kusama/Cargo.toml +++ b/relay/kusama/Cargo.toml @@ -101,6 +101,7 @@ polkadot-primitives = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } xcm-builder = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } sp-debug-derive = { workspace = true } @@ -210,6 +211,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -261,6 +263,7 @@ runtime-benchmarks = [ "sp-staking/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks" ] try-runtime = [ "frame-election-provider-support/try-runtime", diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index b2949c5585..a37f74740e 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -81,7 +81,7 @@ use frame_support::{ InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, StorageMapShim, WithdrawReasons, }, - weights::{ConstantMultiplier, WeightMeter}, + weights::{ConstantMultiplier, WeightMeter, WeightToFee as _}, PalletId, }; use frame_system::EnsureRoot; @@ -102,11 +102,12 @@ use sp_staking::SessionIndex; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use xcm::{ - latest::{InteriorLocation, Junction, Junction::PalletInstance}, - VersionedLocation, -}; +use xcm::prelude::*; use xcm_builder::PayOverXcm; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; @@ -2237,6 +2238,48 @@ sp_api::impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::TokenLocation::get())]; + XcmPallet::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::TokenLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + XcmPallet::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + XcmPallet::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + XcmPallet::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + XcmPallet::dry_run_xcm::(origin_location, xcm) + } + } + impl pallet_nomination_pools_runtime_api::NominationPoolsApi< Block, AccountId, diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index f11edec300..968bac44d0 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -99,6 +99,7 @@ polkadot-primitives = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } xcm-builder = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } sp-debug-derive = { workspace = true } @@ -207,6 +208,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -256,6 +258,7 @@ runtime-benchmarks = [ "sp-staking/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ "frame-election-provider-support/try-runtime", diff --git a/relay/polkadot/src/impls.rs b/relay/polkadot/src/impls.rs index efce64c99a..fa690a1a8d 100644 --- a/relay/polkadot/src/impls.rs +++ b/relay/polkadot/src/impls.rs @@ -26,7 +26,6 @@ use frame_system::RawOrigin; use polkadot_primitives::Id as ParaId; use polkadot_runtime_common::identity_migrator::{OnReapIdentity, WeightInfo}; use polkadot_runtime_constants::system_parachain::PEOPLE_ID; -use xcm::{latest::prelude::*, VersionedXcm}; use xcm_builder::IsChildSystemParachain; use xcm_executor::traits::TransactAsset; diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index b45360a8b7..631fcc9cdc 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -65,7 +65,7 @@ use frame_support::{ Get, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, WithdrawReasons, }, - weights::{ConstantMultiplier, WeightMeter}, + weights::{ConstantMultiplier, WeightMeter, WeightToFee as _}, PalletId, }; use frame_system::EnsureRoot; @@ -102,11 +102,12 @@ use sp_std::{ #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use xcm::{ - latest::{InteriorLocation, Junction, Junction::PalletInstance}, - VersionedLocation, -}; +use xcm::prelude::*; use xcm_builder::PayOverXcm; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; @@ -2336,6 +2337,48 @@ sp_api::impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::TokenLocation::get())]; + XcmPallet::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::TokenLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + XcmPallet::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + XcmPallet::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + XcmPallet::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + XcmPallet::dry_run_xcm::(origin_location, xcm) + } + } + impl sp_genesis_builder::GenesisBuilder for Runtime { fn build_state(config: Vec) -> sp_genesis_builder::Result { build_state::(config) diff --git a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml index 1184dfc2f2..2e7bd9d438 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml @@ -81,6 +81,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -157,6 +158,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -272,6 +274,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std", ] # Enable metadata hash generation at compile time for the `CheckMetadataHash` extension. diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 09be6931df..42b4befc18 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -63,7 +63,7 @@ use frame_support::{ ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse, EnsureOrigin, EnsureOriginWithArg, Equals, InstanceFilter, TransformOrigin, WithdrawReasons, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, BoundedVec, PalletId, }; use frame_system::{ @@ -81,12 +81,19 @@ use system_parachains_constants::{ kusama::{consensus::*, currency::*, fee::WeightToFee}, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }; -use xcm::latest::prelude::{AssetId, BodyId}; +use xcm::{ + latest::prelude::{AssetId, BodyId}, + VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm, +}; use xcm_config::{ FellowshipLocation, ForeignAssetsConvertedConcreteId, ForeignCreatorsSovereignAccountOf, GovernanceLocation, KsmLocation, KsmLocationV3, PoolAssetsConvertedConcreteId, TrustBackedAssetsConvertedConcreteId, TrustBackedAssetsPalletLocationV3, }; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -1283,6 +1290,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::KsmLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::KsmLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl assets_common::runtime_api::FungiblesApi< Block, AccountId, diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index 4dce9f6a45..081e61c224 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -81,6 +81,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -145,6 +146,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -254,6 +256,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std", ] # Enable metadata hash generation at compile time for the `CheckMetadataHash` extension. diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index f163a6bcfa..db4537a508 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -80,6 +80,10 @@ use sp_runtime::{ ApplyExtrinsicResult, Perbill, Permill, }; use xcm_config::TrustBackedAssetsPalletLocationV3; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; use sp_std::prelude::*; #[cfg(feature = "std")] @@ -97,7 +101,7 @@ use frame_support::{ ConstU32, ConstU64, ConstU8, EitherOfDiverse, EnsureOrigin, EnsureOriginWithArg, Equals, InstanceFilter, NeverEnsureOrigin, TransformOrigin, WithdrawReasons, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, }; use frame_system::{ @@ -116,7 +120,10 @@ use system_parachains_constants::{ polkadot::{consensus::*, currency::*, fee::WeightToFee}, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }; -use xcm::latest::prelude::{AssetId, BodyId}; +use xcm::{ + latest::prelude::{AssetId, BodyId}, + VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm, +}; use xcm_config::{ DotLocation, DotLocationV3, FellowshipLocation, ForeignAssetsConvertedConcreteId, ForeignCreatorsSovereignAccountOf, GovernanceLocation, PoolAssetsConvertedConcreteId, @@ -1244,6 +1251,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::DotLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::DotLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl assets_common::runtime_api::FungiblesApi< Block, AccountId, diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml index 6eb8dea2a9..3d972459a8 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -70,6 +70,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -221,7 +222,8 @@ std = [ "xcm-executor/std", "xcm/std", "bp-polkadot-bulletin/std", - "tuplex/std" + "tuplex/std", + "xcm-fee-payment-runtime-api/std", ] runtime-benchmarks = [ @@ -264,6 +266,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index 48fa7da454..96784c165d 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -60,7 +60,7 @@ use frame_support::{ tokens::imbalance::ResolveTo, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, TransformOrigin, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, }; use frame_system::{ @@ -91,6 +91,10 @@ use system_parachains_constants::{ // XCM Imports use xcm::prelude::*; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; /// The address format for describing accounts. pub type Address = MultiAddress; @@ -739,6 +743,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::KsmRelayLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::KsmRelayLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl cumulus_primitives_core::CollectCollationInfo for Runtime { fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml index 7ce786eb5b..d683b0c496 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -70,6 +70,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -217,7 +218,8 @@ std = [ "xcm-executor/std", "xcm/std", "bp-polkadot-bulletin/std", - "tuplex/std" + "tuplex/std", + "xcm-fee-payment-runtime-api/std", ] runtime-benchmarks = [ @@ -259,6 +261,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 7adceeecf3..2c41fa5ee3 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -60,7 +60,7 @@ use frame_support::{ tokens::imbalance::ResolveTo, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, TransformOrigin, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, }; use frame_system::{ @@ -93,6 +93,10 @@ use system_parachains_constants::{ // XCM Imports use xcm::prelude::*; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; /// The address format for describing accounts. pub type Address = MultiAddress; @@ -748,6 +752,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::DotRelayLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::DotRelayLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl cumulus_primitives_core::CollectCollationInfo for Runtime { fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) diff --git a/system-parachains/collectives/collectives-polkadot/Cargo.toml b/system-parachains/collectives/collectives-polkadot/Cargo.toml index 83d9d08b1c..48e4e56133 100644 --- a/system-parachains/collectives/collectives-polkadot/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/Cargo.toml @@ -68,6 +68,7 @@ polkadot-runtime-constants = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -125,6 +126,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -229,6 +231,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std", ] # Enable metadata hash generation at compile time for the `CheckMetadataHash` extension. diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index e7b06c621f..7fb5fc5dfa 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -73,7 +73,7 @@ use frame_support::{ fungible::HoldConsideration, tokens::imbalance::ResolveTo, ConstBool, ConstU16, ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter, LinearStoragePrice, TransformOrigin, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, }; use frame_system::{ @@ -101,6 +101,10 @@ pub use sp_runtime::BuildStorage; use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use xcm::prelude::*; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; @@ -951,6 +955,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::DotLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::DotLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl cumulus_primitives_core::CollectCollationInfo for Runtime { fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) diff --git a/system-parachains/coretime/coretime-kusama/Cargo.toml b/system-parachains/coretime/coretime-kusama/Cargo.toml index 810e50bffd..6af63bf4e1 100644 --- a/system-parachains/coretime/coretime-kusama/Cargo.toml +++ b/system-parachains/coretime/coretime-kusama/Cargo.toml @@ -63,6 +63,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -147,6 +148,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std", ] runtime-benchmarks = [ @@ -175,6 +177,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/coretime/coretime-kusama/src/lib.rs b/system-parachains/coretime/coretime-kusama/src/lib.rs index aefd31d6f8..a2b87a2509 100644 --- a/system-parachains/coretime/coretime-kusama/src/lib.rs +++ b/system-parachains/coretime/coretime-kusama/src/lib.rs @@ -40,7 +40,7 @@ use frame_support::{ tokens::imbalance::ResolveTo, ConstBool, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, EverythingBut, InstanceFilter, TransformOrigin, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, }; use frame_system::{ @@ -72,11 +72,15 @@ use system_parachains_constants::{ AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; -use xcm::latest::prelude::*; +use xcm::prelude::*; use xcm_config::{ FellowshipLocation, GovernanceLocation, KsmRelayLocation, StakingPot, XcmOriginToTransactDispatchOrigin, }; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; /// The address format for describing accounts. pub type Address = MultiAddress; @@ -796,6 +800,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::KsmRelayLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::KsmRelayLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl cumulus_primitives_core::CollectCollationInfo for Runtime { fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 0f75e3365b..0a5082c3d9 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -84,6 +84,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus dependencies cumulus-pallet-aura-ext = { workspace = true } @@ -150,6 +151,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] std = [ "codec/std", @@ -224,6 +226,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std", ] diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 0cce8191c3..61ea918c8c 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -61,7 +61,7 @@ use frame_support::{ ConstBool, ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, TransformOrigin, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, }; use frame_system::{ @@ -103,7 +103,14 @@ use system_parachains_constants::{ SLOT_DURATION, }; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; -use xcm::latest::prelude::{AssetId as XcmAssetId, BodyId}; +use xcm::{ + latest::prelude::{AssetId as XcmAssetId, BodyId}, + VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm, +}; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; use xcm_config::{KsmLocation, StakingPot, XcmOriginToTransactDispatchOrigin}; @@ -916,6 +923,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![XcmAssetId(xcm_config::KsmLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::KsmLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl cumulus_primitives_core::CollectCollationInfo for Runtime { fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) diff --git a/system-parachains/people/people-kusama/Cargo.toml b/system-parachains/people/people-kusama/Cargo.toml index 9ebd65ac38..321df5d416 100644 --- a/system-parachains/people/people-kusama/Cargo.toml +++ b/system-parachains/people/people-kusama/Cargo.toml @@ -61,6 +61,7 @@ kusama-runtime-constants = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-primitives-aura = { workspace = true } @@ -143,7 +144,8 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", - "polkadot-primitives/std" + "polkadot-primitives/std", + "xcm-fee-payment-runtime-api/std", ] runtime-benchmarks = [ @@ -172,7 +174,8 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks" + "polkadot-primitives/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index 5e82749ca7..0585af8e62 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -35,7 +35,9 @@ use frame_support::{ tokens::imbalance::ResolveTo, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, InstanceFilter, TransformOrigin, }, - weights::{constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight}, + weights::{ + constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFee as _, + }, PalletId, }; use frame_system::{ @@ -69,11 +71,18 @@ use system_parachains_constants::kusama::{ consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, currency::*, fee::WeightToFee, }; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; -use xcm::latest::prelude::BodyId; +use xcm::{ + latest::prelude::{AssetId, BodyId}, + VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm, +}; use xcm_config::{ FellowshipLocation, GovernanceLocation, PriceForSiblingParachainDelivery, StakingPot, XcmConfig, XcmOriginToTransactDispatchOrigin, }; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; /// This determines the average expected block time that we are targeting. Blocks will be /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by @@ -783,6 +792,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::RelayLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::RelayLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl cumulus_primitives_core::CollectCollationInfo for Runtime { fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) diff --git a/system-parachains/people/people-polkadot/Cargo.toml b/system-parachains/people/people-polkadot/Cargo.toml index 5fbf1bc4d0..56eb9e8810 100644 --- a/system-parachains/people/people-polkadot/Cargo.toml +++ b/system-parachains/people/people-polkadot/Cargo.toml @@ -60,6 +60,7 @@ polkadot-runtime-constants = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +xcm-fee-payment-runtime-api = { workspace = true } # Cumulus cumulus-primitives-aura = { workspace = true } @@ -140,6 +141,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "xcm-fee-payment-runtime-api/std", ] runtime-benchmarks = [ @@ -168,6 +170,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/people/people-polkadot/src/lib.rs b/system-parachains/people/people-polkadot/src/lib.rs index 001115df32..3208474c6e 100644 --- a/system-parachains/people/people-polkadot/src/lib.rs +++ b/system-parachains/people/people-polkadot/src/lib.rs @@ -34,7 +34,7 @@ use frame_support::{ tokens::imbalance::ResolveTo, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, InstanceFilter, TransformOrigin, }, - weights::{ConstantMultiplier, Weight}, + weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, }; use frame_system::{ @@ -66,11 +66,18 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use system_parachains_constants::polkadot::{consensus::*, currency::*, fee::WeightToFee}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; -use xcm::latest::prelude::BodyId; +use xcm::{ + latest::prelude::{AssetId, BodyId}, + VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm, +}; use xcm_config::{ FellowshipLocation, GovernanceLocation, PriceForSiblingParachainDelivery, StakingPot, XcmConfig, XcmOriginToTransactDispatchOrigin, }; +use xcm_fee_payment_runtime_api::{ + dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, + fees::Error as XcmPaymentApiError, +}; /// The address format for describing accounts. pub type Address = MultiAddress; @@ -735,6 +742,48 @@ impl_runtime_apis! { } } + impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { + let acceptable_assets = vec![AssetId(xcm_config::RelayLocation::get())]; + PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) + } + + fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result { + match asset.try_as::() { + Ok(asset_id) if asset_id.0 == xcm_config::RelayLocation::get() => { + // for native token + Ok(WeightToFee::weight_to_fee(&weight)) + }, + Ok(asset_id) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + Err(XcmPaymentApiError::AssetNotFound) + }, + Err(_) => { + log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + Err(XcmPaymentApiError::VersionedConversionFailed) + } + } + } + + fn query_xcm_weight(message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_xcm_weight(message) + } + + fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result { + PolkadotXcm::query_delivery_fees(destination, message) + } + } + + impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_call::(origin, call) + } + + fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm) -> Result, XcmDryRunApiError> { + PolkadotXcm::dry_run_xcm::(origin_location, xcm) + } + } + impl cumulus_primitives_core::CollectCollationInfo for Runtime { fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) From 5fa4ff0ad5ee3999ebb7f4e27933390f061b9ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 24 Jul 2024 12:44:33 +0200 Subject: [PATCH 03/14] Improve test names (#399) The name of the "All changelog tests passing" was clashing with the name of the "All tests passing" test. Give the check features test a name. Both changes are required to mark these tests as required in github. - [x] Does not require a CHANGELOG entry --- .github/workflows/changelog.yml | 2 +- .github/workflows/check-features.yaml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 5e955521b8..ce214b022d 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -50,7 +50,7 @@ jobs: # If you add more jobs, remember to add them to the "needs" array. confirmChangelogChecksPassed: runs-on: ubuntu-latest - name: All tests passed + name: All changelog tests passed # If any new job gets added, be sure to add it to this list needs: - verify-changelog-updated diff --git a/.github/workflows/check-features.yaml b/.github/workflows/check-features.yaml index d5b72129d0..f816bcd37e 100644 --- a/.github/workflows/check-features.yaml +++ b/.github/workflows/check-features.yaml @@ -1,5 +1,5 @@ # Various checks to verify the cargo workspace and its crates are correctly configured. -name: "Workspace" +name: "Workspace features" on: push: @@ -13,6 +13,7 @@ concurrency: cancel-in-progress: true jobs: + name: Check workspace features check: runs-on: ubuntu-22.04 From c61e836f2e57e07258b13a8868c64cb8f2fc495c Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Wed, 24 Jul 2024 14:35:03 +0200 Subject: [PATCH 04/14] Fix CI + one integration test for `bridge-hub-kusama` (#397) Closes: https://github.com/polkadot-fellows/runtimes/issues/396 This PR: - fixes CI test pipelines to block PRs when tests fail. See more details [here](https://github.com/polkadot-fellows/runtimes/issues/396). - Fixes an integration test for `bridge-hub-kusama-integration-tests` that was not caught due to a previous CI bug. - Includes some minor cleanup, changing `Versioned*::V4` to `Versioned*::from` to use the latest version (for easier migration to `xcm:v5`). ## TODO - [x] fix the integration tests - [X] Does not require a CHANGELOG entry --------- Co-authored-by: Javier Bullrich --- .github/workflows/changelog.yml | 9 +- .github/workflows/test.yml | 2 - integration-tests/emulated/helpers/src/lib.rs | 12 +- .../asset-hub-kusama/src/tests/treasury.rs | 13 ++- .../src/tests/xcm_fee_estimation.rs | 31 ++--- .../src/tests/xcm_fee_estimation.rs | 31 ++--- .../src/tests/asset_transfers.rs | 106 +++++------------- .../bridge-hub-kusama/src/tests/snowbridge.rs | 6 +- .../src/tests/snowbridge.rs | 6 +- .../src/tests/fellowship.rs | 4 +- .../src/tests/fellowship_treasury.rs | 15 +-- .../people-kusama/src/tests/governance.rs | 4 +- .../people-polkadot/src/tests/governance.rs | 4 +- relay/polkadot/src/impls.rs | 4 +- 14 files changed, 103 insertions(+), 144 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index ce214b022d..5dbb738b70 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,6 +1,6 @@ name: Verify Changelog -# If you modify more test jobs, ensure that you add them as required to the job "confirmTestPassed" +# If you modify more test jobs, ensure that you add them as required to the job "confirmChangelogChecksPassed" # which is located at the end of this file (more info in the job) on: @@ -16,7 +16,7 @@ concurrency: cancel-in-progress: true jobs: - + # Job required by "confirmChangelogChecksPassed" verify-changelog-updated: name: Verify that Changelog is Updated runs-on: ubuntu-latest @@ -32,6 +32,7 @@ jobs: if: steps.changed.outputs.matched != 'true' && !contains(github.event.pull_request.body, '[x] Does not require a CHANGELOG entry') run: echo "::error::CHANGELOG.md has not been modified. Either modify the file or check the checkbox in the body" && exit 1 + # Job required by "confirmChangelogChecksPassed" verify-changelog-valid: name: Verify that Changelog is valid runs-on: ubuntu-latest @@ -50,10 +51,10 @@ jobs: # If you add more jobs, remember to add them to the "needs" array. confirmChangelogChecksPassed: runs-on: ubuntu-latest - name: All changelog tests passed + name: All changelog checks passed # If any new job gets added, be sure to add it to this list needs: - verify-changelog-updated - verify-changelog-valid steps: - - run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY + - run: echo '### Good job! All the changelog checks passed 🚀' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57135cf99f..547d17fe9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,7 +45,6 @@ jobs: # Job required by "confirmTestPassed" runtime-test: needs: [runtime-matrix] - continue-on-error: true runs-on: ubuntu-22.04 strategy: matrix: @@ -97,7 +96,6 @@ jobs: # Job required by "confirmTestPassed" integration-test: needs: [integration-test-matrix] - continue-on-error: true runs-on: ubuntu-22.04 strategy: matrix: diff --git a/integration-tests/emulated/helpers/src/lib.rs b/integration-tests/emulated/helpers/src/lib.rs index 096e91b3b7..5e182829fc 100644 --- a/integration-tests/emulated/helpers/src/lib.rs +++ b/integration-tests/emulated/helpers/src/lib.rs @@ -63,7 +63,7 @@ macro_rules! test_relay_is_trusted_teleporter { weight_limit: weight_limit.clone(), }); let mut delivery_fees_amount = 0; - let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + let mut remote_message = VersionedXcm::from(Xcm(Vec::new())); <$sender_relay>::execute_with(|| { type Runtime = <$sender_relay as Chain>::Runtime; type OriginCaller = <$sender_relay as Chain>::OriginCaller; @@ -75,7 +75,7 @@ macro_rules! test_relay_is_trusted_teleporter { .forwarded_xcms .iter() .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(0, [Parachain(<$receiver_para>::para_id().into())])) + *destination == VersionedLocation::from(Location::new(0, [Parachain(<$receiver_para>::para_id().into())])) }) .unwrap(); assert_eq!(messages_to_query.len(), 1); @@ -85,7 +85,7 @@ macro_rules! test_relay_is_trusted_teleporter { .unwrap(); let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); let Fungible(inner_delivery_fees_amount) = latest_delivery_fees.inner()[0].fun else { - unreachable!("asset is fungible"); + unreachable!("asset is non-fungible"); }; delivery_fees_amount = inner_delivery_fees_amount; }); @@ -201,7 +201,7 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay { }); // These will be filled in the closure. let mut delivery_fees_amount = 0; - let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + let mut remote_message = VersionedXcm::from(Xcm(Vec::new())); <$sender_para>::execute_with(|| { type Runtime = <$sender_para as Chain>::Runtime; type OriginCaller = <$sender_para as Chain>::OriginCaller; @@ -213,7 +213,7 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay { .forwarded_xcms .iter() .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(1, [])) + *destination == VersionedLocation::from(Location::parent()) }) .unwrap(); assert_eq!(messages_to_query.len(), 1); @@ -224,7 +224,7 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay { let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); delivery_fees_amount = if let Some(first_asset) = latest_delivery_fees.inner().first() { let Fungible(inner_delivery_fees_amount) = first_asset.fun else { - unreachable!("asset is fungible"); + unreachable!("asset is non-fungible"); }; inner_delivery_fees_amount } else { diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/treasury.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/treasury.rs index 4c7f4faabf..317b1a5f67 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/treasury.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/treasury.rs @@ -70,11 +70,12 @@ fn spend_ksm_on_asset_hub() { let teleport_call = RuntimeCall::Utility(pallet_utility::Call::::dispatch_as { as_origin: bx!(OriginCaller::system(RawOrigin::Signed(treasury_account))), call: bx!(RuntimeCall::XcmPallet(pallet_xcm::Call::::teleport_assets { - dest: bx!(VersionedLocation::V4(asset_hub_location.clone())), - beneficiary: bx!(VersionedLocation::V4(treasury_location)), - assets: bx!(VersionedAssets::V4( - Asset { id: native_asset.clone().into(), fun: treasury_balance.into() }.into() - )), + dest: bx!(VersionedLocation::from(asset_hub_location.clone())), + beneficiary: bx!(VersionedLocation::from(treasury_location)), + assets: bx!(VersionedAssets::from(Assets::from(Asset { + id: native_asset.clone().into(), + fun: treasury_balance.into() + }))), fee_asset_item: 0, })), }); @@ -114,7 +115,7 @@ fn spend_ksm_on_asset_hub() { asset_id: native_asset_on_asset_hub.into(), }), amount: treasury_spend_balance, - beneficiary: bx!(VersionedLocation::V4(alice_location)), + beneficiary: bx!(VersionedLocation::from(alice_location)), valid_from: None, }); diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs index eebb6b9cb4..7202d45476 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs @@ -76,7 +76,7 @@ fn multi_hop_works() { // We get them from the PenpalA closure. let mut delivery_fees_amount = 0; - let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + let mut remote_message = VersionedXcm::from(Xcm(Vec::new())); ::execute_with(|| { type Runtime = ::Runtime; type OriginCaller = ::OriginCaller; @@ -89,7 +89,7 @@ fn multi_hop_works() { .forwarded_xcms .iter() .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(1, [Parachain(1000)])) + *destination == VersionedLocation::from(Location::new(1, [Parachain(1000)])) }) .unwrap(); assert_eq!(messages_to_query.len(), 1); @@ -103,7 +103,7 @@ fn multi_hop_works() { // These are set in the AssetHub closure. let mut intermediate_execution_fees = 0; let mut intermediate_delivery_fees_amount = 0; - let mut intermediate_remote_message = VersionedXcm::V4(Xcm::<()>(Vec::new())); + let mut intermediate_remote_message = VersionedXcm::from(Xcm::<()>(Vec::new())); ::execute_with(|| { type Runtime = ::Runtime; type RuntimeCall = ::RuntimeCall; @@ -112,13 +112,14 @@ fn multi_hop_works() { let weight = Runtime::query_xcm_weight(remote_message.clone()).unwrap(); intermediate_execution_fees = Runtime::query_weight_to_asset_fee( weight, - VersionedAssetId::V4(Location::new(1, []).into()), + VersionedAssetId::from(AssetId(Location::parent())), ) .unwrap(); // We have to do this to turn `VersionedXcm<()>` into `VersionedXcm`. - let xcm_program = - VersionedXcm::V4(Xcm::::from(remote_message.clone().try_into().unwrap())); + let xcm_program = VersionedXcm::from(Xcm::::from( + remote_message.clone().try_into().unwrap(), + )); // Now we get the delivery fees to the final destination. let result = @@ -127,7 +128,7 @@ fn multi_hop_works() { .forwarded_xcms .iter() .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(1, [Parachain(2001)])) + *destination == VersionedLocation::from(Location::new(1, [Parachain(2001)])) }) .unwrap(); // There's actually two messages here. @@ -150,9 +151,11 @@ fn multi_hop_works() { type Runtime = ::Runtime; let weight = Runtime::query_xcm_weight(intermediate_remote_message.clone()).unwrap(); - final_execution_fees = - Runtime::query_weight_to_asset_fee(weight, VersionedAssetId::V4(Parent.into())) - .unwrap(); + final_execution_fees = Runtime::query_weight_to_asset_fee( + weight, + VersionedAssetId::from(AssetId(Parent.into())), + ) + .unwrap(); }); // Dry-running is done. @@ -220,7 +223,7 @@ fn sender_assertions(test: ParaToParaThroughAHTest) { RuntimeEvent::ForeignAssets( pallet_assets::Event::Burned { asset_id, owner, balance } ) => { - asset_id: *asset_id == Location::new(1, []), + asset_id: *asset_id == Location::parent(), owner: *owner == test.sender.account_id, balance: *balance == test.args.amount, }, @@ -254,7 +257,7 @@ fn receiver_assertions(test: ParaToParaThroughAHTest) { RuntimeEvent::ForeignAssets( pallet_assets::Event::Issued { asset_id, owner, .. } ) => { - asset_id: *asset_id == Location::new(1, []), + asset_id: *asset_id == Location::parent(), owner: *owner == test.receiver.account_id, }, ] @@ -264,7 +267,7 @@ fn receiver_assertions(test: ParaToParaThroughAHTest) { fn get_amount_from_versioned_assets(assets: VersionedAssets) -> u128 { let latest_assets: Assets = assets.try_into().unwrap(); let Fungible(amount) = latest_assets.inner()[0].fun else { - unreachable!("asset is fungible"); + unreachable!("asset is non-fungible"); }; amount } @@ -293,7 +296,7 @@ fn transfer_assets_para_to_para_through_ah_call( dest: bx!(test.args.dest.into()), assets: bx!(test.args.assets.clone().into()), assets_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.clone().into())), - remote_fees_id: bx!(VersionedAssetId::V4(AssetId(Location::new(1, [])))), + remote_fees_id: bx!(VersionedAssetId::from(AssetId(Location::parent()))), fees_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.into())), custom_xcm_on_dest: bx!(VersionedXcm::from(custom_xcm_on_dest)), weight_limit: test.args.weight_limit, diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs index 8588e60846..2dea54bc6f 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs @@ -77,7 +77,7 @@ fn multi_hop_works() { // We get them from the PenpalB closure. let mut delivery_fees_amount = 0; - let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); + let mut remote_message = VersionedXcm::from(Xcm(Vec::new())); ::execute_with(|| { type Runtime = ::Runtime; type OriginCaller = ::OriginCaller; @@ -90,7 +90,7 @@ fn multi_hop_works() { .forwarded_xcms .iter() .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(1, [Parachain(1000)])) + *destination == VersionedLocation::from(Location::new(1, [Parachain(1000)])) }) .unwrap(); assert_eq!(messages_to_query.len(), 1); @@ -104,7 +104,7 @@ fn multi_hop_works() { // These are set in the AssetHub closure. let mut intermediate_execution_fees = 0; let mut intermediate_delivery_fees_amount = 0; - let mut intermediate_remote_message = VersionedXcm::V4(Xcm::<()>(Vec::new())); + let mut intermediate_remote_message = VersionedXcm::from(Xcm::<()>(Vec::new())); ::execute_with(|| { type Runtime = ::Runtime; type RuntimeCall = ::RuntimeCall; @@ -113,13 +113,14 @@ fn multi_hop_works() { let weight = Runtime::query_xcm_weight(remote_message.clone()).unwrap(); intermediate_execution_fees = Runtime::query_weight_to_asset_fee( weight, - VersionedAssetId::V4(Location::new(1, []).into()), + VersionedAssetId::from(AssetId(Location::parent())), ) .unwrap(); // We have to do this to turn `VersionedXcm<()>` into `VersionedXcm`. - let xcm_program = - VersionedXcm::V4(Xcm::::from(remote_message.clone().try_into().unwrap())); + let xcm_program = VersionedXcm::from(Xcm::::from( + remote_message.clone().try_into().unwrap(), + )); // Now we get the delivery fees to the final destination. let result = @@ -128,7 +129,7 @@ fn multi_hop_works() { .forwarded_xcms .iter() .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(1, [Parachain(2000)])) + *destination == VersionedLocation::from(Location::new(1, [Parachain(2000)])) }) .unwrap(); // There's actually two messages here. @@ -151,9 +152,11 @@ fn multi_hop_works() { type Runtime = ::Runtime; let weight = Runtime::query_xcm_weight(intermediate_remote_message.clone()).unwrap(); - final_execution_fees = - Runtime::query_weight_to_asset_fee(weight, VersionedAssetId::V4(Parent.into())) - .unwrap(); + final_execution_fees = Runtime::query_weight_to_asset_fee( + weight, + VersionedAssetId::from(AssetId(Location::parent())), + ) + .unwrap(); }); // Dry-running is done. @@ -221,7 +224,7 @@ fn sender_assertions(test: ParaToParaThroughAHTest) { RuntimeEvent::ForeignAssets( pallet_assets::Event::Burned { asset_id, owner, balance } ) => { - asset_id: *asset_id == Location::new(1, []), + asset_id: *asset_id == Location::parent(), owner: *owner == test.sender.account_id, balance: *balance == test.args.amount, }, @@ -255,7 +258,7 @@ fn receiver_assertions(test: ParaToParaThroughAHTest) { RuntimeEvent::ForeignAssets( pallet_assets::Event::Issued { asset_id, owner, .. } ) => { - asset_id: *asset_id == Location::new(1, []), + asset_id: *asset_id == Location::parent(), owner: *owner == test.receiver.account_id, }, ] @@ -265,7 +268,7 @@ fn receiver_assertions(test: ParaToParaThroughAHTest) { fn get_amount_from_versioned_assets(assets: VersionedAssets) -> u128 { let latest_assets: Assets = assets.try_into().unwrap(); let Fungible(amount) = latest_assets.inner()[0].fun else { - unreachable!("asset is fungible"); + unreachable!("asset is non-fungible"); }; amount } @@ -294,7 +297,7 @@ fn transfer_assets_para_to_para_through_ah_call( dest: bx!(test.args.dest.into()), assets: bx!(test.args.assets.clone().into()), assets_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.clone().into())), - remote_fees_id: bx!(VersionedAssetId::V4(AssetId(Location::new(1, [])))), + remote_fees_id: bx!(VersionedAssetId::from(AssetId(Location::parent()))), fees_transfer_type: bx!(TransferType::RemoteReserve(asset_hub_location.into())), custom_xcm_on_dest: bx!(VersionedXcm::from(custom_xcm_on_dest)), weight_limit: test.args.weight_limit, diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs index 9304093e39..25b160fbf8 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs @@ -14,11 +14,9 @@ // limitations under the License. use crate::tests::*; +use bridge_hub_kusama_runtime::RuntimeEvent; use frame_support::{dispatch::RawOrigin, traits::fungible::Mutate}; -use xcm_fee_payment_runtime_api::{ - dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, - fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, -}; +use xcm_fee_payment_runtime_api::dry_run::runtime_decl_for_dry_run_api::DryRunApiV1; fn send_asset_from_asset_hub_kusama_to_asset_hub_polkadot(id: Location, amount: u128) { let destination = asset_hub_polkadot_location(); @@ -36,10 +34,7 @@ fn send_asset_from_asset_hub_kusama_to_asset_hub_polkadot(id: Location, amount: assert_bridge_hub_polkadot_message_received(); } -fn dry_run_send_asset_from_asset_hub_kusama_to_asset_hub_polkadot( - id: Location, - amount: u128, -) -> u128 { +fn dry_run_send_asset_from_asset_hub_kusama_to_asset_hub_polkadot(id: Location, amount: u128) { let destination = asset_hub_polkadot_location(); // fund the AHK's SA on BHK for paying bridge transport fees @@ -55,92 +50,56 @@ fn dry_run_send_asset_from_asset_hub_kusama_to_asset_hub_polkadot( let fee_asset_item = 0; let call = send_asset_from_asset_hub_kusama_call(destination, beneficiary, assets, fee_asset_item); - let mut delivery_fees_amount = 0; - let mut remote_message = VersionedXcm::V4(Xcm(Vec::new())); - AssetHubKusama::execute_with(|| { + + // `remote_message` should contain `ExportMessage` + let remote_message = AssetHubKusama::execute_with(|| { type Runtime = ::Runtime; type OriginCaller = ::OriginCaller; let origin = OriginCaller::system(RawOrigin::Signed(AssetHubKusamaSender::get())); let result = Runtime::dry_run_call(origin, call).unwrap(); + // We filter the result to get only the messages we are interested in. - let (destination_to_query, messages_to_query) = &result + let (_, messages_to_query) = result .forwarded_xcms - .iter() + .into_iter() .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(1, [Parachain(1002)])) + *destination == VersionedLocation::from(Location::new(1, [Parachain(1002)])) }) .unwrap(); - dbg!(&result.forwarded_xcms); assert_eq!(messages_to_query.len(), 1); - remote_message = messages_to_query[0].clone(); - let delivery_fees = - Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) - .unwrap(); - let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); - let Fungible(inner_delivery_fees_amount) = latest_delivery_fees.inner()[0].fun else { - unreachable!("asset is fungible"); - }; - delivery_fees_amount = inner_delivery_fees_amount; + + messages_to_query[0].clone() }); - let mut intermediate_execution_fees = 0; - let mut intermediate_delivery_fees_amount = 0; - let mut intermediate_remote_message = VersionedXcm::V4(Xcm(Vec::new())); + // dry run extracted `remote_message` on local BridgeHub BridgeHubKusama::execute_with(|| { type Runtime = ::Runtime; type RuntimeCall = ::RuntimeCall; - // First we get the execution fees. - let weight = Runtime::query_xcm_weight(remote_message.clone()).unwrap(); - intermediate_execution_fees = - Runtime::query_weight_to_asset_fee(weight, VersionedAssetId::V4(Parent.into())) - .unwrap(); - // We have to do this to turn `VersionedXcm<()>` into `VersionedXcm`. - let xcm_program = - VersionedXcm::V4(Xcm::::from(remote_message.clone().try_into().unwrap())); + let xcm_program = VersionedXcm::from(Xcm::::from( + remote_message.clone().try_into().unwrap(), + )); - // Now we get the delivery fees to the final destination. + // dry run program let asset_hub_as_seen_by_bridge_hub: Location = Location::new(1, [Parachain(1000)]); let result = - Runtime::dry_run_xcm(asset_hub_as_seen_by_bridge_hub.clone().into(), xcm_program) - .unwrap(); - - // We filter the result to get only the messages we are interested in. - // dbg!(&result.forwarded_xcms); - let (destination_to_query, messages_to_query) = &result - .forwarded_xcms - .iter() - .find(|(destination, _)| { - *destination == VersionedLocation::V4(Location::new(1, [Parachain(1002)])) - }) - .unwrap(); - // There's actually two messages here. - // One created when the message we sent from PenpalA arrived and was executed. - // The second one when we dry-run the xcm. - // We could've gotten the message from the queue without having to dry-run, but - // offchain applications would have to dry-run, so we do it here as well. - intermediate_remote_message = messages_to_query[0].clone(); - let delivery_fees = - Runtime::query_delivery_fees(destination_to_query.clone(), remote_message.clone()) - .unwrap(); - let latest_delivery_fees: Assets = delivery_fees.clone().try_into().unwrap(); - let Fungible(inner_delivery_fees_amount) = latest_delivery_fees.inner()[0].fun else { - unreachable!("asset is fungible"); - }; - intermediate_delivery_fees_amount = inner_delivery_fees_amount; + Runtime::dry_run_xcm(asset_hub_as_seen_by_bridge_hub.into(), xcm_program).unwrap(); + + // check dry run result + assert_ok!(result.execution_result.ensure_complete()); + assert!(result.emitted_events.iter().any(|event| matches!( + event, + RuntimeEvent::BridgePolkadotMessages( + pallet_bridge_messages::Event::MessageAccepted { .. } + ) + ))); }); - dbg!(&delivery_fees_amount); - dbg!(&intermediate_execution_fees); - dbg!(&intermediate_delivery_fees_amount); - // After dry-running we reset. AssetHubKusama::reset_ext(); BridgeHubKusama::reset_ext(); - - delivery_fees_amount } #[test] @@ -173,7 +132,7 @@ fn send_ksms_from_asset_hub_kusama_to_asset_hub_polkadot() { let ksm_at_asset_hub_kusama_latest: Location = ksm_at_asset_hub_kusama.try_into().unwrap(); let amount = ASSET_HUB_KUSAMA_ED * 1_000; // First dry-run. - let delivery_fees = dry_run_send_asset_from_asset_hub_kusama_to_asset_hub_polkadot( + dry_run_send_asset_from_asset_hub_kusama_to_asset_hub_polkadot( ksm_at_asset_hub_kusama_latest.clone(), amount, ); @@ -206,15 +165,8 @@ fn send_ksms_from_asset_hub_kusama_to_asset_hub_polkadot() { let ksms_in_reserve_on_ahk_after = ::account_data_of(sov_ahp_on_ahk.clone()).free; - dbg!(&sender_ksms_after); - dbg!(&sender_ksms_before); - dbg!(&amount); - dbg!(&delivery_fees); - dbg!(&receiver_ksms_after); - dbg!(&receiver_ksms_before); - // Sender's balance is reduced - assert_eq!(sender_ksms_after, sender_ksms_before - amount - delivery_fees); + assert!(sender_ksms_before > sender_ksms_after); // Receiver's balance is increased assert!(receiver_ksms_after > receiver_ksms_before); // Reserve balance is reduced by sent amount diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs index 48cc61a0e9..90d9d92537 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs @@ -584,14 +584,14 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { )), fun: Fungible(WETH_AMOUNT), }]; - let multi_assets = VersionedAssets::V4(Assets::from(assets)); + let multi_assets = VersionedAssets::from(Assets::from(assets)); - let destination = VersionedLocation::V4(Location::new( + let destination = VersionedLocation::from(Location::new( 2, [GlobalConsensus(Ethereum { chain_id: CHAIN_ID })], )); - let beneficiary = VersionedLocation::V4(Location::new( + let beneficiary = VersionedLocation::from(Location::new( 0, [AccountKey20 { network: None, key: ETHEREUM_DESTINATION_ADDRESS }], )); diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs index 3c14e2cc57..3b85c63595 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs @@ -588,14 +588,14 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { )), fun: Fungible(WETH_AMOUNT), }]; - let multi_assets = VersionedAssets::V4(Assets::from(assets)); + let multi_assets = VersionedAssets::from(Assets::from(assets)); - let destination = VersionedLocation::V4(Location::new( + let destination = VersionedLocation::from(Location::new( 2, [GlobalConsensus(Ethereum { chain_id: CHAIN_ID })], )); - let beneficiary = VersionedLocation::V4(Location::new( + let beneficiary = VersionedLocation::from(Location::new( 0, [AccountKey20 { network: None, key: ETHEREUM_DESTINATION_ADDRESS }], )); diff --git a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs index c7664de0a6..bdee6c87b7 100644 --- a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs +++ b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs @@ -31,8 +31,8 @@ fn fellows_whitelist_call() { let call_hash = [1u8; 32].into(); let whitelist_call = RuntimeCall::PolkadotXcm(pallet_xcm::Call::::send { - dest: bx!(VersionedLocation::V4(Parent.into())), - message: bx!(VersionedXcm::V4(Xcm(vec![ + dest: bx!(VersionedLocation::from(Location::parent())), + message: bx!(VersionedXcm::from(Xcm(vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, diff --git a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship_treasury.rs b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship_treasury.rs index 03adf3dbbc..9671ff9a5a 100644 --- a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship_treasury.rs +++ b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship_treasury.rs @@ -67,11 +67,12 @@ fn fellowship_treasury_spend() { let teleport_call = RuntimeCall::Utility(pallet_utility::Call::::dispatch_as { as_origin: bx!(OriginCaller::system(RawOrigin::Signed(treasury_account))), call: bx!(RuntimeCall::XcmPallet(pallet_xcm::Call::::teleport_assets { - dest: bx!(VersionedLocation::V4(asset_hub_location.clone())), - beneficiary: bx!(VersionedLocation::V4(treasury_location)), - assets: bx!(VersionedAssets::V4( - Asset { id: native_asset.clone().into(), fun: treasury_balance.into() }.into() - )), + dest: bx!(VersionedLocation::from(asset_hub_location.clone())), + beneficiary: bx!(VersionedLocation::from(treasury_location)), + assets: bx!(VersionedAssets::from(Assets::from(Asset { + id: native_asset.clone().into(), + fun: treasury_balance.into() + }))), fee_asset_item: 0, })), }); @@ -109,7 +110,7 @@ fn fellowship_treasury_spend() { asset_id: native_asset_on_asset_hub.into(), }), amount: fellowship_treasury_balance, - beneficiary: bx!(VersionedLocation::V4(fellowship_treasury_location)), + beneficiary: bx!(VersionedLocation::from(fellowship_treasury_location)), valid_from: None, }); @@ -186,7 +187,7 @@ fn fellowship_treasury_spend() { asset_id: native_asset_on_asset_hub.into(), }), amount: fellowship_spend_balance, - beneficiary: bx!(VersionedLocation::V4(alice_location)), + beneficiary: bx!(VersionedLocation::from(alice_location)), valid_from: None, }); diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs index 50b4bd5626..8d06089947 100644 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs +++ b/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs @@ -38,8 +38,8 @@ fn relay_commands_add_registrar() { }); let xcm_message = RuntimeCall::XcmPallet(pallet_xcm::Call::::send { - dest: bx!(VersionedLocation::V4(Location::new(0, [Parachain(1004)]))), - message: bx!(VersionedXcm::V4(Xcm(vec![ + dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), + message: bx!(VersionedXcm::from(Xcm(vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind, diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs index 8adba4ddd8..11ebf954a3 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs +++ b/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs @@ -38,8 +38,8 @@ fn relay_commands_add_registrar() { }); let xcm_message = RuntimeCall::XcmPallet(pallet_xcm::Call::::send { - dest: bx!(VersionedLocation::V4(Location::new(0, [Parachain(1004)]))), - message: bx!(VersionedXcm::V4(Xcm(vec![ + dest: bx!(VersionedLocation::from(Location::new(0, [Parachain(1004)]))), + message: bx!(VersionedXcm::from(Xcm(vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind, diff --git a/relay/polkadot/src/impls.rs b/relay/polkadot/src/impls.rs index fa690a1a8d..961a06c1d1 100644 --- a/relay/polkadot/src/impls.rs +++ b/relay/polkadot/src/impls.rs @@ -172,8 +172,8 @@ where // send >::send( RawOrigin::Root.into(), - Box::new(VersionedLocation::V4(destination)), - Box::new(VersionedXcm::V4(program)), + Box::new(VersionedLocation::from(destination)), + Box::new(VersionedXcm::from(program)), )?; Ok(()) } From 4eb52675d65773531cba315850703cee49deaf31 Mon Sep 17 00:00:00 2001 From: Javier Bullrich Date: Wed, 24 Jul 2024 18:20:46 +0200 Subject: [PATCH 05/14] CI: updated all deprecated actions (#400) I have noticed there are a lot of outdated actions with deprecated warnings: image This PR updates all of GitHub actions to latest version to remove such warnings. I have also added some`TODO` to actions that have been archived by GitHub and that require an alternative action/solution. We can do that in a different PR once we identify the correct solution. - [x] Does not require a CHANGELOG entry --- .github/workflows/changelog.yml | 2 +- ...check-features.yaml => check-features.yml} | 4 ++-- .github/workflows/check-migrations.yml | 4 ++-- .github/workflows/clippy.yml | 2 +- .github/workflows/fmt.yml | 2 +- .github/workflows/release.yml | 24 ++++++++++--------- .github/workflows/test.yml | 12 +++++----- 7 files changed, 26 insertions(+), 24 deletions(-) rename .github/workflows/{check-features.yaml => check-features.yml} (93%) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 5dbb738b70..52b6801f9b 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -40,7 +40,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Verify run: .github/changelog-processor.py CHANGELOG.md --validate-changelog diff --git a/.github/workflows/check-features.yaml b/.github/workflows/check-features.yml similarity index 93% rename from .github/workflows/check-features.yaml rename to .github/workflows/check-features.yml index f816bcd37e..6b67389ca7 100644 --- a/.github/workflows/check-features.yaml +++ b/.github/workflows/check-features.yml @@ -13,8 +13,8 @@ concurrency: cancel-in-progress: true jobs: - name: Check workspace features check: + name: Check workspace features runs-on: ubuntu-22.04 steps: @@ -28,7 +28,7 @@ jobs: run: cargo install --locked -q zepter && zepter --version - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # Dont clone historic commits. diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 6b073bdb1f..fb433d7257 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -26,7 +26,7 @@ jobs: runtime: ${{ steps.runtime.outputs.runtime }} name: Extract tasks from matrix steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - id: runtime run: | # Filter out runtimes that don't have a URI @@ -51,7 +51,7 @@ jobs: runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build EXTRA_ARGS run: | diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index cec099296a..2aadfd20d8 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -20,7 +20,7 @@ jobs: run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set rust version via common env file run: cat .github/env >> $GITHUB_ENV diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml index 11e1139cf5..11d4df7372 100644 --- a/.github/workflows/fmt.yml +++ b/.github/workflows/fmt.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set rust version via common env file run: cat .github/env >> $GITHUB_ENV diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db876ccf9a..9d5deb9e7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: should-release: ${{ steps.run.outputs.should-release }} version: ${{ steps.run.outputs.version }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - id: run run: | echo "should-release=$(.github/changelog-processor.py CHANGELOG.md --should-release)" >> $GITHUB_OUTPUT @@ -26,7 +26,7 @@ jobs: outputs: runtime: ${{ steps.runtime.outputs.runtime }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - id: runtime run: | TASKS=$(echo $(cat .github/workflows/runtimes-matrix.json) | sed 's/ //g' ) @@ -41,10 +41,10 @@ jobs: runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache target dir - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: "${{ github.workspace }}/${{ matrix.runtime.path }}/target" key: srtool-target-${{ matrix.runtime.path }}-${{ matrix.runtime.name }}-${{ github.sha }} @@ -68,13 +68,13 @@ jobs: echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.runtime.name }}_srtool_output.json - name: Upload ${{ matrix.runtime.name }} srtool json - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.runtime.name }}-srtool-json path: ${{ matrix.runtime.name }}_srtool_output.json - name: Upload ${{ matrix.runtime.name }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.runtime.name }} path: | @@ -88,13 +88,13 @@ jobs: asset_upload_url: ${{ steps.create-release.outputs.upload_url }} steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download srtool json output - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 - name: Archive context output - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: release-notes-context path: | @@ -150,6 +150,7 @@ jobs: - name: Create release id: create-release + # TODO: Replace as it has been deprecated uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -170,10 +171,10 @@ jobs: runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }} steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 - name: Get runtime info env: @@ -183,6 +184,7 @@ jobs: >>$GITHUB_ENV echo SPEC=$(<${JSON} jq -r .runtimes.compact.subwasm.core_version.specVersion) - name: Upload compressed ${{ matrix.runtime.name }} v${{ env.SPEC }} wasm + # TODO: Replace as it has been deprecated uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 547d17fe9b..7b5bcbaf39 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: runtime: ${{ steps.runtime.outputs.runtime }} name: Extract runtimes from matrix steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - id: runtime run: | TASKS=$(echo $(cat .github/workflows/runtimes-matrix.json) | sed 's/ //g' ) @@ -35,7 +35,7 @@ jobs: itest: ${{ steps.itest.outputs.itest }} name: Extract integration tests from matrix steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - id: itest run: | TASKS=$(echo $(cat .github/workflows/integration-tests-matrix.json) | sed 's/ //g' ) @@ -65,7 +65,7 @@ jobs: df -h - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set rust version via common env file run: cat .github/env >> $GITHUB_ENV @@ -121,7 +121,7 @@ jobs: df -h - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set rust version via common env file run: cat .github/env >> $GITHUB_ENV @@ -167,7 +167,7 @@ jobs: df -h - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set rust version via common env file run: cat .github/env >> $GITHUB_ENV @@ -215,7 +215,7 @@ jobs: df -h - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set rust version via common env file run: cat .github/env >> $GITHUB_ENV From 76749171cc500f59b3b8c857aae1bd8f1ce8f85c Mon Sep 17 00:00:00 2001 From: Santi Balaguer Date: Wed, 24 Jul 2024 20:07:58 +0200 Subject: [PATCH 06/14] Adds MetadataHash calculation on Build to Kusama People chain (#371) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds the calculation of the MetadataHash upon build in the Kusama People Chains Runtime. I don't think this needs a CHANGELOG entry, but I could be mistaken. --------- Co-authored-by: Bastian Köcher --- CHANGELOG.md | 4 ++++ system-parachains/people/people-kusama/build.rs | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c05a8ca37..bb6c377848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -129,6 +129,10 @@ Note: This release only affects the following runtimes and is not a full system - Kusama Relay Chain - Kusama Bridge Hub +### Fixed + +- Kusama People: Build the metadata hash at build time, so that `CheckMetadata` can use it at runtime ([polkadot-fellows/runtimes#371](https://github.com/polkadot-fellows/runtimes/pull/371)) + ## [1.2.7] 14.06.2024 Note: This release only affects the following runtimes and is not a full system release: diff --git a/system-parachains/people/people-kusama/build.rs b/system-parachains/people/people-kusama/build.rs index 60f8a12512..ed3ceb02c6 100644 --- a/system-parachains/people/people-kusama/build.rs +++ b/system-parachains/people/people-kusama/build.rs @@ -13,12 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#[cfg(feature = "std")] +#[cfg(all(feature = "std", not(feature = "metadata-hash")))] fn main() { - substrate_wasm_builder::WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() + substrate_wasm_builder::WasmBuilder::build_using_defaults() +} + +#[cfg(all(feature = "std", feature = "metadata-hash"))] +fn main() { + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("KSM", 12) .build() } From afe696b390e7cbe88b54dec69aeee1322fdea540 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 25 Jul 2024 00:44:37 +0200 Subject: [PATCH 07/14] Short benchmarking in CI with `frame-omni-bencher` + extract `chain-spec-builder` stuff to `get_preset` (#379) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR introduces a new CI pipeline for checking and running runtime benchmarks as part of the test pipelines. This means we will now know if any changes break the benchmarks. The pipeline is based on downloading `frame-omni-bencher` (building it in-place is too expensive for every matrix run) and running it with a minimal setup: `--steps 2 --repeat 1`. Another part of this PR splits the default genesis setups from `chain-spec-generator` and moves them to the `sp_genesis_builder::GenesisBuilder::get_preset` runtime API implementation for every runtime, which is required by `frame-omni-bencher`. Closes: https://github.com/polkadot-fellows/runtimes/issues/197 Relates to: https://github.com/polkadot-fellows/runtimes/pull/298 Relates to: https://github.com/polkadot-fellows/runtimes/pull/324 - [X] Does not require a CHANGELOG entry ## Future works When [this issue](https://github.com/paritytech/polkadot-sdk/pull/5083) is fixed, I will rewrite [weight-generation.md](https://github.com/polkadot-fellows/runtimes/blob/main/docs/weight-generation.md). The new version will be significantly simplified, with instructions to simply download `frame-omni-bencher`, build the runtime WASM, and run it—no other steps will be necessary. ``` 2024-07-18 14:45:51 Using the chain spec instead of the runtime to generate the genesis state is deprecated. Please remove the `--chain`/`--dev`/`--local` argument, point `--runtime` to your runtime blob and set `--genesis-builder=runtime`. This warning may become a hard error any time after December 2024. ``` --------- Co-authored-by: Bastian Köcher --- .github/workflows/test.yml | 24 + Cargo.lock | 29 +- Cargo.toml | 4 +- chain-spec-generator/Cargo.toml | 21 - chain-spec-generator/src/common.rs | 42 +- chain-spec-generator/src/relay_chain_specs.rs | 347 +--------- .../src/system_parachains_specs.rs | 632 +----------------- .../chains/relays/polkadot/src/genesis.rs | 4 +- integration-tests/zombienet/Cargo.toml | 2 +- relay/kusama/Cargo.toml | 11 +- relay/kusama/src/genesis_config_presets.rs | 249 +++++++ relay/kusama/src/lib.rs | 12 +- relay/polkadot/Cargo.toml | 9 +- relay/polkadot/src/genesis_config_presets.rs | 249 +++++++ relay/polkadot/src/lib.rs | 12 +- .../asset-hubs/asset-hub-kusama/Cargo.toml | 6 +- .../src/genesis_config_presets.rs | 87 +++ .../asset-hubs/asset-hub-kusama/src/lib.rs | 9 +- .../asset-hubs/asset-hub-polkadot/Cargo.toml | 6 +- .../src/genesis_config_presets.rs | 103 +++ .../asset-hubs/asset-hub-polkadot/src/lib.rs | 9 +- .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 10 +- .../src/genesis_config_presets.rs | 92 +++ .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 9 +- .../bridge-hub-polkadot/Cargo.toml | 10 +- .../bridge-hub-polkadot/primitives/Cargo.toml | 2 +- .../src/genesis_config_presets.rs | 92 +++ .../bridge-hub-polkadot/src/lib.rs | 9 +- .../collectives-polkadot/Cargo.toml | 6 +- .../src/genesis_config_presets.rs | 87 +++ .../collectives-polkadot/src/impls.rs | 21 +- .../collectives-polkadot/src/lib.rs | 9 +- system-parachains/constants/Cargo.toml | 6 + .../constants/src/genesis_presets.rs | 68 ++ system-parachains/constants/src/lib.rs | 1 + .../coretime/coretime-kusama/Cargo.toml | 6 +- .../src/genesis_config_presets.rs | 87 +++ .../coretime/coretime-kusama/src/lib.rs | 9 +- system-parachains/encointer/Cargo.toml | 13 +- .../encointer/src/genesis_config_presets.rs | 87 +++ system-parachains/encointer/src/lib.rs | 251 +------ .../gluttons/glutton-kusama/Cargo.toml | 2 + .../src/genesis_config_presets.rs | 51 ++ .../gluttons/glutton-kusama/src/lib.rs | 9 +- .../people/people-kusama/Cargo.toml | 12 +- .../src/genesis_config_presets.rs | 87 +++ .../people/people-kusama/src/lib.rs | 9 +- .../people/people-polkadot/Cargo.toml | 8 +- .../src/genesis_config_presets.rs | 87 +++ .../people/people-polkadot/src/lib.rs | 9 +- 50 files changed, 1679 insertions(+), 1337 deletions(-) create mode 100644 relay/kusama/src/genesis_config_presets.rs create mode 100644 relay/polkadot/src/genesis_config_presets.rs create mode 100644 system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs create mode 100644 system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs create mode 100644 system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs create mode 100644 system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs create mode 100644 system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs create mode 100644 system-parachains/constants/src/genesis_presets.rs create mode 100644 system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs create mode 100644 system-parachains/encointer/src/genesis_config_presets.rs create mode 100644 system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs create mode 100644 system-parachains/people/people-kusama/src/genesis_config_presets.rs create mode 100644 system-parachains/people/people-polkadot/src/genesis_config_presets.rs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b5bcbaf39..8b342f1399 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,9 @@ on: pull_request: workflow_dispatch: +env: + FRAME_OMNI_BENCHER_RELEASE_VERSION: polkadot-v1.13.0 + # cancel previous runs concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -82,6 +85,13 @@ jobs: with: shared-key: "fellowship-cache-tests" + - name: Download frame-omni-bencher + run: | + curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/$FRAME_OMNI_BENCHER_RELEASE_VERSION/frame-omni-bencher -o frame-omni-bencher + chmod +x ./frame-omni-bencher + ./frame-omni-bencher --version + shell: bash + - name: Test ${{ matrix.runtime.name }} run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q env: @@ -93,6 +103,20 @@ jobs: RUSTFLAGS: "-C debug-assertions -D warnings" SKIP_WASM_BUILD: 1 + - name: Test benchmarks ${{ matrix.runtime.name }} + run: | + PACKAGE_NAME=${{ matrix.runtime.package }} + RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm + RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME + # build wasm + echo "Preparing wasm for benchmarking RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH" + cargo build --profile production -p ${{ matrix.runtime.package }} --features=runtime-benchmarks -q --locked + # run benchmarking + echo "Running benchmarking for RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH" + ./frame-omni-bencher v1 benchmark pallet --runtime $RUNTIME_BLOB_PATH --all --steps 2 --repeat 1 + env: + RUSTFLAGS: "-C debug-assertions -D warnings" + # Job required by "confirmTestPassed" integration-test: needs: [integration-test-matrix] diff --git a/Cargo.lock b/Cargo.lock index 94caf224ec..3f023668cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -642,6 +642,7 @@ dependencies = [ "polkadot-runtime-constants", "primitive-types", "scale-info", + "serde_json", "snowbridge-router-primitives", "sp-api", "sp-block-builder", @@ -775,6 +776,7 @@ dependencies = [ "polkadot-runtime-constants", "primitive-types", "scale-info", + "serde_json", "snowbridge-router-primitives", "sp-api", "sp-block-builder", @@ -1688,7 +1690,6 @@ dependencies = [ "bp-messages", "bp-parachains", "bp-polkadot", - "bp-polkadot-bulletin", "bp-polkadot-core", "bp-relayers", "bp-runtime", @@ -1743,6 +1744,7 @@ dependencies = [ "polkadot-runtime-constants", "scale-info", "serde", + "serde_json", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-outbound-queue-runtime-api", @@ -1843,7 +1845,6 @@ dependencies = [ "bp-messages", "bp-parachains", "bp-polkadot", - "bp-polkadot-bulletin", "bp-polkadot-core", "bp-relayers", "bp-runtime", @@ -1896,6 +1897,7 @@ dependencies = [ "polkadot-runtime-constants", "scale-info", "serde", + "serde_json", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-outbound-queue-runtime-api", @@ -2184,29 +2186,15 @@ dependencies = [ "clap", "collectives-polkadot-runtime", "coretime-kusama-runtime", - "cumulus-primitives-core", "encointer-kusama-runtime", "glutton-kusama-runtime", - "kusama-runtime-constants", - "pallet-staking", - "parachains-common", "people-kusama-runtime", "people-polkadot-runtime", - "polkadot-primitives", "polkadot-runtime", - "polkadot-runtime-constants", - "polkadot-runtime-parachains", "sc-chain-spec", - "sc-consensus-grandpa", "serde", "serde_json", - "sp-authority-discovery", - "sp-consensus-babe", - "sp-consensus-beefy", - "sp-core 34.0.0", - "sp-runtime 38.0.0", "staging-kusama-runtime", - "staging-xcm", ] [[package]] @@ -2421,6 +2409,7 @@ dependencies = [ "polkadot-runtime-common", "polkadot-runtime-constants", "scale-info", + "serde_json", "sp-api", "sp-arithmetic 26.0.0", "sp-block-builder", @@ -2665,6 +2654,7 @@ dependencies = [ "polkadot-runtime-common", "scale-info", "serde", + "serde_json", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -3856,6 +3846,7 @@ dependencies = [ "polkadot-primitives", "polkadot-runtime-common", "scale-info", + "serde_json", "smallvec", "sp-api", "sp-block-builder", @@ -4820,6 +4811,7 @@ dependencies = [ "parachains-common", "parity-scale-codec", "scale-info", + "serde_json", "sp-api", "sp-block-builder", "sp-core 34.0.0", @@ -9398,6 +9390,7 @@ dependencies = [ "polkadot-runtime-common", "scale-info", "serde", + "serde_json", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -9504,6 +9497,7 @@ dependencies = [ "polkadot-runtime-constants", "scale-info", "serde", + "serde_json", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -14588,7 +14582,10 @@ dependencies = [ "polkadot-primitives", "polkadot-runtime-constants", "smallvec", + "sp-core 34.0.0", "sp-runtime 38.0.0", + "sp-std", + "staging-xcm", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6cfc0c6c6a..5e9645b14f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -191,7 +191,7 @@ sc-chain-spec = { version = "34.0.0" } scale-info = { version = "2.10.0", default-features = false } separator = { version = "0.4.1" } serde = { version = "1.0.196" } -serde_json = { version = "1.0.113" } +serde_json = { version = "1.0.113", default-features = false } smallvec = { version = "1.13.1" } snowbridge-beacon-primitives = { version = "0.7.0", default-features = false } snowbridge-core = { version = "0.7.0", default-features = false } @@ -271,6 +271,7 @@ members = [ "integration-tests/emulated/tests/coretime/coretime-kusama", "integration-tests/emulated/tests/people/people-kusama", "integration-tests/emulated/tests/people/people-polkadot", + "integration-tests/zombienet", "relay/kusama", "relay/kusama/constants", "relay/polkadot", @@ -291,7 +292,6 @@ members = [ "system-parachains/gluttons/glutton-kusama", "system-parachains/people/people-kusama", "system-parachains/people/people-polkadot", - "integration-tests/zombienet", ] [profile.release] diff --git a/chain-spec-generator/Cargo.toml b/chain-spec-generator/Cargo.toml index 7a97e371a7..58415043dd 100644 --- a/chain-spec-generator/Cargo.toml +++ b/chain-spec-generator/Cargo.toml @@ -12,23 +12,9 @@ serde_json = { workspace = true } serde = { features = ["derive"], workspace = true } polkadot-runtime = { workspace = true } -polkadot-runtime-constants = { workspace = true, default-features = true } kusama-runtime = { workspace = true } -kusama-runtime-constants = { workspace = true, default-features = true } sc-chain-spec = { workspace = true } -runtime-parachains = { default-features = true, workspace = true } -polkadot-primitives = { workspace = true, default-features = true } -babe-primitives = { workspace = true, default-features = true } -authority-discovery-primitives = { workspace = true, default-features = true } -sp-core = { workspace = true, default-features = true } -pallet-staking = { workspace = true, default-features = true } -grandpa = { workspace = true } -sp-runtime = { workspace = true, default-features = true } -beefy-primitives = { workspace = true, default-features = true } -xcm = { workspace = true, default-features = true } -parachains-common = { workspace = true, default-features = true } -cumulus-primitives-core = { workspace = true, default-features = true } asset-hub-polkadot-runtime = { workspace = true } asset-hub-kusama-runtime = { workspace = true } @@ -50,17 +36,10 @@ runtime-benchmarks = [ "bridge-hub-polkadot-runtime/runtime-benchmarks", "collectives-polkadot-runtime/runtime-benchmarks", "coretime-kusama-runtime/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", "encointer-kusama-runtime/runtime-benchmarks", "glutton-kusama-runtime/runtime-benchmarks", "kusama-runtime/runtime-benchmarks", - "pallet-staking/runtime-benchmarks", - "parachains-common/runtime-benchmarks", "people-kusama-runtime/runtime-benchmarks", "people-polkadot-runtime/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", "polkadot-runtime/runtime-benchmarks", - "runtime-parachains/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "encointer-kusama-runtime/runtime-benchmarks" ] diff --git a/chain-spec-generator/src/common.rs b/chain-spec-generator/src/common.rs index 24162a4600..79f68a8ab5 100644 --- a/chain-spec-generator/src/common.rs +++ b/chain-spec-generator/src/common.rs @@ -19,46 +19,12 @@ use crate::{ relay_chain_specs::{KusamaChainSpec, PolkadotChainSpec}, system_parachains_specs::{ AssetHubKusamaChainSpec, AssetHubPolkadotChainSpec, BridgeHubKusamaChainSpec, - BridgeHubPolkadotChainSpec, CollectivesPolkadotChainSpec, EncointerKusamaChainSpec, - GluttonKusamaChainSpec, PeopleKusamaChainSpec, PeoplePolkadotChainSpec, + BridgeHubPolkadotChainSpec, CollectivesPolkadotChainSpec, CoretimeKusamaChainSpec, + EncointerKusamaChainSpec, GluttonKusamaChainSpec, PeopleKusamaChainSpec, + PeoplePolkadotChainSpec, }, ChainSpec, }; -use polkadot_primitives::{AccountId, AccountPublic}; -use sp_core::{sr25519, Pair, Public}; -use sp_runtime::traits::IdentifyAccount; - -pub fn testnet_accounts() -> Vec { - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ] -} - -/// Helper function to generate a crypto pair from seed -pub fn get_from_seed(seed: &str) -> ::Public { - TPublic::Pair::from_string(&format!("//{}", seed), None) - .expect("static values are valid; qed") - .public() -} - -/// Helper function to generate an account ID from seed -pub fn get_account_id_from_seed(seed: &str) -> AccountId -where - AccountPublic: From<::Public>, -{ - AccountPublic::from(get_from_seed::(seed)).into_account() -} #[derive(Debug, serde::Deserialize)] struct EmptyChainSpecWithId { @@ -86,6 +52,8 @@ pub fn from_json_file(filepath: &str, supported: String) -> Result Ok(Box::new(BridgeHubKusamaChainSpec::from_json_file(path)?)), + x if x.starts_with("coretime-kusama") => + Ok(Box::new(CoretimeKusamaChainSpec::from_json_file(path)?)), x if x.starts_with("glutton-kusama") => Ok(Box::new(GluttonKusamaChainSpec::from_json_file(path)?)), x if x.starts_with("encointer-kusama") => diff --git a/chain-spec-generator/src/relay_chain_specs.rs b/chain-spec-generator/src/relay_chain_specs.rs index fafc276d9d..d2c793b99b 100644 --- a/chain-spec-generator/src/relay_chain_specs.rs +++ b/chain-spec-generator/src/relay_chain_specs.rs @@ -15,21 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; -use babe_primitives::AuthorityId as BabeId; -use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId; -use grandpa::AuthorityId as GrandpaId; -use kusama_runtime_constants::currency::UNITS as KSM; -use pallet_staking::Forcing; -use polkadot_primitives::{ - AccountId, AccountPublic, ApprovalVotingParams, AssignmentId, AsyncBackingParams, NodeFeatures, - ValidatorId, -}; -use polkadot_runtime_constants::currency::UNITS as DOT; -use runtime_parachains::configuration::HostConfiguration; use sc_chain_spec::{ChainSpec, ChainType, NoExtension}; -use sp_core::{sr25519, Pair, Public}; -use sp_runtime::{traits::IdentifyAccount, Perbill}; pub type PolkadotChainSpec = sc_chain_spec::GenericChainSpec; @@ -47,297 +33,6 @@ pub fn polkadot_chain_spec_properties() -> serde_json::map::Map HostConfiguration { - use polkadot_primitives::{MAX_CODE_SIZE, MAX_POV_SIZE}; - - runtime_parachains::configuration::HostConfiguration { - validation_upgrade_cooldown: 2u32, - validation_upgrade_delay: 2, - code_retention_period: 1200, - max_code_size: MAX_CODE_SIZE, - max_pov_size: MAX_POV_SIZE, - max_head_data_size: 32 * 1024, - max_upward_queue_count: 8, - max_upward_queue_size: 1024 * 1024, - max_downward_message_size: 1024 * 1024, - max_upward_message_size: 50 * 1024, - max_upward_message_num_per_candidate: 5, - hrmp_sender_deposit: 0, - hrmp_recipient_deposit: 0, - hrmp_channel_max_capacity: 8, - hrmp_channel_max_total_size: 8 * 1024, - hrmp_max_parachain_inbound_channels: 4, - hrmp_channel_max_message_size: 1024 * 1024, - hrmp_max_parachain_outbound_channels: 4, - hrmp_max_message_num_per_candidate: 5, - dispute_period: 6, - no_show_slots: 2, - n_delay_tranches: 25, - needed_approvals: 2, - relay_vrf_modulo_samples: 2, - zeroth_delay_tranche_width: 0, - minimum_validation_upgrade_delay: 5, - scheduler_params: polkadot_primitives::vstaging::SchedulerParams { - group_rotation_frequency: 20, - paras_availability_period: 4, - ..Default::default() - }, - dispute_post_conclusion_acceptance_period: 100u32, - minimum_backing_votes: 1, - node_features: NodeFeatures::EMPTY, - async_backing_params: AsyncBackingParams { - max_candidate_depth: 2, - allowed_ancestry_len: 2, - }, - executor_params: Default::default(), - max_validators: None, - pvf_voting_ttl: 2, - approval_voting_params: ApprovalVotingParams { max_approval_coalesce_count: 1 }, - } -} - -fn polkadot_session_keys( - babe: BabeId, - grandpa: GrandpaId, - para_validator: ValidatorId, - para_assignment: AssignmentId, - authority_discovery: AuthorityDiscoveryId, - beefy: BeefyId, -) -> polkadot_runtime::SessionKeys { - polkadot_runtime::SessionKeys { - babe, - grandpa, - para_validator, - para_assignment, - authority_discovery, - beefy, - } -} - -fn kusama_session_keys( - babe: BabeId, - grandpa: GrandpaId, - para_validator: ValidatorId, - para_assignment: AssignmentId, - authority_discovery: AuthorityDiscoveryId, - beefy: BeefyId, -) -> kusama_runtime::SessionKeys { - kusama_runtime::SessionKeys { - babe, - grandpa, - para_validator, - para_assignment, - authority_discovery, - beefy, - } -} - -/// Helper function to generate a crypto pair from seed -pub fn get_from_seed(seed: &str) -> ::Public { - TPublic::Pair::from_string(&format!("//{}", seed), None) - .expect("static values are valid; qed") - .public() -} - -/// Helper function to generate an account ID from seed -pub fn get_account_id_from_seed(seed: &str) -> AccountId -where - AccountPublic: From<::Public>, -{ - AccountPublic::from(get_from_seed::(seed)).into_account() -} - -/// Helper function to generate stash, controller and session key from seed -pub fn get_authority_keys_from_seed( - seed: &str, -) -> ( - AccountId, - AccountId, - BabeId, - GrandpaId, - ValidatorId, - AssignmentId, - AuthorityDiscoveryId, - BeefyId, -) { - let keys = get_authority_keys_from_seed_no_beefy(seed); - (keys.0, keys.1, keys.2, keys.3, keys.4, keys.5, keys.6, get_from_seed::(seed)) -} - -/// Helper function to generate stash, controller and session key from seed -pub fn get_authority_keys_from_seed_no_beefy( - seed: &str, -) -> (AccountId, AccountId, BabeId, GrandpaId, ValidatorId, AssignmentId, AuthorityDiscoveryId) { - ( - get_account_id_from_seed::(&format!("{}//stash", seed)), - get_account_id_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - ) -} - -fn testnet_accounts() -> Vec { - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ] -} - -#[allow(clippy::type_complexity)] -pub fn polkadot_testnet_genesis( - initial_authorities: Vec<( - AccountId, - AccountId, - BabeId, - GrandpaId, - ValidatorId, - AssignmentId, - AuthorityDiscoveryId, - BeefyId, - )>, - _root_key: AccountId, - endowed_accounts: Option>, -) -> serde_json::Value { - let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); - - const ENDOWMENT: u128 = 1_000_000 * DOT; - const STASH: u128 = 100 * DOT; - - serde_json::json!({ - "balances": { - "balances": endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::>(), - }, - "session": { - "keys": initial_authorities - .iter() - .map(|x| { - ( - x.0.clone(), - x.0.clone(), - polkadot_session_keys( - x.2.clone(), - x.3.clone(), - x.4.clone(), - x.5.clone(), - x.6.clone(), - x.7.clone(), - ), - ) - }) - .collect::>(), - }, - "staking": { - "minimumValidatorCount": 1, - "validatorCount": initial_authorities.len() as u32, - "stakers": initial_authorities - .iter() - .map(|x| (x.0.clone(), x.0.clone(), STASH, polkadot_runtime::StakerStatus::::Validator)) - .collect::>(), - "invulnerables": initial_authorities.iter().map(|x| x.0.clone()).collect::>(), - "forceEra": Forcing::NotForcing, - "slashRewardFraction": Perbill::from_percent(10), - }, - "babe": { - "epochConfig": Some(polkadot_runtime::BABE_GENESIS_EPOCH_CONFIG), - }, - "configuration": { - "config": default_parachains_host_configuration(), - }, - }) -} - -#[allow(clippy::type_complexity)] -pub fn kusama_testnet_genesis( - initial_authorities: Vec<( - AccountId, - AccountId, - BabeId, - GrandpaId, - ValidatorId, - AssignmentId, - AuthorityDiscoveryId, - BeefyId, - )>, - _root_key: AccountId, - endowed_accounts: Option>, -) -> serde_json::Value { - let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); - - const ENDOWMENT: u128 = 1_000_000 * KSM; - const STASH: u128 = 100 * KSM; - - serde_json::json!({ - "balances": { - "balances": endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::>(), - }, - "session": { - "keys": initial_authorities - .iter() - .map(|x| { - ( - x.0.clone(), - x.0.clone(), - kusama_session_keys( - x.2.clone(), - x.3.clone(), - x.4.clone(), - x.5.clone(), - x.6.clone(), - x.7.clone(), - ), - ) - }) - .collect::>(), - }, - "staking": { - "minimumValidatorCount": 1, - "validatorCount": initial_authorities.len() as u32, - "stakers": initial_authorities - .iter() - .map(|x| (x.0.clone(), x.0.clone(), STASH, kusama_runtime::StakerStatus::::Validator)) - .collect::>(), - "invulnerables": initial_authorities.iter().map(|x| x.0.clone()).collect::>(), - "forceEra": Forcing::NotForcing, - "slashRewardFraction": Perbill::from_percent(10), - }, - "babe": { - "epochConfig": Some(kusama_runtime::BABE_GENESIS_EPOCH_CONFIG), - }, - "configuration": { - "config": default_parachains_host_configuration(), - }, - }) -} - -fn polkadot_development_config_genesis() -> serde_json::Value { - polkadot_testnet_genesis( - vec![get_authority_keys_from_seed("Alice")], - get_account_id_from_seed::("Alice"), - None, - ) -} - -fn kusama_development_config_genesis() -> serde_json::Value { - kusama_testnet_genesis( - vec![get_authority_keys_from_seed("Alice")], - get_account_id_from_seed::("Alice"), - None, - ) -} - /// Polkadot development config (single validator Alice) pub fn polkadot_development_config() -> Result, String> { Ok(Box::new( @@ -348,7 +43,9 @@ pub fn polkadot_development_config() -> Result, String> { .with_name("Polakdot Development") .with_id("polkadot-dev") .with_chain_type(ChainType::Development) - .with_genesis_config_patch(polkadot_development_config_genesis()) + .with_genesis_config_patch( + polkadot_runtime::genesis_config_presets::polkadot_development_config_genesis(), + ) .with_protocol_id(DEFAULT_PROTOCOL_ID) .with_properties(polkadot_chain_spec_properties()) .build(), @@ -365,20 +62,14 @@ pub fn kusama_development_config() -> Result, String> { .with_name("Kusama Development") .with_id("kusama-dev") .with_chain_type(ChainType::Development) - .with_genesis_config_patch(kusama_development_config_genesis()) + .with_genesis_config_patch( + kusama_runtime::genesis_config_presets::kusama_development_config_genesis(), + ) .with_protocol_id(DEFAULT_PROTOCOL_ID) .build(), )) } -fn polkadot_local_testnet_genesis() -> serde_json::Value { - polkadot_testnet_genesis( - vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")], - get_account_id_from_seed::("Alice"), - None, - ) -} - /// Polkadot local testnet config (multivalidator Alice + Bob) pub fn polkadot_local_testnet_config() -> Result, String> { Ok(Box::new( @@ -389,21 +80,15 @@ pub fn polkadot_local_testnet_config() -> Result, String> { .with_name("Polkadot Local Testnet") .with_id("polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(polkadot_local_testnet_genesis()) + .with_genesis_config_patch( + polkadot_runtime::genesis_config_presets::polkadot_local_testnet_genesis(), + ) .with_protocol_id(DEFAULT_PROTOCOL_ID) .with_properties(polkadot_chain_spec_properties()) .build(), )) } -fn kusama_local_testnet_genesis() -> serde_json::Value { - kusama_testnet_genesis( - vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")], - get_account_id_from_seed::("Alice"), - None, - ) -} - /// Kusama local testnet config (multivalidator Alice + Bob) pub fn kusama_local_testnet_config() -> Result, String> { Ok(Box::new( @@ -414,18 +99,10 @@ pub fn kusama_local_testnet_config() -> Result, String> { .with_name("Kusama Local Testnet") .with_id("kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(kusama_local_testnet_genesis()) + .with_genesis_config_patch( + kusama_runtime::genesis_config_presets::kusama_local_testnet_genesis(), + ) .with_protocol_id(DEFAULT_PROTOCOL_ID) .build(), )) } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn default_parachains_host_configuration_is_consistent() { - default_parachains_host_configuration().panic_if_not_consistent(); - } -} diff --git a/chain-spec-generator/src/system_parachains_specs.rs b/chain-spec-generator/src/system_parachains_specs.rs index 271f4c4479..2e85943521 100644 --- a/chain-spec-generator/src/system_parachains_specs.rs +++ b/chain-spec-generator/src/system_parachains_specs.rs @@ -15,12 +15,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use crate::common::{get_account_id_from_seed, get_from_seed, testnet_accounts}; -use cumulus_primitives_core::ParaId; -use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance}; use sc_chain_spec::{ChainSpec, ChainSpecExtension, ChainSpecGroup, ChainType}; use serde::{Deserialize, Serialize}; -use sp_core::sr25519; /// Generic extensions for Parachain ChainSpecs. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] @@ -52,161 +48,6 @@ pub type PeopleKusamaChainSpec = sc_chain_spec::GenericChainSpec; pub type PeoplePolkadotChainSpec = sc_chain_spec::GenericChainSpec; -const ASSET_HUB_POLKADOT_ED: Balance = asset_hub_polkadot_runtime::ExistentialDeposit::get(); - -const ASSET_HUB_KUSAMA_ED: Balance = asset_hub_kusama_runtime::ExistentialDeposit::get(); - -const COLLECTIVES_POLKADOT_ED: Balance = collectives_polkadot_runtime::ExistentialDeposit::get(); - -const BRIDGE_HUB_POLKADOT_ED: Balance = bridge_hub_polkadot_runtime::ExistentialDeposit::get(); - -const BRIDGE_HUB_KUSAMA_ED: Balance = bridge_hub_kusama_runtime::ExistentialDeposit::get(); - -const ENCOINTER_KUSAMA_ED: Balance = encointer_kusama_runtime::ExistentialDeposit::get(); - -const CORETIME_KUSAMA_ED: Balance = coretime_kusama_runtime::ExistentialDeposit::get(); - -const PEOPLE_KUSAMA_ED: Balance = people_kusama_runtime::ExistentialDeposit::get(); - -const PEOPLE_POLKADOT_ED: Balance = people_polkadot_runtime::ExistentialDeposit::get(); - -/// The default XCM version to set in genesis config. -const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; - -/// Invulnerable Collators -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")), - ] -} - -/// Invulnerable Collators for the particular case of AssetHubPolkadot -pub fn invulnerables_asset_hub_polkadot() -> Vec<(AccountId, AssetHubPolkadotAuraId)> { - vec![ - ( - get_account_id_from_seed::("Alice"), - get_from_seed::("Alice"), - ), - ( - get_account_id_from_seed::("Bob"), - get_from_seed::("Bob"), - ), - ] -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn coretime_kusama_session_keys(keys: AuraId) -> coretime_kusama_runtime::SessionKeys { - coretime_kusama_runtime::SessionKeys { aura: keys } -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn asset_hub_polkadot_session_keys( - keys: AssetHubPolkadotAuraId, -) -> asset_hub_polkadot_runtime::SessionKeys { - asset_hub_polkadot_runtime::SessionKeys { aura: keys } -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn asset_hub_kusama_session_keys(keys: AuraId) -> asset_hub_kusama_runtime::SessionKeys { - asset_hub_kusama_runtime::SessionKeys { aura: keys } -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn collectives_polkadot_session_keys( - keys: AuraId, -) -> collectives_polkadot_runtime::SessionKeys { - collectives_polkadot_runtime::SessionKeys { aura: keys } -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn bridge_hub_polkadot_session_keys(keys: AuraId) -> bridge_hub_polkadot_runtime::SessionKeys { - bridge_hub_polkadot_runtime::SessionKeys { aura: keys } -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn bridge_hub_kusama_session_keys(keys: AuraId) -> bridge_hub_kusama_runtime::SessionKeys { - bridge_hub_kusama_runtime::SessionKeys { aura: keys } -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn people_kusama_session_keys(keys: AuraId) -> people_kusama_runtime::SessionKeys { - people_kusama_runtime::SessionKeys { aura: keys } -} - -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn people_polkadot_session_keys(keys: AuraId) -> people_polkadot_runtime::SessionKeys { - people_polkadot_runtime::SessionKeys { aura: keys } -} - -// AssetHubPolkadot -fn asset_hub_polkadot_genesis( - invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": asset_hub_polkadot_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, ASSET_HUB_POLKADOT_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": asset_hub_polkadot_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": asset_hub_polkadot_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: ASSET_HUB_POLKADOT_ED * 16, - ..Default::default() - }, - "session": asset_hub_polkadot_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - asset_hub_polkadot_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn asset_hub_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - asset_hub_polkadot_genesis( - // initial collators. - invulnerables_asset_hub_polkadot(), - testnet_accounts(), - para_id, - ) -} - pub fn asset_hub_polkadot_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 0.into()); @@ -221,64 +62,12 @@ pub fn asset_hub_polkadot_local_testnet_config() -> Result, S .with_name("Polkadot Asset Hub Local") .with_id("asset-hub-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_polkadot_local_genesis(1000.into())) + .with_genesis_config_patch(asset_hub_polkadot_runtime::genesis_config_presets::asset_hub_polkadot_local_testnet_genesis(1000.into())) .with_properties(properties) .build(), )) } -// AssetHubKusama -fn asset_hub_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": asset_hub_kusama_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, ASSET_HUB_KUSAMA_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": asset_hub_kusama_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": asset_hub_kusama_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: ASSET_HUB_KUSAMA_ED * 16, - ..Default::default() - }, - "session": asset_hub_kusama_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - asset_hub_kusama_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn asset_hub_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - asset_hub_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) -} - pub fn asset_hub_kusama_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 2.into()); @@ -293,64 +82,12 @@ pub fn asset_hub_kusama_local_testnet_config() -> Result, Str .with_name("Kusama Asset Hub Local") .with_id("asset-hub-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_kusama_local_genesis(1000.into())) + .with_genesis_config_patch(asset_hub_kusama_runtime::genesis_config_presets::asset_hub_kusama_local_testnet_genesis(1000.into())) .with_properties(properties) .build(), )) } -// CollectivesPolkadot -fn collectives_polkadot_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": collectives_polkadot_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, COLLECTIVES_POLKADOT_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": collectives_polkadot_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": collectives_polkadot_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: COLLECTIVES_POLKADOT_ED * 16, - ..Default::default() - }, - "session": collectives_polkadot_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - collectives_polkadot_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn collectives_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - collectives_polkadot_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) -} - pub fn collectives_polkadot_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 0.into()); @@ -366,69 +103,12 @@ pub fn collectives_polkadot_local_testnet_config() -> Result, .with_name("Polkadot Collectives Local") .with_id("collectives-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(collectives_polkadot_local_genesis(1001.into())) + .with_genesis_config_patch(collectives_polkadot_runtime::genesis_config_presets::collectives_polkadot_local_testnet_genesis(1001.into())) .with_properties(properties) .build(), )) } -// BridgeHubPolkadot -fn bridge_hub_polkadot_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": bridge_hub_polkadot_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, BRIDGE_HUB_POLKADOT_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": bridge_hub_polkadot_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": bridge_hub_polkadot_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: BRIDGE_HUB_POLKADOT_ED * 16, - ..Default::default() - }, - "session": bridge_hub_polkadot_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - bridge_hub_polkadot_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - "ethereumSystem": bridge_hub_polkadot_runtime::EthereumSystemConfig { - para_id: id, - asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), - ..Default::default() - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn bridge_hub_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_polkadot_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) -} - pub fn bridge_hub_polkadot_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 0.into()); @@ -444,69 +124,12 @@ pub fn bridge_hub_polkadot_local_testnet_config() -> Result, .with_name("Polkadot Bridge Hub Local") .with_id("bridge-hub-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_polkadot_local_genesis(1002.into())) + .with_genesis_config_patch(bridge_hub_polkadot_runtime::genesis_config_presets::bridge_hub_polkadot_local_testnet_genesis(1002.into())) .with_properties(properties) .build(), )) } -// BridgeHubKusama -fn bridge_hub_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": bridge_hub_kusama_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, BRIDGE_HUB_KUSAMA_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": bridge_hub_kusama_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": bridge_hub_kusama_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: BRIDGE_HUB_KUSAMA_ED * 16, - ..Default::default() - }, - "session": bridge_hub_kusama_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - bridge_hub_kusama_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - "ethereumSystem": bridge_hub_kusama_runtime::EthereumSystemConfig { - para_id: id, - asset_hub_para_id: kusama_runtime_constants::system_parachain::ASSET_HUB_ID.into(), - ..Default::default() - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn bridge_hub_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) -} - pub fn bridge_hub_kusama_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 2.into()); @@ -521,26 +144,12 @@ pub fn bridge_hub_kusama_local_testnet_config() -> Result, St .with_name("Kusama Bridge Hub Local") .with_id("bridge-hub-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_kusama_local_genesis(1002.into())) + .with_genesis_config_patch(bridge_hub_kusama_runtime::genesis_config_presets::bridge_hub_kusama_local_testnet_genesis(1002.into())) .with_properties(properties) .build(), )) } -// GluttonKusama -fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { - serde_json::json!({ - "parachainInfo": glutton_kusama_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - }) -} - -fn glutton_kusama_local_genesis(id: ParaId) -> serde_json::Value { - glutton_kusama_genesis(id) -} - pub fn glutton_kusama_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 2.into()); @@ -553,59 +162,16 @@ pub fn glutton_kusama_local_testnet_config() -> Result, Strin .with_name("Kusama Glutton Local") .with_id("glutton-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(glutton_kusama_local_genesis(1300.into())) + .with_genesis_config_patch( + glutton_kusama_runtime::genesis_config_presets::glutton_kusama_local_testnet_genesis( + 1300.into(), + ), + ) .with_properties(properties) .build(), )) } -// EncointerKusama -fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_json::Value { - serde_json::json!({ - "balances": asset_hub_kusama_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, ENCOINTER_KUSAMA_ED * 4096)) - .collect(), - }, - "parachainInfo": encointer_kusama_runtime::ParachainInfoConfig { - parachain_id: id.into(), - ..Default::default() - }, - "collatorSelection": encointer_kusama_runtime::CollatorSelectionConfig { - invulnerables: invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: ENCOINTER_KUSAMA_ED * 16, - ..Default::default() - }, - "session": asset_hub_kusama_runtime::SessionConfig { - keys: invulnerables() - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - asset_hub_kusama_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn encointer_kusama_local_genesis(para_id: u32) -> serde_json::Value { - encointer_kusama_genesis( - // initial collators. - testnet_accounts(), - para_id, - ) -} - pub fn encointer_kusama_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 2.into()); @@ -620,64 +186,12 @@ pub fn encointer_kusama_local_testnet_config() -> Result, Str .with_name("Kusama Encointer Local") .with_id("encointer-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(encointer_kusama_local_genesis(1001)) + .with_genesis_config_patch(encointer_kusama_runtime::genesis_config_presets::encointer_kusama_local_testnet_genesis(1001.into())) .with_properties(properties) .build(), )) } -// CoretimeKusama -fn coretime_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": coretime_kusama_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, CORETIME_KUSAMA_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": coretime_kusama_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": coretime_kusama_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: CORETIME_KUSAMA_ED * 16, - ..Default::default() - }, - "session": coretime_kusama_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - coretime_kusama_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn coretime_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - coretime_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) -} - pub fn coretime_kusama_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 2.into()); @@ -692,64 +206,16 @@ pub fn coretime_kusama_local_testnet_config() -> Result, Stri .with_name("Kusama Coretime Local") .with_id("coretime-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(coretime_kusama_local_genesis(1005.into())) + .with_genesis_config_patch( + coretime_kusama_runtime::genesis_config_presets::coretime_kusama_local_testnet_genesis( + 1005.into(), + ), + ) .with_properties(properties) .build(), )) } -// PeopleKusama -fn people_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": people_kusama_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, PEOPLE_KUSAMA_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": people_kusama_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": people_kusama_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: PEOPLE_KUSAMA_ED * 16, - ..Default::default() - }, - "session": people_kusama_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - people_kusama_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn people_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - people_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) -} - pub fn people_kusama_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 2.into()); @@ -764,64 +230,16 @@ pub fn people_kusama_local_testnet_config() -> Result, String .with_name("Kusama People Local") .with_id("people-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(people_kusama_local_genesis(1004.into())) + .with_genesis_config_patch( + people_kusama_runtime::genesis_config_presets::people_kusama_local_testnet_genesis( + 1004.into(), + ), + ) .with_properties(properties) .build(), )) } -// PeoplePolkadot -fn people_polkadot_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, -) -> serde_json::Value { - serde_json::json!({ - "balances": people_polkadot_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, PEOPLE_POLKADOT_ED * 4096 * 4096)) - .collect(), - }, - "parachainInfo": people_polkadot_runtime::ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, - "collatorSelection": people_polkadot_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: PEOPLE_POLKADOT_ED * 16, - ..Default::default() - }, - "session": people_polkadot_runtime::SessionConfig { - keys: invulnerables - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - people_polkadot_session_keys(aura), // session keys - ) - }) - .collect(), - }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` - }) -} - -fn people_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - crate::system_parachains_specs::people_polkadot_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) -} - pub fn people_polkadot_local_testnet_config() -> Result, String> { let mut properties = sc_chain_spec::Properties::new(); properties.insert("ss58Format".into(), 0.into()); @@ -836,9 +254,11 @@ pub fn people_polkadot_local_testnet_config() -> Result, Stri .with_name("Polkadot People Local") .with_id("people-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(crate::system_parachains_specs::people_polkadot_local_genesis( - 1004.into(), - )) + .with_genesis_config_patch( + people_polkadot_runtime::genesis_config_presets::people_polkadot_local_testnet_genesis( + 1004.into(), + ), + ) .with_properties(properties) .build(), )) diff --git a/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs b/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs index 0f9877edb4..ce483f1b67 100644 --- a/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs +++ b/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs @@ -112,9 +112,7 @@ pub fn genesis() -> Storage { minimum_validator_count: 1, stakers: validators::initial_authorities() .iter() - .map(|x| { - (x.0.clone(), x.1.clone(), STASH, polkadot_runtime::StakerStatus::Validator) - }) + .map(|x| (x.0.clone(), x.1.clone(), STASH, pallet_staking::StakerStatus::Validator)) .collect(), invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(), force_era: pallet_staking::Forcing::ForceNone, diff --git a/integration-tests/zombienet/Cargo.toml b/integration-tests/zombienet/Cargo.toml index d72ed9b9e2..93ce161b5b 100644 --- a/integration-tests/zombienet/Cargo.toml +++ b/integration-tests/zombienet/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -subxt = { features = ["native"] , workspace = true } +subxt = { features = ["native"], workspace = true } tokio = { workspace = true } tracing-subscriber = { workspace = true } zombienet-sdk = { workspace = true } diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml index e5c7b53bcb..c2eaa1c153 100644 --- a/relay/kusama/Cargo.toml +++ b/relay/kusama/Cargo.toml @@ -11,6 +11,7 @@ version.workspace = true [dependencies] codec = { features = ["derive", "max-encoded-len"], workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } log = { workspace = true } authority-discovery-primitives = { workspace = true } @@ -109,7 +110,6 @@ sp-debug-derive = { workspace = true } sp-keyring = { workspace = true } sp-trie = { workspace = true } separator = { workspace = true } -serde_json = { workspace = true } remote-externalities = { workspace = true } tokio = { features = ["macros"], workspace = true } sp-tracing = { workspace = true } @@ -188,7 +188,7 @@ std = [ "polkadot-runtime-common/std", "runtime-parachains/std", "scale-info/std", - "substrate-wasm-builder", + "serde_json/std", "sp-api/std", "sp-application-crypto/std", "sp-arithmetic/std", @@ -208,10 +208,11 @@ std = [ "sp-tracing/std", "sp-transaction-pool/std", "sp-version/std", + "substrate-wasm-builder", "xcm-builder/std", "xcm-executor/std", + "xcm-fee-payment-runtime-api/std", "xcm/std", - "xcm-fee-payment-runtime-api/std" ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -263,7 +264,7 @@ runtime-benchmarks = [ "sp-staking/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks" + "xcm-fee-payment-runtime-api/runtime-benchmarks", ] try-runtime = [ "frame-election-provider-support/try-runtime", @@ -321,7 +322,7 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] # Set timing constants (e.g. session period) to faster versions to speed up testing. fast-runtime = [] diff --git a/relay/kusama/src/genesis_config_presets.rs b/relay/kusama/src/genesis_config_presets.rs new file mode 100644 index 0000000000..dda349608b --- /dev/null +++ b/relay/kusama/src/genesis_config_presets.rs @@ -0,0 +1,249 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the Kusama runtime + +use crate::*; +use babe_primitives::AuthorityId as BabeId; +use kusama_runtime_constants::currency::UNITS as KSM; +use pallet_staking::{Forcing, StakerStatus}; +use polkadot_primitives::{AccountPublic, AssignmentId, AsyncBackingParams}; +use runtime_parachains::configuration::HostConfiguration; +use sp_core::{sr25519, Pair, Public}; +use sp_runtime::{traits::IdentifyAccount, Perbill}; +#[cfg(not(feature = "std"))] +use sp_std::alloc::format; +use sp_std::vec::Vec; + +/// Helper function to generate a crypto pair from seed +fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate an account ID from seed +fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// Helper function to generate stash, controller and session key from seed +fn get_authority_keys_from_seed( + seed: &str, +) -> ( + AccountId, + AccountId, + BabeId, + GrandpaId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + BeefyId, +) { + ( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + ) +} + +fn testnet_accounts() -> Vec { + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ] +} + +fn default_parachains_host_configuration() -> HostConfiguration { + use polkadot_primitives::{MAX_CODE_SIZE, MAX_POV_SIZE}; + + runtime_parachains::configuration::HostConfiguration { + validation_upgrade_cooldown: 2u32, + validation_upgrade_delay: 2, + code_retention_period: 1200, + max_code_size: MAX_CODE_SIZE, + max_pov_size: MAX_POV_SIZE, + max_head_data_size: 32 * 1024, + max_upward_queue_count: 8, + max_upward_queue_size: 1024 * 1024, + max_downward_message_size: 1024 * 1024, + max_upward_message_size: 50 * 1024, + max_upward_message_num_per_candidate: 5, + hrmp_sender_deposit: 0, + hrmp_recipient_deposit: 0, + hrmp_channel_max_capacity: 8, + hrmp_channel_max_total_size: 8 * 1024, + hrmp_max_parachain_inbound_channels: 4, + hrmp_channel_max_message_size: 1024 * 1024, + hrmp_max_parachain_outbound_channels: 4, + hrmp_max_message_num_per_candidate: 5, + dispute_period: 6, + no_show_slots: 2, + n_delay_tranches: 25, + needed_approvals: 2, + relay_vrf_modulo_samples: 2, + zeroth_delay_tranche_width: 0, + minimum_validation_upgrade_delay: 5, + scheduler_params: polkadot_primitives::vstaging::SchedulerParams { + group_rotation_frequency: 20, + paras_availability_period: 4, + ..Default::default() + }, + dispute_post_conclusion_acceptance_period: 100u32, + minimum_backing_votes: 1, + node_features: NodeFeatures::EMPTY, + async_backing_params: AsyncBackingParams { + max_candidate_depth: 2, + allowed_ancestry_len: 2, + }, + executor_params: Default::default(), + max_validators: None, + pvf_voting_ttl: 2, + approval_voting_params: ApprovalVotingParams { max_approval_coalesce_count: 1 }, + } +} + +#[allow(clippy::type_complexity)] +fn kusama_testnet_genesis( + initial_authorities: Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + BeefyId, + )>, + _root_key: AccountId, + endowed_accounts: Option>, +) -> serde_json::Value { + let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); + + const ENDOWMENT: u128 = 1_000_000 * KSM; + const STASH: u128 = 100 * KSM; + + serde_json::json!({ + "balances": { + "balances": endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::>(), + }, + "session": { + "keys": initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + kusama_session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + "staking": { + "minimumValidatorCount": 1, + "validatorCount": initial_authorities.len() as u32, + "stakers": initial_authorities + .iter() + .map(|x| (x.0.clone(), x.0.clone(), STASH, StakerStatus::::Validator)) + .collect::>(), + "invulnerables": initial_authorities.iter().map(|x| x.0.clone()).collect::>(), + "forceEra": Forcing::NotForcing, + "slashRewardFraction": Perbill::from_percent(10), + }, + "babe": { + "epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG), + }, + "configuration": { + "config": default_parachains_host_configuration(), + }, + }) +} + +fn kusama_session_keys( + babe: BabeId, + grandpa: GrandpaId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + beefy: BeefyId, +) -> SessionKeys { + SessionKeys { babe, grandpa, para_validator, para_assignment, authority_discovery, beefy } +} + +pub fn kusama_local_testnet_genesis() -> serde_json::Value { + kusama_testnet_genesis( + vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")], + get_account_id_from_seed::("Alice"), + None, + ) +} + +pub fn kusama_development_config_genesis() -> serde_json::Value { + kusama_testnet_genesis( + vec![get_authority_keys_from_seed("Alice")], + get_account_id_from_seed::("Alice"), + None, + ) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => kusama_development_config_genesis(), + Ok("local_testnet") => kusama_local_testnet_genesis(), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn default_parachains_host_configuration_is_consistent() { + default_parachains_host_configuration().panic_if_not_consistent(); + } +} diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index a37f74740e..bdfb383864 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -112,8 +112,6 @@ use xcm_fee_payment_runtime_api::{ pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::{Call as EPMCall, GeometricDepositBase}; -#[cfg(feature = "std")] -pub use pallet_staking::StakerStatus; use pallet_staking::UseValidatorsMap; use sp_runtime::traits::Get; #[cfg(any(feature = "std", test))] @@ -124,6 +122,9 @@ use kusama_runtime_constants::{ currency::*, fee::*, system_parachain, time::*, TREASURY_PALLET_ID, }; +// Genesis preset configurations. +pub mod genesis_config_presets; + // Weights used in the runtime. mod weights; @@ -2334,11 +2335,14 @@ sp_api::impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index 968bac44d0..11e6890f00 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -10,6 +10,7 @@ license.workspace = true [dependencies] codec = { features = ["derive", "max-encoded-len"], workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } log = { workspace = true } authority-discovery-primitives = { workspace = true } @@ -106,7 +107,6 @@ sp-debug-derive = { workspace = true } [dev-dependencies] sp-keyring = { workspace = true } sp-trie = { workspace = true } -serde_json = { workspace = true } separator = { workspace = true } remote-externalities = { workspace = true } tokio = { features = ["macros"], workspace = true } @@ -185,7 +185,7 @@ std = [ "polkadot-runtime-constants/std", "runtime-parachains/std", "scale-info/std", - "substrate-wasm-builder", + "serde_json/std", "sp-api/std", "sp-application-crypto/std", "sp-arithmetic/std", @@ -205,10 +205,11 @@ std = [ "sp-tracing/std", "sp-transaction-pool/std", "sp-version/std", + "substrate-wasm-builder", "xcm-builder/std", "xcm-executor/std", - "xcm/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -314,7 +315,7 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] # Set timing constants (e.g. session period) to faster versions to speed up testing. fast-runtime = [] diff --git a/relay/polkadot/src/genesis_config_presets.rs b/relay/polkadot/src/genesis_config_presets.rs new file mode 100644 index 0000000000..38abd8e48f --- /dev/null +++ b/relay/polkadot/src/genesis_config_presets.rs @@ -0,0 +1,249 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the Polkadot runtime + +use crate::*; +use babe_primitives::AuthorityId as BabeId; +use pallet_staking::{Forcing, StakerStatus}; +use polkadot_primitives::{AccountPublic, AssignmentId, AsyncBackingParams}; +use polkadot_runtime_constants::currency::UNITS as DOT; +use runtime_parachains::configuration::HostConfiguration; +use sp_core::{sr25519, Pair, Public}; +use sp_runtime::{traits::IdentifyAccount, Perbill}; +#[cfg(not(feature = "std"))] +use sp_std::alloc::format; +use sp_std::vec::Vec; + +/// Helper function to generate a crypto pair from seed +fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate an account ID from seed +fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// Helper function to generate stash, controller and session key from seed +fn get_authority_keys_from_seed( + seed: &str, +) -> ( + AccountId, + AccountId, + BabeId, + GrandpaId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + BeefyId, +) { + ( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + ) +} + +fn testnet_accounts() -> Vec { + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ] +} + +fn default_parachains_host_configuration() -> HostConfiguration { + use polkadot_primitives::{MAX_CODE_SIZE, MAX_POV_SIZE}; + + runtime_parachains::configuration::HostConfiguration { + validation_upgrade_cooldown: 2u32, + validation_upgrade_delay: 2, + code_retention_period: 1200, + max_code_size: MAX_CODE_SIZE, + max_pov_size: MAX_POV_SIZE, + max_head_data_size: 32 * 1024, + max_upward_queue_count: 8, + max_upward_queue_size: 1024 * 1024, + max_downward_message_size: 1024 * 1024, + max_upward_message_size: 50 * 1024, + max_upward_message_num_per_candidate: 5, + hrmp_sender_deposit: 0, + hrmp_recipient_deposit: 0, + hrmp_channel_max_capacity: 8, + hrmp_channel_max_total_size: 8 * 1024, + hrmp_max_parachain_inbound_channels: 4, + hrmp_channel_max_message_size: 1024 * 1024, + hrmp_max_parachain_outbound_channels: 4, + hrmp_max_message_num_per_candidate: 5, + dispute_period: 6, + no_show_slots: 2, + n_delay_tranches: 25, + needed_approvals: 2, + relay_vrf_modulo_samples: 2, + zeroth_delay_tranche_width: 0, + minimum_validation_upgrade_delay: 5, + scheduler_params: polkadot_primitives::vstaging::SchedulerParams { + group_rotation_frequency: 20, + paras_availability_period: 4, + ..Default::default() + }, + dispute_post_conclusion_acceptance_period: 100u32, + minimum_backing_votes: 1, + node_features: NodeFeatures::EMPTY, + async_backing_params: AsyncBackingParams { + max_candidate_depth: 2, + allowed_ancestry_len: 2, + }, + executor_params: Default::default(), + max_validators: None, + pvf_voting_ttl: 2, + approval_voting_params: ApprovalVotingParams { max_approval_coalesce_count: 1 }, + } +} + +#[allow(clippy::type_complexity)] +fn polkadot_testnet_genesis( + initial_authorities: Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + BeefyId, + )>, + _root_key: AccountId, + endowed_accounts: Option>, +) -> serde_json::Value { + let endowed_accounts: Vec = endowed_accounts.unwrap_or_else(testnet_accounts); + + const ENDOWMENT: u128 = 1_000_000 * DOT; + const STASH: u128 = 100 * DOT; + + serde_json::json!({ + "balances": { + "balances": endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::>(), + }, + "session": { + "keys": initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + polkadot_session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + "staking": { + "minimumValidatorCount": 1, + "validatorCount": initial_authorities.len() as u32, + "stakers": initial_authorities + .iter() + .map(|x| (x.0.clone(), x.0.clone(), STASH, StakerStatus::::Validator)) + .collect::>(), + "invulnerables": initial_authorities.iter().map(|x| x.0.clone()).collect::>(), + "forceEra": Forcing::NotForcing, + "slashRewardFraction": Perbill::from_percent(10), + }, + "babe": { + "epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG), + }, + "configuration": { + "config": default_parachains_host_configuration(), + }, + }) +} + +fn polkadot_session_keys( + babe: BabeId, + grandpa: GrandpaId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + beefy: BeefyId, +) -> SessionKeys { + SessionKeys { babe, grandpa, para_validator, para_assignment, authority_discovery, beefy } +} + +pub fn polkadot_local_testnet_genesis() -> serde_json::Value { + polkadot_testnet_genesis( + vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")], + get_account_id_from_seed::("Alice"), + None, + ) +} + +pub fn polkadot_development_config_genesis() -> serde_json::Value { + polkadot_testnet_genesis( + vec![get_authority_keys_from_seed("Alice")], + get_account_id_from_seed::("Alice"), + None, + ) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => polkadot_development_config_genesis(), + Ok("local_testnet") => polkadot_local_testnet_genesis(), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn default_parachains_host_configuration_is_consistent() { + default_parachains_host_configuration().panic_if_not_consistent(); + } +} diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 631fcc9cdc..6fd018a9de 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -112,8 +112,6 @@ use xcm_fee_payment_runtime_api::{ pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::{Call as EPMCall, GeometricDepositBase}; -#[cfg(feature = "std")] -pub use pallet_staking::StakerStatus; use pallet_staking::UseValidatorsMap; pub use pallet_timestamp::Call as TimestampCall; #[cfg(any(feature = "std", test))] @@ -126,7 +124,8 @@ use polkadot_runtime_constants::{currency::*, fee::*, time::*, TREASURY_PALLET_I mod weights; mod bag_thresholds; - +// Genesis preset configurations. +pub mod genesis_config_presets; // Governance configurations. pub mod governance; use governance::{ @@ -2385,11 +2384,14 @@ sp_api::impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml index 2e7bd9d438..0031a57feb 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml @@ -13,6 +13,7 @@ codec = { features = ["derive", "max-encoded-len"], workspace = true } hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Local bp-asset-hub-kusama = { workspace = true } @@ -254,6 +255,7 @@ std = [ "polkadot-runtime-constants/std", "primitive-types/std", "scale-info/std", + "serde_json/std", "snowbridge-router-primitives/std", "sp-api/std", "sp-block-builder/std", @@ -273,8 +275,8 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] # Enable metadata hash generation at compile time for the `CheckMetadataHash` extension. @@ -283,4 +285,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs new file mode 100644 index 0000000000..09aef4c37d --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs @@ -0,0 +1,87 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the AssetHubKusama runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const ASSET_HUB_KUSAMA_ED: Balance = ExistentialDeposit::get(); + +fn asset_hub_kusama_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, ASSET_HUB_KUSAMA_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ASSET_HUB_KUSAMA_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn asset_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + asset_hub_kusama_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn asset_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { + asset_hub_kusama_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => asset_hub_kusama_development_genesis(1000.into()), + Ok("local_testnet") => asset_hub_kusama_local_testnet_genesis(1000.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 42b4befc18..b49e9b620d 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -24,6 +24,8 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +// Genesis preset configurations. +pub mod genesis_config_presets; mod impls; mod weights; pub mod xcm_config; @@ -1384,11 +1386,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index 081e61c224..b8b4505163 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -13,6 +13,7 @@ codec = { features = ["derive", "max-encoded-len"], workspace = true } hex-literal = { optional = true, workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Local bp-asset-hub-kusama = { workspace = true } @@ -235,6 +236,7 @@ std = [ "polkadot-runtime-constants/std", "primitive-types/std", "scale-info/std", + "serde_json/std", "snowbridge-router-primitives/std", "sp-api/std", "sp-block-builder/std", @@ -255,8 +257,8 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] # Enable metadata hash generation at compile time for the `CheckMetadataHash` extension. @@ -265,4 +267,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs new file mode 100644 index 0000000000..2f87b6b3b8 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs @@ -0,0 +1,103 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the AssetHubPolkadot runtime + +use crate::*; +use parachains_common::AssetHubPolkadotAuraId; +use sp_core::sr25519; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const ASSET_HUB_POLKADOT_ED: Balance = ExistentialDeposit::get(); + +/// Invulnerable Collators for the particular case of AssetHubPolkadot +pub fn invulnerables_asset_hub_polkadot() -> Vec<(AccountId, AssetHubPolkadotAuraId)> { + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_from_seed::("Bob"), + ), + ] +} + +fn asset_hub_polkadot_genesis( + invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, ASSET_HUB_POLKADOT_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ASSET_HUB_POLKADOT_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn asset_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + asset_hub_polkadot_genesis(invulnerables_asset_hub_polkadot(), testnet_accounts(), para_id) +} + +fn asset_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value { + asset_hub_polkadot_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => asset_hub_polkadot_development_genesis(1000.into()), + Ok("local_testnet") => asset_hub_polkadot_local_testnet_genesis(1000.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index db4537a508..ad04c2dec6 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -59,6 +59,8 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +// Genesis preset configurations. +pub mod genesis_config_presets; mod impls; mod weights; pub mod xcm_config; @@ -1345,11 +1347,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml index 3d972459a8..ee9b6fbeb5 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -17,6 +17,7 @@ hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } serde = { optional = true, features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } tuplex = { workspace = true } # Local @@ -97,7 +98,6 @@ bp-relayers = { workspace = true } bp-runtime = { workspace = true } bp-kusama = { workspace = true } bp-polkadot = { workspace = true } -bp-polkadot-bulletin = { workspace = true } bridge-hub-common = { workspace = true } bridge-runtime-common = { workspace = true } pallet-bridge-grandpa = { workspace = true } @@ -192,6 +192,7 @@ std = [ "polkadot-runtime-constants/std", "scale-info/std", "serde", + "serde_json/std", "snowbridge-beacon-primitives/std", "snowbridge-core/std", "snowbridge-outbound-queue-runtime-api/std", @@ -218,12 +219,11 @@ std = [ "sp-version/std", "substrate-wasm-builder", "system-parachains-constants/std", + "tuplex/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", - "bp-polkadot-bulletin/std", - "tuplex/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] runtime-benchmarks = [ @@ -310,4 +310,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs new file mode 100644 index 0000000000..a57100ce0c --- /dev/null +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs @@ -0,0 +1,92 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the BridgeHubKusama runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const BRIDGE_HUB_KUSAMA_ED: Balance = ExistentialDeposit::get(); + +fn bridge_hub_kusama_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, BRIDGE_HUB_KUSAMA_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: BRIDGE_HUB_KUSAMA_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + "ethereumSystem": EthereumSystemConfig { + para_id: id, + asset_hub_para_id: kusama_runtime_constants::system_parachain::ASSET_HUB_ID.into(), + ..Default::default() + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn bridge_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + bridge_hub_kusama_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn bridge_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { + bridge_hub_kusama_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => bridge_hub_kusama_development_genesis(1002.into()), + Ok("local_testnet") => bridge_hub_kusama_local_testnet_genesis(1002.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index 96784c165d..246ed4c1f0 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -24,6 +24,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod bridge_to_ethereum_config; pub mod bridge_to_polkadot_config; +// Genesis preset configurations. +pub mod genesis_config_presets; mod weights; pub mod xcm_config; @@ -797,11 +799,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml index d683b0c496..a583b57e09 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -17,6 +17,7 @@ hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } serde = { optional = true, features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } tuplex = { workspace = true } # Local @@ -95,7 +96,6 @@ bp-relayers = { workspace = true } bp-runtime = { workspace = true } bp-kusama = { workspace = true } bp-polkadot = { workspace = true } -bp-polkadot-bulletin = { workspace = true } bridge-hub-common = { workspace = true } bridge-runtime-common = { workspace = true } pallet-bridge-grandpa = { workspace = true } @@ -188,6 +188,7 @@ std = [ "polkadot-runtime-constants/std", "scale-info/std", "serde", + "serde_json/std", "snowbridge-beacon-primitives/std", "snowbridge-core/std", "snowbridge-outbound-queue-runtime-api/std", @@ -214,12 +215,11 @@ std = [ "sp-version/std", "substrate-wasm-builder", "system-parachains-constants/std", + "tuplex/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", - "bp-polkadot-bulletin/std", - "tuplex/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] runtime-benchmarks = [ @@ -304,4 +304,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml index 833d4b1d27..1b83619b6b 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/Cargo.toml @@ -35,6 +35,7 @@ default = ["std"] std = [ "bp-bridge-hub-cumulus/std", "bp-messages/std", + "bp-polkadot-bulletin/std", "bp-runtime/std", "frame-support/std", "kusama-runtime-constants/std", @@ -45,5 +46,4 @@ std = [ "sp-std/std", "system-parachains-constants/std", "xcm/std", - "bp-polkadot-bulletin/std" ] diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs new file mode 100644 index 0000000000..0d549d3c2e --- /dev/null +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs @@ -0,0 +1,92 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the BridgeHubPolkadot runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const BRIDGE_HUB_POLKADOT_ED: Balance = ExistentialDeposit::get(); + +fn bridge_hub_polkadot_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, BRIDGE_HUB_POLKADOT_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: BRIDGE_HUB_POLKADOT_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + "ethereumSystem": EthereumSystemConfig { + para_id: id, + asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), + ..Default::default() + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn bridge_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + bridge_hub_polkadot_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn bridge_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value { + bridge_hub_polkadot_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => bridge_hub_polkadot_development_genesis(1002.into()), + Ok("local_testnet") => bridge_hub_polkadot_local_testnet_genesis(1002.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 2c41fa5ee3..62298e79ba 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -24,6 +24,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod bridge_to_ethereum_config; pub mod bridge_to_kusama_config; +// Genesis preset configurations. +pub mod genesis_config_presets; mod weights; pub mod xcm_config; @@ -806,11 +808,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/system-parachains/collectives/collectives-polkadot/Cargo.toml b/system-parachains/collectives/collectives-polkadot/Cargo.toml index 48e4e56133..4b76893052 100644 --- a/system-parachains/collectives/collectives-polkadot/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/Cargo.toml @@ -13,6 +13,7 @@ codec = { features = ["derive", "max-encoded-len"], workspace = true } hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Substrate frame-benchmarking = { optional = true, workspace = true } @@ -212,6 +213,7 @@ std = [ "polkadot-runtime-common/std", "polkadot-runtime-constants/std", "scale-info/std", + "serde_json/std", "sp-api/std", "sp-arithmetic/std", "sp-block-builder/std", @@ -230,8 +232,8 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] # Enable metadata hash generation at compile time for the `CheckMetadataHash` extension. @@ -240,4 +242,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs new file mode 100644 index 0000000000..8ad0b4dcdf --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -0,0 +1,87 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the CollectivesPolkadot runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const COLLECTIVES_POLKADOT_ED: Balance = ExistentialDeposit::get(); + +fn collectives_polkadot_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, COLLECTIVES_POLKADOT_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: COLLECTIVES_POLKADOT_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn collectives_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + collectives_polkadot_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn collectives_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value { + collectives_polkadot_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => collectives_polkadot_development_genesis(1001.into()), + Ok("local_testnet") => collectives_polkadot_local_testnet_genesis(1001.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/collectives/collectives-polkadot/src/impls.rs b/system-parachains/collectives/collectives-polkadot/src/impls.rs index a897e6b112..c25c21766a 100644 --- a/system-parachains/collectives/collectives-polkadot/src/impls.rs +++ b/system-parachains/collectives/collectives-polkadot/src/impls.rs @@ -241,8 +241,25 @@ pub mod benchmarks { pub struct OpenHrmpChannel(PhantomData); impl> EnsureSuccessful for OpenHrmpChannel { fn ensure_successful() { - if let ChannelStatus::Closed = ParachainSystem::get_channel_status(I::get().into()) { - ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(I::get().into()) + let para_id = I::get(); + + // open HRMP channel + if let ChannelStatus::Closed = ParachainSystem::get_channel_status(para_id.into()) { + ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(para_id.into()) + } + + // set XCM version for sibling parachain + let sibling_parachain = Location::new(1, [Parachain(para_id)]); + if PolkadotXcm::get_version_for(&sibling_parachain).is_none() { + if let Err(e) = PolkadotXcm::force_xcm_version( + RuntimeOrigin::root(), + sibling_parachain.into(), + system_parachains_constants::genesis_presets::SAFE_XCM_VERSION, + ) { + log::error!( + "Failed to `force_xcm_version` for para_id: {para_id:?}, error: {e:?}" + ); + } } } } diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 7fb5fc5dfa..b650b26db1 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -37,6 +37,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod ambassador; +// Genesis preset configurations. +pub mod genesis_config_presets; pub mod impls; mod weights; pub mod xcm_config; @@ -1009,11 +1011,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/system-parachains/constants/Cargo.toml b/system-parachains/constants/Cargo.toml index 27dd92e1f5..17582f7785 100644 --- a/system-parachains/constants/Cargo.toml +++ b/system-parachains/constants/Cargo.toml @@ -16,7 +16,10 @@ parachains-common = { workspace = true } polkadot-core-primitives = { workspace = true } polkadot-primitives = { workspace = true } polkadot-runtime-constants = { workspace = true } +sp-core = { workspace = true } sp-runtime = { workspace = true } +sp-std = { workspace = true } +xcm = { workspace = true } [features] default = ["std"] @@ -27,5 +30,8 @@ std = [ "polkadot-core-primitives/std", "polkadot-primitives/std", "polkadot-runtime-constants/std", + "sp-core/std", "sp-runtime/std", + "sp-std/std", + "xcm/std", ] diff --git a/system-parachains/constants/src/genesis_presets.rs b/system-parachains/constants/src/genesis_presets.rs new file mode 100644 index 0000000000..abb1f8b955 --- /dev/null +++ b/system-parachains/constants/src/genesis_presets.rs @@ -0,0 +1,68 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use parachains_common::AuraId; +use polkadot_primitives::{AccountId, AccountPublic}; +use sp_core::{sr25519, Pair, Public}; +use sp_runtime::traits::IdentifyAccount; +#[cfg(not(feature = "std"))] +use sp_std::alloc::format; +use sp_std::vec::Vec; + +/// Invulnerable Collators +pub fn invulnerables() -> Vec<(parachains_common::AccountId, AuraId)> { + Vec::from([ + (get_account_id_from_seed::("Alice"), get_from_seed::("Alice")), + (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), + ]) +} + +/// Test accounts +pub fn testnet_accounts() -> Vec { + Vec::from([ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ]) +} + +/// Helper function to generate a crypto pair from seed +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate an account ID from seed +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// The default XCM version to set in genesis config. +pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; diff --git a/system-parachains/constants/src/lib.rs b/system-parachains/constants/src/lib.rs index d0d320d968..7f31f7e149 100644 --- a/system-parachains/constants/src/lib.rs +++ b/system-parachains/constants/src/lib.rs @@ -16,6 +16,7 @@ #![cfg_attr(not(feature = "std"), no_std)] +pub mod genesis_presets; pub mod kusama; pub mod polkadot; diff --git a/system-parachains/coretime/coretime-kusama/Cargo.toml b/system-parachains/coretime/coretime-kusama/Cargo.toml index 6af63bf4e1..ce8e72e67f 100644 --- a/system-parachains/coretime/coretime-kusama/Cargo.toml +++ b/system-parachains/coretime/coretime-kusama/Cargo.toml @@ -14,6 +14,7 @@ hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } serde = { optional = true, features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Local kusama-runtime-constants = { workspace = true } @@ -130,6 +131,7 @@ std = [ "polkadot-runtime-common/std", "scale-info/std", "serde", + "serde_json/std", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", @@ -147,8 +149,8 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] runtime-benchmarks = [ @@ -215,4 +217,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs new file mode 100644 index 0000000000..9b8c7ec0b2 --- /dev/null +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -0,0 +1,87 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the CoretimeKusama runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const CORETIME_KUSAMA_ED: Balance = ExistentialDeposit::get(); + +fn coretime_kusama_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, CORETIME_KUSAMA_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: CORETIME_KUSAMA_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn coretime_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + coretime_kusama_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn coretime_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { + coretime_kusama_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => coretime_kusama_development_genesis(1005.into()), + Ok("local_testnet") => coretime_kusama_local_testnet_genesis(1005.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/coretime/coretime-kusama/src/lib.rs b/system-parachains/coretime/coretime-kusama/src/lib.rs index a2b87a2509..f094e2894e 100644 --- a/system-parachains/coretime/coretime-kusama/src/lib.rs +++ b/system-parachains/coretime/coretime-kusama/src/lib.rs @@ -23,6 +23,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod coretime; +// Genesis preset configurations. +pub mod genesis_config_presets; #[cfg(test)] mod tests; mod weights; @@ -1088,11 +1090,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } } diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 0a5082c3d9..78bd708acb 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -14,6 +14,7 @@ hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } smallvec = { workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Encointer pallet versioning follows these rules: @@ -100,17 +101,13 @@ parachain-info = { workspace = true } parachains-common = { workspace = true } polkadot-core-primitives = { workspace = true } polkadot-primitives = { workspace = true } +system-parachains-constants = { workspace = true } [build-dependencies] substrate-wasm-builder = { optional = true, workspace = true } [dev-dependencies] -# The Encointer pallets might not have compatible versions of `polkadot-sdk` with the rest of the system parachains, -# so we need to copy all the contents from `system-parachains-constants` and `kusama-runtime-constants`. -# We use these crates only for testing to ensure compatible values. -# NOTE: Do not add this to the `[dependencies]` kusama-runtime-constants = { workspace = true, default-features = true } -system-parachains-constants = { workspace = true, default-features = true } [features] default = ["std"] @@ -210,6 +207,7 @@ std = [ "polkadot-primitives/std", "polkadot-runtime-common/std", "scale-info/std", + "serde_json/std", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", @@ -223,10 +221,11 @@ std = [ "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", + "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] @@ -275,4 +274,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/encointer/src/genesis_config_presets.rs b/system-parachains/encointer/src/genesis_config_presets.rs new file mode 100644 index 0000000000..906c77e505 --- /dev/null +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -0,0 +1,87 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the EncointerKusama runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const ENCOINTER_KUSAMA_ED: Balance = ExistentialDeposit::get(); + +fn encointer_kusama_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, ENCOINTER_KUSAMA_ED * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ENCOINTER_KUSAMA_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn encointer_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + encointer_kusama_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn encointer_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { + encointer_kusama_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => encointer_kusama_development_genesis(1001.into()), + Ok("local_testnet") => encointer_kusama_local_testnet_genesis(1001.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 61ea918c8c..e765483d4b 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -31,6 +31,8 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +// Genesis preset configurations. +pub mod genesis_config_presets; mod migrations_fix; mod weights; pub mod xcm_config; @@ -1025,11 +1027,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } @@ -1146,251 +1151,9 @@ fn test_ed_is_one_tenth_of_relay() { assert_eq!(relay_ed / 10, encointer_ed); } -#[test] -fn test_constants_compatiblity() { - assert_eq!( - ::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT, - system_parachains_constants::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT - ); - assert_eq!( - ::kusama_runtime_constants::currency::deposit(5, 3), - system_parachains_constants::kusama_runtime_constants::currency::deposit(5, 3) - ); - assert_eq!( - ::system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32, - system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32 - ); - assert_eq!( - ::system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32, - system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32 - ); - assert_eq!( - ::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode(), - system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode() - ); - assert_eq!(::system_parachains_constants::MINUTES, system_parachains_constants::MINUTES); - assert_eq!(::system_parachains_constants::HOURS, system_parachains_constants::HOURS); - assert_eq!(::system_parachains_constants::DAYS, system_parachains_constants::DAYS); - assert_eq!( - ::system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT, - system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::UNITS, - system_parachains_constants::kusama::currency::UNITS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::QUID, - system_parachains_constants::kusama::currency::QUID - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::CENTS, - system_parachains_constants::kusama::currency::CENTS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::MILLICENTS, - system_parachains_constants::kusama::currency::MILLICENTS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::system_para_deposit(5, 3), - system_parachains_constants::kusama::currency::system_para_deposit(5, 3) - ); - assert_eq!( - ::system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE, - system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE - ); - assert_eq!( - ::system_parachains_constants::kusama::fee::calculate_weight_to_fee( - &::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT - ), - system_parachains_constants::kusama::fee::calculate_weight_to_fee( - &system_parachains_constants::MAXIMUM_BLOCK_WEIGHT - ) - ); -} - #[test] fn test_transasction_byte_fee_is_one_tenth_of_relay() { let relay_tbf = ::kusama_runtime_constants::fee::TRANSACTION_BYTE_FEE; let parachain_tbf = TransactionByteFee::get(); assert_eq!(relay_tbf / 10, parachain_tbf); } - -// The Encointer pallets do not have compatible versions with `polkadot-sdk`, making it difficult -// for us to reuse the `system-parachains-constants` module. Therefore, we have copies of it here -// with `test_constants_compatiblity`. -mod system_parachains_constants { - use super::*; - use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; - - /// This determines the average expected block time that we are targeting. Blocks will be - /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by - /// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn - /// slot_duration()`. - /// - /// Change this to adjust the block time. - pub const MILLISECS_PER_BLOCK: u64 = 12000; - pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; - - // Time is measured by number of blocks. - pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); - pub const HOURS: BlockNumber = MINUTES * 60; - pub const DAYS: BlockNumber = HOURS * 24; - - /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is - /// used to limit the maximal weight of a single extrinsic. - pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); - /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by - /// Operational extrinsics. - pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); - - /// We allow for 0.5 seconds of compute with a 6 second average block time. - pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - polkadot_primitives::MAX_POV_SIZE as u64, - ); - - pub(crate) mod kusama { - /// Consensus-related. - pub mod consensus { - /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included - /// into the relay chain. - pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; - /// How many parachain blocks are processed by the relay chain per parent. Limits the - /// number of blocks authored per slot. - pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; - /// Relay chain slot duration, in milliseconds. - pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; - } - - /// Constants relating to KSM. - pub mod currency { - use super::super::kusama_runtime_constants; - use polkadot_core_primitives::Balance; - - /// The default existential deposit for system chains. 1/10th of the Relay Chain's - /// existential deposit. Individual system parachains may modify this in special cases. - pub const SYSTEM_PARA_EXISTENTIAL_DEPOSIT: Balance = - kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT / 10; - - /// One "KSM" that a UI would show a user. - pub const UNITS: Balance = 1_000_000_000_000; - pub const QUID: Balance = UNITS / 30; - pub const CENTS: Balance = QUID / 100; - pub const MILLICENTS: Balance = CENTS / 1_000; - - /// Deposit rate for stored data. 1/100th of the Relay Chain's deposit rate. `items` is - /// the number of keys in storage and `bytes` is the size of the value. - pub const fn system_para_deposit(items: u32, bytes: u32) -> Balance { - kusama_runtime_constants::currency::deposit(items, bytes) / 100 - } - } - - /// Constants related to Kusama fee payment. - pub mod fee { - use frame_support::{ - pallet_prelude::Weight, - weights::{ - constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient, - WeightToFeeCoefficients, WeightToFeePolynomial, - }, - }; - use polkadot_core_primitives::Balance; - use smallvec::smallvec; - pub use sp_runtime::Perbill; - - /// Cost of every transaction byte at Kusama system parachains. - /// - /// It is the Relay Chain (Kusama) `TransactionByteFee` / 10. - pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS; - - /// Handles converting a weight scalar to a fee value, based on the scale and - /// granularity of the node's balance type. - /// - /// This should typically create a mapping between the following ranges: - /// - [0, MAXIMUM_BLOCK_WEIGHT] - /// - [Balance::min, Balance::max] - /// - /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: - /// - Setting it to `0` will essentially disable the weight fee. - /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. - pub struct WeightToFee; - - impl frame_support::weights::WeightToFee for WeightToFee { - type Balance = Balance; - - fn weight_to_fee(weight: &Weight) -> Self::Balance { - let time_poly: FeePolynomial = RefTimeToFee::polynomial().into(); - let proof_poly: FeePolynomial = ProofSizeToFee::polynomial().into(); - - // Take the maximum instead of the sum to charge by the more scarce resource. - time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size())) - } - } - - /// Maps the reference time component of `Weight` to a fee. - pub struct RefTimeToFee; - - impl WeightToFeePolynomial for RefTimeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - // In Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 - // CENT: The standard system parachain configuration is 1/10 of that, as in - // 1/100 CENT. - let p = super::currency::CENTS; - let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); - - smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, - }] - } - } - - /// Maps the proof size component of `Weight` to a fee. - pub struct ProofSizeToFee; - - impl WeightToFeePolynomial for ProofSizeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - // Map 10kb proof to 1 CENT. - let p = super::currency::CENTS; - let q = 10_000; - - smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, - }] - } - } - - #[cfg(test)] - pub fn calculate_weight_to_fee(weight: &Weight) -> Balance { - ::weight_to_fee(weight) - } - } - } - - pub(crate) mod kusama_runtime_constants { - /// Money matters. - pub mod currency { - use polkadot_primitives::Balance; - - /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = CENTS; - - pub const UNITS: Balance = 1_000_000_000_000; - pub const QUID: Balance = UNITS / 30; - pub const CENTS: Balance = QUID / 100; - pub const MILLICENTS: Balance = CENTS / 1_000; - - pub const fn deposit(items: u32, bytes: u32) -> Balance { - items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS - } - } - } -} diff --git a/system-parachains/gluttons/glutton-kusama/Cargo.toml b/system-parachains/gluttons/glutton-kusama/Cargo.toml index 9886cf18e6..d3aa109541 100644 --- a/system-parachains/gluttons/glutton-kusama/Cargo.toml +++ b/system-parachains/gluttons/glutton-kusama/Cargo.toml @@ -11,6 +11,7 @@ version.workspace = true [dependencies] codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Substrate frame-benchmarking = { optional = true, workspace = true } @@ -87,6 +88,7 @@ std = [ "parachain-info/std", "parachains-common/std", "scale-info/std", + "serde_json/std", "sp-api/std", "sp-block-builder/std", "sp-core/std", diff --git a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs new file mode 100644 index 0000000000..aa6b3f67ba --- /dev/null +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -0,0 +1,51 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the GluttonKusama runtime + +use crate::*; +use cumulus_primitives_core::ParaId; + +fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { + serde_json::json!({ + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + }) +} + +pub fn glutton_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + glutton_kusama_genesis(para_id) +} + +fn glutton_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { + glutton_kusama_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => glutton_kusama_development_genesis(1300.into()), + Ok("local_testnet") => glutton_kusama_local_testnet_genesis(1300.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/gluttons/glutton-kusama/src/lib.rs b/system-parachains/gluttons/glutton-kusama/src/lib.rs index 591157b7bb..6b61f2053f 100644 --- a/system-parachains/gluttons/glutton-kusama/src/lib.rs +++ b/system-parachains/gluttons/glutton-kusama/src/lib.rs @@ -43,6 +43,8 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +// Genesis preset configurations. +pub mod genesis_config_presets; pub mod weights; pub mod xcm_config; @@ -393,11 +395,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } diff --git a/system-parachains/people/people-kusama/Cargo.toml b/system-parachains/people/people-kusama/Cargo.toml index 321df5d416..1fb1c20d8d 100644 --- a/system-parachains/people/people-kusama/Cargo.toml +++ b/system-parachains/people/people-kusama/Cargo.toml @@ -15,6 +15,7 @@ codec = { features = ["derive", "max-encoded-len"], workspace = true } hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Substrate frame-benchmarking = { optional = true, workspace = true } @@ -92,8 +93,8 @@ std = [ "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", "cumulus-primitives-storage-weight-reclaim/std", + "cumulus-primitives-utility/std", "enumflags2/std", "frame-benchmarking?/std", "frame-executive/std", @@ -123,9 +124,11 @@ std = [ "parachain-info/std", "parachains-common/std", "polkadot-parachain-primitives/std", + "polkadot-primitives/std", "polkadot-runtime-common/std", "scale-info/std", "serde", + "serde_json/std", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", @@ -143,9 +146,8 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", - "polkadot-primitives/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] runtime-benchmarks = [ @@ -170,11 +172,11 @@ runtime-benchmarks = [ "pallet-xcm/runtime-benchmarks", "parachains-common/runtime-benchmarks", "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", "xcm-fee-payment-runtime-api/runtime-benchmarks", ] @@ -211,4 +213,4 @@ metadata-hash = ["substrate-wasm-builder/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/people/people-kusama/src/genesis_config_presets.rs b/system-parachains/people/people-kusama/src/genesis_config_presets.rs new file mode 100644 index 0000000000..74aa13cf80 --- /dev/null +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -0,0 +1,87 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the PeopleKusama runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const PEOPLE_KUSAMA_ED: Balance = ExistentialDeposit::get(); + +fn people_kusama_genesis( + invulnerables: Vec<(AccountId, parachains_common::AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, PEOPLE_KUSAMA_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: PEOPLE_KUSAMA_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn people_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + people_kusama_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn people_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { + people_kusama_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => people_kusama_development_genesis(1004.into()), + Ok("local_testnet") => people_kusama_local_testnet_genesis(1004.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index 0585af8e62..8935f0861b 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -18,6 +18,8 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +// Genesis preset configurations. +pub mod genesis_config_presets; mod identity_ops; pub mod people; mod weights; @@ -1078,11 +1080,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } } diff --git a/system-parachains/people/people-polkadot/Cargo.toml b/system-parachains/people/people-polkadot/Cargo.toml index 56eb9e8810..35303be6a6 100644 --- a/system-parachains/people/people-polkadot/Cargo.toml +++ b/system-parachains/people/people-polkadot/Cargo.toml @@ -15,6 +15,7 @@ codec = { features = ["derive", "max-encoded-len"], workspace = true } hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } +serde_json = { features = ["alloc"], workspace = true } # Substrate frame-benchmarking = { optional = true, workspace = true } @@ -100,7 +101,6 @@ std = [ "frame-system-rpc-runtime-api/std", "frame-system/std", "frame-try-runtime?/std", - "polkadot-runtime-constants/std", "log/std", "pallet-aura/std", "pallet-authorship/std", @@ -121,8 +121,10 @@ std = [ "parachains-common/std", "polkadot-parachain-primitives/std", "polkadot-runtime-common/std", + "polkadot-runtime-constants/std", "scale-info/std", "serde", + "serde_json/std", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", @@ -140,8 +142,8 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm/std", "xcm-fee-payment-runtime-api/std", + "xcm/std", ] runtime-benchmarks = [ @@ -206,4 +208,4 @@ metadata-hash = ["substrate-wasm-builder?/metadata-hash"] # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. -on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"] +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs new file mode 100644 index 0000000000..6847d7ca73 --- /dev/null +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -0,0 +1,87 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Genesis configs presets for the PeoplePolkadot runtime + +use crate::*; +use sp_std::vec::Vec; +use system_parachains_constants::genesis_presets::*; + +const PEOPLE_POLKADOT_ED: Balance = ExistentialDeposit::get(); + +fn people_polkadot_genesis( + invulnerables: Vec<(AccountId, parachains_common::AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> serde_json::Value { + serde_json::json!({ + "balances": BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, PEOPLE_POLKADOT_ED * 4096 * 4096)) + .collect(), + }, + "parachainInfo": ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, + "collatorSelection": CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: PEOPLE_POLKADOT_ED * 16, + ..Default::default() + }, + "session": SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + "polkadotXcm": { + "safeXcmVersion": Some(SAFE_XCM_VERSION), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` + }) +} + +pub fn people_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { + people_polkadot_genesis(invulnerables(), testnet_accounts(), para_id) +} + +fn people_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value { + people_polkadot_local_testnet_genesis(para_id) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => people_polkadot_development_genesis(1004.into()), + Ok("local_testnet") => people_polkadot_local_testnet_genesis(1004.into()), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} diff --git a/system-parachains/people/people-polkadot/src/lib.rs b/system-parachains/people/people-polkadot/src/lib.rs index 3208474c6e..66028a71c4 100644 --- a/system-parachains/people/people-polkadot/src/lib.rs +++ b/system-parachains/people/people-polkadot/src/lib.rs @@ -18,6 +18,8 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +// Genesis preset configurations. +pub mod genesis_config_presets; pub mod people; mod weights; pub mod xcm_config; @@ -1028,11 +1030,14 @@ impl_runtime_apis! { } fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) + get_preset::(id, &genesis_config_presets::get_preset) } fn preset_names() -> Vec { - vec![] + vec![ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ] } } } From 7c69345c75910006d56e60e2f9a93c9d0f44f280 Mon Sep 17 00:00:00 2001 From: Valery Gantchev Date: Thu, 25 Jul 2024 09:45:30 +0200 Subject: [PATCH 08/14] Reduce the base fee on Polkadot System Chains (#398) This PR reduces the base fee on all Polkadot system chains by half. As a result, the base fee will be roughly 1/20 of the base fee on the Polkadot relay chain. This will make all transactions on (non-congested) system chains cheaper and stimulate usage. Among others, the change will push the transaction fees for transfers on Asset Hub below $0.01 which is an important psychological threshold. An initiative by ecosystem agents. --------- Co-authored-by: Adrian Catangiu Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- CHANGELOG.md | 1 + .../assets/asset-hub-kusama/src/tests/teleport.rs | 2 +- .../assets/asset-hub-polkadot/src/tests/teleport.rs | 2 +- .../asset-hubs/asset-hub-polkadot/src/lib.rs | 10 +++++----- .../bridge-hub-polkadot/primitives/src/lib.rs | 6 +++--- .../bridge-hubs/bridge-hub-polkadot/src/lib.rs | 4 ++-- .../collectives/collectives-polkadot/src/lib.rs | 4 ++-- system-parachains/constants/src/polkadot.rs | 12 ++++++------ 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb6c377848..68ac8fc1de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Bounties: Remove payout delay ([polkadot-fellows/runtimes#386](https://github.com/polkadot-fellows/runtimes/pull/386)) +- Polkadot System Chains: Reduce the base transaction fee by half ## [1.2.8] 03.07.2024 diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs index a258f15371..e24c443265 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs @@ -166,7 +166,7 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) { owner: *owner == t.receiver.account_id, amount: *amount == expected_foreign_asset_amount, }, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {}, + RuntimeEvent::Balances(pallet_balances::Event::Issued { .. }) => {}, ] ); } diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs index 2f87daa87e..66fd4f3bff 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs @@ -165,7 +165,7 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) { owner: *owner == t.receiver.account_id, amount: *amount == expected_foreign_asset_amount, }, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {}, + RuntimeEvent::Balances(pallet_balances::Event::Issued { .. }) => {}, ] ); } diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index ad04c2dec6..3f4935396e 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -1811,11 +1811,11 @@ mod tests { /// Weight is being charged for both dimensions. #[test] fn weight_charged_for_both_components() { - let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(10_000, 0)); + let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(20_000, 0)); assert!(!fee.is_zero(), "Charges for ref time"); - let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(0, 10_000)); - assert_eq!(fee, CENTS, "10kb maps to CENT"); + let fee: Balance = fee::WeightToFee::weight_to_fee(&Weight::from_parts(0, 20_000)); + assert_eq!(fee, CENTS, "20kb maps to CENT"); } /// Filling up a block by proof size is at most 30 times more expensive than ref time. @@ -1836,10 +1836,10 @@ mod tests { } #[test] - fn test_transasction_byte_fee_is_one_tenth_of_relay() { + fn test_transasction_byte_fee_is_one_twentieth_of_relay() { let relay_tbf = polkadot_runtime_constants::fee::TRANSACTION_BYTE_FEE; let parachain_tbf = TransactionByteFee::get(); - assert_eq!(relay_tbf / 10, parachain_tbf); + assert_eq!(relay_tbf / 20, parachain_tbf); } #[test] diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs index 40947b410a..85b3570d2c 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs @@ -90,15 +90,15 @@ frame_support::parameter_types! { /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Polkadot /// BridgeHub. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 177_594_900; + pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 88_797_450; /// Transaction fee that is paid at the Polkadot BridgeHub for delivering single inbound message. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_standalone_message_delivery_transaction` + `33%`) - pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 942_248_365; + pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 471_124_182; /// Transaction fee that is paid at the Polkadot BridgeHub for delivering single outbound message confirmation. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_standalone_message_confirmation_transaction` + `33%`) - pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 172_377_865; + pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 86_188_932; } /// Compute the total estimated fee that needs to be paid in DOTs by the sender when sending diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 62298e79ba..57e6e765f3 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -1281,9 +1281,9 @@ mod tests { use super::*; #[test] - fn test_transasction_byte_fee_is_one_tenth_of_relay() { + fn test_transasction_byte_fee_is_one_twentieth_of_relay() { let relay_tbf = polkadot_runtime_constants::fee::TRANSACTION_BYTE_FEE; let parachain_tbf = TransactionByteFee::get(); - assert_eq!(relay_tbf / 10, parachain_tbf); + assert_eq!(relay_tbf / 20, parachain_tbf); } } diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index b650b26db1..63cbcfcd97 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -1194,8 +1194,8 @@ fn test_ed_is_one_tenth_of_relay() { } #[test] -fn test_transasction_byte_fee_is_one_tenth_of_relay() { +fn test_transasction_byte_fee_is_one_twentieth_of_relay() { let relay_tbf = polkadot_runtime_constants::fee::TRANSACTION_BYTE_FEE; let parachain_tbf = TransactionByteFee::get(); - assert_eq!(relay_tbf / 10, parachain_tbf); + assert_eq!(relay_tbf / 20, parachain_tbf); } diff --git a/system-parachains/constants/src/polkadot.rs b/system-parachains/constants/src/polkadot.rs index e8e71c265b..d42ca84d82 100644 --- a/system-parachains/constants/src/polkadot.rs +++ b/system-parachains/constants/src/polkadot.rs @@ -90,8 +90,8 @@ pub mod fee { /// Cost of every transaction byte at Polkadot system parachains. /// - /// It is the Relay Chain (Polkadot) `TransactionByteFee` / 10. - pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS; + /// It is the Relay Chain (Polkadot) `TransactionByteFee` / 20. + pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS / 2; /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the /// node's balance type. @@ -122,9 +122,9 @@ pub mod fee { type Balance = Balance; fn polynomial() -> WeightToFeeCoefficients { // In Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: - // The standard system parachain configuration is 1/10 of that, as in 1/100 CENT. + // The standard system parachain configuration is 1/20 of that, as in 1/200 CENT. let p = super::currency::CENTS; - let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); + let q = 200 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); smallvec![WeightToFeeCoefficient { degree: 1, @@ -140,9 +140,9 @@ pub mod fee { impl WeightToFeePolynomial for ProofSizeToFee { type Balance = Balance; fn polynomial() -> WeightToFeeCoefficients { - // Map 10kb proof to 1 CENT. + // Map 20kb proof to 1 CENT. let p = super::currency::CENTS; - let q = 10_000; + let q = 20_000; smallvec![WeightToFeeCoefficient { degree: 1, From 3dea8bf4fba112e5643f6f4340a3dd5ad3492a8b Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 26 Jul 2024 13:16:17 +0200 Subject: [PATCH 09/14] Update system-parachains/coretime/coretime-kusama/src/coretime.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- system-parachains/coretime/coretime-kusama/src/coretime.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/system-parachains/coretime/coretime-kusama/src/coretime.rs b/system-parachains/coretime/coretime-kusama/src/coretime.rs index 8fe2117b78..115aecc65a 100644 --- a/system-parachains/coretime/coretime-kusama/src/coretime.rs +++ b/system-parachains/coretime/coretime-kusama/src/coretime.rs @@ -74,6 +74,7 @@ impl OnUnbalanced> for BurnCoretimeRevenue { fn on_nonzero_unbalanced(amount: Credit) { let acc = CoretimeBurnAccount::get(); if !System::::account_exists(&acc) { + // The account doesn't require ED to survive. System::::inc_providers(&acc); } Balances::resolve(&acc, amount).defensive_ok(); From 604381cd2c5cc595373acf6e1c8a0898d158278b Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 26 Jul 2024 13:16:30 +0200 Subject: [PATCH 10/14] Update CHANGELOG.md Co-authored-by: Muharem --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a71f0ca47..af873eb149 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - RFC-5: Add request revenue info ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #3940](https://github.com/paritytech/polkadot-sdk/pull/3940)). - Core-Fellowship: new `promote_fast` call ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4877](https://github.com/paritytech/polkadot-sdk/pull/4877)). - Pallet ranked collective: max member count per rank ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4807](https://github.com/paritytech/polkadot-sdk/pull/4807)). -- Pallet assets: optional auto-increment for the asset ID ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4757](https://github.com/paritytech/polkadot-sdk/pull/4757)). #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): From 9b1529e7685faffd9d0b069149b6b35ef90d0889 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 26 Jul 2024 13:26:57 +0200 Subject: [PATCH 11/14] Link issue numbers to TODOs Signed-off-by: Oliver Tale-Yazdi --- system-parachains/coretime/coretime-kusama/src/coretime.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system-parachains/coretime/coretime-kusama/src/coretime.rs b/system-parachains/coretime/coretime-kusama/src/coretime.rs index 115aecc65a..2177745406 100644 --- a/system-parachains/coretime/coretime-kusama/src/coretime.rs +++ b/system-parachains/coretime/coretime-kusama/src/coretime.rs @@ -92,6 +92,7 @@ fn burn_at_relay(stash: &AccountId, value: Balance) -> Result<(), XcmError> { let withdrawn = AssetTransactor::withdraw_asset(&asset, &stash_location, None)?; + // TODO https://github.com/polkadot-fellows/runtimes/issues/404 AssetTransactor::can_check_out(&dest, &asset, &dummy_xcm_context)?; let parent_assets = Into::::into(withdrawn) @@ -177,7 +178,7 @@ impl CoretimeInterface for CoretimeAllocator { // Add 5% to each component and round to 2 significant figures. // // This benchmark has been transplanted from a testnet and not rerun, so adding a healthy - // buffer. TODO refine when benchmarks are run. + // buffer. TODO refine when benchmarks are run: https://github.com/polkadot-fellows/runtimes/issues/404 let call_weight = Weight::from_parts(1_000_000_000, 20_000); let message = Xcm(vec![ From cce6316dacdf4816587e550502f419fb1525c220 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 26 Jul 2024 13:47:53 +0200 Subject: [PATCH 12/14] Post merge fixup Signed-off-by: Oliver Tale-Yazdi --- Cargo.lock | 394 ++++++++++++++++++++++++++++++----------------------- Cargo.toml | 10 +- 2 files changed, 228 insertions(+), 176 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfda1bce7b..1223c2495b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -577,7 +577,7 @@ dependencies = [ "asset-hub-kusama-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "kusama-emulated-chain", "parachains-common", "penpal-emulated-chain", @@ -595,7 +595,7 @@ dependencies = [ "asset-test-utils", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "integration-tests-helpers", "kusama-runtime-constants", "kusama-system-emulated-network", @@ -640,7 +640,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -714,7 +714,7 @@ dependencies = [ "asset-hub-polkadot-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "parachains-common", "penpal-emulated-chain", "polkadot-emulated-chain", @@ -734,7 +734,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "integration-tests-helpers", "pallet-asset-conversion", "pallet-assets", @@ -776,7 +776,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -850,7 +850,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-assets", "pallet-balances", @@ -879,7 +879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e2360c96927aa33b3fef7190eabf2aa4129fe3505c11dfa860ada0f27fd1b1" dependencies = [ "cumulus-primitives-core", - "frame-support", + "frame-support 36.0.0", "impl-trait-for-tuples", "log", "pallet-asset-conversion", @@ -1386,7 +1386,7 @@ name = "bp-asset-hub-kusama" version = "1.0.0" dependencies = [ "bp-xcm-bridge-hub-router", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "scale-info", "sp-std", @@ -1399,7 +1399,7 @@ name = "bp-asset-hub-polkadot" version = "1.0.0" dependencies = [ "bp-xcm-bridge-hub-router", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "scale-info", "sp-std", @@ -1416,7 +1416,7 @@ dependencies = [ "bp-messages", "bp-polkadot-core", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "frame-system", "polkadot-primitives", "sp-api", @@ -1430,7 +1430,7 @@ dependencies = [ "bp-bridge-hub-cumulus", "bp-messages", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "kusama-runtime-constants", "polkadot-runtime-constants", "snowbridge-core", @@ -1449,7 +1449,7 @@ dependencies = [ "bp-messages", "bp-polkadot-bulletin", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "kusama-runtime-constants", "polkadot-runtime-constants", "snowbridge-core", @@ -1468,7 +1468,7 @@ checksum = "57cac4b71008e46d43e346476ed1be85cf7b505efacee17dad84d687344bf1b1" dependencies = [ "bp-runtime", "finality-grandpa", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "scale-info", "serde", @@ -1487,7 +1487,7 @@ dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "sp-api", "sp-std", ] @@ -1500,7 +1500,7 @@ checksum = "f97eec00a98efeb052ac9fc9676d9fccf5acd19e3b18530f3d72af1a1faf21ec" dependencies = [ "bp-header-chain", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "scale-info", "serde", @@ -1517,7 +1517,7 @@ dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", @@ -1535,7 +1535,7 @@ dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "sp-api", "sp-std", ] @@ -1550,7 +1550,7 @@ dependencies = [ "bp-messages", "bp-polkadot-core", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -1567,7 +1567,7 @@ checksum = "6ef2272823ecfee580c00f6542dfcab3ec7abdb00857af853429736847c3a2d9" dependencies = [ "bp-messages", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "parity-util-mem", @@ -1586,7 +1586,7 @@ checksum = "5a589f5bb70baa4377a798823be752042aa6c220d51afc559716667e29b0203d" dependencies = [ "bp-messages", "bp-runtime", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "scale-info", "sp-runtime 38.0.0", @@ -1599,7 +1599,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904644c23b437dde65741f3148067624ed0b4d8360f68adf9e92273aeb970814" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "hash-db", "impl-trait-for-tuples", @@ -1666,7 +1666,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd1e0c182cdd2ce204425d011965d2c6344360b48dd9aa3f4c470713cfaae9ba" dependencies = [ "cumulus-primitives-core", - "frame-support", + "frame-support 36.0.0", "pallet-message-queue", "parity-scale-codec", "scale-info", @@ -1684,7 +1684,7 @@ dependencies = [ "bridge-hub-common", "bridge-hub-kusama-runtime", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "parachains-common", "sp-core 34.0.0", ] @@ -1699,7 +1699,7 @@ dependencies = [ "bridge-hub-kusama-runtime", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "hex-literal", "integration-tests-helpers", "kusama-polkadot-system-emulated-network", @@ -1759,7 +1759,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -1839,7 +1839,7 @@ dependencies = [ "bridge-hub-common", "bridge-hub-polkadot-runtime", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "parachains-common", "sp-core 34.0.0", ] @@ -1854,7 +1854,7 @@ dependencies = [ "bridge-hub-polkadot-runtime", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "hex-literal", "integration-tests-helpers", "kusama-polkadot-system-emulated-network", @@ -1912,7 +1912,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -2001,7 +2001,7 @@ dependencies = [ "bridge-runtime-common", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -2040,7 +2040,7 @@ dependencies = [ "bp-runtime", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", - "frame-support", + "frame-support 36.0.0", "frame-system", "hash-db", "log", @@ -2371,7 +2371,7 @@ dependencies = [ "collectives-polkadot-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "parachains-common", "sp-core 34.0.0", ] @@ -2388,7 +2388,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "integration-tests-helpers", "pallet-asset-rate", "pallet-assets", @@ -2428,7 +2428,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -2632,7 +2632,7 @@ dependencies = [ "coretime-kusama-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "parachains-common", "sp-core 34.0.0", ] @@ -2645,7 +2645,7 @@ dependencies = [ "coretime-kusama-runtime", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "integration-tests-helpers", "kusama-runtime-constants", "kusama-system-emulated-network", @@ -2679,7 +2679,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -2972,7 +2972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5e8af48090936c45483d489ee681acb54277763586b53fa3dbd17173aa474fc" dependencies = [ "cumulus-pallet-parachain-system", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-aura", "pallet-timestamp", @@ -2992,7 +2992,7 @@ checksum = "7926abe4b165565b8c86a3525ac98e3a962761d05c201c53012460b237ad5887" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -3016,7 +3016,7 @@ dependencies = [ "cumulus-primitives-proof-size-hostfunction", "environmental", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -3059,7 +3059,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "506daacefa861aa2909b64f26e76495ce029227fd8355b97e074cc1d5dc54ab2" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-session", "parity-scale-codec", @@ -3074,7 +3074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5224285f60e5159bab549f458079d606a7f95ef779def8b89f1a244dc7cf81" dependencies = [ "cumulus-primitives-core", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -3094,7 +3094,7 @@ dependencies = [ "bp-xcm-bridge-hub-router", "cumulus-primitives-core", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-message-queue", @@ -3182,7 +3182,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-proof-size-hostfunction", "docify", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -3198,7 +3198,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05742c520065e3870d419683113ed7f6d35de66f0c80af6828e7878d1bb0ea94" dependencies = [ "cumulus-primitives-core", - "frame-support", + "frame-support 36.0.0", "log", "pallet-asset-conversion", "parity-scale-codec", @@ -3754,7 +3754,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", - "frame-support", + "frame-support 36.0.0", "pallet-assets", "pallet-balances", "pallet-bridge-messages", @@ -3798,7 +3798,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e0a21785d37fcc1d2bc52c4b962ed0ecc1ea0ad7b1421c84c57edb9e11a3d34" dependencies = [ "encointer-primitives", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-asset-tx-payment", @@ -3815,7 +3815,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "449bca6d70a53456d223f2da58189e56a69eff96249b3d660d7d6123d0c824e9" dependencies = [ "encointer-primitives", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "scale-info", "sp-api", @@ -3851,7 +3851,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -3939,7 +3939,7 @@ dependencies = [ "bs58 0.5.0", "crc", "ep-core", - "frame-support", + "frame-support 36.0.0", "log", "parity-scale-codec", "scale-info", @@ -4332,7 +4332,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "709b26657ebbba53dc7bb616577375ca462b20fef1b00e8d9b20d2435e87f7bc" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-support-procedural", "frame-system", "linregress", @@ -4371,7 +4371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1ec289ebad5e601bb165cf7eb6ec2179ae34280ee310d0710a3111d4f8f8f94" dependencies = [ "frame-election-provider-solution-type", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -4389,7 +4389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d878830330eaa9e8b886279c338556b05702d0059989cb51cfb226b70bf3fa4" dependencies = [ "aquamarine", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-try-runtime", "log", @@ -4433,7 +4433,7 @@ checksum = "cf37fc730bf4b51e82a34c6357eebe32c04dbacf6525e0a7b9726f6a17ec9427" dependencies = [ "array-bytes", "docify", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -4464,6 +4464,48 @@ dependencies = [ "tokio-retry", ] +[[package]] +name = "frame-support" +version = "35.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab6d7780b7f337c8a072f0a7480cbc7b580f9bf871c434fae65e8935053ee5ef" +dependencies = [ + "aquamarine", + "array-bytes", + "bitflags 1.3.2", + "docify", + "environmental", + "frame-metadata 16.0.0", + "frame-support-procedural", + "impl-trait-for-tuples", + "k256", + "log", + "macro_magic", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "serde_json", + "smallvec", + "sp-api", + "sp-arithmetic 26.0.0", + "sp-core 34.0.0", + "sp-crypto-hashing-proc-macro", + "sp-debug-derive", + "sp-genesis-builder", + "sp-inherents", + "sp-io 37.0.0", + "sp-metadata-ir", + "sp-runtime 38.0.0", + "sp-staking", + "sp-state-machine 0.42.0", + "sp-std", + "sp-tracing 17.0.0", + "sp-weights 31.0.0", + "static_assertions", + "tt-call", +] + [[package]] name = "frame-support" version = "36.0.0" @@ -4558,7 +4600,7 @@ checksum = "2c2f10b6943da5d00f45b1b07b101bea49647d0e6c7e755b2852fd947072d7ee" dependencies = [ "cfg-if", "docify", - "frame-support", + "frame-support 36.0.0", "log", "parity-scale-codec", "scale-info", @@ -4578,7 +4620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15afc91c7780e18274dcea58ed1edb700c48d10e086a9785e3f6708099cd3250" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -4603,7 +4645,7 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae6ba8b36a52775ad39ccfb45ff4ad814c3cb45ec74d0a4271889e00bd791c6c" dependencies = [ - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "sp-api", "sp-runtime 38.0.0", @@ -4844,7 +4886,7 @@ dependencies = [ "cumulus-primitives-core", "frame-benchmarking", "frame-executive", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -6062,7 +6104,7 @@ dependencies = [ name = "kusama-runtime-constants" version = "1.0.0" dependencies = [ - "frame-support", + "frame-support 36.0.0", "polkadot-primitives", "polkadot-runtime-common", "smallvec", @@ -7560,7 +7602,7 @@ checksum = "a6c2c92855904f34ce42de688cc9411ffcb4c3f13751af2dafd52474d540b158" dependencies = [ "array-bytes", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-collective", @@ -7581,7 +7623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f726ebb59401c1844a4a8703047bdafcd99a1827cd5d8b2c82abeb8948a7f25b" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -7600,7 +7642,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0fde03a96382f4dbe37ef95cb4ef7aade7c0be410cb6c888eda911c94af3eaf" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-asset-conversion", "pallet-transaction-payment", @@ -7617,7 +7659,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e806842bec955190ec64f8b2179f74f5355137c4cadf04f3269e6196cd19caf9" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -7633,7 +7675,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "100a180dfbf30a1c872100ec2dae8a61c0f5e8b3f2d3a5cbb34093826293e2ab" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-transaction-payment", "parity-scale-codec", @@ -7652,7 +7694,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f79ef6a7763fc08177f014052469ee12aefcdad0d99a747372360c2f648d2cc4" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -7669,7 +7711,7 @@ version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0861b2a1ad6526948567bb59a3fdc4c7f02ee79b07be8b931a544350ec35ab0c" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-timestamp", @@ -7687,7 +7729,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2c3666a476132f5846fe4d5e1961a923a58a0f54d873d84566f24ffaa3684f" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-session", "parity-scale-codec", @@ -7704,7 +7746,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38885846dbcf03b025fdbd7edb3649046dbc68fa0b419ffe8837ef853a10d31f" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", @@ -7720,7 +7762,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b23d2d814e3cb793659fcf84533f66fdf0ed9cccb66cb2225851f482843ed096" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-authorship", @@ -7748,7 +7790,7 @@ dependencies = [ "docify", "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-balances", @@ -7769,7 +7811,7 @@ checksum = "6878e240962d3887f0e0654ac343a18845adb95ad493c9d4d5e803c015d4a4c3" dependencies = [ "docify", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -7784,7 +7826,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "715dfcd1bf3f1f37af6335d4eb3cef921e746ac54721e2258c4fd968b61eb009" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-authorship", @@ -7807,7 +7849,7 @@ checksum = "01d70c6f872eb3f2635355ccbea944a4f9ea411c0aa25f6f1a15219e8da11ad2" dependencies = [ "array-bytes", "binary-merkle-tree", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-beefy", @@ -7832,7 +7874,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0566499e74ba4b7ccbd1b667eef0dab76ca28402a8d501e22b73a363717b05a9" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-treasury", @@ -7855,7 +7897,7 @@ dependencies = [ "bp-test-utils", "finality-grandpa", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -7875,7 +7917,7 @@ dependencies = [ "bp-messages", "bp-runtime", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "num-traits", @@ -7896,7 +7938,7 @@ dependencies = [ "bp-polkadot-core", "bp-runtime", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-bridge-grandpa", @@ -7917,7 +7959,7 @@ dependencies = [ "bp-relayers", "bp-runtime", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-bridge-messages", @@ -7936,7 +7978,7 @@ checksum = "cd0d652c399b6ed776ee3322e60f40e323f86b413719d7696eddb8f64c368ac0" dependencies = [ "bitvec", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -7955,7 +7997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e351f103ebbdd1eb095da8c2379caccc82ebc59a740c2731693d2204286b83" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-bounties", @@ -7975,7 +8017,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f660cc09f2f277a3976da2eef856b5c725ab7ad1192902ef7f4e4bafd992f04f" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-authorship", @@ -7996,7 +8038,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771bf7f6c76c3ea5e965fee0bf1d8a8c79c8c52d75ead65ed3c4d385f333756f" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8015,7 +8057,7 @@ checksum = "9033f0d23500bbc39298fd50c07b89a2f2d9f07300139b4df8005995ef683875" dependencies = [ "assert_matches", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8032,7 +8074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99f3caf5d750236fce5f59fa464a9ca5bbefedd97f2570caa96cf7bdd2ec5261" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-ranked-collective", @@ -8051,7 +8093,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0596ec5ab55e02b1b5637b3ec2b99027d036fe97a1ab4733ae105474dfa727cf" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8068,7 +8110,7 @@ checksum = "bd1090fdc6ccdd8ff08c60000c970428baaaf0b33e7a6b01a91ec8b697a650a3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-election-provider-support-benchmarking", @@ -8108,7 +8150,7 @@ dependencies = [ "approx", "encointer-primitives", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-asset-tx-payment", @@ -8127,7 +8169,7 @@ checksum = "10d38c490fdd90b649b3ec68a8bb25d3cdfaa11223122482737114e00e29f8a5" dependencies = [ "encointer-primitives", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-encointer-communities", @@ -8144,7 +8186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdfc381df1d6346e244994d4a5729b79b60f964ba4c13e29ea2f057627e1db25" dependencies = [ "encointer-primitives", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "sp-api", "sp-std", @@ -8160,7 +8202,7 @@ dependencies = [ "encointer-meetup-validation", "encointer-primitives", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-encointer-balances", @@ -8183,7 +8225,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c186e855a19f98ba75ef8d674e71533584620a3d7a8ff653631c391f7a4a9b79" dependencies = [ "encointer-primitives", - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "sp-api", "sp-std", @@ -8197,7 +8239,7 @@ checksum = "ffbd4cb15599fc47c662234cfdb2c1c63f39106c4099383d84c981fe5c40af0e" dependencies = [ "encointer-primitives", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-encointer-balances", @@ -8230,7 +8272,7 @@ dependencies = [ "approx", "encointer-primitives", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-encointer-communities", @@ -8251,7 +8293,7 @@ dependencies = [ "approx", "encointer-primitives", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-encointer-ceremonies", @@ -8273,7 +8315,7 @@ checksum = "cc3be9d4a09bd65fad4968354b320cd3cd1913950891293e00fbc879fc09b5d6" dependencies = [ "encointer-primitives", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -8293,7 +8335,7 @@ dependencies = [ "docify", "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8312,7 +8354,7 @@ checksum = "9947ef904cd7662b80f8dee58e03431ee409dacada26d394c34a7bb642d3eeea" dependencies = [ "blake2 0.10.6", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8331,7 +8373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8244b686d5cae6a8af1557ed0f49db08f812f0e7942a8d2da554b4da8a69daf0" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-authorship", @@ -8356,7 +8398,7 @@ checksum = "4555795a3e0e3aa49ea432b7afecb9c71a7db8793a99c68bd8dd3a52a12571f3" dependencies = [ "enumflags2", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8373,7 +8415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa761292e95020304b58b50e5187f8bb82f557c8c2d013e3c96ab41d611873b0" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-authorship", @@ -8394,7 +8436,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b183880ad5efae06afe6066e76f2bac5acf67f34b3cfab7352ceec46accf4b45" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8411,7 +8453,7 @@ version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30555c1b6d76cca7266b639f127a055a4974f5a0796859933cbfebc9a75753a2" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "safe-mix", @@ -8427,7 +8469,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34006cf047f47edbef33874cc64895918e2c5d7562795209068d5fb388c53a30" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8446,7 +8488,7 @@ checksum = "20e65a37881d1998546254a5e50a1f768b3f82deabe774e750f4ea95aba8030c" dependencies = [ "environmental", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8466,7 +8508,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8ccec82827413f031689fef4c714fdb0213d58c7a6e208d33f5eab80483770" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8485,7 +8527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be58483d827602eb8353ecf36aed65c857f0974db5d27981831e5ebf853040bd" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8502,7 +8544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dcaa330221f60feaf3b23d495cccc3bf2a3d6254c596b3c032273c2b46d4078" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-assets", @@ -8521,7 +8563,7 @@ checksum = "3e1cd476809de3840e19091a083d5a79178af1f108ad489706e1f9e04c8836a4" dependencies = [ "enumflags2", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8551,7 +8593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e77cba0e15749c8de2be65efffa51e02bd051b4e6fcf23360d43c3b6a859187c" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8567,7 +8609,7 @@ version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36f8c994eb7298a394b58f98afd520b521b5d46f6f39eade4657eeaac9962471" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-balances", @@ -8589,7 +8631,7 @@ checksum = "39ee599f2861e55fc6113c01e9b14d6e85fda46bac36a906b5dd5a951fa0455c" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-bags-list", "pallet-delegated-staking", @@ -8621,7 +8663,7 @@ version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4859e7bb2af46d2e0f137c2f777adf39f0e5d4d188226158d599f1cfcfb76b9e" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-balances", @@ -8641,7 +8683,7 @@ checksum = "4351b0edafcdf3240f0471c638b39d2c981bde9d17c0172536a0aa3b7c3097ef" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-babe", @@ -8665,7 +8707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ac726abc5b1bcd6c8f783514b8e1a48be32c7d15e0b263e4bc28cc1e4e7763" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8683,7 +8725,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4e12680e176607815a78a0cd10a52af50790292cb950404f30a885e2a7229e9" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8699,7 +8741,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "862ea8d386ed5737e859470c43cbfd9652c81398cad29e03ae7846c21aaee4c6" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -8719,7 +8761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b24d4131bc79fee0b07550136ca6329faa84c1c3e76ae62a74aef6b1da0b95b4" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8736,7 +8778,7 @@ checksum = "b2c906a9c4573eb58de4134ec7180bf12c6769df2b9859dae8adcbc5fce78add" dependencies = [ "assert_matches", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8755,7 +8797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6246871441f85b32d67f70ef13726ac195b05f8e9297df7c46a95a397b8df42" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-ranked-collective", @@ -8776,7 +8818,7 @@ checksum = "b170d6aa191197d3f50b1193925546972ffc394376ead4d2739eb40909b73c85" dependencies = [ "docify", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8793,7 +8835,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c92b24c911c2cfa5351616edc7f2f93427ea6f4f95efdb13f0f5d51997939c3" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -8817,7 +8859,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd02aaf5f10734670346677042ece94fae20dcd5436eafeb9b429d8d6d5b6385" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-session", "pallet-staking", @@ -8835,7 +8877,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66b60b1d726532317f9965bab4995aa49b73f9b7ca3b9a0f75d158bd84686c5f" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8855,7 +8897,7 @@ checksum = "fbebdb060417654f215fc6f03675e5f44cfc83837d9e523e1b8fd9a4a2e1bdc2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-authorship", @@ -8911,7 +8953,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e07f8626f4ff62ac79d6ad0bd01fab7645897ce35706ddb95fa084e75be9306d" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8930,7 +8972,7 @@ checksum = "1bd2a8797c1bb3d3897b4f87a7716111da5eeb8561345277b6e6d70349ec8b35" dependencies = [ "docify", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8947,7 +8989,7 @@ checksum = "ae789d344be857679b0b98b28a67c747119724847f81d704d3fd03ee13fb6841" dependencies = [ "docify", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -8966,7 +9008,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74fb6114223c8d967c3c2f21cbc845e8ea604ff7e21a8e59d119d5a9257ba886" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -8998,7 +9040,7 @@ checksum = "9c502615bb4fdd02856a131cb2a612ad40c26435ec938f65f11cae4ff230812b" dependencies = [ "docify", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "pallet-balances", @@ -9017,7 +9059,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a59e8599a8c19908e934645f845b5cb546cef1f08745319db7e5b9c24f9e0e4" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -9033,7 +9075,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3238fe6ad00da6a137be115904c39cab97eb5c7f03da0bb1a20de1bef03f0c71" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -9050,7 +9092,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78f7f0f4fe5e1d851e85d81e5e73b6f929f0c35af786ce8be9c9e3363717c136" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -9066,7 +9108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e4f27640279229eb73fde0cb06e98b799305e6b0bc724f4dfbef2001ab4ad00" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -9083,7 +9125,7 @@ checksum = "fe7409458b7fedc5c7d46459da154ccc2dc22a843ce08e8ab6c1743ef5cf972c" dependencies = [ "bounded-collections", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-balances", @@ -9107,7 +9149,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f177a171203cc0bec3cff1bdd5d3b926abfbd0ecf347e044b147194e664f717" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -9130,7 +9172,7 @@ dependencies = [ "bp-runtime", "bp-xcm-bridge-hub", "bridge-runtime-common", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-bridge-messages", @@ -9152,7 +9194,7 @@ checksum = "f48bd38d4061a51f263f4c08021e66100e16cbda9978fba163d2544637b31dab" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -9172,7 +9214,7 @@ checksum = "9319e656eebdf161666e54a4d8e24f73137f702f01600247f7be650bc4d46167" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "pallet-asset-tx-payment", @@ -9207,7 +9249,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-balances", "pallet-collator-selection", @@ -9421,7 +9463,7 @@ version = "1.0.0" dependencies = [ "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "kusama-emulated-chain", "parachains-common", "penpal-runtime", @@ -9446,7 +9488,7 @@ dependencies = [ "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -9499,7 +9541,7 @@ version = "1.0.0" dependencies = [ "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "kusama-emulated-chain", "parachains-common", "people-kusama-runtime", @@ -9513,7 +9555,7 @@ dependencies = [ "asset-test-utils", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "integration-tests-helpers", "kusama-runtime-constants", "kusama-system-emulated-network", @@ -9549,7 +9591,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -9608,7 +9650,7 @@ version = "1.0.0" dependencies = [ "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "parachains-common", "people-polkadot-runtime", "polkadot-emulated-chain", @@ -9622,7 +9664,7 @@ dependencies = [ "asset-test-utils", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support", + "frame-support 36.0.0", "integration-tests-helpers", "pallet-balances", "pallet-identity", @@ -9657,7 +9699,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -9938,7 +9980,7 @@ dependencies = [ "frame-executive", "frame-metadata-hash-extension", "frame-remote-externalities", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -10039,7 +10081,7 @@ dependencies = [ "bitvec", "frame-benchmarking", "frame-election-provider-support", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "libsecp256k1", @@ -10086,7 +10128,7 @@ dependencies = [ name = "polkadot-runtime-constants" version = "1.0.0" dependencies = [ - "frame-support", + "frame-support 36.0.0", "polkadot-primitives", "polkadot-runtime-common", "smallvec", @@ -10120,7 +10162,7 @@ dependencies = [ "bitvec", "derive_more", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -12759,7 +12801,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0ad61e3ab1c48d4c8060c7ef8571c5b6007df26687e8dbfdb6c857d840cfd2c" dependencies = [ "byte-slice-cast", - "frame-support", + "frame-support 36.0.0", "hex", "parity-scale-codec", "rlp", @@ -12782,7 +12824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668cd71582305168ed51cb0357a4b4ea814c68c7db3898a9ba4d492f712c54e1" dependencies = [ "ethabi-decode", - "frame-support", + "frame-support 36.0.0", "frame-system", "hex-literal", "parity-scale-codec", @@ -12853,7 +12895,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab6b34950a2abce198fe008ac6a199598053fedcbde2c40fedf981bc55f85dc7" dependencies = [ - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "snowbridge-core", "snowbridge-outbound-queue-merkle-tree", @@ -12868,7 +12910,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0040c2f5a66bcef85e125968af172200cd01d8558c8b3cb9c2e3f1b72abf7dc1" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "hex-literal", "log", @@ -12909,7 +12951,7 @@ dependencies = [ "alloy-primitives", "alloy-sol-types", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "hex-literal", "log", @@ -12951,7 +12993,7 @@ dependencies = [ "bridge-hub-common", "ethabi-decode", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -12972,7 +13014,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f726d9d2bc15b2683995e6f6ae707d2db20085742860acd32d8fb246251681f2" dependencies = [ "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "frame-system", "log", "parity-scale-codec", @@ -12992,7 +13034,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e8e6707ced1308d763117bfe68f85e3f22fcdca7987b32e438c0485570f6ac7" dependencies = [ - "frame-support", + "frame-support 36.0.0", "hex-literal", "log", "parity-scale-codec", @@ -13012,7 +13054,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c033e7905056434638a068dca713ec9d15708af6c7590396fc95a216ec64b40b" dependencies = [ - "frame-support", + "frame-support 36.0.0", "log", "parity-scale-codec", "snowbridge-core", @@ -13030,7 +13072,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bbae06a0abb1ba5ffad59b929263c68cc47b8a286794a7389e781eba20f3481" dependencies = [ "cumulus-pallet-parachain-system", - "frame-support", + "frame-support 36.0.0", "frame-system", "pallet-balances", "pallet-collator-selection", @@ -14245,7 +14287,7 @@ dependencies = [ "frame-executive", "frame-metadata-hash-extension", "frame-remote-externalities", - "frame-support", + "frame-support 36.0.0", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -14345,7 +14387,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd00d586b0dac4f42736bdd0ad52213a891b240e011ea82b38938263dd821c25" dependencies = [ "cumulus-primitives-core", - "frame-support", + "frame-support 36.0.0", "frame-system", "parity-scale-codec", "scale-info", @@ -14378,7 +14420,7 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "847fa2afe1bed2751eaabf7b91fa4043037947f17653d7cc59ea202cc44c6bb8" dependencies = [ - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "log", @@ -14403,7 +14445,7 @@ checksum = "26b98d8219449eaf02e71a7edf1a14b14d4c713dd01d9df66fde1ce30dba4d6d" dependencies = [ "environmental", "frame-benchmarking", - "frame-support", + "frame-support 36.0.0", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -14842,7 +14884,7 @@ dependencies = [ name = "system-parachains-constants" version = "1.0.0" dependencies = [ - "frame-support", + "frame-support 36.0.0", "kusama-runtime-constants", "parachains-common", "polkadot-core-primitives", @@ -16543,7 +16585,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", - "frame-support", + "frame-support 36.0.0", "frame-system", "impl-trait-for-tuples", "lazy_static", @@ -16567,6 +16609,22 @@ dependencies = [ "staging-xcm-executor", ] +[[package]] +name = "xcm-fee-payment-runtime-api" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d4261279994b1cb0d16a77cc12734fca18b88b56b65b8740de543af6d6a17dc" +dependencies = [ + "frame-support 35.0.0", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-runtime 38.0.0", + "sp-std", + "sp-weights 31.0.0", + "staging-xcm", +] + [[package]] name = "xcm-procedural" version = "10.0.0" @@ -16585,7 +16643,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30fffcd9128a46abd836c37dd001c2cbe122aeb8904cd7b9bac8358564fb7b56" dependencies = [ - "frame-support", + "frame-support 36.0.0", "parity-scale-codec", "scale-info", "sp-api", diff --git a/Cargo.toml b/Cargo.toml index 6242af53bd..a61ce5c4ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -121,6 +121,7 @@ pallet-fast-unstake = { version = "35.0.0", default-features = false } pallet-glutton = { version = "22.0.0", default-features = false } pallet-grandpa = { version = "36.0.0", default-features = false } pallet-identity = { version = "36.0.0", default-features = false } +pallet-im-online = { version = "35.0.0", default-features = false } pallet-indices = { version = "36.0.0", default-features = false } pallet-insecure-randomness-collective-flip = { version = "24.0.0", default-features = false } pallet-membership = { version = "36.0.0", default-features = false } @@ -231,18 +232,11 @@ static_assertions = { version = "1.1.0" } substrate-wasm-builder = { version = "23.0.0" } system-parachains-constants = { path = "system-parachains/constants", default-features = false } tokio = { version = "1.36.0" } -<<<<<<< HEAD xcm = { version = "14.0.1", default-features = false, package = "staging-xcm" } xcm-builder = { version = "15.0.0", default-features = false, package = "staging-xcm-builder" } xcm-emulator = { version = "0.13.0" } xcm-executor = { version = "15.0.0", default-features = false, package = "staging-xcm-executor" } -======= -xcm = { version = "14.0.0", default-features = false, package = "staging-xcm" } -xcm-builder = { version = "14.0.0", default-features = false, package = "staging-xcm-builder" } -xcm-emulator = { version = "0.12.0" } -xcm-executor = { version = "14.0.0", default-features = false, package = "staging-xcm-executor" } -xcm-fee-payment-runtime-api = { version = "0.4.0", default-features = false } ->>>>>>> origin/main +xcm-fee-payment-runtime-api = {version = "0.4.0", default-features = false} anyhow = { version = "1.0.82" } subxt = { version = "0.35.0", default-features = false } tracing-subscriber = { version = "0.3.18" } From b74a51f7b81f982f1598a892c9ebb7f06819fd90 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 26 Jul 2024 13:54:09 +0200 Subject: [PATCH 13/14] fmt Signed-off-by: Oliver Tale-Yazdi --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a61ce5c4ba..10bc08acb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -236,7 +236,7 @@ xcm = { version = "14.0.1", default-features = false, package = "staging-xcm" } xcm-builder = { version = "15.0.0", default-features = false, package = "staging-xcm-builder" } xcm-emulator = { version = "0.13.0" } xcm-executor = { version = "15.0.0", default-features = false, package = "staging-xcm-executor" } -xcm-fee-payment-runtime-api = {version = "0.4.0", default-features = false} +xcm-fee-payment-runtime-api = { version = "0.4.0", default-features = false } anyhow = { version = "1.0.82" } subxt = { version = "0.35.0", default-features = false } tracing-subscriber = { version = "0.3.18" } From d84c74a0f19114f9a8565afe617abf9e12024dfc Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 26 Jul 2024 14:14:03 +0200 Subject: [PATCH 14/14] Try to make XCM runtime API compile Signed-off-by: Oliver Tale-Yazdi --- Cargo.lock | 432 ++++++++---------- Cargo.toml | 2 +- .../tests/assets/asset-hub-kusama/Cargo.toml | 2 +- .../src/tests/xcm_fee_estimation.rs | 2 +- .../assets/asset-hub-polkadot/Cargo.toml | 2 +- .../src/tests/xcm_fee_estimation.rs | 2 +- .../bridges/bridge-hub-kusama/Cargo.toml | 2 +- .../src/tests/asset_transfers.rs | 2 +- .../bridge-hub-kusama/src/tests/teleport.rs | 2 +- .../bridges/bridge-hub-polkadot/Cargo.toml | 2 +- .../bridge-hub-polkadot/src/tests/teleport.rs | 2 +- .../collectives-polkadot/Cargo.toml | 2 +- .../src/tests/teleport.rs | 2 +- .../tests/coretime/coretime-kusama/Cargo.toml | 2 +- .../coretime-kusama/src/tests/teleport.rs | 2 +- .../tests/people/people-kusama/Cargo.toml | 2 +- .../people-kusama/src/tests/teleport.rs | 2 +- .../tests/people/people-polkadot/Cargo.toml | 2 +- .../people-polkadot/src/tests/teleport.rs | 2 +- relay/kusama/Cargo.toml | 6 +- relay/kusama/src/lib.rs | 10 +- relay/polkadot/Cargo.toml | 6 +- relay/polkadot/src/lib.rs | 10 +- .../asset-hubs/asset-hub-kusama/Cargo.toml | 6 +- .../asset-hubs/asset-hub-kusama/src/lib.rs | 10 +- .../asset-hubs/asset-hub-polkadot/Cargo.toml | 6 +- .../asset-hubs/asset-hub-polkadot/src/lib.rs | 10 +- .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 6 +- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 10 +- .../bridge-hub-polkadot/Cargo.toml | 6 +- .../bridge-hub-polkadot/src/lib.rs | 10 +- .../collectives-polkadot/Cargo.toml | 6 +- .../collectives-polkadot/src/lib.rs | 10 +- .../coretime/coretime-kusama/Cargo.toml | 6 +- .../coretime/coretime-kusama/src/lib.rs | 10 +- system-parachains/encointer/Cargo.toml | 6 +- system-parachains/encointer/src/lib.rs | 10 +- .../people/people-kusama/Cargo.toml | 6 +- .../people/people-kusama/src/lib.rs | 10 +- .../people/people-polkadot/Cargo.toml | 6 +- .../people/people-polkadot/src/lib.rs | 10 +- 41 files changed, 293 insertions(+), 351 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1223c2495b..8af9fb9d96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -577,7 +577,7 @@ dependencies = [ "asset-hub-kusama-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "kusama-emulated-chain", "parachains-common", "penpal-emulated-chain", @@ -595,7 +595,7 @@ dependencies = [ "asset-test-utils", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "integration-tests-helpers", "kusama-runtime-constants", "kusama-system-emulated-network", @@ -614,7 +614,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -640,7 +640,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -704,7 +704,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -714,7 +714,7 @@ dependencies = [ "asset-hub-polkadot-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "parachains-common", "penpal-emulated-chain", "polkadot-emulated-chain", @@ -734,7 +734,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "integration-tests-helpers", "pallet-asset-conversion", "pallet-assets", @@ -751,7 +751,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -776,7 +776,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -838,7 +838,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -850,7 +850,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-assets", "pallet-balances", @@ -879,7 +879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e2360c96927aa33b3fef7190eabf2aa4129fe3505c11dfa860ada0f27fd1b1" dependencies = [ "cumulus-primitives-core", - "frame-support 36.0.0", + "frame-support", "impl-trait-for-tuples", "log", "pallet-asset-conversion", @@ -1386,7 +1386,7 @@ name = "bp-asset-hub-kusama" version = "1.0.0" dependencies = [ "bp-xcm-bridge-hub-router", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "scale-info", "sp-std", @@ -1399,7 +1399,7 @@ name = "bp-asset-hub-polkadot" version = "1.0.0" dependencies = [ "bp-xcm-bridge-hub-router", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "scale-info", "sp-std", @@ -1416,7 +1416,7 @@ dependencies = [ "bp-messages", "bp-polkadot-core", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "frame-system", "polkadot-primitives", "sp-api", @@ -1430,7 +1430,7 @@ dependencies = [ "bp-bridge-hub-cumulus", "bp-messages", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "kusama-runtime-constants", "polkadot-runtime-constants", "snowbridge-core", @@ -1449,7 +1449,7 @@ dependencies = [ "bp-messages", "bp-polkadot-bulletin", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "kusama-runtime-constants", "polkadot-runtime-constants", "snowbridge-core", @@ -1468,7 +1468,7 @@ checksum = "57cac4b71008e46d43e346476ed1be85cf7b505efacee17dad84d687344bf1b1" dependencies = [ "bp-runtime", "finality-grandpa", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "scale-info", "serde", @@ -1487,7 +1487,7 @@ dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "sp-api", "sp-std", ] @@ -1500,7 +1500,7 @@ checksum = "f97eec00a98efeb052ac9fc9676d9fccf5acd19e3b18530f3d72af1a1faf21ec" dependencies = [ "bp-header-chain", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "scale-info", "serde", @@ -1517,7 +1517,7 @@ dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", @@ -1535,7 +1535,7 @@ dependencies = [ "bp-header-chain", "bp-polkadot-core", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "sp-api", "sp-std", ] @@ -1550,7 +1550,7 @@ dependencies = [ "bp-messages", "bp-polkadot-core", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -1567,7 +1567,7 @@ checksum = "6ef2272823ecfee580c00f6542dfcab3ec7abdb00857af853429736847c3a2d9" dependencies = [ "bp-messages", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "parity-util-mem", @@ -1586,7 +1586,7 @@ checksum = "5a589f5bb70baa4377a798823be752042aa6c220d51afc559716667e29b0203d" dependencies = [ "bp-messages", "bp-runtime", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "scale-info", "sp-runtime 38.0.0", @@ -1599,7 +1599,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904644c23b437dde65741f3148067624ed0b4d8360f68adf9e92273aeb970814" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "hash-db", "impl-trait-for-tuples", @@ -1666,7 +1666,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd1e0c182cdd2ce204425d011965d2c6344360b48dd9aa3f4c470713cfaae9ba" dependencies = [ "cumulus-primitives-core", - "frame-support 36.0.0", + "frame-support", "pallet-message-queue", "parity-scale-codec", "scale-info", @@ -1684,7 +1684,7 @@ dependencies = [ "bridge-hub-common", "bridge-hub-kusama-runtime", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "parachains-common", "sp-core 34.0.0", ] @@ -1699,7 +1699,7 @@ dependencies = [ "bridge-hub-kusama-runtime", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "hex-literal", "integration-tests-helpers", "kusama-polkadot-system-emulated-network", @@ -1724,7 +1724,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -1759,7 +1759,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -1829,7 +1829,7 @@ dependencies = [ "substrate-wasm-builder", "system-parachains-constants", "tuplex", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -1839,7 +1839,7 @@ dependencies = [ "bridge-hub-common", "bridge-hub-polkadot-runtime", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "parachains-common", "sp-core 34.0.0", ] @@ -1854,7 +1854,7 @@ dependencies = [ "bridge-hub-polkadot-runtime", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "hex-literal", "integration-tests-helpers", "kusama-polkadot-system-emulated-network", @@ -1879,7 +1879,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -1912,7 +1912,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -1982,7 +1982,7 @@ dependencies = [ "substrate-wasm-builder", "system-parachains-constants", "tuplex", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -2001,7 +2001,7 @@ dependencies = [ "bridge-runtime-common", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -2040,7 +2040,7 @@ dependencies = [ "bp-runtime", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", - "frame-support 36.0.0", + "frame-support", "frame-system", "hash-db", "log", @@ -2371,7 +2371,7 @@ dependencies = [ "collectives-polkadot-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "parachains-common", "sp-core 34.0.0", ] @@ -2388,7 +2388,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "integration-tests-helpers", "pallet-asset-rate", "pallet-assets", @@ -2409,7 +2409,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -2428,7 +2428,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -2486,7 +2486,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -2632,7 +2632,7 @@ dependencies = [ "coretime-kusama-runtime", "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "parachains-common", "sp-core 34.0.0", ] @@ -2645,7 +2645,7 @@ dependencies = [ "coretime-kusama-runtime", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "integration-tests-helpers", "kusama-runtime-constants", "kusama-system-emulated-network", @@ -2660,7 +2660,7 @@ dependencies = [ "staging-kusama-runtime", "staging-xcm", "staging-xcm-executor", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -2679,7 +2679,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -2730,7 +2730,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -2972,7 +2972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5e8af48090936c45483d489ee681acb54277763586b53fa3dbd17173aa474fc" dependencies = [ "cumulus-pallet-parachain-system", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-aura", "pallet-timestamp", @@ -2992,7 +2992,7 @@ checksum = "7926abe4b165565b8c86a3525ac98e3a962761d05c201c53012460b237ad5887" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -3016,7 +3016,7 @@ dependencies = [ "cumulus-primitives-proof-size-hostfunction", "environmental", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -3059,7 +3059,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "506daacefa861aa2909b64f26e76495ce029227fd8355b97e074cc1d5dc54ab2" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-session", "parity-scale-codec", @@ -3074,7 +3074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5224285f60e5159bab549f458079d606a7f95ef779def8b89f1a244dc7cf81" dependencies = [ "cumulus-primitives-core", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -3094,7 +3094,7 @@ dependencies = [ "bp-xcm-bridge-hub-router", "cumulus-primitives-core", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-message-queue", @@ -3182,7 +3182,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-proof-size-hostfunction", "docify", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -3198,7 +3198,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05742c520065e3870d419683113ed7f6d35de66f0c80af6828e7878d1bb0ea94" dependencies = [ "cumulus-primitives-core", - "frame-support 36.0.0", + "frame-support", "log", "pallet-asset-conversion", "parity-scale-codec", @@ -3754,7 +3754,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", - "frame-support 36.0.0", + "frame-support", "pallet-assets", "pallet-balances", "pallet-bridge-messages", @@ -3798,7 +3798,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e0a21785d37fcc1d2bc52c4b962ed0ecc1ea0ad7b1421c84c57edb9e11a3d34" dependencies = [ "encointer-primitives", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-asset-tx-payment", @@ -3815,7 +3815,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "449bca6d70a53456d223f2da58189e56a69eff96249b3d660d7d6123d0c824e9" dependencies = [ "encointer-primitives", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "scale-info", "sp-api", @@ -3851,7 +3851,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -3913,7 +3913,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -3939,7 +3939,7 @@ dependencies = [ "bs58 0.5.0", "crc", "ep-core", - "frame-support 36.0.0", + "frame-support", "log", "parity-scale-codec", "scale-info", @@ -4332,7 +4332,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "709b26657ebbba53dc7bb616577375ca462b20fef1b00e8d9b20d2435e87f7bc" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-support-procedural", "frame-system", "linregress", @@ -4371,7 +4371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1ec289ebad5e601bb165cf7eb6ec2179ae34280ee310d0710a3111d4f8f8f94" dependencies = [ "frame-election-provider-solution-type", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -4389,7 +4389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d878830330eaa9e8b886279c338556b05702d0059989cb51cfb226b70bf3fa4" dependencies = [ "aquamarine", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-try-runtime", "log", @@ -4433,7 +4433,7 @@ checksum = "cf37fc730bf4b51e82a34c6357eebe32c04dbacf6525e0a7b9726f6a17ec9427" dependencies = [ "array-bytes", "docify", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -4464,48 +4464,6 @@ dependencies = [ "tokio-retry", ] -[[package]] -name = "frame-support" -version = "35.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab6d7780b7f337c8a072f0a7480cbc7b580f9bf871c434fae65e8935053ee5ef" -dependencies = [ - "aquamarine", - "array-bytes", - "bitflags 1.3.2", - "docify", - "environmental", - "frame-metadata 16.0.0", - "frame-support-procedural", - "impl-trait-for-tuples", - "k256", - "log", - "macro_magic", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "serde_json", - "smallvec", - "sp-api", - "sp-arithmetic 26.0.0", - "sp-core 34.0.0", - "sp-crypto-hashing-proc-macro", - "sp-debug-derive", - "sp-genesis-builder", - "sp-inherents", - "sp-io 37.0.0", - "sp-metadata-ir", - "sp-runtime 38.0.0", - "sp-staking", - "sp-state-machine 0.42.0", - "sp-std", - "sp-tracing 17.0.0", - "sp-weights 31.0.0", - "static_assertions", - "tt-call", -] - [[package]] name = "frame-support" version = "36.0.0" @@ -4600,7 +4558,7 @@ checksum = "2c2f10b6943da5d00f45b1b07b101bea49647d0e6c7e755b2852fd947072d7ee" dependencies = [ "cfg-if", "docify", - "frame-support 36.0.0", + "frame-support", "log", "parity-scale-codec", "scale-info", @@ -4620,7 +4578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15afc91c7780e18274dcea58ed1edb700c48d10e086a9785e3f6708099cd3250" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -4645,7 +4603,7 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae6ba8b36a52775ad39ccfb45ff4ad814c3cb45ec74d0a4271889e00bd791c6c" dependencies = [ - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "sp-api", "sp-runtime 38.0.0", @@ -4886,7 +4844,7 @@ dependencies = [ "cumulus-primitives-core", "frame-benchmarking", "frame-executive", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -6104,7 +6062,7 @@ dependencies = [ name = "kusama-runtime-constants" version = "1.0.0" dependencies = [ - "frame-support 36.0.0", + "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", @@ -7602,7 +7560,7 @@ checksum = "a6c2c92855904f34ce42de688cc9411ffcb4c3f13751af2dafd52474d540b158" dependencies = [ "array-bytes", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-collective", @@ -7623,7 +7581,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f726ebb59401c1844a4a8703047bdafcd99a1827cd5d8b2c82abeb8948a7f25b" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -7642,7 +7600,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0fde03a96382f4dbe37ef95cb4ef7aade7c0be410cb6c888eda911c94af3eaf" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-asset-conversion", "pallet-transaction-payment", @@ -7659,7 +7617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e806842bec955190ec64f8b2179f74f5355137c4cadf04f3269e6196cd19caf9" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -7675,7 +7633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "100a180dfbf30a1c872100ec2dae8a61c0f5e8b3f2d3a5cbb34093826293e2ab" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-transaction-payment", "parity-scale-codec", @@ -7694,7 +7652,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f79ef6a7763fc08177f014052469ee12aefcdad0d99a747372360c2f648d2cc4" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -7711,7 +7669,7 @@ version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0861b2a1ad6526948567bb59a3fdc4c7f02ee79b07be8b931a544350ec35ab0c" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-timestamp", @@ -7729,7 +7687,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2c3666a476132f5846fe4d5e1961a923a58a0f54d873d84566f24ffaa3684f" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-session", "parity-scale-codec", @@ -7746,7 +7704,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38885846dbcf03b025fdbd7edb3649046dbc68fa0b419ffe8837ef853a10d31f" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", @@ -7762,7 +7720,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b23d2d814e3cb793659fcf84533f66fdf0ed9cccb66cb2225851f482843ed096" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-authorship", @@ -7790,7 +7748,7 @@ dependencies = [ "docify", "frame-benchmarking", "frame-election-provider-support", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-balances", @@ -7811,7 +7769,7 @@ checksum = "6878e240962d3887f0e0654ac343a18845adb95ad493c9d4d5e803c015d4a4c3" dependencies = [ "docify", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -7826,7 +7784,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "715dfcd1bf3f1f37af6335d4eb3cef921e746ac54721e2258c4fd968b61eb009" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-authorship", @@ -7849,7 +7807,7 @@ checksum = "01d70c6f872eb3f2635355ccbea944a4f9ea411c0aa25f6f1a15219e8da11ad2" dependencies = [ "array-bytes", "binary-merkle-tree", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-beefy", @@ -7874,7 +7832,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0566499e74ba4b7ccbd1b667eef0dab76ca28402a8d501e22b73a363717b05a9" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-treasury", @@ -7897,7 +7855,7 @@ dependencies = [ "bp-test-utils", "finality-grandpa", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -7917,7 +7875,7 @@ dependencies = [ "bp-messages", "bp-runtime", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "num-traits", @@ -7938,7 +7896,7 @@ dependencies = [ "bp-polkadot-core", "bp-runtime", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-bridge-grandpa", @@ -7959,7 +7917,7 @@ dependencies = [ "bp-relayers", "bp-runtime", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-bridge-messages", @@ -7978,7 +7936,7 @@ checksum = "cd0d652c399b6ed776ee3322e60f40e323f86b413719d7696eddb8f64c368ac0" dependencies = [ "bitvec", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -7997,7 +7955,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e351f103ebbdd1eb095da8c2379caccc82ebc59a740c2731693d2204286b83" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-bounties", @@ -8017,7 +7975,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f660cc09f2f277a3976da2eef856b5c725ab7ad1192902ef7f4e4bafd992f04f" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-authorship", @@ -8038,7 +7996,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771bf7f6c76c3ea5e965fee0bf1d8a8c79c8c52d75ead65ed3c4d385f333756f" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8057,7 +8015,7 @@ checksum = "9033f0d23500bbc39298fd50c07b89a2f2d9f07300139b4df8005995ef683875" dependencies = [ "assert_matches", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -8074,7 +8032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99f3caf5d750236fce5f59fa464a9ca5bbefedd97f2570caa96cf7bdd2ec5261" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-ranked-collective", @@ -8093,7 +8051,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0596ec5ab55e02b1b5637b3ec2b99027d036fe97a1ab4733ae105474dfa727cf" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -8110,7 +8068,7 @@ checksum = "bd1090fdc6ccdd8ff08c60000c970428baaaf0b33e7a6b01a91ec8b697a650a3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-election-provider-support-benchmarking", @@ -8150,7 +8108,7 @@ dependencies = [ "approx", "encointer-primitives", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-asset-tx-payment", @@ -8169,7 +8127,7 @@ checksum = "10d38c490fdd90b649b3ec68a8bb25d3cdfaa11223122482737114e00e29f8a5" dependencies = [ "encointer-primitives", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-encointer-communities", @@ -8186,7 +8144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdfc381df1d6346e244994d4a5729b79b60f964ba4c13e29ea2f057627e1db25" dependencies = [ "encointer-primitives", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "sp-api", "sp-std", @@ -8202,7 +8160,7 @@ dependencies = [ "encointer-meetup-validation", "encointer-primitives", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-encointer-balances", @@ -8225,7 +8183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c186e855a19f98ba75ef8d674e71533584620a3d7a8ff653631c391f7a4a9b79" dependencies = [ "encointer-primitives", - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "sp-api", "sp-std", @@ -8239,7 +8197,7 @@ checksum = "ffbd4cb15599fc47c662234cfdb2c1c63f39106c4099383d84c981fe5c40af0e" dependencies = [ "encointer-primitives", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-encointer-balances", @@ -8272,7 +8230,7 @@ dependencies = [ "approx", "encointer-primitives", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-encointer-communities", @@ -8293,7 +8251,7 @@ dependencies = [ "approx", "encointer-primitives", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-encointer-ceremonies", @@ -8315,7 +8273,7 @@ checksum = "cc3be9d4a09bd65fad4968354b320cd3cd1913950891293e00fbc879fc09b5d6" dependencies = [ "encointer-primitives", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -8335,7 +8293,7 @@ dependencies = [ "docify", "frame-benchmarking", "frame-election-provider-support", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8354,7 +8312,7 @@ checksum = "9947ef904cd7662b80f8dee58e03431ee409dacada26d394c34a7bb642d3eeea" dependencies = [ "blake2 0.10.6", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8373,7 +8331,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8244b686d5cae6a8af1557ed0f49db08f812f0e7942a8d2da554b4da8a69daf0" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-authorship", @@ -8398,7 +8356,7 @@ checksum = "4555795a3e0e3aa49ea432b7afecb9c71a7db8793a99c68bd8dd3a52a12571f3" dependencies = [ "enumflags2", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8415,7 +8373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa761292e95020304b58b50e5187f8bb82f557c8c2d013e3c96ab41d611873b0" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-authorship", @@ -8436,7 +8394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b183880ad5efae06afe6066e76f2bac5acf67f34b3cfab7352ceec46accf4b45" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -8453,7 +8411,7 @@ version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30555c1b6d76cca7266b639f127a055a4974f5a0796859933cbfebc9a75753a2" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "safe-mix", @@ -8469,7 +8427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34006cf047f47edbef33874cc64895918e2c5d7562795209068d5fb388c53a30" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8488,7 +8446,7 @@ checksum = "20e65a37881d1998546254a5e50a1f768b3f82deabe774e750f4ea95aba8030c" dependencies = [ "environmental", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8508,7 +8466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8ccec82827413f031689fef4c714fdb0213d58c7a6e208d33f5eab80483770" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8527,7 +8485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be58483d827602eb8353ecf36aed65c857f0974db5d27981831e5ebf853040bd" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8544,7 +8502,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dcaa330221f60feaf3b23d495cccc3bf2a3d6254c596b3c032273c2b46d4078" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-assets", @@ -8563,7 +8521,7 @@ checksum = "3e1cd476809de3840e19091a083d5a79178af1f108ad489706e1f9e04c8836a4" dependencies = [ "enumflags2", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8593,7 +8551,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e77cba0e15749c8de2be65efffa51e02bd051b4e6fcf23360d43c3b6a859187c" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -8609,7 +8567,7 @@ version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36f8c994eb7298a394b58f98afd520b521b5d46f6f39eade4657eeaac9962471" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-balances", @@ -8631,7 +8589,7 @@ checksum = "39ee599f2861e55fc6113c01e9b14d6e85fda46bac36a906b5dd5a951fa0455c" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-bags-list", "pallet-delegated-staking", @@ -8663,7 +8621,7 @@ version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4859e7bb2af46d2e0f137c2f777adf39f0e5d4d188226158d599f1cfcfb76b9e" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-balances", @@ -8683,7 +8641,7 @@ checksum = "4351b0edafcdf3240f0471c638b39d2c981bde9d17c0172536a0aa3b7c3097ef" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-babe", @@ -8707,7 +8665,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ac726abc5b1bcd6c8f783514b8e1a48be32c7d15e0b263e4bc28cc1e4e7763" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8725,7 +8683,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4e12680e176607815a78a0cd10a52af50790292cb950404f30a885e2a7229e9" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -8741,7 +8699,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "862ea8d386ed5737e859470c43cbfd9652c81398cad29e03ae7846c21aaee4c6" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -8761,7 +8719,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b24d4131bc79fee0b07550136ca6329faa84c1c3e76ae62a74aef6b1da0b95b4" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -8778,7 +8736,7 @@ checksum = "b2c906a9c4573eb58de4134ec7180bf12c6769df2b9859dae8adcbc5fce78add" dependencies = [ "assert_matches", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8797,7 +8755,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6246871441f85b32d67f70ef13726ac195b05f8e9297df7c46a95a397b8df42" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-ranked-collective", @@ -8818,7 +8776,7 @@ checksum = "b170d6aa191197d3f50b1193925546972ffc394376ead4d2739eb40909b73c85" dependencies = [ "docify", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8835,7 +8793,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c92b24c911c2cfa5351616edc7f2f93427ea6f4f95efdb13f0f5d51997939c3" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -8859,7 +8817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd02aaf5f10734670346677042ece94fae20dcd5436eafeb9b429d8d6d5b6385" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-session", "pallet-staking", @@ -8877,7 +8835,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66b60b1d726532317f9965bab4995aa49b73f9b7ca3b9a0f75d158bd84686c5f" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8897,7 +8855,7 @@ checksum = "fbebdb060417654f215fc6f03675e5f44cfc83837d9e523e1b8fd9a4a2e1bdc2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-authorship", @@ -8953,7 +8911,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e07f8626f4ff62ac79d6ad0bd01fab7645897ce35706ddb95fa084e75be9306d" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -8972,7 +8930,7 @@ checksum = "1bd2a8797c1bb3d3897b4f87a7716111da5eeb8561345277b6e6d70349ec8b35" dependencies = [ "docify", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -8989,7 +8947,7 @@ checksum = "ae789d344be857679b0b98b28a67c747119724847f81d704d3fd03ee13fb6841" dependencies = [ "docify", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -9008,7 +8966,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74fb6114223c8d967c3c2f21cbc845e8ea604ff7e21a8e59d119d5a9257ba886" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -9040,7 +8998,7 @@ checksum = "9c502615bb4fdd02856a131cb2a612ad40c26435ec938f65f11cae4ff230812b" dependencies = [ "docify", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "pallet-balances", @@ -9059,7 +9017,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a59e8599a8c19908e934645f845b5cb546cef1f08745319db7e5b9c24f9e0e4" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -9075,7 +9033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3238fe6ad00da6a137be115904c39cab97eb5c7f03da0bb1a20de1bef03f0c71" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -9092,7 +9050,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78f7f0f4fe5e1d851e85d81e5e73b6f929f0c35af786ce8be9c9e3363717c136" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -9108,7 +9066,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e4f27640279229eb73fde0cb06e98b799305e6b0bc724f4dfbef2001ab4ad00" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -9125,7 +9083,7 @@ checksum = "fe7409458b7fedc5c7d46459da154ccc2dc22a843ce08e8ab6c1743ef5cf972c" dependencies = [ "bounded-collections", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-balances", @@ -9149,7 +9107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f177a171203cc0bec3cff1bdd5d3b926abfbd0ecf347e044b147194e664f717" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -9172,7 +9130,7 @@ dependencies = [ "bp-runtime", "bp-xcm-bridge-hub", "bridge-runtime-common", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-bridge-messages", @@ -9194,7 +9152,7 @@ checksum = "f48bd38d4061a51f263f4c08021e66100e16cbda9978fba163d2544637b31dab" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -9214,7 +9172,7 @@ checksum = "9319e656eebdf161666e54a4d8e24f73137f702f01600247f7be650bc4d46167" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "pallet-asset-tx-payment", @@ -9249,7 +9207,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-balances", "pallet-collator-selection", @@ -9463,7 +9421,7 @@ version = "1.0.0" dependencies = [ "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "kusama-emulated-chain", "parachains-common", "penpal-runtime", @@ -9488,7 +9446,7 @@ dependencies = [ "cumulus-primitives-utility", "frame-benchmarking", "frame-executive", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -9541,7 +9499,7 @@ version = "1.0.0" dependencies = [ "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "kusama-emulated-chain", "parachains-common", "people-kusama-runtime", @@ -9555,7 +9513,7 @@ dependencies = [ "asset-test-utils", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "integration-tests-helpers", "kusama-runtime-constants", "kusama-system-emulated-network", @@ -9571,7 +9529,7 @@ dependencies = [ "staging-kusama-runtime", "staging-xcm", "staging-xcm-executor", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -9591,7 +9549,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -9641,7 +9599,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -9650,7 +9608,7 @@ version = "1.0.0" dependencies = [ "cumulus-primitives-core", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "parachains-common", "people-polkadot-runtime", "polkadot-emulated-chain", @@ -9664,7 +9622,7 @@ dependencies = [ "asset-test-utils", "cumulus-pallet-parachain-system", "emulated-integration-tests-common", - "frame-support 36.0.0", + "frame-support", "integration-tests-helpers", "pallet-balances", "pallet-identity", @@ -9680,7 +9638,7 @@ dependencies = [ "sp-runtime 38.0.0", "staging-xcm", "staging-xcm-executor", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -9699,7 +9657,7 @@ dependencies = [ "frame-benchmarking", "frame-executive", "frame-metadata-hash-extension", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -9748,7 +9706,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "system-parachains-constants", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -9980,7 +9938,7 @@ dependencies = [ "frame-executive", "frame-metadata-hash-extension", "frame-remote-externalities", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -10069,7 +10027,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "tokio", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -10081,7 +10039,7 @@ dependencies = [ "bitvec", "frame-benchmarking", "frame-election-provider-support", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "libsecp256k1", @@ -10128,7 +10086,7 @@ dependencies = [ name = "polkadot-runtime-constants" version = "1.0.0" dependencies = [ - "frame-support 36.0.0", + "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", @@ -10162,7 +10120,7 @@ dependencies = [ "bitvec", "derive_more", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -12801,7 +12759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0ad61e3ab1c48d4c8060c7ef8571c5b6007df26687e8dbfdb6c857d840cfd2c" dependencies = [ "byte-slice-cast", - "frame-support 36.0.0", + "frame-support", "hex", "parity-scale-codec", "rlp", @@ -12824,7 +12782,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668cd71582305168ed51cb0357a4b4ea814c68c7db3898a9ba4d492f712c54e1" dependencies = [ "ethabi-decode", - "frame-support 36.0.0", + "frame-support", "frame-system", "hex-literal", "parity-scale-codec", @@ -12895,7 +12853,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab6b34950a2abce198fe008ac6a199598053fedcbde2c40fedf981bc55f85dc7" dependencies = [ - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "snowbridge-core", "snowbridge-outbound-queue-merkle-tree", @@ -12910,7 +12868,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0040c2f5a66bcef85e125968af172200cd01d8558c8b3cb9c2e3f1b72abf7dc1" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "hex-literal", "log", @@ -12951,7 +12909,7 @@ dependencies = [ "alloy-primitives", "alloy-sol-types", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "hex-literal", "log", @@ -12993,7 +12951,7 @@ dependencies = [ "bridge-hub-common", "ethabi-decode", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -13014,7 +12972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f726d9d2bc15b2683995e6f6ae707d2db20085742860acd32d8fb246251681f2" dependencies = [ "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "frame-system", "log", "parity-scale-codec", @@ -13034,7 +12992,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e8e6707ced1308d763117bfe68f85e3f22fcdca7987b32e438c0485570f6ac7" dependencies = [ - "frame-support 36.0.0", + "frame-support", "hex-literal", "log", "parity-scale-codec", @@ -13054,7 +13012,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c033e7905056434638a068dca713ec9d15708af6c7590396fc95a216ec64b40b" dependencies = [ - "frame-support 36.0.0", + "frame-support", "log", "parity-scale-codec", "snowbridge-core", @@ -13072,7 +13030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bbae06a0abb1ba5ffad59b929263c68cc47b8a286794a7389e781eba20f3481" dependencies = [ "cumulus-pallet-parachain-system", - "frame-support 36.0.0", + "frame-support", "frame-system", "pallet-balances", "pallet-collator-selection", @@ -14287,7 +14245,7 @@ dependencies = [ "frame-executive", "frame-metadata-hash-extension", "frame-remote-externalities", - "frame-support 36.0.0", + "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", @@ -14377,7 +14335,7 @@ dependencies = [ "staging-xcm-executor", "substrate-wasm-builder", "tokio", - "xcm-fee-payment-runtime-api", + "xcm-runtime-apis", ] [[package]] @@ -14387,7 +14345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd00d586b0dac4f42736bdd0ad52213a891b240e011ea82b38938263dd821c25" dependencies = [ "cumulus-primitives-core", - "frame-support 36.0.0", + "frame-support", "frame-system", "parity-scale-codec", "scale-info", @@ -14420,7 +14378,7 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "847fa2afe1bed2751eaabf7b91fa4043037947f17653d7cc59ea202cc44c6bb8" dependencies = [ - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "log", @@ -14445,7 +14403,7 @@ checksum = "26b98d8219449eaf02e71a7edf1a14b14d4c713dd01d9df66fde1ce30dba4d6d" dependencies = [ "environmental", "frame-benchmarking", - "frame-support 36.0.0", + "frame-support", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -14884,7 +14842,7 @@ dependencies = [ name = "system-parachains-constants" version = "1.0.0" dependencies = [ - "frame-support 36.0.0", + "frame-support", "kusama-runtime-constants", "parachains-common", "polkadot-core-primitives", @@ -16585,7 +16543,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", - "frame-support 36.0.0", + "frame-support", "frame-system", "impl-trait-for-tuples", "lazy_static", @@ -16609,22 +16567,6 @@ dependencies = [ "staging-xcm-executor", ] -[[package]] -name = "xcm-fee-payment-runtime-api" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d4261279994b1cb0d16a77cc12734fca18b88b56b65b8740de543af6d6a17dc" -dependencies = [ - "frame-support 35.0.0", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-runtime 38.0.0", - "sp-std", - "sp-weights 31.0.0", - "staging-xcm", -] - [[package]] name = "xcm-procedural" version = "10.0.0" @@ -16643,7 +16585,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30fffcd9128a46abd836c37dd001c2cbe122aeb8904cd7b9bac8358564fb7b56" dependencies = [ - "frame-support 36.0.0", + "frame-support", "parity-scale-codec", "scale-info", "sp-api", diff --git a/Cargo.toml b/Cargo.toml index 10bc08acb7..1de17b2a65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -236,7 +236,7 @@ xcm = { version = "14.0.1", default-features = false, package = "staging-xcm" } xcm-builder = { version = "15.0.0", default-features = false, package = "staging-xcm-builder" } xcm-emulator = { version = "0.13.0" } xcm-executor = { version = "15.0.0", default-features = false, package = "staging-xcm-executor" } -xcm-fee-payment-runtime-api = { version = "0.4.0", default-features = false } +xcm-runtime-apis = { version = "0.2.0", default-features = false } anyhow = { version = "1.0.82" } subxt = { version = "0.35.0", default-features = false } tracing-subscriber = { version = "0.3.18" } diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml b/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml index e858c2ffe2..461c279945 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/Cargo.toml @@ -26,7 +26,7 @@ xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true } pallet-xcm = { workspace = true, default-features = true } polkadot-runtime-common = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus parachains-common = { workspace = true, default-features = true } diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs index 7202d45476..0ad9953be2 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs @@ -27,7 +27,7 @@ use frame_support::{ traits::fungibles::Inspect, }; use xcm::prelude::*; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml index 3b6420f7a6..f212448067 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/Cargo.toml @@ -25,7 +25,7 @@ polkadot-runtime-common = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus asset-test-utils = { workspace = true } diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs index 2dea54bc6f..50fe578dde 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs @@ -27,7 +27,7 @@ use frame_support::{ traits::fungibles::Inspect, }; use xcm::prelude::*; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml index 7076d34d39..2e017144eb 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/Cargo.toml @@ -25,7 +25,7 @@ pallet-message-queue = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus emulated-integration-tests-common = { workspace = true } diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs index 25b160fbf8..2d4a33ac9d 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/asset_transfers.rs @@ -16,7 +16,7 @@ use crate::tests::*; use bridge_hub_kusama_runtime::RuntimeEvent; use frame_support::{dispatch::RawOrigin, traits::fungible::Mutate}; -use xcm_fee_payment_runtime_api::dry_run::runtime_decl_for_dry_run_api::DryRunApiV1; +use xcm_runtime_apis::dry_run::runtime_decl_for_dry_run_api::DryRunApiV1; fn send_asset_from_asset_hub_kusama_to_asset_hub_polkadot(id: Location, amount: u128) { let destination = asset_hub_polkadot_location(); diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs index 58179e8c53..074244a418 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/teleport.rs @@ -21,7 +21,7 @@ use frame_support::{ use integration_tests_helpers::{ test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml index bb9ffdf9bb..34fe19ad15 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/Cargo.toml @@ -25,7 +25,7 @@ pallet-message-queue = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus emulated-integration-tests-common = { workspace = true } diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs index 07664c0d28..996e9f203b 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs @@ -21,7 +21,7 @@ use frame_support::{ use integration_tests_helpers::{ test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml b/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml index 6a9e80de9b..55c82668fb 100644 --- a/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/collectives/collectives-polkadot/Cargo.toml @@ -28,7 +28,7 @@ polkadot-runtime-common = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true, default-features = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus asset-test-utils = { workspace = true } diff --git a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs index d292fd195b..00daa0440a 100644 --- a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/teleport.rs @@ -22,7 +22,7 @@ use frame_support::{ use integration_tests_helpers::{ test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml b/integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml index 45acad6728..4bc905ff94 100644 --- a/integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml +++ b/integration-tests/emulated/tests/coretime/coretime-kusama/Cargo.toml @@ -22,7 +22,7 @@ polkadot-runtime-common = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus parachains-common = { workspace = true, default-features = true } diff --git a/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs index 0e36821279..b55b3c6469 100644 --- a/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/coretime/coretime-kusama/src/tests/teleport.rs @@ -20,7 +20,7 @@ use frame_support::{ use integration_tests_helpers::{ test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/integration-tests/emulated/tests/people/people-kusama/Cargo.toml b/integration-tests/emulated/tests/people/people-kusama/Cargo.toml index 140732df73..9de616880d 100644 --- a/integration-tests/emulated/tests/people/people-kusama/Cargo.toml +++ b/integration-tests/emulated/tests/people/people-kusama/Cargo.toml @@ -22,7 +22,7 @@ polkadot-runtime-common = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus parachains-common = { workspace = true, default-features = true } diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs index 33eb8d2bb8..25b0a187ae 100644 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/people/people-kusama/src/tests/teleport.rs @@ -21,7 +21,7 @@ use integration_tests_helpers::{ test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, }; use people_kusama_runtime::xcm_config::XcmConfig as PeopleKusamaXcmConfig; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml b/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml index de541e552b..7f614a85be 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml +++ b/integration-tests/emulated/tests/people/people-polkadot/Cargo.toml @@ -22,7 +22,7 @@ polkadot-runtime-common = { workspace = true, default-features = true } pallet-xcm = { workspace = true, default-features = true } xcm = { workspace = true, default-features = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true, default-features = true } +xcm-runtime-apis = { workspace = true, default-features = true } # Cumulus parachains-common = { workspace = true, default-features = true } diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs index 1904e53405..bcdd036b71 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/people/people-polkadot/src/tests/teleport.rs @@ -21,7 +21,7 @@ use integration_tests_helpers::{ test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, }; use people_polkadot_runtime::xcm_config::XcmConfig as PeoplePolkadotXcmConfig; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::runtime_decl_for_dry_run_api::DryRunApiV1, fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1, }; diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml index 85a7be8391..5a600a1d35 100644 --- a/relay/kusama/Cargo.toml +++ b/relay/kusama/Cargo.toml @@ -102,7 +102,7 @@ polkadot-primitives = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } xcm-builder = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } sp-debug-derive = { workspace = true } @@ -211,7 +211,7 @@ std = [ "substrate-wasm-builder", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] runtime-benchmarks = [ @@ -264,7 +264,7 @@ runtime-benchmarks = [ "sp-staking/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ "frame-election-provider-support/try-runtime", diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 2117b28124..0b6704edfd 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -106,7 +106,7 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use xcm::prelude::*; use xcm_builder::PayOverXcm; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -2256,7 +2256,7 @@ sp_api::impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::TokenLocation::get())]; XcmPallet::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -2269,11 +2269,11 @@ sp_api::impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -2288,7 +2288,7 @@ sp_api::impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { XcmPallet::dry_run_call::(origin, call) } diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index 11e6890f00..e906be77b5 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -100,7 +100,7 @@ polkadot-primitives = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } xcm-builder = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } sp-debug-derive = { workspace = true } @@ -208,7 +208,7 @@ std = [ "substrate-wasm-builder", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] runtime-benchmarks = [ @@ -259,7 +259,7 @@ runtime-benchmarks = [ "sp-staking/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ "frame-election-provider-support/try-runtime", diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index dbf1aecfe9..4fc780774e 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -104,7 +104,7 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use xcm::prelude::*; use xcm_builder::PayOverXcm; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -2332,7 +2332,7 @@ sp_api::impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::TokenLocation::get())]; XcmPallet::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -2345,11 +2345,11 @@ sp_api::impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -2364,7 +2364,7 @@ sp_api::impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { XcmPallet::dry_run_call::(origin, call) } diff --git a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml index 0031a57feb..341f0cbc86 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml @@ -82,7 +82,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -159,7 +159,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -275,7 +275,7 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index b49e9b620d..bbae7cb48f 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -92,7 +92,7 @@ use xcm_config::{ GovernanceLocation, KsmLocation, KsmLocationV3, PoolAssetsConvertedConcreteId, TrustBackedAssetsConvertedConcreteId, TrustBackedAssetsPalletLocationV3, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -1292,7 +1292,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::KsmLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -1305,11 +1305,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -1324,7 +1324,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index b8b4505163..1f207ce943 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -82,7 +82,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -147,7 +147,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -257,7 +257,7 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index 3f4935396e..a2b482c550 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -82,7 +82,7 @@ use sp_runtime::{ ApplyExtrinsicResult, Perbill, Permill, }; use xcm_config::TrustBackedAssetsPalletLocationV3; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -1253,7 +1253,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::DotLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -1266,11 +1266,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -1285,7 +1285,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml index ee9b6fbeb5..14ae435720 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -71,7 +71,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -222,7 +222,7 @@ std = [ "tuplex/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] @@ -266,7 +266,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index 246ed4c1f0..8f79c19a0c 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -93,7 +93,7 @@ use system_parachains_constants::{ // XCM Imports use xcm::prelude::*; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -745,7 +745,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::KsmRelayLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -758,11 +758,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -777,7 +777,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml index a583b57e09..e4fd5aa9e9 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -71,7 +71,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -218,7 +218,7 @@ std = [ "tuplex/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] @@ -261,7 +261,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 57e6e765f3..7daf3bccca 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -95,7 +95,7 @@ use system_parachains_constants::{ // XCM Imports use xcm::prelude::*; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -754,7 +754,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::DotRelayLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -767,11 +767,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -786,7 +786,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/collectives/collectives-polkadot/Cargo.toml b/system-parachains/collectives/collectives-polkadot/Cargo.toml index 4b76893052..247a4f9554 100644 --- a/system-parachains/collectives/collectives-polkadot/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/Cargo.toml @@ -69,7 +69,7 @@ polkadot-runtime-constants = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -127,7 +127,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -232,7 +232,7 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 63cbcfcd97..b1dbbaf0f4 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -103,7 +103,7 @@ pub use sp_runtime::BuildStorage; use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use xcm::prelude::*; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -957,7 +957,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::DotLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -970,11 +970,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -989,7 +989,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/coretime/coretime-kusama/Cargo.toml b/system-parachains/coretime/coretime-kusama/Cargo.toml index f48a8f0202..9214f46600 100644 --- a/system-parachains/coretime/coretime-kusama/Cargo.toml +++ b/system-parachains/coretime/coretime-kusama/Cargo.toml @@ -64,7 +64,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-pallet-aura-ext = { workspace = true } @@ -149,7 +149,7 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] @@ -179,7 +179,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/coretime/coretime-kusama/src/lib.rs b/system-parachains/coretime/coretime-kusama/src/lib.rs index afb02e23da..a2d90afdc2 100644 --- a/system-parachains/coretime/coretime-kusama/src/lib.rs +++ b/system-parachains/coretime/coretime-kusama/src/lib.rs @@ -79,7 +79,7 @@ use xcm_config::{ FellowshipLocation, GovernanceLocation, KsmRelayLocation, StakingPot, XcmOriginToTransactDispatchOrigin, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -803,7 +803,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::KsmRelayLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -816,11 +816,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -835,7 +835,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 78bd708acb..70777fe6fc 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -85,7 +85,7 @@ polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus dependencies cumulus-pallet-aura-ext = { workspace = true } @@ -148,7 +148,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] std = [ "codec/std", @@ -224,7 +224,7 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index e765483d4b..deabbcac22 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -109,7 +109,7 @@ use xcm::{ latest::prelude::{AssetId as XcmAssetId, BodyId}, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -925,7 +925,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![XcmAssetId(xcm_config::KsmLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -938,11 +938,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -957,7 +957,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/people/people-kusama/Cargo.toml b/system-parachains/people/people-kusama/Cargo.toml index 1fb1c20d8d..63cd39ec49 100644 --- a/system-parachains/people/people-kusama/Cargo.toml +++ b/system-parachains/people/people-kusama/Cargo.toml @@ -62,7 +62,7 @@ kusama-runtime-constants = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-primitives-aura = { workspace = true } @@ -146,7 +146,7 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] @@ -177,7 +177,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index 8935f0861b..15c9572745 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -81,7 +81,7 @@ use xcm_config::{ FellowshipLocation, GovernanceLocation, PriceForSiblingParachainDelivery, StakingPot, XcmConfig, XcmOriginToTransactDispatchOrigin, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -794,7 +794,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::RelayLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -807,11 +807,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -826,7 +826,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) } diff --git a/system-parachains/people/people-polkadot/Cargo.toml b/system-parachains/people/people-polkadot/Cargo.toml index 35303be6a6..8a12549f08 100644 --- a/system-parachains/people/people-polkadot/Cargo.toml +++ b/system-parachains/people/people-polkadot/Cargo.toml @@ -61,7 +61,7 @@ polkadot-runtime-constants = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } -xcm-fee-payment-runtime-api = { workspace = true } +xcm-runtime-apis = { workspace = true } # Cumulus cumulus-primitives-aura = { workspace = true } @@ -142,7 +142,7 @@ std = [ "system-parachains-constants/std", "xcm-builder/std", "xcm-executor/std", - "xcm-fee-payment-runtime-api/std", + "xcm-runtime-apis/std", "xcm/std", ] @@ -172,7 +172,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", - "xcm-fee-payment-runtime-api/runtime-benchmarks", + "xcm-runtime-apis/runtime-benchmarks", ] try-runtime = [ diff --git a/system-parachains/people/people-polkadot/src/lib.rs b/system-parachains/people/people-polkadot/src/lib.rs index 66028a71c4..eb900e6b88 100644 --- a/system-parachains/people/people-polkadot/src/lib.rs +++ b/system-parachains/people/people-polkadot/src/lib.rs @@ -76,7 +76,7 @@ use xcm_config::{ FellowshipLocation, GovernanceLocation, PriceForSiblingParachainDelivery, StakingPot, XcmConfig, XcmOriginToTransactDispatchOrigin, }; -use xcm_fee_payment_runtime_api::{ +use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, }; @@ -744,7 +744,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi for Runtime { + impl xcm_runtime_apis::fees::XcmPaymentApi for Runtime { fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result, XcmPaymentApiError> { let acceptable_assets = vec![AssetId(xcm_config::RelayLocation::get())]; PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets) @@ -757,11 +757,11 @@ impl_runtime_apis! { Ok(WeightToFee::weight_to_fee(&weight)) }, Ok(asset_id) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!"); Err(XcmPaymentApiError::AssetNotFound) }, Err(_) => { - log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); + log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!"); Err(XcmPaymentApiError::VersionedConversionFailed) } } @@ -776,7 +776,7 @@ impl_runtime_apis! { } } - impl xcm_fee_payment_runtime_api::dry_run::DryRunApi for Runtime { + impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call) }