diff --git a/.config/zepter.yaml b/.config/zepter.yaml index be52cd791d..1a7f36cffe 100644 --- a/.config/zepter.yaml +++ b/.config/zepter.yaml @@ -12,7 +12,7 @@ workflows: # Check that `A` activates the features of `B`. 'propagate-feature', # These are the features to check: - '--features=try-runtime,runtime-benchmarks,std,stable2503', + '--features=try-runtime,runtime-benchmarks,std,kusama-ahm,polkadot-ahm', # Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually. '--left-side-feature-missing=ignore', # Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on. diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index a9cd147f5f..a546a97d96 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -41,7 +41,9 @@ jobs: run: | cargo clippy --version cargo clippy --all-targets --locked --workspace --quiet - cargo clippy --all-targets --all-features --locked --workspace --quiet + cargo clippy --all-targets --locked --workspace --features try-runtime,runtime-benchmarks,std --quiet + cargo clippy --all-targets --locked --quiet --features try-runtime,runtime-benchmarks,std,kusama-ahm -p staging-kusama-runtime -p asset-hub-kusama-runtime + cargo clippy --all-targets --locked --quiet --features try-runtime,runtime-benchmarks,std,polkadot-ahm -p polkadot-runtime -p asset-hub-polkadot-runtime env: #RUSTFLAGS: "-D warnings" FAIL-CI re-enable after AHM SKIP_WASM_BUILD: 1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73acf66521..da8d5b87af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -185,21 +185,21 @@ jobs: shared-key: "fellowship-cache-integration-tests-ahm" save-if: ${{ github.ref == 'refs/heads/main' }} - - name: Download Paseo snaps + - name: Download Kusama snaps run: | python3 -m pip install gdown - gdown "1AoIyspAe4MzRTlxzQHWqeWNK-kGlWvP6" # 2025-07-29 - gdown "1yjY4fuzJjxSxzfRb8jESqDojfr8Eu2CV" # 2025-07-29 + gdown 12ndV-id_Z6ZTYx46ULI79XjGVDLiT1pH # 2025-09-02 + gdown 1ZUMCnf1crYxjLT6WiWAKRas-hQWtLVNE # 2025-09-02 - lz4 -d paseo.snap.lz4 paseo.snap - lz4 -d ah-paseo.snap.lz4 ah-paseo.snap + lz4 -d kusama.snap.lz4 kusama.snap + lz4 -d ah-kusama.snap.lz4 ah-kusama.snap - - name: Test Asset Hub Migration (Paseo) - run: cargo test --locked -q -p polkadot-integration-tests-ahm -r --features paseo --features try-runtime -- --nocapture --test-threads 1 + - name: Test Asset Hub Migration (Kusama) + run: cargo test --locked -q -p polkadot-integration-tests-ahm -r --features kusama-ahm --features try-runtime -- --nocapture --test-threads 1 env: RUST_BACKTRACE: 1 - SNAP_RC: "../../paseo.snap" - SNAP_AH: "../../ah-paseo.snap" + SNAP_RC: "../../kusama.snap" + SNAP_AH: "../../ah-kusama.snap" RUST_LOG: "warn" - name: Download Polkadot snaps @@ -211,7 +211,7 @@ jobs: lz4 -d ah-polkadot.snap.lz4 ah-polkadot.snap - name: Test Asset Hub Migration (Polkadot) - run: cargo test --locked -q -p polkadot-integration-tests-ahm -r --features try-runtime -- --nocapture --test-threads 1 + run: cargo test --locked -q -p polkadot-integration-tests-ahm -r --features polkadot-ahm --features try-runtime -- --nocapture --test-threads 1 env: RUST_BACKTRACE: 1 SNAP_RC: "../../polkadot.snap" @@ -219,7 +219,13 @@ jobs: RUST_LOG: "warn" - name: Test Benchmarks Asset Hub Migration (Polkadot) - run: cargo test --locked -q -p polkadot-integration-tests-ahm -r --features runtime-benchmarks -- bench_rc bench_ops bench_ah --nocapture + run: cargo test --locked -q -p polkadot-integration-tests-ahm -r --features polkadot-ahm --features runtime-benchmarks -- bench_rc bench_ops bench_ah --nocapture + env: + RUST_BACKTRACE: 1 + RUST_LOG: "warn" + + - name: Test Benchmarks Asset Hub Migration (Kusama) + run: cargo test --locked -q -p polkadot-integration-tests-ahm -r --features kusama-ahm --features runtime-benchmarks -- bench_rc bench_ops bench_ah --nocapture env: RUST_BACKTRACE: 1 RUST_LOG: "warn" diff --git a/CHANGELOG.md b/CHANGELOG.md index 2da57d8407..b91547619c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +t# Changelog Changelog for the runtimes governed by the Polkadot Fellowship. diff --git a/Cargo.lock b/Cargo.lock index 06265ad65b..69df2135e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -880,6 +880,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", "frame-benchmarking", + "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", @@ -890,30 +891,52 @@ dependencies = [ "hex-literal", "kusama-runtime-constants", "log", + "pallet-ah-migrator", + "pallet-ah-ops", "pallet-asset-conversion", "pallet-asset-conversion-tx-payment", + "pallet-asset-rate", "pallet-assets", "pallet-aura", "pallet-authorship", + "pallet-bags-list", "pallet-balances", + "pallet-bounties", + "pallet-child-bounties", "pallet-collator-selection", + "pallet-conviction-voting", + "pallet-delegated-staking", + "pallet-election-provider-multi-block", + "pallet-indices", "pallet-message-queue", "pallet-migrations", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", + "pallet-preimage", "pallet-proxy", + "pallet-rc-migrator", + "pallet-recovery", + "pallet-referenda", "pallet-remote-proxy", "pallet-revive", + "pallet-scheduler", "pallet-session", + "pallet-staking", + "pallet-staking-async", + "pallet-staking-async-rc-client", "pallet-state-trie-migration", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", "pallet-uniques", "pallet-utility", "pallet-vesting", + "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub-router", @@ -928,15 +951,18 @@ dependencies = [ "serde_json", "snowbridge-inbound-queue-primitives", "sp-api", + "sp-arithmetic", "sp-block-builder", "sp-consensus-aura", "sp-core 38.0.0", "sp-genesis-builder", "sp-inherents", "sp-io", + "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-session", + "sp-staking", "sp-storage", "sp-transaction-pool", "sp-version", @@ -8345,7 +8371,6 @@ name = "pallet-ah-migrator" version = "0.1.0" dependencies = [ "assets-common", - "collectives-polkadot-runtime-constants", "cumulus-primitives-core", "frame-benchmarking", "frame-election-provider-support", @@ -8370,6 +8395,7 @@ dependencies = [ "pallet-preimage", "pallet-proxy", "pallet-rc-migrator", + "pallet-recovery", "pallet-referenda", "pallet-scheduler", "pallet-staking", @@ -8383,7 +8409,6 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-runtime-common", - "polkadot-runtime-constants", "polkadot-runtime-parachains", "scale-info", "serde", @@ -9657,9 +9682,11 @@ dependencies = [ "pallet-indices", "pallet-message-queue", "pallet-multisig", + "pallet-nis", "pallet-nomination-pools", "pallet-preimage", "pallet-proxy", + "pallet-recovery", "pallet-referenda", "pallet-scheduler", "pallet-session", @@ -9673,7 +9700,6 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-runtime-common", - "polkadot-runtime-constants", "polkadot-runtime-parachains", "scale-info", "serde", @@ -10965,6 +10991,7 @@ dependencies = [ name = "polkadot-integration-tests-ahm" version = "0.1.0" dependencies = [ + "asset-hub-kusama-runtime", "asset-hub-polkadot-runtime", "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -10975,6 +11002,7 @@ dependencies = [ "frame-system", "hex", "hex-literal", + "kusama-runtime-constants", "log", "pallet-ah-migrator", "pallet-ah-ops", @@ -11011,6 +11039,7 @@ dependencies = [ "sp-runtime", "sp-storage", "sp-tracing 18.0.0", + "staging-kusama-runtime", "staging-xcm", "staging-xcm-builder", "tokio", @@ -15550,6 +15579,7 @@ dependencies = [ "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", + "pallet-rc-migrator", "pallet-recovery", "pallet-referenda", "pallet-scheduler", @@ -15557,6 +15587,8 @@ dependencies = [ "pallet-session-benchmarking", "pallet-society", "pallet-staking", + "pallet-staking-async-ah-client", + "pallet-staking-async-rc-client", "pallet-staking-runtime-api", "pallet-timestamp", "pallet-transaction-payment", diff --git a/Cargo.toml b/Cargo.toml index a00a603393..97ffc68771 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -276,10 +276,10 @@ ss58-registry = { version = "1.47.0" } resolver = "2" members = [ + "integration-tests/ahm", "pallets/ah-migrator", - "pallets/rc-migrator", "pallets/ah-ops", - "integration-tests/ahm", + "pallets/rc-migrator", "chain-spec-generator", "integration-tests/emulated/chains/parachains/assets/asset-hub-kusama", diff --git a/chain-spec-generator/Cargo.toml b/chain-spec-generator/Cargo.toml index df2f41d3b8..f8f01e9aa5 100644 --- a/chain-spec-generator/Cargo.toml +++ b/chain-spec-generator/Cargo.toml @@ -65,7 +65,11 @@ on-chain-release-build = [ ] polkadot = ["polkadot-runtime"] -kusama = ["kusama-runtime"] +kusama = [ + "asset-hub-kusama-runtime", + "kusama-runtime", + "kusama-runtime", +] asset-hub-polkadot = ["asset-hub-polkadot-runtime"] asset-hub-kusama = ["asset-hub-kusama-runtime"] collectives-polkadot = ["collectives-polkadot-runtime"] diff --git a/integration-tests/ahm/Cargo.toml b/integration-tests/ahm/Cargo.toml index e284328167..eac7b5b06e 100644 --- a/integration-tests/ahm/Cargo.toml +++ b/integration-tests/ahm/Cargo.toml @@ -1,15 +1,14 @@ [package] name = "polkadot-integration-tests-ahm" -version = "0.1.0" # Wont work in the SDK otherwise +version = "0.1.0" authors.workspace = true edition.workspace = true license = "Apache-2.0" description = "Polkadot integration tests for the Asset Hub Migration" publish = false -[dev-dependencies] +[dependencies] codec = { workspace = true, default-features = true } -asset-hub-polkadot-runtime = { workspace = true } authority-discovery-primitives = { workspace = true, default-features = true } babe-primitives = { workspace = true, default-features = true } beefy-primitives = { workspace = true, default-features = true } @@ -30,9 +29,7 @@ parachains-common = { workspace = true, default-features = true } pallet-multisig = { workspace = true, default-features = true } polkadot-parachain-primitives = { workspace = true, default-features = true } polkadot-primitives = { workspace = true, default-features = true } -polkadot-runtime = { workspace = true } polkadot-runtime-common = { workspace = true, default-features = true } -polkadot-runtime-constants = { workspace = true, default-features = true } remote-externalities = { workspace = true } runtime-parachains = { workspace = true, default-features = true } sp-core = { workspace = true, default-features = true } @@ -59,21 +56,46 @@ pallet-preimage = { workspace = true, default-features = true } pallet-staking-async = { workspace = true, default-features = true } pallet-referenda = { workspace = true, default-features = true } +polkadot-runtime = { workspace = true, optional = true } +polkadot-runtime-constants = { workspace = true, default-features = true, optional = true } +asset-hub-polkadot-runtime = { workspace = true, optional = true } + +kusama-runtime = { workspace = true, optional = true } +kusama-runtime-constants = { workspace = true, default-features = true, optional = true } +asset-hub-kusama-runtime = { workspace = true, optional = true } + [features] default = ["std"] +polkadot-ahm = [ + "asset-hub-polkadot-runtime", + "asset-hub-polkadot-runtime?/polkadot-ahm", + "polkadot-runtime", + "polkadot-runtime-constants", + "polkadot-runtime?/polkadot-ahm", +] +kusama-ahm = [ + "asset-hub-kusama-runtime/kusama-ahm", + "kusama-runtime-constants", + "kusama-runtime/kusama-ahm", + "pallet-ah-migrator/kusama-ahm", + "pallet-rc-migrator/kusama-ahm", +] std = [ "cumulus-pallet-parachain-system/std", "frame-benchmarking/std", "hex/std", + "kusama-runtime?/std", "log/std", - "polkadot-runtime/std", + "polkadot-runtime?/std", "rand/std", ] try-runtime = [ - "asset-hub-polkadot-runtime/try-runtime", + "asset-hub-kusama-runtime?/try-runtime", + "asset-hub-polkadot-runtime?/try-runtime", "cumulus-pallet-parachain-system/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", + "kusama-runtime?/try-runtime", "pallet-ah-migrator/try-runtime", "pallet-ah-ops/try-runtime", "pallet-balances/try-runtime", @@ -89,19 +111,22 @@ try-runtime = [ "pallet-timestamp/try-runtime", "pallet-whitelist/try-runtime", "pallet-xcm/try-runtime", + "parachains-common/try-runtime", "polkadot-runtime-common/try-runtime", - "polkadot-runtime/try-runtime", + "polkadot-runtime?/try-runtime", "runtime-parachains/try-runtime", "sp-runtime/try-runtime", - "parachains-common/try-runtime" ] runtime-benchmarks = [ - "asset-hub-polkadot-runtime/runtime-benchmarks", + "asset-hub-kusama-runtime?/runtime-benchmarks", + "asset-hub-polkadot-runtime?/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "kusama-runtime-constants?/runtime-benchmarks", + "kusama-runtime?/runtime-benchmarks", "pallet-ah-migrator/runtime-benchmarks", "pallet-ah-ops/runtime-benchmarks", "pallet-balances/runtime-benchmarks", @@ -121,11 +146,10 @@ runtime-benchmarks = [ "polkadot-parachain-primitives/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", - "polkadot-runtime-constants/runtime-benchmarks", - "polkadot-runtime/runtime-benchmarks", + "polkadot-runtime-constants?/runtime-benchmarks", + "polkadot-runtime?/runtime-benchmarks", "runtime-parachains/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm/runtime-benchmarks", ] -paseo = [] diff --git a/integration-tests/ahm/src/accounts_translation_works.rs b/integration-tests/ahm/src/accounts_translation_works.rs index 1caee9a163..a59db031d4 100644 --- a/integration-tests/ahm/src/accounts_translation_works.rs +++ b/integration-tests/ahm/src/accounts_translation_works.rs @@ -16,6 +16,8 @@ //! Test that account translation works (Para sovereign and derived). +use crate::porting_prelude::*; + use hex_literal::hex; use pallet_ah_migrator::types::AhMigrationCheck; use pallet_rc_migrator::{accounts::AccountState, types::RcMigrationCheck}; @@ -27,6 +29,7 @@ type AssetHubRuntime = asset_hub_polkadot_runtime::Runtime; pub struct AccountTranslationWorks; +#[cfg(not(feature = "kusama-ahm"))] pub const TRANSLATIONS: &[(AccountId32, AccountId32)] = &[ // para 2034: 5Ec4AhPbkXX97KXMcf9v9SkRNG4Gyc3VhcMMuQe9QXfAHnrC -> // 5Eg2fntQqFi3EvFWAf71G66Ecjjah26bmFzoANAeHFgj9Lia @@ -36,6 +39,9 @@ pub const TRANSLATIONS: &[(AccountId32, AccountId32)] = &[ ), ]; +#[cfg(feature = "kusama-ahm")] +pub const TRANSLATIONS: &[(AccountId32, AccountId32)] = &[]; + impl RcMigrationCheck for AccountTranslationWorks { type RcPrePayload = (); diff --git a/integration-tests/ahm/src/balances_test.rs b/integration-tests/ahm/src/balances_test.rs index 5ee21e8df3..efcba58c4d 100644 --- a/integration-tests/ahm/src/balances_test.rs +++ b/integration-tests/ahm/src/balances_test.rs @@ -26,6 +26,7 @@ //! types directly. use crate::porting_prelude::*; + use frame_support::{defensive_assert, traits::Currency}; use pallet_ah_migrator::types::AhMigrationCheck; use pallet_rc_migrator::types::RcMigrationCheck; diff --git a/integration-tests/ahm/src/bench_ah.rs b/integration-tests/ahm/src/bench_ah.rs index 97a45e9fdf..30b1b40dbc 100644 --- a/integration-tests/ahm/src/bench_ah.rs +++ b/integration-tests/ahm/src/bench_ah.rs @@ -18,6 +18,8 @@ #![cfg(feature = "runtime-benchmarks")] +use crate::porting_prelude::*; + use asset_hub_polkadot_runtime::{Runtime as AssetHub, System as AssetHubSystem}; use pallet_ah_migrator::benchmarking::*; use sp_runtime::BuildStorage; diff --git a/integration-tests/ahm/src/bench_ops.rs b/integration-tests/ahm/src/bench_ops.rs index 171cbe87c4..944a3355de 100644 --- a/integration-tests/ahm/src/bench_ops.rs +++ b/integration-tests/ahm/src/bench_ops.rs @@ -18,6 +18,8 @@ #![cfg(feature = "runtime-benchmarks")] +use crate::porting_prelude::*; + use asset_hub_polkadot_runtime::{Runtime as AssetHub, System as AssetHubSystem}; use pallet_ah_ops::benchmarking::*; use sp_runtime::BuildStorage; diff --git a/integration-tests/ahm/src/bench_rc.rs b/integration-tests/ahm/src/bench_rc.rs index 876aeac1c9..e65c7837a7 100644 --- a/integration-tests/ahm/src/bench_rc.rs +++ b/integration-tests/ahm/src/bench_rc.rs @@ -18,6 +18,8 @@ #![cfg(feature = "runtime-benchmarks")] +use crate::porting_prelude::*; + use pallet_rc_migrator::benchmarking::*; use polkadot_runtime::{Runtime as RelayChain, System as RcSystem}; use sp_runtime::BuildStorage; diff --git a/integration-tests/ahm/src/call_filter_asset_hub.rs b/integration-tests/ahm/src/call_filter_asset_hub.rs index 4b3826022d..ab1f05eccd 100644 --- a/integration-tests/ahm/src/call_filter_asset_hub.rs +++ b/integration-tests/ahm/src/call_filter_asset_hub.rs @@ -16,6 +16,8 @@ //! Asset Hub Migration tests. +use crate::porting_prelude::*; + use asset_hub_polkadot_runtime::{BuildStorage, Runtime as T, RuntimeCall, RuntimeOrigin}; use cumulus_primitives_core::AggregateMessageOrigin; use frame_support::{sp_runtime::traits::Dispatchable, traits::Contains}; diff --git a/integration-tests/ahm/src/call_filter_relay.rs b/integration-tests/ahm/src/call_filter_relay.rs index 5d3e5a465e..628363f7c7 100644 --- a/integration-tests/ahm/src/call_filter_relay.rs +++ b/integration-tests/ahm/src/call_filter_relay.rs @@ -16,6 +16,8 @@ //! Asset Hub Migration tests. +use crate::porting_prelude::*; + use frame_support::{sp_runtime::traits::Dispatchable, traits::Contains}; use pallet_rc_migrator::*; use polkadot_primitives::Id as ParaId; diff --git a/integration-tests/ahm/src/checks.rs b/integration-tests/ahm/src/checks.rs index 450664e1e1..9f1d0f9bbe 100644 --- a/integration-tests/ahm/src/checks.rs +++ b/integration-tests/ahm/src/checks.rs @@ -22,7 +22,10 @@ use pallet_ah_migrator::types::AhMigrationCheck; use pallet_rc_migrator::types::RcMigrationCheck; #[cfg(feature = "try-runtime")] -use frame_support::{defensive_assert, traits::{TryDecodeEntireStorage, TryDecodeEntireStorageError, TryState}}; +use frame_support::{ + defensive_assert, + traits::{TryDecodeEntireStorage, TryDecodeEntireStorageError, TryState}, +}; pub struct SanityChecks; diff --git a/integration-tests/ahm/src/lib.rs b/integration-tests/ahm/src/lib.rs index ca07425a7a..e2a983504c 100644 --- a/integration-tests/ahm/src/lib.rs +++ b/integration-tests/ahm/src/lib.rs @@ -16,7 +16,7 @@ //! Helper imports to make it easy to run the AHM integration tests for different runtimes. -#![cfg(test)] +#![cfg(all(test, any(feature = "polkadot-ahm", feature = "kusama-ahm")))] pub mod accounts_translation_works; pub mod balances_test; @@ -36,21 +36,48 @@ pub mod xcm_route; /// Imports for the AHM tests that can be reused for other chains. pub mod porting_prelude { - // For Kusama, we will add a feature here. For now it is just a stub. + #[cfg(feature = "polkadot-ahm")] pub mod import_alias { pub use polkadot_runtime_constants::DOLLARS as RC_DOLLARS; } + #[cfg(feature = "kusama-ahm")] + pub mod import_alias { + pub use asset_hub_kusama_runtime as asset_hub_polkadot_runtime; + pub use kusama_runtime as polkadot_runtime; + pub use kusama_runtime_constants as polkadot_runtime_constants; + + pub use kusama_runtime_constants::currency::UNITS as RC_DOLLARS; + } + #[cfg(any(feature = "polkadot-ahm", feature = "kusama-ahm"))] pub use import_alias::*; // Convenience aliases: + #[cfg(feature = "polkadot-ahm")] pub use asset_hub_polkadot_runtime::{ Runtime as AhRuntime, RuntimeCall as AhRuntimeCall, RuntimeEvent as AhRuntimeEvent, RuntimeOrigin as AhRuntimeOrigin, }; + #[cfg(feature = "polkadot-ahm")] pub use polkadot_runtime::{ Runtime as RcRuntime, RuntimeCall as RcRuntimeCall, RuntimeEvent as RcRuntimeEvent, RuntimeOrigin as RcRuntimeOrigin, }; + #[cfg(feature = "polkadot-ahm")] pub use polkadot_runtime_constants::proxy as rc_proxy_definition; + + // Convenience aliases: + #[cfg(feature = "kusama-ahm")] + pub use asset_hub_kusama_runtime::{ + Runtime as AhRuntime, RuntimeCall as AhRuntimeCall, RuntimeEvent as AhRuntimeEvent, + RuntimeOrigin as AhRuntimeOrigin, + }; + #[cfg(feature = "kusama-ahm")] + pub use kusama_runtime::{ + Runtime as RcRuntime, RuntimeCall as RcRuntimeCall, RuntimeEvent as RcRuntimeEvent, + RuntimeOrigin as RcRuntimeOrigin, + }; + + #[cfg(feature = "kusama-ahm")] + pub use kusama_runtime_constants::proxy as rc_proxy_definition; } diff --git a/integration-tests/ahm/src/mock.rs b/integration-tests/ahm/src/mock.rs index 7bd9bcfbd3..6a6903feeb 100644 --- a/integration-tests/ahm/src/mock.rs +++ b/integration-tests/ahm/src/mock.rs @@ -14,13 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +use crate::porting_prelude::*; + use asset_hub_polkadot_runtime::{AhMigrator, Runtime as AssetHub, RuntimeEvent as AhRuntimeEvent}; use codec::Decode; use cumulus_primitives_core::{ AggregateMessageOrigin as ParachainMessageOrigin, InboundDownwardMessage, ParaId, }; -use frame_support::traits::QueueFootprintQuery; -use frame_support::traits::{EnqueueMessage, OnFinalize, OnInitialize}; +use frame_support::traits::{EnqueueMessage, OnFinalize, OnInitialize, QueueFootprintQuery}; use frame_system::pallet_prelude::BlockNumberFor; use pallet_rc_migrator::{ MigrationStage as RcMigrationStage, MigrationStageOf as RcMigrationStageOf, diff --git a/integration-tests/ahm/src/multisig_still_work.rs b/integration-tests/ahm/src/multisig_still_work.rs index 925df77bb6..5c913148e5 100644 --- a/integration-tests/ahm/src/multisig_still_work.rs +++ b/integration-tests/ahm/src/multisig_still_work.rs @@ -16,11 +16,12 @@ //! Test that Multisig Account IDs result in the same IDs and they can still dispatch calls. +use crate::porting_prelude::*; + use frame_support::{dispatch::GetDispatchInfo, pallet_prelude::Weight, traits::Currency}; use pallet_ah_migrator::types::AhMigrationCheck; use pallet_rc_migrator::types::RcMigrationCheck; -use rand::{Rng}; -use rand::seq::IteratorRandom; +use rand::{seq::IteratorRandom, Rng}; use sp_core::Get; use sp_runtime::{traits::StaticLookup, AccountId32}; @@ -75,6 +76,7 @@ impl RcMigrationCheck for MultisigStillWork { multisigs.push(multisig.clone()); } + // TODO: @ggwpez supposed to be error? errors for Kusama log::error!("multisigs num: {:?}", multisigs.len()); multisigs } diff --git a/integration-tests/ahm/src/multisig_test.rs b/integration-tests/ahm/src/multisig_test.rs index ad823a00e0..7c1232464a 100644 --- a/integration-tests/ahm/src/multisig_test.rs +++ b/integration-tests/ahm/src/multisig_test.rs @@ -26,6 +26,7 @@ //! types directly. use crate::porting_prelude::*; + use frame_support::{pallet_prelude::*, traits::Currency}; use pallet_ah_migrator::types::AhMigrationCheck; use pallet_rc_migrator::types::RcMigrationCheck; diff --git a/integration-tests/ahm/src/proxy/basic_still_works.rs b/integration-tests/ahm/src/proxy/basic_still_works.rs index 577094ad99..14b28ae153 100644 --- a/integration-tests/ahm/src/proxy/basic_still_works.rs +++ b/integration-tests/ahm/src/proxy/basic_still_works.rs @@ -23,8 +23,9 @@ //! yet, they are here. This test is also very simple, it is not generic and just uses the Runtime //! types directly. -use super::Permission; +use crate::porting_prelude::*; +use super::Permission; use frame_support::{ pallet_prelude::*, traits::{schedule::DispatchTime, Currency, StorePreimage}, @@ -102,7 +103,7 @@ impl RcMigrationCheck for ProxyBasicWorks { impl AhMigrationCheck for ProxyBasicWorks { type RcPrePayload = PureProxies; - type AhPrePayload = (); + type AhPrePayload = PureProxies; fn pre_check(_: Self::RcPrePayload) -> Self::AhPrePayload { // Not empty in this case @@ -110,10 +111,40 @@ impl AhMigrationCheck for ProxyBasicWorks { pallet_proxy::Proxies::::iter().next().is_some(), "Assert storage 'Proxy::Proxies::ah_pre::empty'" ); + + let mut pre_payload = BTreeMap::new(); + + for (delegator, (proxies, _deposit)) in pallet_proxy::Proxies::::iter() { + for proxy in proxies.into_iter() { + let inner = proxy.proxy_type; + + let permission = match Permission::try_convert(inner) { + Ok(permission) => permission, + Err(e) => { + defensive!("Proxy could not be converted: {:?}", e); + continue; + }, + }; + pre_payload + .entry((proxy.delegate, delegator.clone())) + .or_insert_with(Vec::new) + .push(permission); + } + } + + pre_payload } - fn post_check(rc_pre_payload: Self::RcPrePayload, _: Self::AhPrePayload) { - for ((delegatee, delegator), permissions) in rc_pre_payload.iter() { + fn post_check(rc_pre_payload: Self::RcPrePayload, ah_pre_payload: Self::AhPrePayload) { + let mut pre_and_post = rc_pre_payload; + for ((delegatee, delegator), permissions) in ah_pre_payload.iter() { + pre_and_post + .entry((delegatee.clone(), delegator.clone())) + .or_insert_with(Vec::new) + .extend(permissions.clone()); + } + + for ((delegatee, delegator), permissions) in pre_and_post.iter() { // Assert storage "Proxy::Proxies::ah_post::correct" let (entry, _) = pallet_proxy::Proxies::::get(delegator); if entry.is_empty() { @@ -169,9 +200,15 @@ impl ProxyBasicWorks { let allowed_transfer = permissions.contains(&Permission::Any); if allowed_transfer { - assert!(Self::can_transfer(delegatee, delegator, true), "`Any` can transfer"); + assert!( + Self::can_transfer(delegatee, delegator, permissions, true), + "`Any` can transfer" + ); } else { - assert!(!Self::can_transfer(delegatee, delegator, false), "Only `Any` can transfer"); + assert!( + !Self::can_transfer(delegatee, delegator, permissions, false), + "Only `Any` can transfer" + ); } let allowed_governance = permissions.contains(&Permission::Any) || @@ -179,12 +216,12 @@ impl ProxyBasicWorks { permissions.contains(&Permission::Governance); if allowed_governance { assert!( - Self::can_governance(delegatee, delegator, true), + Self::can_governance(delegatee, delegator, permissions, true), "`Any`, `NonTransfer`, or `Governance` can do governance" ); } else { assert!( - !Self::can_governance(delegatee, delegator, false), + !Self::can_governance(delegatee, delegator, permissions, false), "Only `Any`, `NonTransfer`, or `Governance` can do governance, permissions: {permissions:?}" ); } @@ -193,21 +230,54 @@ impl ProxyBasicWorks { permissions.contains(&Permission::NonTransfer) || permissions.contains(&Permission::Staking); if allowed_staking { - assert!(Self::can_stake(delegatee, delegator), "`Any` or `Staking` can stake"); + assert!( + Self::can_stake(delegatee, delegator, permissions, true), + "`Any` or `Staking` can stake" + ); } else { - assert!(!Self::can_stake(delegatee, delegator), "Only `Any` or `Staking` can stake"); + assert!( + !Self::can_stake(delegatee, delegator, permissions, false), + "Only `Any` or `Staking` can stake" + ); } // Alice cannot transfer - assert!(!Self::can_transfer(&alice, delegator, false), "Alice cannot transfer"); + assert!(!Self::can_transfer_impl(&alice, delegator, None, false), "Alice cannot transfer"); // Alice cannot do governance - assert!(!Self::can_governance(&alice, delegator, false), "Alice cannot do governance"); + assert!( + !Self::can_governance_impl(&alice, delegator, None, false), + "Alice cannot do governance" + ); // Alice cannot stake - assert!(!Self::can_stake(&alice, delegator), "Alice cannot stake"); + assert!(!Self::can_stake_impl(&alice, delegator, None, false), "Alice cannot stake"); } /// Check that the `delegatee` can transfer balances on behalf of the `delegator`. - fn can_transfer(delegatee: &AccountId32, delegator: &AccountId32, hint: bool) -> bool { + fn can_transfer( + delegatee: &AccountId32, + delegator: &AccountId32, + permissions: &Vec, + hint: bool, + ) -> bool { + let mut force_types = permissions + .iter() + .map(|p| Permission::try_convert(p.clone()).ok()) + .collect::>(); + // Also always check without a force type + force_types.push(None); + + force_types + .into_iter() + .map(|p| Self::can_transfer_impl(delegatee, delegator, p, hint)) + .any(|r| r) + } + + fn can_transfer_impl( + delegatee: &AccountId32, + delegator: &AccountId32, + force_proxy_type: Option, + hint: bool, + ) -> bool { frame_support::hypothetically!({ let ed = Self::fund_accounts(delegatee, delegator); @@ -220,7 +290,7 @@ impl ProxyBasicWorks { let proxy_call: asset_hub_polkadot_runtime::RuntimeCall = pallet_proxy::Call::proxy { real: delegator.clone().into(), - force_proxy_type: None, + force_proxy_type, call: Box::new(transfer), } .into(); @@ -244,7 +314,31 @@ impl ProxyBasicWorks { /// Check that the `delegatee` can do governance on behalf of the `delegator`. /// /// Currently only checks the `bounties::propose_bounty` call. - fn can_governance(delegatee: &AccountId32, delegator: &AccountId32, hint: bool) -> bool { + fn can_governance( + delegatee: &AccountId32, + delegator: &AccountId32, + permissions: &Vec, + hint: bool, + ) -> bool { + let mut force_types = permissions + .iter() + .map(|p| Permission::try_convert(p.clone()).ok()) + .collect::>(); + // Also always check without a force type + force_types.push(None); + + force_types + .into_iter() + .map(|p| Self::can_governance_impl(delegatee, delegator, p, hint)) + .any(|r| r) + } + + fn can_governance_impl( + delegatee: &AccountId32, + delegator: &AccountId32, + force_proxy_type: Option, + hint: bool, + ) -> bool { frame_support::hypothetically!({ Self::fund_accounts(delegatee, delegator); @@ -263,7 +357,7 @@ impl ProxyBasicWorks { let proxy_call: asset_hub_polkadot_runtime::RuntimeCall = pallet_proxy::Call::proxy { real: delegator.clone().into(), - force_proxy_type: None, + force_proxy_type, call: Box::new(call), } .into(); @@ -288,7 +382,31 @@ impl ProxyBasicWorks { /// Check that the `delegatee` can do staking on behalf of the `delegator`. /// /// Uses the `bond` call - fn can_stake(delegatee: &AccountId32, delegator: &AccountId32) -> bool { + fn can_stake( + delegatee: &AccountId32, + delegator: &AccountId32, + permissions: &Vec, + hint: bool, + ) -> bool { + let mut force_types = permissions + .iter() + .map(|p| Permission::try_convert(p.clone()).ok()) + .collect::>(); + // Also always check without a force type + force_types.push(None); + + force_types + .into_iter() + .map(|p| Self::can_stake_impl(delegatee, delegator, p, hint)) + .any(|r| r) + } + + fn can_stake_impl( + delegatee: &AccountId32, + delegator: &AccountId32, + force_proxy_type: Option, + hint: bool, + ) -> bool { frame_support::hypothetically!({ // Migration should have finished assert!( @@ -298,29 +416,26 @@ impl ProxyBasicWorks { ); Self::fund_accounts(delegatee, delegator); + let hint = if hint { " (it should)" } else { " (it should not)" }; + log::debug!( + "Checking whether {:?} can stake on behalf of {:?}{}", + delegatee.to_polkadot_ss58(), + delegator.to_polkadot_ss58(), + hint + ); + let call: asset_hub_polkadot_runtime::RuntimeCall = pallet_staking_async::Call::set_payee { payee: RewardDestination::Staked }.into(); - // The proxy pallet is stupid and does not work when there are multiple delegations for - // the same account. So we need to force and try which it is... - frame_system::Pallet::::reset_events(); - for force_proxy_type in [ - None, - Some(asset_hub_polkadot_runtime::ProxyType::Staking), - Some(asset_hub_polkadot_runtime::ProxyType::Any), - Some(asset_hub_polkadot_runtime::ProxyType::NonTransfer), - ] { - let proxy_call: asset_hub_polkadot_runtime::RuntimeCall = - pallet_proxy::Call::proxy { - real: delegator.clone().into(), - force_proxy_type, - call: Box::new(call.clone()), - } - .into(); - - let _ = proxy_call - .dispatch(asset_hub_polkadot_runtime::RuntimeOrigin::signed(delegatee.clone())); + let proxy_call: asset_hub_polkadot_runtime::RuntimeCall = pallet_proxy::Call::proxy { + real: delegator.clone().into(), + force_proxy_type, + call: Box::new(call.clone()), } + .into(); + + let _ = proxy_call + .dispatch(asset_hub_polkadot_runtime::RuntimeOrigin::signed(delegatee.clone())); Self::find_proxy_executed_event() }) diff --git a/integration-tests/ahm/src/proxy/mod.rs b/integration-tests/ahm/src/proxy/mod.rs index 75b2c3594a..3532b01886 100644 --- a/integration-tests/ahm/src/proxy/mod.rs +++ b/integration-tests/ahm/src/proxy/mod.rs @@ -43,6 +43,10 @@ pub enum Permission { AssetManager, Collator, Old, + #[cfg(feature = "kusama-ahm")] + Society, + #[cfg(feature = "kusama-ahm")] + Spokesperson, } // Relay -> Permission @@ -61,6 +65,10 @@ impl TryConvert for Permission { ProxyType::NonTransfer => Permission::NonTransfer, ProxyType::ParaRegistration => Permission::ParaRegistration, ProxyType::Staking => Permission::Staking, + #[cfg(feature = "kusama-ahm")] + ProxyType::Society => Permission::Society, + #[cfg(feature = "kusama-ahm")] + ProxyType::Spokesperson => Permission::Spokesperson, }) } } @@ -85,6 +93,39 @@ impl TryConvert for Permissio ProxyType::Auction => Permission::Old, ProxyType::ParaRegistration => Permission::Old, ProxyType::Staking => Permission::Staking, + #[cfg(feature = "kusama-ahm")] + ProxyType::Society => Permission::Society, + #[cfg(feature = "kusama-ahm")] + ProxyType::Spokesperson => Permission::Spokesperson, + }) + } +} + +// Permission -> Maybe(AH) +impl TryConvert for Permission { + fn try_convert( + permission: Permission, + ) -> Result { + use asset_hub_polkadot_runtime::ProxyType; + + Ok(match permission { + Permission::Any => ProxyType::Any, + Permission::NonTransfer => ProxyType::NonTransfer, + Permission::Governance => ProxyType::Governance, + Permission::Staking => ProxyType::Staking, + Permission::CancelProxy => ProxyType::CancelProxy, + Permission::Auction => ProxyType::Auction, + Permission::NominationPools => ProxyType::NominationPools, + Permission::ParaRegistration => ProxyType::ParaRegistration, + Permission::Assets => ProxyType::Assets, + Permission::AssetOwner => ProxyType::AssetOwner, + Permission::AssetManager => ProxyType::AssetManager, + Permission::Collator => ProxyType::Collator, + Permission::Old => return Err(permission), + #[cfg(feature = "kusama-ahm")] + Permission::Society => ProxyType::Society, + #[cfg(feature = "kusama-ahm")] + Permission::Spokesperson => ProxyType::Spokesperson, }) } } diff --git a/integration-tests/ahm/src/proxy/whale_watching.rs b/integration-tests/ahm/src/proxy/whale_watching.rs index ee51dbb262..3cd36c07ab 100644 --- a/integration-tests/ahm/src/proxy/whale_watching.rs +++ b/integration-tests/ahm/src/proxy/whale_watching.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +use crate::porting_prelude::*; + use crate::proxy::{Permission, ProxyBasicWorks}; use hex_literal::hex; use pallet_ah_migrator::types::AhMigrationCheck; diff --git a/integration-tests/ahm/src/queues_priority.rs b/integration-tests/ahm/src/queues_priority.rs index e949c885ec..e856b25760 100644 --- a/integration-tests/ahm/src/queues_priority.rs +++ b/integration-tests/ahm/src/queues_priority.rs @@ -15,6 +15,7 @@ // along with Polkadot. If not, see . use crate::porting_prelude::*; + use asset_hub_polkadot_runtime::{AhMigrator, BuildStorage}; use frame_support::{ traits::{DefensiveTruncateFrom, OnFinalize}, diff --git a/integration-tests/ahm/src/tests.rs b/integration-tests/ahm/src/tests.rs index 8fffd225f9..0144f38b3b 100644 --- a/integration-tests/ahm/src/tests.rs +++ b/integration-tests/ahm/src/tests.rs @@ -34,8 +34,6 @@ use crate::porting_prelude::*; -#[cfg(not(feature = "paseo"))] -use super::proxy::ProxyWhaleWatching; use super::{ accounts_translation_works::AccountTranslationWorks, balances_test::BalancesCrossChecker, @@ -43,11 +41,13 @@ use super::{ mock::*, multisig_still_work::MultisigStillWork, multisig_test::MultisigsAccountIdStaysTheSame, - proxy::ProxyBasicWorks, + proxy::{ProxyBasicWorks, ProxyWhaleWatching}, }; use asset_hub_polkadot_runtime::Runtime as AssetHub; use cumulus_pallet_parachain_system::PendingUpwardMessages; -use cumulus_primitives_core::{InboundDownwardMessage, Junction, Location, ParaId}; +use cumulus_primitives_core::{ + InboundDownwardMessage, Junction, Location, ParaId, UpwardMessageSender, +}; use frame_support::{ hypothetically, hypothetically_ok, traits::{ @@ -73,7 +73,7 @@ use polkadot_runtime::{RcMigrator, Runtime as Polkadot}; use polkadot_runtime_common::slots as pallet_slots; use rand::Rng; use runtime_parachains::dmp::DownwardMessageQueues; -use sp_core::{crypto::Ss58Codec, ByteArray}; +use sp_core::{crypto::Ss58Codec, ByteArray, Get}; use sp_io::TestExternalities; use sp_runtime::{traits::Dispatchable, AccountId32, BuildStorage, DispatchError, TokenError}; use std::{ @@ -102,6 +102,8 @@ type RcChecks = ( BalancesCrossChecker, RcRuntimeSpecificChecks, // other checks go here (if available on Polkadot, Kusama and Westend) + + // TODO: does not work for Kusama; calls are filtered for some reason ProxyBasicWorks, MultisigStillWork, AccountTranslationWorks, @@ -109,8 +111,8 @@ type RcChecks = ( EntireStateDecodes, ); -// Checks that are specific to Polkadot, and not available on other chains (like Paseo) -#[cfg(not(feature = "paseo"))] +// Checks that are specific to Polkadot, and not available on other chains +#[cfg(feature = "polkadot-ahm")] pub type RcRuntimeSpecificChecks = ( MultisigsAccountIdStaysTheSame, pallet_rc_migrator::multisig::MultisigMigrationChecker, @@ -123,8 +125,8 @@ pub type RcRuntimeSpecificChecks = ( ChildBountiesMigratedCorrectly, ); -// Checks that are specific to Paseo. -#[cfg(feature = "paseo")] +// Checks that are specific to Kusama. +#[cfg(feature = "kusama-ahm")] pub type RcRuntimeSpecificChecks = ( MultisigsAccountIdStaysTheSame, pallet_rc_migrator::multisig::MultisigMigrationChecker, @@ -156,6 +158,8 @@ type AhChecks = ( BalancesCrossChecker, AhRuntimeSpecificChecks, // other checks go here (if available on Polkadot, Kusama and Westend) + + // TODO: does not work for Kusama; calls are filtered for some reason ProxyBasicWorks, MultisigStillWork, AccountTranslationWorks, @@ -163,7 +167,7 @@ type AhChecks = ( EntireStateDecodes, ); -#[cfg(not(feature = "paseo"))] +#[cfg(feature = "polkadot-ahm")] pub type AhRuntimeSpecificChecks = ( MultisigsAccountIdStaysTheSame, pallet_rc_migrator::multisig::MultisigMigrationChecker, @@ -176,7 +180,7 @@ pub type AhRuntimeSpecificChecks = ( ChildBountiesMigratedCorrectly, ); -#[cfg(feature = "paseo")] +#[cfg(feature = "kusama-ahm")] pub type AhRuntimeSpecificChecks = ( MultisigsAccountIdStaysTheSame, pallet_rc_migrator::multisig::MultisigMigrationChecker, @@ -238,6 +242,7 @@ fn run_check(f: impl FnOnce() -> R, ext: &mut TestExternalities) -> Option } } +#[cfg(feature = "polkadot-ahm")] // TODO @ggwpez #[tokio::test] async fn num_leases_to_ending_block_works_simple() { let mut rc = remote_ext_test_setup(Chain::Relay).await.unwrap(); @@ -747,6 +752,7 @@ async fn scheduled_migration_works() { warm_up_end = start + 3; // Fellowship Origin + #[cfg(not(feature = "kusama-ahm"))] let origin = pallet_xcm::Origin::Xcm(Location::new( 0, [ @@ -754,6 +760,9 @@ async fn scheduled_migration_works() { Junction::Plurality { id: BodyId::Technical, part: BodyPart::Voice }, ], )); + #[cfg(feature = "kusama-ahm")] + let origin = polkadot_runtime::governance::Origin::Fellows; + assert_ok!(RcMigrator::schedule_migration( origin.into(), DispatchTime::At(start), @@ -1088,6 +1097,9 @@ fn test_control_flow() { maybe_xcm_version: Some(xcm::prelude::XCM_VERSION), }) .dispatch(AhRuntimeOrigin::root()); + + asset_hub_polkadot_runtime::ParachainSystem::ensure_successful_delivery(); + assert!(result.is_ok(), "fails with error: {:?}", result.err()); }); diff --git a/integration-tests/ahm/src/xcm_route.rs b/integration-tests/ahm/src/xcm_route.rs index b9bca39c3a..98f42a1b80 100644 --- a/integration-tests/ahm/src/xcm_route.rs +++ b/integration-tests/ahm/src/xcm_route.rs @@ -15,12 +15,13 @@ // along with Polkadot. If not, see . use crate::porting_prelude::*; + use asset_hub_polkadot_runtime::{ xcm_config::XcmRouter as AhXcmRouter, BuildStorage, ParachainSystem as AhParachainSystem, }; use codec::Encode; use cumulus_pallet_parachain_system::PendingUpwardMessages; -use cumulus_primitives_core::send_xcm; +use cumulus_primitives_core::{send_xcm, UpwardMessageSender}; use pallet_ah_migrator::{ AhMigrationStage as AhMigrationStageStorage, MigrationStage as AhMigrationStage, }; @@ -63,6 +64,9 @@ fn test_send_to_rc_from_ah() { maybe_xcm_version: Some(xcm::prelude::XCM_VERSION), }) .dispatch(AhRuntimeOrigin::root()); + + asset_hub_polkadot_runtime::ParachainSystem::ensure_successful_delivery(); + assert!(result.is_ok(), "fails with error: {:?}", result.err()); // open the channel between AH and Collectives (1001) @@ -271,6 +275,8 @@ fn test_send_to_rc_from_ah_via_extrinsic() { // open the channel between AH and Collectives (1001) AhParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(1001.into()); + asset_hub_polkadot_runtime::ParachainSystem::ensure_successful_delivery(); + let result = AhRuntimeCall::AhMigrator(pallet_ah_migrator::Call::::set_manager { new: Some(migration_admin.clone()), diff --git a/pallets/ah-migrator/Cargo.toml b/pallets/ah-migrator/Cargo.toml index fc5313f5e4..b8e01139dd 100644 --- a/pallets/ah-migrator/Cargo.toml +++ b/pallets/ah-migrator/Cargo.toml @@ -41,10 +41,9 @@ pallet-vesting = { workspace = true } pallet-treasury = { workspace = true } pallet-timestamp = { workspace = true } pallet-xcm = { workspace = true } +pallet-recovery = { workspace = true, optional = true } polkadot-parachain-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } -polkadot-runtime-constants = { workspace = true } -collectives-polkadot-runtime-constants = { workspace = true } runtime-parachains = { workspace = true } scale-info = { workspace = true, features = ["derive"] } serde = { features = ["derive"], optional = true, workspace = true } @@ -66,6 +65,12 @@ pallet-ah-ops = { workspace = true } [features] default = ["std"] + +kusama-ahm = [ + "pallet-rc-migrator/kusama-ahm", + "pallet-recovery", +] + std = [ "assets-common/std", "assets-common/std", @@ -92,6 +97,7 @@ std = [ "pallet-preimage/std", "pallet-proxy/std", "pallet-rc-migrator/std", + "pallet-recovery?/std", "pallet-referenda/std", "pallet-scheduler/std", "pallet-staking-async/std", @@ -105,8 +111,6 @@ std = [ "parachains-common/std", "polkadot-parachain-primitives/std", "polkadot-runtime-common/std", - "polkadot-runtime-constants/std", - "polkadot-runtime-constants/std", "runtime-parachains/std", "scale-info/std", "serde", @@ -145,6 +149,7 @@ runtime-benchmarks = [ "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-rc-migrator/runtime-benchmarks", + "pallet-recovery?/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-staking-async/runtime-benchmarks", @@ -158,7 +163,6 @@ runtime-benchmarks = [ "parachains-common/runtime-benchmarks", "polkadot-parachain-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", - "polkadot-runtime-constants/runtime-benchmarks", "runtime-parachains/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "sp-staking/runtime-benchmarks", @@ -187,6 +191,7 @@ try-runtime = [ "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-rc-migrator/try-runtime", + "pallet-recovery?/try-runtime", "pallet-referenda/try-runtime", "pallet-scheduler/try-runtime", "pallet-staking-async/try-runtime", diff --git a/pallets/ah-migrator/src/account.rs b/pallets/ah-migrator/src/account.rs index 4fc29f9ba6..84c12ccd03 100644 --- a/pallets/ah-migrator/src/account.rs +++ b/pallets/ah-migrator/src/account.rs @@ -331,6 +331,11 @@ pub mod tests { let mut ah_holds_diff = Vec::new(); for hold in pallet_balances::Holds::::get(&who) { + let hold_id_encoded = hold.id.clone().encode(); + if hold_id_encoded[0] == 60 { + // filter out pallet revive holds + continue; + } let mut hold_amount = hold.amount; if let Some(ah_hold_amount_pre) = ah_holds_pre.get(&hold.id.encode()) { hold_amount -= ah_hold_amount_pre; diff --git a/pallets/ah-migrator/src/benchmarking.rs b/pallets/ah-migrator/src/benchmarking.rs index dcb3ecb9f8..2f523e12c1 100644 --- a/pallets/ah-migrator/src/benchmarking.rs +++ b/pallets/ah-migrator/src/benchmarking.rs @@ -949,6 +949,7 @@ pub mod benchmarks { #[benchmark] fn start_migration() { + T::SendXcm::ensure_successful_delivery(Some(xcm::latest::Location::parent())); #[extrinsic_call] _(RawOrigin::Root); diff --git a/pallets/ah-migrator/src/lib.rs b/pallets/ah-migrator/src/lib.rs index f71029f0c8..60fa891332 100644 --- a/pallets/ah-migrator/src/lib.rs +++ b/pallets/ah-migrator/src/lib.rs @@ -46,6 +46,8 @@ pub mod indices; pub mod multisig; pub mod preimage; pub mod proxy; +#[cfg(feature = "kusama-ahm")] +pub mod recovery; pub mod referenda; pub mod scheduler; pub mod sovereign_account_translation; @@ -80,6 +82,8 @@ use frame_support::{ }; use frame_system::pallet_prelude::*; use pallet_balances::{AccountData, Reasons as LockReasons}; +#[cfg(feature = "kusama-ahm")] +use pallet_rc_migrator::recovery::{PortableRecoveryMessage, MAX_FRIENDS}; use pallet_rc_migrator::{ bounties::RcBountiesMessageOf, child_bounties::PortableChildBountiesMessage, claims::RcClaimsMessageOf, crowdloan::RcCrowdloanMessageOf, staking::PortableStakingMessage, @@ -140,31 +144,32 @@ type RcAccountFor = RcAccount< MaxEncodedLen, )] pub enum PalletEventName { - Indices, - Crowdloan, + AssetRates, BagsList, - Vesting, + Balances, Bounties, ChildBounties, - Treasury, - Balances, - Multisig, Claims, - ProxyProxies, - ProxyAnnouncements, + ConvictionVoting, + Crowdloan, + DelegatedStaking, + Indices, + Multisig, + NomPools, PreimageChunk, - PreimageRequestStatus, PreimageLegacyStatus, - NomPools, - ReferendaValues, + PreimageRequestStatus, + ProxyAnnouncements, + ProxyProxies, + Recovery, ReferendaMetadata, ReferendaReferendums, + ReferendaValues, Scheduler, SchedulerAgenda, - ConvictionVoting, - AssetRates, Staking, - DelegatedStaking, + Treasury, + Vesting, } /// The migration stage on the Asset Hub. @@ -297,6 +302,18 @@ pub mod pallet { + Unbalanced + ReservableCurrency + LockableCurrency; + + /// Config for pallets that are only on Kusama. + #[cfg(feature = "kusama-ahm")] + type KusamaConfig: pallet_recovery::Config< + Currency = pallet_balances::Pallet, + BlockNumberProvider = Self::RecoveryBlockNumberProvider, + MaxFriends = ConstU32<{ MAX_FRIENDS }>, + > + frame_system::Config, AccountId = AccountId32>; + + #[cfg(feature = "kusama-ahm")] + type RecoveryBlockNumberProvider: BlockNumberProvider; + /// All supported assets registry. type Assets: FungiblesMutate; /// XCM check account. @@ -332,6 +349,7 @@ pub mod pallet { Self::RcPalletsOrigin, <::RuntimeOrigin as OriginTrait>::PalletsOrigin, >; + /// Preimage registry. type Preimage: QueryPreimage::Hashing> + StorePreimage; /// Convert a Relay Chain Call to a local AH one. @@ -941,6 +959,18 @@ pub mod pallet { Self::do_receive_staking_messages(messages).map_err(Into::into) } + #[cfg(feature = "kusama-ahm")] + #[pallet::call_index(26)] + #[pallet::weight(T::AhWeightInfo::receive_staking_messages(messages.len() as u32))] // TODO @ggwpez weight + pub fn receive_recovery_messages( + origin: OriginFor, + messages: Vec, + ) -> DispatchResult { + ensure_root(origin)?; + + Self::do_receive_recovery_messages(messages).map_err(Into::into) + } + /// Set the migration stage. /// /// This call is intended for emergency use only and is guarded by the diff --git a/pallets/ah-migrator/src/recovery.rs b/pallets/ah-migrator/src/recovery.rs new file mode 100644 index 0000000000..0add1c6ef0 --- /dev/null +++ b/pallets/ah-migrator/src/recovery.rs @@ -0,0 +1,60 @@ +// This file is part of Substrate. + +// 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 pallet_rc_migrator::types::TranslateAccounts; + +impl Pallet { + pub fn do_receive_recovery_messages( + messages: Vec, + ) -> Result<(), Error> { + Self::deposit_event(Event::BatchReceived { + pallet: PalletEventName::Recovery, + count: messages.len() as u32, + }); + + for message in &messages { + Self::do_receive_recovery_message(message.clone()); + } + + Self::deposit_event(Event::BatchProcessed { + pallet: PalletEventName::Recovery, + count_good: messages.len() as u32, + count_bad: 0, + }); + + Ok(()) + } + + pub fn do_receive_recovery_message(message: PortableRecoveryMessage) { + let message = message.translate_accounts(Self::translate_account_rc_to_ah); + + match message { + PortableRecoveryMessage::Recoverable((who, config)) => { + let config: pallet_recovery::RecoveryConfig<_, _, _> = config.into(); + pallet_recovery::Recoverable::::insert(who, config); + }, + PortableRecoveryMessage::ActiveRecoveries((w1, w2, config)) => { + let config: pallet_recovery::ActiveRecovery<_, _, _> = config.into(); + pallet_recovery::ActiveRecoveries::::insert(w1, w2, config); + }, + PortableRecoveryMessage::Proxy((w1, w2)) => { + pallet_recovery::Proxy::::insert(w1, w2); + }, + } + } +} diff --git a/pallets/ah-migrator/src/sovereign_account_translation.rs b/pallets/ah-migrator/src/sovereign_account_translation.rs index cd18285dcc..edfed20a56 100644 --- a/pallets/ah-migrator/src/sovereign_account_translation.rs +++ b/pallets/ah-migrator/src/sovereign_account_translation.rs @@ -22,6 +22,7 @@ use sp_runtime::AccountId32; // AUTOGENERATED BELOW // RC snap path: ../../polkadot.snap /// List of RC para to AH sibl sovereign account translation sorted by RC account. +#[cfg(not(feature = "kusama-ahm"))] pub const SOV_TRANSLATIONS: &[((AccountId32, &'static str), (AccountId32, &'static str))] = &[ // para 0 ( @@ -821,6 +822,7 @@ pub const SOV_TRANSLATIONS: &[((AccountId32, &'static str), (AccountId32, &'stat ]; /// List of RC para to AH sibl derived account translation sorted by RC account. +#[cfg(not(feature = "kusama-ahm"))] pub const DERIVED_TRANSLATIONS: &[( (AccountId32, &'static str), u16, @@ -923,3 +925,13 @@ pub const DERIVED_TRANSLATIONS: &[( ), ), ]; + +#[cfg(feature = "kusama-ahm")] +pub const SOV_TRANSLATIONS: &[((AccountId32, &'static str), (AccountId32, &'static str))] = &[]; + +#[cfg(feature = "kusama-ahm")] +pub const DERIVED_TRANSLATIONS: &[( + (AccountId32, &'static str), + u16, + (AccountId32, &'static str), +)] = &[]; diff --git a/pallets/ah-migrator/src/xcm_config.rs b/pallets/ah-migrator/src/xcm_config.rs index db885f024e..f1f333b675 100644 --- a/pallets/ah-migrator/src/xcm_config.rs +++ b/pallets/ah-migrator/src/xcm_config.rs @@ -17,223 +17,29 @@ //! XCM configurations for Asset Hub for the AHM migration. use crate::PhantomData; -use assets_common::matching::{FromSiblingParachain, IsForeignConcreteAsset, ParentLocation}; -use cumulus_primitives_core::ParaId; -use frame_support::{ - parameter_types, - traits::{Contains, ContainsPair, Equals, ProcessMessageError, TypedGet}, -}; +use frame_support::traits::{ContainsPair, TypedGet}; use pallet_rc_migrator::types::MigrationStatus; -use parachains_common::xcm_config::ConcreteAssetFromSystem; use sp_runtime::{traits::Get, AccountId32}; use xcm::latest::prelude::*; -use xcm_builder::{AllowExplicitUnpaidExecutionFrom, IsSiblingSystemParachain}; -use xcm_executor::traits::{Properties, ShouldExecute}; - -use polkadot_runtime_constants::system_parachain; - -pub mod common { - use super::*; - parameter_types! { - pub const AssetHubParaId: ParaId = ParaId::new(system_parachain::ASSET_HUB_ID); - pub const DotLocation: Location = Location::parent(); - pub const RootLocation: Location = Location::here(); - } - - pub struct FellowshipEntities; - impl Contains for FellowshipEntities { - fn contains(location: &Location) -> bool { - matches!( - location.unpack(), - ( - 1, - [ - Parachain(system_parachain::COLLECTIVES_ID), - Plurality { id: BodyId::Technical, .. } - ] - ) | ( - 1, - [ - Parachain(system_parachain::COLLECTIVES_ID), - PalletInstance( - collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX - ) - ] - ) | ( - 1, - [ - Parachain(system_parachain::COLLECTIVES_ID), - PalletInstance( - collectives_polkadot_runtime_constants::FELLOWSHIP_TREASURY_PALLET_INDEX - ) - ] - ) - ) - } - } - - pub struct AmbassadorEntities; - impl Contains for AmbassadorEntities { - fn contains(location: &Location) -> bool { - matches!( - location.unpack(), - ( - 1, - [ - Parachain(system_parachain::COLLECTIVES_ID), - PalletInstance( - collectives_polkadot_runtime_constants::AMBASSADOR_SALARY_PALLET_INDEX - ) - ] - ) | ( - 1, - [ - Parachain(system_parachain::COLLECTIVES_ID), - PalletInstance( - collectives_polkadot_runtime_constants::AMBASSADOR_TREASURY_PALLET_INDEX - ) - ] - ) - ) - } - } - - /// Location type to determine the Secretary Collective related - /// pallets for use in XCM. - pub struct SecretaryEntities; - impl Contains for SecretaryEntities { - fn contains(location: &Location) -> bool { - matches!( - location.unpack(), - ( - 1, - [ - Parachain(system_parachain::COLLECTIVES_ID), - PalletInstance( - collectives_polkadot_runtime_constants::SECRETARY_SALARY_PALLET_INDEX - ) - ] - ) - ) - } - } - - // Teleport filters are a special case because we might want to have finer control over which - // one to use at fine-grained stages of the migration. - - /// Cases where a remote origin is accepted as trusted Teleporter for a given asset: - /// - /// - DOT with the parent Relay Chain and sibling system parachains; and - /// - Sibling parachains' assets from where they originate (as `ForeignCreators`). - pub type TrustedTeleportersBeforeAfter = ( - ConcreteAssetFromSystem, - IsForeignConcreteAsset>, - ); - - /// During migration we only allow teleports of foreign assets (not DOT). - /// - /// - Sibling parachains' assets from where they originate (as `ForeignCreators`). - pub type TrustedTeleportersDuring = - IsForeignConcreteAsset>; -} - -mod before { - use super::{ - common::{ - AmbassadorEntities, AssetHubParaId, FellowshipEntities, RootLocation, SecretaryEntities, - }, - *, - }; - - use polkadot_runtime_constants::TREASURY_PALLET_ID; - - parameter_types! { - pub RelayTreasuryLocation: Location = - (Parent, PalletInstance(TREASURY_PALLET_ID)).into(); - } - - pub struct ParentOrParentsPlurality; - impl Contains for ParentOrParentsPlurality { - fn contains(location: &Location) -> bool { - matches!(location.unpack(), (1, []) | (1, [Plurality { .. }])) - } - } - - /// For use in XCM Barriers: the locations listed below get free execution: - /// - /// Parent, its pluralities (i.e. governance bodies), the Fellows plurality, AmbassadorEntities - /// and sibling system parachains' root get free execution. - pub type UnpaidExecutionBeforeDuring = AllowExplicitUnpaidExecutionFrom<( - ParentOrParentsPlurality, - IsSiblingSystemParachain, - Equals, - FellowshipEntities, - AmbassadorEntities, - SecretaryEntities, - )>; - - /// Locations that will not be charged fees in the executor, either execution or delivery. - /// - /// We only waive fees for system functions, which these locations represent. - pub type WaivedLocationsBeforeDuring = ( - Equals, - Equals, - IsSiblingSystemParachain, - Equals, - FellowshipEntities, - AmbassadorEntities, - SecretaryEntities, - ); -} - -mod after { - use super::{ - common::{ - AmbassadorEntities, AssetHubParaId, FellowshipEntities, RootLocation, SecretaryEntities, - }, - *, - }; - - /// For use in XCM Barriers: the locations listed below get free execution: - /// - /// Parent, the Fellows plurality, AmbassadorEntities and sibling system parachains' root - /// get free execution. - pub type UnpaidExecutionAfter = AllowExplicitUnpaidExecutionFrom<( - // outside this pallet, when the `Runtime` type is available, the below can be replaced - // with `RelayOrOtherSystemParachains` - Equals, - IsSiblingSystemParachain, - FellowshipEntities, - AmbassadorEntities, - SecretaryEntities, - )>; - - /// Locations that will not be charged fees in the executor, either execution or delivery. - /// - /// We only waive fees for system functions, which these locations represent. - pub type WaivedLocationsAfter = ( - Equals, - // outside this pallet, when the `Runtime` type is available, the below can be replaced - // with `RelayOrOtherSystemParachains` - Equals, - IsSiblingSystemParachain, - FellowshipEntities, - AmbassadorEntities, - SecretaryEntities, - ); -} /// To be used for `IsTeleport` filter. Disallows DOT teleports during the migration. -pub struct TrustedTeleporters(PhantomData); -impl ContainsPair for TrustedTeleporters { +pub struct TrustedTeleporters( + PhantomData<(Stage, During, BeforeAfter)>, +); +impl< + Stage: MigrationStatus, + During: ContainsPair, + BeforeAfter: ContainsPair, + > ContainsPair for TrustedTeleporters +{ fn contains(asset: &Asset, origin: &Location) -> bool { let migration_ongoing = Stage::is_ongoing(); log::trace!(target: "xcm::IsTeleport::contains", "migration ongoing: {:?}", migration_ongoing); let result = if migration_ongoing { - common::TrustedTeleportersDuring::contains(asset, origin) + During::contains(asset, origin) } else { // before and after migration use normal filter - common::TrustedTeleportersBeforeAfter::contains(asset, origin) + BeforeAfter::contains(asset, origin) }; log::trace!( target: "xcm::IsTeleport::contains", @@ -244,47 +50,6 @@ impl ContainsPair for TrustedTeleporter } } -pub struct UnpaidExecutionFilter(PhantomData); -impl ShouldExecute for UnpaidExecutionFilter { - fn should_execute( - origin: &Location, - instructions: &mut [Instruction], - max_weight: Weight, - _properties: &mut Properties, - ) -> Result<(), ProcessMessageError> { - if Stage::is_finished() { - log::trace!(target: "xcm::UnpaidExecutionFilter::should_execute", "migration finished"); - after::UnpaidExecutionAfter::should_execute( - origin, - instructions, - max_weight, - _properties, - ) - } else { - log::trace!(target: "xcm::UnpaidExecutionFilter::should_execute", "migration not finished"); - before::UnpaidExecutionBeforeDuring::should_execute( - origin, - instructions, - max_weight, - _properties, - ) - } - } -} - -pub struct WaivedLocations(PhantomData); -impl Contains for WaivedLocations { - fn contains(location: &Location) -> bool { - if Stage::is_finished() { - log::trace!(target: "xcm::WaivedLocations::contains", "{location:?} (migration finished)"); - after::WaivedLocationsAfter::contains(location) - } else { - log::trace!(target: "xcm::WaivedLocations::contains", "{location:?} (migration not finished)"); - before::WaivedLocationsBeforeDuring::contains(location) - } - } -} - pub struct TreasuryAccount( PhantomData<(Stage, PreMigrationAccount, PostMigrationAccount)>, ); diff --git a/pallets/rc-migrator/Cargo.toml b/pallets/rc-migrator/Cargo.toml index fc01476e96..84e529d6ba 100644 --- a/pallets/rc-migrator/Cargo.toml +++ b/pallets/rc-migrator/Cargo.toml @@ -39,6 +39,8 @@ pallet-treasury = { workspace = true } pallet-fast-unstake = { workspace = true } pallet-referenda = { workspace = true } pallet-vesting = { workspace = true } +pallet-recovery = { workspace = true, optional = true } +pallet-nis = { workspace = true, optional = true } pallet-staking-async-ah-client = { workspace = true } pallet-session = { workspace = true } pallet-nomination-pools = { workspace = true } @@ -47,7 +49,6 @@ pallet-xcm = { workspace = true } polkadot-runtime-common = { workspace = true } runtime-parachains = { workspace = true } polkadot-parachain-primitives = { workspace = true } -polkadot-runtime-constants = { workspace = true } hex-literal = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } @@ -58,6 +59,7 @@ frame-election-provider-support = { workspace = true } [features] default = ["std"] +kusama-ahm = ["pallet-nis", "pallet-recovery"] std = [ "codec/std", "frame-benchmarking?/std", @@ -76,9 +78,11 @@ std = [ "pallet-indices/std", "pallet-message-queue/std", "pallet-multisig/std", + "pallet-nis?/std", "pallet-nomination-pools/std", "pallet-preimage/std", "pallet-proxy/std", + "pallet-recovery?/std", "pallet-referenda/std", "pallet-scheduler/std", "pallet-session/std", @@ -91,8 +95,6 @@ std = [ "pallet-xcm/std", "polkadot-parachain-primitives/std", "polkadot-runtime-common/std", - "polkadot-runtime-constants/std", - "polkadot-runtime-constants/std", "runtime-parachains/std", "scale-info/std", "serde", @@ -123,9 +125,11 @@ runtime-benchmarks = [ "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", + "pallet-nis?/runtime-benchmarks", "pallet-nomination-pools/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", + "pallet-recovery?/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-staking-async-ah-client/runtime-benchmarks", @@ -137,7 +141,6 @@ runtime-benchmarks = [ "pallet-xcm/runtime-benchmarks", "polkadot-parachain-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", - "polkadot-runtime-constants/runtime-benchmarks", "runtime-parachains/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "sp-staking/runtime-benchmarks", @@ -160,9 +163,11 @@ try-runtime = [ "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", "pallet-multisig/try-runtime", + "pallet-nis?/try-runtime", "pallet-nomination-pools/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", + "pallet-recovery?/try-runtime", "pallet-referenda/try-runtime", "pallet-scheduler/try-runtime", "pallet-session/try-runtime", diff --git a/pallets/rc-migrator/src/accounts.rs b/pallets/rc-migrator/src/accounts.rs index 0538e2339e..7b7fd28bf7 100644 --- a/pallets/rc-migrator/src/accounts.rs +++ b/pallets/rc-migrator/src/accounts.rs @@ -264,13 +264,15 @@ impl PalletMigration for AccountsMigrator { }; let mut maybe_last_key = last_key; + let mut total_items_iterated = 0; loop { // account the weight for migrating a single account on Relay Chain. if weight_counter.try_consume(T::RcWeightInfo::withdraw_account()).is_err() || weight_counter.try_consume(batch.consume_weight()).is_err() { log::info!("RC weight limit reached at batch length {}, stopping", batch.len()); - if batch.is_empty() { + if batch.is_empty() && total_items_iterated == 0 { + defensive!("Not enough weight to migrate a single account"); return Err(Error::OutOfWeight); } else { break; @@ -305,6 +307,8 @@ impl PalletMigration for AccountsMigrator { }) .expect("Always returning Ok; qed"); + total_items_iterated += 1; + match withdraw_res { // Account does not need to be migrated Ok(None) => { @@ -318,11 +322,11 @@ impl PalletMigration for AccountsMigrator { batch.push(ah_account) }, // Not enough weight, lets try again in the next block since we made some progress. - Err(Error::OutOfWeight) if !batch.is_empty() => { + Err(Error::OutOfWeight) if total_items_iterated > 1 => { break; }, // Not enough weight and was unable to make progress, bad. - Err(Error::OutOfWeight) if batch.is_empty() => { + Err(Error::OutOfWeight) if total_items_iterated <= 1 => { defensive!("Not enough weight to migrate a single account"); return Err(Error::OutOfWeight); }, @@ -956,9 +960,9 @@ pub mod tests { pub struct AccountsMigrationChecker(sp_std::marker::PhantomData); + #[cfg(not(feature = "kusama-ahm"))] impl AccountsMigrationChecker { // Translate the RC freeze id encoding to the corresponding AH freeze id encoding. - // TODO: implement mapping for Kusama and Paseo pub fn rc_freeze_id_encoding_to_ah(freeze_id: Vec) -> Vec { match freeze_id.as_slice() { // Nomination pools pallet indexes on Polkadot RC => AH @@ -968,7 +972,6 @@ pub mod tests { } // Translate the RC hold id encoding to the corresponding AH hold id encoding. - // TODO: implement mapping for Kusama and Paseo pub fn rc_hold_id_encoding_to_ah(hold_id: Vec) -> Vec { match hold_id.as_slice() { // Preimage pallet indexes on Polkadot RC => AH @@ -994,6 +997,42 @@ pub mod tests { } } + #[cfg(feature = "kusama-ahm")] + impl AccountsMigrationChecker { + // Translate the RC freeze id encoding to the corresponding AH freeze id encoding. + pub fn rc_freeze_id_encoding_to_ah(freeze_id: Vec) -> Vec { + match freeze_id.as_slice() { + // Nomination pools pallet indexes on Kusama RC => AH + [41, 0] => [80, 0].to_vec(), + _ => panic!("Unknown freeze id: {:?}", freeze_id), + } + } + // Translate the RC hold id encoding to the corresponding AH hold id encoding. + pub fn rc_hold_id_encoding_to_ah(hold_id: Vec) -> Vec { + match hold_id.as_slice() { + // Preimage pallet indexes on Kusama RC => AH + [32, 0] => [6, 0].to_vec(), + // Pallet staking indexes on Kusama RC => AH + [6, 0] => [89, 0].to_vec(), + // Pallet delegated-staking indexes on Kusama RC => AH + [47, 0] => [83, 0].to_vec(), + _ => panic!("Unknown hold id: {:?}", hold_id), + } + } + + // Get the AH expected hold amount for a RC migrated hold. + // This is used to check that the hold amount is correct after migration. + pub fn ah_hold_amount_from_rc(hold_id: Vec, hold_amount: u128) -> u128 { + match hold_id.as_slice() { + // Preimage deposits are divided by 100 when migrated to Asset Hub. + [32, 0] => hold_amount.saturating_div(100), + // TODO: change to correct amounts for Staking if we decide to adjust deposits + // during migration. + _ => hold_amount, + } + } + } + impl crate::types::RcMigrationCheck for AccountsMigrationChecker { // The first item is a mapping from account to a summary of their balances, including holds, // reserves, locks, and freezes. The second item is the total issuance on the relay chain diff --git a/pallets/rc-migrator/src/lib.rs b/pallets/rc-migrator/src/lib.rs index 1f5a74be3a..b2715fcc6b 100644 --- a/pallets/rc-migrator/src/lib.rs +++ b/pallets/rc-migrator/src/lib.rs @@ -51,6 +51,8 @@ pub mod benchmarking; pub mod bounties; pub mod child_bounties; pub mod conviction_voting; +#[cfg(feature = "kusama-ahm")] +pub mod recovery; pub mod scheduler; pub mod treasury; pub mod xcm_config; @@ -344,11 +346,21 @@ pub enum MigrationStage< }, TreasuryMigrationDone, + #[cfg(feature = "kusama-ahm")] + RecoveryMigrationInit, + #[cfg(feature = "kusama-ahm")] + RecoveryMigrationOngoing { + last_key: Option, + }, + #[cfg(feature = "kusama-ahm")] + RecoveryMigrationDone, + StakingMigrationInit, StakingMigrationOngoing { next_key: Option>, }, StakingMigrationDone, + CoolOff { /// The block number at which the post migration cool-off period will end. /// @@ -476,6 +488,18 @@ pub mod pallet { + VariantCount + IntoPortable; + /// Config for pallets that are only on Kusama. + #[cfg(feature = "kusama-ahm")] + type KusamaConfig: pallet_recovery::Config< + Currency = pallet_balances::Pallet, + BlockNumberProvider = Self::RecoveryBlockNumberProvider, + MaxFriends = ConstU32<{ recovery::MAX_FRIENDS }>, + > + frame_system::Config, AccountId = AccountId32>; + + /// Block number provider of the recovery pallet. + #[cfg(feature = "kusama-ahm")] + type RecoveryBlockNumberProvider: BlockNumberProvider; + /// Block number provider of the treasury pallet. /// /// This is here to simplify the code of the treasury, bounties and child-bounties migration @@ -849,8 +873,6 @@ pub mod pallet { let start = start.evaluate(now); ensure!(start > now, Error::::PastBlockNumber); - ensure!(warm_up.evaluate(now) >= start, Error::::PastBlockNumber); - ensure!(cool_off.evaluate(now) >= start, Error::::PastBlockNumber); if !unsafe_ignore_staking_lock_check { let until_start = start.saturating_sub(now); @@ -1931,6 +1953,22 @@ pub mod pallet { } }, MigrationStage::TreasuryMigrationDone => { + #[cfg(feature = "kusama-ahm")] + Self::transition(MigrationStage::RecoveryMigrationInit); + #[cfg(not(feature = "kusama-ahm"))] + Self::transition(MigrationStage::StakingMigrationInit); + }, + #[cfg(feature = "kusama-ahm")] + MigrationStage::RecoveryMigrationInit => { + Self::transition(MigrationStage::RecoveryMigrationOngoing { last_key: None }); + }, + #[cfg(feature = "kusama-ahm")] + MigrationStage::RecoveryMigrationOngoing { last_key } => { + // TODO + Self::transition(MigrationStage::RecoveryMigrationDone); + }, + #[cfg(feature = "kusama-ahm")] + MigrationStage::RecoveryMigrationDone => { Self::transition(MigrationStage::StakingMigrationInit); }, MigrationStage::StakingMigrationInit => { diff --git a/pallets/rc-migrator/src/multisig.rs b/pallets/rc-migrator/src/multisig.rs index ae8f0e09c8..898fbec9bb 100644 --- a/pallets/rc-migrator/src/multisig.rs +++ b/pallets/rc-migrator/src/multisig.rs @@ -18,7 +18,6 @@ #![doc = include_str!("multisig.md")] use frame_support::traits::Currency; -use sp_runtime::traits::Zero; extern crate alloc; use crate::{types::*, *}; @@ -184,13 +183,14 @@ impl RcMigrationCheck for MultisigMigrationChecker { fn pre_check() -> Self::RcPrePayload { let mut multisig_ids = Vec::new(); + let ed = <::Currency as Currency<_>>::minimum_balance(); // Collect all multisig account ids with non-zero balance from storage for (multisig_id, _, _) in aliases::Multisigs::::iter() { let multisig_balance = <::Currency as frame_support::traits::Currency< ::AccountId, >>::total_balance(&multisig_id); - if !multisig_balance.is_zero() { + if multisig_balance >= ed { multisig_ids.push(multisig_id); } } diff --git a/pallets/rc-migrator/src/recovery.rs b/pallets/rc-migrator/src/recovery.rs new file mode 100644 index 0000000000..329107f529 --- /dev/null +++ b/pallets/rc-migrator/src/recovery.rs @@ -0,0 +1,356 @@ +// 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 . + +use crate::{ + types::{DefensiveTruncateInto, TranslateAccounts}, + *, +}; + +/// Hard-code the number of max friends in Kusama for simplicity. +pub const MAX_FRIENDS: u32 = 9; + +#[derive( + Encode, + DecodeWithMemTracking, + Decode, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialEq, + Eq, +)] +pub enum RecoveryStage { + Recoverable(Option), + ActiveRecoveries(Option<(AccountId32, AccountId32)>), + Proxy(Option), + Finished, +} + +#[derive( + Encode, + DecodeWithMemTracking, + Decode, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialEq, + Eq, +)] +pub enum PortableRecoveryMessage { + Recoverable((AccountId32, PortableRecoveryConfig)), + ActiveRecoveries((AccountId32, AccountId32, PortableActiveRecovery)), + Proxy((AccountId32, AccountId32)), +} + +#[derive( + Encode, + DecodeWithMemTracking, + Decode, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialEq, + Eq, +)] +pub struct PortableRecoveryConfig { + pub delay_period: u32, + pub deposit: u128, + pub friends: PortableRecoveryFriends, + pub threshold: u16, +} + +#[derive( + Encode, + DecodeWithMemTracking, + Decode, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialEq, + Eq, +)] +pub struct PortableActiveRecovery { + pub created: u32, + pub deposit: u128, + pub friends: PortableRecoveryFriends, +} + +#[derive( + Encode, + DecodeWithMemTracking, + Decode, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialEq, + Eq, +)] +pub struct PortableRecoveryFriends { + pub friends: BoundedVec>, +} + +// Acc Translation +impl TranslateAccounts for PortableRecoveryMessage { + fn translate_accounts(self, f: impl Fn(AccountId32) -> AccountId32) -> Self { + match self { + PortableRecoveryMessage::Recoverable((who, config)) => + PortableRecoveryMessage::Recoverable((f(who), config.translate_accounts(f))), + PortableRecoveryMessage::ActiveRecoveries((w1, w2, config)) => + PortableRecoveryMessage::ActiveRecoveries(( + f(w1), + f(w2), + config.translate_accounts(f), + )), + PortableRecoveryMessage::Proxy((w1, w2)) => + PortableRecoveryMessage::Proxy((f(w1), f(w2))), + } + } +} + +// RC -> Portable +impl IntoPortable + for pallet_recovery::RecoveryConfig>> +{ + type Portable = PortableRecoveryConfig; + + fn into_portable(self) -> Self::Portable { + PortableRecoveryConfig { + delay_period: self.delay_period, + deposit: self.deposit, + friends: self.friends.into_portable(), + threshold: self.threshold, + } + } +} + +// Acc Translation +impl TranslateAccounts for PortableRecoveryConfig { + fn translate_accounts(self, f: impl Fn(AccountId32) -> AccountId32) -> Self { + Self { friends: self.friends.translate_accounts(f), ..self } + } +} + +// Portable -> AH +impl + Into>>> + for PortableRecoveryConfig +{ + fn into( + self, + ) -> pallet_recovery::RecoveryConfig>> + { + pallet_recovery::RecoveryConfig { + delay_period: self.delay_period, + deposit: self.deposit, + friends: self.friends.into(), + threshold: self.threshold, + } + } +} + +// Acc Translation +impl TranslateAccounts for PortableActiveRecovery { + fn translate_accounts(self, f: impl Fn(AccountId32) -> AccountId32) -> Self { + Self { friends: self.friends.translate_accounts(f), ..self } + } +} + +// RC -> Portable +impl IntoPortable + for pallet_recovery::ActiveRecovery>> +{ + type Portable = PortableActiveRecovery; + + fn into_portable(self) -> Self::Portable { + PortableActiveRecovery { + created: self.created, + deposit: self.deposit, + friends: self.friends.into_portable(), + } + } +} + +// Portable -> AH +impl + Into>>> + for PortableActiveRecovery +{ + fn into( + self, + ) -> pallet_recovery::ActiveRecovery>> + { + pallet_recovery::ActiveRecovery { + created: self.created, + deposit: self.deposit, + friends: self.friends.into(), + } + } +} + +// RC -> Portable +impl IntoPortable for BoundedVec> { + type Portable = PortableRecoveryFriends; + + fn into_portable(self) -> Self::Portable { + PortableRecoveryFriends { friends: self } + } +} + +// Acc Translation +impl TranslateAccounts for PortableRecoveryFriends { + fn translate_accounts(self, f: impl Fn(AccountId32) -> AccountId32) -> Self { + Self { + friends: self.friends.into_iter().map(f).collect::>().defensive_truncate_into(), + } // TODO @ggwpez iter_mut? + } +} + +// Portable -> AH +impl Into>> for PortableRecoveryFriends { + fn into(self) -> BoundedVec> { + self.friends + } +} + +pub struct RecoveryMigrator { + _phantom: sp_std::marker::PhantomData, +} + +impl PalletMigration for RecoveryMigrator { + type Key = RecoveryStage; + type Error = Error; + + fn migrate_many( + last_key: Option, + weight_counter: &mut WeightMeter, + ) -> Result, Self::Error> { + let mut last_key = last_key.unwrap_or(RecoveryStage::Recoverable(None)); + let mut messages = XcmBatchAndMeter::new_from_config::(); + + loop { + if weight_counter.try_consume(T::DbWeight::get().reads_writes(1, 1)).is_err() || + weight_counter.try_consume(messages.consume_weight()).is_err() + { + log::info!("RC weight limit reached at batch length {}, stopping", messages.len()); + if messages.is_empty() { + return Err(Error::OutOfWeight); + } else { + break; + } + } + + // TODO @ggwpez weight + if T::MaxAhWeight::get() + .any_lt(T::AhWeightInfo::receive_vesting_schedules((messages.len() + 1) as u32)) + { + log::info!("AH weight limit reached at batch length {}, stopping", messages.len()); + if messages.is_empty() { + return Err(Error::OutOfWeight); + } else { + break; + } + } + + if messages.len() > MAX_ITEMS_PER_BLOCK { + log::info!( + "Maximum number of items ({:?}) to migrate per block reached, current batch size: {}", + MAX_ITEMS_PER_BLOCK, + messages.len() + ); + break; + } + + last_key = match last_key { + RecoveryStage::Recoverable(last_key) => { + let mut iter = match last_key { + Some(last_key) => + pallet_recovery::Recoverable::::iter_from_key(last_key), + None => pallet_recovery::Recoverable::::iter(), + }; + + match iter.next() { + Some((who, config)) => { + pallet_recovery::Recoverable::::remove(&who); + messages.push(PortableRecoveryMessage::Recoverable(( + who.clone(), + config.into_portable(), + ))); + RecoveryStage::Recoverable(Some(who)) + }, + None => RecoveryStage::ActiveRecoveries(None), + } + }, + RecoveryStage::ActiveRecoveries(last_key) => { + let mut iter = match last_key { + Some((w1, w2)) => pallet_recovery::ActiveRecoveries::::iter_from( + pallet_recovery::ActiveRecoveries::::hashed_key_for(w1, w2), + ), + None => pallet_recovery::ActiveRecoveries::::iter(), + }; + + match iter.next() { + Some((w1, w2, config)) => { + pallet_recovery::ActiveRecoveries::::remove(&w1, &w2); + messages.push(PortableRecoveryMessage::ActiveRecoveries(( + w1.clone(), + w2.clone(), + config.into_portable(), + ))); + RecoveryStage::ActiveRecoveries(Some((w1, w2))) + }, + None => RecoveryStage::Proxy(None), + } + }, + RecoveryStage::Proxy(last_key) => { + let mut iter = match last_key { + Some(last_key) => + pallet_recovery::Proxy::::iter_from_key(last_key), + None => pallet_recovery::Proxy::::iter(), + }; + + match iter.next() { + Some((w1, w2)) => { + pallet_recovery::Proxy::::remove(&w1); + messages.push(PortableRecoveryMessage::Proxy((w1.clone(), w2.clone()))); + RecoveryStage::Proxy(Some(w1)) + }, + None => RecoveryStage::Finished, + } + }, + RecoveryStage::Finished => { + break; + }, + } + } + + if !messages.is_empty() { + Pallet::::send_chunked_xcm_and_track(messages, |messages| { + types::AhMigratorCall::ReceiveRecoveryMessages { messages } + })?; + } + + if last_key == RecoveryStage::Finished { + Ok(None) + } else { + Ok(Some(last_key)) + } + } +} diff --git a/pallets/rc-migrator/src/staking/message.rs b/pallets/rc-migrator/src/staking/message.rs index 556f55bab3..1ff915debe 100644 --- a/pallets/rc-migrator/src/staking/message.rs +++ b/pallets/rc-migrator/src/staking/message.rs @@ -675,7 +675,10 @@ impl Into> for PortableIndivid )] pub struct PortableEraRewardPoints { pub total: u32, - pub individual: BoundedVec<(AccountId32, u32), ConstU32<600>>, // Up to MaxValidatorSize + #[cfg(not(feature = "kusama-ahm"))] + pub individual: BoundedVec<(AccountId32, u32), ConstU32<600>>, // Up to MaxValidatorSize + #[cfg(feature = "kusama-ahm")] + pub individual: BoundedVec<(AccountId32, u32), ConstU32<12500>>, } // EraRewardPoints: RC -> Portable @@ -683,10 +686,10 @@ impl IntoPortable for pallet_staking::EraRewardPoints { type Portable = PortableEraRewardPoints; fn into_portable(self) -> Self::Portable { - let individual: BoundedVec<_, ConstU32<600>> = - self.individual.into_iter().collect::>().defensive_truncate_into(); - - PortableEraRewardPoints { total: self.total, individual } + PortableEraRewardPoints { + total: self.total, + individual: self.individual.into_iter().collect::>().defensive_truncate_into(), + } } } diff --git a/pallets/rc-migrator/src/staking/staking.rs b/pallets/rc-migrator/src/staking/staking.rs index 28857dc3ff..30b83fd248 100644 --- a/pallets/rc-migrator/src/staking/staking.rs +++ b/pallets/rc-migrator/src/staking/staking.rs @@ -113,6 +113,8 @@ impl PalletMigration for StakingMigrator { break; } + log::debug!("Migrating staking stage: {:?}", inner_key); + inner_key = match inner_key { StakingStage::Values => { let values = Self::take_values(); diff --git a/pallets/rc-migrator/src/types.rs b/pallets/rc-migrator/src/types.rs index 3c55742900..f6d78e2d1e 100644 --- a/pallets/rc-migrator/src/types.rs +++ b/pallets/rc-migrator/src/types.rs @@ -37,6 +37,10 @@ impl ToPolkadotSs58 for AccountId32 { } } +pub trait TranslateAccounts { + fn translate_accounts(self, f: impl Fn(AccountId32) -> AccountId32) -> Self; +} + /// Convert a type into its portable format. /// /// The portable format is chain-agnostic. The flow the following: Convert RC object to portable @@ -154,6 +158,9 @@ pub enum AhMigratorCall { ReceiveChildBountiesMessages { messages: Vec }, #[codec(index = 25)] ReceiveStakingMessages { messages: Vec }, + #[cfg(feature = "kusama-ahm")] + #[codec(index = 26)] + ReceiveRecoveryMessages { messages: Vec }, #[codec(index = 101)] StartMigration, #[codec(index = 110)] diff --git a/pallets/rc-migrator/src/weights_ah.rs b/pallets/rc-migrator/src/weights_ah.rs index e3ded4ddd6..ccb94f6bed 100644 --- a/pallets/rc-migrator/src/weights_ah.rs +++ b/pallets/rc-migrator/src/weights_ah.rs @@ -60,7 +60,6 @@ pub trait WeightInfo { fn receive_proxy_announcements(n: u32, ) -> Weight; fn receive_vesting_schedules(n: u32, ) -> Weight; fn receive_nom_pools_messages(n: u32, ) -> Weight; - fn receive_fast_unstake_messages(n: u32, ) -> Weight; fn receive_referenda_values() -> Weight; fn receive_single_active_referendums(m: u32, ) -> Weight; fn receive_complete_referendums(n: u32, ) -> Weight; @@ -224,25 +223,6 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 3672).saturating_mul(n.into())) } - /// Storage: `FastUnstake::Queue` (r:255 w:255) - /// Proof: `FastUnstake::Queue` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) - /// Storage: `FastUnstake::CounterForQueue` (r:1 w:1) - /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 255]`. - fn receive_fast_unstake_messages(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `1489 + n * (2531 ±0)` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(4_553_762, 1489) - // Standard Error: 52_177 - .saturating_add(Weight::from_parts(2_631_698, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) - } /// Storage: `Referenda::DecidingCount` (r:0 w:16) /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Referenda::ReferendumCount` (r:0 w:1) @@ -749,25 +729,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 3672).saturating_mul(n.into())) } - /// Storage: `FastUnstake::Queue` (r:255 w:255) - /// Proof: `FastUnstake::Queue` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) - /// Storage: `FastUnstake::CounterForQueue` (r:1 w:1) - /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 255]`. - fn receive_fast_unstake_messages(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `1489 + n * (2531 ±0)` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(4_553_762, 1489) - // Standard Error: 52_177 - .saturating_add(Weight::from_parts(2_631_698, 0).saturating_mul(n.into())) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) - } /// Storage: `Referenda::DecidingCount` (r:0 w:16) /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Referenda::ReferendumCount` (r:0 w:1) diff --git a/pallets/rc-migrator/src/xcm_config.rs b/pallets/rc-migrator/src/xcm_config.rs index 266616ed4a..7855d0c5b4 100644 --- a/pallets/rc-migrator/src/xcm_config.rs +++ b/pallets/rc-migrator/src/xcm_config.rs @@ -17,42 +17,14 @@ //! XCM configurations for the Relay Chain for the AHM migration. use crate::{types::MigrationStatus, PhantomData}; -use frame_support::{ - parameter_types, - traits::{Contains, ContainsPair, Equals}, -}; +use frame_support::traits::ContainsPair; use xcm::latest::prelude::*; -use xcm_builder::Case; - -use polkadot_runtime_constants::system_parachain::*; - -parameter_types! { - pub const RootLocation: Location = Here.into_location(); - pub const Dot: AssetFilter = Wild(AllOf { fun: WildFungible, id: AssetId(Here.into_location()) }); - pub AssetHubLocation: Location = Parachain(ASSET_HUB_ID).into_location(); - pub DotForAssetHub: (AssetFilter, Location) = (Dot::get(), AssetHubLocation::get()); - pub CollectivesLocation: Location = Parachain(COLLECTIVES_ID).into_location(); - pub DotForCollectives: (AssetFilter, Location) = (Dot::get(), CollectivesLocation::get()); - pub CoretimeLocation: Location = Parachain(BROKER_ID).into_location(); - pub DotForCoretime: (AssetFilter, Location) = (Dot::get(), CoretimeLocation::get()); - pub BridgeHubLocation: Location = Parachain(BRIDGE_HUB_ID).into_location(); - pub DotForBridgeHub: (AssetFilter, Location) = (Dot::get(), BridgeHubLocation::get()); - pub People: Location = Parachain(PEOPLE_ID).into_location(); - pub DotForPeople: (AssetFilter, Location) = (Dot::get(), People::get()); -} - -/// Polkadot Relay recognizes/respects System Parachains as teleporters. -pub type TrustedTeleportersBeforeAndAfter = ( - Case, - Case, - Case, - Case, - Case, -); /// To be used for `IsTeleport` filter. Disallows DOT teleports during the migration. -pub struct TrustedTeleporters(PhantomData); -impl ContainsPair for TrustedTeleporters { +pub struct FalseIfMigrating(PhantomData<(Stage, Inner)>); +impl> ContainsPair + for FalseIfMigrating +{ fn contains(asset: &Asset, origin: &Location) -> bool { let migration_ongoing = Stage::is_ongoing(); log::trace!(target: "xcm::IsTeleport::contains", "migration ongoing: {:?}", migration_ongoing); @@ -61,7 +33,7 @@ impl ContainsPair for TrustedTeleporter false } else { // before and after migration use normal filter - TrustedTeleportersBeforeAndAfter::contains(asset, origin) + Inner::contains(asset, origin) }; log::trace!( target: "xcm::IsTeleport::contains", @@ -71,33 +43,3 @@ impl ContainsPair for TrustedTeleporter result } } - -mod before { - use super::*; - pub struct LocalPlurality; - impl Contains for LocalPlurality { - fn contains(loc: &Location) -> bool { - matches!(loc.unpack(), (0, [Plurality { .. }])) - } - } - pub type WaivedLocationsBeforeDuring = (SystemParachains, Equals, LocalPlurality); -} -mod after { - use super::*; - pub type WaivedLocationsAfter = (SystemParachains, Equals); -} - -/// Locations that will not be charged fees in the executor, neither for execution nor delivery. -/// We only waive fees for system functions, which these locations represent. -pub struct WaivedLocations(PhantomData); -impl Contains for WaivedLocations { - fn contains(location: &Location) -> bool { - if Stage::is_finished() { - log::trace!(target: "xcm::WaivedLocations::contains", "{location:?} (migration finished)"); - after::WaivedLocationsAfter::contains(location) - } else { - log::trace!(target: "xcm::WaivedLocations::contains", "{location:?} (migration not finished)"); - before::WaivedLocationsBeforeDuring::contains(location) - } - } -} diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml index 415db4a3b3..1a05cbbd78 100644 --- a/relay/kusama/Cargo.toml +++ b/relay/kusama/Cargo.toml @@ -9,6 +9,11 @@ repository.workspace = true version.workspace = true [dependencies] + +# Asset Hub Migration concerning deps +pallet-rc-migrator = { workspace = true } +# End: Asset Hub Migration concerning deps + codec = { features = ["derive", "max-encoded-len"], workspace = true } scale-info = { features = ["derive"], workspace = true } serde_json = { features = ["alloc"], workspace = true } @@ -51,6 +56,8 @@ pallet-transaction-payment-rpc-runtime-api = { workspace = true } pallet-nomination-pools-runtime-api = { workspace = true } pallet-conviction-voting = { workspace = true } pallet-delegated-staking = { workspace = true } +pallet-staking-async-ah-client = { workspace = true } +pallet-staking-async-rc-client = { workspace = true } pallet-election-provider-multi-phase = { workspace = true } pallet-fast-unstake = { workspace = true } frame-executive = { workspace = true } @@ -122,6 +129,7 @@ substrate-wasm-builder = { workspace = true, optional = true } [features] default = ["std"] no_std = [] +kusama-ahm = ["pallet-rc-migrator/kusama-ahm"] std = [ "authority-discovery-primitives/std", "babe-primitives/std", @@ -169,12 +177,15 @@ std = [ "pallet-preimage/std", "pallet-proxy/std", "pallet-ranked-collective/std", + "pallet-rc-migrator/std", "pallet-recovery/std", "pallet-referenda/std", "pallet-scheduler/std", "pallet-session-benchmarking?/std", "pallet-session/std", "pallet-society/std", + "pallet-staking-async-ah-client/std", + "pallet-staking-async-rc-client/std", "pallet-staking-runtime-api/std", "pallet-staking/std", "pallet-timestamp/std", @@ -250,11 +261,14 @@ runtime-benchmarks = [ "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-ranked-collective/runtime-benchmarks", + "pallet-rc-migrator/runtime-benchmarks", "pallet-recovery/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-session-benchmarking/runtime-benchmarks", "pallet-society/runtime-benchmarks", + "pallet-staking-async-ah-client/runtime-benchmarks", + "pallet-staking-async-rc-client/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-transaction-payment/runtime-benchmarks", @@ -308,11 +322,14 @@ try-runtime = [ "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-ranked-collective/try-runtime", + "pallet-rc-migrator/try-runtime", "pallet-recovery/try-runtime", "pallet-referenda/try-runtime", "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-society/try-runtime", + "pallet-staking-async-ah-client/try-runtime", + "pallet-staking-async-rc-client/try-runtime", "pallet-staking/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", diff --git a/relay/kusama/src/ah_migration/mod.rs b/relay/kusama/src/ah_migration/mod.rs new file mode 100644 index 0000000000..d3ccdf8d54 --- /dev/null +++ b/relay/kusama/src/ah_migration/mod.rs @@ -0,0 +1,20 @@ +// 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 . + +//! Asset Hub Migration. + +pub mod phase1; +pub mod weights; diff --git a/relay/kusama/src/ah_migration/phase1.rs b/relay/kusama/src/ah_migration/phase1.rs new file mode 100644 index 0000000000..cc8c643f18 --- /dev/null +++ b/relay/kusama/src/ah_migration/phase1.rs @@ -0,0 +1,177 @@ +// 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 . + +//! First phase of the Asset Hub Migration. + +use crate::*; +use frame_support::traits::Contains; +use pallet_rc_migrator::types::PortableFreezeReason; + +/// Contains all calls that are enabled during the migration. +pub struct CallsEnabledDuringMigration; +impl Contains<::RuntimeCall> for CallsEnabledDuringMigration { + fn contains(call: &::RuntimeCall) -> bool { + let (during, _after) = call_allowed_status(call); + if !during { + log::warn!("Call bounced by the filter during the migration: {:?}", call); + } + during + } +} + +/// Contains all calls that are enabled after the migration. +pub struct CallsEnabledAfterMigration; +impl Contains<::RuntimeCall> for CallsEnabledAfterMigration { + fn contains(call: &::RuntimeCall) -> bool { + let (_during, after) = call_allowed_status(call); + if !after { + log::warn!("Call bounced by the filter after the migration: {:?}", call); + } + after + } +} + +/// The hold reason for staking delegation. +pub struct StakingDelegationReason; +impl Get for StakingDelegationReason { + fn get() -> RuntimeHoldReason { + RuntimeHoldReason::DelegatedStaking(pallet_delegated_staking::HoldReason::StakingDelegation) + } +} + +/// Return whether a call should be enabled during and/or after the migration. +/// +/// Time line of the migration looks like this: +/// +/// --------|-----------|---------> +/// Start End +/// +/// We now define 2 periods: +/// +/// 1. During the migration: [Start, End] +/// 2. After the migration: (End, ∞) +/// +/// Visually: +/// +/// ```text +/// |-----1-----| +/// |---2----> +/// --------|-----------|---------> +/// Start End +/// ``` +/// +/// This call returns a 2-tuple to indicate whether a call is enabled during these periods. +pub fn call_allowed_status(call: &::RuntimeCall) -> (bool, bool) { + use RuntimeCall::*; + const ON: bool = true; + const OFF: bool = false; + + match call { + System(..) => (ON, ON), // Remarks, root calls and `set_code` if we need for emergency. + Scheduler(..) => (OFF, OFF), // Only for governance, hence disabled. + Preimage(..) => (OFF, OFF), // Only for governance, hence disabled. + Babe(..) => (ON, ON), // For equivocation proof submissions; security relevant + Timestamp(..) => (ON, ON), // only `set` inherit + Indices(..) => (OFF, OFF), // Not needed anymore and migrated to AH. + Balances(..) => (OFF, ON), // Disabled during migration to avoid confusing externals. + Staking(..) => (OFF, OFF), + StakingAhClient(..) => (ON, ON), // Only permissioned calls and needed for the migration. + Session(..) => (ON, ON), // Does not affect any migrating pallet. + Grandpa(..) => (ON, ON), // For equivocation proof submissions; security relevant + Treasury(..) => (OFF, OFF), + ConvictionVoting(..) => (OFF, OFF), + Referenda(..) => (OFF, OFF), + Whitelist(..) => (OFF, OFF), + Claims(..) => (OFF, OFF), + Vesting(..) => (OFF, OFF), + Utility(..) => (ON, ON), // batching etc + Proxy(..) => (OFF, ON), // On after the migration to keep proxy accounts accessible. + Multisig(..) => (OFF, ON), // On after the migration to keep multisig accounts accessible. + Bounties(..) => (OFF, OFF), + ChildBounties(..) => (OFF, OFF), + ElectionProviderMultiPhase(..) => (OFF, OFF), + VoterList(..) => (OFF, OFF), + NominationPools(..) => (OFF, OFF), + FastUnstake(..) => (OFF, OFF), + Configuration(..) => (ON, ON), /* TODO allow this to be called by fellow origin during the migration https://github.com/polkadot-fellows/runtimes/pull/559#discussion_r1928794490 */ + ParasShared(parachains_shared::Call::__Ignore { .. }) => (ON, ON), // Has no calls + ParaInclusion(parachains_inclusion::Call::__Ignore { .. }) => (ON, ON), // Has no calls + ParaInherent(..) => (ON, ON), // only inherents + Paras(..) => (ON, ON), /* Only root and one security relevant call: */ + // `include_pvf_check_statement` + Initializer(..) => (ON, ON), // Only root calls. Fine to keep. + Hrmp(..) => (ON, ON), /* open close hrmp channels by parachains or root force. */ + // no concerns. + ParasDisputes(..) => (ON, ON), // Only a single root call. Fine to keep. + ParasSlashing(..) => (ON, ON), /* Security critical. If disabled there will be no */ + // slashes or offences generated for malicious + // validators. + OnDemandAssignmentProvider(..) => (OFF, ON), + Registrar(..) => (OFF, ON), + Slots(..) => (OFF, OFF), + Auctions(..) => (OFF, OFF), + Crowdloan( + crowdloan::Call::::dissolve { .. } | + crowdloan::Call::::refund { .. } | + crowdloan::Call::::withdraw { .. }, + ) => (OFF, ON), + Crowdloan(..) => (OFF, OFF), + Coretime(coretime::Call::::request_revenue_at { .. }) => (OFF, ON), + Coretime(..) => (ON, ON), // Only permissioned calls. + XcmPallet(..) => (ON, ON), // during migration can only send XCMs to other + MessageQueue(..) => (ON, ON), // contains non-permissioned service calls + AssetRate(..) => (OFF, OFF), + Beefy(..) => (ON, ON), // For reporting equivocation proofs; security relevant + RcMigrator(..) => (ON, ON), // Required for the migration, only permissioned calls + + // Kusama specific calls + Society(..) => (OFF, OFF), // migrating pallet + Recovery(..) => (OFF, OFF), // migrating pallet + Parameters(..) => (ON, ON), + FellowshipCollective(..) => (ON, ON), + FellowshipReferenda(..) => (ON, ON), + } + // Exhaustive match. Compiler ensures that we did not miss any. +} + +// Type safe mapping of RC hold reason to portable format. +impl pallet_rc_migrator::types::IntoPortable for RuntimeHoldReason { + type Portable = pallet_rc_migrator::types::PortableHoldReason; + + fn into_portable(self) -> Self::Portable { + use pallet_rc_migrator::types::PortableHoldReason; + + match self { + RuntimeHoldReason::Preimage(inner) => PortableHoldReason::Preimage(inner), + RuntimeHoldReason::DelegatedStaking(inner) => + PortableHoldReason::DelegatedStaking(inner), + RuntimeHoldReason::Staking(inner) => PortableHoldReason::Staking(inner), + RuntimeHoldReason::Session(inner) => PortableHoldReason::Session(inner), + RuntimeHoldReason::XcmPallet(inner) => PortableHoldReason::XcmPallet(inner), + } + } +} + +impl pallet_rc_migrator::types::IntoPortable for RuntimeFreezeReason { + type Portable = pallet_rc_migrator::types::PortableFreezeReason; + + fn into_portable(self) -> Self::Portable { + match self { + RuntimeFreezeReason::NominationPools(inner) => + PortableFreezeReason::NominationPools(inner), + } + } +} diff --git a/relay/kusama/src/ah_migration/weights.rs b/relay/kusama/src/ah_migration/weights.rs new file mode 100644 index 0000000000..655761fd80 --- /dev/null +++ b/relay/kusama/src/ah_migration/weights.rs @@ -0,0 +1,42 @@ +// 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 . + +use crate::*; +use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, +}; + +/// DB Weight config trait adapter for AH migrator pallet weights. +pub trait DbConfig { + type DbWeight: Get; +} + +/// DB Weight config type adapter for AH migrator pallet weights. +pub struct AhDbConfig; +impl DbConfig for AhDbConfig { + type DbWeight = RocksDbWeight; +} + +parameter_types! { + /// Asset Hub DB Weights. + /// + /// Copied from `asset_hub_polkadot::weights::RocksDbWeight`. + pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + }; +} diff --git a/relay/kusama/src/genesis_config_presets.rs b/relay/kusama/src/genesis_config_presets.rs index c2a715a961..ea34b40bff 100644 --- a/relay/kusama/src/genesis_config_presets.rs +++ b/relay/kusama/src/genesis_config_presets.rs @@ -16,6 +16,8 @@ //! Genesis configs presets for the Kusama runtime +extern crate alloc; + use crate::*; #[cfg(not(feature = "std"))] use alloc::format; diff --git a/relay/kusama/src/governance/mod.rs b/relay/kusama/src/governance/mod.rs index 5b68785104..f5d88d8dd4 100644 --- a/relay/kusama/src/governance/mod.rs +++ b/relay/kusama/src/governance/mod.rs @@ -26,7 +26,7 @@ use frame_system::EnsureRootWithSuccess; mod origins; pub use origins::{ pallet_custom_origins, AuctionAdmin, Fellows, FellowshipAdmin, FellowshipExperts, - FellowshipInitiates, FellowshipMasters, GeneralAdmin, LeaseAdmin, ReferendumCanceller, + FellowshipInitiates, FellowshipMasters, GeneralAdmin, LeaseAdmin, Origin, ReferendumCanceller, ReferendumKiller, Spender, StakingAdmin, Treasurer, WhitelistedCaller, }; mod tracks; diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 59b682af97..209c04630c 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -20,8 +20,12 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit. #![recursion_limit = "512"] +#[cfg(all(not(feature = "kusama-ahm"), feature = "on-chain-release-build"))] +compile_error!("Asset Hub migration requires the `kusama` feature"); + extern crate alloc; +use ah_migration::phase1 as ahm_phase1; use alloc::{ collections::{btree_map::BTreeMap, vec_deque::VecDeque}, vec, @@ -48,10 +52,10 @@ use frame_support::{ traits::{ fungible::HoldConsideration, tokens::{imbalance::ResolveTo, UnityOrOuterConversion}, - ConstU32, ConstU8, ConstUint, Contains, Currency, EitherOf, EitherOfDiverse, EnsureOrigin, - EnsureOriginWithArg, EverythingBut, FromContains, InstanceFilter, KeyOwnerProofSystem, + ConstU32, ConstU8, ConstUint, Currency, EitherOf, EitherOfDiverse, EnsureOrigin, + EnsureOriginWithArg, Equals, FromContains, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, OnUnbalanced, PrivilegeCmp, ProcessMessage, ProcessMessageError, - StorageMapShim, WithdrawReasons, + WithdrawReasons, }, weights::{ constants::{WEIGHT_PROOF_SIZE_PER_KB, WEIGHT_REF_TIME_PER_MICROS}, @@ -65,11 +69,11 @@ use kusama_runtime_constants::{proxy::ProxyType, system_parachain::coretime::TIM pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::{Call as EPMCall, GeometricDepositBase}; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; -use pallet_nis::WithMaximumOf; use pallet_session::historical as session_historical; use pallet_staking::UseValidatorsMap; use pallet_transaction_payment::{FeeDetails, FungibleAdapter, RuntimeDispatchInfo}; use pallet_treasury::TreasuryAccountId; +use pallet_xcm::EnsureXcm; use polkadot_primitives::{ slashing, vstaging::{ @@ -130,6 +134,7 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use xcm::prelude::*; use xcm_builder::PayOverXcm; +use xcm_config::AssetHubLocation; use xcm_runtime_apis::{ dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects}, fees::Error as XcmPaymentApiError, @@ -158,6 +163,8 @@ mod past_payouts; // XCM configurations. pub mod xcm_config; +pub mod ah_migration; + // Governance configurations. pub mod governance; use governance::{ @@ -200,14 +207,6 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -/// Contains `Nis` and `NisCounterpartBalances` pallets calls. -pub struct NisCalls; -impl Contains for NisCalls { - fn contains(call: &RuntimeCall) -> bool { - matches!(call, RuntimeCall::Nis(..) | RuntimeCall::NisCounterpartBalances(..)) - } -} - parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const SS58Prefix: u8 = 2; @@ -215,7 +214,7 @@ parameter_types! { impl frame_system::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BaseCallFilter = EverythingBut; + type BaseCallFilter = RcMigrator; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type RuntimeOrigin = RuntimeOrigin; @@ -248,6 +247,7 @@ impl frame_system::Config for Runtime { parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; + pub ZeroWeight: Weight = Weight::zero(); pub const MaxScheduledPerBlock: u32 = 50; pub const NoPreimagePostponement: Option = Some(10); } @@ -275,7 +275,8 @@ impl pallet_scheduler::Config for Runtime { type RuntimeEvent = RuntimeEvent; type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; - type MaximumWeight = MaximumSchedulerWeight; + type MaximumWeight = + pallet_rc_migrator::types::LeftOrRight; // The goal of having ScheduleOrigin include AuctionAdmin is to allow the auctions track of // OpenGov to schedule periodic auctions. // Also allow Treasurer to schedule recurring payments. @@ -484,7 +485,7 @@ impl pallet_timestamp::Config for Runtime { impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type EventHandler = Staking; + type EventHandler = StakingAhClient; } impl_opaque_keys! { @@ -504,14 +505,12 @@ parameter_types! { } impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = AccountId; type ValidatorIdOf = ConvertInto; type ShouldEndSession = Babe; type NextSessionRotation = Babe; - type SessionManager = pallet_session::historical::NoteHistoricalRoot; + type SessionManager = session_historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = weights::pallet_session::WeightInfo; @@ -594,7 +593,6 @@ impl onchain::Config for OnChainSeqPhragmen { } impl pallet_election_provider_multi_phase::MinerConfig for Runtime { - type MaxBackersPerWinner = MaxBackersPerWinner; type AccountId = AccountId; type MaxLength = OffchainSolutionLengthLimit; type MaxWeight = OffchainSolutionWeightLimit; @@ -619,7 +617,6 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime { } impl pallet_election_provider_multi_phase::Config for Runtime { - type MaxBackersPerWinner = MaxBackersPerWinner; type RuntimeEvent = RuntimeEvent; type Currency = Balances; type EstimateCallFee = TransactionPayment; @@ -640,7 +637,6 @@ impl pallet_election_provider_multi_phase::Config for Runtime { type BetterSignedThreshold = (); type OffchainRepeat = OffchainRepeat; type MinerTxPriority = NposSolutionPriority; - type MaxWinners = MaxWinnersPerPage; type MaxBackersPerWinner = MaxBackersPerWinner; type DataProvider = Staking; #[cfg(any(feature = "fast-runtime", feature = "runtime-benchmarks"))] @@ -668,7 +664,6 @@ impl pallet_election_provider_multi_phase::Config for Runtime { parameter_types! { pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS; - pub const AutoRebagNumber: u32 = 10; } type VoterBagsListInstance = pallet_bags_list::Instance1; @@ -677,7 +672,6 @@ impl pallet_bags_list::Config for Runtime { type ScoreProvider = Staking; type WeightInfo = weights::pallet_bags_list::WeightInfo; type BagThresholds = BagThresholds; - type MaxAutoRebagPerBlock = AutoRebagNumber; type Score = sp_npos_elections::VoteWeight; #[cfg(feature = "runtime-benchmarks")] type MaxAutoRebagPerBlock = ConstU32<5>; @@ -809,7 +803,7 @@ impl pallet_staking::EraPayout for EraPayout { let params = relay_common::EraPayoutParams { total_staked, - total_stakable: Nis::issuance().other, + total_stakable: 0, // TODO: double check ideal_stake: dynamic_params::inflation::IdealStake::get(), max_annual_inflation: dynamic_params::inflation::MaxInflation::get(), min_annual_inflation: dynamic_params::inflation::MinInflation::get(), @@ -860,7 +854,6 @@ parameter_types! { } impl pallet_staking::Config for Runtime { - type MaxValidatorSet = MaxActiveValidators; type OldCurrency = Balances; type Currency = Balances; type CurrencyBalance = Balance; @@ -891,7 +884,7 @@ impl pallet_staking::Config for Runtime { type BenchmarkingConfig = polkadot_runtime_common::StakingBenchmarkingConfig; type EventListeners = (NominationPools, DelegatedStaking); type WeightInfo = weights::pallet_staking::WeightInfo; - type Filter = (); + type Filter = pallet_nomination_pools::AllPoolMembers; } impl pallet_fast_unstake::Config for Runtime { @@ -902,7 +895,10 @@ impl pallet_fast_unstake::Config for Runtime { type ControlOrigin = EnsureRoot; type Staking = Staking; type MaxErasToCheckPerBlock = ConstU32<1>; - type WeightInfo = weights::pallet_fast_unstake::WeightInfo; + type WeightInfo = pallet_rc_migrator::types::MaxOnIdleOrInner< + RcMigrator, + weights::pallet_fast_unstake::WeightInfo, + >; } parameter_types! { @@ -910,6 +906,7 @@ parameter_types! { pub const ProposalBondMinimum: Balance = 2000 * CENTS; pub const ProposalBondMaximum: Balance = GRAND; pub const SpendPeriod: BlockNumber = 6 * DAYS; + pub const DisableSpends: BlockNumber = BlockNumber::MAX; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const PayoutSpendPeriod: BlockNumber = 90 * DAYS; // The asset's interior location for the paying account. This is the Treasury @@ -956,12 +953,24 @@ impl Get for TreasuryBurnHandler { } } +pub type TreasuryPaymaster = PayOverXcm< + TreasuryInteriorLocation, + crate::xcm_config::XcmRouter, + crate::XcmPallet, + ConstU32<{ 6 * HOURS }>, + ::Beneficiary, + ::AssetKind, + LocatableAssetConverter, + VersionedLocationConverter, +>; + impl pallet_treasury::Config for Runtime { type PalletId = TreasuryPalletId; type Currency = Balances; type RejectOrigin = EitherOfDiverse, Treasurer>; type RuntimeEvent = RuntimeEvent; - type SpendPeriod = SpendPeriod; + type SpendPeriod = + pallet_rc_migrator::types::LeftOrRight; type Burn = TreasuryBurnHandler; type BurnDestination = TreasuryBurnHandler; type MaxApprovals = MaxApprovals; @@ -971,16 +980,7 @@ impl pallet_treasury::Config for Runtime { type AssetKind = VersionedLocatableAsset; type Beneficiary = VersionedLocation; type BeneficiaryLookup = IdentityLookup; - type Paymaster = PayOverXcm< - TreasuryInteriorLocation, - crate::xcm_config::XcmRouter, - crate::XcmPallet, - ConstU32<{ 6 * HOURS }>, - Self::Beneficiary, - Self::AssetKind, - LocatableAssetConverter, - VersionedLocationConverter, - >; + type Paymaster = TreasuryPaymaster; type BalanceConverter = AssetRateWithNative; type PayoutPeriod = PayoutSpendPeriod; #[cfg(feature = "runtime-benchmarks")] @@ -1029,8 +1029,8 @@ impl pallet_child_bounties::Config for Runtime { impl pallet_offences::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type IdentificationTuple = session_historical::IdentificationTuple; - type OnOffenceHandler = Staking; + type IdentificationTuple = pallet_session::historical::IdentificationTuple; + type OnOffenceHandler = StakingAhClient; } impl pallet_authority_discovery::Config for Runtime { @@ -1172,7 +1172,6 @@ impl pallet_multisig::Config for Runtime { parameter_types! { pub const ConfigDepositBase: Balance = 500 * CENTS; pub const FriendDepositFactor: Balance = 50 * CENTS; - pub const MaxFriends: u16 = 9; pub const RecoveryDeposit: Balance = 500 * CENTS; } @@ -1183,7 +1182,7 @@ impl pallet_recovery::Config for Runtime { type Currency = Balances; type ConfigDepositBase = ConfigDepositBase; type FriendDepositFactor = FriendDepositFactor; - type MaxFriends = MaxFriends; + type MaxFriends = ConstU32<9>; type RecoveryDeposit = RecoveryDeposit; type BlockNumberProvider = System; } @@ -1256,7 +1255,13 @@ parameter_types! { MaxEncodedLen, Default, )] -pub struct TransparentProxyType(ProxyType); +pub struct TransparentProxyType(pub ProxyType); + +impl Into for TransparentProxyType { + fn into(self) -> ProxyType { + self.0 + } +} impl scale_info::TypeInfo for TransparentProxyType { type Identity = ::Identity; @@ -1307,7 +1312,6 @@ impl InstanceFilter for TransparentProxyType { RuntimeCall::Scheduler(..) | RuntimeCall::Proxy(..) | RuntimeCall::Multisig(..) | - RuntimeCall::Nis(..) | RuntimeCall::Registrar(paras_registrar::Call::register {..}) | RuntimeCall::Registrar(paras_registrar::Call::deregister {..}) | // Specifically omitting Registrar `swap` @@ -1423,7 +1427,7 @@ impl parachains_inclusion::Config for Runtime { type RuntimeEvent = RuntimeEvent; type DisputesHandler = ParasDisputes; type RewardValidators = - parachains_reward_points::RewardValidatorsWithEraPoints; + parachains_reward_points::RewardValidatorsWithEraPoints; type MessageQueue = MessageQueue; type WeightInfo = weights::runtime_parachains_inclusion::WeightInfo; } @@ -1588,7 +1592,7 @@ impl parachains_initializer::Config for Runtime { impl parachains_disputes::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RewardValidators = - parachains_reward_points::RewardValidatorsWithEraPoints; + parachains_reward_points::RewardValidatorsWithEraPoints; type SlashingHandler = parachains_slashing::SlashValidatorsForDisputes; type WeightInfo = weights::runtime_parachains_disputes::WeightInfo; } @@ -1679,65 +1683,6 @@ impl auctions::Config for Runtime { type WeightInfo = weights::polkadot_runtime_common_auctions::WeightInfo; } -type NisCounterpartInstance = pallet_balances::Instance2; -impl pallet_balances::Config for Runtime { - type Balance = Balance; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ConstU128<10_000_000_000>; // One KTC cent - type AccountStore = StorageMapShim< - pallet_balances::Account, - AccountId, - pallet_balances::AccountData, - >; - type MaxLocks = ConstU32<4>; - type MaxReserves = ConstU32<4>; - type ReserveIdentifier = [u8; 8]; - type WeightInfo = weights::pallet_balances_nis_counterpart::WeightInfo; - type RuntimeHoldReason = RuntimeHoldReason; - type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = (); - type MaxFreezes = ConstU32<1>; - type DoneSlashHandler = (); -} - -parameter_types! { - pub const NisBasePeriod: BlockNumber = 7 * DAYS; - pub const MinBid: Balance = 100 * QUID; - pub MinReceipt: Perquintill = Perquintill::from_rational(1u64, 10_000_000u64); - pub const IntakePeriod: BlockNumber = 5 * MINUTES; - pub MaxIntakeWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10; - pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5); - pub storage NisTarget: Perquintill = Perquintill::zero(); - pub const NisPalletId: PalletId = PalletId(*b"py/nis "); -} - -impl pallet_nis::Config for Runtime { - type WeightInfo = weights::pallet_nis::WeightInfo; - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type CurrencyBalance = Balance; - type FundOrigin = frame_system::EnsureSigned; - type Counterpart = NisCounterpartBalances; - type CounterpartAmount = WithMaximumOf>; - type Deficit = (); // Mint - type IgnoredIssuance = (); - type Target = NisTarget; - type PalletId = NisPalletId; - type QueueCount = ConstU32<500>; - type MaxQueueLen = ConstU32<1000>; - type FifoQueueLen = ConstU32<250>; - type BasePeriod = NisBasePeriod; - type MinBid = MinBid; - type MinReceipt = MinReceipt; - type IntakePeriod = IntakePeriod; - type MaxIntakeWeight = MaxIntakeWeight; - type ThawThrottle = ThawThrottle; - type RuntimeHoldReason = RuntimeHoldReason; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkSetup = (); -} - parameter_types! { pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls"); pub const MaxPointsToBalance: u8 = 10; @@ -1760,7 +1705,7 @@ impl pallet_nomination_pools::Config for Runtime { type PalletId = PoolsPalletId; type MaxPointsToBalance = MaxPointsToBalance; type AdminOrigin = EitherOf, StakingAdmin>; - type Filter = (); + type Filter = pallet_staking::AllStakers; type BlockNumberProvider = System; } @@ -1780,6 +1725,117 @@ impl pallet_delegated_staking::Config for Runtime { type CoreStaking = Staking; } +impl pallet_staking_async_ah_client::Config for Runtime { + type CurrencyBalance = Balance; + type AssetHubOrigin = + frame_support::traits::EitherOfDiverse, EnsureAssetHub>; + type AdminOrigin = EnsureRoot; + type SessionInterface = Self; + type SendToAssetHub = StakingXcmToAssetHub; + type MinimumValidatorSetSize = ConstU32<400>; + type UnixTime = Timestamp; + type PointsPerBlock = ConstU32<20>; + type MaxOffenceBatchSize = ConstU32<50>; + type Fallback = Staking; + type WeightInfo = pallet_staking_async_ah_client::weights::SubstrateWeight; +} + +pub struct EnsureAssetHub; +impl frame_support::traits::EnsureOrigin for EnsureAssetHub { + type Success = (); + fn try_origin(o: RuntimeOrigin) -> Result { + match >>::into( + o.clone(), + ) { + Ok(parachains_origin::Origin::Parachain(id)) + if id == kusama_runtime_constants::system_parachain::ASSET_HUB_ID.into() => + Ok(()), + _ => Err(o), + } + } + + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin() -> Result { + Ok(RuntimeOrigin::root()) + } +} + +#[derive(Encode, Decode)] +enum AssetHubRuntimePallets { + #[codec(index = 84)] + RcClient(RcClientCalls), +} + +#[derive(Encode, Decode)] +enum RcClientCalls { + #[codec(index = 0)] + RelaySessionReport(pallet_staking_async_rc_client::SessionReport), + #[codec(index = 1)] + RelayNewOffence(SessionIndex, Vec>), +} + +pub struct SessionReportToXcm; +impl sp_runtime::traits::Convert, Xcm<()>> + for SessionReportToXcm +{ + fn convert(a: pallet_staking_async_rc_client::SessionReport) -> Xcm<()> { + Xcm(vec![ + Instruction::UnpaidExecution { + weight_limit: WeightLimit::Unlimited, + check_origin: None, + }, + Instruction::Transact { + origin_kind: OriginKind::Superuser, + fallback_max_weight: None, + call: AssetHubRuntimePallets::RcClient(RcClientCalls::RelaySessionReport(a)) + .encode() + .into(), + }, + ]) + } +} + +pub struct StakingXcmToAssetHub; +impl pallet_staking_async_ah_client::SendToAssetHub for StakingXcmToAssetHub { + type AccountId = AccountId; + + fn relay_session_report( + session_report: pallet_staking_async_rc_client::SessionReport, + ) { + pallet_staking_async_rc_client::XCMSender::< + xcm_config::XcmRouter, + AssetHubLocation, + pallet_staking_async_rc_client::SessionReport, + SessionReportToXcm, + >::split_then_send(session_report, Some(8)); + } + + fn relay_new_offence( + session_index: SessionIndex, + offences: Vec>, + ) { + let message = Xcm(vec![ + Instruction::UnpaidExecution { + weight_limit: WeightLimit::Unlimited, + check_origin: None, + }, + Instruction::Transact { + origin_kind: OriginKind::Superuser, + fallback_max_weight: None, + call: AssetHubRuntimePallets::RcClient(RcClientCalls::RelayNewOffence( + session_index, + offences, + )) + .encode() + .into(), + }, + ]); + if let Err(err) = send_xcm::(AssetHubLocation::get(), message) { + log::error!(target: "runtime::ah-client", "Failed to send relay offence message: {:?}", err); + } + } +} + /// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the /// `AssetRate` pallet instance. /// @@ -1807,13 +1863,56 @@ impl pallet_asset_rate::Config for Runtime { type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments; } -impl frame_system::offchain::CreateBare for Runtime -where - RuntimeCall: From, -{ - fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic { - UncheckedExtrinsic::new_bare(call) - } +// Derived from `kusama_asset_hub_runtime::RuntimeBlockWeights`. +const AH_MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), + polkadot_primitives::MAX_POV_SIZE as u64, +); + +parameter_types! { + // Exvivalent to `kusama_asset_hub_runtime::MessageQueueServiceWeight`. + pub AhMqServiceWeight: Weight = Perbill::from_percent(50) * AH_MAXIMUM_BLOCK_WEIGHT; + // 80 percent of the `AhMqServiceWeight` to leave some space for XCM message base processing. + pub AhMigratorMaxWeight: Weight = Perbill::from_percent(80) * AhMqServiceWeight::get(); + pub RcMigratorMaxWeight: Weight = Perbill::from_percent(60) * BlockWeights::get().max_block; + pub AhExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT / 100; + pub const XcmResponseTimeout: BlockNumber = 30 * DAYS; + pub const AhUmpQueuePriorityPattern: (BlockNumber, BlockNumber) = (18, 2); +} + +impl pallet_rc_migrator::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type RuntimeEvent = RuntimeEvent; + type AdminOrigin = EitherOfDiverse< + EnsureRoot, + EitherOfDiverse, Location>>, + >; + type Currency = Balances; + type CheckingAccount = xcm_config::CheckAccount; + type TreasuryBlockNumberProvider = System; + type TreasuryPaymaster = TreasuryPaymaster; + type SendXcm = xcm_config::XcmRouterWithoutException; + type MaxRcWeight = RcMigratorMaxWeight; + type MaxAhWeight = AhMigratorMaxWeight; + type AhExistentialDeposit = AhExistentialDeposit; + type RcWeightInfo = weights::pallet_rc_migrator::WeightInfo; + type AhWeightInfo = weights::pallet_ah_migrator::WeightInfo; + type RcIntraMigrationCalls = ahm_phase1::CallsEnabledDuringMigration; + type RcPostMigrationCalls = ahm_phase1::CallsEnabledAfterMigration; + type StakingDelegationReason = ahm_phase1::StakingDelegationReason; + type OnDemandPalletId = OnDemandPalletId; + type UnprocessedMsgBuffer = ConstU32<50>; + type XcmResponseTimeout = XcmResponseTimeout; + type MessageQueue = MessageQueue; + type AhUmpQueuePriorityPattern = AhUmpQueuePriorityPattern; + type SessionDuration = EpochDuration; // Session == Epoch + #[cfg(feature = "kusama-ahm")] + type KusamaConfig = Runtime; + #[cfg(feature = "kusama-ahm")] + type RecoveryBlockNumberProvider = System; } construct_runtime! { @@ -1890,9 +1989,9 @@ construct_runtime! { // Election pallet. Only works with staking, but placed here to maintain indices. ElectionProviderMultiPhase: pallet_election_provider_multi_phase = 37, - // NIS pallet. - Nis: pallet_nis = 38, - NisCounterpartBalances: pallet_balances:: = 45, + // NIS pallets removed. + // Nis: pallet_nis = 38, + // NisCounterpartBalances: pallet_balances:: = 45, // Provides a semi-sorted list of nominators for staking. VoterList: pallet_bags_list:: = 39, @@ -1906,6 +2005,8 @@ construct_runtime! { // Staking extension for delegation DelegatedStaking: pallet_delegated_staking = 47, + StakingAhClient: pallet_staking_async_ah_client = 48, + // Parachains pallets. Start indices at 50 to leave room. ParachainsOrigin: parachains_origin = 50, Configuration: parachains_configuration = 51, @@ -1945,6 +2046,20 @@ construct_runtime! { // refer to block. See issue #160 for details. Mmr: pallet_mmr = 201, BeefyMmrLeaf: pallet_beefy_mmr = 202, + + // Relay Chain Migrator + // The pallet must be located below `MessageQueue` to get the XCM message acknowledgements + // from Asset Hub before we get the `RcMigrator` `on_initialize` executed. + RcMigrator: pallet_rc_migrator = 255, + } +} + +impl frame_system::offchain::CreateBare for Runtime +where + RuntimeCall: From, +{ + fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_bare(call) } } @@ -2040,7 +2155,6 @@ mod benches { [runtime_parachains::coretime, Coretime] // Substrate [pallet_balances, Native] - [pallet_balances, NisCounterpart] [pallet_bags_list, VoterList] [pallet_beefy_mmr, BeefyMmrLeaf] [frame_benchmarking::baseline, Baseline::] @@ -2050,7 +2164,6 @@ mod benches { [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] [frame_election_provider_support, ElectionProviderBench::] [pallet_fast_unstake, FastUnstake] - [pallet_nis, Nis] [pallet_indices, Indices] [pallet_message_queue, MessageQueue] [pallet_multisig, Multisig] @@ -2076,13 +2189,15 @@ mod benches { [pallet_whitelist, Whitelist] [pallet_asset_rate, AssetRate] [pallet_parameters, Parameters] + [pallet_rc_migrator, RcMigrator] // XCM [pallet_xcm, PalletXcmExtrinsicsBenchmark::] [pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::] [pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::] ); + use xcm_builder::MintLocation; use xcm_config::{ - AssetHubLocation, LocalCheckAccount, SovereignAccountOf, TokenLocation, XcmConfig, + AssetHubLocation, SovereignAccountOf, TeleportTracking, TokenLocation, XcmConfig, }; impl pallet_session_benchmarking::Config for Runtime {} @@ -2184,6 +2299,7 @@ mod benches { Asset { fun: Fungible(UNITS), id: AssetId(TokenLocation::get()) }, )); pub const TrustedReserve: Option<(Location, Asset)> = None; + pub LocalCheckAccount: (AccountId, MintLocation) = TeleportTracking::get().unwrap(); } impl pallet_xcm_benchmarks::fungible::Config for Runtime { @@ -2266,7 +2382,6 @@ mod benches { } pub type Native = pallet_balances::Pallet; - pub type NisCounterpart = pallet_balances::Pallet; pub use frame_benchmarking::{ baseline::Pallet as Baseline, BenchmarkBatch, BenchmarkError, BenchmarkList, }; @@ -2291,7 +2406,6 @@ impl Runtime { let (staked, _start) = ActiveEra::::get() .map(|ae| (ErasTotalStake::::get(ae.index), ae.start.unwrap_or(0))) .unwrap_or((0, 0)); - let stake_able_issuance = Nis::issuance().other; let ideal_staking_rate = dynamic_params::inflation::IdealStake::get(); let inflation = if dynamic_params::inflation::UseAuctionSlots::get() { @@ -2309,11 +2423,8 @@ impl Runtime { // We assume un-delayed 6h eras. let era_duration = 6 * (HOURS as Moment) * MILLISECS_PER_BLOCK; - let next_mint = ::EraPayout::era_payout( - staked, - stake_able_issuance, - era_duration, - ); + let next_mint = + ::EraPayout::era_payout(staked, 0, era_duration); InflationInfo { inflation, next_mint } } @@ -3262,7 +3373,7 @@ mod remote_tests { (pallet_staking::ErasTotalStake::::get(ae.index), ae.start.unwrap()) }) .unwrap(); - let total_issuance = Nis::issuance().other; + let total_issuance = 0; let _real_era_duration_millis = pallet_timestamp::Now::::get().saturating_sub(started); // 6h in milliseconds diff --git a/relay/kusama/src/tests.rs b/relay/kusama/src/tests.rs index ae83ea77b8..2e5e6b4e71 100644 --- a/relay/kusama/src/tests.rs +++ b/relay/kusama/src/tests.rs @@ -26,11 +26,6 @@ use sp_core::hexdisplay::HexDisplay; use sp_keyring::Sr25519Keyring::Charlie; use std::collections::HashSet; -#[test] -fn nis_hold_reason_encoding_is_correct() { - assert_eq!(RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt).encode(), [38, 0]); -} - #[test] fn remove_keys_weight_is_sensible() { use polkadot_runtime_common::crowdloan::WeightInfo; diff --git a/relay/kusama/src/weights/mod.rs b/relay/kusama/src/weights/mod.rs index 8473d92043..35c1f68514 100644 --- a/relay/kusama/src/weights/mod.rs +++ b/relay/kusama/src/weights/mod.rs @@ -18,10 +18,10 @@ pub mod frame_election_provider_support; pub mod frame_system; pub mod frame_system_extensions; +pub mod pallet_ah_migrator; pub mod pallet_asset_rate; pub mod pallet_bags_list; pub mod pallet_balances_native; -pub mod pallet_balances_nis_counterpart; pub mod pallet_beefy_mmr; pub mod pallet_bounties; pub mod pallet_child_bounties; @@ -31,12 +31,12 @@ pub mod pallet_fast_unstake; pub mod pallet_indices; pub mod pallet_message_queue; pub mod pallet_multisig; -pub mod pallet_nis; pub mod pallet_nomination_pools; pub mod pallet_parameters; pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_ranked_collective; +pub mod pallet_rc_migrator; pub mod pallet_referenda_fellowship_referenda; pub mod pallet_referenda_referenda; pub mod pallet_scheduler; diff --git a/relay/kusama/src/weights/pallet_ah_migrator.rs b/relay/kusama/src/weights/pallet_ah_migrator.rs new file mode 100644 index 0000000000..3014ac2e75 --- /dev/null +++ b/relay/kusama/src/weights/pallet_ah_migrator.rs @@ -0,0 +1,588 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_ah_migrator` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Olivers-MacBook-Pro.local`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// ./target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --extrinsic +// +// --pallet +// pallet_ah_migrator +// --heap-pages +// 4096 +// --header=.github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_ah_migrator`. +pub struct WeightInfo(PhantomData); +impl pallet_rc_migrator::weights_ah::WeightInfo for WeightInfo { + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_multisigs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(1_209_456, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 52_135 + .saturating_add(Weight::from_parts(12_733_708, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:255 w:255) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:255 w:255) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:255 w:255) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_accounts(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `34309 + n * (1050 ±0)` + // Estimated: `990 + n * (3774 ±0)` + // Minimum execution time: 73_000_000 picoseconds. + Weight::from_parts(80_000_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 73_945 + .saturating_add(Weight::from_parts(76_965_383, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_liquid_accounts(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(24_804_997, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 27_336 + .saturating_add(Weight::from_parts(20_362_852, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `Claims::Vesting` (r:255 w:255) + /// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_claims(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `43` + // Estimated: `990 + n * (2531 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(3_676_051, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 2_688 + .saturating_add(Weight::from_parts(1_785_633, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) + } + /// Storage: `Proxy::Proxies` (r:255 w:255) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_proxy_proxies(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `990 + n * (3716 ±0)` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(2_817_412, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 4_759 + .saturating_add(Weight::from_parts(3_309_148, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3716).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_proxy_announcements(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(12_384_963, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 10_748 + .saturating_add(Weight::from_parts(13_324_647, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `Vesting::Vesting` (r:255 w:255) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Vesting::StorageVersion` (r:0 w:1) + /// Proof: `Vesting::StorageVersion` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_vesting_schedules(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `204` + // Estimated: `990 + n * (3532 ±0)` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(3_815_323, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 4_616 + .saturating_add(Weight::from_parts(3_021_115, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3532).saturating_mul(n.into())) + } + /// Storage: `NominationPools::SubPoolsStorage` (r:255 w:255) + /// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForSubPoolsStorage` (r:1 w:1) + /// Proof: `NominationPools::CounterForSubPoolsStorage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_nom_pools_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `264` + // Estimated: `1489 + n * (3672 ±0)` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(6_643_805, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 4_391 + .saturating_add(Weight::from_parts(3_998_668, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3672).saturating_mul(n.into())) + } + /// Storage: `Referenda::DecidingCount` (r:0 w:16) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumCount` (r:0 w:1) + /// Proof: `Referenda::ReferendumCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:0 w:16) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + fn receive_referenda_values() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 35_000_000 picoseconds. + Weight::from_parts(40_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(33)) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:0 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// The range of component `m` is `[1, 4000000]`. + fn receive_single_active_referendums(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `144 + m * (1 ±0)` + // Estimated: `3609 + m * (1 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(8_000_000, 0) + .saturating_add(Weight::from_parts(0, 3609)) + // Standard Error: 8 + .saturating_add(Weight::from_parts(1_833, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(m.into())) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:0 w:255) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_complete_referendums(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 5_956 + .saturating_add(Weight::from_parts(1_248_838, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:0 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// The range of component `m` is `[1, 4000000]`. + fn receive_single_scheduler_agenda(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `144 + m * (1 ±0)` + // Estimated: `3609 + m * (1 ±0)` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) + .saturating_add(Weight::from_parts(0, 3609)) + // Standard Error: 8 + .saturating_add(Weight::from_parts(1_856, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(m.into())) + } + /// Storage: `Scheduler::Lookup` (r:0 w:255) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_scheduler_lookup(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(3_463_733, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 3_062 + .saturating_add(Weight::from_parts(1_021_975, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `VoterList::ListNodes` (r:255 w:255) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_bags_list_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16209 + n * (485 ±0)` + // Estimated: `1489 + n * (2629 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(36_930_358, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 8_966 + .saturating_add(Weight::from_parts(5_007_274, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2629).saturating_mul(n.into())) + } + /// Storage: `Indices::Accounts` (r:255 w:255) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_indices(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `990 + n * (2544 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 4_300 + .saturating_add(Weight::from_parts(2_061_139, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2544).saturating_mul(n.into())) + } + /// Storage: `ConvictionVoting::VotingFor` (r:0 w:255) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_conviction_voting_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(29_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 40_484 + .saturating_add(Weight::from_parts(21_227_919, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Bounties::Bounties` (r:0 w:255) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_bounties_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(3_125_181, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 2_947 + .saturating_add(Weight::from_parts(1_166_082, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `AssetRate::ConversionRateToNative` (r:0 w:255) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_asset_rates(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(2_503_595, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 6_148 + .saturating_add(Weight::from_parts(2_154_128, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `AhOps::RcCrowdloanContribution` (r:255 w:255) + /// Proof: `AhOps::RcCrowdloanContribution` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_crowdloan_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `990 + n * (2587 ±0)` + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_594_335, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 42_852 + .saturating_add(Weight::from_parts(5_324_762, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2587).saturating_mul(n.into())) + } + /// Storage: `Referenda::MetadataOf` (r:0 w:255) + /// Proof: `Referenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_referenda_metadata(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(3_324_055, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 4_675 + .saturating_add(Weight::from_parts(1_050_250, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Treasury::Spends` (r:0 w:255) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(2456), added: 4931, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_treasury_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(87_407, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 44_241 + .saturating_add(Weight::from_parts(4_257_705, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `DelegatedStaking::Agents` (r:255 w:255) + /// Proof: `DelegatedStaking::Agents` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) + /// Storage: `DelegatedStaking::CounterForAgents` (r:1 w:1) + /// Proof: `DelegatedStaking::CounterForAgents` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_delegated_staking_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `1489 + n * (2595 ±0)` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(3_965_017, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 9_028 + .saturating_add(Weight::from_parts(2_776_513, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2595).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_preimage_legacy_status(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 51_019 + .saturating_add(Weight::from_parts(13_337_869, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `Preimage::RequestStatusFor` (r:255 w:0) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_preimage_request_status(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `57 + n * (47 ±0)` + // Estimated: `990 + n * (2566 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(6_136_012, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 3_834 + .saturating_add(Weight::from_parts(2_065_009, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into())) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// The range of component `m` is `[1, 80]`. + fn receive_preimage_chunk(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + m * (49900 ±0)` + // Estimated: `3469 + m * (48969 ±24)` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) + .saturating_add(Weight::from_parts(0, 3469)) + // Standard Error: 122_813 + .saturating_add(Weight::from_parts(26_253_720, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 48969).saturating_mul(m.into())) + } + /// Storage: `ChildBounties::ChildBountyDescriptionsV1` (r:0 w:100) + /// Proof: `ChildBounties::ChildBountyDescriptionsV1` (`max_values`: None, `max_size`: Some(16412), added: 18887, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 100]`. + fn receive_child_bounties_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(5_131_873, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 85_675 + .saturating_add(Weight::from_parts(8_240_026, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Staking::UnappliedSlashes` (r:0 w:100) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(24735), added: 27210, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 100]`. + fn receive_staking_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(12_802_327, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 55_802 + .saturating_add(Weight::from_parts(5_900_033, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `AhMigrator::AhMigrationStage` (r:1 w:1) + /// Proof: `AhMigrator::AhMigrationStage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_set_stage() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1486` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(Weight::from_parts(0, 1486)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AhMigrator::AhMigrationStage` (r:1 w:1) + /// Proof: `AhMigrator::AhMigrationStage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `AhMigrator::AhBalancesBefore` (r:0 w:1) + /// Proof: `AhMigrator::AhBalancesBefore` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn start_migration() -> Weight { + // Proof Size summary in bytes: + // Measured: `1358` + // Estimated: `4823` + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) + .saturating_add(Weight::from_parts(0, 4823)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `AhMigrator::AhBalancesBefore` (r:1 w:0) + /// Proof: `AhMigrator::AhBalancesBefore` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: `AhMigrator::AhMigrationStage` (r:1 w:1) + /// Proof: `AhMigrator::AhMigrationStage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn finish_migration() -> Weight { + // Proof Size summary in bytes: + // Measured: `133` + // Estimated: `1517` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AhMigrator::DmpQueuePriorityConfig` (r:1 w:0) + /// Proof: `AhMigrator::DmpQueuePriorityConfig` (`max_values`: Some(1), `max_size`: Some(9), added: 504, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:0) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:0 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + fn force_dmp_queue_priority() -> Weight { + // Proof Size summary in bytes: + // Measured: `336` + // Estimated: `3517` + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AhMigrator::DmpQueuePriorityConfig` (r:1 w:1) + /// Proof: `AhMigrator::DmpQueuePriorityConfig` (`max_values`: Some(1), `max_size`: Some(9), added: 504, mode: `MaxEncodedLen`) + fn set_dmp_queue_priority() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1494` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) + .saturating_add(Weight::from_parts(0, 1494)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AhMigrator::Manager` (r:1 w:1) + /// Proof: `AhMigrator::Manager` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn set_manager() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1517` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/relay/kusama/src/weights/pallet_balances_nis_counterpart.rs b/relay/kusama/src/weights/pallet_balances_nis_counterpart.rs deleted file mode 100644 index 40b66567d6..0000000000 --- a/relay/kusama/src/weights/pallet_balances_nis_counterpart.rs +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md -// for a list of specific contributors. -// 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. - -//! Autogenerated weights for `pallet_balances` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 50.0.0 -//! DATE: 2025-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `db6e397ee4b2`, CPU: `QEMU Virtual CPU version 2.5+` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/staging-kusama-runtime/staging_kusama_runtime.wasm -// --pallet=pallet_balances -// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt -// --output=./relay/kusama/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_balances`. -pub struct WeightInfo(PhantomData); -impl pallet_balances::WeightInfo for WeightInfo { - /// Storage: `NisCounterpartBalances::Account` (r:2 w:2) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn transfer_allow_death() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6164` - // Minimum execution time: 64_360_000 picoseconds. - Weight::from_parts(66_160_000, 0) - .saturating_add(Weight::from_parts(0, 6164)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `NisCounterpartBalances::Account` (r:2 w:2) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn transfer_keep_alive() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6164` - // Minimum execution time: 50_379_000 picoseconds. - Weight::from_parts(51_949_000, 0) - .saturating_add(Weight::from_parts(0, 6164)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_set_balance_creating() -> Weight { - // Proof Size summary in bytes: - // Measured: `39` - // Estimated: `3593` - // Minimum execution time: 26_940_000 picoseconds. - Weight::from_parts(27_780_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_set_balance_killing() -> Weight { - // Proof Size summary in bytes: - // Measured: `277` - // Estimated: `3593` - // Minimum execution time: 26_640_000 picoseconds. - Weight::from_parts(28_360_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `NisCounterpartBalances::Account` (r:2 w:2) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_transfer() -> Weight { - // Proof Size summary in bytes: - // Measured: `206` - // Estimated: `6196` - // Minimum execution time: 67_549_000 picoseconds. - Weight::from_parts(69_820_000, 0) - .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `NisCounterpartBalances::Account` (r:2 w:2) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn transfer_all() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6164` - // Minimum execution time: 62_930_000 picoseconds. - Weight::from_parts(65_320_000, 0) - .saturating_add(Weight::from_parts(0, 6164)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn force_unreserve() -> Weight { - // Proof Size summary in bytes: - // Measured: `277` - // Estimated: `3593` - // Minimum execution time: 22_680_000 picoseconds. - Weight::from_parts(23_941_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `NisCounterpartBalances::Account` (r:999 w:999) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:999 w:999) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `u` is `[1, 1000]`. - /// The range of component `u` is `[1, 1000]`. - fn upgrade_accounts(u: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `0 + u * (256 ±0)` - // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 22_059_000 picoseconds. - Weight::from_parts(22_629_000, 0) - .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 31_712 - .saturating_add(Weight::from_parts(20_377_702, 0).saturating_mul(u.into())) - .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(u.into()))) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(u.into()))) - .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) - } - fn force_adjust_total_issuance() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 8_861_000 picoseconds. - Weight::from_parts(9_541_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - fn burn_allow_death() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `3577` - // Minimum execution time: 41_511_000 picoseconds. - Weight::from_parts(44_301_000, 0) - .saturating_add(Weight::from_parts(0, 3577)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - fn burn_keep_alive() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `3577` - // Minimum execution time: 27_981_000 picoseconds. - Weight::from_parts(29_891_000, 0) - .saturating_add(Weight::from_parts(0, 3577)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/relay/kusama/src/weights/pallet_nis.rs b/relay/kusama/src/weights/pallet_nis.rs deleted file mode 100644 index a4a31d28e8..0000000000 --- a/relay/kusama/src/weights/pallet_nis.rs +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md -// for a list of specific contributors. -// 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. - -//! Autogenerated weights for `pallet_nis` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 50.0.0 -//! DATE: 2025-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `db6e397ee4b2`, CPU: `QEMU Virtual CPU version 2.5+` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --extrinsic=* -// --runtime=target/production/wbuild/staging-kusama-runtime/staging_kusama_runtime.wasm -// --pallet=pallet_nis -// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt -// --output=./relay/kusama/src/weights -// --wasm-execution=compiled -// --steps=50 -// --repeat=20 -// --heap-pages=4096 - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_nis`. -pub struct WeightInfo(PhantomData); -impl pallet_nis::WeightInfo for WeightInfo { - /// Storage: `Nis::Queues` (r:1 w:1) - /// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`) - /// Storage: `Nis::QueueTotals` (r:1 w:1) - /// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(10002), added: 10497, mode: `MaxEncodedLen`) - /// The range of component `l` is `[0, 999]`. - fn place_bid(l: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `10247 + l * (48 ±0)` - // Estimated: `51487` - // Minimum execution time: 68_000_000 picoseconds. - Weight::from_parts(79_052_579, 0) - .saturating_add(Weight::from_parts(0, 51487)) - // Standard Error: 588 - .saturating_add(Weight::from_parts(75_012, 0).saturating_mul(l.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Nis::Queues` (r:1 w:1) - /// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`) - /// Storage: `Nis::QueueTotals` (r:1 w:1) - /// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(10002), added: 10497, mode: `MaxEncodedLen`) - fn place_bid_max() -> Weight { - // Proof Size summary in bytes: - // Measured: `58249` - // Estimated: `51487` - // Minimum execution time: 171_981_000 picoseconds. - Weight::from_parts(177_530_000, 0) - .saturating_add(Weight::from_parts(0, 51487)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Nis::Queues` (r:1 w:1) - /// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`) - /// Storage: `Nis::QueueTotals` (r:1 w:1) - /// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(10002), added: 10497, mode: `MaxEncodedLen`) - /// The range of component `l` is `[1, 1000]`. - fn retract_bid(l: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `10247 + l * (48 ±0)` - // Estimated: `51487` - // Minimum execution time: 65_140_000 picoseconds. - Weight::from_parts(70_879_136, 0) - .saturating_add(Weight::from_parts(0, 51487)) - // Standard Error: 442 - .saturating_add(Weight::from_parts(57_045, 0).saturating_mul(l.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Nis::Summary` (r:1 w:0) - /// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn fund_deficit() -> Weight { - // Proof Size summary in bytes: - // Measured: `225` - // Estimated: `3593` - // Minimum execution time: 42_510_000 picoseconds. - Weight::from_parts(44_250_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Nis::Receipts` (r:1 w:1) - /// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Nis::Summary` (r:1 w:1) - /// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - fn communify() -> Weight { - // Proof Size summary in bytes: - // Measured: `425` - // Estimated: `3622` - // Minimum execution time: 89_140_000 picoseconds. - Weight::from_parts(92_340_000, 0) - .saturating_add(Weight::from_parts(0, 3622)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: `Nis::Receipts` (r:1 w:1) - /// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - /// Storage: `Nis::Summary` (r:1 w:1) - /// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`) - fn privatize() -> Weight { - // Proof Size summary in bytes: - // Measured: `581` - // Estimated: `3622` - // Minimum execution time: 113_310_000 picoseconds. - Weight::from_parts(115_350_000, 0) - .saturating_add(Weight::from_parts(0, 3622)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: `Nis::Receipts` (r:1 w:1) - /// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - /// Storage: `Nis::Summary` (r:1 w:1) - /// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:0) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Balances::Holds` (r:1 w:1) - /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(157), added: 2632, mode: `MaxEncodedLen`) - fn thaw_private() -> Weight { - // Proof Size summary in bytes: - // Measured: `425` - // Estimated: `3622` - // Minimum execution time: 72_490_000 picoseconds. - Weight::from_parts(73_760_000, 0) - .saturating_add(Weight::from_parts(0, 3622)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Nis::Receipts` (r:1 w:1) - /// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - /// Storage: `Nis::Summary` (r:1 w:1) - /// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) - /// Storage: `NisCounterpartBalances::Account` (r:1 w:1) - /// Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn thaw_communal() -> Weight { - // Proof Size summary in bytes: - // Measured: `488` - // Estimated: `3593` - // Minimum execution time: 119_770_000 picoseconds. - Weight::from_parts(123_350_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `Nis::Summary` (r:1 w:1) - /// Proof: `Nis::Summary` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:0) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Nis::QueueTotals` (r:1 w:1) - /// Proof: `Nis::QueueTotals` (`max_values`: Some(1), `max_size`: Some(10002), added: 10497, mode: `MaxEncodedLen`) - fn process_queues() -> Weight { - // Proof Size summary in bytes: - // Measured: `10658` - // Estimated: `11487` - // Minimum execution time: 28_950_000 picoseconds. - Weight::from_parts(31_101_000, 0) - .saturating_add(Weight::from_parts(0, 11487)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Nis::Queues` (r:1 w:1) - /// Proof: `Nis::Queues` (`max_values`: None, `max_size`: Some(48022), added: 50497, mode: `MaxEncodedLen`) - fn process_queue() -> Weight { - // Proof Size summary in bytes: - // Measured: `76` - // Estimated: `51487` - // Minimum execution time: 6_890_000 picoseconds. - Weight::from_parts(7_400_000, 0) - .saturating_add(Weight::from_parts(0, 51487)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Nis::Receipts` (r:0 w:1) - /// Proof: `Nis::Receipts` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - fn process_bid() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 6_670_000 picoseconds. - Weight::from_parts(7_070_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/relay/kusama/src/weights/pallet_rc_migrator.rs b/relay/kusama/src/weights/pallet_rc_migrator.rs new file mode 100644 index 0000000000..861044fb56 --- /dev/null +++ b/relay/kusama/src/weights/pallet_rc_migrator.rs @@ -0,0 +1,159 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_rc_migrator` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 47.0.0 +//! DATE: 2025-05-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `f97dd9be0429`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/polkadot-runtime/polkadot_runtime.wasm +// --pallet=pallet_rc_migrator +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./relay/polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_rc_migrator`. +pub struct WeightInfo(PhantomData); +impl pallet_rc_migrator::WeightInfo for WeightInfo { + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `RcMigrator::RcAccounts` (r:1 w:0) + /// Proof: `RcMigrator::RcAccounts` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(193), added: 2668, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(103), added: 2578, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:0) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `RcMigrator::RcMigratedBalance` (r:1 w:1) + /// Proof: `RcMigrator::RcMigratedBalance` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn withdraw_account() -> Weight { + // Proof Size summary in bytes: + // Measured: `503` + // Estimated: `6196` + // Minimum execution time: 66_870_000 picoseconds. + Weight::from_parts(69_352_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `RcMigrator::RcMigrationStage` (r:1 w:1) + /// Proof: `RcMigrator::RcMigrationStage` (`max_values`: Some(1), `max_size`: Some(1208), added: 1703, mode: `MaxEncodedLen`) + fn force_set_stage() -> Weight { + // Proof Size summary in bytes: + // Measured: `4` + // Estimated: `2693` + // Minimum execution time: 17_011_000 picoseconds. + Weight::from_parts(18_290_000, 0) + .saturating_add(Weight::from_parts(0, 2693)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `RcMigrator::RcMigrationStage` (r:1 w:1) + /// Proof: `RcMigrator::RcMigrationStage` (`max_values`: Some(1), `max_size`: Some(1208), added: 1703, mode: `MaxEncodedLen`) + fn schedule_migration() -> Weight { + // Proof Size summary in bytes: + // Measured: `4` + // Estimated: `2693` + // Minimum execution time: 16_120_000 picoseconds. + Weight::from_parts(17_420_000, 0) + .saturating_add(Weight::from_parts(0, 2693)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `RcMigrator::RcMigrationStage` (r:1 w:1) + /// Proof: `RcMigrator::RcMigrationStage` (`max_values`: Some(1), `max_size`: Some(1208), added: 1703, mode: `MaxEncodedLen`) + fn start_data_migration() -> Weight { + // Proof Size summary in bytes: + // Measured: `4` + // Estimated: `2693` + // Minimum execution time: 15_811_000 picoseconds. + Weight::from_parts(16_570_000, 0) + .saturating_add(Weight::from_parts(0, 2693)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `RcMigrator::DmpDataMessageCounts` (r:1 w:1) + /// Proof: `RcMigrator::DmpDataMessageCounts` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn send_chunked_xcm_and_track() -> Weight { + // Proof Size summary in bytes: + // Measured: `118` + // Estimated: `3583` + // Minimum execution time: 334_992_000 picoseconds. + Weight::from_parts(343_002_000, 0) + .saturating_add(Weight::from_parts(0, 3583)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `RcMigrator::DmpDataMessageCounts` (r:1 w:1) + /// Proof: `RcMigrator::DmpDataMessageCounts` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn update_ah_msg_processed_count() -> Weight { + // Proof Size summary in bytes: + // Measured: `4` + // Estimated: `1493` + // Minimum execution time: 10_980_000 picoseconds. + Weight::from_parts(11_590_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn receive_query_response() -> Weight { + Weight::from_parts(10_000_000, 1000) + } + fn resend_xcm() -> Weight { + Weight::from_parts(10_000_000, 1000) + } + fn set_unprocessed_msg_buffer() -> Weight { + Weight::from_parts(10_000_000, 1000) + } + fn set_ah_ump_queue_priority() -> Weight { + Weight::from_parts(10_000_000, 1000) + } + fn force_ah_ump_queue_priority() -> Weight { + Weight::from_parts(10_000_000, 1000) + } + fn set_manager() -> Weight { + Weight::from_parts(10_000_000, 1000) + } +} diff --git a/relay/kusama/src/xcm_config.rs b/relay/kusama/src/xcm_config.rs index b84e2248e3..96cad024e7 100644 --- a/relay/kusama/src/xcm_config.rs +++ b/relay/kusama/src/xcm_config.rs @@ -23,10 +23,11 @@ use super::{ }; use frame_support::{ parameter_types, - traits::{Contains, Disabled, Equals, Everything, Nothing}, + traits::{Contains, Disabled, Equals, Everything, FromContains, Nothing}, }; use frame_system::EnsureRoot; use kusama_runtime_constants::{currency::CENTS, system_parachain::*}; +use pallet_xcm::XcmPassthrough; use polkadot_runtime_common::{ xcm_sender::{ChildParachainRouter, ExponentialPrice}, ToAuthor, @@ -45,7 +46,6 @@ use xcm_builder::{ }; parameter_types! { - pub const RootLocation: Location = Here.into_location(); /// The location of the KSM token, from the context of this chain. Since this token is native to this /// chain, we make it synonymous with it and thus it is the `Here` location, which means "equivalent to /// the context". @@ -59,7 +59,7 @@ parameter_types! { /// The check account, which holds any native assets that have been teleported out and not back in (yet). pub CheckAccount: AccountId = XcmPallet::check_account(); /// The check account that is allowed to mint assets locally. - pub LocalCheckAccount: (AccountId, MintLocation) = (CheckAccount::get(), MintLocation::Local); + pub TeleportTracking: Option<(AccountId, MintLocation)> = crate::RcMigrator::teleport_tracking(); /// Account of the treasury pallet. pub TreasuryAccount: AccountId = Treasury::account_id(); } @@ -79,6 +79,8 @@ pub type SovereignAccountOf = ( /// point of view of XCM-only concepts like `Location` and `Asset`. /// /// Ours is only aware of the Balances pallet, which is mapped to `TokenLocation`. +/// +/// Teleports tracking is managed by `RcMigrator` pub type LocalAssetTransactor = FungibleAdapter< // Use this currency: Balances, @@ -88,8 +90,8 @@ pub type LocalAssetTransactor = FungibleAdapter< SovereignAccountOf, // Our chain's account ID type (we can't get away without mentioning it explicitly): AccountId, - // We track our teleports in/out to keep total issuance correct. - LocalCheckAccount, + // Teleports tracking is managed by `RcMigrator`: track before, no tracking after. + TeleportTracking, >; /// The means that we convert the XCM message origin location into a local dispatch origin. @@ -100,6 +102,8 @@ type LocalOriginConverter = ( ChildParachainAsNative, // The AccountId32 location type can be expressed natively as a `Signed` origin. SignedAccountId32AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + XcmPassthrough, ); parameter_types! { @@ -117,13 +121,22 @@ parameter_types! { pub type PriceForChildParachainDelivery = ExponentialPrice; -/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our -/// individual routers. -pub type XcmRouter = WithUniqueTopic<( +/// The XCM router. Use [`XcmRouter`] instead. +pub(crate) type XcmRouterWithoutException = WithUniqueTopic<( // Only one router so far - use DMP to communicate with child parachains. ChildParachainRouter, )>; +/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our +/// individual routers. +/// +/// This router does not route to the Asset Hub if the migration is ongoing. +pub type XcmRouter = pallet_rc_migrator::types::RouteInnerWithException< + XcmRouterWithoutException, + FromContains, Everything>, + crate::RcMigrator, +>; + parameter_types! { pub const Ksm: AssetFilter = Wild(AllOf { fun: WildFungible, id: AssetId(TokenLocation::get()) }); pub AssetHubLocation: Location = Parachain(ASSET_HUB_ID).into_location(); @@ -184,7 +197,7 @@ pub type Barrier = TrailingSetTopicAsId<( /// Locations that will not be charged fees in the executor, neither for execution nor delivery. /// We only waive fees for system functions, which these locations represent. -pub type WaivedLocations = (SystemParachains, Equals, LocalPlurality); +pub type WaivedLocations = (SystemParachains, Equals, LocalPlurality); pub struct XcmConfig; impl xcm_executor::Config for XcmConfig { @@ -194,7 +207,8 @@ impl xcm_executor::Config for XcmConfig { type AssetTransactor = LocalAssetTransactor; type OriginConverter = LocalOriginConverter; type IsReserve = (); - type IsTeleporter = TrustedTeleporters; + type IsTeleporter = + pallet_rc_migrator::xcm_config::FalseIfMigrating; type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< @@ -215,6 +229,8 @@ impl xcm_executor::Config for XcmConfig { type MaxAssetsIntoHolding = MaxAssetsIntoHolding; type FeeManager = XcmFeeManagerFromComponents< WaivedLocations, + // TODO: post-ahm move the Treasury funds from this local account to sovereign account + // of the new AH Treasury. SendXcmFeeToAccount, >; // No bridges on the Relay Chain diff --git a/relay/kusama/tests/mod.rs b/relay/kusama/tests/mod.rs new file mode 100644 index 0000000000..e934b5f336 --- /dev/null +++ b/relay/kusama/tests/mod.rs @@ -0,0 +1,19 @@ +// 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 . + +mod asset_rate; +mod location_conversion; +mod treasury_burn_handler; diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index a5875ec7e8..5bd8e805dc 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -132,7 +132,8 @@ substrate-wasm-builder = { workspace = true, optional = true } [features] default = ["std"] no_std = [] -paseo = [] # For Paseo AHM + +polkadot-ahm = [] std = [ "pallet-rc-migrator/std", diff --git a/relay/polkadot/src/ah_migration/phase1.rs b/relay/polkadot/src/ah_migration/phase1.rs index d48c350c94..d702ebcdf8 100644 --- a/relay/polkadot/src/ah_migration/phase1.rs +++ b/relay/polkadot/src/ah_migration/phase1.rs @@ -17,8 +17,8 @@ //! First phase of the Asset Hub Migration. use crate::*; -use pallet_rc_migrator::types::PortableFreezeReason; use frame_support::traits::Contains; +use pallet_rc_migrator::types::PortableFreezeReason; /// Contains all calls that are enabled during the migration. pub struct CallsEnabledDuringMigration; diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 7abe77ce7b..a96e910a21 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -20,8 +20,12 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "512"] +#[cfg(feature = "kusama-ahm")] +compile_error!("Polkadot AHM cannot run with `kusama` feature"); + extern crate alloc; +use ah_migration::phase1 as ahm_phase1; use alloc::{ collections::{BTreeMap, VecDeque}, vec, @@ -45,7 +49,7 @@ use frame_support::{ traits::{ fungible::HoldConsideration, tokens::{imbalance::ResolveTo, UnityOrOuterConversion}, - ConstU32, ConstU8, ConstUint, EitherOf, EitherOfDiverse, Everything, FromContains, Get, + ConstU32, ConstU8, ConstUint, EitherOf, EitherOfDiverse, Equals, FromContains, Get, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, WithdrawReasons, }, @@ -55,7 +59,6 @@ use frame_support::{ }, PalletId, }; -use ah_migration::phase1 as ahm_phase1; pub use frame_system::Call as SystemCall; use frame_system::EnsureRoot; pub use pallet_balances::Call as BalancesCall; @@ -79,7 +82,6 @@ use polkadot_primitives::{ PersistedValidationData, SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, PARACHAIN_KEY_TYPE_ID, }; -use frame_support::traits::Equals; use polkadot_runtime_common::{ auctions, claims, crowdloan, impl_runtime_weights, impls::{ @@ -649,7 +651,7 @@ parameter_types! { pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS; } -// TODO: remove feature gate and keep 10, when we want to activate it for Polkadot +// TODO @kianenigma: remove feature gate and keep 10, when we want to activate it for Polkadot #[cfg(feature = "runtime-benchmarks")] parameter_types! { pub const AutoRebagNumber: u32 = 10; @@ -666,9 +668,9 @@ impl pallet_bags_list::Config for Runtime { type WeightInfo = weights::pallet_bags_list::WeightInfo; type BagThresholds = BagThresholds; type Score = sp_npos_elections::VoteWeight; - #[cfg(any(feature = "paseo", feature = "runtime-benchmarks"))] + #[cfg(feature = "runtime-benchmarks")] type MaxAutoRebagPerBlock = ConstU32<5>; - #[cfg(not(any(feature = "paseo", feature = "runtime-benchmarks")))] + #[cfg(not(feature = "runtime-benchmarks"))] type MaxAutoRebagPerBlock = AutoRebagNumber; } @@ -1546,10 +1548,7 @@ impl pallet_staking_async_ah_client::Config for Runtime { type AdminOrigin = EnsureRoot; type SessionInterface = Self; type SendToAssetHub = StakingXcmToAssetHub; - #[cfg(feature = "paseo")] - type MinimumValidatorSetSize = ConstU32<50>; - #[cfg(not(feature = "paseo"))] - type MinimumValidatorSetSize = ConstU32<400>; + type MinimumValidatorSetSize = ConstU32<400>; // TODO @kianenigma type UnixTime = Timestamp; type PointsPerBlock = ConstU32<20>; type MaxOffenceBatchSize = ConstU32<50>; diff --git a/relay/polkadot/src/weights/pallet_ah_migrator.rs b/relay/polkadot/src/weights/pallet_ah_migrator.rs index d9e5fc61a4..3014ac2e75 100644 --- a/relay/polkadot/src/weights/pallet_ah_migrator.rs +++ b/relay/polkadot/src/weights/pallet_ah_migrator.rs @@ -191,26 +191,6 @@ impl pallet_rc_migrator::weights_ah:: .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 3672).saturating_mul(n.into())) } - /// Storage: `FastUnstake::Queue` (r:255 w:255) - /// Proof: `FastUnstake::Queue` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) - /// Storage: `FastUnstake::CounterForQueue` (r:1 w:1) - /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 255]`. - fn receive_fast_unstake_messages(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `1489 + n * (2531 ±0)` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(3_337_171, 0) - .saturating_add(Weight::from_parts(0, 1489)) - // Standard Error: 6_848 - .saturating_add(Weight::from_parts(2_491_678, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) - } /// Storage: `Referenda::DecidingCount` (r:0 w:16) /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Referenda::ReferendumCount` (r:0 w:1) diff --git a/relay/polkadot/src/xcm_config.rs b/relay/polkadot/src/xcm_config.rs index 5beb613004..c08c2da968 100644 --- a/relay/polkadot/src/xcm_config.rs +++ b/relay/polkadot/src/xcm_config.rs @@ -38,7 +38,7 @@ use sp_core::ConstU32; use xcm::latest::{prelude::*, BodyId}; use xcm_builder::{ AccountId32Aliases, AliasChildLocation, AllowExplicitUnpaidExecutionFrom, - AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, + AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, Case, ChildParachainAsNative, ChildParachainConvertsVia, DescribeAllTerminal, DescribeFamily, FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsChildSystemParachain, IsConcrete, MintLocation, OriginToPluralityVoice, SendXcmFeeToAccount, @@ -47,8 +47,6 @@ use xcm_builder::{ XcmFeeManagerFromComponents, }; -pub use pallet_rc_migrator::xcm_config::{AssetHubLocation, CollectivesLocation}; - parameter_types! { /// The location of the DOT token, from the context of this chain. Since this token is native to this /// chain, we make it synonymous with it and thus it is the `Here` location, which means "equivalent to @@ -147,6 +145,30 @@ pub type XcmRouter = pallet_rc_migrator::types::RouteInnerWithException< crate::RcMigrator, >; +parameter_types! { + pub const RootLocation: Location = Here.into_location(); + pub const Dot: AssetFilter = Wild(AllOf { fun: WildFungible, id: AssetId(Here.into_location()) }); + pub AssetHubLocation: Location = Parachain(ASSET_HUB_ID).into_location(); + pub DotForAssetHub: (AssetFilter, Location) = (Dot::get(), AssetHubLocation::get()); + pub CollectivesLocation: Location = Parachain(COLLECTIVES_ID).into_location(); + pub DotForCollectives: (AssetFilter, Location) = (Dot::get(), CollectivesLocation::get()); + pub CoretimeLocation: Location = Parachain(BROKER_ID).into_location(); + pub DotForCoretime: (AssetFilter, Location) = (Dot::get(), CoretimeLocation::get()); + pub BridgeHubLocation: Location = Parachain(BRIDGE_HUB_ID).into_location(); + pub DotForBridgeHub: (AssetFilter, Location) = (Dot::get(), BridgeHubLocation::get()); + pub People: Location = Parachain(PEOPLE_ID).into_location(); + pub DotForPeople: (AssetFilter, Location) = (Dot::get(), People::get()); +} + +/// Polkadot Relay recognizes/respects System Parachains as teleporters. +pub type TrustedTeleporters = ( + Case, + Case, + Case, + Case, + Case, +); + pub struct Fellows; impl Contains for Fellows { fn contains(loc: &Location) -> bool { @@ -164,6 +186,13 @@ impl Contains for OnlyParachains { } } +pub struct LocalPlurality; +impl Contains for LocalPlurality { + fn contains(loc: &Location) -> bool { + matches!(loc.unpack(), (0, [Plurality { .. }])) + } +} + /// The barriers one of which must be passed for an XCM message to be executed. pub type Barrier = TrailingSetTopicAsId<( // Weight that is paid for may be consumed. @@ -184,6 +213,10 @@ pub type Barrier = TrailingSetTopicAsId<( >, )>; +/// Locations that will not be charged fees in the executor, neither for execution nor delivery. +/// We only waive fees for system functions, which these locations represent. +pub type WaivedLocations = (SystemParachains, Equals, LocalPlurality); + pub struct XcmConfig; impl xcm_executor::Config for XcmConfig { type RuntimeCall = RuntimeCall; @@ -193,7 +226,8 @@ impl xcm_executor::Config for XcmConfig { type OriginConverter = LocalOriginConverter; // Polkadot Relay recognises no chains which act as reserves. type IsReserve = (); - type IsTeleporter = pallet_rc_migrator::xcm_config::TrustedTeleporters; + type IsTeleporter = + pallet_rc_migrator::xcm_config::FalseIfMigrating; type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< @@ -213,7 +247,7 @@ impl xcm_executor::Config for XcmConfig { type PalletInstancesInfo = AllPalletsWithSystem; type MaxAssetsIntoHolding = MaxAssetsIntoHolding; type FeeManager = XcmFeeManagerFromComponents< - pallet_rc_migrator::xcm_config::WaivedLocations, + WaivedLocations, // TODO: post-ahm move the Treasury funds from this local account to sovereign account // of the new AH Treasury. SendXcmFeeToAccount, diff --git a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml index 60569830e9..a75a404a9d 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml @@ -9,6 +9,10 @@ repository.workspace = true version.workspace = true [dependencies] +pallet-rc-migrator = { workspace = true } +pallet-ah-migrator = { workspace = true } +pallet-ah-ops = { workspace = true } + codec = { features = ["derive", "max-encoded-len"], workspace = true } hex-literal = { workspace = true } log = { workspace = true } @@ -21,10 +25,12 @@ bp-asset-hub-polkadot = { workspace = true } bp-bridge-hub-kusama = { workspace = true } bp-bridge-hub-polkadot = { workspace = true } kusama-runtime-constants = { workspace = true } +system-parachains-constants = { workspace = true } pallet-remote-proxy = { workspace = true } # Substrate frame-benchmarking = { optional = true, workspace = true } +frame-election-provider-support = { workspace = true } frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true } @@ -33,36 +39,58 @@ frame-system-benchmarking = { optional = true, workspace = true } frame-system-rpc-runtime-api = { workspace = true } frame-try-runtime = { optional = true, workspace = true } pallet-asset-conversion-tx-payment = { workspace = true } +pallet-asset-rate = { workspace = true } pallet-assets = { workspace = true } pallet-asset-conversion = { workspace = true } pallet-aura = { workspace = true } pallet-authorship = { workspace = true } pallet-balances = { workspace = true } +pallet-bags-list = { workspace = true } +pallet-bounties = { workspace = true } +pallet-child-bounties = { workspace = true } +pallet-conviction-voting = { workspace = true } +pallet-delegated-staking = { workspace = true } +pallet-indices = { workspace = true } pallet-message-queue = { workspace = true } pallet-migrations = { workspace = true } pallet-multisig = { workspace = true } +pallet-nomination-pools = { workspace = true } pallet-nft-fractionalization = { workspace = true } pallet-nfts = { workspace = true } pallet-nfts-runtime-api = { workspace = true } +pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } +pallet-recovery = { workspace = true } +pallet-referenda = { workspace = true } pallet-revive = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-nomination-pools-benchmarking = { optional = true, workspace = true } +pallet-staking-async = { workspace = true } +pallet-staking-async-rc-client = { workspace = true } +pallet-election-provider-multi-block = { workspace = true } pallet-session = { workspace = true } +pallet-staking = { workspace = true } pallet-state-trie-migration = { workspace = true } pallet-timestamp = { workspace = true } pallet-transaction-payment = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-treasury = { workspace = true } pallet-uniques = { workspace = true } pallet-utility = { workspace = true } pallet-vesting = { workspace = true } +pallet-whitelist = { workspace = true } sp-api = { workspace = true } +sp-arithmetic = { workspace = true } sp-block-builder = { workspace = true } sp-consensus-aura = { workspace = true } sp-core = { workspace = true } sp-genesis-builder = { workspace = true } sp-inherents = { workspace = true } +sp-npos-elections = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } +sp-staking = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -97,7 +125,6 @@ cumulus-primitives-utility = { workspace = true } pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } -system-parachains-constants = { workspace = true } assets-common = { workspace = true } # Bridges @@ -114,6 +141,7 @@ substrate-wasm-builder = { optional = true, workspace = true } [features] default = ["std"] +kusama-ahm = ["pallet-ah-migrator/kusama-ahm", "pallet-rc-migrator/kusama-ahm"] runtime-benchmarks = [ "assets-common/runtime-benchmarks", "bp-asset-hub-kusama/runtime-benchmarks", @@ -126,29 +154,52 @@ runtime-benchmarks = [ "cumulus-primitives-core/runtime-benchmarks", "cumulus-primitives-utility/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", + "frame-election-provider-support/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", "kusama-runtime-constants/runtime-benchmarks", + "pallet-ah-migrator/runtime-benchmarks", + "pallet-ah-ops/runtime-benchmarks", "pallet-asset-conversion-tx-payment/runtime-benchmarks", "pallet-asset-conversion/runtime-benchmarks", + "pallet-asset-rate/runtime-benchmarks", "pallet-assets/runtime-benchmarks", + "pallet-bags-list/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", + "pallet-conviction-voting/runtime-benchmarks", + "pallet-delegated-staking/runtime-benchmarks", + "pallet-election-provider-multi-block/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", "pallet-migrations/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-nft-fractionalization/runtime-benchmarks", "pallet-nfts/runtime-benchmarks", + "pallet-nomination-pools-benchmarking/runtime-benchmarks", + "pallet-nomination-pools/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", + "pallet-rc-migrator/runtime-benchmarks", + "pallet-recovery/runtime-benchmarks", + "pallet-referenda/runtime-benchmarks", "pallet-remote-proxy/runtime-benchmarks", "pallet-revive/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-staking-async-rc-client/runtime-benchmarks", + "pallet-staking-async/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", "pallet-state-trie-migration/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-transaction-payment/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", "pallet-uniques/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", + "pallet-whitelist/runtime-benchmarks", "pallet-xcm-benchmarks/runtime-benchmarks", "pallet-xcm-bridge-hub-router/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", @@ -157,6 +208,7 @@ runtime-benchmarks = [ "polkadot-runtime-common/runtime-benchmarks", "snowbridge-inbound-queue-primitives/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "sp-staking/runtime-benchmarks", "system-parachains-constants/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", @@ -169,32 +221,54 @@ try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", + "frame-election-provider-support/try-runtime", "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", "frame-try-runtime/try-runtime", + "pallet-ah-migrator/try-runtime", + "pallet-ah-ops/try-runtime", "pallet-asset-conversion-tx-payment/try-runtime", "pallet-asset-conversion/try-runtime", + "pallet-asset-rate/try-runtime", "pallet-assets/try-runtime", "pallet-aura/try-runtime", "pallet-authorship/try-runtime", + "pallet-bags-list/try-runtime", "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", "pallet-collator-selection/try-runtime", + "pallet-conviction-voting/try-runtime", + "pallet-delegated-staking/try-runtime", + "pallet-election-provider-multi-block/try-runtime", + "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", "pallet-migrations/try-runtime", "pallet-multisig/try-runtime", "pallet-nft-fractionalization/try-runtime", "pallet-nfts/try-runtime", + "pallet-nomination-pools/try-runtime", + "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", + "pallet-rc-migrator/try-runtime", + "pallet-recovery/try-runtime", + "pallet-referenda/try-runtime", "pallet-remote-proxy/try-runtime", "pallet-revive/try-runtime", + "pallet-scheduler/try-runtime", "pallet-session/try-runtime", + "pallet-staking-async-rc-client/try-runtime", + "pallet-staking-async/try-runtime", + "pallet-staking/try-runtime", "pallet-state-trie-migration/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", "pallet-uniques/try-runtime", "pallet-utility/try-runtime", "pallet-vesting/try-runtime", + "pallet-whitelist/try-runtime", "pallet-xcm-bridge-hub-router/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", @@ -218,6 +292,7 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-utility/std", "frame-benchmarking?/std", + "frame-election-provider-support/std", "frame-executive/std", "frame-metadata-hash-extension/std", "frame-support/std", @@ -227,30 +302,52 @@ std = [ "frame-try-runtime?/std", "kusama-runtime-constants/std", "log/std", + "pallet-ah-migrator/std", + "pallet-ah-ops/std", "pallet-asset-conversion-tx-payment/std", "pallet-asset-conversion/std", + "pallet-asset-rate/std", "pallet-assets/std", "pallet-aura/std", "pallet-authorship/std", + "pallet-bags-list/std", "pallet-balances/std", + "pallet-bounties/std", + "pallet-child-bounties/std", "pallet-collator-selection/std", + "pallet-conviction-voting/std", + "pallet-delegated-staking/std", + "pallet-election-provider-multi-block/std", + "pallet-indices/std", "pallet-message-queue/std", "pallet-migrations/std", "pallet-multisig/std", "pallet-nft-fractionalization/std", "pallet-nfts-runtime-api/std", "pallet-nfts/std", + "pallet-nomination-pools-benchmarking?/std", + "pallet-nomination-pools/std", + "pallet-preimage/std", "pallet-proxy/std", + "pallet-rc-migrator/std", + "pallet-recovery/std", + "pallet-referenda/std", "pallet-remote-proxy/std", "pallet-revive/std", + "pallet-scheduler/std", "pallet-session/std", + "pallet-staking-async-rc-client/std", + "pallet-staking-async/std", + "pallet-staking/std", "pallet-state-trie-migration/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", + "pallet-treasury/std", "pallet-uniques/std", "pallet-utility/std", "pallet-vesting/std", + "pallet-whitelist/std", "pallet-xcm-benchmarks?/std", "pallet-xcm-bridge-hub-router/std", "pallet-xcm/std", @@ -264,14 +361,17 @@ std = [ "serde_json/std", "snowbridge-inbound-queue-primitives/std", "sp-api/std", + "sp-arithmetic/std", "sp-block-builder/std", "sp-consensus-aura/std", "sp-core/std", "sp-genesis-builder/std", "sp-inherents/std", + "sp-npos-elections/std", "sp-offchain/std", "sp-runtime/std", "sp-session/std", + "sp-staking/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/call_filter.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/call_filter.rs new file mode 100644 index 0000000000..95239993d1 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/call_filter.rs @@ -0,0 +1,213 @@ +// 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 . + +//! Call filters for Asset Hub during the Asset Hub Migration. + +use crate::*; + +/// Contains all calls that are enabled before the migration. +pub struct CallsEnabledBeforeMigration; +impl Contains<::RuntimeCall> for CallsEnabledBeforeMigration { + fn contains(call: &::RuntimeCall) -> bool { + let (before, _, _) = call_allowed_status(call); + if !before { + log::warn!("Call bounced by the filter before the migration: {:?}", call); + } + before + } +} + +/// Contains all calls that are enabled during the migration. +pub struct CallsEnabledDuringMigration; +impl Contains<::RuntimeCall> for CallsEnabledDuringMigration { + fn contains(call: &::RuntimeCall) -> bool { + let (_before, during, _after) = call_allowed_status(call); + if !during { + log::warn!("Call bounced by the filter during the migration: {:?}", call); + } + during + } +} + +/// Contains all calls that are enabled after the migration. +pub struct CallsEnabledAfterMigration; +impl Contains<::RuntimeCall> for CallsEnabledAfterMigration { + fn contains(call: &::RuntimeCall) -> bool { + let (_before, _during, after) = call_allowed_status(call); + if !after { + log::warn!("Call bounced by the filter after the migration: {:?}", call); + } + after + } +} + +/// Return whether a call should be enabled before, during and/or after the migration. +/// +/// Time line of the migration looks like this: +/// +/// --------|-----------|---------> +/// Start End +/// +/// We now define 3 periods: +/// +/// 1. Before the migration: [0, Start) +/// 2. During the migration: [Start, End] +/// 3. After the migration: (End, ∞) +/// +/// Visually: +/// +/// ```text +/// |--1---| +/// |-----2-----| +/// |---3----> +/// --------|-----------|---------> +/// Start End +/// ``` +/// +/// This call returns a 3-tuple to indicate whether a call is enabled during these periods. +pub fn call_allowed_status( + call: &::RuntimeCall, +) -> (bool, bool, bool) { + use RuntimeCall::*; + const ON: bool = true; + const OFF: bool = false; + let before_migration = call_allowed_before_migration(call); + + let during_migration = match call { + AhMigrator(..) => ON, // required for the migration, only permissioned calls + AhOps(..) => OFF, // Not needed during the migration + AssetConversion(..) => ON, // no reason to disable it, just convenience + AssetRate(..) => OFF, + Assets(..) => ON, // no reason to disable it, just convenience + Balances(..) => ON, // no reason to disable it, just convenience + Bounties(..) => OFF, + ChildBounties(..) => OFF, + Claims(..) => OFF, + CollatorSelection(..) => ON, // Why? + ConvictionVoting(..) => OFF, + CumulusXcm(..) => OFF, /* Empty call enum, see https://github.com/paritytech/polkadot-sdk/issues/8222 */ + ForeignAssets(..) => ON, // no reason to disable it, just convenience + Indices(..) => OFF, + MultiBlockElection(..) => OFF, + MultiBlockElectionSigned(..) => OFF, + MultiBlockElectionUnsigned(..) => OFF, + MultiBlockElectionVerifier(..) => OFF, + MessageQueue(..) => ON, // contains non-permissioned service calls + Multisig(..) => OFF, + Nfts(..) => ON, // no reason to disable it, just convenience + NominationPools(..) => OFF, + ParachainInfo(parachain_info::Call::__Ignore { .. }) => ON, // Has no calls + ParachainSystem(..) => ON, // Only inherent and root calls + PolkadotXcm(..) => ON, /* no reason to disable it, */ + // just convenience + PoolAssets(..) => ON, // no reason to disable it, just convenience + Preimage(..) => OFF, + Proxy(..) => OFF, + Referenda(..) => OFF, + Scheduler(..) => ON, // only permissioned service calls + Session(..) => OFF, + Staking(..) => OFF, + StakingRcClient(..) => ON, // Keep on for incoming RC calls over XCM + StateTrieMigration(..) => OFF, // Deprecated + System(..) => ON, // remark plus root calls + Timestamp(..) => ON, // only `set` inherit + ToPolkadotXcmRouter(..) => ON, // Allow to report bridge congestion + Treasury(..) => OFF, + Uniques(..) => OFF, + Utility(..) => ON, // batching etc, just convenience + Vesting(..) => OFF, + VoterList(..) => OFF, + Whitelist(..) => OFF, + XcmpQueue(..) => ON, // Allow updating XCM settings. Only by Fellowship and root. + RemoteProxyRelayChain(..) => OFF, + NftFractionalization(..) => OFF, + Recovery(..) => OFF, + MultiBlockMigrations(..) => OFF, // has not calls + Revive(..) => OFF, // TODO: OFF or ON? + }; + // Exhaustive match. Compiler ensures that we did not miss any. + + // All pallets are enabled on Asset Hub after the migration :) + let after_migration = ON; + (before_migration, during_migration, after_migration) +} + +/// Whether a call is enabled before the migration starts. +pub fn call_allowed_before_migration( + call: &::RuntimeCall, +) -> bool { + use RuntimeCall::*; + const ON: bool = true; + const OFF: bool = false; + + match call { + // Disabled to avoid state insert conflicts. + Staking(..) => OFF, + // Not needed since staking is off. + MultiBlockElection(..) => OFF, + MultiBlockElectionSigned(..) => OFF, + MultiBlockElectionUnsigned(..) => OFF, + MultiBlockElectionVerifier(..) => OFF, + NominationPools(..) => OFF, + VoterList(..) => OFF, + // To avoid insert issues. + Indices(..) => OFF, + Vesting(..) => OFF, + // Governance disabled before migration starts. + Bounties(..) => OFF, + ChildBounties(..) => OFF, + ConvictionVoting(..) => OFF, + Referenda(..) => OFF, + Treasury(..) => OFF, + Recovery(..) => OFF, + MultiBlockMigrations(..) => OFF, // has not calls + // Everything else is enabled before the migration. + // Exhaustive match in case a pallet is added: + AhMigrator(..) | + AhOps(..) | + AssetConversion(..) | + AssetRate(..) | + Assets(..) | + Balances(..) | + Claims(..) | + CollatorSelection(..) | + CumulusXcm(..) | + ForeignAssets(..) | + MessageQueue(..) | + Multisig(..) | + Nfts(..) | + ParachainInfo(..) | + ParachainSystem(..) | + PolkadotXcm(..) | + PoolAssets(..) | + Preimage(..) | + Proxy(..) | + Scheduler(..) | + Session(..) | + StakingRcClient(..) | + StateTrieMigration(..) | + System(..) | + Timestamp(..) | + ToPolkadotXcmRouter(..) | + Uniques(..) | + Utility(..) | + Whitelist(..) | + XcmpQueue(..) | + RemoteProxyRelayChain(..) | + NftFractionalization(..) | + Revive(..) => ON, + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/mod.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/mod.rs new file mode 100644 index 0000000000..81c0a74e79 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/ah_migration/mod.rs @@ -0,0 +1,363 @@ +// 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 call_filter; + +extern crate alloc; + +use super::*; +use alloc::boxed::Box; +use codec::DecodeAll; +use frame_support::pallet_prelude::TypeInfo; +use pallet_ah_migrator::LOG_TARGET; +use parachains_common::pay::VersionedLocatableAccount; +use polkadot_runtime_common::impls::{LocatableAssetConverter, VersionedLocatableAsset}; +use sp_core::Get; +use sp_runtime::traits::{Convert, TryConvert}; + +impl From for RuntimeHoldReason { + fn from(reason: pallet_rc_migrator::types::PortableHoldReason) -> Self { + use pallet_rc_migrator::types::PortableHoldReason; + use RuntimeHoldReason::*; + + match reason { + PortableHoldReason::Preimage(preimage) => Preimage(preimage), + PortableHoldReason::Staking(staking) => match staking { + pallet_staking::HoldReason::Staking => + Staking(pallet_staking_async::HoldReason::Staking), + }, + PortableHoldReason::StateTrieMigration(state_trie_migration) => + StateTrieMigration(state_trie_migration), + PortableHoldReason::DelegatedStaking(delegated_staking) => + DelegatedStaking(delegated_staking), + PortableHoldReason::Session(session) => Session(session), + PortableHoldReason::XcmPallet(xcm_pallet) => PolkadotXcm(xcm_pallet), + } + } +} + +impl From for RuntimeFreezeReason { + fn from(reason: pallet_rc_migrator::types::PortableFreezeReason) -> Self { + use pallet_rc_migrator::types::PortableFreezeReason; + + match reason { + PortableFreezeReason::NominationPools(nomination_pools) => + RuntimeFreezeReason::NominationPools(nomination_pools), + } + } +} + +/// Treasury accounts migrating to the new treasury account address (same account address that was +/// used on the Relay Chain). +pub struct TreasuryAccounts; +impl Get<(AccountId, Vec)> for TreasuryAccounts { + fn get() -> (AccountId, Vec) { + // Treasury account on Asset Hub has only KSM + (xcm_config::PreMigrationRelayTreasuryPalletAccount::get(), vec![]) + } +} + +pub type RcProxyType = kusama_runtime_constants::proxy::ProxyType; + +pub struct RcToProxyType; +impl TryConvert for RcToProxyType { + fn try_convert(p: RcProxyType) -> Result { + use kusama_runtime_constants::proxy::ProxyType::*; + + match p { + Any => Ok(ProxyType::Any), + NonTransfer => Ok(ProxyType::NonTransfer), + Governance => Ok(ProxyType::Governance), + Staking => Ok(ProxyType::Staking), + CancelProxy => Ok(ProxyType::CancelProxy), + Auction => Ok(ProxyType::Auction), + NominationPools => Ok(ProxyType::NominationPools), + ParaRegistration => Ok(ProxyType::ParaRegistration), + Society => Ok(ProxyType::Society), + Spokesperson => Ok(ProxyType::Spokesperson), + } + } +} + +/// A subset of Relay Chain origins. +/// +/// These origins are utilized in Governance and mapped to Asset Hub origins for active referendums. +#[allow(non_camel_case_types)] +#[derive(Encode, DecodeWithMemTracking, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +pub enum RcPalletsOrigin { + #[codec(index = 0u8)] + system(frame_system::Origin), + #[codec(index = 43u8)] + Origins(pallet_custom_origins::Origin), +} + +impl Default for RcPalletsOrigin { + fn default() -> Self { + RcPalletsOrigin::system(frame_system::Origin::::Root) + } +} + +/// Convert a Relay Chain origin to an Asset Hub one. +pub struct RcToAhPalletsOrigin; +impl TryConvert for RcToAhPalletsOrigin { + fn try_convert(a: RcPalletsOrigin) -> Result { + match a { + RcPalletsOrigin::system(a) => Ok(OriginCaller::system(a)), + RcPalletsOrigin::Origins(a) => Ok(OriginCaller::Origins(a)), + } + } +} + +/// Relay Chain Runtime Call. +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +pub enum RcRuntimeCall { + // TODO: @muharem variant set code for Relay Chain + // TODO: @muharem variant set code for Parachains + // TODO: @muharem whitelisted caller + #[codec(index = 0u8)] + System(frame_system::Call), + #[codec(index = 18u8)] + Treasury(RcTreasuryCall), + #[codec(index = 21u8)] + Referenda(pallet_referenda::Call), + #[codec(index = 24u8)] + Utility(RcUtilityCall), + #[codec(index = 35u8)] + Bounties(pallet_bounties::Call), + #[codec(index = 40u8)] + ChildBounties(pallet_child_bounties::Call), +} + +/// Relay Chain Treasury Call obtained from cargo expand. +#[allow(non_camel_case_types)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +pub enum RcTreasuryCall { + /// Propose and approve a spend of treasury funds. + #[codec(index = 3u8)] + spend_local { + #[codec(compact)] + amount: Balance, + beneficiary: Address, + }, + /// Force a previously approved proposal to be removed from the approval queue. + #[codec(index = 4u8)] + remove_approval { + #[codec(compact)] + proposal_id: pallet_treasury::ProposalIndex, + }, + /// Propose and approve a spend of treasury funds. + #[codec(index = 5u8)] + spend { + asset_kind: Box, + #[codec(compact)] + amount: Balance, + beneficiary: Box, + valid_from: Option, + }, + /// Claim a spend. + #[codec(index = 6u8)] + payout { index: pallet_treasury::SpendIndex }, + #[codec(index = 7u8)] + check_status { index: pallet_treasury::SpendIndex }, + #[codec(index = 8u8)] + void_spend { index: pallet_treasury::SpendIndex }, +} + +/// Relay Chain Utility Call obtained from cargo expand. +/// +/// The variants that are not generally used in Governance are not included. +#[allow(non_camel_case_types)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +pub enum RcUtilityCall { + /// Send a batch of dispatch calls. + #[codec(index = 0u8)] + batch { calls: Vec }, + /// Send a batch of dispatch calls and atomically execute them. + #[codec(index = 2u8)] + batch_all { calls: Vec }, + /// Dispatches a function call with a provided origin. + #[codec(index = 3u8)] + dispatch_as { as_origin: Box, call: Box }, + /// Send a batch of dispatch calls. + /// Unlike `batch`, it allows errors and won't interrupt. + #[codec(index = 4u8)] + force_batch { calls: Vec }, +} + +/// Convert an encoded Relay Chain Call to a local AH one. +pub struct RcToAhCall; +impl<'a> TryConvert<&'a [u8], RuntimeCall> for RcToAhCall { + fn try_convert(mut a: &'a [u8]) -> Result { + let rc_call = match RcRuntimeCall::decode_all(&mut a) { + Ok(rc_call) => rc_call, + Err(e) => { + log::error!(target: LOG_TARGET, "Failed to decode RC call with error: {:?}", e); + return Err(a) + }, + }; + Self::map(rc_call).map_err(|_| a) + } +} +impl RcToAhCall { + fn map(rc_call: RcRuntimeCall) -> Result { + match rc_call { + RcRuntimeCall::System(inner_call) => { + let call = + inner_call.using_encoded(|mut e| Decode::decode(&mut e)).map_err(|err| { + log::error!( + target: LOG_TARGET, + "Failed to decode RC Bounties call to AH System call: {:?}", + err + ); + })?; + Ok(RuntimeCall::System(call)) + }, + RcRuntimeCall::Utility(RcUtilityCall::dispatch_as { as_origin, call }) => { + let origin = RcToAhPalletsOrigin::try_convert(*as_origin).map_err(|err| { + log::error!( + target: LOG_TARGET, + "Failed to decode RC dispatch_as origin: {:?}", + err + ); + })?; + Ok(RuntimeCall::Utility(pallet_utility::Call::::dispatch_as { + as_origin: Box::new(origin), + call: Box::new(Self::map(*call)?), + })) + }, + RcRuntimeCall::Utility(RcUtilityCall::batch { calls }) => + Ok(RuntimeCall::Utility(pallet_utility::Call::::batch { + calls: calls + .into_iter() + .map(|c| Self::map(c)) + .collect::, _>>()?, + })), + RcRuntimeCall::Utility(RcUtilityCall::batch_all { calls }) => + Ok(RuntimeCall::Utility(pallet_utility::Call::::batch_all { + calls: calls + .into_iter() + .map(|c| Self::map(c)) + .collect::, _>>()?, + })), + RcRuntimeCall::Utility(RcUtilityCall::force_batch { calls }) => + Ok(RuntimeCall::Utility(pallet_utility::Call::::force_batch { + calls: calls + .into_iter() + .map(|c| Self::map(c)) + .collect::, _>>()?, + })), + RcRuntimeCall::Treasury(RcTreasuryCall::spend { + asset_kind, + amount, + beneficiary, + valid_from, + }) => { + let (asset_kind, beneficiary) = + RcToAhTreasurySpend::convert((*asset_kind, *beneficiary))?; + Ok(RuntimeCall::Treasury(pallet_treasury::Call::::spend { + asset_kind: Box::new(asset_kind), + amount, + beneficiary: Box::new(beneficiary), + valid_from, + })) + }, + RcRuntimeCall::Treasury(inner_call) => { + let call = + inner_call.using_encoded(|mut e| Decode::decode(&mut e)).map_err(|err| { + log::error!( + target: LOG_TARGET, + "Failed to decode inner RC call into inner AH call: {:?}", + err + ); + })?; + Ok(RuntimeCall::Treasury(call)) + }, + RcRuntimeCall::Referenda(inner_call) => { + let call = + inner_call.using_encoded(|mut e| Decode::decode(&mut e)).map_err(|err| { + log::error!( + target: LOG_TARGET, + "Failed to decode RC Referenda call to AH Referenda call: {:?}", + err + ); + })?; + Ok(RuntimeCall::Referenda(call)) + }, + RcRuntimeCall::Bounties(inner_call) => { + let call = + inner_call.using_encoded(|mut e| Decode::decode(&mut e)).map_err(|err| { + log::error!( + target: LOG_TARGET, + "Failed to decode RC Bounties call to AH Bounties call: {:?}", + err + ); + })?; + Ok(RuntimeCall::Bounties(call)) + }, + RcRuntimeCall::ChildBounties(inner_call) => { + let call = + inner_call.using_encoded(|mut e| Decode::decode(&mut e)).map_err(|err| { + log::error!( + target: LOG_TARGET, + "Failed to decode RC ChildBounties call to AH ChildBounties call: {:?}", + err + ); + })?; + Ok(RuntimeCall::ChildBounties(call)) + }, + } + } +} + +/// Convert RC Treasury Spend (AssetKind, Beneficiary) parameters to AH Treasury Spend (AssetKind, +/// Beneficiary) parameters. +pub struct RcToAhTreasurySpend; +impl + Convert< + (VersionedLocatableAsset, VersionedLocation), + Result<(VersionedLocatableAsset, VersionedLocatableAccount), ()>, + > for RcToAhTreasurySpend +{ + fn convert( + (asset_kind, beneficiary): (VersionedLocatableAsset, VersionedLocation), + ) -> Result<(VersionedLocatableAsset, VersionedLocatableAccount), ()> { + let asset_kind = LocatableAssetConverter::try_convert(asset_kind).map_err(|_| { + log::error!(target: LOG_TARGET, "Failed to convert RC asset kind to latest version"); + })?; + if asset_kind.location != xcm::v5::Location::new(0, xcm::v5::Junction::Parachain(1000)) { + log::error!( + target: LOG_TARGET, + "Unsupported RC asset kind location: {:?}", + asset_kind.location + ); + return Err(()); + }; + let asset_kind = VersionedLocatableAsset::V5 { + location: xcm::v5::Location::here(), + asset_id: asset_kind.asset_id, + }; + let beneficiary = beneficiary.try_into().map_err(|_| { + log::error!( + target: LOG_TARGET, + "Failed to convert RC beneficiary type to the latest version" + ); + })?; + let beneficiary = VersionedLocatableAccount::V4 { + location: xcm::v4::Location::here(), + account_id: beneficiary, + }; + Ok((asset_kind, beneficiary)) + } +} 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 index bfb557ee81..dfa791b9af 100644 --- 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 @@ -67,6 +67,10 @@ fn asset_hub_kusama_genesis( "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, + "staking": { + "validatorCount": 1000, + "devStakers": Some((2_000, 25_000)), + }, "foreignAssets": ForeignAssetsConfig { assets: foreign_assets .into_iter() diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/governance/mod.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/governance/mod.rs new file mode 100644 index 0000000000..ec75f9d1c6 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/governance/mod.rs @@ -0,0 +1,100 @@ +// 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 . + +//! Governance configurations for the Asset Hub runtime. + +use super::*; +use crate::xcm_config::FellowshipLocation; +use frame_support::traits::EitherOf; +use frame_system::EnsureRootWithSuccess; +use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; +use xcm::latest::BodyId; + +mod origins; +pub use origins::{ + pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, LeaseAdmin, + ReferendumCanceller, ReferendumKiller, Spender, StakingAdmin, Treasurer, WhitelistedCaller, +}; +mod tracks; +pub use tracks::TracksInfo; + +parameter_types! { + pub const VoteLockingPeriod: BlockNumber = 7 * RC_DAYS; +} + +impl pallet_conviction_voting::Config for Runtime { + type WeightInfo = weights::pallet_conviction_voting::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type VoteLockingPeriod = VoteLockingPeriod; + type MaxVotes = ConstU32<512>; + type MaxTurnout = + frame_support::traits::tokens::currency::ActiveIssuanceOf; + type Polls = Referenda; + type BlockNumberProvider = RelaychainDataProvider; + type VotingHooks = (); +} + +parameter_types! { + pub const AlarmInterval: BlockNumber = 1; + pub const SubmissionDeposit: Balance = QUID; + pub const UndecidingTimeout: BlockNumber = 14 * RC_DAYS; +} + +parameter_types! { + pub const MaxBalance: Balance = Balance::MAX; +} +pub type TreasurySpender = EitherOf, Spender>; + +impl origins::pallet_custom_origins::Config for Runtime {} + +parameter_types! { + // Fellows pluralistic body. + pub const FellowsBodyId: BodyId = BodyId::Technical; +} + +impl pallet_whitelist::Config for Runtime { + type WeightInfo = weights::pallet_whitelist::WeightInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WhitelistOrigin = EitherOfDiverse< + EnsureRoot, + EnsureXcm>, + >; + type DispatchWhitelistedOrigin = EitherOf, WhitelistedCaller>; + type Preimages = Preimage; +} + +impl pallet_referenda::Config for Runtime { + type WeightInfo = weights::pallet_referenda::WeightInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type Scheduler = Scheduler; + type Currency = Balances; + type SubmitOrigin = frame_system::EnsureSigned; + type CancelOrigin = EitherOf, ReferendumCanceller>; + type KillOrigin = EitherOf, ReferendumKiller>; + type Slash = Treasury; + type Votes = pallet_conviction_voting::VotesOf; + type Tally = pallet_conviction_voting::TallyOf; + type SubmissionDeposit = SubmissionDeposit; + type MaxQueued = ConstU32<100>; + type UndecidingTimeout = UndecidingTimeout; + type AlarmInterval = AlarmInterval; + type Tracks = TracksInfo; + type Preimages = Preimage; + type BlockNumberProvider = RelaychainDataProvider; +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/governance/origins.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/governance/origins.rs new file mode 100644 index 0000000000..db9c76f25b --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/governance/origins.rs @@ -0,0 +1,198 @@ +// 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 . + +//! Custom origins for governance interventions. + +pub use pallet_custom_origins::*; + +// From https://github.com/polkadot-fellows/runtimes/blob/7bbf00566d86d51fcd5582779e7e9c37a814405e/relay/polkadot/src/governance/origins.rs#L21-L154 +#[frame_support::pallet] +pub mod pallet_custom_origins { + use crate::{Balance, GRAND, QUID}; + use frame_support::pallet_prelude::*; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::pallet] + pub struct Pallet(_); + + #[derive( + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + DecodeWithMemTracking, + TypeInfo, + RuntimeDebug, + )] + #[pallet::origin] + pub enum Origin { + /// Origin for cancelling slashes. + StakingAdmin, + /// Origin for spending (any amount of) funds. + Treasurer, + /// Origin for managing the composition of the fellowship. + FellowshipAdmin, + /// Origin for managing the registrar and permissioned HRMP channel operations. + GeneralAdmin, + /// Origin for starting auctions. + AuctionAdmin, + /// Origin able to force slot leases. + LeaseAdmin, + /// Origin able to cancel referenda. + ReferendumCanceller, + /// Origin able to kill referenda. + ReferendumKiller, + /// Origin able to spend up to 1 KSM from the treasury at once. + SmallTipper, + /// Origin able to spend up to 5 KSM from the treasury at once. + BigTipper, + /// Origin able to spend up to 50 KSM from the treasury at once. + SmallSpender, + /// Origin able to spend up to 500 KSM from the treasury at once. + MediumSpender, + /// Origin able to spend up to 5,000 KSM from the treasury at once. + BigSpender, + /// Origin able to dispatch a whitelisted call. + WhitelistedCaller, + + /* START: Fellowship Origins */ + /* + Keep Fellowship Origins until the migration is not done to avoid any decoding issues. + These origins cannot be selected at the OpenGov and not used in the Asset Hub. + */ + /// Origin commanded by any members of the Polkadot Fellowship (no Dan grade needed). + FellowshipInitiates, + /// Origin commanded by Polkadot Fellows (3rd Dan fellows or greater). + Fellows, + /// Origin commanded by Polkadot Experts (5th Dan fellows or greater). + FellowshipExperts, + /// Origin commanded by Polkadot Masters (7th Dan fellows of greater). + FellowshipMasters, + /// Origin commanded by rank 1 of the Polkadot Fellowship and with a success of 1. + Fellowship1Dan, + /// Origin commanded by rank 2 of the Polkadot Fellowship and with a success of 2. + Fellowship2Dan, + /// Origin commanded by rank 3 of the Polkadot Fellowship and with a success of 3. + Fellowship3Dan, + /// Origin commanded by rank 4 of the Polkadot Fellowship and with a success of 4. + Fellowship4Dan, + /// Origin commanded by rank 5 of the Polkadot Fellowship and with a success of 5. + Fellowship5Dan, + /// Origin commanded by rank 6 of the Polkadot Fellowship and with a success of 6. + Fellowship6Dan, + /// Origin commanded by rank 7 of the Polkadot Fellowship and with a success of 7. + Fellowship7Dan, + /// Origin commanded by rank 8 of the Polkadot Fellowship and with a success of 8. + Fellowship8Dan, + /// Origin commanded by rank 9 of the Polkadot Fellowship and with a success of 9. + Fellowship9Dan, + + /* END: Fellowship Origins */ + #[codec(index = 27)] + WishForChange, + } + + macro_rules! decl_unit_ensures { + ( $name:ident: $success_type:ty = $success:expr ) => { + pub struct $name; + impl> + From> + EnsureOrigin for $name + { + type Success = $success_type; + fn try_origin(o: O) -> Result { + o.into().and_then(|o| match o { + Origin::$name => Ok($success), + r => Err(O::from(r)), + }) + } + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin() -> Result { + Ok(O::from(Origin::$name)) + } + } + }; + ( $name:ident ) => { decl_unit_ensures! { $name : () = () } }; + ( $name:ident: $success_type:ty = $success:expr, $( $rest:tt )* ) => { + decl_unit_ensures! { $name: $success_type = $success } + decl_unit_ensures! { $( $rest )* } + }; + ( $name:ident, $( $rest:tt )* ) => { + decl_unit_ensures! { $name } + decl_unit_ensures! { $( $rest )* } + }; + () => {} + } + decl_unit_ensures!( + StakingAdmin, + Treasurer, + FellowshipAdmin, + GeneralAdmin, + AuctionAdmin, + LeaseAdmin, + ReferendumCanceller, + ReferendumKiller, + WhitelistedCaller, + WishForChange, + ); + + macro_rules! decl_ensure { + ( + $vis:vis type $name:ident: EnsureOrigin { + $( $item:ident = $success:expr, )* + } + ) => { + $vis struct $name; + impl> + From> + EnsureOrigin for $name + { + type Success = $success_type; + fn try_origin(o: O) -> Result { + o.into().and_then(|o| match o { + $( + Origin::$item => Ok($success), + )* + r => Err(O::from(r)), + }) + } + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin() -> Result { + // By convention the more privileged origins go later, so for greatest chance + // of success, we want the last one. + let _result: Result = Err(()); + $( + let _result: Result = Ok(O::from(Origin::$item)); + )* + _result + } + } + } + } + + decl_ensure! { + pub type Spender: EnsureOrigin { + SmallTipper = 250 * QUID, + BigTipper = GRAND, + SmallSpender = 10 * GRAND, + MediumSpender = 100 * GRAND, + BigSpender = 1_000 * GRAND, + Treasurer = 10_000 * GRAND, + } + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/governance/tracks.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/governance/tracks.rs new file mode 100644 index 0000000000..cd0f397933 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/governance/tracks.rs @@ -0,0 +1,339 @@ +// 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 . + +//! Track configurations for governance. + +use super::*; + +use alloc::borrow::Cow; +use sp_runtime::str_array as s; + +const fn percent(x: i32) -> sp_arithmetic::FixedI64 { + sp_arithmetic::FixedI64::from_rational(x as u128, 100) +} +use pallet_referenda::Curve; +const APP_ROOT: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100)); +const SUP_ROOT: Curve = Curve::make_linear(28, 28, percent(0), percent(50)); +const APP_STAKING_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100)); +const SUP_STAKING_ADMIN: Curve = + Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50)); +const APP_TREASURER: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100)); +const SUP_TREASURER: Curve = Curve::make_linear(28, 28, percent(0), percent(50)); +const APP_FELLOWSHIP_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100)); +const SUP_FELLOWSHIP_ADMIN: Curve = + Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50)); +const APP_GENERAL_ADMIN: Curve = + Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100)); +const SUP_GENERAL_ADMIN: Curve = + Curve::make_reciprocal(7, 28, percent(10), percent(0), percent(50)); +const APP_AUCTION_ADMIN: Curve = + Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100)); +const SUP_AUCTION_ADMIN: Curve = + Curve::make_reciprocal(7, 28, percent(10), percent(0), percent(50)); +const APP_LEASE_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100)); +const SUP_LEASE_ADMIN: Curve = Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50)); +const APP_REFERENDUM_CANCELLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100)); +const SUP_REFERENDUM_CANCELLER: Curve = + Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50)); +const APP_REFERENDUM_KILLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100)); +const SUP_REFERENDUM_KILLER: Curve = + Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50)); +const APP_SMALL_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100)); +const SUP_SMALL_TIPPER: Curve = Curve::make_reciprocal(1, 28, percent(4), percent(0), percent(50)); +const APP_BIG_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100)); +const SUP_BIG_TIPPER: Curve = Curve::make_reciprocal(8, 28, percent(1), percent(0), percent(50)); +const APP_SMALL_SPENDER: Curve = Curve::make_linear(17, 28, percent(50), percent(100)); +const SUP_SMALL_SPENDER: Curve = + Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50)); +const APP_MEDIUM_SPENDER: Curve = Curve::make_linear(23, 28, percent(50), percent(100)); +const SUP_MEDIUM_SPENDER: Curve = + Curve::make_reciprocal(16, 28, percent(1), percent(0), percent(50)); +const APP_BIG_SPENDER: Curve = Curve::make_linear(28, 28, percent(50), percent(100)); +const SUP_BIG_SPENDER: Curve = Curve::make_reciprocal(20, 28, percent(1), percent(0), percent(50)); +const APP_WHITELISTED_CALLER: Curve = + Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100)); +const SUP_WHITELISTED_CALLER: Curve = + Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50)); + +const TRACKS_DATA: [pallet_referenda::Track; 16] = [ + pallet_referenda::Track { + id: 0, + info: pallet_referenda::TrackInfo { + name: s("root"), + max_deciding: 1, + decision_deposit: 100 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 24 * RC_HOURS, + min_enactment_period: 24 * RC_HOURS, + min_approval: APP_ROOT, + min_support: SUP_ROOT, + }, + }, + pallet_referenda::Track { + id: 1, + info: pallet_referenda::TrackInfo { + name: s("whitelisted_caller"), + max_deciding: 100, + decision_deposit: 10 * GRAND, + prepare_period: 30 * RC_MINUTES, + decision_period: 14 * RC_DAYS, + confirm_period: 10 * RC_MINUTES, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_WHITELISTED_CALLER, + min_support: SUP_WHITELISTED_CALLER, + }, + }, + pallet_referenda::Track { + id: 2, + info: pallet_referenda::TrackInfo { + name: s("wish_for_change"), + max_deciding: 10, + decision_deposit: 20 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 24 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_ROOT, + min_support: SUP_ROOT, + }, + }, + pallet_referenda::Track { + id: 10, + info: pallet_referenda::TrackInfo { + name: s("staking_admin"), + max_deciding: 10, + decision_deposit: 5 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 3 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_STAKING_ADMIN, + min_support: SUP_STAKING_ADMIN, + }, + }, + pallet_referenda::Track { + id: 11, + info: pallet_referenda::TrackInfo { + name: s("treasurer"), + max_deciding: 10, + decision_deposit: GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 48 * RC_HOURS, + min_enactment_period: 24 * RC_HOURS, + min_approval: APP_TREASURER, + min_support: SUP_TREASURER, + }, + }, + pallet_referenda::Track { + id: 12, + info: pallet_referenda::TrackInfo { + name: s("lease_admin"), + max_deciding: 10, + decision_deposit: 5 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 3 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_LEASE_ADMIN, + min_support: SUP_LEASE_ADMIN, + }, + }, + pallet_referenda::Track { + id: 13, + info: pallet_referenda::TrackInfo { + name: s("fellowship_admin"), + max_deciding: 10, + decision_deposit: 5 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 3 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_FELLOWSHIP_ADMIN, + min_support: SUP_FELLOWSHIP_ADMIN, + }, + }, + pallet_referenda::Track { + id: 14, + info: pallet_referenda::TrackInfo { + name: s("general_admin"), + max_deciding: 10, + decision_deposit: 5 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 3 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_GENERAL_ADMIN, + min_support: SUP_GENERAL_ADMIN, + }, + }, + pallet_referenda::Track { + id: 15, + info: pallet_referenda::TrackInfo { + name: s("auction_admin"), + max_deciding: 10, + decision_deposit: 5 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 3 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_AUCTION_ADMIN, + min_support: SUP_AUCTION_ADMIN, + }, + }, + pallet_referenda::Track { + id: 20, + info: pallet_referenda::TrackInfo { + name: s("referendum_canceller"), + max_deciding: 1_000, + decision_deposit: 10 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 7 * RC_DAYS, + confirm_period: 3 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_REFERENDUM_CANCELLER, + min_support: SUP_REFERENDUM_CANCELLER, + }, + }, + pallet_referenda::Track { + id: 21, + info: pallet_referenda::TrackInfo { + name: s("referendum_killer"), + max_deciding: 1_000, + decision_deposit: 50 * GRAND, + prepare_period: 2 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 3 * RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_REFERENDUM_KILLER, + min_support: SUP_REFERENDUM_KILLER, + }, + }, + pallet_referenda::Track { + id: 30, + info: pallet_referenda::TrackInfo { + name: s("small_tipper"), + max_deciding: 200, + decision_deposit: QUID, + prepare_period: RC_MINUTES, + decision_period: 7 * RC_DAYS, + confirm_period: 10 * RC_MINUTES, + min_enactment_period: RC_MINUTES, + min_approval: APP_SMALL_TIPPER, + min_support: SUP_SMALL_TIPPER, + }, + }, + pallet_referenda::Track { + id: 31, + info: pallet_referenda::TrackInfo { + name: s("big_tipper"), + max_deciding: 100, + decision_deposit: 10 * QUID, + prepare_period: 10 * RC_MINUTES, + decision_period: 7 * RC_DAYS, + confirm_period: RC_HOURS, + min_enactment_period: 10 * RC_MINUTES, + min_approval: APP_BIG_TIPPER, + min_support: SUP_BIG_TIPPER, + }, + }, + pallet_referenda::Track { + id: 32, + info: pallet_referenda::TrackInfo { + name: s("small_spender"), + max_deciding: 50, + decision_deposit: 100 * QUID, + prepare_period: 4 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 12 * RC_HOURS, + min_enactment_period: 24 * RC_HOURS, + min_approval: APP_SMALL_SPENDER, + min_support: SUP_SMALL_SPENDER, + }, + }, + pallet_referenda::Track { + id: 33, + info: pallet_referenda::TrackInfo { + name: s("medium_spender"), + max_deciding: 50, + decision_deposit: 200 * QUID, + prepare_period: 4 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 24 * RC_HOURS, + min_enactment_period: 24 * RC_HOURS, + min_approval: APP_MEDIUM_SPENDER, + min_support: SUP_MEDIUM_SPENDER, + }, + }, + pallet_referenda::Track { + id: 34, + info: pallet_referenda::TrackInfo { + name: s("big_spender"), + max_deciding: 50, + decision_deposit: 400 * QUID, + prepare_period: 4 * RC_HOURS, + decision_period: 14 * RC_DAYS, + confirm_period: 48 * RC_HOURS, + min_enactment_period: 24 * RC_HOURS, + min_approval: APP_BIG_SPENDER, + min_support: SUP_BIG_SPENDER, + }, + }, +]; + +pub struct TracksInfo; +impl pallet_referenda::TracksInfo for TracksInfo { + type Id = u16; + type RuntimeOrigin = ::PalletsOrigin; + fn tracks( + ) -> impl Iterator>> + { + TRACKS_DATA.iter().map(Cow::Borrowed) + } + fn track_for(id: &Self::RuntimeOrigin) -> Result { + if let Ok(system_origin) = frame_system::RawOrigin::try_from(id.clone()) { + match system_origin { + frame_system::RawOrigin::Root => Ok(0), + _ => Err(()), + } + } else if let Ok(custom_origin) = origins::Origin::try_from(id.clone()) { + match custom_origin { + origins::Origin::WhitelistedCaller => Ok(1), + origins::Origin::WishForChange => Ok(2), + // General admin + origins::Origin::StakingAdmin => Ok(10), + origins::Origin::Treasurer => Ok(11), + origins::Origin::LeaseAdmin => Ok(12), + origins::Origin::FellowshipAdmin => Ok(13), + origins::Origin::GeneralAdmin => Ok(14), + origins::Origin::AuctionAdmin => Ok(15), + // Referendum admins + origins::Origin::ReferendumCanceller => Ok(20), + origins::Origin::ReferendumKiller => Ok(21), + // Limited treasury spenders + origins::Origin::SmallTipper => Ok(30), + origins::Origin::BigTipper => Ok(31), + origins::Origin::SmallSpender => Ok(32), + origins::Origin::MediumSpender => Ok(33), + origins::Origin::BigSpender => Ok(34), + _ => Err(()), + } + } else { + Err(()) + } + } +} 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 06c3489178..e7dc79da23 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -18,17 +18,24 @@ //! Asset Hub Kusama, formerly known as "Statemine", is the canary network for its Polkadot cousin. #![cfg_attr(not(feature = "std"), no_std)] -#![recursion_limit = "256"] +#![recursion_limit = "512"] // Make the WASM binary available. #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +#[cfg(all(not(feature = "kusama-ahm"), feature = "on-chain-release-build"))] +compile_error!("Asset Hub migration requires the `kusama` feature"); + extern crate alloc; +pub mod ah_migration; // Genesis preset configurations. pub mod genesis_config_presets; +pub mod governance; mod impls; +pub mod staking; +pub mod treasury; mod weights; pub mod xcm_config; @@ -40,6 +47,7 @@ use assets_common::{ AssetIdForTrustBackedAssetsConvert, }; use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; +use core::cmp::Ordering; use cumulus_pallet_parachain_system::{RelayNumberMonotonicallyIncreases, RelaychainDataProvider}; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ @@ -48,9 +56,12 @@ use frame_support::{ genesis_builder_helper::{build_state, get_preset}, ord_parameter_types, parameter_types, traits::{ - fungible, fungibles, tokens::imbalance::ResolveAssetTo, AsEnsureOriginWithArg, ConstBool, - ConstU128, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, Equals, EverythingBut, - InstanceFilter, TransformOrigin, WithdrawReasons, + fungible::{self, HoldConsideration}, + fungibles, + tokens::imbalance::ResolveAssetTo, + AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, Contains, + EitherOf, EitherOfDiverse, Equals, InstanceFilter, LinearStoragePrice, PrivilegeCmp, + TheseExcept, TransformOrigin, WithdrawReasons, }, weights::{ConstantMultiplier, Weight}, BoundedVec, PalletId, @@ -59,7 +70,8 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, EnsureSigned, EnsureSignedBy, }; -use kusama_runtime_constants::time::MINUTES as RC_MINUTES; +use governance::{pallet_custom_origins, Treasurer, TreasurySpender}; +use kusama_runtime_constants::time::{DAYS as RC_DAYS, HOURS as RC_HOURS, MINUTES as RC_MINUTES}; use pallet_assets::precompiles::{InlineIdConfig, ERC20}; use pallet_nfts::PalletFeatures; use pallet_proxy::ProxyDefinition; @@ -69,7 +81,8 @@ use parachains_common::{ message_queue::*, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature, }; -use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; +use polkadot_core_primitives::AccountIndex; +use polkadot_runtime_common::{claims as pallet_claims, BlockHashCount, SlowAdjustingFeeUpdate}; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; #[cfg(any(feature = "std", test))] @@ -78,7 +91,7 @@ use sp_runtime::{ generic, impl_opaque_keys, traits::{ AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Convert, ConvertInto, - Verify, + IdentityLookup, Verify, }, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Perbill, Permill, RuntimeDebug, @@ -89,7 +102,7 @@ use sp_version::RuntimeVersion; pub use system_parachains_constants::async_backing::SLOT_DURATION; use system_parachains_constants::{ async_backing::{ - AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, + AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }, kusama::{ consensus::{ @@ -176,7 +189,7 @@ impl Contains for VestedTransferCalls { // Configure FRAME pallets to include in runtime. impl frame_system::Config for Runtime { - type BaseCallFilter = EverythingBut; + type BaseCallFilter = TheseExcept; type BlockWeights = RuntimeBlockWeights; type BlockLength = RuntimeBlockLength; type AccountId = AccountId; @@ -260,8 +273,8 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type RuntimeHoldReason = RuntimeHoldReason; type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = (); - type MaxFreezes = ConstU32<0>; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = frame_support::traits::VariantCountOf; type DoneSlashHandler = (); } @@ -428,7 +441,7 @@ impl pallet_asset_conversion::Config for Runtime { type PoolAssets = PoolAssets; type PoolSetupFee = PoolSetupFee; type PoolSetupFeeAsset = KsmLocation; - type PoolSetupFeeTarget = ResolveAssetTo; + type PoolSetupFeeTarget = ResolveAssetTo; type LiquidityWithdrawalFee = LiquidityWithdrawalFee; type LPFee = ConstU32<3>; type PalletId = AssetConversionPalletId; @@ -518,6 +531,22 @@ impl pallet_utility::Config for Runtime { type WeightInfo = weights::pallet_utility::WeightInfo; } +parameter_types! { + /// Deposit for an index in the indices pallet. + /// + /// 32 bytes for the account ID and 16 for the deposit. We cannot use `max_encoded_len` since it + /// is not const. + pub const IndexDeposit: Balance = system_para_deposit(1, 32 + 16); +} + +impl pallet_indices::Config for Runtime { + type AccountIndex = AccountIndex; + type Currency = Balances; + type Deposit = IndexDeposit; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_indices::WeightInfo; +} + parameter_types! { // One storage item; key size 32, value size 8; . pub const ProxyDepositBase: Balance = system_para_deposit(1, 40); @@ -562,12 +591,41 @@ pub enum ProxyType { AssetManager, /// Collator selection proxy. Can execute calls related to collator selection mechanism. Collator, + + // New variants introduced by the Asset Hub Migration from the Relay Chain. + /// Allow to do governance. + /// + /// Contains pallets `Treasury`, `Bounties`, `Utility`, `ChildBounties`, `ConvictionVoting`, + /// `Referenda` and `Whitelist`. + Governance, + /// Allows access to staking related calls. + /// + /// Contains the `Staking`, `Session`, `Utility`, `FastUnstake`, `VoterList`, `NominationPools` + /// pallets. + Staking, + /// Allows access to nomination pools related calls. + /// + /// Contains the `NominationPools` and `Utility` pallets. + NominationPools, + /// To be used with the remote proxy pallet to manage parachain lease auctions on the relay. + /// + /// This variant cannot do anything on Asset Hub itself. + Auction, + /// To be used with the remote proxy pallet to manage parachain registration on the relay. + /// + /// This variant cannot do anything on Asset Hub itself. + ParaRegistration, + /// Society pallet. + Society, + /// System remarks. + Spokesperson, } impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, + ProxyType::Auction | ProxyType::ParaRegistration => false, // Only for remote proxy ProxyType::NonTransfer => matches!( c, RuntimeCall::System(_) | @@ -583,7 +641,11 @@ impl InstanceFilter for ProxyType { RuntimeCall::Utility(_) | RuntimeCall::Multisig(_) | RuntimeCall::Proxy(_) | - RuntimeCall::RemoteProxyRelayChain(_) + RuntimeCall::RemoteProxyRelayChain(_) | + // TODO @ggwpez add more + RuntimeCall::Staking(_) | + RuntimeCall::Bounties(..) | + RuntimeCall::ChildBounties(..) ), ProxyType::CancelProxy => matches!( c, @@ -672,6 +734,36 @@ impl InstanceFilter for ProxyType { RuntimeCall::Utility { .. } | RuntimeCall::Multisig { .. } ), + // New variants introduced by the Asset Hub Migration from the Relay Chain. + ProxyType::Governance => matches!( + c, + RuntimeCall::Treasury(..) | + RuntimeCall::Bounties(..) | + RuntimeCall::Utility(..) | + RuntimeCall::ChildBounties(..) | + RuntimeCall::ConvictionVoting(..) | + RuntimeCall::Referenda(..) | + RuntimeCall::Whitelist(..) + ), + ProxyType::Staking => { + matches!( + c, + RuntimeCall::Staking(..) | + RuntimeCall::Session(..) | + RuntimeCall::Utility(..) | + RuntimeCall::NominationPools(..) | + RuntimeCall::VoterList(..) + ) + }, + ProxyType::NominationPools => { + matches!(c, RuntimeCall::NominationPools(..) | RuntimeCall::Utility(..)) + }, + ProxyType::Society => false, // TODO: matches!(c, RuntimeCall::Society(..)), + ProxyType::Spokesperson => matches!( + c, + RuntimeCall::System(frame_system::Call::remark { .. }) | + RuntimeCall::System(frame_system::Call::remark_with_event { .. }) + ), } } @@ -682,7 +774,13 @@ impl InstanceFilter for ProxyType { (_, ProxyType::Any) => false, (ProxyType::Assets, ProxyType::AssetOwner) => true, (ProxyType::Assets, ProxyType::AssetManager) => true, - (ProxyType::NonTransfer, ProxyType::Collator) => true, + ( + ProxyType::NonTransfer, + ProxyType::Collator | + ProxyType::Governance | + ProxyType::Staking | + ProxyType::NominationPools, + ) => true, _ => false, } } @@ -736,8 +834,8 @@ type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< impl parachain_info::Config for Runtime {} parameter_types! { - pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; - pub MessageQueueIdleServiceWeight: Weight = Perbill::from_percent(20) * RuntimeBlockWeights::get().max_block; + pub MessageQueueServiceWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; + pub MessageQueueIdleServiceWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; } impl pallet_message_queue::Config for Runtime { @@ -832,8 +930,6 @@ impl pallet_session::Config for Runtime { type Keys = SessionKeys; type WeightInfo = weights::pallet_session::WeightInfo; type DisablingStrategy = (); - type Currency = Balances; - type KeyDeposit = (); } impl pallet_aura::Config for Runtime { @@ -945,7 +1041,7 @@ impl pallet_nft_fractionalization::Config for Runtime { parameter_types! { pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); - pub const NftsMaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS; + pub const NftsMaxDeadlineDuration: BlockNumber = 12 * 30 * RC_DAYS; // re-use the Uniques deposits pub const NftsCollectionDeposit: Balance = system_para_deposit(1, 130); pub const NftsItemDeposit: Balance = system_para_deposit(1, 164) / 40; @@ -1090,6 +1186,147 @@ impl pallet_revive::Config for Runtime { type FindAuthor = ::FindAuthor; } +parameter_types! { + pub const PreimageBaseDeposit: Balance = system_para_deposit(2, 64); + pub const PreimageByteDeposit: Balance = system_para_deposit(0, 1); + pub const PreimageHoldReason: RuntimeHoldReason = + RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage); +} + +impl pallet_preimage::Config for Runtime { + type WeightInfo = weights::pallet_preimage::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type Consideration = HoldConsideration< + AccountId, + Balances, + PreimageHoldReason, + LinearStoragePrice, + >; +} + +parameter_types! { + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * + RuntimeBlockWeights::get().max_block; + pub ZeroWeight: Weight = Weight::zero(); + pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); +} + +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; + +impl PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(Ordering::Equal); + } + + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} + +impl pallet_scheduler::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type RuntimeEvent = RuntimeEvent; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = + pallet_ah_migrator::LeftOrRight; + // Also allow Treasurer to schedule recurring payments. + type ScheduleOrigin = EitherOf, Treasurer>; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type WeightInfo = weights::pallet_scheduler::WeightInfo; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type Preimages = Preimage; + type BlockNumberProvider = RelaychainDataProvider; +} + +parameter_types! { + pub PalletClaimsPrefix: &'static [u8] = b"Pay KSMs to the Kusama account:"; +} + +impl pallet_claims::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type VestingSchedule = Vesting; + type Prefix = PalletClaimsPrefix; + /// Only Root can move a claim. + type MoveClaimOrigin = EnsureRoot; + type WeightInfo = weights::polkadot_runtime_common_claims::WeightInfo; +} + +impl pallet_ah_ops::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type RcBlockNumberProvider = RelaychainDataProvider; + type WeightInfo = weights::pallet_ah_ops::WeightInfo; +} + +parameter_types! { + pub const DmpQueuePriorityPattern: (BlockNumber, BlockNumber) = (18, 2); +} + +impl pallet_ah_migrator::Config for Runtime { + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type PortableHoldReason = pallet_rc_migrator::types::PortableHoldReason; + type PortableFreezeReason = pallet_rc_migrator::types::PortableFreezeReason; + type RuntimeEvent = RuntimeEvent; + type AdminOrigin = EitherOfDiverse< + EnsureRoot, + EnsureXcm>, + >; + type Currency = Balances; + type TreasuryBlockNumberProvider = RelaychainDataProvider; + type TreasuryPaymaster = treasury::TreasuryPaymaster; + type Assets = NativeAndAssets; + type CheckingAccount = xcm_config::CheckingAccount; + type RcProxyType = ah_migration::RcProxyType; + type RcToProxyType = ah_migration::RcToProxyType; + type RcBlockNumberProvider = RelaychainDataProvider; + type RcToAhCall = ah_migration::RcToAhCall; + type RcPalletsOrigin = ah_migration::RcPalletsOrigin; + type RcToAhPalletsOrigin = ah_migration::RcToAhPalletsOrigin; + type Preimage = Preimage; + type SendXcm = xcm_builder::WithUniqueTopic; + type AhWeightInfo = weights::pallet_ah_migrator::WeightInfo; + type TreasuryAccounts = ah_migration::TreasuryAccounts; + type RcToAhTreasurySpend = ah_migration::RcToAhTreasurySpend; + type AhPreMigrationCalls = ah_migration::call_filter::CallsEnabledBeforeMigration; + type AhIntraMigrationCalls = ah_migration::call_filter::CallsEnabledDuringMigration; + type AhPostMigrationCalls = ah_migration::call_filter::CallsEnabledAfterMigration; + type MessageQueue = MessageQueue; + type DmpQueuePriorityPattern = DmpQueuePriorityPattern; + #[cfg(feature = "kusama-ahm")] + type KusamaConfig = Runtime; + #[cfg(feature = "kusama-ahm")] + type RecoveryBlockNumberProvider = RelaychainDataProvider; +} + +parameter_types! { + pub const ConfigDepositBase: Balance = 500 * CENTS; + pub const FriendDepositFactor: Balance = 50 * CENTS; + pub const RecoveryDeposit: Balance = 500 * CENTS; +} + +impl pallet_recovery::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); // TODO + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type ConfigDepositBase = ConfigDepositBase; + type FriendDepositFactor = FriendDepositFactor; + type MaxFriends = ConstU32<9>; + type RecoveryDeposit = RecoveryDeposit; + type BlockNumberProvider = RelaychainDataProvider; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -1101,12 +1338,15 @@ construct_runtime!( Timestamp: pallet_timestamp = 3, ParachainInfo: parachain_info = 4, MultiBlockMigrations: pallet_migrations = 5, + Preimage: pallet_preimage = 6, + Scheduler: pallet_scheduler = 7, // Monetary stuff. Balances: pallet_balances = 10, TransactionPayment: pallet_transaction_payment = 11, AssetTxPayment: pallet_asset_conversion_tx_payment = 13, Vesting: pallet_vesting = 14, + Claims: pallet_claims = 15, // Collator support. the order of these 5 are important and shall not change. Authorship: pallet_authorship = 20, @@ -1128,6 +1368,7 @@ construct_runtime!( Multisig: pallet_multisig = 41, Proxy: pallet_proxy = 42, RemoteProxyRelayChain: pallet_remote_proxy = 43, + Indices: pallet_indices = 44, // The main stage. Assets: pallet_assets:: = 50, @@ -1138,11 +1379,37 @@ construct_runtime!( PoolAssets: pallet_assets:: = 55, AssetConversion: pallet_asset_conversion = 56, + Recovery: pallet_recovery = 57, Revive: pallet_revive = 60, // State trie migration pallet, only temporary. StateTrieMigration: pallet_state_trie_migration = 70, + + // Staking in the 80s + NominationPools: pallet_nomination_pools = 80, + VoterList: pallet_bags_list:: = 82, + DelegatedStaking: pallet_delegated_staking = 83, + StakingRcClient: pallet_staking_async_rc_client = 84, + MultiBlockElection: pallet_election_provider_multi_block = 85, + MultiBlockElectionVerifier: pallet_election_provider_multi_block::verifier = 86, + MultiBlockElectionUnsigned: pallet_election_provider_multi_block::unsigned = 87, + MultiBlockElectionSigned: pallet_election_provider_multi_block::signed = 88, + Staking: pallet_staking_async = 89, + + // OpenGov stuff + Treasury: pallet_treasury = 90, + ConvictionVoting: pallet_conviction_voting = 91, + Referenda: pallet_referenda = 92, + Origins: pallet_custom_origins = 93, + Whitelist: pallet_whitelist = 94, + Bounties: pallet_bounties = 95, + ChildBounties: pallet_child_bounties = 96, + AssetRate: pallet_asset_rate = 97, + + // Asset Hub Migration in the 250s + AhOps: pallet_ah_ops = 254, + AhMigrator: pallet_ah_migrator = 255, } ); @@ -1301,13 +1568,16 @@ mod benches { // TODO: Somehow, benchmarks for this pallet are not visible outside the pallet [pallet_asset_conversion_tx_payment, AssetTxPayment] [pallet_balances, Balances] + [pallet_indices, Indices] [pallet_message_queue, MessageQueue] [pallet_migrations, MultiBlockMigrations] [pallet_multisig, Multisig] [pallet_nft_fractionalization, NftFractionalization] [pallet_nfts, Nfts] + [pallet_preimage, Preimage] [pallet_proxy, Proxy] [pallet_remote_proxy, RemoteProxyRelayChain] + [pallet_scheduler, Scheduler] // TODO(#840): uncomment this so that pallet-revive is also benchmarked with this runtime // [pallet_revive, Revive] [pallet_session, SessionBench::] @@ -1315,10 +1585,22 @@ mod benches { [pallet_utility, Utility] [pallet_vesting, Vesting] [pallet_timestamp, Timestamp] + [pallet_treasury, Treasury] [pallet_transaction_payment, TransactionPayment] [pallet_collator_selection, CollatorSelection] [cumulus_pallet_parachain_system, ParachainSystem] [cumulus_pallet_xcmp_queue, XcmpQueue] + [pallet_conviction_voting, ConvictionVoting] + [pallet_referenda, Referenda] + [pallet_whitelist, Whitelist] + [pallet_bounties, Bounties] + [pallet_child_bounties, ChildBounties] + [pallet_asset_rate, AssetRate] + [pallet_ah_migrator, AhMigrator] + [pallet_indices, Indices] + [pallet_recovery, Recovery] + [polkadot_runtime_common::claims, Claims] + [pallet_ah_ops, AhOps] // XCM [pallet_xcm, PalletXcmExtrinsicsBenchmark::] // Bridges @@ -1326,6 +1608,17 @@ mod benches { // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + + // Staking + [pallet_staking_async, Staking] + // TODO @ggwpez [pallet_nomination_pools, NominationPools] Does not work since it depends on pallet-staking being deployed, but we only have pallet-staking-async :( + [pallet_bags_list, VoterList] + // DelegatedStaking has no calls + // TODO @ggwpez [pallet_staking_async_rc_client, StakingRcClient] + [pallet_election_provider_multi_block, MultiBlockElection] + [pallet_election_provider_multi_block_verifier, MultiBlockElectionVerifier] + [pallet_election_provider_multi_block_unsigned, MultiBlockElectionUnsigned] + [pallet_election_provider_multi_block_signed, MultiBlockElectionSigned] ); use frame_benchmarking::BenchmarkError; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/staking/bags_thresholds.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/staking/bags_thresholds.rs new file mode 100644 index 0000000000..5e34d5073f --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/staking/bags_thresholds.rs @@ -0,0 +1,234 @@ +// 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 . + +//! Autogenerated voter bag thresholds. +//! +//! Generated on 2021-07-05T14:34:44.453491278+00:00 +//! for the kusama runtime. + +/// Existential weight for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const EXISTENTIAL_WEIGHT: u64 = 33_333_333; + +/// Constant ratio between bags for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const CONSTANT_RATIO: f64 = 1.145_539_993_909_1; + +/// Upper thresholds delimiting the bag list. +pub const THRESHOLDS: [u64; 200] = [ + 33_333_333, + 38_184_666, + 43_742_062, + 50_108_281, + 57_401_040, + 65_755_187, + 75_325_197, + 86_288_026, + 98_846_385, + 113_232_487, + 129_712_342, + 148_590_675, + 170_216_561, + 194_989_878, + 223_368_704, + 255_877_784, + 293_118_235, + 335_778_661, + 384_647_885, + 440_629_536, + 504_758_756, + 578_221_342, + 662_375_673, + 758_777_824, + 869_210_344, + 995_715_212, + 1_140_631_598, + 1_306_639_114, + 1_496_807_363, + 1_714_652_697, + 1_964_203_240, + 2_250_073_368, + 2_577_549_032, + 2_952_685_502, + 3_382_419_332, + 3_874_696_621, + 4_438_619_944, + 5_084_616_664, + 5_824_631_742, + 6_672_348_610, + 7_643_442_186, + 8_755_868_715, + 10_030_197_794, + 11_489_992_720, + 13_162_246_190, + 15_077_879_420, + 17_272_313_899, + 19_786_126_359, + 22_665_799_069, + 25_964_579_327, + 29_743_464_044, + 34_072_327_620, + 39_031_213_974, + 44_711_816_618, + 51_219_174_136, + 58_673_612_428, + 67_212_969_623, + 76_995_144_813, + 88_201_017_720, + 101_037_793_302, + 115_742_833_124, + 132_588_044_352, + 151_884_907_519, + 173_990_236_034, + 199_312_773_927, + 228_320_753_830, + 261_550_554_952, + 299_616_621_127, + 343_222_822_341, + 393_175_469_814, + 450_398_225_296, + 515_949_180_262, + 591_040_420_815, + 677_060_440_060, + 775_599_812_382, + 888_480_604_352, + 1_017_790_066_098, + 1_165_919_226_119, + 1_335_607_103_187, + 1_529_991_352_850, + 1_752_666_285_025, + 2_007_749_325_472, + 2_299_957_150_072, + 2_634_692_899_685, + 3_018_146_088_258, + 3_457_407_051_560, + 3_960_598_052_785, + 4_537_023_469_264, + 5_197_341_837_346, + 5_953_762_936_697, + 6_820_273_558_240, + 7_812_896_130_365, + 8_949_984_985_591, + 10_252_565_745_880, + 11_744_724_102_088, + 13_454_051_176_370, + 15_412_153_702_632, + 17_655_238_458_639, + 20_224_781_756_373, + 23_168_296_370_008, + 26_540_210_082_583, + 30_402_872_096_348, + 34_827_705_916_070, + 39_896_530_022_963, + 45_703_070_759_499, + 52_354_695_399_464, + 59_974_397_449_015, + 68_703_070_888_447, + 78_702_115_407_088, + 90_156_420_804_069, + 103_277_785_738_759, + 118_308_834_046_123, + 135_527_501_032_588, + 155_252_172_707_386, + 177_847_572_977_594, + 203_731_507_665_501, + 233_382_590_050_230, + 267_349_090_784_630, + 306_259_075_829_029, + 350_832_019_859_793, + 401_892_109_893_305, + 460_383_485_119_292, + 527_387_694_739_404, + 604_143_696_619_511, + 692_070_766_545_736, + 792_794_741_693_469, + 908_178_083_570_703, + 1_040_354_316_321_961, + 1_191_767_477_182_765, + 1_365_217_308_553_008, + 1_563_911_027_324_411, + 1_791_522_628_715_580, + 2_052_260_821_186_860, + 2_350_946_848_602_280, + 2_693_103_638_628_474, + 3_085_057_925_791_037, + 3_534_057_237_519_885, + 4_048_403_906_342_940, + 4_637_608_586_213_668, + 5_312_566_111_603_995, + 6_085_756_951_128_531, + 6_971_477_980_728_040, + 7_986_106_843_580_624, + 9_148_404_784_952_770, + 10_479_863_561_632_778, + 12_005_102_840_561_012, + 13_752_325_434_854_380, + 15_753_838_794_879_048, + 18_046_652_397_130_688, + 20_673_162_077_088_732, + 23_681_933_959_870_064, + 27_128_602_484_145_260, + 31_076_899_124_450_156, + 35_599_830_833_736_348, + 40_781_029_996_443_328, + 46_716_300_853_732_512, + 53_515_390_995_440_424, + 61_304_020_674_959_928, + 70_226_207_470_596_936, + 80_446_929_278_126_800, + 92_155_174_875_271_168, + 105_567_438_465_310_176, + 120_931_722_816_550_704, + 138_532_125_018_688_464, + 158_694_089_650_123_072, + 181_790_426_491_212_160, + 208_248_204_055_475_872, + 238_556_646_405_290_848, + 273_276_179_270_092_192, + 313_048_792_736_563_520, + 358_609_912_124_694_080, + 410_801_996_551_064_960, + 470_590_116_626_953_088, + 539_079_799_334_522_496, + 617_537_470_046_187_776, + 707_413_869_675_350_912, + 810_370_879_959_114_368, + 928_312_252_892_475_904, + 1_063_418_812_524_189_696, + 1_218_188_780_021_782_528, + 1_395_483_967_646_286_592, + 1_598_582_695_797_773_824, + 1_831_240_411_607_374_592, + 2_097_759_129_958_809_600, + 2_403_066_980_955_773_440, + 2_752_809_334_727_236_096, + 3_153_453_188_536_351_744, + 3_612_406_746_388_564_480, + 4_138_156_402_255_148_032, + 4_740_423_659_834_265_600, + 5_430_344_890_413_097_984, + 6_220_677_252_688_132_096, + 7_126_034_582_154_840_064, + 8_163_157_611_837_691_904, + 9_351_223_520_943_572_992, + 10_712_200_535_224_332_288, + 12_271_254_135_873_939_456, + 14_057_212_388_066_050_048, + 16_103_098_993_404_108_800, + 18_446_744_073_709_551_615, +]; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/staking/mod.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/staking/mod.rs new file mode 100644 index 0000000000..79a4bcf2fc --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/staking/mod.rs @@ -0,0 +1,424 @@ +// 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 . + +//! Staking related config of the Asset Hub. +//! +//! The large pallets have their config in a sub-module, the smaller ones are defined here. + +pub mod bags_thresholds; +pub mod nom_pools; + +use crate::{governance::StakingAdmin, *}; +use frame_election_provider_support::{ElectionDataProvider, SequentialPhragmen}; +use frame_support::traits::tokens::imbalance::ResolveTo; +use pallet_election_provider_multi_block::{self as multi_block, SolutionAccuracyOf}; +use pallet_staking_async::UseValidatorsMap; +use pallet_staking_async_rc_client as rc_client; +use scale_info::TypeInfo; +use sp_arithmetic::FixedU128; +use sp_runtime::{ + transaction_validity::TransactionPriority, FixedPointNumber, SaturatedConversion, +}; +use sp_staking::SessionIndex; +use system_parachains_constants::async_backing::MINUTES; +use xcm::v5::prelude::*; + +parameter_types! { + /// Number of election pages that we operate upon. 32 * 6s block = 192s = 3.2min snapshots + pub Pages: u32 = 32; + + /// Verify 8 solutions at most. + pub storage SignedValidationPhase: u32 = Pages::get() * 8; + + // TODO: local or RC minutes? + // TODO: 15 minutes like in RC? + /// 20 mins for signed phase. + pub storage SignedPhase: u32 = 20 * MINUTES; + + // TODO: local or RC minutes? + /// Offchain miner shall mine at most 4 pages. + pub storage MinerPages: u32 = 4; + + // TODO: local or RC minutes? + // TODO: 15 minutes like in RC? + /// 30m for unsigned phase. + pub storage UnsignedPhase: u32 = 30 * MINUTES; + + // TODO: devide by 8 like in RC? + /// Allow OCW miner to at most run 4 times in the entirety of the 10m Unsigned Phase. + pub OffchainRepeat: u32 = UnsignedPhase::get() / 4; + + // TODO: 12_500 like in RC? + pub storage MaxElectingVoters: u32 = 12_500; + + /// Always equal to `staking.maxValidatorCount`. + pub storage TargetSnapshotPerBlock: u32 = 2000; + + /// Number of nominators per page of the snapshot, and consequently number of backers in the solution. + pub VoterSnapshotPerBlock: u32 = MaxElectingVoters::get().div_ceil(Pages::get()); + + // TODO: 2000 like in RC? + /// Maximum number of validators that we may want to elect. 1000 is the end target. + pub const MaxValidatorSet: u32 = 2000; + + /// In each page, we may observe up to all of the validators. + pub MaxWinnersPerPage: u32 = MaxValidatorSet::get(); + + /// In each page of the election, we allow up to all of the nominators of that page to be present. + /// + /// Translates to "no limit" as of now. + pub MaxBackersPerWinner: u32 = VoterSnapshotPerBlock::get(); + + /// Total number of backers per winner across all pages. + /// + /// Translates to "no limit" as of now. + pub MaxBackersPerWinnerFinal: u32 = MaxElectingVoters::get(); + + /// Size of the exposures. This should be small enough to make the reward payouts feasible. + pub MaxExposurePageSize: u32 = 512; +} + +frame_election_provider_support::generate_solution_type!( + #[compact] + pub struct NposCompactSolution24::< + VoterIndex = u32, + TargetIndex = u16, + Accuracy = sp_runtime::PerU16, + MaxVoters = MaxElectingVoters, + >(24) +); + +parameter_types! { + pub const BagThresholds: &'static [u64] = &bags_thresholds::THRESHOLDS; +} + +type VoterBagsListInstance = pallet_bags_list::Instance1; +impl pallet_bags_list::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ScoreProvider = Staking; + type WeightInfo = weights::pallet_bags_list::WeightInfo; + type BagThresholds = BagThresholds; + type Score = sp_npos_elections::VoteWeight; + // We have to enable it for benchmarks since the benchmark otherwise panics. + #[cfg(feature = "runtime-benchmarks")] + type MaxAutoRebagPerBlock = ConstU32<5>; + #[cfg(not(any(feature = "runtime-benchmarks")))] + type MaxAutoRebagPerBlock = ConstU32<0>; +} + +parameter_types! { + pub const DelegatedStakingPalletId: PalletId = PalletId(*b"py/dlstk"); + pub const SlashRewardFraction: Perbill = Perbill::from_percent(1); +} + +impl pallet_delegated_staking::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type PalletId = DelegatedStakingPalletId; + type Currency = Balances; + // slashes are sent to the treasury. + type OnSlash = ResolveTo; + type SlashRewardFraction = SlashRewardFraction; + type RuntimeHoldReason = RuntimeHoldReason; + type CoreStaking = Staking; +} + +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub BenchElectionBounds: frame_election_provider_support::bounds::ElectionBounds = + frame_election_provider_support::bounds::ElectionBoundsBuilder::default().build(); +} + +#[cfg(feature = "runtime-benchmarks")] +pub struct OnChainConfig; + +#[cfg(feature = "runtime-benchmarks")] +impl frame_election_provider_support::onchain::Config for OnChainConfig { + // unbounded + type Bounds = BenchElectionBounds; + // We should not need sorting, as our bounds are large enough for the number of + // nominators/validators in this test setup. + type Sort = ConstBool; + type DataProvider = Staking; + type MaxBackersPerWinner = MaxBackersPerWinner; + type MaxWinnersPerPage = MaxWinnersPerPage; + type Solver = frame_election_provider_support::SequentialPhragmen; + type System = Runtime; + type WeightInfo = (); +} + +impl multi_block::Config for Runtime { + type Pages = Pages; + type UnsignedPhase = UnsignedPhase; + type SignedPhase = SignedPhase; + type SignedValidationPhase = SignedValidationPhase; + type VoterSnapshotPerBlock = VoterSnapshotPerBlock; + type TargetSnapshotPerBlock = TargetSnapshotPerBlock; + type AdminOrigin = EitherOfDiverse, StakingAdmin>; + type DataProvider = Staking; + type MinerConfig = Self; + type Verifier = MultiBlockElectionVerifier; + // we chill and do nothing in the fallback. + #[cfg(not(feature = "runtime-benchmarks"))] + type Fallback = multi_block::Continue; + #[cfg(feature = "runtime-benchmarks")] + type Fallback = frame_election_provider_support::onchain::OnChainExecution; + // Revert back to signed phase if nothing is submitted and queued, so we prolong the election. + type AreWeDone = multi_block::RevertToSignedIfNotQueuedOf; + type OnRoundRotation = multi_block::CleanRound; + // Note: these pallets are currently not "easily" benchmark-able in CIs. They provide a set of + // weights for polkadot/kusama/westend. Using the polkadot-variant is good enough for now. + type WeightInfo = multi_block::weights::kusama::MultiBlockWeightInfo; +} + +impl multi_block::verifier::Config for Runtime { + type MaxWinnersPerPage = MaxWinnersPerPage; + type MaxBackersPerWinner = MaxBackersPerWinner; + type MaxBackersPerWinnerFinal = MaxBackersPerWinnerFinal; + type SolutionDataProvider = MultiBlockElectionSigned; + type SolutionImprovementThreshold = (); + type WeightInfo = multi_block::weights::polkadot::MultiBlockVerifierWeightInfo; +} + +parameter_types! { + pub MaxSubmissions: u32 = 16; // TODO: 16 like in RC? + pub DepositBase: Balance = 5 * UNITS; // TODO: new deposit base? + pub DepositPerPage: Balance = 1 * UNITS; // TODO: new deposit per page? + pub BailoutGraceRatio: Perbill = Perbill::from_percent(50); + pub EjectGraceRatio: Perbill = Perbill::from_percent(50); + pub RewardBase: Balance = 10 * UNITS; // TODO: new reward base? +} + +impl multi_block::signed::Config for Runtime { + type Currency = Balances; + type BailoutGraceRatio = BailoutGraceRatio; + type EjectGraceRatio = EjectGraceRatio; + type DepositBase = DepositBase; + type DepositPerPage = DepositPerPage; + type InvulnerableDeposit = (); + type RewardBase = RewardBase; + type MaxSubmissions = MaxSubmissions; + type EstimateCallFee = TransactionPayment; + type WeightInfo = multi_block::weights::polkadot::MultiBlockSignedWeightInfo; +} + +parameter_types! { + /// Priority of the offchain miner transactions. + pub MinerTxPriority: TransactionPriority = TransactionPriority::max_value() / 2; +} + +impl multi_block::unsigned::Config for Runtime { + type MinerPages = MinerPages; + type OffchainStorage = ConstBool; + type OffchainSolver = SequentialPhragmen>; + type MinerTxPriority = MinerTxPriority; + type OffchainRepeat = OffchainRepeat; + type WeightInfo = multi_block::weights::polkadot::MultiBlockUnsignedWeightInfo; +} + +parameter_types! { + /// Miner transaction can fill up to 75% of the block size. + pub MinerMaxLength: u32 = Perbill::from_rational(75u32, 100) * + *RuntimeBlockLength::get() + .max + .get(DispatchClass::Normal); +} + +impl multi_block::unsigned::miner::MinerConfig for Runtime { + type AccountId = AccountId; + type Hash = Hash; + type MaxBackersPerWinner = ::MaxBackersPerWinner; + type MaxBackersPerWinnerFinal = + ::MaxBackersPerWinnerFinal; + type MaxWinnersPerPage = ::MaxWinnersPerPage; + type MaxVotesPerVoter = + <::DataProvider as ElectionDataProvider>::MaxVotesPerVoter; + type MaxLength = MinerMaxLength; + type Solver = ::OffchainSolver; + type Pages = Pages; + type Solution = NposCompactSolution24; + type VoterSnapshotPerBlock = ::VoterSnapshotPerBlock; + type TargetSnapshotPerBlock = ::TargetSnapshotPerBlock; +} + +// We cannot re-use the one from the relay since that is for pallet-staking and will be removed soon +// anyway. +pub struct EraPayout; +impl pallet_staking_async::EraPayout for EraPayout { + fn era_payout( + _total_staked: Balance, + _total_issuance: Balance, + era_duration_millis: u64, + ) -> (Balance, Balance) { + // TODO: review, copied from Polkadot. + const MILLISECONDS_PER_YEAR: u64 = (1000 * 3600 * 24 * 36525) / 100; + // A normal-sized era will have 1 / 365.25 here: + let relative_era_len = + FixedU128::from_rational(era_duration_millis.into(), MILLISECONDS_PER_YEAR.into()); + + // Fixed total TI that we use as baseline for the issuance. + let fixed_total_issuance: i128 = 5_216_342_402_773_185_773; + let fixed_inflation_rate = FixedU128::from_rational(8, 100); + let yearly_emission = fixed_inflation_rate.saturating_mul_int(fixed_total_issuance); + + let era_emission = relative_era_len.saturating_mul_int(yearly_emission); + // 15% to treasury, as per Polkadot ref 1139. + let to_treasury = FixedU128::from_rational(15, 100).saturating_mul_int(era_emission); + let to_stakers = era_emission.saturating_sub(to_treasury); + + (to_stakers.saturated_into(), to_treasury.saturated_into()) + } +} + +// See: TODO @kianenigma +// https://github.com/paseo-network/runtimes/blob/7904882933075551e23d32d86dbb97b971e84bca/relay/paseo/src/lib.rs#L662 +// https://github.com/paseo-network/runtimes/blob/7904882933075551e23d32d86dbb97b971e84bca/relay/paseo/constants/src/lib.rs#L49 +parameter_types! { + pub const SessionsPerEra: SessionIndex = 6; + pub const RelaySessionDuration: BlockNumber = 1 * HOURS; // TODO: RC hours/minutes? + pub const BondingDuration: sp_staking::EraIndex = 28; + pub const SlashDeferDuration: sp_staking::EraIndex = 27; + pub const MaxControllersInDeprecationBatch: u32 = 5169; // TODO: 5169 like in RC? + // alias for 16, which is the max nominations per nominator in the runtime. + pub const MaxNominations: u32 = ::LIMIT as u32; + pub const MaxEraDuration: u64 = RelaySessionDuration::get() as u64 * RELAY_CHAIN_SLOT_DURATION_MILLIS as u64 * SessionsPerEra::get() as u64; +} + +impl pallet_staking_async::Config for Runtime { + type Filter = (); + type OldCurrency = Balances; + type Currency = Balances; + type CurrencyBalance = Balance; + type RuntimeHoldReason = RuntimeHoldReason; + type CurrencyToVote = sp_staking::currency_to_vote::SaturatingCurrencyToVote; + type RewardRemainder = ResolveTo; + type Slash = ResolveTo; + type Reward = (); + type SessionsPerEra = SessionsPerEra; + type BondingDuration = BondingDuration; + type SlashDeferDuration = SlashDeferDuration; + type AdminOrigin = EitherOf, StakingAdmin>; + type EraPayout = EraPayout; + type MaxExposurePageSize = MaxExposurePageSize; + type ElectionProvider = MultiBlockElection; + type VoterList = VoterList; + type TargetList = UseValidatorsMap; + type MaxValidatorSet = MaxValidatorSet; + type NominationsQuota = pallet_staking_async::FixedNominationsQuota<{ MaxNominations::get() }>; + type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; + type HistoryDepth = frame_support::traits::ConstU32<84>; + type MaxControllersInDeprecationBatch = MaxControllersInDeprecationBatch; + type EventListeners = (NominationPools, DelegatedStaking); + type WeightInfo = weights::pallet_staking_async::WeightInfo; + type MaxInvulnerables = frame_support::traits::ConstU32<20>; + type PlanningEraOffset = + pallet_staking_async::PlanningEraOffsetOf>; + type RcClientInterface = StakingRcClient; + type MaxEraDuration = MaxEraDuration; +} + +impl pallet_staking_async_rc_client::Config for Runtime { + type RelayChainOrigin = EnsureRoot; + type AHStakingInterface = Staking; + type SendToRelayChain = StakingXcmToRelayChain; +} + +#[derive(Encode, Decode)] +// Call indices taken from westend-next runtime. +pub enum RelayChainRuntimePallets { + // Audit: index of `StakingAhClient` on the Relay Chain. + #[codec(index = 48)] + AhClient(AhClientCalls), +} + +#[derive(Encode, Decode)] +pub enum AhClientCalls { + // index of `fn validator_set` in `staking-async-ah-client`. It has only one call. + #[codec(index = 0)] + ValidatorSet(rc_client::ValidatorSetReport), +} + +pub struct ValidatorSetToXcm; +impl sp_runtime::traits::Convert, Xcm<()>> + for ValidatorSetToXcm +{ + fn convert(report: rc_client::ValidatorSetReport) -> Xcm<()> { + Xcm(vec![ + Instruction::UnpaidExecution { + weight_limit: WeightLimit::Unlimited, + check_origin: None, + }, + Instruction::Transact { + origin_kind: OriginKind::Native, + fallback_max_weight: None, + call: RelayChainRuntimePallets::AhClient(AhClientCalls::ValidatorSet(report)) + .encode() + .into(), + }, + ]) + } +} + +parameter_types! { + pub RelayLocation: Location = Location::parent(); +} + +pub struct StakingXcmToRelayChain; + +impl rc_client::SendToRelayChain for StakingXcmToRelayChain { + type AccountId = AccountId; + fn validator_set(report: rc_client::ValidatorSetReport) { + rc_client::XCMSender::< + xcm_config::XcmRouter, + RelayLocation, + rc_client::ValidatorSetReport, + ValidatorSetToXcm, + >::split_then_send(report, Some(8)); + } +} + +impl frame_system::offchain::CreateTransactionBase for Runtime +where + RuntimeCall: From, +{ + type RuntimeCall = RuntimeCall; + type Extrinsic = UncheckedExtrinsic; +} + +impl frame_system::offchain::CreateTransaction for Runtime +where + RuntimeCall: From, +{ + type Extension = TxExtension; + + fn create_transaction(call: RuntimeCall, extension: TxExtension) -> UncheckedExtrinsic { + // TODO: double check. the only way I found to access the `new_transaction` method. + // `UncheckedExtrinsic` is not generic::UncheckedExtrinsic, its wrapped by pallet revive's + // type `UncheckedExtrinsic`. + ::Identity::new_transaction(call, extension).into() + } +} + +impl frame_system::offchain::CreateBare for Runtime +where + RuntimeCall: From, +{ + fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic { + // TODO: double check. the only way I found to access the `new_bare` method. + // `UncheckedExtrinsic` is not generic::UncheckedExtrinsic, its wrapped by pallet revive's + // type `UncheckedExtrinsic`. + ::Identity::new_bare(call).into() + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/staking/nom_pools.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/staking/nom_pools.rs new file mode 100644 index 0000000000..d49d8f4546 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/staking/nom_pools.rs @@ -0,0 +1,49 @@ +// 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 . + +//! Config for the nomination pools. + +use crate::{staking::StakingAdmin, *}; +use frame_support::traits::Nothing; +use sp_runtime::FixedU128; + +parameter_types! { + pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls"); + // Allow pools that got slashed up to 90% to remain operational. + pub const MaxPointsToBalance: u8 = 10; +} + +impl pallet_nomination_pools::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type RuntimeFreezeReason = RuntimeFreezeReason; + type RewardCounter = FixedU128; + type BalanceToU256 = polkadot_runtime_common::BalanceToU256; + type U256ToBalance = polkadot_runtime_common::U256ToBalance; + type StakeAdapter = + pallet_nomination_pools::adapter::DelegateStake; + type PostUnbondingPoolsWindow = frame_support::traits::ConstU32<4>; + type MaxMetadataLen = frame_support::traits::ConstU32<256>; + // we use the same number of allowed unlocking chunks as with staking. + type MaxUnbonding = ::MaxUnlockingChunks; + type PalletId = PoolsPalletId; + type MaxPointsToBalance = MaxPointsToBalance; + type WeightInfo = (); // TODO @ggwpez cannot do this until the nomination pools pallet is fixed to be benchmarkable + // with pallet-staking-async. + type AdminOrigin = EitherOf, StakingAdmin>; + type Filter = Nothing; // TODO: or pallet_staking::AllStakers as in RC? + type BlockNumberProvider = RelaychainDataProvider; +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/treasury.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/treasury.rs new file mode 100644 index 0000000000..dd3f8bc6a7 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/treasury.rs @@ -0,0 +1,133 @@ +// 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. + +// TODO review all module + +use crate::*; +use frame_support::traits::{tokens::UnityOrOuterConversion, FromContains}; +use parachains_common::pay::VersionedLocatableAccount; +use polkadot_runtime_common::impls::{ContainsParts, VersionedLocatableAsset}; + +parameter_types! { + pub const SpendPeriod: BlockNumber = 6 * RC_DAYS; + pub const DisableSpends: BlockNumber = BlockNumber::MAX; + pub const Burn: Permill = Permill::from_percent(1); + pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + pub const PayoutSpendPeriod: BlockNumber = 90 * RC_DAYS; + pub const MaxApprovals: u32 = 100; + // Account address: `13UVJyLnbVp9RBZYFwFGyDvVd1y27Tt8tkntv6Q7JVPhFsTB` + pub TreasuryAccount: AccountId = Treasury::account_id(); +} + +pub type TreasuryPaymaster = parachains_common::pay::LocalPay< + NativeAndAssets, + TreasuryAccount, + xcm_config::LocationToAccountId, +>; + +impl pallet_treasury::Config for Runtime { + type PalletId = TreasuryPalletId; + type Currency = Balances; + type RejectOrigin = EitherOfDiverse, Treasurer>; + type RuntimeEvent = RuntimeEvent; + type SpendPeriod = pallet_ah_migrator::LeftOrRight; + type Burn = Burn; + type BurnDestination = (); + type SpendFunds = Bounties; + type MaxApprovals = MaxApprovals; + type WeightInfo = weights::pallet_treasury::WeightInfo; + type SpendOrigin = TreasurySpender; + type AssetKind = VersionedLocatableAsset; + type Beneficiary = VersionedLocatableAccount; + type BeneficiaryLookup = IdentityLookup; + type Paymaster = TreasuryPaymaster; + type BalanceConverter = AssetRateWithNative; + type PayoutPeriod = PayoutSpendPeriod; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = parachains_common::pay::benchmarks::LocalPayArguments< + xcm_config::TrustBackedAssetsPalletIndex, + >; + type BlockNumberProvider = RelaychainDataProvider; +} + +parameter_types! { + // where `176` is the size of the `Bounty` struct in bytes. + pub const BountyDepositBase: Balance = system_para_deposit(0, 176); + // per byte for the bounty description. + pub const DataDepositPerByte: Balance = system_para_deposit(0, 1); + pub const BountyDepositPayoutDelay: BlockNumber = 0; + // Bounties expire after 10 years. + pub const BountyUpdatePeriod: BlockNumber = 10 * 12 * 30 * RC_DAYS; + pub const MaximumReasonLength: u32 = 16384; + pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); + pub const CuratorDepositMin: Balance = 10 * CENTS; + pub const CuratorDepositMax: Balance = 500 * CENTS; + pub const BountyValueMinimum: Balance = 200 * CENTS; +} + +impl pallet_bounties::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BountyDepositBase = BountyDepositBase; + type BountyDepositPayoutDelay = BountyDepositPayoutDelay; + type BountyUpdatePeriod = BountyUpdatePeriod; + type CuratorDepositMultiplier = CuratorDepositMultiplier; + type CuratorDepositMin = CuratorDepositMin; + type CuratorDepositMax = CuratorDepositMax; + type BountyValueMinimum = BountyValueMinimum; + type ChildBountyManager = ChildBounties; + type DataDepositPerByte = DataDepositPerByte; + type MaximumReasonLength = MaximumReasonLength; + type OnSlash = Treasury; + type WeightInfo = weights::pallet_bounties::WeightInfo; +} + +parameter_types! { + pub const MaxActiveChildBountyCount: u32 = 100; + pub const ChildBountyValueMinimum: Balance = BountyValueMinimum::get() / 10; +} + +impl pallet_child_bounties::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MaxActiveChildBountyCount = MaxActiveChildBountyCount; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type WeightInfo = weights::pallet_child_bounties::WeightInfo; +} + +/// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the +/// `AssetRate` pallet instance. +/// +/// With additional decoration to identify different IDs/locations of native asset and provide a +/// one-to-one balance conversion for them. +pub type AssetRateWithNative = UnityOrOuterConversion< + ContainsParts< + FromContains< + xcm_builder::IsChildSystemParachain, + xcm_builder::IsParentsOnly>, + >, + >, + AssetRate, +>; + +impl pallet_asset_rate::Config for Runtime { + type WeightInfo = weights::pallet_asset_rate::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type CreateOrigin = EitherOfDiverse, Treasurer>; + type RemoveOrigin = EitherOfDiverse, Treasurer>; + type UpdateOrigin = EitherOfDiverse, Treasurer>; + type Currency = Balances; + type AssetKind = ::AssetKind; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments; +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs index 0a96804959..aec5499f54 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/mod.rs @@ -36,15 +36,34 @@ pub mod pallet_proxy; pub mod pallet_remote_proxy; // TODO(#840): uncomment this so that pallet-revive is also benchmarked with this runtime // pub mod pallet_revive; +pub mod pallet_ah_migrator; +pub mod pallet_ah_ops; +pub mod pallet_asset_rate; +pub mod pallet_bags_list; +pub mod pallet_bounties; +pub mod pallet_child_bounties; +pub mod pallet_conviction_voting; +pub mod pallet_election_provider_multi_block; +pub mod pallet_election_provider_multi_block_signed; +pub mod pallet_election_provider_multi_block_unsigned; +pub mod pallet_election_provider_multi_block_verifier; +pub mod pallet_indices; +pub mod pallet_preimage; +pub mod pallet_referenda; +pub mod pallet_scheduler; pub mod pallet_session; +pub mod pallet_staking_async; pub mod pallet_timestamp; pub mod pallet_transaction_payment; +pub mod pallet_treasury; pub mod pallet_uniques; pub mod pallet_utility; pub mod pallet_vesting; +pub mod pallet_whitelist; pub mod pallet_xcm; pub mod pallet_xcm_bridge_hub_router; pub mod paritydb_weights; +pub mod polkadot_runtime_common_claims; pub mod rocksdb_weights; pub mod xcm; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_ah_migrator.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_ah_migrator.rs new file mode 100644 index 0000000000..6177039c1c --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_ah_migrator.rs @@ -0,0 +1,588 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_ah_migrator` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Olivers-MacBook-Pro.local`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// ./target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --extrinsic +// +// --pallet +// pallet_ah_migrator +// --heap-pages +// 4096 +// --header=.github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_ah_migrator`. +pub struct WeightInfo(PhantomData); +impl pallet_ah_migrator::WeightInfo for WeightInfo { + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_multisigs(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(1_209_456, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 52_135 + .saturating_add(Weight::from_parts(12_733_708, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:255 w:255) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:255 w:255) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:255 w:255) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_accounts(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `34309 + n * (1050 ±0)` + // Estimated: `990 + n * (3774 ±0)` + // Minimum execution time: 73_000_000 picoseconds. + Weight::from_parts(80_000_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 73_945 + .saturating_add(Weight::from_parts(76_965_383, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_liquid_accounts(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(24_804_997, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 27_336 + .saturating_add(Weight::from_parts(20_362_852, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `Claims::Vesting` (r:255 w:255) + /// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_claims(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `43` + // Estimated: `990 + n * (2531 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(3_676_051, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 2_688 + .saturating_add(Weight::from_parts(1_785_633, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) + } + /// Storage: `Proxy::Proxies` (r:255 w:255) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_proxy_proxies(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `990 + n * (3716 ±0)` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(2_817_412, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 4_759 + .saturating_add(Weight::from_parts(3_309_148, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3716).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_proxy_announcements(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(12_384_963, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 10_748 + .saturating_add(Weight::from_parts(13_324_647, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `Vesting::Vesting` (r:255 w:255) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Vesting::StorageVersion` (r:0 w:1) + /// Proof: `Vesting::StorageVersion` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_vesting_schedules(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `204` + // Estimated: `990 + n * (3532 ±0)` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(3_815_323, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 4_616 + .saturating_add(Weight::from_parts(3_021_115, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3532).saturating_mul(n.into())) + } + /// Storage: `NominationPools::SubPoolsStorage` (r:255 w:255) + /// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForSubPoolsStorage` (r:1 w:1) + /// Proof: `NominationPools::CounterForSubPoolsStorage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_nom_pools_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `264` + // Estimated: `1489 + n * (3672 ±0)` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(6_643_805, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 4_391 + .saturating_add(Weight::from_parts(3_998_668, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3672).saturating_mul(n.into())) + } + /// Storage: `Referenda::DecidingCount` (r:0 w:16) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumCount` (r:0 w:1) + /// Proof: `Referenda::ReferendumCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:0 w:16) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + fn receive_referenda_values() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 35_000_000 picoseconds. + Weight::from_parts(40_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(33)) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:0 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// The range of component `m` is `[1, 4000000]`. + fn receive_single_active_referendums(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `144 + m * (1 ±0)` + // Estimated: `3609 + m * (1 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(8_000_000, 0) + .saturating_add(Weight::from_parts(0, 3609)) + // Standard Error: 8 + .saturating_add(Weight::from_parts(1_833, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(m.into())) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:0 w:255) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_complete_referendums(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 5_956 + .saturating_add(Weight::from_parts(1_248_838, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:0 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// The range of component `m` is `[1, 4000000]`. + fn receive_single_scheduler_agenda(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `144 + m * (1 ±0)` + // Estimated: `3609 + m * (1 ±0)` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) + .saturating_add(Weight::from_parts(0, 3609)) + // Standard Error: 8 + .saturating_add(Weight::from_parts(1_856, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(m.into())) + } + /// Storage: `Scheduler::Lookup` (r:0 w:255) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_scheduler_lookup(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(3_463_733, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 3_062 + .saturating_add(Weight::from_parts(1_021_975, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `VoterList::ListNodes` (r:255 w:255) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_bags_list_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16209 + n * (485 ±0)` + // Estimated: `1489 + n * (2629 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(36_930_358, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 8_966 + .saturating_add(Weight::from_parts(5_007_274, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2629).saturating_mul(n.into())) + } + /// Storage: `Indices::Accounts` (r:255 w:255) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_indices(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `990 + n * (2544 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 4_300 + .saturating_add(Weight::from_parts(2_061_139, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2544).saturating_mul(n.into())) + } + /// Storage: `ConvictionVoting::VotingFor` (r:0 w:255) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_conviction_voting_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(29_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 40_484 + .saturating_add(Weight::from_parts(21_227_919, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Bounties::Bounties` (r:0 w:255) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_bounties_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(3_125_181, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 2_947 + .saturating_add(Weight::from_parts(1_166_082, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `AssetRate::ConversionRateToNative` (r:0 w:255) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_asset_rates(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(2_503_595, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 6_148 + .saturating_add(Weight::from_parts(2_154_128, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `AhOps::RcCrowdloanContribution` (r:255 w:255) + /// Proof: `AhOps::RcCrowdloanContribution` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_crowdloan_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `990 + n * (2587 ±0)` + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_594_335, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 42_852 + .saturating_add(Weight::from_parts(5_324_762, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2587).saturating_mul(n.into())) + } + /// Storage: `Referenda::MetadataOf` (r:0 w:255) + /// Proof: `Referenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_referenda_metadata(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(3_324_055, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 4_675 + .saturating_add(Weight::from_parts(1_050_250, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Treasury::Spends` (r:0 w:255) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(2456), added: 4931, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_treasury_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(87_407, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 44_241 + .saturating_add(Weight::from_parts(4_257_705, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `DelegatedStaking::Agents` (r:255 w:255) + /// Proof: `DelegatedStaking::Agents` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) + /// Storage: `DelegatedStaking::CounterForAgents` (r:1 w:1) + /// Proof: `DelegatedStaking::CounterForAgents` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_delegated_staking_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `1489 + n * (2595 ±0)` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(3_965_017, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 9_028 + .saturating_add(Weight::from_parts(2_776_513, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2595).saturating_mul(n.into())) + } + /// Storage: `System::Account` (r:255 w:255) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_preimage_legacy_status(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `16867 + n * (584 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 51_019 + .saturating_add(Weight::from_parts(13_337_869, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } + /// Storage: `Preimage::RequestStatusFor` (r:255 w:0) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 255]`. + fn receive_preimage_request_status(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `57 + n * (47 ±0)` + // Estimated: `990 + n * (2566 ±0)` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(6_136_012, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 3_834 + .saturating_add(Weight::from_parts(2_065_009, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into())) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// The range of component `m` is `[1, 80]`. + fn receive_preimage_chunk(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + m * (49900 ±0)` + // Estimated: `3469 + m * (48969 ±24)` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) + .saturating_add(Weight::from_parts(0, 3469)) + // Standard Error: 122_813 + .saturating_add(Weight::from_parts(26_253_720, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 48969).saturating_mul(m.into())) + } + /// Storage: `ChildBounties::ChildBountyDescriptionsV1` (r:0 w:100) + /// Proof: `ChildBounties::ChildBountyDescriptionsV1` (`max_values`: None, `max_size`: Some(16412), added: 18887, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 100]`. + fn receive_child_bounties_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(5_131_873, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 85_675 + .saturating_add(Weight::from_parts(8_240_026, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `Staking::UnappliedSlashes` (r:0 w:100) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(24735), added: 27210, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 100]`. + fn receive_staking_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(12_802_327, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 55_802 + .saturating_add(Weight::from_parts(5_900_033, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: `AhMigrator::AhMigrationStage` (r:1 w:1) + /// Proof: `AhMigrator::AhMigrationStage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_set_stage() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1486` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(Weight::from_parts(0, 1486)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0) + /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) + /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AhMigrator::AhMigrationStage` (r:1 w:1) + /// Proof: `AhMigrator::AhMigrationStage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `AhMigrator::AhBalancesBefore` (r:0 w:1) + /// Proof: `AhMigrator::AhBalancesBefore` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn start_migration() -> Weight { + // Proof Size summary in bytes: + // Measured: `1358` + // Estimated: `4823` + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) + .saturating_add(Weight::from_parts(0, 4823)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `AhMigrator::AhBalancesBefore` (r:1 w:0) + /// Proof: `AhMigrator::AhBalancesBefore` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: `AhMigrator::AhMigrationStage` (r:1 w:1) + /// Proof: `AhMigrator::AhMigrationStage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn finish_migration() -> Weight { + // Proof Size summary in bytes: + // Measured: `133` + // Estimated: `1517` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AhMigrator::DmpQueuePriorityConfig` (r:1 w:0) + /// Proof: `AhMigrator::DmpQueuePriorityConfig` (`max_values`: Some(1), `max_size`: Some(9), added: 504, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:0) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:0 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + fn force_dmp_queue_priority() -> Weight { + // Proof Size summary in bytes: + // Measured: `336` + // Estimated: `3517` + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AhMigrator::DmpQueuePriorityConfig` (r:1 w:1) + /// Proof: `AhMigrator::DmpQueuePriorityConfig` (`max_values`: Some(1), `max_size`: Some(9), added: 504, mode: `MaxEncodedLen`) + fn set_dmp_queue_priority() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1494` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) + .saturating_add(Weight::from_parts(0, 1494)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AhMigrator::Manager` (r:1 w:1) + /// Proof: `AhMigrator::Manager` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + fn set_manager() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1517` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) + .saturating_add(Weight::from_parts(0, 1517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_ah_ops.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_ah_ops.rs new file mode 100644 index 0000000000..eaac6326fc --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_ah_ops.rs @@ -0,0 +1,110 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_ah_ops` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-07-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Mac`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// ./target/release/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm +// --pallet +// pallet-ah-ops +// --extrinsic +// +// --header +// .github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_ah_ops`. +pub struct WeightInfo(PhantomData); +impl pallet_ah_ops::WeightInfo for WeightInfo { + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AhOps::RcLeaseReserve` (r:1 w:1) + /// Proof: `AhOps::RcLeaseReserve` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn unreserve_lease_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `365` + // Estimated: `3593` + // Minimum execution time: 36_000_000 picoseconds. + Weight::from_parts(37_000_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AhOps::RcCrowdloanContribution` (r:1 w:1) + /// Proof: `AhOps::RcCrowdloanContribution` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) + /// Storage: `AhOps::RcLeaseReserve` (r:1 w:1) + /// Proof: `AhOps::RcLeaseReserve` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn withdraw_crowdloan_contribution() -> Weight { + // Proof Size summary in bytes: + // Measured: `538` + // Estimated: `6196` + // Minimum execution time: 93_000_000 picoseconds. + Weight::from_parts(95_000_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AhOps::RcCrowdloanContribution` (r:1 w:0) + /// Proof: `AhOps::RcCrowdloanContribution` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`) + /// Storage: `AhOps::RcCrowdloanReserve` (r:1 w:1) + /// Proof: `AhOps::RcCrowdloanReserve` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn unreserve_crowdloan_reserve() -> Weight { + // Proof Size summary in bytes: + // Measured: `365` + // Estimated: `3593` + // Minimum execution time: 41_000_000 picoseconds. + Weight::from_parts(43_000_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_asset_rate.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_asset_rate.rs new file mode 100644 index 0000000000..c5f13a16e5 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_asset_rate.rs @@ -0,0 +1,87 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_asset_rate` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `59a913dd07aa`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_asset_rate +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_asset_rate`. +pub struct WeightInfo(PhantomData); +impl pallet_asset_rate::WeightInfo for WeightInfo { + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:1) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `4703` + // Minimum execution time: 13_920_000 picoseconds. + Weight::from_parts(14_980_000, 0) + .saturating_add(Weight::from_parts(0, 4703)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:1) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + fn update() -> Weight { + // Proof Size summary in bytes: + // Measured: `110` + // Estimated: `4703` + // Minimum execution time: 14_650_000 picoseconds. + Weight::from_parts(15_640_000, 0) + .saturating_add(Weight::from_parts(0, 4703)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:1) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + fn remove() -> Weight { + // Proof Size summary in bytes: + // Measured: `110` + // Estimated: `4703` + // Minimum execution time: 16_200_000 picoseconds. + Weight::from_parts(16_810_000, 0) + .saturating_add(Weight::from_parts(0, 4703)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_bags_list.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_bags_list.rs new file mode 100644 index 0000000000..f1ad4ee385 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_bags_list.rs @@ -0,0 +1,138 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_bags_list` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 48.0.0 +//! DATE: 2025-07-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm +// --extrinsic +// +// --header +// .github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights/ +// --heap-pages=4096 +// --pallet=pallet_staking_async,pallet_fast_unstake,pallet_bags_list,pallet_election_provider_multi_block,pallet_election_provider_multi_block_verifier,pallet_election_provider_multi_block_unsigned,pallet_election_provider_multi_block_signed + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_bags_list`. +pub struct WeightInfo(PhantomData); +impl pallet_bags_list::WeightInfo for WeightInfo { + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:4 w:4) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn rebag_non_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `4880` + // Estimated: `11506` + // Minimum execution time: 176_351_000 picoseconds. + Weight::from_parts(181_961_000, 0) + .saturating_add(Weight::from_parts(0, 11506)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn rebag_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `4816` + // Estimated: `8877` + // Minimum execution time: 166_490_000 picoseconds. + Weight::from_parts(189_421_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:4 w:4) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:2 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:2 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn put_in_front_of() -> Weight { + // Proof Size summary in bytes: + // Measured: `7272` + // Estimated: `11506` + // Minimum execution time: 236_251_000 picoseconds. + Weight::from_parts(250_121_000, 0) + .saturating_add(Weight::from_parts(0, 11506)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `VoterList::CounterForListNodes` (r:1 w:0) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::NextNodeAutoRebagged` (r:1 w:1) + /// Proof: `VoterList::NextNodeAutoRebagged` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:200 w:4) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:7 w:6) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:5 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:5 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + fn on_idle() -> Weight { + // Proof Size summary in bytes: + // Measured: `14094` + // Estimated: `512390` + // Minimum execution time: 882_142_000 picoseconds. + Weight::from_parts(938_933_000, 0) + .saturating_add(Weight::from_parts(0, 512390)) + .saturating_add(T::DbWeight::get().reads(220)) + .saturating_add(T::DbWeight::get().writes(11)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_bounties.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_bounties.rs new file mode 100644 index 0000000000..55cdf2a539 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_bounties.rs @@ -0,0 +1,247 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `59a913dd07aa`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_bounties +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_bounties::WeightInfo for WeightInfo { + fn poke_deposit() -> Weight { // FAIL-CI re-run + Weight::from_parts(36_041_148, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Bounties::BountyCount` (r:1 w:1) + /// Proof: `Bounties::BountyCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyDescriptions` (r:0 w:1) + /// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + /// Storage: `Bounties::Bounties` (r:0 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// The range of component `d` is `[0, 16384]`. + fn propose_bounty(d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `181` + // Estimated: `3593` + // Minimum execution time: 33_990_000 picoseconds. + Weight::from_parts(36_041_148, 0) + .saturating_add(Weight::from_parts(0, 3593)) + // Standard Error: 16 + .saturating_add(Weight::from_parts(804, 0).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyApprovals` (r:1 w:1) + /// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + fn approve_bounty_with_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `176` + // Estimated: `3642` + // Minimum execution time: 14_120_000 picoseconds. + Weight::from_parts(14_539_000, 3642) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyApprovals` (r:1 w:1) + /// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + fn approve_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `273` + // Estimated: `3642` + // Minimum execution time: 17_540_000 picoseconds. + Weight::from_parts(18_540_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + fn propose_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `293` + // Estimated: `3642` + // Minimum execution time: 14_980_000 picoseconds. + Weight::from_parts(16_120_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn unassign_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `572` + // Estimated: `6196` + // Minimum execution time: 49_700_000 picoseconds. + Weight::from_parts(50_680_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn accept_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `465` + // Estimated: `3642` + // Minimum execution time: 35_460_000 picoseconds. + Weight::from_parts(36_060_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ParentChildBounties` (r:1 w:0) + /// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + fn award_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `332` + // Estimated: `3642` + // Minimum execution time: 19_130_000 picoseconds. + Weight::from_parts(21_050_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1) + /// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyDescriptions` (r:0 w:1) + /// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + fn claim_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `696` + // Estimated: `8799` + // Minimum execution time: 136_411_000 picoseconds. + Weight::from_parts(142_871_000, 0) + .saturating_add(Weight::from_parts(0, 8799)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ParentChildBounties` (r:1 w:0) + /// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyDescriptions` (r:0 w:1) + /// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + fn close_bounty_proposed() -> Weight { + // Proof Size summary in bytes: + // Measured: `479` + // Estimated: `6196` + // Minimum execution time: 52_211_000 picoseconds. + Weight::from_parts(54_380_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ParentChildBounties` (r:1 w:0) + /// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyDescriptions` (r:0 w:1) + /// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + fn close_bounty_active() -> Weight { + // Proof Size summary in bytes: + // Measured: `715` + // Estimated: `8799` + // Minimum execution time: 95_430_000 picoseconds. + Weight::from_parts(97_801_000, 0) + .saturating_add(Weight::from_parts(0, 8799)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + fn extend_bounty_expiry() -> Weight { + // Proof Size summary in bytes: + // Measured: `329` + // Estimated: `3642` + // Minimum execution time: 15_411_000 picoseconds. + Weight::from_parts(16_509_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Bounties::BountyApprovals` (r:1 w:1) + /// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + /// Storage: `Bounties::Bounties` (r:100 w:100) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:200 w:200) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `b` is `[0, 100]`. + fn spend_funds(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `19 + b * (299 ±0)` + // Estimated: `1887 + b * (5206 ±0)` + // Minimum execution time: 5_520_000 picoseconds. + Weight::from_parts(5_701_000, 0) + .saturating_add(Weight::from_parts(0, 1887)) + // Standard Error: 26_277 + .saturating_add(Weight::from_parts(44_312_204, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into()))) + .saturating_add(Weight::from_parts(0, 5206).saturating_mul(b.into())) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_child_bounties.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_child_bounties.rs new file mode 100644 index 0000000000..e35271e9a2 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_child_bounties.rs @@ -0,0 +1,200 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_child_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `59a913dd07aa`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_child_bounties +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_child_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_child_bounties::WeightInfo for WeightInfo { + /// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Bounties::Bounties` (r:1 w:0) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBountyCount` (r:1 w:1) + /// Proof: `ChildBounties::ChildBountyCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1) + /// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBounties` (r:0 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + /// The range of component `d` is `[0, 16384]`. + fn add_child_bounty(d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `472` + // Estimated: `6196` + // Minimum execution time: 77_210_000 picoseconds. + Weight::from_parts(82_262_316, 0) + .saturating_add(Weight::from_parts(0, 6196)) + // Standard Error: 31 + .saturating_add(Weight::from_parts(532, 0).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Bounties::Bounties` (r:1 w:0) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1) + /// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + fn propose_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `526` + // Estimated: `3642` + // Minimum execution time: 21_209_000 picoseconds. + Weight::from_parts(22_180_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Bounties::Bounties` (r:1 w:0) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn accept_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `672` + // Estimated: `3642` + // Minimum execution time: 37_400_000 picoseconds. + Weight::from_parts(38_920_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `ChildBounties::ChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + /// Storage: `Bounties::Bounties` (r:1 w:0) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn unassign_curator() -> Weight { + // Proof Size summary in bytes: + // Measured: `775` + // Estimated: `6196` + // Minimum execution time: 52_451_000 picoseconds. + Weight::from_parts(54_321_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Bounties::Bounties` (r:1 w:0) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + fn award_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `569` + // Estimated: `3642` + // Minimum execution time: 23_052_000 picoseconds. + Weight::from_parts(23_530_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `ChildBounties::ChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1) + /// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + fn claim_child_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `8799` + // Minimum execution time: 127_932_000 picoseconds. + Weight::from_parts(129_501_000, 0) + .saturating_add(Weight::from_parts(0, 8799)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Bounties::Bounties` (r:1 w:0) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1) + /// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1) + /// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + fn close_child_bounty_added() -> Weight { + // Proof Size summary in bytes: + // Measured: `772` + // Estimated: `6196` + // Minimum execution time: 86_830_000 picoseconds. + Weight::from_parts(90_451_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Bounties::Bounties` (r:1 w:0) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1) + /// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1) + /// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1) + /// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`) + fn close_child_bounty_active() -> Weight { + // Proof Size summary in bytes: + // Measured: `959` + // Estimated: `8799` + // Minimum execution time: 105_281_000 picoseconds. + Weight::from_parts(108_190_000, 0) + .saturating_add(Weight::from_parts(0, 8799)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(7)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_conviction_voting.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_conviction_voting.rs new file mode 100644 index 0000000000..4cb3a15247 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_conviction_voting.rs @@ -0,0 +1,201 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_conviction_voting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `122e32c8e414`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_conviction_voting +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_conviction_voting`. +pub struct WeightInfo(PhantomData); +impl pallet_conviction_voting::WeightInfo for WeightInfo { + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `ConvictionVoting::VotingFor` (r:1 w:1) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// Storage: `ConvictionVoting::ClassLocksFor` (r:1 w:1) + /// Proof: `ConvictionVoting::ClassLocksFor` (`max_values`: None, `max_size`: Some(329), added: 2804, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn vote_new() -> Weight { + // Proof Size summary in bytes: + // Measured: `13475` + // Estimated: `42428` + // Minimum execution time: 160_931_000 picoseconds. + Weight::from_parts(167_191_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `ConvictionVoting::VotingFor` (r:1 w:1) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// Storage: `ConvictionVoting::ClassLocksFor` (r:1 w:1) + /// Proof: `ConvictionVoting::ClassLocksFor` (`max_values`: None, `max_size`: Some(329), added: 2804, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn vote_existing() -> Weight { + // Proof Size summary in bytes: + // Measured: `14196` + // Estimated: `83866` + // Minimum execution time: 195_681_000 picoseconds. + Weight::from_parts(210_071_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `ConvictionVoting::VotingFor` (r:1 w:1) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn remove_vote() -> Weight { + // Proof Size summary in bytes: + // Measured: `13986` + // Estimated: `83866` + // Minimum execution time: 162_132_000 picoseconds. + Weight::from_parts(175_391_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `ConvictionVoting::VotingFor` (r:1 w:1) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + fn remove_other_vote() -> Weight { + // Proof Size summary in bytes: + // Measured: `13110` + // Estimated: `30706` + // Minimum execution time: 86_191_000 picoseconds. + Weight::from_parts(90_031_000, 0) + .saturating_add(Weight::from_parts(0, 30706)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `ConvictionVoting::VotingFor` (r:2 w:2) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:512 w:512) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `ConvictionVoting::ClassLocksFor` (r:1 w:1) + /// Proof: `ConvictionVoting::ClassLocksFor` (`max_values`: None, `max_size`: Some(329), added: 2804, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:50) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 512]`. + fn delegate(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `28982 + r * (364 ±0)` + // Estimated: `83866 + r * (3411 ±0)` + // Minimum execution time: 91_901_000 picoseconds. + Weight::from_parts(1_009_006_564, 0) + .saturating_add(Weight::from_parts(0, 83866)) + // Standard Error: 80_116 + .saturating_add(Weight::from_parts(25_729_462, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(45)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 3411).saturating_mul(r.into())) + } + /// Storage: `ConvictionVoting::VotingFor` (r:2 w:2) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:512 w:512) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:50) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 512]`. + fn undelegate(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `28935 + r * (364 ±0)` + // Estimated: `83866 + r * (3411 ±0)` + // Minimum execution time: 51_560_000 picoseconds. + Weight::from_parts(939_538_302, 0) + .saturating_add(Weight::from_parts(0, 83866)) + // Standard Error: 80_657 + .saturating_add(Weight::from_parts(25_807_301, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(43)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 3411).saturating_mul(r.into())) + } + /// Storage: `ConvictionVoting::VotingFor` (r:1 w:1) + /// Proof: `ConvictionVoting::VotingFor` (`max_values`: None, `max_size`: Some(27241), added: 29716, mode: `MaxEncodedLen`) + /// Storage: `ConvictionVoting::ClassLocksFor` (r:1 w:1) + /// Proof: `ConvictionVoting::ClassLocksFor` (`max_values`: None, `max_size`: Some(329), added: 2804, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + fn unlock() -> Weight { + // Proof Size summary in bytes: + // Measured: `12303` + // Estimated: `30706` + // Minimum execution time: 105_271_000 picoseconds. + Weight::from_parts(115_401_000, 0) + .saturating_add(Weight::from_parts(0, 30706)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block.rs new file mode 100644 index 0000000000..2a33672edc --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block.rs @@ -0,0 +1,315 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_election_provider_multi_block` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 48.0.0 +//! DATE: 2025-07-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm +// --extrinsic +// +// --header +// .github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights/ +// --heap-pages=4096 +// --pallet=pallet_staking_async,pallet_fast_unstake,pallet_bags_list,pallet_election_provider_multi_block,pallet_election_provider_multi_block_verifier,pallet_election_provider_multi_block_unsigned,pallet_election_provider_multi_block_signed + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] +#![allow(dead_code)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_election_provider_multi_block`. +pub struct WeightInfo(PhantomData); +impl pallet_election_provider_multi_block::WeightInfo for WeightInfo { + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + fn on_initialize_nothing() -> Weight { + // Proof Size summary in bytes: + // Measured: `223` + // Estimated: `3688` + // Minimum execution time: 11_180_000 picoseconds. + Weight::from_parts(11_530_000, 0) + .saturating_add(Weight::from_parts(0, 3688)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `Staking::ValidatorCount` (r:1 w:0) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Storage: `Staking::CounterForValidators` (r:1 w:0) + /// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `Staking::Validators` (r:2001 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Storage: `MultiBlockElection::DesiredTargets` (r:0 w:1) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshotHash` (r:0 w:1) + /// Proof: `MultiBlockElection::PagedTargetSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:0 w:1) + /// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(64026), added: 66501, mode: `Measured`) + fn on_initialize_into_snapshot_msp() -> Weight { + // Proof Size summary in bytes: + // Measured: `95221` + // Estimated: `5048686` + // Minimum execution time: 13_515_581_000 picoseconds. + Weight::from_parts(13_558_480_000, 0) + .saturating_add(Weight::from_parts(0, 5048686)) + .saturating_add(T::DbWeight::get().reads(2008)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `Staking::VoterSnapshotStatus` (r:1 w:1) + /// Proof: `Staking::VoterSnapshotStatus` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `Measured`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:0) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `VoterList::ListBags` (r:1 w:0) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `Measured`) + /// Storage: `VoterList::ListNodes` (r:706 w:0) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `Measured`) + /// Storage: `Staking::Bonded` (r:704 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `Measured`) + /// Storage: `Staking::Ledger` (r:704 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `Measured`) + /// Storage: `Staking::Nominators` (r:704 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `Measured`) + /// Storage: `Staking::Validators` (r:216 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Storage: `Staking::MinimumActiveStake` (r:0 w:1) + /// Proof: `Staking::MinimumActiveStake` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) + /// Storage: `VoterList::Lock` (r:0 w:1) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:0 w:1) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedVoterSnapshotHash` (r:0 w:1) + /// Proof: `MultiBlockElection::PagedVoterSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`) + fn on_initialize_into_snapshot_rest() -> Weight { + // Proof Size summary in bytes: + // Measured: `1466883` + // Estimated: `3215223` + // Minimum execution time: 38_139_334_000 picoseconds. + Weight::from_parts(42_870_088_000, 0) + .saturating_add(Weight::from_parts(0, 3215223)) + .saturating_add(T::DbWeight::get().reads(3042)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `Staking::VoterSnapshotStatus` (r:1 w:1) + /// Proof: `Staking::VoterSnapshotStatus` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `Measured`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:0) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `VoterList::ListNodes` (r:706 w:0) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `Measured`) + /// Storage: `Staking::Bonded` (r:704 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `Measured`) + /// Storage: `Staking::Ledger` (r:704 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `Measured`) + /// Storage: `Staking::Nominators` (r:704 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `Measured`) + /// Storage: `VoterList::ListBags` (r:1 w:0) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `Measured`) + /// Storage: `Staking::Validators` (r:38 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6358acd2035ec4bb863fa981e0c177b9` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6358acd2035ec4bb863fa981e0c177b9` (r:1 w:0) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Storage: `Staking::MinimumActiveStake` (r:0 w:1) + /// Proof: `Staking::MinimumActiveStake` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) + /// Storage: `VoterList::Lock` (r:0 w:1) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:0 w:1) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedVoterSnapshotHash` (r:0 w:1) + /// Proof: `MultiBlockElection::PagedVoterSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`) + fn on_initialize_into_signed() -> Weight { + // Proof Size summary in bytes: + // Measured: `1536828` + // Estimated: `3285168` + // Minimum execution time: 40_918_833_000 picoseconds. + Weight::from_parts(41_169_753_000, 0) + .saturating_add(Weight::from_parts(0, 3285168)) + .saturating_add(T::DbWeight::get().reads(2865)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + fn on_initialize_into_signed_validation() -> Weight { + // Proof Size summary in bytes: + // Measured: `417` + // Estimated: `3882` + // Minimum execution time: 45_840_000 picoseconds. + Weight::from_parts(56_110_000, 0) + .saturating_add(Weight::from_parts(0, 3882)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + fn on_initialize_into_unsigned() -> Weight { + // Proof Size summary in bytes: + // Measured: `417` + // Estimated: `3882` + // Minimum execution time: 53_260_000 picoseconds. + Weight::from_parts(56_970_000, 0) + .saturating_add(Weight::from_parts(0, 3882)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33842026), added: 33844501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `Staking::ElectableStashes` (r:1 w:1) + /// Proof: `Staking::ElectableStashes` (`max_values`: Some(1), `max_size`: Some(32002), added: 32497, mode: `Measured`) + /// Storage: `Staking::ErasStakersOverview` (r:981 w:981) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `Measured`) + /// Storage: `Staking::ErasTotalStake` (r:1 w:1) + /// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`) + /// Storage: `Staking::Validators` (r:981 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `Measured`) + /// Storage: `Staking::ErasValidatorPrefs` (r:0 w:981) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `Measured`) + /// Storage: `Staking::ErasStakersPaged` (r:0 w:980) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(24656), added: 27131, mode: `Measured`) + fn export_non_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `336781` + // Estimated: `2765746` + // Minimum execution time: 18_476_588_000 picoseconds. + Weight::from_parts(18_649_428_000, 0) + .saturating_add(Weight::from_parts(0, 2765746)) + .saturating_add(T::DbWeight::get().reads(1970)) + .saturating_add(T::DbWeight::get().writes(2945)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:1) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:32 w:32) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33842026), added: 33844501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:32 w:32) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedVoterSnapshotHash` (r:32 w:32) + /// Proof: `MultiBlockElection::PagedVoterSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:1) + /// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(64026), added: 66501, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshotHash` (r:1 w:1) + /// Proof: `MultiBlockElection::PagedTargetSnapshotHash` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `Measured`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `Staking::ElectableStashes` (r:1 w:1) + /// Proof: `Staking::ElectableStashes` (`max_values`: Some(1), `max_size`: Some(32002), added: 32497, mode: `Measured`) + /// Storage: `Staking::ErasStakersOverview` (r:995 w:995) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `Measured`) + /// Storage: `Staking::ErasStakersPaged` (r:995 w:995) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(24656), added: 27131, mode: `Measured`) + /// Storage: `Staking::ErasTotalStake` (r:1 w:1) + /// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`) + /// Storage: `Staking::Validators` (r:995 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:0 w:1) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionScore` (r:0 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionScore` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `Measured`) + /// Storage: `Staking::ErasValidatorPrefs` (r:0 w:995) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `Measured`) + /// Storage: `MultiBlockElection::DesiredTargets` (r:0 w:1) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + fn export_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `7461067` + // Estimated: `9924682` + // Minimum execution time: 48_080_914_000 picoseconds. + Weight::from_parts(48_305_537_000, 0) + .saturating_add(Weight::from_parts(0, 9924682)) + .saturating_add(T::DbWeight::get().reads(3090)) + .saturating_add(T::DbWeight::get().writes(3091)) + } + fn manage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 180_000 picoseconds. + Weight::from_parts(230_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_signed.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_signed.rs new file mode 100644 index 0000000000..86e6b07ad4 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_signed.rs @@ -0,0 +1,197 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_election_provider_multi_block::signed` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 48.0.0 +//! DATE: 2025-07-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm +// --extrinsic +// +// --header +// .github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights/ +// --heap-pages=4096 +// --pallet=pallet_staking_async,pallet_fast_unstake,pallet_bags_list,pallet_election_provider_multi_block,pallet_election_provider_multi_block_verifier,pallet_election_provider_multi_block_unsigned,pallet_election_provider_multi_block::signed + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] +#![allow(dead_code)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_election_provider_multi_block::signed`. +pub struct WeightInfo(PhantomData); +impl pallet_election_provider_multi_block::signed::WeightInfo for WeightInfo { + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:0 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + fn register_not_full() -> Weight { + // Proof Size summary in bytes: + // Measured: `3219` + // Estimated: `6684` + // Minimum execution time: 87_751_000 picoseconds. + Weight::from_parts(88_571_000, 0) + .saturating_add(Weight::from_parts(0, 6684)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `Balances::Holds` (r:2 w:2) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:2) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + fn register_eject() -> Weight { + // Proof Size summary in bytes: + // Measured: `7819` + // Estimated: `88009` + // Minimum execution time: 216_110_000 picoseconds. + Weight::from_parts(219_591_000, 0) + .saturating_add(Weight::from_parts(0, 88009)) + .saturating_add(T::DbWeight::get().reads(39)) + .saturating_add(T::DbWeight::get().writes(37)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + fn submit_page() -> Weight { + // Proof Size summary in bytes: + // Measured: `3752` + // Estimated: `7217` + // Minimum execution time: 398_791_000 picoseconds. + Weight::from_parts(409_752_000, 0) + .saturating_add(Weight::from_parts(0, 7217)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + fn unset_page() -> Weight { + // Proof Size summary in bytes: + // Measured: `26458` + // Estimated: `29923` + // Minimum execution time: 289_911_000 picoseconds. + Weight::from_parts(313_272_000, 0) + .saturating_add(Weight::from_parts(0, 29923)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + fn bail() -> Weight { + // Proof Size summary in bytes: + // Measured: `4684` + // Estimated: `84874` + // Minimum execution time: 149_251_000 picoseconds. + Weight::from_parts(150_491_000, 0) + .saturating_add(Weight::from_parts(0, 84874)) + .saturating_add(T::DbWeight::get().reads(37)) + .saturating_add(T::DbWeight::get().writes(35)) + } + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::Invulnerables` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::Invulnerables` (`max_values`: Some(1), `max_size`: Some(513), added: 1008, mode: `Measured`) + /// The range of component `p` is `[1, 32]`. + fn clear_old_round_data(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3676 + p * (32 ±0)` + // Estimated: `7141 + p * (2507 ±0)` + // Minimum execution time: 92_150_000 picoseconds. + Weight::from_parts(92_039_244, 0) + .saturating_add(Weight::from_parts(0, 7141)) + // Standard Error: 4_475 + .saturating_add(Weight::from_parts(1_255_738, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + .saturating_add(Weight::from_parts(0, 2507).saturating_mul(p.into())) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_unsigned.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_unsigned.rs new file mode 100644 index 0000000000..4ac2594f75 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_unsigned.rs @@ -0,0 +1,108 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_election_provider_multi_block::unsigned` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 48.0.0 +//! DATE: 2025-07-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm +// --extrinsic +// +// --header +// .github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights/ +// --heap-pages=4096 +// --pallet=pallet_staking_async,pallet_fast_unstake,pallet_bags_list,pallet_election_provider_multi_block,pallet_election_provider_multi_block_verifier,pallet_election_provider_multi_block::unsigned,pallet_election_provider_multi_block_signed + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] +#![allow(dead_code)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_election_provider_multi_block::unsigned`. +pub struct WeightInfo(PhantomData); +impl pallet_election_provider_multi_block::unsigned::WeightInfo for WeightInfo { + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:0) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (r:1 w:0) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionScore` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionScore` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::MinimumScore` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::MinimumScore` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `Measured`) + /// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + /// Storage: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0) + fn validate_unsigned() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3816` + // Minimum execution time: 1_972_935_000 picoseconds. + Weight::from_parts(1_990_546_000, 0) + .saturating_add(Weight::from_parts(0, 3816)) + .saturating_add(T::DbWeight::get().reads(7)) + } + /// Storage: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x33ed3d010c1fea25c2adbfba9297161f` (r:1 w:0) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionScore` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionScore` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::MinimumScore` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::MinimumScore` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(64026), added: 66501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:4 w:0) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionY` (r:0 w:4) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionY` (`max_values`: None, `max_size`: Some(33842026), added: 33844501, mode: `Measured`) + fn submit_unsigned() -> Weight { + // Proof Size summary in bytes: + // Measured: `1494854` + // Estimated: `1505744` + // Minimum execution time: 25_539_087_000 picoseconds. + Weight::from_parts(25_700_488_000, 0) + .saturating_add(Weight::from_parts(0, 1505744)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(5)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_verifier.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_verifier.rs new file mode 100644 index 0000000000..221654c0b2 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_election_provider_multi_block_verifier.rs @@ -0,0 +1,223 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_election_provider_multi_block::verifier` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 48.0.0 +//! DATE: 2025-07-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm +// --extrinsic +// +// --header +// .github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights/ +// --heap-pages=4096 +// --pallet=pallet_staking_async,pallet_fast_unstake,pallet_bags_list,pallet_election_provider_multi_block,pallet_election_provider_multi_block::verifier,pallet_election_provider_multi_block_unsigned,pallet_election_provider_multi_block_signed + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] +#![allow(dead_code)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_election_provider_multi_block::verifier`. +pub struct WeightInfo(PhantomData); +impl pallet_election_provider_multi_block::verifier::WeightInfo for WeightInfo { + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:1 w:0) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(64026), added: 66501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:0 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33842026), added: 33844501, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionBackings` (r:0 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionBackings` (`max_values`: None, `max_size`: Some(52026), added: 54501, mode: `Measured`) + fn on_initialize_valid_non_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `369597` + // Estimated: `373062` + // Minimum execution time: 5_262_150_000 picoseconds. + Weight::from_parts(5_671_372_000, 0) + .saturating_add(Weight::from_parts(0, 373062)) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(64026), added: 66501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionBackings` (r:33 w:32) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionBackings` (`max_values`: None, `max_size`: Some(52026), added: 54501, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionScore` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionScore` (`max_values`: None, `max_size`: Some(60), added: 2535, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:0 w:1) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33842026), added: 33844501, mode: `Measured`) + fn on_initialize_valid_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `2070494` + // Estimated: `2153159` + // Minimum execution time: 25_549_667_000 picoseconds. + Weight::from_parts(26_029_812_000, 0) + .saturating_add(Weight::from_parts(0, 2153159)) + .saturating_add(T::DbWeight::get().reads(79)) + .saturating_add(T::DbWeight::get().writes(72)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(64026), added: 66501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionBackings` (r:33 w:32) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionBackings` (`max_values`: None, `max_size`: Some(52026), added: 54501, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:31 w:32) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33842026), added: 33844501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + fn on_initialize_invalid_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `2071515` + // Estimated: `2154180` + // Minimum execution time: 25_533_386_000 picoseconds. + Weight::from_parts(26_026_125_000, 0) + .saturating_add(Weight::from_parts(0, 2154180)) + .saturating_add(T::DbWeight::get().reads(109)) + .saturating_add(T::DbWeight::get().writes(101)) + } + /// Storage: `MultiBlockElection::CurrentPhase` (r:1 w:1) + /// Proof: `MultiBlockElection::CurrentPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::StatusStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionVerifier::StatusStorage` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `Measured`) + /// Storage: `MultiBlockElection::Round` (r:1 w:0) + /// Proof: `MultiBlockElection::Round` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SortedScores` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SortedScores` (`max_values`: None, `max_size`: Some(653), added: 3128, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionStorage` (r:32 w:32) + /// Proof: `MultiBlockElectionSigned::SubmissionStorage` (`max_values`: None, `max_size`: Some(46544), added: 49019, mode: `Measured`) + /// Storage: `MultiBlockElection::PagedTargetSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedTargetSnapshot` (`max_values`: None, `max_size`: Some(64026), added: 66501, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x5640fd84ada5e16d1b6739279282536c` (r:1 w:0) + /// Storage: `MultiBlockElection::PagedVoterSnapshot` (r:1 w:0) + /// Proof: `MultiBlockElection::PagedVoterSnapshot` (`max_values`: None, `max_size`: Some(389338), added: 391813, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `MultiBlockElection::DesiredTargets` (r:1 w:0) + /// Proof: `MultiBlockElection::DesiredTargets` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedValidVariant` (r:1 w:0) + /// Proof: `MultiBlockElectionVerifier::QueuedValidVariant` (`max_values`: None, `max_size`: Some(13), added: 2488, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionX` (r:31 w:31) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionX` (`max_values`: None, `max_size`: Some(33842026), added: 33844501, mode: `Measured`) + /// Storage: `MultiBlockElectionVerifier::QueuedSolutionBackings` (r:31 w:31) + /// Proof: `MultiBlockElectionVerifier::QueuedSolutionBackings` (`max_values`: None, `max_size`: Some(52026), added: 54501, mode: `Measured`) + /// Storage: `MultiBlockElectionSigned::SubmissionMetadataStorage` (r:1 w:1) + /// Proof: `MultiBlockElectionSigned::SubmissionMetadataStorage` (`max_values`: None, `max_size`: Some(181), added: 2656, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// The range of component `v` is `[0, 31]`. + fn on_initialize_invalid_non_terminal(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `461848 + v * (72 ±0)` + // Estimated: `530959 + v * (2189 ±153)` + // Minimum execution time: 1_124_784_000 picoseconds. + Weight::from_parts(1_436_146_817, 0) + .saturating_add(Weight::from_parts(0, 530959)) + .saturating_add(T::DbWeight::get().reads(45)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(37)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 2189).saturating_mul(v.into())) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_indices.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_indices.rs new file mode 100644 index 0000000000..023806abdc --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_indices.rs @@ -0,0 +1,113 @@ + +//! Autogenerated weights for `pallet_indices` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-07-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Mac.parity`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// ./target/release/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --extrinsic +// +// --pallet +// pallet_indices +// --heap-pages +// 4096 +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_indices`. +pub struct WeightInfo(PhantomData); +impl pallet_indices::WeightInfo for WeightInfo { + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `3534` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `1413` + // Estimated: `3593` + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(31_000_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn free() -> Weight { + // Proof Size summary in bytes: + // Measured: `205` + // Estimated: `3534` + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `1446` + // Estimated: `3593` + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(23_000_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn freeze() -> Weight { + // Proof Size summary in bytes: + // Measured: `205` + // Estimated: `3534` + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(22_000_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn poke_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `205` + // Estimated: `3534` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_preimage.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_preimage.rs new file mode 100644 index 0000000000..c218ecd334 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_preimage.rs @@ -0,0 +1,266 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `122e32c8e414`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_preimage +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `3556` + // Minimum execution time: 56_512_000 picoseconds. + Weight::from_parts(27_330_201, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_712, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `3556` + // Minimum execution time: 18_120_000 picoseconds. + Weight::from_parts(18_810_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_697, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `3556` + // Minimum execution time: 18_880_000 picoseconds. + Weight::from_parts(19_350_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_700, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unnote_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `243` + // Estimated: `3556` + // Minimum execution time: 67_501_000 picoseconds. + Weight::from_parts(71_411_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unnote_no_deposit_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `3556` + // Minimum execution time: 35_070_000 picoseconds. + Weight::from_parts(37_531_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `188` + // Estimated: `3556` + // Minimum execution time: 25_240_000 picoseconds. + Weight::from_parts(30_241_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_no_deposit_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `3556` + // Minimum execution time: 19_899_000 picoseconds. + Weight::from_parts(22_710_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_unnoted_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `3556` + // Minimum execution time: 18_110_000 picoseconds. + Weight::from_parts(19_441_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_requested_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `3556` + // Minimum execution time: 13_891_000 picoseconds. + Weight::from_parts(14_750_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unrequest_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `3556` + // Minimum execution time: 28_680_000 picoseconds. + Weight::from_parts(32_330_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn unrequest_unnoted_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `3556` + // Minimum execution time: 13_711_000 picoseconds. + Weight::from_parts(14_680_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn unrequest_multi_referenced_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `3556` + // Minimum execution time: 13_790_000 picoseconds. + Weight::from_parts(14_650_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1023 w:1023) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1023 w:1023) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1023 w:1023) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:0 w:1023) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1024]`. + fn ensure_updated(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + n * (227 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 63_210_000 picoseconds. + Weight::from_parts(63_780_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 47_335 + .saturating_add(Weight::from_parts(66_032_530, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_referenda.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_referenda.rs new file mode 100644 index 0000000000..dc3c0df879 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_referenda.rs @@ -0,0 +1,515 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_referenda` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `122e32c8e414`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_referenda +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_referenda`. +pub struct WeightInfo(PhantomData); +impl pallet_referenda::WeightInfo for WeightInfo { + /// Storage: `Referenda::ReferendumCount` (r:1 w:1) + /// Proof: `Referenda::ReferendumCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:0 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + fn submit() -> Weight { + // Proof Size summary in bytes: + // Measured: `253` + // Estimated: `42428` + // Minimum execution time: 42_059_000 picoseconds. + Weight::from_parts(43_419_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_preparing() -> Weight { + // Proof Size summary in bytes: + // Measured: `506` + // Estimated: `83866` + // Minimum execution time: 55_240_000 picoseconds. + Weight::from_parts(56_710_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:0) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3293` + // Estimated: `42428` + // Minimum execution time: 77_491_000 picoseconds. + Weight::from_parts(80_580_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:0) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_not_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3313` + // Estimated: `42428` + // Minimum execution time: 81_770_000 picoseconds. + Weight::from_parts(91_591_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:1) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `506` + // Estimated: `83866` + // Minimum execution time: 66_431_000 picoseconds. + Weight::from_parts(69_530_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:1) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `506` + // Estimated: `83866` + // Minimum execution time: 63_751_000 picoseconds. + Weight::from_parts(67_411_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + fn refund_decision_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `384` + // Estimated: `4401` + // Minimum execution time: 34_032_000 picoseconds. + Weight::from_parts(35_621_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + fn refund_submission_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `374` + // Estimated: `4401` + // Minimum execution time: 33_590_000 picoseconds. + Weight::from_parts(36_020_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn cancel() -> Weight { + // Proof Size summary in bytes: + // Measured: `414` + // Estimated: `83866` + // Minimum execution time: 38_881_000 picoseconds. + Weight::from_parts(40_401_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Referenda::MetadataOf` (r:1 w:0) + /// Proof: `Referenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn kill() -> Weight { + // Proof Size summary in bytes: + // Measured: `758` + // Estimated: `83866` + // Minimum execution time: 108_201_000 picoseconds. + Weight::from_parts(110_161_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Referenda::TrackQueue` (r:1 w:0) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:1) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + fn one_fewer_deciding_queue_empty() -> Weight { + // Proof Size summary in bytes: + // Measured: `207` + // Estimated: `5477` + // Minimum execution time: 13_050_000 picoseconds. + Weight::from_parts(13_830_000, 0) + .saturating_add(Weight::from_parts(0, 5477)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn one_fewer_deciding_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `3183` + // Estimated: `42428` + // Minimum execution time: 49_111_000 picoseconds. + Weight::from_parts(50_760_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn one_fewer_deciding_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `3183` + // Estimated: `42428` + // Minimum execution time: 51_240_000 picoseconds. + Weight::from_parts(53_770_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + fn nudge_referendum_requeued_insertion() -> Weight { + // Proof Size summary in bytes: + // Measured: `3044` + // Estimated: `5477` + // Minimum execution time: 25_370_000 picoseconds. + Weight::from_parts(27_300_000, 0) + .saturating_add(Weight::from_parts(0, 5477)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + fn nudge_referendum_requeued_slide() -> Weight { + // Proof Size summary in bytes: + // Measured: `3044` + // Estimated: `5477` + // Minimum execution time: 25_340_000 picoseconds. + Weight::from_parts(26_981_000, 0) + .saturating_add(Weight::from_parts(0, 5477)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:0) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + fn nudge_referendum_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3048` + // Estimated: `5477` + // Minimum execution time: 31_461_000 picoseconds. + Weight::from_parts(32_699_000, 0) + .saturating_add(Weight::from_parts(0, 5477)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:0) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Referenda::TrackQueue` (r:1 w:1) + /// Proof: `Referenda::TrackQueue` (`max_values`: None, `max_size`: Some(2012), added: 4487, mode: `MaxEncodedLen`) + fn nudge_referendum_not_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3068` + // Estimated: `5477` + // Minimum execution time: 31_731_000 picoseconds. + Weight::from_parts(32_600_000, 0) + .saturating_add(Weight::from_parts(0, 5477)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_no_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `366` + // Estimated: `42428` + // Minimum execution time: 25_861_000 picoseconds. + Weight::from_parts(27_241_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_preparing() -> Weight { + // Proof Size summary in bytes: + // Measured: `414` + // Estimated: `42428` + // Minimum execution time: 25_191_000 picoseconds. + Weight::from_parts(26_540_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + fn nudge_referendum_timed_out() -> Weight { + // Proof Size summary in bytes: + // Measured: `311` + // Estimated: `4401` + // Minimum execution time: 16_760_000 picoseconds. + Weight::from_parts(17_490_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:1) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_begin_deciding_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `414` + // Estimated: `42428` + // Minimum execution time: 33_421_000 picoseconds. + Weight::from_parts(34_770_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::DecidingCount` (r:1 w:1) + /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_begin_deciding_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `414` + // Estimated: `42428` + // Minimum execution time: 36_731_000 picoseconds. + Weight::from_parts(39_240_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_begin_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `467` + // Estimated: `42428` + // Minimum execution time: 29_090_000 picoseconds. + Weight::from_parts(30_170_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_end_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `450` + // Estimated: `42428` + // Minimum execution time: 29_590_000 picoseconds. + Weight::from_parts(31_440_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_continue_not_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `467` + // Estimated: `42428` + // Minimum execution time: 28_061_000 picoseconds. + Weight::from_parts(29_220_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_continue_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `471` + // Estimated: `42428` + // Minimum execution time: 26_800_000 picoseconds. + Weight::from_parts(28_041_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Lookup` (r:1 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn nudge_referendum_approved() -> Weight { + // Proof Size summary in bytes: + // Measured: `471` + // Estimated: `83866` + // Minimum execution time: 40_910_000 picoseconds. + Weight::from_parts(42_260_000, 0) + .saturating_add(Weight::from_parts(0, 83866)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + fn nudge_referendum_rejected() -> Weight { + // Proof Size summary in bytes: + // Measured: `467` + // Estimated: `42428` + // Minimum execution time: 29_640_000 picoseconds. + Weight::from_parts(30_250_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:0) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Referenda::MetadataOf` (r:0 w:1) + /// Proof: `Referenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn set_some_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `455` + // Estimated: `4401` + // Minimum execution time: 25_290_000 picoseconds. + Weight::from_parts(25_821_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Referenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `Referenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(936), added: 3411, mode: `MaxEncodedLen`) + /// Storage: `Referenda::MetadataOf` (r:1 w:1) + /// Proof: `Referenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn clear_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `388` + // Estimated: `4401` + // Minimum execution time: 19_960_000 picoseconds. + Weight::from_parts(21_070_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_scheduler.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_scheduler.rs new file mode 100644 index 0000000000..832e73db77 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_scheduler.rs @@ -0,0 +1,285 @@ + +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-07-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Mac.parity`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// ./target/release/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --extrinsic +// +// --pallet +// pallet_scheduler +// --heap-pages +// 4096 +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + /// Storage: `Scheduler::IncompleteSince` (r:1 w:1) + /// Proof: `Scheduler::IncompleteSince` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn service_agendas_base() -> Weight { + // Proof Size summary in bytes: + // Measured: `31` + // Estimated: `1489` + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(5_000_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 50]`. + fn service_agenda_base(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `78 + s * (177 ±0)` + // Estimated: `42428` + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(4_749_134, 0) + .saturating_add(Weight::from_parts(0, 42428)) + // Standard Error: 2_050 + .saturating_add(Weight::from_parts(306_560, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_base() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `s` is `[128, 4194304]`. + fn service_task_fetched(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `141 + s * (1 ±0)` + // Estimated: `3606 + s * (1 ±0)` + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_106_979, 0) + .saturating_add(Weight::from_parts(0, 3606)) + // Standard Error: 3 + .saturating_add(Weight::from_parts(530, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) + } + /// Storage: `Scheduler::Lookup` (r:0 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn service_task_named() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(5_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_periodic() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `AhMigrator::AhMigrationStage` (r:1 w:0) + /// Proof: `AhMigrator::AhMigrationStage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn execute_dispatch_signed() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1486` + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(4_000_000, 0) + .saturating_add(Weight::from_parts(0, 1486)) + .saturating_add(T::DbWeight::get().reads(1)) + } + fn execute_dispatch_unsigned() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(2_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 49]`. + fn schedule(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `187 + s * (177 ±0)` + // Estimated: `42428 + s * (177 ±0)` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(12_389_882, 0) + .saturating_add(Weight::from_parts(0, 42428)) + // Standard Error: 3_495 + .saturating_add(Weight::from_parts(310_045, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 177).saturating_mul(s.into())) + } + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Lookup` (r:0 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 50]`. + fn cancel(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `78 + s * (177 ±0)` + // Estimated: `42428` + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(10_555_591, 0) + .saturating_add(Weight::from_parts(0, 42428)) + // Standard Error: 3_092 + .saturating_add(Weight::from_parts(514_525, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Scheduler::Lookup` (r:1 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 49]`. + fn schedule_named(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `364 + s * (185 ±0)` + // Estimated: `42428 + s * (186 ±0)` + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(15_252_235, 0) + .saturating_add(Weight::from_parts(0, 42428)) + // Standard Error: 3_331 + .saturating_add(Weight::from_parts(335_337, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 186).saturating_mul(s.into())) + } + /// Storage: `Scheduler::Lookup` (r:1 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 50]`. + fn cancel_named(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `281 + s * (185 ±0)` + // Estimated: `42428` + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_277_551, 0) + .saturating_add(Weight::from_parts(0, 42428)) + // Standard Error: 3_476 + .saturating_add(Weight::from_parts(522_448, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 50]`. + fn schedule_retry(_s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `118` + // Estimated: `42428` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_368_081, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn set_retry() -> Weight { + // Proof Size summary in bytes: + // Measured: `8928` + // Estimated: `42428` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Lookup` (r:1 w:0) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn set_retry_named() -> Weight { + // Proof Size summary in bytes: + // Measured: `9606` + // Estimated: `42428` + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(25_000_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn cancel_retry() -> Weight { + // Proof Size summary in bytes: + // Measured: `8940` + // Estimated: `42428` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Lookup` (r:1 w:0) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn cancel_retry_named() -> Weight { + // Proof Size summary in bytes: + // Measured: `9618` + // Estimated: `42428` + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(24_000_000, 0) + .saturating_add(Weight::from_parts(0, 42428)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_staking_async.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_staking_async.rs new file mode 100644 index 0000000000..b6eb63f414 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_staking_async.rs @@ -0,0 +1,918 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_staking_async` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 48.0.0 +//! DATE: 2025-07-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm +// --extrinsic +// +// --header +// .github/scripts/cmd/file_header.txt +// --output +// system-parachains/asset-hubs/asset-hub-polkadot/src/weights/ +// --heap-pages=4096 +// --pallet=pallet_staking_async,pallet_fast_unstake,pallet_bags_list,pallet_election_provider_multi_block,pallet_election_provider_multi_block_verifier,pallet_election_provider_multi_block_unsigned,pallet_election_provider_multi_block_signed + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_staking_async`. +pub struct WeightInfo(PhantomData); +impl pallet_staking_async::WeightInfo for WeightInfo { + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn bond() -> Weight { + // Proof Size summary in bytes: + // Measured: `6714` + // Estimated: `4218` + // Minimum execution time: 122_241_000 picoseconds. + Weight::from_parts(123_960_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn bond_extra() -> Weight { + // Proof Size summary in bytes: + // Measured: `8175` + // Estimated: `8877` + // Minimum execution time: 392_781_000 picoseconds. + Weight::from_parts(405_511_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn unbond() -> Weight { + // Proof Size summary in bytes: + // Measured: `8323` + // Estimated: `8877` + // Minimum execution time: 362_640_000 picoseconds. + Weight::from_parts(372_581_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:0) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `DelegatedStaking::Agents` (r:1 w:0) + /// Proof: `DelegatedStaking::Agents` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) + fn withdraw_unbonded_update() -> Weight { + // Proof Size summary in bytes: + // Measured: `7397` + // Estimated: `4218` + // Minimum execution time: 138_041_000 picoseconds. + Weight::from_parts(139_510_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn withdraw_unbonded_kill() -> Weight { + // Proof Size summary in bytes: + // Measured: `8269` + // Estimated: `6248` + // Minimum execution time: 395_351_000 picoseconds. + Weight::from_parts(411_981_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(11)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinCommission` (r:1 w:0) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:1) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:1 w:1) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForValidators` (r:1 w:1) + /// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn validate() -> Weight { + // Proof Size summary in bytes: + // Measured: `9902` + // Estimated: `4218` + // Minimum execution time: 131_640_000 picoseconds. + Weight::from_parts(132_680_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:128 w:128) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// The range of component `k` is `[1, 128]`. + fn kick(k: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `12104 + k * (1121 ±0)` + // Estimated: `4218 + k * (3033 ±0)` + // Minimum execution time: 76_161_000 picoseconds. + Weight::from_parts(108_939_004, 0) + .saturating_add(Weight::from_parts(0, 4218)) + // Standard Error: 31_853 + .saturating_add(Weight::from_parts(16_587_642, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(Weight::from_parts(0, 3033).saturating_mul(k.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:17 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 16]`. + fn nominate(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `4962 + n * (68 ±0)` + // Estimated: `6248 + n * (2520 ±0)` + // Minimum execution time: 209_950_000 picoseconds. + Weight::from_parts(258_504_764, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 212_055 + .saturating_add(Weight::from_parts(5_295_124, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn chill() -> Weight { + // Proof Size summary in bytes: + // Measured: `5138` + // Estimated: `6248` + // Minimum execution time: 195_520_000 picoseconds. + Weight::from_parts(209_261_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn set_payee() -> Weight { + // Proof Size summary in bytes: + // Measured: `3957` + // Estimated: `4218` + // Minimum execution time: 45_330_000 picoseconds. + Weight::from_parts(45_880_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:1 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn update_payee() -> Weight { + // Proof Size summary in bytes: + // Measured: `5629` + // Estimated: `4218` + // Minimum execution time: 58_110_000 picoseconds. + Weight::from_parts(58_800_000, 0) + .saturating_add(Weight::from_parts(0, 4218)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:2 w:2) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + fn set_controller() -> Weight { + // Proof Size summary in bytes: + // Measured: `5300` + // Estimated: `7446` + // Minimum execution time: 58_200_000 picoseconds. + Weight::from_parts(58_750_000, 0) + .saturating_add(Weight::from_parts(0, 7446)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Staking::ValidatorCount` (r:0 w:1) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_validator_count() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_340_000 picoseconds. + Weight::from_parts(3_450_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_no_eras() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 17_620_000 picoseconds. + Weight::from_parts(18_290_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_new_era() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 17_550_000 picoseconds. + Weight::from_parts(18_140_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_new_era_always() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 17_660_000 picoseconds. + Weight::from_parts(18_190_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Invulnerables` (r:0 w:1) + /// Proof: `Staking::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// The range of component `v` is `[0, 20]`. + fn set_invulnerables(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_480_000 picoseconds. + Weight::from_parts(4_036_317, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 863 + .saturating_add(Weight::from_parts(15_312, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Ledger` (r:1502 w:1502) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:751 w:751) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:751 w:0) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// The range of component `u` is `[0, 751]`. + fn deprecate_controller_batch(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `196533 + u * (1120 ±0)` + // Estimated: `990 + u * (6456 ±0)` + // Minimum execution time: 7_110_000 picoseconds. + Weight::from_parts(514_043_621, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 49_974 + .saturating_add(Weight::from_parts(50_482_234, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 6456).saturating_mul(u.into())) + } + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn force_unstake() -> Weight { + // Proof Size summary in bytes: + // Measured: `8206` + // Estimated: `6248` + // Minimum execution time: 325_351_000 picoseconds. + Weight::from_parts(335_811_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(12)) + } + /// Storage: `Staking::UnappliedSlashes` (r:999 w:999) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(24735), added: 27210, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 1000]`. + fn cancel_deferred_slash(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `594 + s * (122 ±0)` + // Estimated: `990 + s * (27210 ±0)` + // Minimum execution time: 23_570_000 picoseconds. + Weight::from_parts(24_080_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 6_857 + .saturating_add(Weight::from_parts(9_182_899, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 27210).saturating_mul(s.into())) + } + /// Storage: `Staking::ErasStakersOverview` (r:1 w:0) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ClaimedRewards` (r:1 w:1) + /// Proof: `Staking::ClaimedRewards` (`max_values`: None, `max_size`: Some(229), added: 2704, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasValidatorReward` (r:1 w:0) + /// Proof: `Staking::ErasValidatorReward` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:513 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:513 w:513) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:513 w:513) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:513 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:513 w:513) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6f320d44e42312c78638e6c92dff65af` (r:1 w:0) + /// Storage: `Staking::ErasStakersPaged` (r:1 w:0) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(24656), added: 27131, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasRewardPoints` (r:1 w:0) + /// Proof: `Staking::ErasRewardPoints` (`max_values`: None, `max_size`: Some(36018), added: 38493, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasValidatorPrefs` (r:1 w:0) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:513 w:0) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 512]`. + fn payout_stakers_alive_staked(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `174012 + n * (2164 ±0)` + // Estimated: `151511 + n * (3228 ±0)` + // Minimum execution time: 403_601_000 picoseconds. + Weight::from_parts(408_281_000, 0) + .saturating_add(Weight::from_parts(0, 151511)) + // Standard Error: 219_737 + .saturating_add(Weight::from_parts(141_090_199, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3228).saturating_mul(n.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// The range of component `l` is `[1, 32]`. + fn rebond(l: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `8176 + l * (5 ±0)` + // Estimated: `8877` + // Minimum execution time: 286_241_000 picoseconds. + Weight::from_parts(329_289_607, 0) + .saturating_add(Weight::from_parts(0, 8877)) + // Standard Error: 133_316 + .saturating_add(Weight::from_parts(397_922, 0).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn reap_stash() -> Weight { + // Proof Size summary in bytes: + // Measured: `8269` + // Estimated: `6248` + // Minimum execution time: 398_812_000 picoseconds. + Weight::from_parts(421_601_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().writes(11)) + } + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:0 w:1) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:0 w:1) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:0 w:1) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:0 w:1) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_staking_configs_all_set() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_640_000 picoseconds. + Weight::from_parts(5_820_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:0 w:1) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:0 w:1) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:0 w:1) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:0 w:1) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_staking_configs_all_remove() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_320_000 picoseconds. + Weight::from_parts(5_620_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:1 w:0) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `VoterList::Lock` (r:1 w:0) + /// Proof: `VoterList::Lock` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn chill_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `5261` + // Estimated: `6248` + // Minimum execution time: 279_291_000 picoseconds. + Weight::from_parts(297_761_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Staking::MinCommission` (r:1 w:0) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:1) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + fn force_apply_min_commission() -> Weight { + // Proof Size summary in bytes: + // Measured: `564` + // Estimated: `3510` + // Minimum execution time: 65_961_000 picoseconds. + Weight::from_parts(69_200_000, 0) + .saturating_add(Weight::from_parts(0, 3510)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_min_commission() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_280_000 picoseconds. + Weight::from_parts(3_430_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:0) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + fn restore_ledger() -> Weight { + // Proof Size summary in bytes: + // Measured: `7028` + // Estimated: `4764` + // Minimum execution time: 93_000_000 picoseconds. + Weight::from_parts(93_900_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + fn migrate_currency() -> Weight { + // Proof Size summary in bytes: + // Measured: `6936` + // Estimated: `4764` + // Minimum execution time: 133_750_000 picoseconds. + Weight::from_parts(134_900_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::UnappliedSlashes` (r:1 w:1) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(24735), added: 27210, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:513 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:513 w:513) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(753), added: 3228, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:513 w:0) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `DelegatedStaking::Agents` (r:513 w:513) + /// Proof: `DelegatedStaking::Agents` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:514 w:514) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:513 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:513 w:513) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(175), added: 2650, mode: `MaxEncodedLen`) + fn apply_slash() -> Weight { + // Proof Size summary in bytes: + // Measured: `994841` + // Estimated: `1656954` + // Minimum execution time: 52_416_863_000 picoseconds. + Weight::from_parts(52_898_365_000, 0) + .saturating_add(Weight::from_parts(0, 1656954)) + .saturating_add(T::DbWeight::get().reads(3594)) + .saturating_add(T::DbWeight::get().writes(2054)) + } + /// Storage: `Staking::ProcessingOffence` (r:1 w:1) + /// Proof: `Staking::ProcessingOffence` (`max_values`: Some(1), `max_size`: Some(85), added: 580, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueueEras` (r:1 w:1) + /// Proof: `Staking::OffenceQueueEras` (`max_values`: Some(1), `max_size`: Some(113), added: 608, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueue` (r:2 w:1) + /// Proof: `Staking::OffenceQueue` (`max_values`: None, `max_size`: Some(101), added: 2576, mode: `MaxEncodedLen`) + /// Storage: `Staking::SlashRewardFraction` (r:1 w:0) + /// Proof: `Staking::SlashRewardFraction` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersOverview` (r:1 w:0) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersPaged` (r:1 w:0) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(24656), added: 27131, mode: `MaxEncodedLen`) + /// Storage: `Staking::UnappliedSlashes` (r:0 w:1) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(24735), added: 27210, mode: `MaxEncodedLen`) + fn process_offence_queue() -> Weight { + // Proof Size summary in bytes: + // Measured: `20660` + // Estimated: `28121` + // Minimum execution time: 355_001_000 picoseconds. + Weight::from_parts(366_621_000, 0) + .saturating_add(Weight::from_parts(0, 28121)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Staking::ActiveEra` (r:1 w:0) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::BondedEras` (r:1 w:0) + /// Proof: `Staking::BondedEras` (`max_values`: Some(1), `max_size`: Some(233), added: 728, mode: `MaxEncodedLen`) + /// Storage: `Staking::Invulnerables` (r:1 w:0) + /// Proof: `Staking::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersOverview` (r:500 w:0) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ValidatorSlashInEra` (r:500 w:500) + /// Proof: `Staking::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueue` (r:500 w:500) + /// Proof: `Staking::OffenceQueue` (`max_values`: None, `max_size`: Some(101), added: 2576, mode: `MaxEncodedLen`) + /// Storage: `Staking::OffenceQueueEras` (r:1 w:1) + /// Proof: `Staking::OffenceQueueEras` (`max_values`: Some(1), `max_size`: Some(113), added: 608, mode: `MaxEncodedLen`) + /// The range of component `v` is `[2, 500]`. + fn rc_on_offence(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `639 + v * (93 ±0)` + // Estimated: `2126 + v * (2576 ±0)` + // Minimum execution time: 130_371_000 picoseconds. + Weight::from_parts(124_955_129, 0) + .saturating_add(Weight::from_parts(0, 2126)) + // Standard Error: 42_583 + .saturating_add(Weight::from_parts(22_574_198, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 2576).saturating_mul(v.into())) + } + /// Storage: `Staking::ActiveEra` (r:1 w:1) + /// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasRewardPoints` (r:1 w:1) + /// Proof: `Staking::ErasRewardPoints` (`max_values`: None, `max_size`: Some(36018), added: 38493, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasTotalStake` (r:1 w:0) + /// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:1 w:0) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::BondedEras` (r:1 w:1) + /// Proof: `Staking::BondedEras` (`max_values`: Some(1), `max_size`: Some(233), added: 728, mode: `MaxEncodedLen`) + /// Storage: `Staking::ForceEra` (r:1 w:0) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0x6358acd2035ec4bb863fa981e0c177b9` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x6358acd2035ec4bb863fa981e0c177b9` (r:1 w:0) + /// Storage: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0) + /// Proof: UNKNOWN KEY `0xc209f5d8eb920681b56c64b8694ea78c` (r:1 w:0) + /// Storage: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x48384a816e4f71a936cb76dc9e303f2a` (r:1 w:0) + /// Storage: `Staking::VoterSnapshotStatus` (r:0 w:1) + /// Proof: `Staking::VoterSnapshotStatus` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasValidatorReward` (r:0 w:1) + /// Proof: `Staking::ErasValidatorReward` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::NextElectionPage` (r:0 w:1) + /// Proof: `Staking::NextElectionPage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ElectableStashes` (r:0 w:1) + /// Proof: `Staking::ElectableStashes` (`max_values`: Some(1), `max_size`: Some(32002), added: 32497, mode: `MaxEncodedLen`) + fn rc_on_session_report() -> Weight { + // Proof Size summary in bytes: + // Measured: `2372` + // Estimated: `39483` + // Minimum execution time: 579_411_000 picoseconds. + Weight::from_parts(594_801_000, 0) + .saturating_add(Weight::from_parts(0, 39483)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(8)) + } + /// Storage: `Staking::ErasValidatorPrefs` (r:999 w:999) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `Measured`) + /// Storage: `Staking::ClaimedRewards` (r:999 w:999) + /// Proof: `Staking::ClaimedRewards` (`max_values`: None, `max_size`: Some(229), added: 2704, mode: `Measured`) + /// Storage: `Staking::ErasStakersPaged` (r:999 w:999) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: Some(24656), added: 27131, mode: `Measured`) + /// Storage: `Staking::ErasStakersOverview` (r:999 w:999) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `Measured`) + /// Storage: `Staking::ValidatorCount` (r:1 w:0) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `Measured`) + /// Storage: `Staking::ErasValidatorReward` (r:0 w:1) + /// Proof: `Staking::ErasValidatorReward` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`) + /// Storage: `Staking::ErasRewardPoints` (r:0 w:1) + /// Proof: `Staking::ErasRewardPoints` (`max_values`: None, `max_size`: Some(36018), added: 38493, mode: `Measured`) + /// Storage: `Staking::ErasTotalStake` (r:0 w:1) + /// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `Measured`) + /// The range of component `v` is `[1, 1000]`. + fn prune_era(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `812 + v * (292 ±0)` + // Estimated: `25724 + v * (2767 ±0)` + // Minimum execution time: 107_510_000 picoseconds. + Weight::from_parts(108_850_000, 0) + .saturating_add(Weight::from_parts(0, 25724)) + // Standard Error: 15_995 + .saturating_add(Weight::from_parts(7_223_013, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(12)) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 2767).saturating_mul(v.into())) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_treasury.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_treasury.rs new file mode 100644 index 0000000000..8c5adb2174 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_treasury.rs @@ -0,0 +1,163 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `122e32c8e414`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_treasury +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + /// Storage: `Treasury::ProposalCount` (r:1 w:1) + /// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Approvals` (r:1 w:1) + /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Proposals` (r:0 w:1) + /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) + fn spend_local() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `1887` + // Minimum execution time: 14_500_000 picoseconds. + Weight::from_parts(15_270_000, 0) + .saturating_add(Weight::from_parts(0, 1887)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Treasury::Approvals` (r:1 w:1) + /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + fn remove_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `127` + // Estimated: `1887` + // Minimum execution time: 8_330_000 picoseconds. + Weight::from_parts(8_650_000, 0) + .saturating_add(Weight::from_parts(0, 1887)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:100 w:100) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Deactivated` (r:1 w:1) + /// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Approvals` (r:1 w:1) + /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Proposals` (r:99 w:99) + /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyApprovals` (r:1 w:1) + /// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 99]`. + fn on_initialize_proposals(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `149 + p * (158 ±0)` + // Estimated: `3593 + p * (2603 ±0)` + // Minimum execution time: 49_690_000 picoseconds. + Weight::from_parts(43_573_659, 0) + .saturating_add(Weight::from_parts(0, 3593)) + // Standard Error: 49_492 + .saturating_add(Weight::from_parts(28_022_163, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(p.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(p.into())) + } + /// Storage: `AssetRate::ConversionRateToNative` (r:1 w:0) + /// Proof: `AssetRate::ConversionRateToNative` (`max_values`: None, `max_size`: Some(1238), added: 3713, mode: `MaxEncodedLen`) + /// Storage: `Treasury::SpendCount` (r:1 w:1) + /// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Spends` (r:0 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(2456), added: 4931, mode: `MaxEncodedLen`) + fn spend() -> Weight { + // Proof Size summary in bytes: + // Measured: `112` + // Estimated: `4703` + // Minimum execution time: 22_259_000 picoseconds. + Weight::from_parts(36_190_000, 0) + .saturating_add(Weight::from_parts(0, 4703)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Treasury::Spends` (r:1 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(2456), added: 4931, mode: `MaxEncodedLen`) + /// Storage: `Assets::Asset` (r:1 w:1) + /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `Assets::Account` (r:2 w:2) + /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `720` + // Estimated: `6208` + // Minimum execution time: 72_072_000 picoseconds. + Weight::from_parts(74_450_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Treasury::Spends` (r:1 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(2456), added: 4931, mode: `MaxEncodedLen`) + fn check_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `185` + // Estimated: `5921` + // Minimum execution time: 17_310_000 picoseconds. + Weight::from_parts(18_150_000, 0) + .saturating_add(Weight::from_parts(0, 5921)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Treasury::Spends` (r:1 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(2456), added: 4931, mode: `MaxEncodedLen`) + fn void_spend() -> Weight { + // Proof Size summary in bytes: + // Measured: `177` + // Estimated: `5921` + // Minimum execution time: 16_011_000 picoseconds. + Weight::from_parts(16_480_000, 0) + .saturating_add(Weight::from_parts(0, 5921)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_whitelist.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_whitelist.rs new file mode 100644 index 0000000000..475db018d0 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_whitelist.rs @@ -0,0 +1,124 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `pallet_whitelist` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0 +//! DATE: 2025-03-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `59a913dd07aa`, CPU: `QEMU Virtual CPU version 2.5+` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet=pallet_whitelist +// --header=/_work/fellowship-001/runtimes/runtimes/.github/scripts/cmd/file_header.txt +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_whitelist`. +pub struct WeightInfo(PhantomData); +impl pallet_whitelist::WeightInfo for WeightInfo { + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn whitelist_call() -> Weight { + // Proof Size summary in bytes: + // Measured: `84` + // Estimated: `3556` + // Minimum execution time: 23_211_000 picoseconds. + Weight::from_parts(23_820_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn remove_whitelisted_call() -> Weight { + // Proof Size summary in bytes: + // Measured: `213` + // Estimated: `3556` + // Minimum execution time: 22_210_000 picoseconds. + Weight::from_parts(23_950_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 4194294]`. + fn dispatch_whitelisted_call(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `289 + n * (1 ±0)` + // Estimated: `3753 + n * (1 ±0)` + // Minimum execution time: 35_061_000 picoseconds. + Weight::from_parts(7_986_908, 0) + .saturating_add(Weight::from_parts(0, 3753)) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_136, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 10000]`. + fn dispatch_whitelisted_call_with_preimage(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `213` + // Estimated: `3556` + // Minimum execution time: 26_141_000 picoseconds. + Weight::from_parts(27_182_768, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(1_615, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/polkadot_runtime_common_claims.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/polkadot_runtime_common_claims.rs new file mode 100644 index 0000000000..a51349bbe3 --- /dev/null +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/polkadot_runtime_common_claims.rs @@ -0,0 +1,181 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// 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. + +//! Autogenerated weights for `polkadot_runtime_common::claims` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-03-27, STEPS: `5`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `cob`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime=target/production/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.wasm +// --pallet +// polkadot_runtime_common::claims +// --extrinsic +// * +// --output=./system-parachains/asset-hubs/asset-hub-polkadot/src/weights +// --steps=5 +// --repeat=2 + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `polkadot_runtime_common::claims`. +pub struct WeightInfo(PhantomData); +impl polkadot_runtime_common::claims::WeightInfo for WeightInfo { + fn prevalidate_attests() -> Weight { + Weight::MAX + } + /// Storage: `Claims::Claims` (r:1 w:1) + /// Proof: `Claims::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Signing` (r:1 w:1) + /// Proof: `Claims::Signing` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Total` (r:1 w:1) + /// Proof: `Claims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Vesting` (r:1 w:1) + /// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `558` + // Estimated: `4764` + // Minimum execution time: 141_000_000 picoseconds. + Weight::from_parts(153_000_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Claims::Total` (r:1 w:1) + /// Proof: `Claims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Vesting` (r:0 w:1) + /// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Claims` (r:0 w:1) + /// Proof: `Claims::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Signing` (r:0 w:1) + /// Proof: `Claims::Signing` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn mint_claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `1630` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) + .saturating_add(Weight::from_parts(0, 1630)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Claims::Claims` (r:1 w:1) + /// Proof: `Claims::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Signing` (r:1 w:1) + /// Proof: `Claims::Signing` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Total` (r:1 w:1) + /// Proof: `Claims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Vesting` (r:1 w:1) + /// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + fn claim_attest() -> Weight { + // Proof Size summary in bytes: + // Measured: `558` + // Estimated: `4764` + // Minimum execution time: 145_000_000 picoseconds. + Weight::from_parts(149_000_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Claims::Preclaims` (r:1 w:1) + /// Proof: `Claims::Preclaims` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Signing` (r:1 w:1) + /// Proof: `Claims::Signing` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Claims` (r:1 w:1) + /// Proof: `Claims::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Total` (r:1 w:1) + /// Proof: `Claims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Vesting` (r:1 w:1) + /// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::LastRelayChainBlockNumber` (r:1 w:0) + /// Proof: `ParachainSystem::LastRelayChainBlockNumber` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + fn attest() -> Weight { + // Proof Size summary in bytes: + // Measured: `632` + // Estimated: `4764` + // Minimum execution time: 71_000_000 picoseconds. + Weight::from_parts(83_000_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Claims::Claims` (r:1 w:2) + /// Proof: `Claims::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Vesting` (r:1 w:2) + /// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Signing` (r:1 w:2) + /// Proof: `Claims::Signing` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Claims::Preclaims` (r:1 w:1) + /// Proof: `Claims::Preclaims` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn move_claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `369` + // Estimated: `3834` + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(25_000_000, 0) + .saturating_add(Weight::from_parts(0, 3834)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(7)) + } +} diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs index b77dbdb458..3e7c69cc2e 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs @@ -13,6 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use cumulus_primitives_core::ParaId; +pub use TreasuryAccount as RelayTreasuryPalletAccount; + use super::{ AccountId, AllPalletsWithSystem, AssetConversion, Assets, Balance, Balances, CollatorSelection, NativeAndAssets, ParachainInfo, ParachainSystem, PolkadotXcm, PoolAssets, @@ -32,7 +35,8 @@ use frame_support::{ traits::{ fungible::HoldConsideration, tokens::imbalance::{ResolveAssetTo, ResolveTo}, - ConstU32, Contains, ContainsPair, Equals, Everything, LinearStoragePrice, PalletInfoAccess, + ConstU32, Contains, ContainsPair, Equals, Everything, FromContains, LinearStoragePrice, + PalletInfoAccess, }, }; use frame_system::EnsureRoot; @@ -43,8 +47,7 @@ use parachains_common::xcm_config::{ }; use polkadot_parachain_primitives::primitives::Sibling; use snowbridge_inbound_queue_primitives::EthereumLocationsConverterFor; -use sp_runtime::traits::{AccountIdConversion, TryConvertInto}; -use system_parachains_constants::TREASURY_PALLET_ID; +use sp_runtime::traits::TryConvertInto; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AliasChildLocation, AliasOriginRootUsingFilter, @@ -52,10 +55,10 @@ use xcm_builder::{ AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, GlobalConsensusParachainConvertsFor, HashedDescription, - IsConcrete, LocalMint, MatchedConvertedConcreteId, NoChecking, ParentAsSuperuser, - ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SingleAssetExchangeAdapter, SovereignSignedViaLocation, StartsWith, + IsConcrete, IsSiblingSystemParachain, LocalMint, MatchedConvertedConcreteId, MintLocation, + NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SingleAssetExchangeAdapter, SovereignSignedViaLocation, StartsWith, StartsWithExplicitGlobalConsensus, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithLatestLocationConverter, WithUniqueTopic, XcmFeeManagerFromComponents, @@ -81,15 +84,26 @@ parameter_types! { pub CheckingAccount: AccountId = PolkadotXcm::check_account(); pub const FellowshipLocation: Location = Location::parent(); pub RelayTreasuryLocation: Location = (Parent, PalletInstance(kusama_runtime_constants::TREASURY_PALLET_ID)).into(); - pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating(); pub StakingPot: AccountId = CollatorSelection::account_id(); // Test [`crate::tests::treasury_pallet_account_not_none`] ensures that the result of location // conversion is not `None`. - pub RelayTreasuryPalletAccount: AccountId = + // Account address: `5Gzx76VEMzLpMp9HBarpkJ62WMSNeRfdD1jLjpvpZtY37Wum` + pub PreMigrationRelayTreasuryPalletAccount: AccountId = LocationToAccountId::convert_location(&RelayTreasuryLocation::get()) - .unwrap_or(TreasuryAccount::get()); + .unwrap_or(crate::treasury::TreasuryAccount::get()); + pub PostMigrationTreasuryAccount: AccountId = crate::treasury::TreasuryAccount::get(); + /// The Checking Account along with the indication that the local chain is able to mint tokens. + pub TeleportTracking: Option<(AccountId, MintLocation)> = crate::AhMigrator::teleport_tracking(); + pub const Here: Location = Location::here(); } +/// Treasury account that changes once migration ends. +pub type TreasuryAccount = pallet_ah_migrator::xcm_config::TreasuryAccount< + crate::AhMigrator, + PreMigrationRelayTreasuryPalletAccount, + PostMigrationTreasuryAccount, +>; + /// Type for specifying how a `Location` can be converted into an `AccountId`. /// /// This is used when determining ownership of accounts for asset transacting and when attempting to @@ -121,8 +135,8 @@ pub type FungibleTransactor = FungibleAdapter< LocationToAccountId, // Our chain's account ID type (we can't get away without mentioning it explicitly): AccountId, - // We don't track any teleports of `Balances`. - (), + // Teleports tracking is managed by `AhMigrator`: no tracking before, track after. + TeleportTracking, >; /// `AssetId`/`Balance` converter for `TrustBackedAssets`. @@ -263,6 +277,15 @@ impl Contains for ParentOrParentsPlurality { } } +/// Location type to determine the Technical Fellowship related +/// pallets for use in XCM. +pub struct FellowshipEntities; +impl Contains for FellowshipEntities { + fn contains(location: &Location) -> bool { + matches!(location.unpack(), (1, [Plurality { id: BodyId::Technical, .. }])) + } +} + pub type Barrier = TrailingSetTopicAsId< DenyThenTry< DenyReserveTransferToRelayChain, @@ -282,6 +305,8 @@ pub type Barrier = TrailingSetTopicAsId< ParentOrParentsPlurality, Equals, Equals, + FellowshipEntities, + IsSiblingSystemParachain>, )>, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, @@ -298,8 +323,10 @@ pub type Barrier = TrailingSetTopicAsId< /// We only waive fees for system functions, which these locations represent. pub type WaivedLocations = ( Equals, + Equals, RelayOrOtherSystemParachains, Equals, + FellowshipEntities, ); /// Cases where a remote origin is accepted as trusted Teleporter for a given asset: @@ -311,6 +338,12 @@ pub type TrustedTeleporters = ( IsForeignConcreteAsset>>, ); +/// During migration we only allow teleports of foreign assets (not DOT). +/// +/// - Sibling parachains' assets from where they originate (as `ForeignCreators`). +pub type TrustedTeleportersWhileMigrating = + IsForeignConcreteAsset>>; + /// Defines all global consensus locations that Polkadot Asset Hub is allowed to alias into. pub struct PolkadotOrEthereumGlobalConsensus; impl Contains for PolkadotOrEthereumGlobalConsensus { @@ -346,7 +379,11 @@ impl xcm_executor::Config for XcmConfig { // held). On Kusama Asset Hub, we allow Polkadot Asset Hub to act as reserve for any asset // native to the Polkadot or Ethereum ecosystems. type IsReserve = (bridging::to_polkadot::PolkadotOrEthereumAssetFromAssetHubPolkadot,); - type IsTeleporter = TrustedTeleporters; + type IsTeleporter = pallet_ah_migrator::xcm_config::TrustedTeleporters< + crate::AhMigrator, + TrustedTeleportersWhileMigrating, + TrustedTeleporters, + >; type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< @@ -387,7 +424,7 @@ impl xcm_executor::Config for XcmConfig { type AssetExchanger = PoolAssetsExchanger; type FeeManager = XcmFeeManagerFromComponents< WaivedLocations, - SendXcmFeeToAccount, + SendXcmFeeToAccount, >; type MessageExporter = (); type UniversalAliases = (bridging::to_polkadot::UniversalAliases,); @@ -405,14 +442,27 @@ impl xcm_executor::Config for XcmConfig { /// Forms the basis for local origins sending/executing XCMs. pub type LocalSignedOriginToLocation = SignedToAccountId32; -/// For routing XCM messages which do not cross local consensus boundary. -type LocalXcmRouter = ( +/// Use [`LocalXcmRouter`] instead. +pub(crate) type LocalXcmRouterWithoutException = ( // Two routers - use UMP to communicate with the relay chain: cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +/// For routing XCM messages which do not cross local consensus boundary. +type LocalXcmRouter = pallet_ah_migrator::RouteInnerWithException< + LocalXcmRouterWithoutException, + // Exception: query responses to Relay Chain (`ParentLocation`) which initiated (`Querier`) by + // the Relay Chain (`Here`, since from the perspective of the receiver). + // See: https://github.com/paritytech/polkadot-sdk/blob/28b7c7770e9e7abf5b561fc42cfe565baf076cb7/polkadot/xcm/xcm-executor/src/lib.rs#L728 + // + // This exception is required for the migration flow-control system to send query responses + // to the Relay Chain, confirming that data messages have been received. + FromContains, pallet_ah_migrator::ExceptResponseFor>>, + crate::AhMigrator, +>; + /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = WithUniqueTopic<( diff --git a/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs b/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs index 9d30af27ff..6ee018fd8d 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs @@ -43,7 +43,7 @@ use asset_test_utils::{ use codec::{Decode, Encode}; use frame_support::{ assert_err, assert_ok, - traits::{fungibles::InspectEnumerable, ContainsPair}, + traits::{fungibles::InspectEnumerable, ContainsPair, Get}, }; use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance}; use sp_consensus_aura::SlotDuration; @@ -360,6 +360,9 @@ fn bridging_to_asset_hub_polkadot() -> TestBridgingConfig { #[test] fn limited_reserve_transfer_assets_for_native_asset_to_asset_hub_polkadot_works() { + ExtBuilder::::default() + .build() + .execute_with(|| { asset_test_utils::test_cases_over_bridge::limited_reserve_transfer_assets_for_native_asset_works::< Runtime, AllPalletsWithoutSystem, @@ -388,7 +391,8 @@ fn limited_reserve_transfer_assets_for_native_asset_to_asset_hub_polkadot_works( WeightLimit::Unlimited, Some(XcmBridgeHubRouterFeeAssetId::get()), Some(RelayTreasuryPalletAccount::get()), - ) + ) + }); } #[test] @@ -595,10 +599,13 @@ fn change_xcm_bridge_hub_router_byte_fee_by_governance_works() { #[test] fn treasury_pallet_account_not_none() { - assert_eq!( - RelayTreasuryPalletAccount::get(), - LocationToAccountId::convert_location(&RelayTreasuryLocation::get()).unwrap() - ) + ExtBuilder::::default().build().execute_with(|| { + let relay_treasury_account: AccountId = RelayTreasuryPalletAccount::get(); + assert_eq!( + relay_treasury_account, + LocationToAccountId::convert_location(&RelayTreasuryLocation::get()).unwrap() + ) + }); } #[test] @@ -887,7 +894,7 @@ fn governance_authorize_upgrade_works() { Runtime, RuntimeOrigin, >(GovernanceOrigin::Location(Location::new(1, Parachain(ASSET_HUB_ID)))), - Either::Right(InstructionError { index: 0, error: XcmError::Barrier }) + Either::Right(InstructionError { index: 1, error: XcmError::BadOrigin }) ); // ok - relaychain diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index 10375dfb8c..14d004a88a 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -141,7 +141,8 @@ substrate-wasm-builder = { optional = true, workspace = true } [features] default = ["std"] -paseo = [] # For Paseo AHM + +polkadot-ahm = [] runtime-benchmarks = [ "assets-common/runtime-benchmarks", "bp-asset-hub-kusama/runtime-benchmarks", diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/mod.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/mod.rs index a77d8ba698..6dc00d83e9 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/mod.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/ah_migration/mod.rs @@ -22,10 +22,10 @@ use alloc::boxed::Box; use codec::DecodeAll; use frame_support::pallet_prelude::{PalletInfoAccess, TypeInfo}; use pallet_ah_migrator::LOG_TARGET; +use parachains_common::pay::VersionedLocatableAccount; use polkadot_runtime_common::impls::{LocatableAssetConverter, VersionedLocatableAsset}; use sp_core::Get; use sp_runtime::traits::{Convert, TryConvert}; -use parachains_common::pay::VersionedLocatableAccount; impl From for RuntimeHoldReason { fn from(reason: pallet_rc_migrator::types::PortableHoldReason) -> Self { diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/bridge_to_ethereum_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/bridge_to_ethereum_config.rs index befe8ae9fa..74817653bc 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/bridge_to_ethereum_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/bridge_to_ethereum_config.rs @@ -67,7 +67,7 @@ impl snowbridge_pallet_system_frontend::Config for Runtime { Location, >, >, - EnsureRootWithSuccess, + EnsureRootWithSuccess, // TODO: Here or Parent? >; #[cfg(not(feature = "runtime-benchmarks"))] type XcmSender = xcm_config::XcmRouter; 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 bb29f0c198..20323904ca 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -55,6 +55,9 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "512"] +#[cfg(feature = "kusama-ahm")] +compile_error!("Polkadot AHM cannot run with `kusama` feature"); + // Make the WASM binary available. #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -135,7 +138,7 @@ use sp_runtime::RuntimeDebug; pub use system_parachains_constants::async_backing::SLOT_DURATION; use system_parachains_constants::{ async_backing::{ - AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, + AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }, polkadot::{ consensus::{ @@ -568,7 +571,12 @@ impl InstanceFilter for ProxyType { RuntimeCall::Session(_) | RuntimeCall::Utility(_) | RuntimeCall::Multisig(_) | - RuntimeCall::Proxy(_) + RuntimeCall::Proxy(_) | + RuntimeCall::Staking(_) | + // TODO @ggwpez add more + RuntimeCall::Staking(_) | + RuntimeCall::Bounties(..) | + RuntimeCall::ChildBounties(..) ), ProxyType::CancelProxy => matches!( c, diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/staking/mod.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/staking/mod.rs index de241ac134..5db5d0b0ae 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/staking/mod.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/staking/mod.rs @@ -100,11 +100,6 @@ frame_election_provider_support::generate_solution_type!( >(16) ); -#[cfg(feature = "paseo")] -ord_parameter_types! { - pub const StakingMiner: AccountId = AccountId::from(hex_literal::hex!("b65991822483a6c3bd24b1dcf6afd3e270525da1f9c8c22a4373d1e1079e236a")); -} - parameter_types! { pub const BagThresholds: &'static [u64] = &bags_thresholds::THRESHOLDS; } @@ -117,9 +112,9 @@ impl pallet_bags_list::Config for Runtime { type BagThresholds = BagThresholds; type Score = sp_npos_elections::VoteWeight; // We have to enable it for benchmarks since the benchmark otherwise panics. - #[cfg(any(feature = "paseo", feature = "runtime-benchmarks"))] + #[cfg(feature = "runtime-benchmarks")] type MaxAutoRebagPerBlock = ConstU32<5>; - #[cfg(not(any(feature = "paseo", feature = "runtime-benchmarks")))] + #[cfg(not(feature = "runtime-benchmarks"))] // TODO @kianenigma type MaxAutoRebagPerBlock = ConstU32<0>; } @@ -170,10 +165,6 @@ impl multi_block::Config for Runtime { type SignedValidationPhase = SignedValidationPhase; type VoterSnapshotPerBlock = VoterSnapshotPerBlock; type TargetSnapshotPerBlock = TargetSnapshotPerBlock; - #[cfg(feature = "paseo")] - type AdminOrigin = - EitherOfDiverse, EnsureSignedBy>; - #[cfg(not(feature = "paseo"))] type AdminOrigin = EitherOfDiverse, StakingAdmin>; type DataProvider = Staking; type MinerConfig = Self; @@ -289,7 +280,7 @@ impl pallet_staking_async::EraPayout for EraPayout { } } -// See: +// See: TODO @kianenigma // https://github.com/paseo-network/runtimes/blob/7904882933075551e23d32d86dbb97b971e84bca/relay/paseo/src/lib.rs#L662 // https://github.com/paseo-network/runtimes/blob/7904882933075551e23d32d86dbb97b971e84bca/relay/paseo/constants/src/lib.rs#L49 parameter_types! { diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs index 367997ff2a..20b36b4bae 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/treasury.rs @@ -15,8 +15,8 @@ use crate::*; use frame_support::traits::{tokens::UnityOrOuterConversion, FromContains}; -use polkadot_runtime_common::impls::{ContainsParts, VersionedLocatableAsset}; use parachains_common::pay::VersionedLocatableAccount; +use polkadot_runtime_common::impls::{ContainsParts, VersionedLocatableAsset}; parameter_types! { pub const SpendPeriod: BlockNumber = 24 * RC_DAYS; diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_ah_migrator.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_ah_migrator.rs index 9ea13df842..6177039c1c 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_ah_migrator.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_ah_migrator.rs @@ -191,26 +191,6 @@ impl pallet_ah_migrator::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 3672).saturating_mul(n.into())) } - /// Storage: `FastUnstake::Queue` (r:255 w:255) - /// Proof: `FastUnstake::Queue` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) - /// Storage: `FastUnstake::CounterForQueue` (r:1 w:1) - /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 255]`. - fn receive_fast_unstake_messages(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `1489 + n * (2531 ±0)` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(3_337_171, 0) - .saturating_add(Weight::from_parts(0, 1489)) - // Standard Error: 6_848 - .saturating_add(Weight::from_parts(2_491_678, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2531).saturating_mul(n.into())) - } /// Storage: `Referenda::DecidingCount` (r:0 w:16) /// Proof: `Referenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) /// Storage: `Referenda::ReferendumCount` (r:0 w:1) diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index 23775ebab3..b487100d23 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use cumulus_primitives_core::ParaId; pub use TreasuryAccount as RelayTreasuryPalletAccount; use super::{ @@ -33,8 +34,8 @@ use frame_support::{ traits::{ fungible::HoldConsideration, tokens::imbalance::{ResolveAssetTo, ResolveTo}, - ConstU32, Contains, ContainsPair, Disabled, Equals, Everything, FromContains, - LinearStoragePrice, PalletInfoAccess, + ConstU32, Contains, ContainsPair, Equals, Everything, FromContains, LinearStoragePrice, + PalletInfoAccess, }, }; use frame_system::EnsureRoot; @@ -46,22 +47,21 @@ use parachains_common::xcm_config::{ use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_constants::system_parachain; use snowbridge_outbound_queue_primitives::v2::exporter::PausableExporter; -use sp_runtime::traits::{AccountIdConversion, TryConvertInto}; -use system_parachains_constants::TREASURY_PALLET_ID; +use sp_runtime::traits::TryConvertInto; use xcm::latest::prelude::*; -use xcm_builder::MintLocation; use xcm_builder::{ AccountId32Aliases, AliasChildLocation, AliasOriginRootUsingFilter, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, ExternalConsensusLocationsConverterFor, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, HashedDescription, IsConcrete, - LocalMint, MatchedConvertedConcreteId, NoChecking, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SingleAssetExchangeAdapter, - SovereignSignedViaLocation, StartsWith, StartsWithExplicitGlobalConsensus, TakeWeightCredit, - TrailingSetTopicAsId, UnpaidRemoteExporter, UsingComponents, WeightInfoBounds, - WithComputedOrigin, WithLatestLocationConverter, WithUniqueTopic, XcmFeeManagerFromComponents, + IsSiblingSystemParachain, LocalMint, MatchedConvertedConcreteId, MintLocation, NoChecking, + ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SingleAssetExchangeAdapter, SovereignSignedViaLocation, StartsWith, + StartsWithExplicitGlobalConsensus, TakeWeightCredit, TrailingSetTopicAsId, + UnpaidRemoteExporter, UsingComponents, WeightInfoBounds, WithComputedOrigin, + WithLatestLocationConverter, WithUniqueTopic, XcmFeeManagerFromComponents, }; use xcm_executor::{traits::ConvertLocation, XcmExecutor}; @@ -377,11 +377,10 @@ pub type Barrier = TrailingSetTopicAsId< Equals, AmbassadorEntities, SecretaryEntities, + IsSiblingSystemParachain>, )>, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, - // Explicit unpaid execution barrier. - pallet_ah_migrator::xcm_config::UnpaidExecutionFilter, ), UniversalLocation, ConstU32<8>, @@ -395,6 +394,7 @@ pub type Barrier = TrailingSetTopicAsId< /// We only waive fees for system functions, which these locations represent. pub type WaivedLocations = ( Equals, + Equals, RelayOrOtherSystemParachains, Equals, FellowshipEntities, @@ -411,6 +411,12 @@ pub type TrustedTeleporters = ( IsForeignConcreteAsset>>, ); +/// During migration we only allow teleports of foreign assets (not DOT). +/// +/// - Sibling parachains' assets from where they originate (as `ForeignCreators`). +pub type TrustedTeleportersWhileMigrating = + IsForeignConcreteAsset>>; + /// Defines all global consensus locations that Kusama Asset Hub is allowed to alias into. pub struct KusamaGlobalConsensus; impl Contains for KusamaGlobalConsensus { @@ -446,7 +452,11 @@ impl xcm_executor::Config for XcmConfig { bridging::to_kusama::KusamaAssetFromAssetHubKusama, bridging::to_ethereum::EthereumAssetFromEthereum, ); - type IsTeleporter = pallet_ah_migrator::xcm_config::TrustedTeleporters; + type IsTeleporter = pallet_ah_migrator::xcm_config::TrustedTeleporters< + crate::AhMigrator, + TrustedTeleportersWhileMigrating, + TrustedTeleporters, + >; type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< @@ -486,7 +496,7 @@ impl xcm_executor::Config for XcmConfig { type AssetLocker = (); type AssetExchanger = PoolAssetsExchanger; type FeeManager = XcmFeeManagerFromComponents< - pallet_ah_migrator::xcm_config::WaivedLocations, + WaivedLocations, SendXcmFeeToAccount, >; type MessageExporter = (); diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs b/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs index b33cf496b3..210a04ea98 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs @@ -19,11 +19,8 @@ use asset_hub_polkadot_runtime::{ xcm_config::{ - bridging, - bridging::{self, XcmBridgeHubRouterFeeAssetId}, - CheckingAccount, DotLocation, ForeignCreatorsSovereignAccountOf, GovernanceLocation, - LocationToAccountId, RelayTreasuryLocation, RelayTreasuryPalletAccount, StakingPot, - TrustBackedAssetsPalletLocation, XcmConfig, + bridging, CheckingAccount, DotLocation, GovernanceLocation, LocationToAccountId, + StakingPot, TrustBackedAssetsPalletLocation, XcmConfig, }, AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, Block, ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, @@ -915,7 +912,7 @@ fn governance_authorize_upgrade_works() { Runtime, RuntimeOrigin, >(GovernanceOrigin::Location(Location::new(1, Parachain(ASSET_HUB_ID)))), - Either::Right(InstructionError { index: 0, error: XcmError::Barrier }) + Either::Right(InstructionError { index: 1, error: XcmError::BadOrigin }) ); // no - Collectives assert_err!( @@ -923,7 +920,7 @@ fn governance_authorize_upgrade_works() { Runtime, RuntimeOrigin, >(GovernanceOrigin::Location(Location::new(1, Parachain(COLLECTIVES_ID)))), - Either::Right(InstructionError { index: 0, error: XcmError::Barrier }) + Either::Right(InstructionError { index: 1, error: XcmError::BadOrigin }) ); // no - Collectives Voice of Fellows plurality assert_err!( 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 1670eb0cec..923b61ed3d 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -460,8 +460,6 @@ pub const PERIOD: u32 = 6 * HOURS; pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. 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 885a8a85f0..5a7646768f 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -471,8 +471,6 @@ pub const PERIOD: u32 = 6 * HOURS; pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 3c6052a1ae..98653874ad 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -542,8 +542,6 @@ pub const PERIOD: u32 = 6 * HOURS; pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. diff --git a/system-parachains/coretime/coretime-kusama/src/lib.rs b/system-parachains/coretime/coretime-kusama/src/lib.rs index f078b1495b..597b8dce7b 100644 --- a/system-parachains/coretime/coretime-kusama/src/lib.rs +++ b/system-parachains/coretime/coretime-kusama/src/lib.rs @@ -421,8 +421,6 @@ pub const PERIOD: u32 = 6 * HOURS; pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. diff --git a/system-parachains/coretime/coretime-polkadot/src/lib.rs b/system-parachains/coretime/coretime-polkadot/src/lib.rs index c7c629e55a..be611a03d6 100644 --- a/system-parachains/coretime/coretime-polkadot/src/lib.rs +++ b/system-parachains/coretime/coretime-polkadot/src/lib.rs @@ -427,8 +427,6 @@ pub const SESSION_LENGTH: u32 = 6 * HOURS; pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // We don't have stash and controller, thus we don't need the convert as well. diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 5e448647e7..3f1d8d9d8e 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -721,8 +721,6 @@ impl pallet_authorship::Config for Runtime { } impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index 616efd08bd..7581c76cd1 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -376,8 +376,6 @@ pub const PERIOD: u32 = 6 * HOURS; pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. diff --git a/system-parachains/people/people-polkadot/src/lib.rs b/system-parachains/people/people-polkadot/src/lib.rs index d0a9395481..9cc753800e 100644 --- a/system-parachains/people/people-polkadot/src/lib.rs +++ b/system-parachains/people/people-polkadot/src/lib.rs @@ -363,8 +363,6 @@ pub const PERIOD: u32 = 6 * HOURS; pub const OFFSET: u32 = 0; impl pallet_session::Config for Runtime { - type Currency = Balances; - type KeyDeposit = (); type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well.