From 2b07b7d3b6b131d77a9161468339b417e0295538 Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Mon, 5 Jun 2023 18:08:12 +0200 Subject: [PATCH] Merge from bko-transfer-assets-via-bridge (#30) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use updated api for ensure origin trait * Benchmarks for pallet-bridge-assets-transfer (#2316) * benchmarks for pallet-bridge-asset-transfer * use proper template for pallet weights * fix test * fixing compialtion * fix (?) compilation warn/error in westmint * weight limits in can_governance_call_xcm_transact_with_bridge_assets_transfer_configuration * ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_assets_transfer * ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_assets_transfer * add prototype for multiple assets benchmarking --------- Co-authored-by: command-bot <> * Assets/ForeignAssets tests and fixes (#2167) * Test for create and transfer `TrustBackedAssets` with AssetTransactor * Test for transfer `local Currency` with AssetTransactor * Test for create foreign assets (covers foreign relaychain currency) * Added `ForeignFungiblesTransactor` and test for transfer `ForeignAssets` with AssetTransactor * Removed unused `pub const Local: MultiLocation` * Changed `ParaId -> Sibling` for `SiblingParachainConvertsVia` * Test for create foreign assets (covers local sibling parachain assets) * Reverted stuff for ForeignCreators from different global consensus (moved to transfer asset branch) * Refactor `weight_limit` for `execute_xcm` * Added test for `set_metadata` by ForeignCreator with `xcm::Transact(set_metadata)` * Renamed `receive_teleported_asset_works` -> `receive_teleported_asset_for_native_asset_works` * Allow `ForeignCreators` only for sibling parachains * Unify ReservedDmpWeight/ReservedXcmpWeight usage * Removed hack - replaced with `MatchedConvertedConcreteId` * Refactor `ForeignCreators` to assets-common * Add `ReceiveTeleportedAsset` test * Change test - `Utility::batch` -> Multiple `xcm::Transact` * Reusing the same deposits as for TrustBackedAssets * missing `try_successful_origin` ? * Finished `ForeignAssets` for westmint (converter, FungiblesApi, tests) * Refactoring tests - receive_teleported_asset_for_native_asset_works * ForeignAssets for statemine + refactored `receive_teleported_asset_from_foreign_creator_works` * Add `ForeignAssets` to statemine `FungiblesApi` * Add `asset_transactor_transfer_with_local_consensus_currency_works` to all runtimes * Added `asset_transactor_transfer_with_trust_backed_assets_works` test * Added `asset_transactor_transfer_with_foreign_assets_works` * Fix `missing `try_successful_origin` in implementation` * Added `create_and_manage_foreign_assets_for_local_consensus_parachain_assets_works` * Added `ExpectTransactStatus` check * Small rename * Extended `test_assets_balances_api_works` with ForeignAssets for `statemine` * PR fixes * Update parachains/runtimes/assets/test-utils/src/test_cases.rs --------- Co-authored-by: parity-processbot <> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Added `StartsWithExplicitGlobalConsensus` to ignores (#2338) * Change to correct weight file for pallet_bridge_assets_transfer * Renamed `pallet-bridge-assets-transfer` to `pallet-bridge-transfer` * from_ref_time to from_parts * ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer * Added `ping_via_bridge` * ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer * Fix test * Revert not needed stuff * Added test-case `can_governance_change_bridge_transfer_configuration` * Added test `initiate_transfer_asset_via_bridge_for_native_asset_works` * Fix compilation * Small fixes * Added support for paid or unpaid execution by configuration * Removed stuff * Bump futures from 0.3.26 to 0.3.27 (#2359) Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.26 to 0.3.27. - [Release notes](https://github.com/rust-lang/futures-rs/releases) - [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.26...0.3.27) --- updated-dependencies: - dependency-name: futures dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sebastian Kunert * Bump clap from 4.1.11 to 4.1.13 (#2388) Bumps [clap](https://github.com/clap-rs/clap) from 4.1.11 to 4.1.13. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.1.11...v4.1.13) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Remove HeaderBackend from RelayChainRPCClient (#2385) * Remove HeaderBackend from RelayChainRPCClient * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> * Added `receive_reserve_asset_deposited_from_different_consensus_works` * Bump scale-info from 2.3.1 to 2.4.0 (#2386) Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.3.1 to 2.4.0. - [Release notes](https://github.com/paritytech/scale-info/releases) - [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/scale-info/compare/v2.3.1...v2.4.0) --- updated-dependencies: - dependency-name: scale-info dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Renamed Bridges -> AllowedExporters * Bump serde_json from 1.0.94 to 1.0.95 (#2387) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.94 to 1.0.95. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.94...v1.0.95) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Companion: wasm-builder support stable Rust (#2393) * Companion: wasm-builder support stable Rust * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * Added `IsReserve` handling for `ReserveAssetDeposited` + benchmarks * Bump thiserror from 1.0.38 to 1.0.40 (#2396) Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.38 to 1.0.40. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.38...1.0.40) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix compile * ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer * Bump syn from 1.0.109 to 2.0.9 (#2397) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.109 to 2.0.9. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.109...2.0.9) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump serde from 1.0.156 to 1.0.159 (#2395) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.156 to 1.0.159. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.156...v1.0.159) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Companion for https://github.com/paritytech/substrate/pull/13725 (#2401) * Companion for https://github.com/paritytech/substrate/pull/13725 * Add comment * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> * Bump syn from 2.0.9 to 2.0.11 (#2405) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.9 to 2.0.11. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.9...2.0.11) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump scale-info from 2.4.0 to 2.5.0 (#2404) Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/paritytech/scale-info/releases) - [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/scale-info/compare/v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: scale-info dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump tempfile from 3.4.0 to 3.5.0 (#2406) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/Stebalien/tempfile/releases) - [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS) - [Commits](https://github.com/Stebalien/tempfile/commits) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: parity-processbot <> * bump zombienet version (#2411) * Fix conditional benchmarking * ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer * ".git/.scripts/commands/bench/bench.sh" pallet westmint assets pallet_bridge_transfer * Bump tokio from 1.26.0 to 1.27.0 (#2413) Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.26.0 to 1.27.0. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.26.0...tokio-1.27.0) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Change test weights * Bump syn from 2.0.11 to 2.0.12 (#2414) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.11 to 2.0.12. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.11...2.0.12) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump proc-macro2 from 1.0.52 to 1.0.54 (#2415) Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.52 to 1.0.54. - [Release notes](https://github.com/dtolnay/proc-macro2/releases) - [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.52...1.0.54) --- updated-dependencies: - dependency-name: proc-macro2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Companion PR for contract deletion updates (#2409) * Companion PR for contract deletion updates see https://github.com/paritytech/substrate/pull/13702 * Revert "Companion PR for contract deletion updates" This reverts commit 4fb2ca53a1bdfbd7dc0d35be52525da99547c76c. * fix lint * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * Fix SafeCallFilter for westmint * Allow arbitrary key-values in RelayStateSproofBuilder (#2407) * help text examples + clean up (#2418) * Bump futures from 0.3.27 to 0.3.28 (#2420) Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.27 to 0.3.28. - [Release notes](https://github.com/rust-lang/futures-rs/releases) - [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.27...0.3.28) --- updated-dependencies: - dependency-name: futures dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump clap from 4.1.13 to 4.1.14 (#2421) Bumps [clap](https://github.com/clap-rs/clap) from 4.1.13 to 4.1.14. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.1.13...v4.1.14) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update Substrate & Polkadot (#2422) * Bump syn from 2.0.12 to 2.0.13 (#2428) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.12 to 2.0.13. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.12...2.0.13) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump hex-literal from 0.3.4 to 0.4.0 (#2426) Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.3.4 to 0.4.0. - [Release notes](https://github.com/RustCrypto/utils/releases) - [Commits](https://github.com/RustCrypto/utils/compare/hex-literal-v0.3.4...hex-literal-v0.4.0) --- updated-dependencies: - dependency-name: hex-literal dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Companion for #6986 (#2416) * refactor: apply substrate/pull/13610 * Added `origin` to config for `universal_origin` benchmark * update lockfile for {"polkadot", "substrate"} * Update --------- Co-authored-by: William Freudenberger Co-authored-by: parity-processbot <> Co-authored-by: Bastian Köcher * [backport] weights 9400 (#2425) * [benchmarks] pr with weights (#2373) Co-authored-by: paritytech-ci * [benchmarks] pr with weights (#2374) Co-authored-by: paritytech-ci * [benchmarks] pr with weights (#2375) Co-authored-by: paritytech-ci * Proof size in test wasn't sufficient (due to updated weights.) --------- Co-authored-by: Paritytech CI <52199148+paritytech-ci@users.noreply.github.com> Co-authored-by: paritytech-ci Co-authored-by: Giles Cope * Use send_xcm and add cost to event * Cleanup: Remove polkadot-service dependency from minimal node (#2430) * Remove polkadot-service dependency from minimal-node * Clean up error handline * Remove unwanted changes * Unused deps * Co #13699: Remove old calls (#2431) * Remove old calls Signed-off-by: Oliver Tale-Yazdi * update lockfile for {"substrate", "polkadot"} * Ignore warning in pallet ping Signed-off-by: Oliver Tale-Yazdi * Ignore more warnings... Signed-off-by: Oliver Tale-Yazdi * ... Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: parity-processbot <> * [Backport] version bumps 9400 (#2424) * Bump crate versions * Bump spec_version to 9400 * bump transaction versions (#2364) * Refactor to support multiple MultiAsset + cleaning * ".git/.scripts/commands/bench/bench.sh" xcm westmint assets pallet_xcm_benchmarks::generic * Bump hex-literal from 0.4.0 to 0.4.1 (#2434) Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.4.0 to 0.4.1. - [Release notes](https://github.com/RustCrypto/utils/releases) - [Commits](https://github.com/RustCrypto/utils/compare/hex-literal-v0.4.0...hex-literal-v0.4.1) --- updated-dependencies: - dependency-name: hex-literal dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Updated bridge-hub-polkadot.json (#2435) * The Polkadot Fellowship import (#2236) * Fellowship into Collectives * cargo.lock * tracks alias * allow to send Fellows origin over XCM * update todos, remove duplication of type * use Collectives location for Fellows body * alias for ranks constants * benchmarks * proxy for Fellowship * docs * correct copyright date * Apply suggestions from code review Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * rustfmt * remove council, update origins * renames * remove tech committee from promote origin * renames * Fellowship import * test * rename mod * fix import * updated addresses (only ss58 version) * update addresses * doc nits * weights with new api * update addresses * fix try runtime * update addresses * use pallet api to import the members * merge fix * hex-literal version * add Bradley to the 1 rank --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: parity-processbot <> * Companion for #13302 (#2357) * primitives/core: Derive scale_info::TypeInfo for runtime APIs Signed-off-by: Alexandru Vasile * parachains: Derive scale_info::TypeInfo for FungiblesAccessError Signed-off-by: Alexandru Vasile * parachains: Fix `TypeInfo` import path Signed-off-by: Alexandru Vasile * update lockfile for {"polkadot", "substrate"} * Adjust testing for the new API Signed-off-by: Alexandru Vasile * Adjust deprecated methods Signed-off-by: Alexandru Vasile --------- Signed-off-by: Alexandru Vasile Co-authored-by: parity-processbot <> * use stable rust toolchain in ci * Bump syn from 2.0.13 to 2.0.14 (#2446) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.13 to 2.0.14. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.13...2.0.14) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump serde from 1.0.159 to 1.0.160 (#2445) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.159 to 1.0.160. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.159...v1.0.160) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Invoke cargo build commands with `--locked` (#2444) * Bump actions/checkout from 3.1.0 to 3.5.1 (#2448) * Bump actions/checkout from 3.1.0 to 3.5.1 Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.5.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3.1.0...83b7061638ee4956cf7545a6f7efe594e5ad0247) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * align version with hash --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sergejs Kostjucenko * Updated doc * Bump serde_json from 1.0.95 to 1.0.96 (#2453) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.95 to 1.0.96. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.95...v1.0.96) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/checkout from 3.5.1 to 3.5.2 (#2452) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.1 to 3.5.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/83b7061638ee4956cf7545a6f7efe594e5ad0247...8e5e7e5ab8b370d6c329ec480221332ada57f0ab) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump syn from 2.0.14 to 2.0.15 (#2454) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.14 to 2.0.15. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.14...2.0.15) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump assert_cmd from 2.0.10 to 2.0.11 (#2457) Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.10 to 2.0.11. - [Release notes](https://github.com/assert-rs/assert_cmd/releases) - [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md) - [Commits](https://github.com/assert-rs/assert_cmd/compare/v2.0.10...v2.0.11) --- updated-dependencies: - dependency-name: assert_cmd dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Changed `query_account_balances` return type (#2455) * Companion for substrate#13883 (#2460) * update substrate * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * Optimize level monitor reconstruction (#2461) * Optimize level monitor reconstruction * Fix counter increment and test * Struct comments as doc comments * Bump clap from 4.1.14 to 4.2.3 (#2465) * Bump Swatinem/rust-cache from 2.2.0 to 2.2.1 (#2456) Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.2.0 to 2.2.1. - [Release notes](https://github.com/Swatinem/rust-cache/releases) - [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md) - [Commits](https://github.com/Swatinem/rust-cache/compare/359a70e43a0bb8a13953b04a90f76428b4959bb6...6fd3edff6979b79f87531400ad694fb7f2c84b1f) --- updated-dependencies: - dependency-name: Swatinem/rust-cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Companion for substrate#13771 (#2410) * max proposal weight config * update deps --------- Co-authored-by: parity-processbot <> * Parachain node should not recover blocks while syncing (#2462) * Address review comments * [Polkadot Companion] for 7101 (#2470) * [Polkadot Companion] for 7101 PR: https://github.com/paritytech/polkadot/pull/7101 * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * Align BridgeHub runtimes with other SP runtimes + reused test for teleport native tokens + some nits (#2449) * Align BridgeHub runtimes with other SP runtimes * Reused `teleports_for_native_asset_works` test to all bridge-hub runtime * Fix import vs doc * Removed unnecessery deps * DealWithFees + ToAuthor->ToStakingPot for BH according to the other runtimes * Update parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Align all desc * Extract runtime_para_id for test * Fix test --------- Co-authored-by: parity-processbot <> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Extract runtime_para_id for test * Typos * Added helper for `execute_as_governance` * Fix test because `UnpaidRemoteExporter` adds now `UnpaidExecution` instruction * Use `execute_as_governance` function * [ci] Update buildah command and version (#2479) * Bump enumflags2 from 0.7.5 to 0.7.7 (#2481) Bumps [enumflags2](https://github.com/meithecatte/enumflags2) from 0.7.5 to 0.7.7. - [Release notes](https://github.com/meithecatte/enumflags2/releases) - [Commits](https://github.com/meithecatte/enumflags2/compare/v0.7.5...v0.7.7) --- updated-dependencies: - dependency-name: enumflags2 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump ruby/setup-ruby from 1.133.2 to 1.146.0 (#2466) Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.133.2 to 1.146.0. - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Commits](https://github.com/ruby/setup-ruby/compare/93287a1fa82c6ddbb6d8db978df4b0119cd8879f...55283cc23133118229fd3f97f9336ee23a179fcf) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump ruby/setup-ruby from 1.146.0 to 1.147.0 (#2484) Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.146.0 to 1.147.0. - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Commits](https://github.com/ruby/setup-ruby/compare/55283cc23133118229fd3f97f9336ee23a179fcf...6cecb48364174b0952995175c55f9bf5527e6682) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/download-artifact from 3.0.0 to 3.0.1 (#1798) * Bump actions/download-artifact from 3.0.0 to 3.0.1 Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/fb598a63ae348fa914e94cd0ff38f362e927b741...9782bd6a9848b53b110e712e20e42d89988822b7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * match hash with version --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sergejs Kostjucenko <85877331+sergejparity@users.noreply.github.com> * Bump actions/upload-artifact from 3.1.0 to 3.1.1 (#1799) * Bump actions/upload-artifact from 3.1.0 to 3.1.1 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/3cea5372237819ed00197afe530f5a7ea3e805c8...83fd05a356d7e2593de66fc9913b3002723633cb) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * match hash with version --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sergejs Kostjucenko * Bump actions/cache from 3.0.11 to 3.2.3 (#2082) Bumps [actions/cache](https://github.com/actions/cache) from 3.0.11 to 3.2.3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7...58c146cc91c5b9e778e71775dfe9bf1442ad9a12) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: parity-processbot <> * Companion for substrate#13565 (#2306) * add default deposit limit * cargo upd * Bump actions/download-artifact from 3.0.1 to 3.0.2 (#2485) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3.0.1 to 3.0.2. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/9782bd6a9848b53b110e712e20e42d89988822b7...9bc31d5ccc31df68ecc42ccf4149144866c47d8a) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump chevdor/srtool-actions from 0.6.0 to 0.7.0 (#2486) Bumps [chevdor/srtool-actions](https://github.com/chevdor/srtool-actions) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/chevdor/srtool-actions/releases) - [Commits](https://github.com/chevdor/srtool-actions/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: chevdor/srtool-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/upload-artifact from 3.1.1 to 3.1.2 (#2487) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.1 to 3.1.2. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/83fd05a356d7e2593de66fc9913b3002723633cb...0b7f8abb1508181956e8e162db84b466c27e18ce) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/cache from 3.2.3 to 3.3.1 (#2488) Bumps [actions/cache](https://github.com/actions/cache) from 3.2.3 to 3.3.1. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/58c146cc91c5b9e778e71775dfe9bf1442ad9a12...88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump h2 from 0.3.9 to 0.3.17 (#2451) Bumps [h2](https://github.com/hyperium/h2) from 0.3.9 to 0.3.17. - [Release notes](https://github.com/hyperium/h2/releases) - [Changelog](https://github.com/hyperium/h2/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/h2/compare/v0.3.9...v0.3.17) --- updated-dependencies: - dependency-name: h2 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add JSON chainspecs for Wococo and Rococo Bridge-hub (#2473) * add bridge-hub rococo and wococo chainspecs * use json chainspec for bridge-hub-rococo and bridge-hub-wococo * Removed unused functions --------- Co-authored-by: Branislav Kontur * Companion for paritytech/polkadot#7098 (#2469) * Companion for paritytech/polkadot#7098 * Fixes * Add missing benchmarked function * Fix typo * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * level-monitor: Use prroper log target (#2493) * level-monitor: Use prroper log target * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: command-bot <> * Bump ruby/setup-ruby from 1.147.0 to 1.148.0 (#2496) Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.147.0 to 1.148.0. - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Commits](https://github.com/ruby/setup-ruby/compare/6cecb48364174b0952995175c55f9bf5527e6682...d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Skip av-store, make consensus task blocking (#2497) * Bump scale-info from 2.5.0 to 2.6.0 (#2500) Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/paritytech/scale-info/releases) - [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/scale-info/commits) --- updated-dependencies: - dependency-name: scale-info dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump clap to 4.2.5 (#2505) * [ci] Run gha fmt in docker (#2511) * [ci] Run gha fmt in docker * use cargo run instead action * Companion PR for add events to ContractResult (#2510) * contracts: adapt to new contracts api * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> * Bump tokio from 1.27.0 to 1.28.0 (#2508) Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.27.0 to 1.28.0. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.27.0...tokio-1.28.0) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump clap from 4.2.5 to 4.2.7 (#2516) Bumps [clap](https://github.com/clap-rs/clap) from 4.2.5 to 4.2.7. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.2.5...v4.2.7) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Initial version of bridging pallets as git subtree (#2458) * Initial version of bridges pallet as subtree of https://github.com/paritytech/parity-bridges-common Added `Bridges subtree files` pr review rule * Squashed 'bridges/' content from commit d30927c08 git-subtree-dir: bridges git-subtree-split: d30927c089bd9e73092d1ec1a62895603cb277a3 * Updated REAMDE.md and BRIDGES.md (inspired by original https://github.com/paritytech/polkadot/blob/d22eb62fe40e55e15eb91d375f48cc540d83a47e/BRIDGES.md) * Squashed 'bridges/' changes from d30927c08..d3970944b d3970944b Small simplifications (#2050) git-subtree-dir: bridges git-subtree-split: d3970944b0cfc4ea5226225e1ca07dab234c3556 * Squashed 'bridges/' changes from d3970944b..2180797fb 2180797fb Removed CODEOWNERS (#2051) git-subtree-dir: bridges git-subtree-split: 2180797fbf8a990490c67853dcffd81bc8dd083c * Squashed 'bridges/' changes from 2180797fbf..4850aac8ce 4850aac8ce Removed relayer_account: &AccountId from MessageDispatch (#2080) 8c8adafd54 Revert "Fix max-size messages at test chains (#2064)" (#2077) c01a63efd8 Fixed off-by-one when confirming rewards in messages pallet (#2075) a298be96aa Update subxt dependencies (#2072) c0eef51eab Fix max-size messages at test chains (#2064) 3a658e3697 Messages relay fixes (#2073) 0022b5ab22 Slash relayers for invalid transactions (#2025) 198104007f Bump enumflags2 from 0.7.5 to 0.7.7 9229b257e5 [ci] Fix rules for docker build (#2069) 660d791390 [ci] Update buildah command and version (#2058) e4535c0ca4 fix the way latest_confirmed_nonce_at_source is "calculated" (#2067) dbc2d37590 select nothing if we have already selected nonces to submit or have submitted something (#2065) a7eedd21fe [relay-substrate-client] Bump jsonrpsee (#2066) 8875d5aeae Bump clap from 4.2.2 to 4.2.4 25f9cf55e2 Another use of RangeInclusiveExt::checked_len() (#2060) 4942c12a5f submit lane unblock transactions from relay (#2030) c0325d3c9c Test deployments fixes (#2057) fc7b9b7ed7 Use the new matrix server (#2056) 63bcb5c10b Fixed delivery alert rule (#2052) git-subtree-dir: bridges git-subtree-split: 4850aac8ce6c34e5ca6246b88cd14c873a879cba * Squashed 'bridges/' changes from 4850aac8ce..66aaf0dd23 66aaf0dd23 Nits (#2083) git-subtree-dir: bridges git-subtree-split: 66aaf0dd239dde40b64264061a77c921e2c82568 * Squashed 'bridges/' changes from 66aaf0dd23..557ecbcecc 557ecbcecc Fix sized messages (Follow-up on #2064) (#2103) 54f587a066 Add weight of refund extension post_dispatch to the weights of messages pallet (#2089) 5b1626f8c4 fix pallet param for nightly benchmarks check (#2099) ae44c6b7a1 Add millau specific messages weights (#2097) 6ad0bd1f1e Add integrity tests to rialto parachain runtiime (#2096) 6919556de5 Bump tokio from 1.27.0 to 1.28.0 58795fcb75 Bump clap from 4.2.4 to 4.2.5 01bf31085b Bump scale-info from 2.5.0 to 2.6.0 8fe383240d Bump anyhow from 1.0.70 to 1.0.71 8d94e82ad5 deployments: add new BEEFY metrics and alarms (#2090) e9a4749e7e Bump wasmtime from 6.0.1 to 6.0.2 9d9936c0d9 Bump wasmtime from 6.0.1 to 6.0.2 in /tools/runtime-codegen 5d77cd7bee Add more logs to relayer and message pallets (#2082) 75fbb9d3ef Update comment (#2081) 9904d09cf6 Benchmarks for new relayers pallet calls (#2040) git-subtree-dir: bridges git-subtree-split: 557ecbcecc585547b744a5ac9fb8d7f3b9de4521 * fmt * Squashed 'bridges/' changes from 557ecbcecc..04b3dda6aa 04b3dda6aa Remove from subtree (#2111) f8ff15e7e7 Add `MessagesPalletInstance` for integrity tests (#2107) 92ccef58e6 Use generated runtimes for BHR/BHW (#2106) b33e0a585b Fix comment (#2105) git-subtree-dir: bridges git-subtree-split: 04b3dda6aa38599e612ff637710b6d2cff275ef3 * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: parity-processbot <> * BridgeHub Rococo/Wococo runtimes (#2111) * Fixes * Fixes * Fixes * cargo fmt * Fixes * Fixes * Fixes * Fixes * Update BridgeHub runtime version * Fixes * Zombienet for bridge-hub setup * Fixes * Remove unused import * Fixes for gav-xcm-v3 (#1835) * Fix for FungiblesAdapter - trait changes: Contains -> AssetChecking * Fix for missing weight for `fn unpaid_execution()` * Used NonLocalMint for all NonZeroIssuance * Fix * Fixes * Fixes * Fixes * Fixes * Fixes * Fix tests * Fixes * Trying to fix sed expression? * Trying to fix sed expression? * Use the `relay-headers-and-messages` command (#1913) * Bridge hubs readme: fixes and additions * Use the relay-headers-and-messages command * cargo fmt * Fix README.md + zombienet * Parachain ID update of bridge-hub-wococo * Update bridge-hub-wococo chainspec * Squashed 'bridges/' content from commit 062554430 git-subtree-dir: bridges git-subtree-split: 0625544309ff299307f7e110f252f04eac383102 * Add SafeCallFilter * Add missing config items * Add TODO * Fixes (xcm Superuser + DispatchLevelResult) * Fix cargo * Change runtime version * Unit-tests for dispatch bridging messages and XCM routing on BridgeHubs + HRMP * Removed Sudo pallet * Use () as the PriceForParentDelivery * Fixes * Fixes * Fixes * Fixes * Update transact_origin to transact_origin_and_runtime_call * Add ReachableDest config item to XCM pallet * Add BridgeRejectObsoleteHeadersAndMessages to bridge hubs (#1972) * Update SafeCallFilter to allow remark_with_event in runtime benchmarks * cargo fmt * Update substrate * Fix worst_case_holding * Fix DMQ queue unit tests * Remove unused label * cargo fmt * Actually process incoming XCMs * Fixes * Fixes * Fixes * Fixes - return back Weightless * Simplify local run + readme * Added measured benchmarks for `pallet_xcm` (#1968) * Fix Fix Fix * Fix * Fixes for transact benchmark * Fixes add pallet_xcm to benchmarks * Revert remark_with_event * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * Fixes * TMP * Fix for reserve_asset_deposited * ".git/.scripts/bench-bot.sh" pallet statemine assets pallet_xcm * Fix * ".git/.scripts/bench-bot.sh" pallet statemint assets pallet_xcm * Fix * ".git/.scripts/bench-bot.sh" pallet westmint assets pallet_xcm * Fix westmint * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * Fix * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" pallet collectives-polkadot collectives pallet_xcm * Fix for collectives * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-rococo bridge-hubs pallet_xcm * Fixes for bridge-hubs * Fixes - return back Weightless * Fix - removed MigrateToTrackInactive for contracts-rococo Co-authored-by: command-bot <> * cargo fmt * Fix benchmarks * Bko gav xcm v3 (#1993) * Fix * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" pallet statemine assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet westmint assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet statemint assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet collectives-polkadot collectives pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-rococo bridge-hubs pallet_xcm Co-authored-by: command-bot <> * Change AllowUnpaidExecutionFrom to be explicit * Turn on more xcm logs for parachains * Added polkadot-parachain-mint binary instructions * xcm-v3 benchmarks, weights, fixes for bridge-hubs (#2035) * Dumy weights to get compile * Change UniversalLocation according to https://github.com/paritytech/polkadot/pull/4097 (Location Inversion Removed) * Fix bridge-hubs weights * ".git/.scripts/bench-bot.sh" pallet statemine assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet statemint assets pallet_xcm * ".git/.scripts/bench-bot.sh" pallet collectives-polkadot collectives pallet_xcm * ".git/.scripts/bench-bot.sh" pallet westmint assets pallet_xcm * ".git/.scripts/bench-bot.sh" xcm bridge-hub-kusama bridge-hubs pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm bridge-hub-kusama bridge-hubs pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" pallet bridge-hub-rococo bridge-hubs pallet_xcm * ".git/.scripts/bench-bot.sh" xcm bridge-hub-rococo bridge-hubs pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm bridge-hub-rococo bridge-hubs pallet_xcm_benchmarks::generic * Change NetworkId to Option Co-authored-by: command-bot <> Co-authored-by: Keith Yeung * remove shift session manager from bridge-hub-rococo (#2047) * remove shift session manager from bridge-hub-rococo * also remove from Cargo.toml * Add event for showing the hash of an UMP sent message (#1228) * Add UpwardMessageSent event in parachain-system * additional fixes * Message Id * Fix errors from merge * fmt * more fmt * Remove todo * more formatting * Fixes * Fixes * Fixes * Fixes * Updated README.md and scripts/bridges_rococo_wococo.sh for sending messages (local, live) * Allow explicit unpaid executions from the relay chains for system parachains (#2060) * Allow explicit unpaid executions from the relay chains for system parachains * Put origin-filtering barriers into WithComputedOrigin * Use ConstU32<8> * Small nits * formatting * cargo fmt * Align laneId to 00000001 * Allow receiving XCMs from any relay chain plurality * Fixes * Use Rococo/Wococo runtime APIs defined in bridge primitives (#2080) * Patched dependencies (polkadot, substrate) for xcm-v3 (compiles + tests work) * Replace serial_test and fix with thread_local * Very init of script for bumping bridges repo * Squashed 'bridges/' changes from 062554430..984749ba0 984749ba0 Define separate signed extension for BHR/BHW (#1776) 72b03d463 update Substrate/Polkadot/Cumulus deps to master (#1775) 3065c7903 Added crate-level docs for the parachains pallet (#1772) a0f41b2d8 added/updated pallet level docs to grandpa and messages pallets (#1771) 6d69d1f4d docs: add Security Policy doc (#1770) ff8c0f727 Fix cargo deny issues (#1769) 6fc931d07 Bump xcm-v3 + substrate (#1767) 5840197c3 Define method for checking message lane weights (#1766) 881af0219 increase MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX and MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX for RBH/WBH (#1765) 41d91e961 fixed receive_delivery_proof_for_two_messages_by_two_relayers (#1764) ac0cf7b78 Fix some cargo-deny issues (#1763) 6d9dc6367 `cargo machete` removed unused deps (#1761) c265b5430 Remove sp-version dependency from bin-substrate (#1758) 1327c9d97 Set `R/WococoBridgeHub` bundle runtime version (#1756) a3a2a06ae Expose relay version metric (#1750) 13f4a0164 Use indirect runtime calls for RialtoParachain (#1753) 9563f9eee fix nightly clippy again (#1752) 21b75b893 no-grafana-startup-delay option in run.sh (#1751) a5fe0dfc4 Remove TODO (#1749) 6c826a6c3 Deduplicate pallet call structs used for indirect runtime calls (#1744) e575269e5 fix nightly clippy (#1746) 209cba353 Update project level docs (#1734) b05cef5b4 Improve relayer initialization behaviour (#1743) c7b6bae9d Make debug display of LaneId compatible with its previous version (#1740) 221e4e80c Remove CliChain::KeyPair (#1741) 3d9d2907f Use TypedLaneId instead of LaneId (#1738) 6683b8136 Simplify read_client_state() (#1739) 3f7353b82 Expose metrics of on-demand relay chain headers sync from with-parachain complex relays (#1737) ab65d84e0 Handle `SIGTERM` for the docker containers + relay (#1735) b9050e90c Replace `BATCH_CALL_SUPPORTED` (#1733) c28b3ff66 Updated db weights and some experiments (#1732) 023689c6c Do not require new headers if lane is empty (#1725) bddf1fa19 remove messages pallet owner relay argument (#1728) ef55226c6 more traces + remove signer override (#1727) 4d50df6ed remove BatchDeliveryTransaction::new and BatchConfirmationTransaction::new to avoid expects (#1726) 15244e53e Batch transactions in complex relays (#1669) c209bb9ac fix pallet names at bridge hubs (#1722) 036e6696e tests (#1720) 3d56e2089 Check origin? (#1718) af9abbeb8 Remove SOURCE_PARACHAIN_PARA_ID (#1716) d1cb5d1a8 fix parachains benchmarks (#1717) 84bdf864b Changed docker image name for substrate-relay (#1714) 5698fb465 Remove WeightToFee (#1713) 9f4106bc1 Fix bridge hub rococo/wococo weights (#1712) 114b1502f Only store header state root (pallet-bridge-parachains) (#1701) 92e86f07b New relayer rewards scheme integration (#1652) 8649d12af Signed extension to refund relayer at the target chain (#1657) ec6bafaf0 DeliveryConfirmationPayments trait for paying relayer rewards at the source chain (#1653) fab2344f4 only store header state root (pallet-bridge-grandpa) (#1699) b5e916f64 fixed benchmarks of relayers pallet (#1700) 5cce3e86d fix clippy (#1698) f78e8867b removed MintReward and added PayLaneRewardFromAccount (#1693) 0c19db305 added version guards to RBH<>WBH GRANDPA finality (and complex) relay (#1697) c003b951d removed ESTIMATE_MESSAGE_FEE_METHOD (#1696) 4903b7929 refund_pay_dispatch_fee removed (#1695) 61c3b22ca Replace const parameters types (#1691) git-subtree-dir: bridges git-subtree-split: 984749ba021b5b8ec16f65cd1e50b234640d838b * Fixes after merge * Fixes * Use auto runtime version for local runs (#2113) * Squashed 'bridges/' changes from 984749ba0..fb3c5ef5d fb3c5ef5d Add integrity check for signed extensions (#1780) 3959628ff add try-runtime feature to pallets (#1779) be36ff00c Default impl for some methods in messages benchmarking pallet config (#1777) 68344e329 Relayer reward metric (#1742) 6b455597b Crate-level documentation on finality relays and relayers pallet (#1773) git-subtree-dir: bridges git-subtree-split: fb3c5ef5dae42553522c7eff37678de9bf4f6c67 * Fixed try-runtime * Fix cargo.lock * Fix BridgePalletIsNotInitialized (#2114) * Squashed 'bridges/' changes from fb3c5ef5d..e2e9fa7f9 e2e9fa7f9 Expose EXTRA_STORAGE_PROOF_SIZE in bp-bridge-hub-cumulus (#1788) ba85532b1 Removed unecesserry test + substrate/polkadot (#1787) git-subtree-dir: bridges git-subtree-split: e2e9fa7f94d2f105c1816402a9ae4b85bfc34145 * Fix cargo.toml * Squashed 'bridges/' changes from e2e9fa7f9..d5f95c14a d5f95c14a use wss to connect to the Rialto node in test deployments (#1809) 722d47b06 fix compilation a48732676 Bump sysinfo from 0.15.9 to 0.27.7 9a6e8bb1d Bump env_logger from 0.8.4 to 0.10.0 89c5e7981 Bump async-trait from 0.1.61 to 0.1.62 ddd0a5742 Bump fixed-hash from 0.7.0 to 0.8.0 e8b0b8192 Bump impl-serde from 0.3.2 to 0.4.0 c5227460f Bump jsonpath_lib from 0.2.6 to 0.3.0 9f4771d38 Bump parking_lot from 0.11.2 to 0.12.1 dab5d72ae Bump backoff from 0.2.1 to 0.4.0 d7dd3acce Bump strum from 0.21.0 to 0.24.1 c49799017 Bump tokio from 1.24.1 to 1.24.2 db614681e Bump clap from 4.1.0 to 4.1.1 3c155214d update ignored dependencies for dependabot (#1790) 4c791472c No wildcard patterns in Cargo.toml (#1789) 33632313d Remove chain-specific dependencies from crates that will be used in Cumulus (#1783) git-subtree-dir: bridges git-subtree-split: d5f95c14a2771d7ad51db95670d08a5d0da526a0 * Fix `send-remark-local` script because of new xcm-v3 * Refactor haul/dispatch xcm stuff * Add Rococo <> Wococo integrity tests (#1975) * Remove 1 integrity test In sync with https://github.com/paritytech/parity-bridges-common/pull/1816 * use TargetHeaderChainAdapter and SourceHeaderChainAdapter * Rococo <-> Wococo integrity tests * Add message lane weights tests * Add signed extension integrity test * Bridge benchmarks for bridge hub rococo/wococo (#2107) * fix benchmarks compilation and add bridges benchmarks (prototype) to RBH/WBH * post-merge fixes * remove duplicate "pallet-collator-selection/runtime-benchmarks" * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_grandpa * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_parachains * remove methods that are no longer required * fixed helpers used in bridge hub messages palelt benchmarks * unused imports * compilation * compilation * benchmarks-ci.sh * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_messages * use generated weights in pallets configuration * add mod for new weights * impl WeightInfoExt Co-authored-by: command-bot <> * Ensure governance can call `initialize` with `xcm:Transact` bridge grandpa pallets * Just in case changed spec_version * Some scripts for enabling asset transfer on local statemine->westmint * script * Squashed 'bridges/' changes from d5f95c14a..b39cb0dea b39cb0dea MaxValues limit for storage maps in the pallet-bridge-grandpa (#1861) 11b3a611d fixed TODOs for weights v2 (#1860) 5a44f9fea Message delivery transaction is not free!!! (#1859) 59a42bd58 fixed BEEFY genesis (#1858) ab7c7ad0f Use parity-util-mem 0.12.0 (#1856) 8fd346e5a changed some tests for weights v2 (#1855) c438b9f74 Add separate Cargo.lock for `tools/runtime-codegen` (#1854) fc55a97d7 Fix `HeadersToKeep` and `MaxBridgedAuthorities` in Millau benchmarks (#1851) 72e64a3d7 Decrease number of GRANDPA authorities in Polkadot-like chains from 100_000 to 2_048 (#1852) d60a331ed Update Substrate/Polkadot/Cumulus dependencies + weights v2 (#1850) 61b229b65 Bump async-trait from 0.1.63 to 0.1.64 366333108 Bump serde_json from 1.0.91 to 1.0.92 (#1845) 4d917bb3a Bump trie-db from 0.24.0 to 0.25.0 8d919eac9 Bump anyhow from 1.0.68 to 1.0.69 ef9364dd0 Bump proc-macro2 from 1.0.49 to 1.0.51 9ddeebed5 Bump futures from 0.3.25 to 0.3.26 e02eb7573 connect using wss under flag condition (#1843) 99754a07f remove extra tracing on test deployments (#1842) bdb84cea6 Add tool for auto generating runtime code from metadata (#1812) 86662f263 fix bridge-runtime-common build (#1839) f656ac77d Change some macro names (#1837) 50f2980e9 Verify partial repo build on CI (#1832) f70f8231b fix bridge hubs blocks interval (#1836) ddbe5cddf [ci] change runners (#1833) 45a68ad39 Fix on demand parachains relay when no parachain head at target (#1834) 6dbce7258 Use GitLab env vars to get git commit (#1831) b1a8161e8 bump bridge hub versions (#1830) e909595e0 Use specific error for case when para head is missing from the bridge pallet (#1829) d517da8a2 Do not read parachain heads from ancient relay headers (#1827) 217bc72f5 Reconnect source client (#1826) 47bf5f693 Bump tokio from 1.24.2 to 1.25.0 6b307b48a Bump clap from 4.1.3 to 4.1.4 90bc29a17 Use named parameters for indirect calls (#1823) 986eeb556 Fix: typos (#1822) 450823b01 docs: fix broken link and minor nits (#1821) 3ed01ae31 do not call best_finalized_para_block_at_source for ancient block (#1819) 001956290 Functions to benchmark messages pallet with linked to parachain (#1817) e9b0a1c48 Remove InboundPayload check (#1816) 873ea4e40 Bump clap from 4.1.1 to 4.1.3 97eccaa8b also ignore the base xcm crate (#1798) 2d3dcd00b Update bundled runtime version for bridge hub r/wococo (#1814) 7167c0067 Bump bumpalo from 3.10.0 to 3.12.0 in /fuzz/storage-proof 067687520 Bump async-trait from 0.1.62 to 0.1.63 (#1811) git-subtree-dir: bridges git-subtree-split: b39cb0dea5751847ea73ab9946667003625eaf1a * Squashed 'bridges/' changes from b39cb0dea..4c4a7eae1 4c4a7eae1 Small stuff from Cumulus integration (#1865) git-subtree-dir: bridges git-subtree-split: 4c4a7eae1503aa63a84fb65d56d67599d362d645 * Squashed 'bridges/' changes from 4c4a7eae1..dcaec27aa dcaec27aa RefundRelayerForMessagesFromParachain improvements (#1879) 5457f0672 clippy fixes (#1880) 29e8a305c MaxValues for OutboundLanes map (#1871) 5219b56f8 More tests for message pallet weights (#1870) c4c0c7a1b Bump signal-hook from 0.3.14 to 0.3.15 0ff597b96 Bump serde_json from 1.0.92 to 1.0.93 1c5132eb1 Bump subxt from `20adb19` to `9e2acff` adb07816b update parachains relay doc (#1874) 972ef3133 Update README.md (#1872) 94648061b MaxValues for maps in parachain maps (#1868) 662267a6f "refund" proof size in GRANDPa pallet (#1863) git-subtree-dir: bridges git-subtree-split: dcaec27aaa6f41070fbdfbfd4fde2029697eb85f * Squashed 'bridges/' changes from dcaec27aa..91e66cfb9 91e66cfb9 Fix clippy issues (#1884) 0bd77f457 Reject storage proofs with unused nodes: begin (#1878) 77a3672f9 Refund extra proof bytes in message delivery transaction (#1864) git-subtree-dir: bridges git-subtree-split: 91e66cfb99c1a7b247e435515dd0f62b4058974e * Fix tests * Squashed 'bridges/' changes from 91e66cfb9..d39f563be d39f563be Make `weights::WeightInfo` pub (#1886) c67d06aa5 ChainWithGrandpa in primitives (#1885) git-subtree-dir: bridges git-subtree-split: d39f563bea57528c16763f458af3036842a0ea5f * Merge fix * Squashed 'bridges/' changes from d39f563be..78e3357c0 78e3357c0 RefundRelayerForMessagesFromParachain improvements (#1895) 131b17359 optimize justification before submit (#1887) 5bc279ebb use complex transactions on RBH/WBH bridge hubs (#1893) 8f0c09ab9 Bump clap from 4.1.4 to 4.1.6 66429b06a Bump sysinfo from 0.27.7 to 0.28.0 8b329ee8f Bump trie-db from 0.25.0 to 0.25.1 635cfccfd Bump time from 0.3.17 to 0.3.19 git-subtree-dir: bridges git-subtree-split: 78e3357c0387c95317b8c3e5c4d9316f3a9f3ef4 * Squashed 'bridges/' changes from 78e3357c0..5b5627e90 5b5627e90 Rewards refund for relaying BridgeHubRococo/BridgeHubWococo (#1894) git-subtree-dir: bridges git-subtree-split: 5b5627e9081640ed5691eb2891182843563fb99a * Rewards for relayers setup (#2194) * Rewards for relayers setup * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_relayers * Setup weight for relayer * Setup `DeliveryConfirmationPayments` + `RefundRelayerForMessagesFromParachain` * No need to have more than one collator per parachain * Setup multi refund signed extensions * Rewards sign ext test * test * fixes --------- Co-authored-by: command-bot <> * Squashed 'bridges/' changes from 5b5627e90..3c15c3645 3c15c3645 get rid of ChainWithMessages::WeightInfo, because we can't have exact weights for "external chains" (#1899) 8ccaa0213 Wrap confirmation and finality transactions into batch_all in Millau -> RialtoParachain bridge (#1898) 9b7285edb Weight+size limits for bridge GRANDPA pallet calls (#1882) git-subtree-dir: bridges git-subtree-split: 3c15c36455f2ad944df6a492a8d82f7e0aaf7e9f * Squashed 'bridges/' changes from 3c15c3645..d05a98473 d05a98473 Refund messages confirmation tx (#1904) e2e8a7198 Relayers pallet: extend payment source id (#1907) cccf73b3f fix nightly clippy issues (#1915) a33a91e79 Bump tempfile from 3.3.0 to 3.4.0 1df768a2e Bump time from 0.3.17 to 0.3.20 cf17b424f Bump sysinfo from 0.28.0 to 0.28.1 0b6276b41 Bump jsonrpsee from 0.15.1 to 0.16.2 328dde02b Bump rand from 0.7.3 to 0.8.5 2f302a4b6 Bump trie-db from 0.25.1 to 0.26.0 b5d5d03ab CI add jobs to publish Docker images description to hub.docker.com (#1906) db5168f18 Do not stall on lost transaction (#1903) 2d83d6389 Fix init-bridge (#1900) git-subtree-dir: bridges git-subtree-split: d05a98473dc933cfed9e5f59023efa2ec811f03c * Rewards adjustments * Update RBH/WBH spec version * Squashed 'bridges/' changes from d05a98473..ce7cf9a49 ce7cf9a49 Removed deprecated `#[pallet::generate_store(pub(super) trait Store)]` according to latest Cumulus (#1964) 897b1c0b2 Bump substrate/polkadot/cumulus (#1962) 7b946da2d Backport xcm bridging extensions to the bridge repo (#1813) 88c1114ec Bump futures from 0.3.26 to 0.3.27 8668f73bf Bump serde from 1.0.152 to 1.0.155 3df8823e1 Bump subxt from `a7b45ef` to `d4545de` ef1b1bcd0 Some error improvements (#1956) 434c5e014 optimize justifications before they're included into complex transaction (#1949) 7bac365a6 Actually clone client data by reference when cloning the client (#1941) 764ddd4a8 remove lock file after checks are done (#1942) c18a758f8 Fix invalid messages relay delivery transactions (#1940) 8ad152b06 fix nightly benchmarks test (#1939) d451b4f84 Bump tokio from 1.25.0 to 1.26.0 8019c50aa Bump async-trait from 0.1.64 to 0.1.66 aa055fcee Bump serde_json from 1.0.93 to 1.0.94 ec2ef31c4 Bump subxt from `1c5faf3` to `a7b45ef` 20026366f Bump sysinfo from 0.28.1 to 0.28.2 fe246d1e3 Bump thiserror from 1.0.38 to 1.0.39 c95e0cf02 Fix deploy step in CI (#1931) 15b41c2dd Improve some relay errors readability (#1930) 792deae5e Added deploy Job (#1929) d86c3ce21 Reconnect on-demand clients from MessagesSource::reconnect and MessagesTarget::reconnect (#1927) 4161b51f0 get rid of obsolete weight functions (#1926) 9b3b00e0f cargo update -p clap@4.1.6 (#1925) 13ab28c37 Bump subxt from `9e2acff` to `1c5faf3` bb6171a05 Remove subxt dependency features (#1924) 66d200abb Verify with-parachain message benchmarks on CI (#1923) b6af2116f Update BHR and BHW spec version (#1922) d464e78d9 Fix benchmarks (#1919) 74574d53e fix master compilation (#1920) 1b373dff9 Fix multiple parachain headers submission for single message delivery (#1916) git-subtree-dir: bridges git-subtree-split: ce7cf9a4977fe614d35b6a7a84d5057e2c4ccaf5 * fixed npm install call (#2323) * New weights (#2315) * New weights * Fix compile benchmarks * Fix import * Fix all weights * Remove bridge_common_config replaced by bridges impl * Cargo.lock * fixed bridge pallets compilation * Cargo.lock * fix bridge pallets compilation after substrate+polkadot bump * BridgeHubs: XCM ExportMessage benchmark - just Rococo now * bench export_message() * include Bridge::haul_blob() weight in ExportMessage weight * fix import * more build fixes * Squashed 'bridges/' changes from ce7cf9a49..6343a7d37 6343a7d37 bump substrate+polkadot refs and fix builds (#1989) 8efc2b3cc Added receive_single_message_proof_with_dispatch benchmark (#1990) 6540f74dc Remove deprecated code from bridge-runtime-common (#1983) c4f368be3 minor cosmetic updates (#1985) bef11ac43 remove invalid weight, returned by send_message (#1984) 28cf5c957 Kusama <> Polkadot relay prototype (#1982) b195223d1 Bump serde from 1.0.156 to 1.0.157 70caa75d7 ignore binary-merkle-tree (#1980) 3dc640d30 Bump thiserror from 1.0.39 to 1.0.40 8a2729101 Bump subxt from `d4545de` to `ae63d3d` 40937e8a3 Bump clap from 4.1.8 to 4.1.11 d72394c4e Bump finality-grandpa from 0.16.1 to 0.16.2 54147603d Bump serde from 1.0.155 to 1.0.156 b513193e6 Bump anyhow from 1.0.69 to 1.0.70 20867abd9 Bump sysinfo from 0.28.2 to 0.28.3 4d9a45305 Bump async-trait from 0.1.66 to 0.1.67 8a88a7536 Bump trie-db from 0.26.0 to 0.27.1 0add06edd move signed extension stuff from prolkadot-core primitives to bridge-hub-cumulus-primitives (#1968) 7481ce6eb added UpdatedBestFinalizedHeader event to pallet-bridge-grandpa (#1967) 6787cd0cb RBH <> WBH dashboards and alerts (#1966) 036f7be76 enable relayer rewards metrics at bridge hubs (#1965) a3f07d5dd Fix invalid batch transaction (#1957) git-subtree-dir: bridges git-subtree-split: 6343a7d37c32191413be91afb537b8bc6c770285 * dispatch message weight for bridge messages (#2378) Co-authored-by: Svyatoslav Nikolsky * Fixes * Squashed 'bridges/' changes from 6343a7d37..c1d5990e8 c1d5990e8 Try check-rustdoc pipeline (#1782) git-subtree-dir: bridges git-subtree-split: c1d5990e840b8ee4981beb61a8099271ee629ae5 * Removed imports * Fix compile * fixed benchmarks compilation * fix rustdoc * Squashed 'bridges/' changes from c1d5990e8..ecddd4a31 ecddd4a31 Rust cargo doc for all features (#1995) e0997c14d Fix gitlab-check (#1994) 5284850ef Bump clap from 4.1.11 to 4.1.13 743cd60df Bump sysinfo from 0.28.3 to 0.28.4 dc322bae2 Bump async-trait from 0.1.67 to 0.1.68 git-subtree-dir: bridges git-subtree-split: ecddd4a315470d85135aafbdb96753af9b07b854 * Updated scripts for transfer assets * Cargo.lock * Script updates for `ping-via-bridge-from-statemine-rococo` * Added `transfer-asset-from-statemine-rococo` * Finished scripts * README.md * Compile fix + log xcm trace all * Initial version of bridges pallet as subtree of https://github.com/paritytech/parity-bridges-common Added `Bridges subtree files` pr review rule * Squashed 'bridges/' changes from ecddd4a31..d30927c08 d30927c08 Revert dispatch-results (#2048) fa454c3b4 Remove unneeded files (#2044) 956a2c687 Bump clap from 4.2.1 to 4.2.2 91951583a Bump serde_json from 1.0.95 to 1.0.96 fcf462051 Bump h2 from 0.3.16 to 0.3.17 in /tools/runtime-codegen b751fb24f Bump h2 from 0.3.16 to 0.3.17 0bf31ab78 update refs (#2041) a490ecbd3 Fix CI build (#2039) 01139ebbc Define `RangeInclusiveExt` (#2037) 2db2f3fe3 Impl review suggestions from #2021 (#2036) 36292760f fix build step on CI (#2034) 3a2311b7a refund extra weight in receive_messages_delivery_proof call (#2031) 77f1641d1 Boost message delivery transaction priority (#2023) c23c4e441 Reject delivery transactions with at least one obsolete message (#2021) 68ba699b7 Reintroduce msg dispatch status reporting (#2027) d1e852cc3 Bump hex-literal from 0.4.0 to 0.4.1 16f25d613 Relay node down alert (#2002) 4bb1a6406 only refund if all bundled messages have been delivered (#2019) b9acf52bc fail with InsufficientDispatchWeight if dispatch_weight doesn't cover weight of all bundled messages (#2018) e10097fe2 Remove unneeded error debug strings (#2017) f5e38f057 enable metrics on all validator nodes (#2016) c35f1a187 Bump scale-info from 2.4.0 to 2.5.0 04c56977c Bump clap from 4.1.13 to 4.2.1 481371f3c Bump hex-literal from 0.3.4 to 0.4.0 6b9c1400d Bump serde from 1.0.158 to 1.0.159 e71877a2e Bump futures from 0.3.27 to 0.3.28 c019f4faa Bump tempfile from 3.4.0 to 3.5.0 2e6e79ef6 Bump serde_json from 1.0.94 to 1.0.95 0698b1ff9 Bump tokio from 1.26.0 to 1.27.0 35b149830 fix test step on CI (#2003) 0c3acc858 cleanup removed lane traces (#2001) 8bf81749e bump BridgeHubRococo/BridgeHubWococo versions (#2000) e53bb7f36 MaxRequests -> MaxFreeMandatoryHeadersPerBlock in pallet-bridge-grandpa (#1997) dfcc09043 Run tests for `runtime-benchmarks` feature only (#1998) efcc8db17 Run benchmarks for mock runtimes (#1996) git-subtree-dir: bridges git-subtree-split: d30927c089bd9e73092d1ec1a62895603cb277a3 * Fixes * Squashed 'bridges/' content from commit d30927c08 git-subtree-dir: bridges git-subtree-split: d30927c089bd9e73092d1ec1a62895603cb277a3 * Updated REAMDE.md and BRIDGES.md (inspired by original https://github.com/paritytech/polkadot/blob/d22eb62fe40e55e15eb91d375f48cc540d83a47e/BRIDGES.md) * Squashed 'bridges/' changes from d30927c08..d3970944b d3970944b Small simplifications (#2050) git-subtree-dir: bridges git-subtree-split: d3970944b0cfc4ea5226225e1ca07dab234c3556 * Squashed 'bridges/' changes from d3970944b..2180797fb 2180797fb Removed CODEOWNERS (#2051) git-subtree-dir: bridges git-subtree-split: 2180797fbf8a990490c67853dcffd81bc8dd083c * Reused `teleports_for_native_asset_works` test to all bridge-hub runtime Extract runtime_para_id for test Fix test Typos Added helper for `execute_as_governance` * Added test case `initialize_bridge_by_governance_works` * Added test case `handle_export_message_from_system_parachain_to_outbound_queue_works` fix script Removed BridgeGrandpaRococoInstance * Added test-case `message_dispatch_routing_works` * Squashed 'bridges/' changes from 2180797fbf..4850aac8ce 4850aac8ce Removed relayer_account: &AccountId from MessageDispatch (#2080) 8c8adafd54 Revert "Fix max-size messages at test chains (#2064)" (#2077) c01a63efd8 Fixed off-by-one when confirming rewards in messages pallet (#2075) a298be96aa Update subxt dependencies (#2072) c0eef51eab Fix max-size messages at test chains (#2064) 3a658e3697 Messages relay fixes (#2073) 0022b5ab22 Slash relayers for invalid transactions (#2025) 198104007f Bump enumflags2 from 0.7.5 to 0.7.7 9229b257e5 [ci] Fix rules for docker build (#2069) 660d791390 [ci] Update buildah command and version (#2058) e4535c0ca4 fix the way latest_confirmed_nonce_at_source is "calculated" (#2067) dbc2d37590 select nothing if we have already selected nonces to submit or have submitted something (#2065) a7eedd21fe [relay-substrate-client] Bump jsonrpsee (#2066) 8875d5aeae Bump clap from 4.2.2 to 4.2.4 25f9cf55e2 Another use of RangeInclusiveExt::checked_len() (#2060) 4942c12a5f submit lane unblock transactions from relay (#2030) c0325d3c9c Test deployments fixes (#2057) fc7b9b7ed7 Use the new matrix server (#2056) 63bcb5c10b Fixed delivery alert rule (#2052) git-subtree-dir: bridges git-subtree-split: 4850aac8ce6c34e5ca6246b88cd14c873a879cba * Fmt * Squashed 'bridges/' changes from 4850aac8ce..66aaf0dd23 66aaf0dd23 Nits (#2083) git-subtree-dir: bridges git-subtree-split: 66aaf0dd239dde40b64264061a77c921e2c82568 * Cleaning * bridge-hub-rococo: minor fixes Signed-off-by: Adrian Catangiu * Squashed 'bridges/' changes from 66aaf0dd23..557ecbcecc 557ecbcecc Fix sized messages (Follow-up on #2064) (#2103) 54f587a066 Add weight of refund extension post_dispatch to the weights of messages pallet (#2089) 5b1626f8c4 fix pallet param for nightly benchmarks check (#2099) ae44c6b7a1 Add millau specific messages weights (#2097) 6ad0bd1f1e Add integrity tests to rialto parachain runtiime (#2096) 6919556de5 Bump tokio from 1.27.0 to 1.28.0 58795fcb75 Bump clap from 4.2.4 to 4.2.5 01bf31085b Bump scale-info from 2.5.0 to 2.6.0 8fe383240d Bump anyhow from 1.0.70 to 1.0.71 8d94e82ad5 deployments: add new BEEFY metrics and alarms (#2090) e9a4749e7e Bump wasmtime from 6.0.1 to 6.0.2 9d9936c0d9 Bump wasmtime from 6.0.1 to 6.0.2 in /tools/runtime-codegen 5d77cd7bee Add more logs to relayer and message pallets (#2082) 75fbb9d3ef Update comment (#2081) 9904d09cf6 Benchmarks for new relayers pallet calls (#2040) git-subtree-dir: bridges git-subtree-split: 557ecbcecc585547b744a5ac9fb8d7f3b9de4521 * fmt * Fix compile * Fix benchmark * Squashed 'bridges/' changes from 557ecbcecc..04b3dda6aa 04b3dda6aa Remove from subtree (#2111) f8ff15e7e7 Add `MessagesPalletInstance` for integrity tests (#2107) 92ccef58e6 Use generated runtimes for BHR/BHW (#2106) b33e0a585b Fix comment (#2105) git-subtree-dir: bridges git-subtree-split: 04b3dda6aa38599e612ff637710b6d2cff275ef3 * Fix * ".git/.scripts/commands/fmt/fmt.sh" * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_grandpa * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_parachains * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_messages * ".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-rococo bridge-hubs pallet_bridge_relayers --------- Signed-off-by: Adrian Catangiu Co-authored-by: Keith Yeung Co-authored-by: Anthony Lazam Co-authored-by: Serban Iorga Co-authored-by: Svyatoslav Nikolsky Co-authored-by: girazoki Co-authored-by: parity-processbot <> Co-authored-by: Serban Iorga Co-authored-by: acatangiu * companion for #13384 (#2417) * companion for #13384 * update rpc cli * fix missed stuff * update parachain rpc commands * update polkadot and substrate deps * update substrate & polkadot --------- Co-authored-by: parity-processbot <> Co-authored-by: muharem * Companion for #13701 (#2423) * Set data_path * fmt * Updated substrate and polkadot * Bump parity-scale-codec from 3.4.0 to 3.5.0 (#2523) Bumps [parity-scale-codec](https://github.com/paritytech/parity-scale-codec) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/paritytech/parity-scale-codec/releases) - [Changelog](https://github.com/paritytech/parity-scale-codec/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/parity-scale-codec/compare/v3.4.0...parity-scale-codec-v3.5.0) --- updated-dependencies: - dependency-name: parity-scale-codec dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Companion: XCM remote lock config (#2463) * xcm remote lock config * rename * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * Update DNS names of Rococo Contracts bootnodes (#2524) * bump zombienet version (#2525) * bump zombienet version * fix para registration args * Make zombienet tests required (#2527) Co-authored-by: parity-processbot <> * Fix Clippy (#2522) * Import Clippy config from Polkadot Signed-off-by: Oliver Tale-Yazdi * Auto clippy fix Signed-off-by: Oliver Tale-Yazdi * No tabs in comments Signed-off-by: Oliver Tale-Yazdi * Prefer matches Signed-off-by: Oliver Tale-Yazdi * Dont drop references Signed-off-by: Oliver Tale-Yazdi * Trivial Signed-off-by: Oliver Tale-Yazdi * Refactor Signed-off-by: Oliver Tale-Yazdi * fmt Signed-off-by: Oliver Tale-Yazdi * add clippy to ci * Clippy reborrow Signed-off-by: Oliver Tale-Yazdi * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher * Partially revert 'Prefer matches' Using matches! instead of match does give less compiler checks as per review from @chevdor. Partially reverts 8c0609677f3ea040f77fffd5be6facf7c3fec95c Signed-off-by: Oliver Tale-Yazdi * Update .cargo/config.toml Co-authored-by: Chevdor * Revert revert 💩 Should be fine to use matches! macro since it is an explicit whitelist, not wildcard matching. --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: alvicsam Co-authored-by: Bastian Köcher Co-authored-by: Chevdor Co-authored-by: parity-processbot <> * Bump serde from 1.0.160 to 1.0.162 (#2534) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.160 to 1.0.162. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.160...1.0.162) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: parity-processbot <> * Update westmint bootnodes (#2521) Co-authored-by: parity-processbot <> * companion for #14088 (#2539) * companion for #14088 * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> * add set_invulnerables to SafeCallFilter (#2537) * Substrate 13843 (Asset Freezing) Companion (#2437) * add migrations * fix pallet instancing in migration * migrate by instance * weights * remove migrations * update weights * update weights * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: muharem Co-authored-by: parity-processbot <> * Prevent name clash with Substrate Pallet Template (#2536) * Remove cumulus template pallet Signed-off-by: Oliver Tale-Yazdi * Use substrate template pallet Signed-off-by: Oliver Tale-Yazdi * Update Cargo.lock Signed-off-by: Oliver Tale-Yazdi * Revert back to master Revert "Remove cumulus template pallet" This reverts commit a6d3566e52e9124c0e9823c12cacea557187c6b4. Revert "Use substrate template pallet" This reverts commit fbb8eea28dec5b75e13823762572d24bd9a4b88f. Revert "Update Cargo.lock" This reverts commit ee24cb81e5d91d6b8f7ef0c97d0f0fdbfe857c53. Signed-off-by: Oliver Tale-Yazdi * pallet-template -> pallet-parachain-template Signed-off-by: Oliver Tale-Yazdi * Update Cargo.lock Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi * Bump quote from 1.0.26 to 1.0.27 (#2548) Bumps [quote](https://github.com/dtolnay/quote) from 1.0.26 to 1.0.27. - [Release notes](https://github.com/dtolnay/quote/releases) - [Commits](https://github.com/dtolnay/quote/compare/1.0.26...1.0.27) --- updated-dependencies: - dependency-name: quote dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump array-bytes from 6.0.0 to 6.1.0 (#2549) Bumps [array-bytes](https://github.com/hack-ink/array-bytes) from 6.0.0 to 6.1.0. - [Release notes](https://github.com/hack-ink/array-bytes/releases) - [Changelog](https://github.com/hack-ink/array-bytes/blob/main/CHANGELOG) - [Commits](https://github.com/hack-ink/array-bytes/compare/v6.0.0...v6.1.0) --- updated-dependencies: - dependency-name: array-bytes dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Collectives: xcm base weights (#2550) * [Backport] weights from 9420 (#2562) * [benchmarks] Update weights for collectives (#2532) * [benchmarks] pr with weights * bump zombienet version (#2525) * bump zombienet version * fix para registration args --------- Co-authored-by: paritytech-ci Co-authored-by: Javier Viola * [benchmarks] Update weights for bridge-hubs (#2533) * [benchmarks] pr with weights * bump zombienet version (#2525) * bump zombienet version * fix para registration args --------- Co-authored-by: paritytech-ci Co-authored-by: Javier Viola * [benchmarks] Update weights for statemine/t (#2535) * [benchmarks] pr with weights * bump zombienet version (#2525) * bump zombienet version * fix para registration args --------- Co-authored-by: paritytech-ci Co-authored-by: Javier Viola --------- Co-authored-by: Paritytech CI <52199148+paritytech-ci@users.noreply.github.com> Co-authored-by: paritytech-ci Co-authored-by: Javier Viola * Companion for paritytech/substrate#14080 (#2526) * Companion for paritytech/substrate#14080 * Update lockfile * Update Polkadot * Update Cargo.lock * Substrate Companion (#2514) * pallet-sudo-weightinfo * revert * s * runtime-benchmarks * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * companion PR for https://github.com/paritytech/substrate/pull/13373 (#2547) * companion PR for https://github.com/paritytech/substrate/pull/13373 * Add missing trait function * Fix template Signed-off-by: Oliver Tale-Yazdi * Add missing weight functions Signed-off-by: Oliver Tale-Yazdi * update lockfile for {"polkadot", "substrate"} --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: Falco Hirschenberger Co-authored-by: Oliver Tale-Yazdi Co-authored-by: parity-processbot <> * docs: fix build command and some broken links (#2567) * Bump parity-db (#2559) * [Substrate Companion] Upgrade to libp2p 0.51.3 (#2429) * upgrade js-sys to 0.3.61 * update wasm-bindgen-futures * update zeroize * update either * update once_cell --------- Co-authored-by: parity-processbot <> * [Backport] version bumps from 9420 (#2561) * Bump crate versions * Bump spec_version to 9420 * Bump transaction_version (#2520) * bump trnsaction_version * revert transaction_version bump for all except the collectives * make cargo fmt happy again * Relay-parent digest logs for parachains (#2552) * add digest item for relay-parent to primitives * add a relay-parent-storage-root digest as a workaround * more docs * deposit log in pallet-parachain-system * even more docs * fix duplicate imports after botched mertge * fix hyperlinks in docs * clean up match Co-authored-by: Bastian Köcher * improve docs * fix typo * add number to the digest item --------- Co-authored-by: Bastian Köcher * Consensus utilities and rearchitecture for more dynamic collators (#2382) * implement a proposer utility for consensus * tidy up deps of new proposer crate * implement a collator-service crate * rewrite cumulus-collator to use new service struct * implement a module for relay-chain-driven collators * adapt start_collator to use the new relay_chain_driven module * move collator-service to a public submodule * create an interface trait for the proposer * begin aura reimplementation * address review comments * update substrrate git ref * update polkadot-primitives refs * rough draft of aura collation using standalone fns * add a ServiceInterface * port aura reimpl to use new service trait * add an import queue utility crate * remove import queue crate in favor of module in common * implement new verification queue for aura * implement remaining behaviors * split 'collate' into smaller functions that could be pub * add telemetry * fix doc job? * Specify async-trait patch version Co-authored-by: Bastian Köcher * remove 'fn@' in doc string. Co-authored-by: Bastian Köcher * update variable names to be more readable * refactor proposer errors to anyhow/thiserror * remove manual span instrumentation Co-authored-by: Bastian Köcher * make slot_claim private * fix unused import * fmt * fmt * make clippy happy --------- Co-authored-by: Bastian Köcher * remove sp-serializer (#2574) * remove sp-serializer * improve * update lockfile for {"polkadot", "substrate"} * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> * Bump serde from 1.0.162 to 1.0.163 (#2568) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.162 to 1.0.163. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.162...v1.0.163) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump tokio from 1.28.0 to 1.28.1 (#2564) Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.28.0 to 1.28.1. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.28.0...tokio-1.28.1) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump anyhow from 1.0.69 to 1.0.71 (#2584) Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.69 to 1.0.71. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.69...1.0.71) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump polkadot (#2585) * Bump polkadot * Another bump * Fix for `GrandpaJustification` + `Debug` --------- Co-authored-by: Branislav Kontur * Collectives integration tests xcm v3 (#2221) * Collectives integration tests xcm v3 * remove comment * review fixs --------- Co-authored-by: parity-processbot <> * BridgeHubRococo/Wococo nits + updated subtree (#2572) * Nits (merge before separatelly) * Small cosmetics for Rococo/Wococo bridge local run * Squashed 'bridges/' changes from 04b3dda6aa..5fc377ab34 5fc377ab34 Support for kusama-polkadot relaying (#2128) 01f4b7f1ba Fix clippy warnings (#2127) 696ff1c368 BHK/P alignments (#2115) 2a66aa3248 Small fixes (#2126) 7810f1a988 Cosmetics (#2124) daf250f69c Remove some `expect()` statements (#2123) 1c5fba8274 temporarily remove balance guard (#2121) 3d0e547361 Propagate message receival confirmation errors (#2116) 1c33143f07 Propagate message verification errors (#2114) b075b00910 Bump time from 0.3.20 to 0.3.21 51a3a51618 Bump serde from 1.0.160 to 1.0.162 da88d044a6 Bump clap from 4.2.5 to 4.2.7 cdca322cd6 Bump sysinfo from 0.28.4 to 0.29.0 git-subtree-dir: bridges git-subtree-split: 5fc377ab34f7dfd3293099c5feec49255e827812 * Fix * Allow to change storage constants (DeliveryReward, RequiredStakeForStakeAndSlash) + tests * Clippy * New SA for RO/WO * Squashed 'bridges/' changes from 5fc377ab34..0f6091d481 0f6091d481 Bump polkadot/substrate (#2134) 9233f0a337 Bump tokio from 1.28.0 to 1.28.1 a29c1caa93 Bump serde from 1.0.162 to 1.0.163 git-subtree-dir: bridges git-subtree-split: 0f6091d48184ebb4f75cb3089befa6b92cf37335 * Glutton Parachain (#2294) * Glutton Parachain * implement collator stuff * add glutton * implement missing api calls * small changes * use shell-runtime as starting point * update docs * Glutton chain configurations * successfully build * add local chain config * chain spec * update Cargo.lock * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * explicit indices * update para_id * irrelevant docs * update glutton.json * para_id as cli argument * expect * merge * update * fixes * xcm-builder/runtime-benchmarks added * benchmarks enabled * add glutton to bench scripts + nitpick * remove local bootnode * ".git/.scripts/commands/fmt/fmt.sh" * make clippy happy * fix clippy * fix chain_spec * fix chain_spec 2 * fix chain_spec 3 * ".git/.scripts/commands/bench/bench.sh" pallet glutton-kusama-dev-1300 glutton pallet_glutton * Update polkadot-parachain/src/chain_spec/glutton.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: NachoPal Co-authored-by: command-bot <> * Bump polkadot (#2589) * Added Dwellir bootnodes. (#2557) * Bump scale-info from 2.6.0 to 2.7.0 (#2587) Bumps [scale-info](https://github.com/paritytech/scale-info) from 2.6.0 to 2.7.0. - [Release notes](https://github.com/paritytech/scale-info/releases) - [Changelog](https://github.com/paritytech/scale-info/blob/master/CHANGELOG.md) - [Commits](https://github.com/paritytech/scale-info/commits/v2.7.0) --- updated-dependencies: - dependency-name: scale-info dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump proc-macro2 from 1.0.56 to 1.0.58 (#2592) Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.56 to 1.0.58. - [Release notes](https://github.com/dtolnay/proc-macro2/releases) - [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.56...1.0.58) --- updated-dependencies: - dependency-name: proc-macro2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * BridgeHub[Rococo/Wococo] test batched relaying of messages and their dispatch (#2578) Added some tests that aim to cover the runtime configuration that is exercised when BH receives relayed complex message. * checks correct importing of proofs for: bridged chain finality, bridged para heads, bridged messages, * checks relayer extension correctly configured to reward submitting relayer, * checks relayed message is successfully dispatched. Also moved generic test-utils from `asset-test-utils: parachains/runtimes/assets/test-utils` one level up to new crate `parachains-runtimes-test-utils: parachains/runtimes/test-utils` to be reused by BridgeHubs. Signed-off-by: acatangiu Co-authored-by: Branislav Kontur * Bump toml from 0.7.3 to 0.7.4 (#2598) Bumps [toml](https://github.com/toml-rs/toml) from 0.7.3 to 0.7.4. - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.7.3...toml-v0.7.4) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump bridges (#2602) * Squashed 'bridges/' changes from 0f6091d481..c9dd8b9dfc c9dd8b9dfc expose test utilities to be used in BH paras (#2142) 334df22361 Ws-port argument has been repalced with rpc-port (#2140) 106173cb91 fix nodes startup (#2138) git-subtree-dir: bridges git-subtree-split: c9dd8b9dfc8b48014d119153032589ac39c18c9a * tmp * Removed Cargo.lock from subtreee (#2604) * [Feature] XCM-Emulator (#2447) * [Feature] XCM-Emulator * ".git/.scripts/commands/fmt/fmt.sh" * rename * readme * more rename * rename directory * implement AssetTransactor * Update xcm/xcm-emulator/README.md Co-authored-by: Muharem Ismailov * address review comments (#2502) * Update xcm/xcm-emulator/example/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update xcm/xcm-emulator/README.md * Use 2d weights. * Point out nearer the failure why it should fail * Move test-runtime to under examples * Walk through how to use it * proof needs to be non-zero * Apply suggestions from code review * Update xcm/xcm-emulator/README.md Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Improve xcm emulator (#2593) * folder restructutre * common created * make macros repetitions * messenger traits for relay and para * default Messenger impls * messenger traits refactor * declared two networks * init network approach works * queues use HashMap but relay block number * init and reset refactor * messengers trait name changed * relay block number suboptimal * fix reset hashmap keys * genesis added * test ext added for parachains * genesis added relay chains * genesis to storage * new_ext replaced by on_init * new relay block number approach * ext_wrapper added * added types to Parachain trait * relay chain with types * restructure * para_ids working * replace para_id getter * replace para_id getter 2 * tests restructure + common variables * added sovereign and balances helpers * more helpers + tess pass * expected events macro added * added events trait method * expect_events macro improve * expect_events macro done * network traits added * reserve_transfer test added * para & relay macro inputs redefined * added collectives & BH paras * test restructure * statemine removed * nitpick * rename test folder + events logs * clean * weight threshold helper * update readme * remove cumulus-test-service dependancy * fmt * comment docs * update e2e tests to xcm v3 * clippy + runtime-benchmark + clean docs --------- Co-authored-by: command-bot <> Co-authored-by: Muharem Ismailov Co-authored-by: Squirrel Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Ignacio Palacios * Update README.md (#2603) fix broken link * Update syn (#2605) Signed-off-by: Oliver Tale-Yazdi * Switch to `relay_dispatch_queue_remaining_capacity` (#2608) * Switch to `relay_dispatch_queue_remaining_capacity` This switches the parachain runtimes to use `relay_dispatch_queue_remaining_capacity` when possible. If the data is not yet available on the relay chain it falls back to `relay_dispatch_queue_size`. It will require that all parachains migrate to `relay_dispatch_queue_remaining_capacity` before we can start removing the call to `relay_dipatch_queue_size`. Besides that the pr adapts the xcm exumulator to make it work with the message queue. * Fix test and use correct types * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: command-bot <> * update WasmExecutionMethod (#2599) * Used `GlobalConsensusParachainConvertsFor` from `xcm-builder` * Bump ruby/setup-ruby from 1.148.0 to 1.149.0 (#2581) Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.148.0 to 1.149.0. - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Commits](https://github.com/ruby/setup-ruby/compare/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c...7d546f4868fb108ed378764d873683f920672ae2) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump Swatinem/rust-cache from 2.2.1 to 2.3.0 (#2582) Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.2.1 to 2.3.0. - [Release notes](https://github.com/Swatinem/rust-cache/releases) - [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md) - [Commits](https://github.com/Swatinem/rust-cache/compare/6fd3edff6979b79f87531400ad694fb7f2c84b1f...060bda31e0be4f453bb6ed2d7e5427b31734ad01) --- updated-dependencies: - dependency-name: Swatinem/rust-cache dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Chainspecs: Fix bootnode address (#2611) * Update substrate/polkadot + needed changes to compile (#2613) * Update substrate/polkadot + needed changed to compile * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: command-bot <> * Nfts on Statemint (#2595) * Try-runtime proper return types (#2615) * Try-runtime proper return types * update * update pallet-xcm * NFT Fractionalization on Westmint (#2600) * NFT Fractionalization on Westmint * Typos * One more typo * Undo Cargo.lock * Point to master * Referense the first instance of the assets pallet * Update cargo.lock --------- Co-authored-by: parity-processbot <> * Do not assume `AssetId`s are `Copy` (companion for substrate#14158) (#2586) * Do not assume `AssetId`s are `Copy` * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> * Bump Swatinem/rust-cache from 2.3.0 to 2.4.0 (#2617) Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/Swatinem/rust-cache/releases) - [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md) - [Commits](https://github.com/Swatinem/rust-cache/compare/060bda31e0be4f453bb6ed2d7e5427b31734ad01...988c164c3d0e93c4dbab36aaf5bbeb77425b2894) --- updated-dependencies: - dependency-name: Swatinem/rust-cache dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * use `WasmExecutionMethod::default()` (#2622) * Use default for test relay runtimes (#2616) * Companion for substrate#14188 (Add genesis config to Glutton pallet) (#2612) * sudo + genesis for glutton * ".git/.scripts/commands/fmt/fmt.sh" * add AdminOrigin to glutton * ".git/.scripts/commands/fmt/fmt.sh" * update Cargo.lock --------- Co-authored-by: command-bot <> * Bump casey from 0.3.3 to 0.4.0 (#2619) Bumps [casey](https://github.com/jordy25519/casey) from 0.3.3 to 0.4.0. - [Release notes](https://github.com/jordy25519/casey/releases) - [Changelog](https://github.com/jordy25519/casey/blob/master/CHANGELOG.md) - [Commits](https://github.com/jordy25519/casey/compare/0.3.3...0.4.0) --- updated-dependencies: - dependency-name: casey dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add Foreign Assets to Statemint (#2540) * add foreign assets to statemint * make review changes * two dots --------- Co-authored-by: parity-processbot <> * Change SA for Rococo/Statemine_1000 + removed `CheckedExtrinsic` (#2627) * Companion for #14178: Update cargo.lock to point to substrate (#2623) * Update cargo.lock to point to substrate PR Signed-off-by: Alexandru Vasile * Update sc-executor-wasmtime after diener patch Signed-off-by: Alexandru Vasile * Update cargo.lock Signed-off-by: Alexandru Vasile --------- Signed-off-by: Alexandru Vasile * Updated README.md for bridges (#2629) * Updated README.md * Update BRIDGES.md Co-authored-by: Squirrel --------- Co-authored-by: Squirrel * add statemine emulator tests (#2630) * fix typo * statemine tests * fix statemine tests * cargo fmt, update readme * Bump criterion from 0.4.0 to 0.5.0 (#2628) Bumps [criterion](https://github.com/bheisler/criterion.rs) from 0.4.0 to 0.5.0. - [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/bheisler/criterion.rs/compare/0.4.0...0.5.0) --- updated-dependencies: - dependency-name: criterion dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update & revamp e2e tests (#2614) * update & revamp e2e tests * add seeds as comments * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: command-bot <> * Bump clap from 4.2.7 to 4.3.0 (#2634) Bumps [clap](https://github.com/clap-rs/clap) from 4.2.7 to 4.3.0. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.2.7...clap_complete-v4.3.0) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Companion for: Substrate#13869 (#2631) * Companion for: Substrate#13869 https://github.com/paritytech/substrate/pull/13869 * Fix * Warning * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * fix typo (#2635) * Fix target * Fixed AssetTrapped issue * bump zombienet version (#2637) * bump substrate version (#2640) * Companion for polkadot#7234 (XCM: Tools for uniquely referencing messages) (#2601) * Fixes for new API * Formatting * Fixes * Fixes * Further fixes * XCMP dispatch events mention message ID * XCMP event includes ID * Add DMP message ID functionality * Integrate into test parachains * Remove WithUniqueTopic usage * Use new primitive * Formatting * undiener * Revert lock * Fixes * Fixes * Fixes * Fixes * Formatting * message_hash becomes message_id * Rename * Another Rename * Fixes * Fix * Bump * Fixes * Grumble. * Companion for Polkadot 7253 (#2621) * Companion for Polkadot #7253 Polkadot PR: https://github.com/paritytech/polkadot/pull/7253 * Update Cargo.lock * Update Cargo.lock * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * pallets: implement `Default` for `GenesisConfig` in `no_std` (#2624) * pallets: implement Default for GenesisConfig in no_std This change is follow-up of: https://github.com/paritytech/substrate/pull/14108 It is a step towards: https://github.com/paritytech/substrate/issues/13334 * ".git/.scripts/commands/fmt/fmt.sh" * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: command-bot <> * polkompanion 6667: past session slashing (#2160) * polkompanion 6667: past session slashing * fix imports * fix incorrect merge * implement staging methods on RPC client * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> * Fix xcm `SetTopic` vs message_hash vs message_id stuff * Sovereign account as target destination instead of bridge-hub * Bump quote from 1.0.27 to 1.0.28 (#2646) Bumps [quote](https://github.com/dtolnay/quote) from 1.0.27 to 1.0.28. - [Release notes](https://github.com/dtolnay/quote/releases) - [Commits](https://github.com/dtolnay/quote/compare/1.0.27...1.0.28) --- updated-dependencies: - dependency-name: quote dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump proc-macro2 from 1.0.58 to 1.0.59 (#2647) Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.58 to 1.0.59. - [Release notes](https://github.com/dtolnay/proc-macro2/releases) - [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.58...1.0.59) --- updated-dependencies: - dependency-name: proc-macro2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump criterion from 0.5.0 to 0.5.1 (#2645) Bumps [criterion](https://github.com/bheisler/criterion.rs) from 0.5.0 to 0.5.1. - [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/bheisler/criterion.rs/compare/0.5.0...0.5.1) --- updated-dependencies: - dependency-name: criterion dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump peaceiris/actions-gh-pages from 3.9.0 to 3.9.3 (#2412) Bumps [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages) from 3.9.0 to 3.9.3. - [Release notes](https://github.com/peaceiris/actions-gh-pages/releases) - [Changelog](https://github.com/peaceiris/actions-gh-pages/blob/main/CHANGELOG.md) - [Commits](https://github.com/peaceiris/actions-gh-pages/compare/de7ea6f8efb354206b205ef54722213d99067935...373f7f263a76c20808c831209c920827a82a2847) --- updated-dependencies: - dependency-name: peaceiris/actions-gh-pages dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump bumpalo from 3.8.0 to 3.12.0 (#2120) Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.8.0 to 3.12.0. - [Release notes](https://github.com/fitzgen/bumpalo/releases) - [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md) - [Commits](https://github.com/fitzgen/bumpalo/compare/3.8.0...3.12.0) --- updated-dependencies: - dependency-name: bumpalo dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: parity-processbot <> * Glutton script chain spec generator (#2638) * added script * create_glutton_spec script done * made script for many paras * comment fix * comment fix Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * update docs * check jq installed --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Companion for #14237: Use latest sp-crates (#2643) * Update cargo.lock Signed-off-by: Alexandru Vasile * Update cargo.lock Signed-off-by: Alexandru Vasile * Update cargo.lock Signed-off-by: Alexandru Vasile --------- Signed-off-by: Alexandru Vasile * Bump ruby/setup-ruby from 1.149.0 to 1.150.0 (#2618) Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.149.0 to 1.150.0. - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Commits](https://github.com/ruby/setup-ruby/compare/7d546f4868fb108ed378764d873683f920672ae2...8a45918450651f5e4784b6031db26f4b9f76b251) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add Ability to Add/Remove Invulnerable Collators (#2596) * add add and remove invulnerable dispatchables * add migration * fix benchmarking code * add weights * add migration to runtimes * clippy * pass SafeCallFilter * make try-runtime work * typos Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> * better insert and added test * fix try-runtime update * Apply suggestions from code review Co-authored-by: Bastian Köcher * Update pallets/collator-selection/src/migration.rs * check events in test * Update pallets/collator-selection/src/migration.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * just dispatchresult * only sp_std for try-runtime --------- Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> Co-authored-by: Bastian Köcher Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Allow both sides * ".git/.scripts/commands/bench/bench.sh" xcm statemine assets pallet_xcm_benchmarks::generic * ".git/.scripts/commands/bench/bench.sh" xcm westmint assets pallet_xcm_benchmarks::generic * ".git/.scripts/commands/bench/bench.sh" pallet statemine assets pallet_bridge_transfer * ".git/.scripts/commands/bench/bench.sh" pallet westmint assets pallet_bridge_transfer * undo bad automerge * update cargo lock * update cargo lock * add safe call filter * remove extra clone --------- Signed-off-by: dependabot[bot] Signed-off-by: Oliver Tale-Yazdi Signed-off-by: Alexandru Vasile Signed-off-by: Adrian Catangiu Signed-off-by: acatangiu Co-authored-by: parity-processbot <> Co-authored-by: muharem Co-authored-by: Branislav Kontur Co-authored-by: Svyatoslav Nikolsky Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sebastian Kunert Co-authored-by: Bastian Köcher Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com> Co-authored-by: Javier Viola Co-authored-by: PG Herveou Co-authored-by: tmpolaczyk <44604217+tmpolaczyk@users.noreply.github.com> Co-authored-by: William Freudenberger Co-authored-by: Bastian Köcher Co-authored-by: Egor_P Co-authored-by: Paritytech CI <52199148+paritytech-ci@users.noreply.github.com> Co-authored-by: paritytech-ci Co-authored-by: Giles Cope Co-authored-by: Oliver Tale-Yazdi Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Co-authored-by: Mira Ressel Co-authored-by: Sergejs Kostjucenko Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: Davide Galassi Co-authored-by: Serban Iorga Co-authored-by: Marcin S Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Co-authored-by: Sergejs Kostjucenko <85877331+sergejparity@users.noreply.github.com> Co-authored-by: Sasha Gryaznov Co-authored-by: Pierre Besson Co-authored-by: Keith Yeung Co-authored-by: juangirini Co-authored-by: Anthony Lazam Co-authored-by: Serban Iorga Co-authored-by: girazoki Co-authored-by: acatangiu Co-authored-by: Niklas Adolfsson Co-authored-by: Arkadiy Paronyan Co-authored-by: Artyom Bakhtin Co-authored-by: alvicsam Co-authored-by: Chevdor Co-authored-by: Bulat Saifullin Co-authored-by: Doordashcon Co-authored-by: Falco Hirschenberger Co-authored-by: Falco Hirschenberger Co-authored-by: Anton Co-authored-by: asynchronous rob Co-authored-by: yjh Co-authored-by: Tsvetomir Dimitrov Co-authored-by: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Co-authored-by: NachoPal Co-authored-by: Joakim Nyman Co-authored-by: Roman Useinov Co-authored-by: S E R A Y A Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> Co-authored-by: Koute Co-authored-by: Gavin Wood Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Co-authored-by: ordian Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- .cargo/config.toml | 32 + .github/workflows/docs.yml | 4 +- .github/workflows/release-30_create-draft.yml | 4 +- .gitignore | 1 - .gitlab-ci.yml | 2 +- BRIDGES.md | 11 +- Cargo.lock | 1995 ++++++++++------- Cargo.toml | 6 + README.md | 10 +- bridges/README.md | 2 +- bridges/bin/runtime-common/Cargo.toml | 8 +- bridges/bin/runtime-common/src/lib.rs | 2 +- bridges/bin/runtime-common/src/messages.rs | 220 +- .../runtime-common/src/messages_call_ext.rs | 2 +- .../runtime-common/src/messages_generation.rs | 8 +- bridges/bin/runtime-common/src/mock.rs | 2 +- .../src/refund_relayer_extension.rs | 19 +- bridges/modules/grandpa/Cargo.toml | 2 +- bridges/modules/grandpa/src/lib.rs | 20 +- bridges/modules/messages/Cargo.toml | 2 +- bridges/modules/messages/src/benchmarking.rs | 9 +- bridges/modules/messages/src/inbound_lane.rs | 45 +- bridges/modules/messages/src/lib.rs | 212 +- bridges/modules/messages/src/mock.rs | 29 +- bridges/modules/messages/src/outbound_lane.rs | 156 +- bridges/modules/parachains/Cargo.toml | 2 +- bridges/modules/parachains/src/lib.rs | 317 ++- bridges/modules/parachains/src/mock.rs | 7 +- bridges/modules/relayers/Cargo.toml | 2 +- bridges/modules/relayers/src/mock.rs | 2 +- .../chain-bridge-hub-kusama/src/lib.rs | 2 - .../chain-bridge-hub-polkadot/src/lib.rs | 3 - bridges/primitives/chain-kusama/src/lib.rs | 7 + bridges/primitives/chain-polkadot/src/lib.rs | 7 + .../header-chain/src/justification.rs | 21 +- bridges/primitives/header-chain/src/lib.rs | 12 +- bridges/primitives/messages/Cargo.toml | 2 + bridges/primitives/messages/src/lib.rs | 108 +- .../primitives/messages/src/source_chain.rs | 30 +- .../primitives/messages/src/target_chain.rs | 16 +- .../polkadot-core/src/parachains.rs | 4 +- bridges/primitives/runtime/src/chain.rs | 8 + bridges/primitives/runtime/src/lib.rs | 20 +- bridges/primitives/test-utils/Cargo.toml | 9 +- bridges/primitives/test-utils/src/lib.rs | 41 + bridges/scripts/verify-pallets-build.sh | 1 + client/cli/Cargo.toml | 2 +- client/cli/src/lib.rs | 34 +- client/collator/Cargo.toml | 4 +- client/collator/src/lib.rs | 377 ++-- client/collator/src/service.rs | 318 +++ client/consensus/aura/Cargo.toml | 11 + client/consensus/aura/src/import_queue.rs | 4 +- client/consensus/aura/src/lib.rs | 2 + client/consensus/aura/src/unstable_reimpl.rs | 529 +++++ client/consensus/common/Cargo.toml | 2 + client/consensus/common/src/import_queue.rs | 77 + client/consensus/common/src/level_monitor.rs | 2 +- client/consensus/common/src/lib.rs | 2 + .../common/src/parachain_consensus.rs | 10 +- client/consensus/common/src/tests.rs | 10 +- client/consensus/proposer/Cargo.toml | 20 + client/consensus/proposer/src/lib.rs | 137 ++ client/consensus/relay-chain/src/lib.rs | 4 +- client/network/Cargo.toml | 2 +- client/network/src/lib.rs | 21 +- client/network/src/tests.rs | 6 +- client/pov-recovery/Cargo.toml | 2 +- client/pov-recovery/src/lib.rs | 8 +- .../src/lib.rs | 6 +- client/relay-chain-interface/Cargo.toml | 2 +- client/relay-chain-minimal-node/Cargo.toml | 4 +- .../src/blockchain_rpc_client.rs | 37 +- .../src/collator_overseer.rs | 4 +- client/relay-chain-minimal-node/src/lib.rs | 34 +- .../relay-chain-minimal-node/src/network.rs | 5 +- client/relay-chain-rpc-interface/Cargo.toml | 6 +- .../src/rpc_client.rs | 55 +- client/service/src/lib.rs | 5 +- pallets/aura-ext/Cargo.toml | 2 +- pallets/collator-selection/Cargo.toml | 6 +- .../collator-selection/src/benchmarking.rs | 54 +- pallets/collator-selection/src/lib.rs | 128 +- pallets/collator-selection/src/migration.rs | 91 + pallets/collator-selection/src/mock.rs | 14 +- pallets/collator-selection/src/tests.rs | 153 +- pallets/collator-selection/src/weights.rs | 162 +- pallets/dmp-queue/Cargo.toml | 2 +- pallets/dmp-queue/src/lib.rs | 196 +- pallets/dmp-queue/src/migration.rs | 2 +- pallets/parachain-system/Cargo.toml | 2 +- .../parachain-system/proc-macro/Cargo.toml | 4 +- pallets/parachain-system/src/lib.rs | 61 +- .../src/relay_state_snapshot.rs | 54 +- pallets/parachain-system/src/tests.rs | 40 +- .../src/validate_block/tests.rs | 10 +- pallets/session-benchmarking/Cargo.toml | 2 +- pallets/solo-to-para/Cargo.toml | 2 +- pallets/xcm/Cargo.toml | 2 +- pallets/xcmp-queue/Cargo.toml | 2 +- pallets/xcmp-queue/src/lib.rs | 46 +- pallets/xcmp-queue/src/migration.rs | 2 +- pallets/xcmp-queue/src/mock.rs | 4 +- pallets/xcmp-queue/src/tests.rs | 12 +- pallets/xcmp-queue/src/weights.rs | 24 +- parachain-template/node/Cargo.toml | 4 +- parachain-template/node/src/cli.rs | 8 +- parachain-template/node/src/command.rs | 28 +- parachain-template/node/src/service.rs | 2 + .../pallets/template/Cargo.toml | 2 +- .../pallets/template/src/benchmarking.rs | 2 +- .../pallets/template/src/mock.rs | 5 +- parachain-template/runtime/Cargo.toml | 10 +- parachain-template/runtime/src/lib.rs | 12 +- parachain-template/runtime/src/xcm_config.rs | 122 +- parachains/chain-specs/bridge-hub-kusama.json | 4 +- .../chain-specs/bridge-hub-polkadot.json | 4 +- .../chain-specs/bridge-hub-westend.json | 4 +- .../chain-specs/collectives-polkadot.json | 4 +- .../chain-specs/collectives-westend.json | 4 +- parachains/chain-specs/contracts-rococo.json | 15 +- parachains/chain-specs/statemine.json | 6 +- parachains/chain-specs/statemint.json | 6 +- parachains/chain-specs/westmint.json | 14 +- parachains/common/Cargo.toml | 2 +- parachains/common/src/impls.rs | 7 +- parachains/common/src/xcm_config.rs | 78 +- .../collectives/0_xcm/2_reserve.yml | 84 - .../assets/statemine/0_xcm}/0_init.yml | 63 +- .../assets/statemine/0_xcm}/1_dmp.yml | 100 +- .../assets/statemine/0_xcm}/2_ump.yml | 92 +- .../0_xcm/3_force_hrmp-open-channels.yml | 122 + .../e2e/assets/statemine/0_xcm/4_hrmp.yml | 390 ++++ .../e2e/assets/statemine/config.toml | 71 + .../assets/statemint/0_xcm}/0_init.yml | 69 +- .../assets/statemint/0_xcm}/1_dmp.yml | 99 +- .../assets/statemint/0_xcm}/2_ump.yml | 95 +- .../0_xcm/3_force_hrmp-open-channels.yml | 120 + .../e2e/assets/statemint/0_xcm/4_hrmp.yml | 390 ++++ .../e2e/assets/statemint/config.toml | 72 + .../collectives-polkadot}/0_xcm/0_init.yml | 57 +- .../0_xcm/1_teleport.yml | 83 +- .../collectives-polkadot/0_xcm/2_reserve.yml | 53 + .../1_alliance/0_join_alliance_fails.yml | 17 +- .../1_alliance/1_init_alliance.yml | 175 +- .../1_alliance/2_join_alliance_fails.yml | 18 +- .../1_alliance/3_kick_member.yml | 85 +- .../collectives-polkadot}/config.toml | 11 +- .../emulated/assets/statemine/Cargo.toml | 36 + .../emulated/assets/statemine/src/lib.rs | 30 + .../assets/statemine/src/tests/mod.rs | 3 + .../statemine/src/tests/reserve_transfer.rs | 63 + .../assets/statemine/src/tests/teleport.rs | 62 + .../assets/statemine/src/tests/transact.rs | 58 + .../emulated/assets/statemint/Cargo.toml | 36 + .../emulated/assets/statemint/src/lib.rs | 33 + .../assets/statemint/src/tests/mod.rs | 3 + .../statemint/src/tests/reserve_transfer.rs | 63 + .../assets/statemint/src/tests/teleport.rs | 60 + .../assets/statemint/src/tests/transact.rs | 58 + .../emulated/common/Cargo.toml | 54 + .../emulated/common/src/constants.rs | 641 ++++++ .../emulated/common/src/lib.rs | 255 +++ .../integration-tests/statemine/config.toml | 49 - .../statemine/xcm/3_hrmp-open-channels.yml | 408 ---- .../statemine/xcm/4_hrmp.yml | 356 --- .../integration-tests/statemint/config.toml | 49 - .../statemint/xcm/3_hrmp-open-channels.yml | 402 ---- .../statemint/xcm/4_hrmp.yml | 356 --- .../bridge-transfer/src/benchmarking.rs | 6 +- parachains/pallets/bridge-transfer/src/lib.rs | 164 +- parachains/pallets/parachain-info/Cargo.toml | 2 +- parachains/pallets/parachain-info/src/lib.rs | 3 +- parachains/pallets/ping/Cargo.toml | 2 +- parachains/runtimes/assets/common/Cargo.toml | 2 +- .../assets/common/src/foreign_creators.rs | 4 +- parachains/runtimes/assets/common/src/lib.rs | 1 - .../assets/common/src/location_conversion.rs | 152 -- .../runtimes/assets/common/src/matching.rs | 17 +- .../runtimes/assets/statemine/Cargo.toml | 3 +- .../runtimes/assets/statemine/src/lib.rs | 35 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 13 +- .../statemine/src/weights/frame_system.rs | 52 +- .../statemine/src/weights/pallet_assets.rs | 69 + .../statemine/src/weights/pallet_balances.rs | 52 +- .../src/weights/pallet_bridge_transfer.rs | 119 +- .../src/weights/pallet_collator_selection.rs | 98 +- .../statemine/src/weights/pallet_multisig.rs | 75 +- .../statemine/src/weights/pallet_nfts.rs | 317 ++- .../statemine/src/weights/pallet_proxy.rs | 117 +- .../statemine/src/weights/pallet_session.rs | 21 +- .../statemine/src/weights/pallet_timestamp.rs | 17 +- .../statemine/src/weights/pallet_uniques.rs | 201 +- .../statemine/src/weights/pallet_utility.rs | 37 +- .../statemine/src/weights/pallet_xcm.rs | 87 +- .../assets/statemine/src/weights/xcm/mod.rs | 11 +- .../xcm/pallet_xcm_benchmarks_fungible.rs | 36 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 197 +- .../assets/statemine/src/xcm_config.rs | 397 ++-- .../runtimes/assets/statemine/tests/tests.rs | 192 +- .../runtimes/assets/statemint/Cargo.toml | 8 +- .../runtimes/assets/statemint/src/lib.rs | 172 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 13 +- .../statemint/src/weights/frame_system.rs | 50 +- .../assets/statemint/src/weights/mod.rs | 1 + .../statemint/src/weights/pallet_assets.rs | 288 ++- .../statemint/src/weights/pallet_balances.rs | 52 +- .../src/weights/pallet_collator_selection.rs | 98 +- .../statemint/src/weights/pallet_multisig.rs | 75 +- .../statemint/src/weights/pallet_nfts.rs | 763 +++++++ .../statemint/src/weights/pallet_proxy.rs | 117 +- .../statemint/src/weights/pallet_session.rs | 21 +- .../statemint/src/weights/pallet_timestamp.rs | 17 +- .../statemint/src/weights/pallet_uniques.rs | 203 +- .../statemint/src/weights/pallet_utility.rs | 37 +- .../statemint/src/weights/pallet_xcm.rs | 87 +- .../assets/statemint/src/weights/xcm/mod.rs | 9 +- .../xcm/pallet_xcm_benchmarks_fungible.rs | 36 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 130 +- .../assets/statemint/src/xcm_config.rs | 300 ++- .../runtimes/assets/statemint/tests/tests.rs | 180 +- .../runtimes/assets/test-utils/Cargo.toml | 4 + .../runtimes/assets/test-utils/src/lib.rs | 449 +--- .../assets/test-utils/src/test_cases.rs | 395 ++-- .../runtimes/assets/westmint/Cargo.toml | 7 +- .../runtimes/assets/westmint/src/lib.rs | 85 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 13 +- .../westmint/src/weights/frame_system.rs | 52 +- .../assets/westmint/src/weights/mod.rs | 1 + .../westmint/src/weights/pallet_assets.rs | 69 + .../westmint/src/weights/pallet_balances.rs | 52 +- .../src/weights/pallet_bridge_transfer.rs | 107 +- .../src/weights/pallet_collator_selection.rs | 98 +- .../westmint/src/weights/pallet_multisig.rs | 75 +- .../weights/pallet_nft_fractionalization.rs | 63 + .../westmint/src/weights/pallet_nfts.rs | 313 +-- .../westmint/src/weights/pallet_proxy.rs | 117 +- .../westmint/src/weights/pallet_session.rs | 21 +- .../westmint/src/weights/pallet_timestamp.rs | 17 +- .../westmint/src/weights/pallet_uniques.rs | 201 +- .../westmint/src/weights/pallet_utility.rs | 37 +- .../assets/westmint/src/weights/pallet_xcm.rs | 91 +- .../assets/westmint/src/weights/xcm/mod.rs | 9 +- .../xcm/pallet_xcm_benchmarks_fungible.rs | 36 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 207 +- .../assets/westmint/src/xcm_config.rs | 461 ++-- .../runtimes/assets/westmint/tests/tests.rs | 187 +- parachains/runtimes/bridge-hubs/README.md | 39 +- .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 4 +- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 16 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 15 +- .../src/weights/frame_system.rs | 50 +- .../src/weights/pallet_balances.rs | 54 +- .../src/weights/pallet_collator_selection.rs | 100 +- .../src/weights/pallet_multisig.rs | 77 +- .../src/weights/pallet_session.rs | 23 +- .../src/weights/pallet_timestamp.rs | 19 +- .../src/weights/pallet_utility.rs | 39 +- .../src/weights/pallet_xcm.rs | 85 +- .../bridge-hub-kusama/src/weights/xcm/mod.rs | 9 +- .../xcm/pallet_xcm_benchmarks_fungible.rs | 38 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 132 +- .../bridge-hub-kusama/src/xcm_config.rs | 108 +- .../bridge-hub-polkadot/Cargo.toml | 4 +- .../bridge-hub-polkadot/src/lib.rs | 16 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 15 +- .../src/weights/frame_system.rs | 50 +- .../src/weights/pallet_balances.rs | 54 +- .../src/weights/pallet_collator_selection.rs | 100 +- .../src/weights/pallet_multisig.rs | 77 +- .../src/weights/pallet_session.rs | 23 +- .../src/weights/pallet_timestamp.rs | 19 +- .../src/weights/pallet_utility.rs | 39 +- .../src/weights/pallet_xcm.rs | 85 +- .../src/weights/xcm/mod.rs | 11 +- .../xcm/pallet_xcm_benchmarks_fungible.rs | 38 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 132 +- .../bridge-hub-polkadot/src/xcm_config.rs | 62 +- .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 6 +- .../src/bridge_hub_rococo_config.rs | 6 +- .../src/bridge_hub_wococo_config.rs | 6 +- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 19 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 15 +- .../src/weights/frame_system.rs | 50 +- .../bridge-hub-rococo/src/weights/mod.rs | 4 +- .../src/weights/pallet_balances.rs | 54 +- .../src/weights/pallet_collator_selection.rs | 100 +- .../src/weights/pallet_multisig.rs | 77 +- .../src/weights/pallet_session.rs | 23 +- .../src/weights/pallet_timestamp.rs | 19 +- .../src/weights/pallet_utility.rs | 39 +- .../src/weights/pallet_xcm.rs | 85 +- .../bridge-hub-rococo/src/weights/xcm/mod.rs | 9 +- .../xcm/pallet_xcm_benchmarks_fungible.rs | 38 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 138 +- .../bridge-hub-rococo/src/xcm_config.rs | 160 +- .../bridge-hub-rococo/tests/tests.rs | 529 +++-- .../bridge-hubs/test-utils/Cargo.toml | 28 +- .../bridge-hubs/test-utils/src/lib.rs | 8 +- .../bridge-hubs/test-utils/src/test_cases.rs | 819 +++++-- .../collectives-polkadot/Cargo.toml | 2 +- .../src/fellowship/migration.rs | 28 +- .../src/fellowship/tracks.rs | 30 +- .../collectives-polkadot/src/impls.rs | 9 +- .../collectives-polkadot/src/lib.rs | 19 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 27 +- .../src/weights/frame_system.rs | 56 +- .../src/weights/pallet_alliance.rs | 269 +-- .../src/weights/pallet_balances.rs | 54 +- .../src/weights/pallet_collator_selection.rs | 100 +- .../src/weights/pallet_collective.rs | 201 +- .../src/weights/pallet_multisig.rs | 91 +- .../src/weights/pallet_preimage.rs | 105 +- .../src/weights/pallet_proxy.rs | 119 +- .../src/weights/pallet_ranked_collective.rs | 126 +- .../src/weights/pallet_referenda.rs | 323 +-- .../src/weights/pallet_scheduler.rs | 135 +- .../src/weights/pallet_session.rs | 23 +- .../src/weights/pallet_timestamp.rs | 19 +- .../src/weights/pallet_utility.rs | 39 +- .../src/weights/pallet_xcm.rs | 125 +- .../collectives-polkadot/src/xcm_config.rs | 124 +- .../contracts/contracts-rococo/Cargo.toml | 3 +- .../contracts/contracts-rococo/README.md | 10 +- .../contracts/contracts-rococo/src/lib.rs | 15 +- .../contracts-rococo/src/xcm_config.rs | 60 +- .../glutton/glutton-kusama/Cargo.toml | 88 + .../runtimes/glutton/glutton-kusama/build.rs | 9 + .../glutton/glutton-kusama/src/lib.rs | 436 ++++ .../glutton/glutton-kusama/src/weights/mod.rs | 1 + .../src/weights/pallet_glutton.rs | 175 ++ .../glutton/glutton-kusama/src/xcm_config.rs | 91 + .../runtimes/starters/seedling/Cargo.toml | 2 +- .../runtimes/starters/seedling/src/lib.rs | 5 +- parachains/runtimes/starters/shell/Cargo.toml | 2 +- parachains/runtimes/starters/shell/src/lib.rs | 4 +- parachains/runtimes/test-utils/Cargo.toml | 74 + parachains/runtimes/test-utils/src/lib.rs | 480 ++++ parachains/runtimes/testing/penpal/Cargo.toml | 3 +- parachains/runtimes/testing/penpal/src/lib.rs | 17 +- .../runtimes/testing/penpal/src/xcm_config.rs | 77 +- .../testing/rococo-parachain/Cargo.toml | 2 +- .../testing/rococo-parachain/src/lib.rs | 25 +- polkadot-parachain/Cargo.toml | 11 +- .../src/chain_spec/bridge_hubs.rs | 2 +- polkadot-parachain/src/chain_spec/glutton.rs | 99 + polkadot-parachain/src/chain_spec/mod.rs | 1 + polkadot-parachain/src/cli.rs | 8 +- polkadot-parachain/src/command.rs | 104 +- polkadot-parachain/src/rpc.rs | 2 +- polkadot-parachain/src/service.rs | 27 +- .../tests/benchmark_storage_works.rs | 4 +- polkadot-parachain/tests/common.rs | 10 +- polkadot-parachain/tests/purge_chain_works.rs | 2 +- primitives/core/Cargo.toml | 2 +- primitives/core/src/lib.rs | 90 +- primitives/parachain-inherent/Cargo.toml | 2 +- .../parachain-inherent/src/client_side.rs | 29 +- primitives/parachain-inherent/src/mock.rs | 4 +- primitives/timestamp/src/lib.rs | 4 +- primitives/utility/src/lib.rs | 49 +- scripts/benchmarks-ci.sh | 4 + scripts/benchmarks.sh | 2 + scripts/bridges_rococo_wococo.sh | 56 +- scripts/ci/gitlab/pipeline/test.yml | 8 + scripts/ci/gitlab/pipeline/zombienet.yml | 2 +- scripts/create_glutton_spec.sh | 86 + scripts/generate_hex_encoded_call/index.js | 18 +- scripts/scale_encode_genesis/index.js | 6 +- test/client/src/block_builder.rs | 6 +- test/client/src/lib.rs | 3 +- test/relay-sproof-builder/src/lib.rs | 13 +- .../Cargo.toml | 4 +- .../relay-validation-worker-provider/build.rs | 2 +- .../src/lib.rs | 2 +- test/runtime/Cargo.toml | 2 +- test/runtime/src/lib.rs | 3 +- test/service/Cargo.toml | 8 +- .../service/benches/transaction_throughput.rs | 22 +- test/service/src/chain_spec.rs | 3 +- test/service/src/cli.rs | 30 +- test/service/src/lib.rs | 40 +- xcm/xcm-emulator/Cargo.toml | 38 + xcm/xcm-emulator/README.md | 23 + xcm/xcm-emulator/src/lib.rs | 957 ++++++++ .../bridge_hub_rococo_local_network.toml | 4 +- .../bridge_hub_wococo_local_network.toml | 4 +- zombienet/tests/register-para.js | 13 +- 388 files changed, 18674 insertions(+), 10753 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 client/collator/src/service.rs create mode 100644 client/consensus/aura/src/unstable_reimpl.rs create mode 100644 client/consensus/common/src/import_queue.rs create mode 100644 client/consensus/proposer/Cargo.toml create mode 100644 client/consensus/proposer/src/lib.rs create mode 100644 pallets/collator-selection/src/migration.rs delete mode 100644 parachains/integration-tests/collectives/0_xcm/2_reserve.yml rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemine/0_xcm}/0_init.yml (67%) rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemine/0_xcm}/1_dmp.yml (72%) rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemine/0_xcm}/2_ump.yml (65%) create mode 100644 parachains/integration-tests/e2e/assets/statemine/0_xcm/3_force_hrmp-open-channels.yml create mode 100644 parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml create mode 100644 parachains/integration-tests/e2e/assets/statemine/config.toml rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemint/0_xcm}/0_init.yml (66%) rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemint/0_xcm}/1_dmp.yml (72%) rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemint/0_xcm}/2_ump.yml (65%) create mode 100644 parachains/integration-tests/e2e/assets/statemint/0_xcm/3_force_hrmp-open-channels.yml create mode 100644 parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml create mode 100644 parachains/integration-tests/e2e/assets/statemint/config.toml rename parachains/integration-tests/{collectives => e2e/collectives/collectives-polkadot}/0_xcm/0_init.yml (60%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives-polkadot}/0_xcm/1_teleport.yml (69%) create mode 100644 parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml rename parachains/integration-tests/{collectives => e2e/collectives/collectives-polkadot}/1_alliance/0_join_alliance_fails.yml (53%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives-polkadot}/1_alliance/1_init_alliance.yml (55%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives-polkadot}/1_alliance/2_join_alliance_fails.yml (53%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives-polkadot}/1_alliance/3_kick_member.yml (67%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives-polkadot}/config.toml (74%) create mode 100644 parachains/integration-tests/emulated/assets/statemine/Cargo.toml create mode 100644 parachains/integration-tests/emulated/assets/statemine/src/lib.rs create mode 100644 parachains/integration-tests/emulated/assets/statemine/src/tests/mod.rs create mode 100644 parachains/integration-tests/emulated/assets/statemine/src/tests/reserve_transfer.rs create mode 100644 parachains/integration-tests/emulated/assets/statemine/src/tests/teleport.rs create mode 100644 parachains/integration-tests/emulated/assets/statemine/src/tests/transact.rs create mode 100644 parachains/integration-tests/emulated/assets/statemint/Cargo.toml create mode 100644 parachains/integration-tests/emulated/assets/statemint/src/lib.rs create mode 100644 parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs create mode 100644 parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs create mode 100644 parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs create mode 100644 parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs create mode 100644 parachains/integration-tests/emulated/common/Cargo.toml create mode 100644 parachains/integration-tests/emulated/common/src/constants.rs create mode 100644 parachains/integration-tests/emulated/common/src/lib.rs delete mode 100644 parachains/integration-tests/statemine/config.toml delete mode 100644 parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml delete mode 100644 parachains/integration-tests/statemine/xcm/4_hrmp.yml delete mode 100644 parachains/integration-tests/statemint/config.toml delete mode 100644 parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml delete mode 100644 parachains/integration-tests/statemint/xcm/4_hrmp.yml delete mode 100644 parachains/runtimes/assets/common/src/location_conversion.rs create mode 100644 parachains/runtimes/assets/statemint/src/weights/pallet_nfts.rs create mode 100644 parachains/runtimes/assets/westmint/src/weights/pallet_nft_fractionalization.rs create mode 100644 parachains/runtimes/glutton/glutton-kusama/Cargo.toml create mode 100644 parachains/runtimes/glutton/glutton-kusama/build.rs create mode 100644 parachains/runtimes/glutton/glutton-kusama/src/lib.rs create mode 100644 parachains/runtimes/glutton/glutton-kusama/src/weights/mod.rs create mode 100644 parachains/runtimes/glutton/glutton-kusama/src/weights/pallet_glutton.rs create mode 100644 parachains/runtimes/glutton/glutton-kusama/src/xcm_config.rs create mode 100644 parachains/runtimes/test-utils/Cargo.toml create mode 100644 parachains/runtimes/test-utils/src/lib.rs create mode 100644 polkadot-parachain/src/chain_spec/glutton.rs create mode 100755 scripts/create_glutton_spec.sh create mode 100644 xcm/xcm-emulator/Cargo.toml create mode 100644 xcm/xcm-emulator/README.md create mode 100644 xcm/xcm-emulator/src/lib.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000000..66b28b3485d --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,32 @@ +# +# An auto defined `clippy` feature was introduced, +# but it was found to clash with user defined features, +# so was renamed to `cargo-clippy`. +# +# If you want standard clippy run: +# RUSTFLAGS= cargo clippy +[target.'cfg(feature = "cargo-clippy")'] +rustflags = [ + "-Aclippy::all", + "-Dclippy::correctness", + "-Aclippy::if-same-then-else", + "-Aclippy::clone-double-ref", + "-Dclippy::complexity", + "-Aclippy::zero-prefixed-literal", # 00_1000_000 + "-Aclippy::type_complexity", # raison d'etre + "-Aclippy::nonminimal-bool", # maybe + "-Aclippy::borrowed-box", # Reasonable to fix this one + "-Aclippy::too-many-arguments", # (Turning this on would lead to) + "-Aclippy::unnecessary_cast", # Types may change + "-Aclippy::identity-op", # One case where we do 0 + + "-Aclippy::useless_conversion", # Types may change + "-Aclippy::unit_arg", # styalistic. + "-Aclippy::option-map-unit-fn", # styalistic + "-Aclippy::bind_instead_of_map", # styalistic + "-Aclippy::erasing_op", # E.g. 0 * DOLLARS + "-Aclippy::eq_op", # In tests we test equality. + "-Aclippy::while_immutable_condition", # false positives + "-Aclippy::needless_option_as_deref", # false positives + "-Aclippy::derivable_impls", # false positives + "-Aclippy::stable_sort_primitive", # prefer stable sort +] diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a5ad2bd555e..c67f5bb97ad 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,7 @@ jobs: run: rustup show - name: Rust cache - uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1 + uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 - name: Build rustdocs run: SKIP_WASM_BUILD=1 cargo doc --all --no-deps @@ -32,7 +32,7 @@ jobs: run: echo "" > ./target/doc/index.html - name: Deploy documentation - uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 # v3.9.0 + uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_branch: gh-pages diff --git a/.github/workflows/release-30_create-draft.yml b/.github/workflows/release-30_create-draft.yml index a3b39806eec..c4bb546dc78 100644 --- a/.github/workflows/release-30_create-draft.yml +++ b/.github/workflows/release-30_create-draft.yml @@ -126,7 +126,7 @@ jobs: path: cumulus ref: ${{ github.event.inputs.ref2 }} - - uses: ruby/setup-ruby@d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c # v1.148.0 + - uses: ruby/setup-ruby@8a45918450651f5e4784b6031db26f4b9f76b251 # v1.150.0 with: ruby-version: 3.0.0 @@ -253,7 +253,7 @@ jobs: - name: Download artifacts uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - - uses: ruby/setup-ruby@d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c # v1.148.0 + - uses: ruby/setup-ruby@8a45918450651f5e4784b6031db26f4b9f76b251 # v1.150.0 with: ruby-version: 3.0.0 diff --git a/.gitignore b/.gitignore index 58abcc32cc5..225be857745 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,4 @@ polkadot_argument_parsing **/chains/ *.iml .env -bin **/._* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7166ace649f..7e7d2f252e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ variables: CI_IMAGE: "paritytech/ci-linux:production" DOCKER_OS: "debian:stretch" ARCH: "x86_64" - ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.43" + ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.55" BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29" BUILDAH_COMMAND: "buildah --storage-driver overlay2" diff --git a/BRIDGES.md b/BRIDGES.md index a9fff624cdc..8766de92c17 100644 --- a/BRIDGES.md +++ b/BRIDGES.md @@ -18,13 +18,16 @@ it easier to import that change back to upstream repo. # 2. How to pull latest Bridges code to the `bridges` subtree (in practice) + +The `bridges` repo has a stabilized branch `polkadot-staging` dedicated for releasing. + ``` cd # this will update new git branches from bridges repo # there could be unresolved conflicts, but dont worry, # lots of them are caused because of removed unneeded files with patch step, -./scripts/bridges_update_subtree.sh fetch +BRANCH=polkadot-staging ./scripts/bridges_update_subtree.sh fetch # so, after fetch and before solving conflicts just run patch, # this will remove unneeded files and checks if subtree modules compiles @@ -68,8 +71,8 @@ $ git remote add -f my-bridges git@github.com:tomusdrw/parity-bridges-common.git 2. To update Bridges: ``` -$ git fetch bridges master -$ git subtree pull --prefix=bridges bridges master --squash +$ git fetch bridges polkadot-staging +$ git subtree pull --prefix=bridges bridges polkadot-staging --squash ```` We use `--squash` to avoid adding individual commits and rather squashing them @@ -82,7 +85,7 @@ all into one. 4. Contributing back to Bridges (creating upstream PR) ``` -$ git subtree push --prefix=bridges my-bridges master +$ git subtree push --prefix=bridges my-bridges polkadot-staging ``` This command will push changes to your personal fork of Bridges repo, from where you can simply create a PR to the main repo. diff --git a/Cargo.lock b/Cargo.lock index b340d9d067f..1b3bfd30455 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,22 +12,13 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli 0.26.1", -] - [[package]] name = "addr2line" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.0", + "gimli", ] [[package]] @@ -245,9 +236,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.69" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "approx" @@ -272,9 +263,9 @@ checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "array-bytes" -version = "6.0.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" +checksum = "d9b1c5a481ec30a5abd8dfbd94ab5cf1bb4e9a66be7f1b3b322f2f1170c200fd" [[package]] name = "arrayref" @@ -361,19 +352,13 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "asn1_der" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" - [[package]] name = "assert_cmd" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0b2340f55d9661d76793b2bfc2eb0e62689bd79d067a95707ea762afd5e9dd" +checksum = "86d6b683edf8d1119fe420a94f8a7e389239666aa72e65495d91c00462510151" dependencies = [ - "anstyle 0.3.4", + "anstyle 1.0.0", "bstr 1.1.0", "doc-comment", "predicates 3.0.1", @@ -410,6 +395,7 @@ dependencies = [ "pallet-xcm", "parachain-info", "parachains-common", + "parachains-runtimes-test-utils", "parity-scale-codec", "polkadot-parachain", "sp-consensus-aura", @@ -419,6 +405,7 @@ dependencies = [ "sp-std", "substrate-wasm-builder", "xcm", + "xcm-builder", "xcm-executor", ] @@ -488,7 +475,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -499,7 +486,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -544,12 +531,12 @@ version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line 0.19.0", + "addr2line", "cc", "cfg-if", "libc", "miniz_oxide 0.6.2", - "object 0.30.0", + "object", "rustc-demangle", ] @@ -577,6 +564,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f1e31e207a6b8fb791a38ea3105e6cb541f55e4d029902d3039a4ad07cc4105" + [[package]] name = "base64ct" version = "1.5.2" @@ -595,7 +588,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "hash-db", "log", @@ -612,9 +605,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.64.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ "bitflags", "cexpr", @@ -622,12 +615,13 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", + "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 1.0.109", + "syn 2.0.16", ] [[package]] @@ -830,6 +824,7 @@ dependencies = [ name = "bp-messages" version = "0.1.0" dependencies = [ + "bp-header-chain", "bp-runtime", "frame-support", "hex", @@ -928,13 +923,18 @@ name = "bp-test-utils" version = "0.1.0" dependencies = [ "bp-header-chain", + "bp-parachains", + "bp-polkadot-core", + "bp-runtime", "ed25519-dalek", "finality-grandpa", "parity-scale-codec", "sp-application-crypto", "sp-consensus-grandpa", + "sp-core", "sp-runtime", "sp-std", + "sp-trie", ] [[package]] @@ -1146,6 +1146,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", @@ -1163,29 +1164,42 @@ dependencies = [ name = "bridge-hub-test-utils" version = "0.1.0" dependencies = [ + "assert_matches", "asset-test-utils", + "bp-bridge-hub-rococo", + "bp-bridge-hub-wococo", "bp-header-chain", "bp-messages", + "bp-parachains", "bp-polkadot-core", + "bp-relayers", "bp-runtime", "bp-test-utils", "bridge-runtime-common", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", + "frame-benchmarking", + "frame-executive", "frame-support", "frame-system", "log", "pallet-balances", "pallet-bridge-grandpa", "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-bridge-relayers", "pallet-collator-selection", "pallet-session", + "pallet-utility", "pallet-xcm", "pallet-xcm-benchmarks", "parachain-info", + "parachains-runtimes-test-utils", "parity-scale-codec", + "sp-core", "sp-io", + "sp-keyring", "sp-runtime", "xcm", "xcm-builder", @@ -1214,7 +1228,6 @@ dependencies = [ "pallet-bridge-relayers", "pallet-transaction-payment", "pallet-utility", - "pallet-xcm", "parity-scale-codec", "scale-info", "sp-api", @@ -1226,7 +1239,6 @@ dependencies = [ "static_assertions", "xcm", "xcm-builder", - "xcm-executor", ] [[package]] @@ -1267,9 +1279,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.8.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" @@ -1350,6 +1362,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "casey" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614586263949597dcc18675da12ef9b429135e13628d92eb8b8c6fa50ca5656b" +dependencies = [ + "syn 1.0.109", +] + [[package]] name = "cast" version = "0.3.0" @@ -1387,9 +1408,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.10.3" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9" dependencies = [ "smallvec", ] @@ -1479,7 +1500,7 @@ checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ "core2", "multibase", - "multihash", + "multihash 0.16.2", "serde", "unsigned-varint", ] @@ -1524,21 +1545,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" -dependencies = [ - "bitflags", - "clap_lex 0.2.2", - "indexmap", - "textwrap", -] - -[[package]] -name = "clap" -version = "4.2.7" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" +checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" dependencies = [ "clap_builder", "clap_derive", @@ -1547,43 +1556,34 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.2.7" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" +checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" dependencies = [ "anstream", "anstyle 1.0.0", "bitflags", - "clap_lex 0.4.1", + "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" +checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.15", -] - -[[package]] -name = "clap_lex" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613" -dependencies = [ - "os_str_bytes", + "syn 2.0.16", ] [[package]] name = "clap_lex" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "coarsetime" @@ -1731,6 +1731,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "console" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.42.0", +] + [[package]] name = "const-oid" version = "0.9.2" @@ -1879,28 +1892,27 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "cranelift-bforest" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc42ba2e232e5b20ff7dc299a812d53337dadce9a7e39a238e6a5cb82d2e57b" +checksum = "1277fbfa94bc82c8ec4af2ded3e639d49ca5f7f3c7eeab2c66accd135ece4e70" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e" +checksum = "c6e8c31ad3b2270e9aeec38723888fe1b0ace3bea2b06b3f749ccf46661d3220" dependencies = [ - "arrayvec 0.7.2", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", "cranelift-isle", - "gimli 0.26.1", - "hashbrown 0.12.3", + "gimli", + "hashbrown 0.13.2", "log", "regalloc2", "smallvec", @@ -1909,33 +1921,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f2154365e2bff1b1b8537a7181591fdff50d8e27fa6e40d5c69c3bad0ca7c8" +checksum = "c8ac5ac30d62b2d66f12651f6b606dbdfd9c2cfd0908de6b387560a277c5c9da" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "687e14e3f5775248930e0d5a84195abef8b829958e9794bf8d525104993612b4" +checksum = "dd82b8b376247834b59ed9bdc0ddeb50f517452827d4a11bccf5937b213748b8" [[package]] name = "cranelift-entity" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" +checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8483c2db6f45fe9ace984e5adc5d058102227e4c62e5aa2054e16b0275fd3a6e" +checksum = "64a25d9d0a0ae3079c463c34115ec59507b4707175454f0eee0891e83e30e82d" dependencies = [ "cranelift-codegen", "log", @@ -1945,15 +1957,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9793158837678902446c411741d87b43f57dadfb944f2440db4287cda8cbd59" +checksum = "80de6a7d0486e4acbd5f9f87ec49912bf4c8fb6aea00087b989685460d4469ba" [[package]] name = "cranelift-native" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72668c7755f2b880665cb422c8ad2d56db58a88b9bebfef0b73edc2277c13c49" +checksum = "bb6b03e0e03801c4b3fd8ce0758a94750c07a44e7944cc0ffbf0d3f2e7c79b00" dependencies = [ "cranelift-codegen", "libc", @@ -1962,9 +1974,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852ce4b088b44ac4e29459573943009a70d1b192c8d77ef949b4e814f656fc1" +checksum = "ff3220489a3d928ad91e59dd7aeaa8b3de18afb554a6211213673a71c90737ac" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -2002,20 +2014,20 @@ dependencies = [ [[package]] name = "criterion" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" dependencies = [ "anes", - "atty", "cast", "ciborium", - "clap 3.2.22", + "clap", "criterion-plot", "futures", + "is-terminal", "itertools", - "lazy_static", "num-traits", + "once_cell", "oorandom", "plotters", "rayon", @@ -2183,7 +2195,7 @@ dependencies = [ name = "cumulus-client-cli" version = "0.1.0" dependencies = [ - "clap 4.2.7", + "clap", "parity-scale-codec", "sc-chain-spec", "sc-cli", @@ -2227,10 +2239,17 @@ name = "cumulus-client-consensus-aura" version = "0.1.0" dependencies = [ "async-trait", + "cumulus-client-collator", "cumulus-client-consensus-common", + "cumulus-client-consensus-proposer", "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-relay-chain-interface", "futures", "parity-scale-codec", + "polkadot-node-primitives", + "polkadot-overseer", + "polkadot-primitives", "sc-client-api", "sc-consensus", "sc-consensus-aura", @@ -2246,6 +2265,8 @@ dependencies = [ "sp-inherents", "sp-keystore", "sp-runtime", + "sp-state-machine", + "sp-timestamp", "substrate-prometheus-endpoint", "tracing", ] @@ -2270,12 +2291,28 @@ dependencies = [ "schnellru", "sp-blockchain", "sp-consensus", + "sp-core", "sp-runtime", "sp-tracing", "sp-trie", + "substrate-prometheus-endpoint", "tracing", ] +[[package]] +name = "cumulus-client-consensus-proposer" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "cumulus-primitives-parachain-inherent", + "sp-consensus", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "thiserror", +] + [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" @@ -2470,7 +2507,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -2677,7 +2714,7 @@ dependencies = [ name = "cumulus-relay-chain-minimal-node" version = "0.1.0" dependencies = [ - "array-bytes 6.0.0", + "array-bytes 6.1.0", "async-trait", "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -2786,8 +2823,8 @@ dependencies = [ name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" dependencies = [ - "polkadot-node-core-pvf-worker", - "toml 0.7.3", + "polkadot-node-core-pvf", + "toml 0.7.4", ] [[package]] @@ -2826,7 +2863,7 @@ name = "cumulus-test-service" version = "0.1.0" dependencies = [ "async-trait", - "clap 4.2.7", + "clap", "criterion", "cumulus-client-cli", "cumulus-client-consensus-common", @@ -2920,7 +2957,7 @@ dependencies = [ "cfg-if", "fiat-crypto", "packed_simd_2", - "platforms 3.0.2", + "platforms", "subtle", "zeroize", ] @@ -3346,9 +3383,9 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" @@ -3391,6 +3428,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "enum-as-inner" version = "0.5.1" @@ -3420,18 +3463,18 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "enumn" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038b1afa59052df211f9efd58f8b1d84c242935ede1c3dbaed26b018a9e06ae2" +checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.16", ] [[package]] @@ -3600,7 +3643,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -3771,7 +3814,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", ] @@ -3794,7 +3837,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-support-procedural", @@ -3819,12 +3862,12 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "Inflector", "array-bytes 4.2.0", "chrono", - "clap 4.2.7", + "clap", "comfy-table", "frame-benchmarking", "frame-support", @@ -3866,18 +3909,18 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3894,7 +3937,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -3923,10 +3966,11 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-recursion", "futures", + "indicatif", "jsonrpsee", "log", "parity-scale-codec", @@ -3934,14 +3978,16 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", + "spinners", "substrate-rpc-client", "tokio", + "tokio-retry", ] [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "bitflags", "environmental", @@ -3960,6 +4006,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-core-hashing-proc-macro", + "sp-debug-derive", "sp-inherents", "sp-io", "sp-runtime", @@ -3974,7 +4021,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "Inflector", "cfg-expr", @@ -3984,36 +4031,37 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ + "cfg-if", "frame-support", "log", "parity-scale-codec", @@ -4030,7 +4078,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -4045,7 +4093,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "sp-api", @@ -4054,7 +4102,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "parity-scale-codec", @@ -4174,7 +4222,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -4307,21 +4355,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" dependencies = [ "fallible-iterator", "indexmap", "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" - [[package]] name = "glob" version = "0.3.0" @@ -4341,6 +4383,41 @@ dependencies = [ "regex", ] +[[package]] +name = "glutton-runtime" +version = "1.0.0" +dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcm", + "cumulus-primitives-core", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-try-runtime", + "pallet-glutton", + "pallet-sudo", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-block-builder", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", +] + [[package]] name = "group" version = "0.12.1" @@ -4759,6 +4836,18 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" +[[package]] +name = "indicatif" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef509aa9bc73864d6756f0d34d35504af3cf0844373afe9b8669a5b8005a729" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width", +] + [[package]] name = "instant" version = "0.1.12" @@ -4783,6 +4872,47 @@ dependencies = [ "num-traits", ] +[[package]] +name = "integration-tests-common" +version = "1.0.0" +dependencies = [ + "bridge-hub-kusama-runtime", + "bridge-hub-polkadot-runtime", + "collectives-polkadot-runtime", + "cumulus-primitives-core", + "frame-support", + "frame-system", + "kusama-runtime", + "kusama-runtime-constants", + "pallet-assets", + "pallet-balances", + "pallet-im-online", + "pallet-staking", + "pallet-xcm", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-runtime", + "polkadot-runtime-constants", + "polkadot-runtime-parachains", + "polkadot-service", + "sc-consensus-grandpa", + "sp-authority-discovery", + "sp-consensus-babe", + "sp-core", + "sp-runtime", + "sp-weights", + "statemine-runtime", + "statemint-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "interceptor" version = "0.8.2" @@ -4886,9 +5016,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -5059,7 +5189,7 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kusama-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "frame-benchmarking", @@ -5092,6 +5222,7 @@ dependencies = [ "pallet-im-online", "pallet-indices", "pallet-membership", + "pallet-message-queue", "pallet-multisig", "pallet-nis", "pallet-nomination-pools", @@ -5157,7 +5288,7 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-support", "polkadot-primitives", @@ -5189,9 +5320,9 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7a749456510c45f795e8b04a6a3e0976d0139213ecbf465843830ad55e2217" +checksum = "b644c70b92285f66bfc2032922a79000ea30af7bc2ab31902992a5dcb9b434f6" dependencies = [ "kvdb", "num_cpus", @@ -5243,22 +5374,24 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" [[package]] name = "libp2p" -version = "0.50.0" +version = "0.51.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0a0d2f693675f49ded13c5d510c48b78069e23cbd9108d7ccd59f6dc568819" +checksum = "f210d259724eae82005b5c48078619b7745edb7b76de370b03f8ba59ea103097" dependencies = [ "bytes", "futures", "futures-timer", "getrandom 0.2.8", "instant", + "libp2p-allow-block-list", + "libp2p-connection-limits", "libp2p-core", "libp2p-dns", "libp2p-identify", + "libp2p-identity", "libp2p-kad", "libp2p-mdns", "libp2p-metrics", - "libp2p-mplex", "libp2p-noise", "libp2p-ping", "libp2p-quic", @@ -5270,50 +5403,66 @@ dependencies = [ "libp2p-websocket", "libp2p-yamux", "multiaddr", - "parking_lot 0.12.1", "pin-project", - "smallvec", +] + +[[package]] +name = "libp2p-allow-block-list" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "510daa05efbc25184458db837f6f9a5143888f1caa742426d92e1833ddd38a50" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-connection-limits" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4caa33f1d26ed664c4fe2cca81a08c8e07d4c1c04f2f4ac7655c2dd85467fda0" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", ] [[package]] name = "libp2p-core" -version = "0.38.0" +version = "0.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" +checksum = "3c1df63c0b582aa434fb09b2d86897fa2b419ffeccf934b36f87fcedc8e835c2" dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", "either", "fnv", "futures", "futures-timer", "instant", + "libp2p-identity", "log", "multiaddr", - "multihash", + "multihash 0.17.0", "multistream-select", "once_cell", "parking_lot 0.12.1", "pin-project", - "prost", - "prost-build", + "quick-protobuf", "rand 0.8.5", "rw-stream-sink", - "sec1 0.3.0", - "sha2 0.10.2", "smallvec", "thiserror", "unsigned-varint", "void", - "zeroize", ] [[package]] name = "libp2p-dns" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e42a271c1b49f789b92f7fc87749fa79ce5c7bdc88cbdfacb818a4bca47fec5" +checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554" dependencies = [ "futures", "libp2p-core", @@ -5325,30 +5474,49 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.41.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c052d0026f4817b44869bfb6810f4e1112f43aec8553f2cb38881c524b563abf" +checksum = "5455f472243e63b9c497ff320ded0314254a9eb751799a39c283c6f20b793f3c" dependencies = [ "asynchronous-codec", + "either", "futures", "futures-timer", "libp2p-core", + "libp2p-identity", "libp2p-swarm", "log", - "lru 0.8.1", - "prost", - "prost-build", - "prost-codec", + "lru 0.10.0", + "quick-protobuf", + "quick-protobuf-codec", "smallvec", "thiserror", "void", ] +[[package]] +name = "libp2p-identity" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e2d584751cecb2aabaa56106be6be91338a60a0f4e420cf2af639204f596fc1" +dependencies = [ + "bs58", + "ed25519-dalek", + "log", + "multiaddr", + "multihash 0.17.0", + "quick-protobuf", + "rand 0.8.5", + "sha2 0.10.2", + "thiserror", + "zeroize", +] + [[package]] name = "libp2p-kad" -version = "0.42.1" +version = "0.43.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2" +checksum = "39d5ef876a2b2323d63c258e63c2f8e36f205fe5a11f0b3095d59635650790ff" dependencies = [ "arrayvec 0.7.2", "asynchronous-codec", @@ -5359,10 +5527,10 @@ dependencies = [ "futures-timer", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm", "log", - "prost", - "prost-build", + "quick-protobuf", "rand 0.8.5", "sha2 0.10.2", "smallvec", @@ -5374,14 +5542,15 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f378264aade9872d6ccd315c0accc18be3a35d15fc1b9c36e5b6f983b62b5b" +checksum = "19983e1f949f979a928f2c603de1cf180cc0dc23e4ac93a62651ccb18341460b" dependencies = [ "data-encoding", "futures", "if-watch", "libp2p-core", + "libp2p-identity", "libp2p-swarm", "log", "rand 0.8.5", @@ -5394,9 +5563,9 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad8a64f29da86005c86a4d2728b8a0719e9b192f4092b609fd8790acb9dec55" +checksum = "a42ec91e227d7d0dafa4ce88b333cdf5f277253873ab087555c92798db2ddd46" dependencies = [ "libp2p-core", "libp2p-identify", @@ -5406,38 +5575,20 @@ dependencies = [ "prometheus-client", ] -[[package]] -name = "libp2p-mplex" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03805b44107aa013e7cbbfa5627b31c36cbedfdfb00603c0311998882bc4bace" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core", - "log", - "nohash-hasher", - "parking_lot 0.12.1", - "rand 0.8.5", - "smallvec", - "unsigned-varint", -] - [[package]] name = "libp2p-noise" -version = "0.41.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a978cb57efe82e892ec6f348a536bfbd9fee677adbe5689d7a93ad3a9bffbf2e" +checksum = "9c3673da89d29936bc6435bafc638e2f184180d554ce844db65915113f86ec5e" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", "libp2p-core", + "libp2p-identity", "log", "once_cell", - "prost", - "prost-build", + "quick-protobuf", "rand 0.8.5", "sha2 0.10.2", "snow", @@ -5449,10 +5600,11 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.41.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "929fcace45a112536e22b3dcfd4db538723ef9c3cb79f672b98be2cc8e25f37f" +checksum = "3e57759c19c28a73ef1eb3585ca410cefb72c1a709fcf6de1612a378e4219202" dependencies = [ + "either", "futures", "futures-timer", "instant", @@ -5465,15 +5617,16 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.7.0-alpha" +version = "0.7.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e7c867e95c8130667b24409d236d37598270e6da69b3baf54213ba31ffca59" +checksum = "c6b26abd81cd2398382a1edfe739b539775be8a90fa6914f39b2ab49571ec735" dependencies = [ "bytes", "futures", "futures-timer", "if-watch", "libp2p-core", + "libp2p-identity", "libp2p-tls", "log", "parking_lot 0.12.1", @@ -5486,27 +5639,25 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3236168796727bfcf4927f766393415361e2c644b08bedb6a6b13d957c9a4884" +checksum = "7ffdb374267d42dc5ed5bc53f6e601d4a64ac5964779c6e40bb9e4f14c1e30d5" dependencies = [ "async-trait", - "bytes", "futures", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm", - "log", "rand 0.8.5", "smallvec", - "unsigned-varint", ] [[package]] name = "libp2p-swarm" -version = "0.41.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0" +checksum = "903b3d592d7694e56204d211f29d31bc004be99386644ba8731fc3e3ef27b296" dependencies = [ "either", "fnv", @@ -5514,21 +5665,20 @@ dependencies = [ "futures-timer", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm-derive", "log", - "pin-project", "rand 0.8.5", "smallvec", - "thiserror", "tokio", "void", ] [[package]] name = "libp2p-swarm-derive" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d527d5827582abd44a6d80c07ff8b50b4ee238a8979e05998474179e79dc400" +checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f" dependencies = [ "heck", "quote", @@ -5537,9 +5687,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b257baf6df8f2df39678b86c578961d48cc8b68642a12f0f763f56c8e5858d" +checksum = "33d33698596d7722d85d3ab0c86c2c322254fce1241e91208e3679b4eb3026cf" dependencies = [ "futures", "futures-timer", @@ -5553,13 +5703,14 @@ dependencies = [ [[package]] name = "libp2p-tls" -version = "0.1.0-alpha" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7905ce0d040576634e8a3229a7587cc8beab83f79db6023800f1792895defa8" +checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781" dependencies = [ "futures", "futures-rustls", "libp2p-core", + "libp2p-identity", "rcgen 0.10.0", "ring", "rustls 0.20.7", @@ -5571,9 +5722,9 @@ dependencies = [ [[package]] name = "libp2p-wasm-ext" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bb1a35299860e0d4b3c02a3e74e3b293ad35ae0cee8a056363b0c862d082069" +checksum = "77dff9d32353a5887adb86c8afc1de1a94d9e8c3bc6df8b2201d7cdf5c848f43" dependencies = [ "futures", "js-sys", @@ -5585,9 +5736,9 @@ dependencies = [ [[package]] name = "libp2p-webrtc" -version = "0.4.0-alpha" +version = "0.4.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb6cd86dd68cba72308ea05de1cebf3ba0ae6e187c40548167955d4e3970f6a" +checksum = "dba48592edbc2f60b4bc7c10d65445b0c3964c07df26fdf493b6880d33be36f8" dependencies = [ "async-trait", "asynchronous-codec", @@ -5597,12 +5748,12 @@ dependencies = [ "hex", "if-watch", "libp2p-core", + "libp2p-identity", "libp2p-noise", "log", - "multihash", - "prost", - "prost-build", - "prost-codec", + "multihash 0.17.0", + "quick-protobuf", + "quick-protobuf-codec", "rand 0.8.5", "rcgen 0.9.3", "serde", @@ -5616,9 +5767,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.40.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d705506030d5c0aaf2882437c70dab437605f21c5f9811978f694e6917a3b54" +checksum = "111273f7b3d3510524c752e8b7a5314b7f7a1fee7e68161c01a7d72cbb06db9f" dependencies = [ "either", "futures", @@ -5635,23 +5786,22 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f63594a0aa818642d9d4915c791945053877253f08a3626f13416b5cd928a29" +checksum = "4dcd21d950662700a385d4c6d68e2f5f54d778e97068cdd718522222ef513bda" dependencies = [ "futures", "libp2p-core", "log", - "parking_lot 0.12.1", "thiserror", "yamux", ] [[package]] name = "librocksdb-sys" -version = "0.10.0+7.9.2" +version = "0.11.0+8.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fe4d5874f5ff2bc616e55e8c6086d478fcda13faf9495768a4aa1c22042d30b" +checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" dependencies = [ "bindgen", "bzip2-sys", @@ -5669,7 +5819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" dependencies = [ "arrayref", - "base64", + "base64 0.13.0", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -5808,6 +5958,15 @@ dependencies = [ "hashbrown 0.13.2", ] +[[package]] +name = "lru" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03f1160296536f10c833a82dca22267d5486734230d47bf00bf435885814ba1e" +dependencies = [ + "hashbrown 0.13.2", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -5933,6 +6092,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + [[package]] name = "memory-db" version = "0.32.0" @@ -5942,12 +6110,6 @@ dependencies = [ "hash-db", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "merlin" version = "2.0.1" @@ -6025,7 +6187,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "log", @@ -6044,7 +6206,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "anyhow", "jsonrpsee", @@ -6086,15 +6248,16 @@ dependencies = [ [[package]] name = "multiaddr" -version = "0.16.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e" +checksum = "2b36f567c7099511fa8612bbbb52dda2419ce0bdbacf31714e3a5ffdb766d3bd" dependencies = [ "arrayref", "byteorder", "data-encoding", + "log", "multibase", - "multihash", + "multihash 0.17.0", "percent-encoding", "serde", "static_assertions", @@ -6130,6 +6293,19 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "multihash" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" +dependencies = [ + "core2", + "digest 0.10.6", + "multihash-derive", + "sha2 0.10.2", + "unsigned-varint", +] + [[package]] name = "multihash-derive" version = "0.8.0" @@ -6393,23 +6569,20 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.29.0" +name = "number_prefix" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "crc32fast", - "hashbrown 0.12.3", - "indexmap", - "memchr", -] +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.30.0" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap", "memchr", ] @@ -6433,9 +6606,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "oorandom" @@ -6502,12 +6675,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "os_str_bytes" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" - [[package]] name = "p256" version = "0.11.1" @@ -6543,7 +6710,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -6564,7 +6731,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -6582,7 +6749,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -6597,7 +6764,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -6613,7 +6780,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -6629,7 +6796,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -6643,7 +6810,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -6667,7 +6834,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6687,7 +6854,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -6702,7 +6869,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -6721,7 +6888,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -6745,7 +6912,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -6873,7 +7040,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -6917,7 +7084,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -6934,7 +7101,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "bitflags", "environmental", @@ -6957,14 +7124,14 @@ dependencies = [ "sp-runtime", "sp-std", "wasm-instrument 0.4.0", - "wasmi 0.28.0", + "wasmi", "wasmparser-nostd", ] [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "bitflags", "parity-scale-codec", @@ -6977,17 +7144,17 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7004,7 +7171,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7022,7 +7189,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7045,7 +7212,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7058,7 +7225,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7076,7 +7243,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7091,10 +7258,28 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-glutton" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" +dependencies = [ + "blake2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7117,7 +7302,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7133,7 +7318,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7153,7 +7338,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7170,7 +7355,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -7184,7 +7369,24 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-message-queue" +version = "7.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7192,16 +7394,18 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", + "sp-arithmetic", "sp-core", "sp-io", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7218,7 +7422,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7231,10 +7435,27 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-nft-fractionalization" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-assets", + "pallet-nfts", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7252,7 +7473,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "pallet-nfts", @@ -7263,7 +7484,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7279,7 +7500,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -7296,7 +7517,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7316,7 +7537,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -7327,7 +7548,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -7344,7 +7565,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7365,10 +7586,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-parachain-template" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7385,7 +7621,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7400,7 +7636,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7418,7 +7654,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7433,7 +7669,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7452,7 +7688,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7469,7 +7705,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -7490,7 +7726,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7506,7 +7742,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -7520,7 +7756,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7543,18 +7779,18 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "log", "sp-arithmetic", @@ -7563,7 +7799,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "sp-api", @@ -7572,7 +7808,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7589,36 +7825,22 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-template" -version = "0.1.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", "scale-info", - "serde", - "sp-core", "sp-io", "sp-runtime", + "sp-std", ] [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7636,7 +7858,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7655,7 +7877,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-support", "frame-system", @@ -7671,7 +7893,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7687,7 +7909,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7699,7 +7921,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7716,7 +7938,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7731,7 +7953,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7747,7 +7969,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7762,7 +7984,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-benchmarking", "frame-support", @@ -7777,7 +7999,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -7798,7 +8020,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-benchmarking", "frame-support", @@ -7829,7 +8051,7 @@ dependencies = [ name = "parachain-template-node" version = "0.1.0" dependencies = [ - "clap 4.2.7", + "clap", "color-print", "cumulus-client-cli", "cumulus-client-consensus-aura", @@ -7905,9 +8127,9 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-collator-selection", + "pallet-parachain-template", "pallet-session", "pallet-sudo", - "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -7961,6 +8183,39 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "parachains-runtimes-test-utils" +version = "1.0.0" +dependencies = [ + "assets-common", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-test-relay-sproof-builder", + "frame-support", + "frame-system", + "hex-literal 0.3.4", + "pallet-assets", + "pallet-balances", + "pallet-collator-selection", + "pallet-session", + "pallet-xcm", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-parachain", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "substrate-wasm-builder", + "xcm", + "xcm-executor", +] + [[package]] name = "parity-bytes" version = "0.1.2" @@ -7969,9 +8224,9 @@ checksum = "16b56e3a2420138bdb970f84dfb9c774aea80fa0e7371549eedec0d80c209c67" [[package]] name = "parity-db" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00bfb81cf5c90a222db2fb7b3a7cbf8cc7f38dfb6647aca4d98edf8281f56ed5" +checksum = "4890dcb9556136a4ec2b0c51fa4a08c8b733b829506af8fff2e853f3a065985b" dependencies = [ "blake2", "crc32fast", @@ -7989,9 +8244,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" +checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -8109,6 +8364,12 @@ dependencies = [ "windows-sys 0.32.0", ] +[[package]] +name = "partial_sort" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156" + [[package]] name = "paste" version = "1.0.12" @@ -8145,7 +8406,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c64931a1a212348ec4f3b4362585eca7159d0d09cbdf4a7f74f02173596fd4" dependencies = [ - "base64", + "base64 0.13.0", ] [[package]] @@ -8339,12 +8600,6 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" -[[package]] -name = "platforms" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" - [[package]] name = "platforms" version = "3.0.2" @@ -8382,7 +8637,7 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "polkadot-node-jaeger", @@ -8398,7 +8653,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -8412,7 +8667,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "derive_more", "fatality", @@ -8435,7 +8690,7 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "fatality", "futures", @@ -8456,14 +8711,15 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ - "clap 4.2.7", + "clap", "frame-benchmarking-cli", "futures", "log", "polkadot-client", - "polkadot-node-core-pvf-worker", + "polkadot-node-core-pvf-execute-worker", + "polkadot-node-core-pvf-prepare-worker", "polkadot-node-metrics", "polkadot-performance-test", "polkadot-service", @@ -8485,7 +8741,7 @@ dependencies = [ [[package]] name = "polkadot-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "frame-benchmarking", @@ -8528,7 +8784,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "always-assert", "bitvec", @@ -8550,7 +8806,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "parity-scale-codec", "scale-info", @@ -8562,7 +8818,7 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "derive_more", "fatality", @@ -8587,7 +8843,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8601,7 +8857,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "futures-timer", @@ -8621,7 +8877,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "always-assert", "async-trait", @@ -8644,7 +8900,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "parity-scale-codec", @@ -8662,7 +8918,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "derive_more", @@ -8691,7 +8947,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "futures", @@ -8712,7 +8968,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "fatality", @@ -8731,7 +8987,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8746,7 +9002,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "futures", @@ -8766,7 +9022,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "polkadot-node-metrics", @@ -8781,7 +9037,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "futures-timer", @@ -8798,7 +9054,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "fatality", "futures", @@ -8817,7 +9073,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "futures", @@ -8834,7 +9090,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "fatality", @@ -8852,7 +9108,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "always-assert", "futures", @@ -8861,6 +9117,9 @@ dependencies = [ "parity-scale-codec", "pin-project", "polkadot-core-primitives", + "polkadot-node-core-pvf-common", + "polkadot-node-core-pvf-execute-worker", + "polkadot-node-core-pvf-prepare-worker", "polkadot-node-metrics", "polkadot-node-primitives", "polkadot-parachain", @@ -8872,6 +9131,7 @@ dependencies = [ "sp-tracing", "sp-wasm-interface", "substrate-build-script-utils", + "tempfile", "tokio", "tracing-gum", ] @@ -8879,7 +9139,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "polkadot-node-primitives", @@ -8893,16 +9153,34 @@ dependencies = [ ] [[package]] -name = "polkadot-node-core-pvf-worker" +name = "polkadot-node-core-pvf-common" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ - "assert_matches", "cpu-time", "futures", "libc", "parity-scale-codec", - "polkadot-node-core-pvf", + "polkadot-parachain", + "polkadot-primitives", + "sc-executor-common", + "sc-executor-wasmtime", + "sp-core", + "sp-tracing", + "substrate-build-script-utils", + "tokio", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-pvf-execute-worker" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" +dependencies = [ + "cpu-time", + "futures", + "parity-scale-codec", + "polkadot-node-core-pvf-common", "polkadot-parachain", "polkadot-primitives", "rayon", @@ -8914,8 +9192,29 @@ dependencies = [ "sp-io", "sp-maybe-compressed-blob", "sp-tracing", - "substrate-build-script-utils", - "tempfile", + "tikv-jemalloc-ctl", + "tokio", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-pvf-prepare-worker" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" +dependencies = [ + "futures", + "libc", + "parity-scale-codec", + "polkadot-node-core-pvf-common", + "polkadot-parachain", + "polkadot-primitives", + "rayon", + "sc-executor", + "sc-executor-common", + "sc-executor-wasmtime", + "sp-io", + "sp-maybe-compressed-blob", + "sp-tracing", "tikv-jemalloc-ctl", "tokio", "tracing-gum", @@ -8924,7 +9223,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "futures", "lru 0.9.0", @@ -8939,7 +9238,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "lazy_static", "log", @@ -8957,7 +9256,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bs58", "futures", @@ -8976,8 +9275,9 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ + "async-channel", "async-trait", "derive_more", "fatality", @@ -8998,7 +9298,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bounded-vec", "futures", @@ -9020,7 +9320,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -9030,7 +9330,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "futures", @@ -9048,7 +9348,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "derive_more", @@ -9071,7 +9371,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "derive_more", @@ -9104,7 +9404,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "futures", @@ -9127,7 +9427,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bounded-collections", "derive_more", @@ -9143,14 +9443,14 @@ dependencies = [ [[package]] name = "polkadot-parachain-bin" -version = "0.9.400" +version = "0.9.420" dependencies = [ "assert_cmd", "async-trait", "bridge-hub-kusama-runtime", "bridge-hub-polkadot-runtime", "bridge-hub-rococo-runtime", - "clap 4.2.7", + "clap", "collectives-polkadot-runtime", "color-print", "contracts-rococo-runtime", @@ -9165,6 +9465,7 @@ dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", "futures", + "glutton-runtime", "hex-literal 0.4.1", "jsonrpsee", "log", @@ -9194,6 +9495,7 @@ dependencies = [ "sc-transaction-pool-api", "seedling-runtime", "serde", + "serde_json", "shell-runtime", "snowbridge-outbound-queue-rpc", "sp-api", @@ -9205,7 +9507,6 @@ dependencies = [ "sp-keystore", "sp-offchain", "sp-runtime", - "sp-serializer", "sp-session", "sp-timestamp", "sp-transaction-pool", @@ -9226,13 +9527,13 @@ dependencies = [ [[package]] name = "polkadot-performance-test" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "env_logger 0.9.0", "kusama-runtime", "log", "polkadot-erasure-coding", - "polkadot-node-core-pvf-worker", + "polkadot-node-core-pvf-prepare-worker", "polkadot-node-primitives", "polkadot-primitives", "quote", @@ -9244,7 +9545,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "hex-literal 0.4.1", @@ -9270,7 +9571,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -9302,7 +9603,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "frame-benchmarking", @@ -9334,6 +9635,7 @@ dependencies = [ "pallet-im-online", "pallet-indices", "pallet-membership", + "pallet-message-queue", "pallet-multisig", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", @@ -9396,7 +9698,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "frame-benchmarking", @@ -9442,7 +9744,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-support", "polkadot-primitives", @@ -9456,7 +9758,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bs58", "parity-scale-codec", @@ -9468,7 +9770,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitflags", "bitvec", @@ -9481,6 +9783,7 @@ dependencies = [ "pallet-authorship", "pallet-babe", "pallet-balances", + "pallet-message-queue", "pallet-session", "pallet-staking", "pallet-timestamp", @@ -9512,7 +9815,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "async-trait", "frame-benchmarking-cli", @@ -9622,7 +9925,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -9643,7 +9946,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9653,7 +9956,7 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -9678,7 +9981,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "frame-election-provider-support", @@ -9739,7 +10042,7 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-benchmarking", "frame-system", @@ -9836,6 +10139,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" + [[package]] name = "portpicker" version = "0.1.1" @@ -9893,6 +10202,16 @@ dependencies = [ "termtree", ] +[[package]] +name = "prettyplease" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ceca8aaf45b5c46ec7ed39fff75f57290368c1846d33d24a122ca81416ab058" +dependencies = [ + "proc-macro2", + "syn 2.0.16", +] + [[package]] name = "primitive-types" version = "0.12.0" @@ -9959,20 +10278,20 @@ dependencies = [ [[package]] name = "proc-macro-warning" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" +checksum = "70550716265d1ec349c41f70dd4f964b4fd88394efe4405f0c1da679c4799a07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] @@ -9993,21 +10312,21 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" +checksum = "5d6fa99d535dd930d1249e6c79cb3c2915f9172a540fe2b02a4c8f9ca954721e" dependencies = [ "dtoa", "itoa 1.0.4", "parking_lot 0.12.1", - "prometheus-client-derive-text-encode", + "prometheus-client-derive-encode", ] [[package]] -name = "prometheus-client-derive-text-encode" -version = "0.3.0" +name = "prometheus-client-derive-encode" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" +checksum = "72b6a5217beb0ad503ee7fa752d451c905113d70721b937126158f3106a48cc1" dependencies = [ "proc-macro2", "quote", @@ -10044,19 +10363,6 @@ dependencies = [ "which", ] -[[package]] -name = "prost-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc34979ff898b6e141106178981ce2596c387ea6e62533facfc61a37fc879c0" -dependencies = [ - "asynchronous-codec", - "bytes", - "prost", - "thiserror", - "unsigned-varint", -] - [[package]] name = "prost-derive" version = "0.11.0" @@ -10101,6 +10407,28 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" +[[package]] +name = "quick-protobuf" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" +dependencies = [ + "byteorder", +] + +[[package]] +name = "quick-protobuf-codec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1693116345026436eb2f10b677806169c1a1260c1c60eaaffe3fb5a29ae23d8b" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror", + "unsigned-varint", +] + [[package]] name = "quicksink" version = "0.1.2" @@ -10132,9 +10460,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -10341,9 +10669,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" +checksum = "80535183cae11b149d618fbd3c37e38d7cda589d82d7769e196ca9a9042d7621" dependencies = [ "fxhash", "log", @@ -10373,21 +10701,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "region" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "resolv-conf" @@ -10447,9 +10763,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015439787fce1e75d55f279078d33ff14b4af5d93d995e8838ee4631301c8a99" +checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" dependencies = [ "libc", "librocksdb-sys", @@ -10506,7 +10822,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -10534,6 +10850,7 @@ dependencies = [ "pallet-im-online", "pallet-indices", "pallet-membership", + "pallet-message-queue", "pallet-mmr", "pallet-multisig", "pallet-nis", @@ -10592,7 +10909,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-support", "polkadot-primitives", @@ -10746,7 +11063,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64", + "base64 0.13.0", "log", "ring", "sct 0.6.1", @@ -10783,7 +11100,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" dependencies = [ - "base64", + "base64 0.13.0", ] [[package]] @@ -10839,7 +11156,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "log", "sp-core", @@ -10850,7 +11167,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures", @@ -10858,6 +11175,7 @@ dependencies = [ "ip_network", "libp2p", "log", + "multihash 0.17.0", "parity-scale-codec", "prost", "prost-build", @@ -10878,7 +11196,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "futures-timer", @@ -10901,7 +11219,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10916,7 +11234,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10935,25 +11253,25 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "chrono", - "clap 4.2.7", + "clap", "fdlimit", "futures", - "libp2p", + "libp2p-identity", "log", "names", "parity-scale-codec", @@ -10986,7 +11304,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "fnv", "futures", @@ -11005,6 +11323,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-state-machine", + "sp-statement-store", "sp-storage", "substrate-prometheus-endpoint", ] @@ -11012,7 +11331,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "hash-db", "kvdb", @@ -11038,12 +11357,12 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures", "futures-timer", - "libp2p", + "libp2p-identity", "log", "mockall", "parking_lot 0.12.1", @@ -11063,7 +11382,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures", @@ -11092,7 +11411,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "fork-tree", @@ -11128,7 +11447,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "jsonrpsee", @@ -11150,9 +11469,10 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", + "async-channel", "async-trait", "fnv", "futures", @@ -11185,7 +11505,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "jsonrpsee", @@ -11204,7 +11524,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "fork-tree", "parity-scale-codec", @@ -11217,7 +11537,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "ahash 0.8.2", "array-bytes 4.2.0", @@ -11257,7 +11577,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "finality-grandpa", "futures", @@ -11277,7 +11597,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures", @@ -11300,13 +11620,12 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ - "lru 0.8.1", + "lru 0.10.0", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", - "sc-executor-wasmi", "sc-executor-wasmtime", "sp-api", "sp-core", @@ -11318,39 +11637,24 @@ dependencies = [ "sp-version", "sp-wasm-interface", "tracing", - "wasmi 0.13.2", ] [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", "sp-wasm-interface", "thiserror", "wasm-instrument 0.3.0", - "wasmi 0.13.2", -] - -[[package]] -name = "sc-executor-wasmi" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" -dependencies = [ - "log", - "sc-allocator", - "sc-executor-common", - "sp-runtime-interface", - "sp-wasm-interface", - "wasmi 0.13.2", ] [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "anyhow", "cfg-if", @@ -11368,7 +11672,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "ansi_term", "futures", @@ -11384,10 +11688,9 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", - "async-trait", "parking_lot 0.12.1", "serde_json", "sp-application-crypto", @@ -11399,7 +11702,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -11414,7 +11717,7 @@ dependencies = [ "libp2p", "linked_hash_set", "log", - "lru 0.8.1", + "lru 0.10.0", "mockall", "parity-scale-codec", "parking_lot 0.12.1", @@ -11444,11 +11747,12 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ + "async-channel", "cid", "futures", - "libp2p", + "libp2p-identity", "log", "prost", "prost-build", @@ -11464,7 +11768,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11472,7 +11776,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "libp2p", + "libp2p-identity", "parity-scale-codec", "prost-build", "sc-consensus", @@ -11492,14 +11796,14 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "ahash 0.8.2", "futures", "futures-timer", "libp2p", "log", - "lru 0.8.1", + "lru 0.10.0", "sc-network", "sc-network-common", "sc-peerset", @@ -11511,11 +11815,12 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", + "async-channel", "futures", - "libp2p", + "libp2p-identity", "log", "parity-scale-codec", "prost", @@ -11533,16 +11838,17 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", + "async-channel", "async-trait", "fork-tree", "futures", "futures-timer", "libp2p", "log", - "lru 0.8.1", + "lru 0.10.0", "mockall", "parity-scale-codec", "prost", @@ -11567,14 +11873,13 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "futures", "libp2p", "log", "parity-scale-codec", - "pin-project", "sc-network", "sc-network-common", "sc-peerset", @@ -11587,7 +11892,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11618,20 +11923,23 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", - "libp2p", + "libp2p-identity", "log", + "parking_lot 0.12.1", + "partial_sort", "sc-utils", "serde_json", + "sp-arithmetic", "wasm-timer", ] [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11640,7 +11948,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "jsonrpsee", @@ -11663,6 +11971,7 @@ dependencies = [ "sp-rpc", "sp-runtime", "sp-session", + "sp-statement-store", "sp-version", "tokio", ] @@ -11670,7 +11979,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11689,7 +11998,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "http", "jsonrpsee", @@ -11704,7 +12013,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11730,7 +12039,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "directories", @@ -11796,7 +12105,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "log", "parity-scale-codec", @@ -11807,9 +12116,9 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ - "clap 4.2.7", + "clap", "fs4", "futures", "log", @@ -11823,7 +12132,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11842,7 +12151,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "libc", @@ -11861,7 +12170,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "chrono", "futures", @@ -11880,7 +12189,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "ansi_term", "atty", @@ -11911,18 +12220,18 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures", @@ -11949,7 +12258,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures", @@ -11963,7 +12272,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-channel", "futures", @@ -11977,9 +12286,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfdef77228a4c05dc94211441595746732131ad7f6530c6c18f045da7b7ab937" +checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" dependencies = [ "bitvec", "cfg-if", @@ -12226,9 +12535,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" dependencies = [ "serde_derive", ] @@ -12244,13 +12553,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -12266,9 +12575,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" dependencies = [ "serde", ] @@ -12453,7 +12762,7 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "enumn", "parity-scale-codec", @@ -12686,7 +12995,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64", + "base64 0.13.0", "bytes", "flate2", "futures", @@ -12700,7 +13009,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "hash-db", "log", @@ -12720,7 +13029,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "Inflector", "blake2", @@ -12728,13 +13037,13 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "sp-application-crypto" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "scale-info", @@ -12746,8 +13055,8 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "7.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "integer-sqrt", "num-traits", @@ -12761,7 +13070,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "scale-info", @@ -12774,7 +13083,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "sp-api", @@ -12786,11 +13095,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "log", - "lru 0.8.1", + "lru 0.10.0", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -12804,7 +13113,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures", @@ -12819,7 +13128,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "parity-scale-codec", @@ -12837,7 +13146,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "parity-scale-codec", @@ -12858,7 +13167,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "lazy_static", "parity-scale-codec", @@ -12877,7 +13186,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "finality-grandpa", "log", @@ -12895,7 +13204,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "scale-info", @@ -12906,8 +13215,8 @@ dependencies = [ [[package]] name = "sp-core" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -12950,8 +13259,8 @@ dependencies = [ [[package]] name = "sp-core-hashing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "blake2b_simd", "byteorder", @@ -12964,19 +13273,19 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12984,18 +13293,18 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "sp-externalities" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "0.14.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "environmental", "parity-scale-codec", @@ -13006,7 +13315,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -13020,8 +13329,8 @@ dependencies = [ [[package]] name = "sp-io" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "bytes", "ed25519", @@ -13046,8 +13355,8 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "lazy_static", "sp-core", @@ -13057,8 +13366,8 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "0.14.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "parity-scale-codec", @@ -13072,7 +13381,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -13081,7 +13390,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -13092,7 +13401,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -13110,7 +13419,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "scale-info", @@ -13124,7 +13433,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "sp-api", "sp-core", @@ -13133,8 +13442,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "backtrace", "lazy_static", @@ -13144,7 +13453,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "rustc-hash", "serde", @@ -13153,8 +13462,8 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "either", "hash256-std-hasher", @@ -13175,8 +13484,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13193,29 +13502,20 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "7.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", -] - -[[package]] -name = "sp-serializer" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" -dependencies = [ - "serde", - "serde_json", + "syn 2.0.16", ] [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "scale-info", @@ -13229,7 +13529,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "scale-info", @@ -13241,8 +13541,8 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "0.14.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "hash-db", "log", @@ -13259,15 +13559,33 @@ dependencies = [ "tracing", ] +[[package]] +name = "sp-statement-store" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-externalities", + "sp-runtime", + "sp-runtime-interface", + "sp-std", + "thiserror", +] + [[package]] name = "sp-std" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" [[package]] name = "sp-storage" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13280,7 +13598,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "futures-timer", @@ -13294,8 +13612,8 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "7.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "sp-std", @@ -13307,7 +13625,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "sp-api", "sp-runtime", @@ -13316,7 +13634,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "log", @@ -13331,8 +13649,8 @@ dependencies = [ [[package]] name = "sp-trie" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "ahash 0.8.2", "hash-db", @@ -13354,8 +13672,8 @@ dependencies = [ [[package]] name = "sp-version" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13371,33 +13689,32 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "sp-wasm-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", "sp-std", - "wasmi 0.13.2", "wasmtime", ] [[package]] name = "sp-weights" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "parity-scale-codec", "scale-info", @@ -13421,6 +13738,17 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +[[package]] +name = "spinners" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08615eea740067d9899969bc2891c68a19c315cb1f66640af9a9ecb91b13bcab" +dependencies = [ + "lazy_static", + "maplit", + "strum", +] + [[package]] name = "spki" version = "0.6.0" @@ -13484,6 +13812,32 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "statemine-it" +version = "1.0.0" +dependencies = [ + "frame-support", + "frame-system", + "integration-tests-common", + "pallet-assets", + "pallet-balances", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "statemine-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "statemine-runtime" version = "2.0.0" @@ -13556,6 +13910,32 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "statemint-it" +version = "1.0.0" +dependencies = [ + "frame-support", + "frame-system", + "integration-tests-common", + "pallet-assets", + "pallet-balances", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "statemint-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "statemint-runtime" version = "1.0.0" @@ -13587,6 +13967,8 @@ dependencies = [ "pallet-balances", "pallet-collator-selection", "pallet-multisig", + "pallet-nfts", + "pallet-nfts-runtime-api", "pallet-proxy", "pallet-session", "pallet-timestamp", @@ -13716,7 +14098,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" dependencies = [ - "base64", + "base64 0.13.0", "crc", "lazy_static", "md-5", @@ -13745,15 +14127,15 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ - "platforms 2.0.0", + "platforms", ] [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -13772,7 +14154,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "hyper", "log", @@ -13784,7 +14166,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", "jsonrpsee", @@ -13797,7 +14179,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "jsonrpsee", "log", @@ -13816,7 +14198,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -13842,7 +14224,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "futures", "substrate-test-utils-derive", @@ -13852,27 +14234,28 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "ansi_term", "build-helper", "cargo_metadata", "filetime", + "parity-wasm", "sp-maybe-compressed-blob", "strum", "tempfile", - "toml 0.7.3", + "toml 0.7.4", "walkdir", "wasm-opt", ] @@ -13905,9 +14288,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" dependencies = [ "proc-macro2", "quote", @@ -13990,7 +14373,7 @@ checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" [[package]] name = "test-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-support", "polkadot-primitives", @@ -14001,12 +14384,6 @@ dependencies = [ "sp-weights", ] -[[package]] -name = "textwrap" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" - [[package]] name = "thiserror" version = "1.0.40" @@ -14024,7 +14401,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -14179,9 +14556,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.28.0" +version = "1.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" +checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" dependencies = [ "autocfg", "bytes", @@ -14204,7 +14581,18 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", +] + +[[package]] +name = "tokio-retry" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" +dependencies = [ + "pin-project", + "rand 0.8.5", + "tokio", ] [[package]] @@ -14256,9 +14644,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" dependencies = [ "serde", "serde_spanned", @@ -14268,18 +14656,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.7" +version = "0.19.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc18466501acd8ac6a3f615dd29a3438f8ca6bb3b19537138b3106e575621274" +checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f" dependencies = [ "indexmap", "serde", @@ -14301,9 +14689,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" +checksum = "5d1d42a9b3f3ec46ba828e8d376aec14592ea199f70a06a548587ecd1c4ab658" dependencies = [ "bitflags", "bytes", @@ -14376,7 +14764,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -14387,13 +14775,13 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "expander 2.0.0", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -14517,10 +14905,10 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#44130d53f222a0efdd976e76e32460680637c5fe" +source = "git+https://github.com/paritytech/substrate?branch=master#2bc071f33da268ae218f2f376e7aa1dbf397ec76" dependencies = [ "async-trait", - "clap 4.2.7", + "clap", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -14564,7 +14952,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" dependencies = [ "async-trait", - "base64", + "base64 0.13.0", "futures", "log", "md-5", @@ -14788,9 +15176,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -14798,13 +15186,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn 1.0.109", @@ -14813,9 +15201,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.28" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -14825,9 +15213,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -14835,9 +15223,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -14848,9 +15236,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasm-instrument" @@ -14872,9 +15260,9 @@ dependencies = [ [[package]] name = "wasm-opt" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a303793cbc01fb96551badfc7367db6007396bba6bac97936b3c8b6f7fdb41" +checksum = "87fef6d0d508f08334e0ab0e6877feb4c0ecb3956bcf2cb950699b22fedf3e9c" dependencies = [ "anyhow", "libc", @@ -14888,9 +15276,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c9deb56f8a9f2ec177b3bd642a8205621835944ed5da55f2388ef216aca5a4" +checksum = "bc816bbc1596c8f2e8127e137a760c798023ef3d378f2ae51f0f1840e2dfa445" dependencies = [ "anyhow", "cxx", @@ -14900,15 +15288,14 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4432e28b542738a9776cedf92e8a99d8991c7b4667ee2c7ccddfb479dd2856a7" +checksum = "40199e4f68ef1071b3c6d0bd8026a12b481865d4b9e49c156932ea9a6234dd14" dependencies = [ "anyhow", "cc", "cxx", "cxx-build", - "regex", ] [[package]] @@ -14926,17 +15313,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wasmi" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" -dependencies = [ - "parity-wasm", - "wasmi-validation", - "wasmi_core 0.2.1", -] - [[package]] name = "wasmi" version = "0.28.0" @@ -14945,39 +15321,16 @@ checksum = "8e61a7006b0fdf24f6bbe8dcfdad5ca1b350de80061fb2827f31c82fbbb9565a" dependencies = [ "spin 0.9.4", "wasmi_arena", - "wasmi_core 0.12.0", + "wasmi_core", "wasmparser-nostd", ] -[[package]] -name = "wasmi-validation" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" -dependencies = [ - "parity-wasm", -] - [[package]] name = "wasmi_arena" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm 0.2.1", - "memory_units", - "num-rational", - "num-traits", - "region", -] - [[package]] name = "wasmi_core" version = "0.12.0" @@ -14992,9 +15345,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.100.0" +version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" dependencies = [ "indexmap", "url", @@ -15011,9 +15364,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" dependencies = [ "anyhow", "bincode", @@ -15021,7 +15374,7 @@ dependencies = [ "indexmap", "libc", "log", - "object 0.29.0", + "object", "once_cell", "paste", "psm", @@ -15034,26 +15387,26 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-asm-macros" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ceb3adf61d654be0be67fffdce42447b0880481348785be5fe40b5dd7663a4c" +checksum = "c86437fa68626fe896e5afc69234bb2b5894949083586535f200385adfd71213" dependencies = [ "anyhow", - "base64", + "base64 0.21.1", "bincode", "directories-next", "file-per-thread-logger", @@ -15062,15 +15415,15 @@ dependencies = [ "serde", "sha2 0.10.2", "toml 0.5.10", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "zstd 0.11.2+zstd.1.5.2", ] [[package]] name = "wasmtime-cranelift" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c366bb8647e01fd08cb5589976284b00abfded5529b33d7e7f3f086c68304a4" +checksum = "b1cefde0cce8cb700b1b21b6298a3837dba46521affd7b8c38a9ee2c869eee04" dependencies = [ "anyhow", "cranelift-codegen", @@ -15078,27 +15431,43 @@ dependencies = [ "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.26.1", + "gimli", "log", - "object 0.29.0", + "object", "target-lexicon", "thiserror", "wasmparser", + "wasmtime-cranelift-shared", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd041e382ef5aea1b9fc78442394f1a4f6d676ce457e7076ca4cb3f397882f8b" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-native", + "gimli", + "object", + "target-lexicon", "wasmtime-environ", ] [[package]] name = "wasmtime-environ" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.26.1", + "gimli", "indexmap", "log", - "object 0.29.0", + "object", "serde", "target-lexicon", "thiserror", @@ -15108,18 +15477,18 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" dependencies = [ - "addr2line 0.17.0", + "addr2line", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli 0.26.1", + "gimli", "log", - "object 0.29.0", + "object", "rustc-demangle", "serde", "target-lexicon", @@ -15127,36 +15496,36 @@ dependencies = [ "wasmtime-jit-debug", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-jit-debug" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" dependencies = [ - "object 0.29.0", + "object", "once_cell", "rustix 0.36.7", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" dependencies = [ "cfg-if", "libc", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-runtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" dependencies = [ "anyhow", "cc", @@ -15166,21 +15535,21 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.6.5", + "memoffset 0.8.0", "paste", "rand 0.8.5", "rustix 0.36.7", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-types" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" dependencies = [ "cranelift-entity", "serde", @@ -15451,7 +15820,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bitvec", "frame-benchmarking", @@ -15480,6 +15849,7 @@ dependencies = [ "pallet-im-online", "pallet-indices", "pallet-membership", + "pallet-message-queue", "pallet-multisig", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", @@ -15543,7 +15913,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-support", "polkadot-primitives", @@ -15586,6 +15956,7 @@ dependencies = [ "pallet-bridge-transfer", "pallet-collator-selection", "pallet-multisig", + "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-proxy", @@ -15959,9 +16330,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.3.6" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" dependencies = [ "memchr", ] @@ -16013,7 +16384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" dependencies = [ "asn1-rs 0.3.1", - "base64", + "base64 0.13.0", "data-encoding", "der-parser 7.0.0", "lazy_static", @@ -16032,7 +16403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" dependencies = [ "asn1-rs 0.5.1", - "base64", + "base64 0.13.0", "data-encoding", "der-parser 8.1.0", "lazy_static", @@ -16046,7 +16417,7 @@ dependencies = [ [[package]] name = "xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "bounded-collections", "derivative", @@ -16062,7 +16433,7 @@ dependencies = [ [[package]] name = "xcm-builder" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "frame-support", "frame-system", @@ -16076,6 +16447,40 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "sp-weights", + "xcm", + "xcm-executor", +] + +[[package]] +name = "xcm-emulator" +version = "0.1.0" +dependencies = [ + "casey", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-test-relay-sproof-builder", + "cumulus-test-service", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "pallet-message-queue", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "paste", + "polkadot-primitives", + "polkadot-runtime-parachains", + "quote", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std", + "sp-trie", "xcm", "xcm-executor", ] @@ -16083,7 +16488,7 @@ dependencies = [ [[package]] name = "xcm-executor" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "environmental", "frame-benchmarking", @@ -16103,12 +16508,12 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#81456c83ae4736f51ae0ad63f9d7e1fa321ba076" +source = "git+https://github.com/paritytech/polkadot?branch=master#710419524ece26228f70562147f704eacd00e3af" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.16", ] [[package]] @@ -16136,9 +16541,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.7" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" dependencies = [ "zeroize_derive", ] diff --git a/Cargo.toml b/Cargo.toml index ae2966e05a6..26c916777ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ members = [ "client/cli", "client/consensus/aura", "client/consensus/common", + "client/consensus/proposer", "client/consensus/relay-chain", "client/network", "client/pov-recovery", @@ -50,12 +51,17 @@ members = [ "parachains/runtimes/bridge-hubs/bridge-hub-polkadot", "parachains/runtimes/collectives/collectives-polkadot", "parachains/runtimes/contracts/contracts-rococo", + "parachains/runtimes/glutton/glutton-kusama", "parachains/runtimes/testing/penpal", + "parachains/integration-tests/emulated/common", + "parachains/integration-tests/emulated/assets/statemine", + "parachains/integration-tests/emulated/assets/statemint", "test/client", "test/relay-sproof-builder", "test/relay-validation-worker-provider", "test/runtime", "test/service", + "xcm/xcm-emulator", ] [profile.release] diff --git a/README.md b/README.md index d1828eafce1..fe6836e03ae 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A set of tools for writing [Substrate](https://substrate.io/)-based [Polkadot](https://wiki.polkadot.network/en/) [parachains](https://wiki.polkadot.network/docs/en/learn-parachains). Refer to the included [overview](docs/overview.md) for architectural details, and the -[Connect to relay and parachain tutorials](https://docs.substrate.io/tutorials/connect-relay-and-parachains/) for a +[Connect to a relay chain how-to guide](https://docs.substrate.io/reference/how-to-guides/parachains/connect-to-a-relay-chain/) for a guided walk-through of using these tools. It's easy to write blockchains using Substrate, and the overhead of writing parachains' @@ -179,7 +179,7 @@ To run a Statemine or Westmint node (Statemint is not deployed, yet) you will ne `polkadot-parachain` binary: ```bash -cargo build --release --locked -p polkadot-parachain +cargo build --release --locked --bin polkadot-parachain ``` Once the executable is built, launch the parachain node via: @@ -189,7 +189,7 @@ CHAIN=westmint # or statemine ./target/release/polkadot-parachain --chain $CHAIN ``` -Refer to the [setup instructions](#local-setup) to run a local network for development. +Refer to the [setup instructions](#manual-setup) to run a local network for development. ## Contracts 📝 @@ -219,7 +219,7 @@ eventually be included by the relay chain for a parachain. To run a Rococo collator you will need to compile the following binary: ```bash -cargo build --release --locked -p polkadot-parachain +cargo build --release --locked --bin polkadot-parachain ``` Otherwise you can compile it with @@ -228,7 +228,7 @@ Otherwise you can compile it with ```bash docker run --rm -it -w /shellhere/cumulus \ -v $(pwd):/shellhere/cumulus \ - paritytech/ci-linux:production cargo build --release --locked -p polkadot-parachain + paritytech/ci-linux:production cargo build --release --locked --bin polkadot-parachain sudo chown -R $(id -u):$(id -g) target/ ``` diff --git a/bridges/README.md b/bridges/README.md index aab6007d2cd..2f8c5ca9abb 100644 --- a/bridges/README.md +++ b/bridges/README.md @@ -242,7 +242,7 @@ To run a Rialto node for example, you can use the following command: ```bash docker run -p 30333:30333 -p 9933:9933 -p 9944:9944 \ -it paritytech/rialto-bridge-node --dev --tmp \ - --rpc-cors=all --unsafe-rpc-external --unsafe-ws-external + --rpc-cors=all --unsafe-rpc-external ``` ## Community diff --git a/bridges/bin/runtime-common/Cargo.toml b/bridges/bin/runtime-common/Cargo.toml index 039e323b9b7..5f42048d8d3 100644 --- a/bridges/bin/runtime-common/Cargo.toml +++ b/bridges/bin/runtime-common/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } hash-db = { version = "0.16.0", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } static_assertions = { version = "1.1", optional = true } # Bridge dependencies @@ -40,10 +40,8 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } # Polkadot dependencies -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false } [dev-dependencies] bp-test-utils = { path = "../../primitives/test-utils" } @@ -68,7 +66,6 @@ std = [ "pallet-bridge-relayers/std", "pallet-transaction-payment/std", "pallet-utility/std", - "pallet-xcm/std", "scale-info/std", "sp-api/std", "sp-core/std", @@ -78,13 +75,12 @@ std = [ "sp-trie/std", "xcm/std", "xcm-builder/std", - "xcm-executor/std", ] runtime-benchmarks = [ "pallet-bridge-grandpa/runtime-benchmarks", "pallet-bridge-messages/runtime-benchmarks", "pallet-bridge-parachains/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", + "pallet-bridge-relayers/runtime-benchmarks", "xcm-builder/runtime-benchmarks", ] integrity-test = [ diff --git a/bridges/bin/runtime-common/src/lib.rs b/bridges/bin/runtime-common/src/lib.rs index 12b096492cd..546d4388471 100644 --- a/bridges/bin/runtime-common/src/lib.rs +++ b/bridges/bin/runtime-common/src/lib.rs @@ -28,12 +28,12 @@ pub mod messages; pub mod messages_api; pub mod messages_benchmarking; pub mod messages_call_ext; +pub mod messages_generation; pub mod messages_xcm_extension; pub mod parachains_benchmarking; pub mod priority_calculator; pub mod refund_relayer_extension; -mod messages_generation; mod mock; #[cfg(feature = "integrity-test")] diff --git a/bridges/bin/runtime-common/src/messages.rs b/bridges/bin/runtime-common/src/messages.rs index 6f6b1959577..e6c7deb98a2 100644 --- a/bridges/bin/runtime-common/src/messages.rs +++ b/bridges/bin/runtime-common/src/messages.rs @@ -22,18 +22,19 @@ pub use bp_runtime::{RangeInclusiveExt, UnderlyingChainOf, UnderlyingChainProvider}; -use bp_header_chain::{HeaderChain, HeaderChainError}; +use bp_header_chain::HeaderChain; use bp_messages::{ source_chain::{LaneMessageVerifier, TargetHeaderChain}, target_chain::{ProvedLaneMessages, ProvedMessages, SourceHeaderChain}, InboundLaneData, LaneId, Message, MessageKey, MessageNonce, MessagePayload, OutboundLaneData, + VerificationError, }; -use bp_runtime::{Chain, RawStorageProof, Size, StorageProofChecker, StorageProofError}; +use bp_runtime::{Chain, RawStorageProof, Size, StorageProofChecker}; use codec::{Decode, Encode}; use frame_support::{traits::Get, weights::Weight, RuntimeDebug}; use hash_db::Hasher; use scale_info::TypeInfo; -use sp_std::{convert::TryFrom, fmt::Debug, marker::PhantomData, vec::Vec}; +use sp_std::{convert::TryFrom, marker::PhantomData, vec::Vec}; /// Bidirectional message bridge. pub trait MessageBridge { @@ -74,29 +75,6 @@ pub type BalanceOf = bp_runtime::BalanceOf>; /// Type of origin that is used on the chain. pub type OriginOf = ::RuntimeOrigin; -/// Error that happens during message verification. -#[derive(Debug, PartialEq, Eq)] -pub enum Error { - /// The message proof is empty. - EmptyMessageProof, - /// Error returned by the bridged header chain. - HeaderChain(HeaderChainError), - /// Error returned while reading/decoding inbound lane data from the storage proof. - InboundLaneStorage(StorageProofError), - /// The declared message weight is incorrect. - InvalidMessageWeight, - /// Declared messages count doesn't match actual value. - MessagesCountMismatch, - /// Error returned while reading/decoding message data from the storage proof. - MessageStorage(StorageProofError), - /// The message is too large. - MessageTooLarge, - /// Error returned while reading/decoding outbound lane data from the storage proof. - OutboundLaneStorage(StorageProofError), - /// Storage proof related error. - StorageProof(StorageProofError), -} - /// Sub-module that is declaring types required for processing This -> Bridged chain messages. pub mod source { use super::*; @@ -169,14 +147,12 @@ pub mod source { + Into>>, OriginOf>>>, AccountIdOf>: PartialEq + Clone, { - type Error = &'static str; - fn verify_message( _submitter: &OriginOf>, _lane: &LaneId, _lane_outbound_data: &OutboundLaneData, _payload: &FromThisChainMessagePayload, - ) -> Result<(), Self::Error> { + ) -> Result<(), VerificationError> { // IMPORTANT: any error that is returned here is fatal for the bridge, because // this code is executed at the bridge hub and message sender actually lives // at some sibling parachain. So we are failing **after** the message has been @@ -200,16 +176,15 @@ pub mod source { impl TargetHeaderChain>> for TargetHeaderChainAdapter { - type Error = Error; type MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof>>; - fn verify_message(payload: &FromThisChainMessagePayload) -> Result<(), Self::Error> { + fn verify_message(payload: &FromThisChainMessagePayload) -> Result<(), VerificationError> { verify_chain_message::(payload) } fn verify_messages_delivery_proof( proof: Self::MessagesDeliveryProof, - ) -> Result<(LaneId, InboundLaneData>>), Self::Error> { + ) -> Result<(LaneId, InboundLaneData>>), VerificationError> { verify_messages_delivery_proof::(proof) } } @@ -221,7 +196,7 @@ pub mod source { /// check) that would reject message (see `FromThisChainMessageVerifier`). pub fn verify_chain_message( payload: &FromThisChainMessagePayload, - ) -> Result<(), Error> { + ) -> Result<(), VerificationError> { // IMPORTANT: any error that is returned here is fatal for the bridge, because // this code is executed at the bridge hub and message sender actually lives // at some sibling parachain. So we are failing **after** the message has been @@ -241,9 +216,9 @@ pub mod source { // the message itself. The proof is always larger than the message. But unless chain state // is enormously large, it should be several dozens/hundreds of bytes. The delivery // transaction also contains signatures and signed extensions. Because of this, we reserve - // 1/3 of the the maximal extrinsic weight for this data. + // 1/3 of the the maximal extrinsic size for this data. if payload.len() > maximal_message_size::() as usize { - return Err(Error::MessageTooLarge) + return Err(VerificationError::MessageTooLarge) } Ok(()) @@ -255,31 +230,26 @@ pub mod source { /// parachains, please use the `verify_messages_delivery_proof_from_parachain`. pub fn verify_messages_delivery_proof( proof: FromBridgedChainMessagesDeliveryProof>>, - ) -> Result, Error> { + ) -> Result, VerificationError> { let FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane } = proof; - B::BridgedHeaderChain::parse_finalized_storage_proof( - bridged_header_hash, - storage_proof, - |mut storage| { - // Messages delivery proof is just proof of single storage key read => any error - // is fatal. - let storage_inbound_lane_data_key = - bp_messages::storage_keys::inbound_lane_data_key( - B::BRIDGED_MESSAGES_PALLET_NAME, - &lane, - ); - let inbound_lane_data = storage - .read_and_decode_mandatory_value(storage_inbound_lane_data_key.0.as_ref()) - .map_err(Error::InboundLaneStorage)?; - - // check that the storage proof doesn't have any untouched trie nodes - storage.ensure_no_unused_nodes().map_err(Error::StorageProof)?; - - Ok((lane, inbound_lane_data)) - }, - ) - .map_err(Error::HeaderChain)? + let mut storage = + B::BridgedHeaderChain::storage_proof_checker(bridged_header_hash, storage_proof) + .map_err(VerificationError::HeaderChain)?; + // Messages delivery proof is just proof of single storage key read => any error + // is fatal. + let storage_inbound_lane_data_key = bp_messages::storage_keys::inbound_lane_data_key( + B::BRIDGED_MESSAGES_PALLET_NAME, + &lane, + ); + let inbound_lane_data = storage + .read_and_decode_mandatory_value(storage_inbound_lane_data_key.0.as_ref()) + .map_err(VerificationError::InboundLaneStorage)?; + + // check that the storage proof doesn't have any untouched trie nodes + storage.ensure_no_unused_nodes().map_err(VerificationError::StorageProof)?; + + Ok((lane, inbound_lane_data)) } } @@ -335,13 +305,12 @@ pub mod target { pub struct SourceHeaderChainAdapter(PhantomData); impl SourceHeaderChain for SourceHeaderChainAdapter { - type Error = Error; type MessagesProof = FromBridgedChainMessagesProof>>; fn verify_messages_proof( proof: Self::MessagesProof, messages_count: u32, - ) -> Result, Self::Error> { + ) -> Result, VerificationError> { verify_messages_proof::(proof, messages_count) } } @@ -357,7 +326,7 @@ pub mod target { pub fn verify_messages_proof( proof: FromBridgedChainMessagesProof>>, messages_count: u32, - ) -> Result, Error> { + ) -> Result, VerificationError> { let FromBridgedChainMessagesProof { bridged_header_hash, storage_proof, @@ -365,57 +334,52 @@ pub mod target { nonces_start, nonces_end, } = proof; + let storage = + B::BridgedHeaderChain::storage_proof_checker(bridged_header_hash, storage_proof) + .map_err(VerificationError::HeaderChain)?; + let mut parser = StorageProofCheckerAdapter::<_, B> { storage, _dummy: Default::default() }; let nonces_range = nonces_start..=nonces_end; - B::BridgedHeaderChain::parse_finalized_storage_proof( - bridged_header_hash, - storage_proof, - |storage| { - let mut parser = - StorageProofCheckerAdapter::<_, B> { storage, _dummy: Default::default() }; - - // receiving proofs where end < begin is ok (if proof includes outbound lane state) - let messages_in_the_proof = nonces_range.checked_len().unwrap_or(0); - if messages_in_the_proof != MessageNonce::from(messages_count) { - return Err(Error::MessagesCountMismatch) - } - - // Read messages first. All messages that are claimed to be in the proof must - // be in the proof. So any error in `read_value`, or even missing value is fatal. - // - // Mind that we allow proofs with no messages if outbound lane state is proved. - let mut messages = Vec::with_capacity(messages_in_the_proof as _); - for nonce in nonces_range { - let message_key = MessageKey { lane_id: lane, nonce }; - let message_payload = parser.read_and_decode_message_payload(&message_key)?; - messages.push(Message { key: message_key, payload: message_payload }); - } - - // Now let's check if proof contains outbound lane state proof. It is optional, so - // we simply ignore `read_value` errors and missing value. - let proved_lane_messages = ProvedLaneMessages { - lane_state: parser.read_and_decode_outbound_lane_data(&lane)?, - messages, - }; - - // Now we may actually check if the proof is empty or not. - if proved_lane_messages.lane_state.is_none() && - proved_lane_messages.messages.is_empty() - { - return Err(Error::EmptyMessageProof) - } - - // check that the storage proof doesn't have any untouched trie nodes - parser.storage.ensure_no_unused_nodes().map_err(Error::StorageProof)?; - - // We only support single lane messages in this generated_schema - let mut proved_messages = ProvedMessages::new(); - proved_messages.insert(lane, proved_lane_messages); - - Ok(proved_messages) - }, - ) - .map_err(Error::HeaderChain)? + // receiving proofs where end < begin is ok (if proof includes outbound lane state) + let messages_in_the_proof = nonces_range.checked_len().unwrap_or(0); + if messages_in_the_proof != MessageNonce::from(messages_count) { + return Err(VerificationError::MessagesCountMismatch) + } + + // Read messages first. All messages that are claimed to be in the proof must + // be in the proof. So any error in `read_value`, or even missing value is fatal. + // + // Mind that we allow proofs with no messages if outbound lane state is proved. + let mut messages = Vec::with_capacity(messages_in_the_proof as _); + for nonce in nonces_range { + let message_key = MessageKey { lane_id: lane, nonce }; + let message_payload = parser.read_and_decode_message_payload(&message_key)?; + messages.push(Message { key: message_key, payload: message_payload }); + } + + // Now let's check if proof contains outbound lane state proof. It is optional, so + // we simply ignore `read_value` errors and missing value. + let proved_lane_messages = ProvedLaneMessages { + lane_state: parser.read_and_decode_outbound_lane_data(&lane)?, + messages, + }; + + // Now we may actually check if the proof is empty or not. + if proved_lane_messages.lane_state.is_none() && proved_lane_messages.messages.is_empty() { + return Err(VerificationError::EmptyMessageProof) + } + + // check that the storage proof doesn't have any untouched trie nodes + parser + .storage + .ensure_no_unused_nodes() + .map_err(VerificationError::StorageProof)?; + + // We only support single lane messages in this generated_schema + let mut proved_messages = ProvedMessages::new(); + proved_messages.insert(lane, proved_lane_messages); + + Ok(proved_messages) } struct StorageProofCheckerAdapter { @@ -427,7 +391,7 @@ pub mod target { fn read_and_decode_outbound_lane_data( &mut self, lane_id: &LaneId, - ) -> Result, Error> { + ) -> Result, VerificationError> { let storage_outbound_lane_data_key = bp_messages::storage_keys::outbound_lane_data_key( B::BRIDGED_MESSAGES_PALLET_NAME, lane_id, @@ -435,13 +399,13 @@ pub mod target { self.storage .read_and_decode_opt_value(storage_outbound_lane_data_key.0.as_ref()) - .map_err(Error::OutboundLaneStorage) + .map_err(VerificationError::OutboundLaneStorage) } fn read_and_decode_message_payload( &mut self, message_key: &MessageKey, - ) -> Result { + ) -> Result { let storage_message_key = bp_messages::storage_keys::message_key( B::BRIDGED_MESSAGES_PALLET_NAME, &message_key.lane_id, @@ -449,7 +413,7 @@ pub mod target { ); self.storage .read_and_decode_mandatory_value(storage_message_key.0.as_ref()) - .map_err(Error::MessageStorage) + .map_err(VerificationError::MessageStorage) } } } @@ -470,8 +434,8 @@ mod tests { }, mock::*, }; - use bp_header_chain::StoredHeaderDataBuilder; - use bp_runtime::HeaderId; + use bp_header_chain::{HeaderChainError, StoredHeaderDataBuilder}; + use bp_runtime::{HeaderId, StorageProofError}; use codec::Encode; use sp_core::H256; use sp_runtime::traits::Header as _; @@ -559,7 +523,7 @@ mod tests { using_messages_proof(10, None, encode_all_messages, encode_lane_data, |proof| { target::verify_messages_proof::(proof, 5) }), - Err(Error::MessagesCountMismatch), + Err(VerificationError::MessagesCountMismatch), ); } @@ -569,7 +533,7 @@ mod tests { using_messages_proof(10, None, encode_all_messages, encode_lane_data, |proof| { target::verify_messages_proof::(proof, 15) }), - Err(Error::MessagesCountMismatch), + Err(VerificationError::MessagesCountMismatch), ); } @@ -582,7 +546,7 @@ mod tests { pallet_bridge_grandpa::ImportedHeaders::::remove(bridged_header_hash); target::verify_messages_proof::(proof, 10) }), - Err(Error::HeaderChain(HeaderChainError::UnknownHeader)), + Err(VerificationError::HeaderChain(HeaderChainError::UnknownHeader)), ); } @@ -605,7 +569,7 @@ mod tests { ); target::verify_messages_proof::(proof, 10) }), - Err(Error::HeaderChain(HeaderChainError::StorageProof( + Err(VerificationError::HeaderChain(HeaderChainError::StorageProof( StorageProofError::StorageRootMismatch ))), ); @@ -620,7 +584,7 @@ mod tests { proof.storage_proof.push(node); target::verify_messages_proof::(proof, 10) },), - Err(Error::HeaderChain(HeaderChainError::StorageProof( + Err(VerificationError::HeaderChain(HeaderChainError::StorageProof( StorageProofError::DuplicateNodesInProof ))), ); @@ -633,7 +597,7 @@ mod tests { proof.storage_proof.push(vec![42]); target::verify_messages_proof::(proof, 10) },), - Err(Error::StorageProof(StorageProofError::UnusedNodesInTheProof)), + Err(VerificationError::StorageProof(StorageProofError::UnusedNodesInTheProof)), ); } @@ -647,7 +611,7 @@ mod tests { encode_lane_data, |proof| target::verify_messages_proof::(proof, 10) ), - Err(Error::MessageStorage(StorageProofError::StorageValueEmpty)), + Err(VerificationError::MessageStorage(StorageProofError::StorageValueEmpty)), ); } @@ -667,7 +631,7 @@ mod tests { encode_lane_data, |proof| target::verify_messages_proof::(proof, 10), ), - Err(Error::MessageStorage(StorageProofError::StorageValueDecodeFailed(_))), + Err(VerificationError::MessageStorage(StorageProofError::StorageValueDecodeFailed(_))), ); } @@ -689,7 +653,9 @@ mod tests { }, |proof| target::verify_messages_proof::(proof, 10), ), - Err(Error::OutboundLaneStorage(StorageProofError::StorageValueDecodeFailed(_))), + Err(VerificationError::OutboundLaneStorage( + StorageProofError::StorageValueDecodeFailed(_) + )), ); } @@ -699,7 +665,7 @@ mod tests { using_messages_proof(0, None, encode_all_messages, encode_lane_data, |proof| { target::verify_messages_proof::(proof, 0) },), - Err(Error::EmptyMessageProof), + Err(VerificationError::EmptyMessageProof), ); } @@ -773,7 +739,7 @@ mod tests { proof.nonces_end = u64::MAX; target::verify_messages_proof::(proof, u32::MAX) },), - Err(Error::MessagesCountMismatch), + Err(VerificationError::MessagesCountMismatch), ); } } diff --git a/bridges/bin/runtime-common/src/messages_call_ext.rs b/bridges/bin/runtime-common/src/messages_call_ext.rs index 3f48ce583f9..8b4a50a0f30 100644 --- a/bridges/bin/runtime-common/src/messages_call_ext.rs +++ b/bridges/bin/runtime-common/src/messages_call_ext.rs @@ -47,7 +47,7 @@ pub struct BaseMessagesProofInfo { impl BaseMessagesProofInfo { /// Returns true if `bundled_range` continues the `0..=best_stored_nonce` range. fn appends_to_stored_nonce(&self) -> bool { - *self.bundled_range.start() == self.best_stored_nonce + 1 + Some(*self.bundled_range.start()) == self.best_stored_nonce.checked_add(1) } } diff --git a/bridges/bin/runtime-common/src/messages_generation.rs b/bridges/bin/runtime-common/src/messages_generation.rs index 29a869a5c87..8dbf3abd683 100644 --- a/bridges/bin/runtime-common/src/messages_generation.rs +++ b/bridges/bin/runtime-common/src/messages_generation.rs @@ -16,8 +16,6 @@ //! Helpers for generating message storage proofs, that are used by tests and by benchmarks. -#![cfg(any(feature = "runtime-benchmarks", test))] - use crate::messages::{BridgedChain, HashOf, HasherOf, MessageBridge}; use bp_messages::{ @@ -29,19 +27,19 @@ use sp_std::{ops::RangeInclusive, prelude::*}; use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut}; /// Simple and correct message data encode function. -pub(crate) fn encode_all_messages(_: MessageNonce, m: &MessagePayload) -> Option> { +pub fn encode_all_messages(_: MessageNonce, m: &MessagePayload) -> Option> { Some(m.encode()) } /// Simple and correct outbound lane data encode function. -pub(crate) fn encode_lane_data(d: &OutboundLaneData) -> Vec { +pub fn encode_lane_data(d: &OutboundLaneData) -> Vec { d.encode() } /// Prepare storage proof of given messages. /// /// Returns state trie root and nodes with prepared messages. -pub(crate) fn prepare_messages_storage_proof( +pub fn prepare_messages_storage_proof( lane: LaneId, message_nonces: RangeInclusive, outbound_lane_data: Option, diff --git a/bridges/bin/runtime-common/src/mock.rs b/bridges/bin/runtime-common/src/mock.rs index c1767199676..4542ad39b62 100644 --- a/bridges/bin/runtime-common/src/mock.rs +++ b/bridges/bin/runtime-common/src/mock.rs @@ -190,7 +190,7 @@ impl pallet_balances::Config for TestRuntime { type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; diff --git a/bridges/bin/runtime-common/src/refund_relayer_extension.rs b/bridges/bin/runtime-common/src/refund_relayer_extension.rs index 00ea70aa04e..c5419837316 100644 --- a/bridges/bin/runtime-common/src/refund_relayer_extension.rs +++ b/bridges/bin/runtime-common/src/refund_relayer_extension.rs @@ -24,7 +24,7 @@ use crate::messages_call_ext::{ }; use bp_messages::{LaneId, MessageNonce}; use bp_relayers::{RewardsAccountOwner, RewardsAccountParams}; -use bp_runtime::{RangeInclusiveExt, StaticStrProvider}; +use bp_runtime::{Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider}; use codec::{Decode, Encode}; use frame_support::{ dispatch::{CallableCallFor, DispatchInfo, Dispatchable, PostDispatchInfo}, @@ -71,9 +71,9 @@ pub trait RefundableParachainId { } /// Default implementation of `RefundableParachainId`. -pub struct RefundableParachain(PhantomData<(Instance, Id)>); +pub struct DefaultRefundableParachainId(PhantomData<(Instance, Id)>); -impl RefundableParachainId for RefundableParachain +impl RefundableParachainId for DefaultRefundableParachainId where Id: Get, { @@ -81,6 +81,17 @@ where type Id = Id; } +/// Implementation of `RefundableParachainId` for `trait Parachain`. +pub struct RefundableParachain(PhantomData<(Instance, Para)>); + +impl RefundableParachainId for RefundableParachain +where + Para: Parachain, +{ + type Instance = Instance; + type Id = ParachainIdOf; +} + /// Trait identifying a bridged messages lane. A relayer might be refunded for delivering messages /// coming from this lane. pub trait RefundableMessagesLaneId { @@ -682,7 +693,7 @@ mod tests { bp_runtime::generate_static_str_provider!(TestExtension); type TestExtension = RefundBridgedParachainMessages< TestRuntime, - RefundableParachain<(), TestParachain>, + DefaultRefundableParachainId<(), TestParachain>, RefundableMessagesLane<(), TestLaneId>, ActualFeeRefund, ConstU64<1>, diff --git a/bridges/modules/grandpa/Cargo.toml b/bridges/modules/grandpa/Cargo.toml index 9b97b518fc5..ea8d00b8860 100644 --- a/bridges/modules/grandpa/Cargo.toml +++ b/bridges/modules/grandpa/Cargo.toml @@ -11,7 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } finality-grandpa = { version = "0.16.2", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index 329e4c21136..10b60878302 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -44,7 +44,7 @@ use bp_header_chain::{ }; use bp_runtime::{BlockNumberOf, HashOf, HasherOf, HeaderId, HeaderOf, OwnedBridgeModule}; use finality_grandpa::voter_set::VoterSet; -use frame_support::{dispatch::PostDispatchInfo, ensure}; +use frame_support::{dispatch::PostDispatchInfo, ensure, DefaultNoBound}; use sp_consensus_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID}; use sp_runtime::{ traits::{Header as HeaderT, Zero}, @@ -370,6 +370,7 @@ pub mod pallet { StorageValue<_, BasicOperatingMode, ValueQuery>; #[pallet::genesis_config] + #[derive(DefaultNoBound)] pub struct GenesisConfig, I: 'static = ()> { /// Optional module owner account. pub owner: Option, @@ -377,13 +378,6 @@ pub mod pallet { pub init_data: Option>>, } - #[cfg(feature = "std")] - impl, I: 'static> Default for GenesisConfig { - fn default() -> Self { - Self { owner: None, init_data: None } - } - } - #[pallet::genesis_build] impl, I: 'static> GenesisBuild for GenesisConfig { fn build(&self) { @@ -1212,11 +1206,8 @@ mod tests { fn parse_finalized_storage_proof_rejects_proof_on_unknown_header() { run_test(|| { assert_noop!( - Pallet::::parse_finalized_storage_proof( - Default::default(), - vec![], - |_| (), - ), + Pallet::::storage_proof_checker(Default::default(), vec![],) + .map(|_| ()), bp_header_chain::HeaderChainError::UnknownHeader, ); }); @@ -1235,8 +1226,7 @@ mod tests { >::insert(hash, header.build()); assert_ok!( - Pallet::::parse_finalized_storage_proof(hash, storage_proof, |_| (),), - (), + Pallet::::storage_proof_checker(hash, storage_proof).map(|_| ()) ); }); } diff --git a/bridges/modules/messages/Cargo.toml b/bridges/modules/messages/Cargo.toml index 639ac9dc23c..52fdea1df00 100644 --- a/bridges/modules/messages/Cargo.toml +++ b/bridges/modules/messages/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.17", default-features = false } num-traits = { version = "0.2", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/modules/messages/src/benchmarking.rs b/bridges/modules/messages/src/benchmarking.rs index aab8855a729..04f64b53b30 100644 --- a/bridges/modules/messages/src/benchmarking.rs +++ b/bridges/modules/messages/src/benchmarking.rs @@ -17,8 +17,8 @@ //! Messages pallet benchmarking. use crate::{ - inbound_lane::InboundLaneStorage, inbound_lane_storage, outbound_lane, - weights_ext::EXPECTED_DEFAULT_MESSAGE_LENGTH, Call, OutboundLanes, + inbound_lane::InboundLaneStorage, outbound_lane, weights_ext::EXPECTED_DEFAULT_MESSAGE_LENGTH, + Call, OutboundLanes, RuntimeInboundLaneStorage, }; use bp_messages::{ @@ -443,11 +443,12 @@ benchmarks_instance_pallet! { fn send_regular_message, I: 'static>() { let mut outbound_lane = outbound_lane::(T::bench_lane_id()); - outbound_lane.send_message(vec![]); + outbound_lane.send_message(vec![]).expect("We craft valid messages"); } fn receive_messages, I: 'static>(nonce: MessageNonce) { - let mut inbound_lane_storage = inbound_lane_storage::(T::bench_lane_id()); + let mut inbound_lane_storage = + RuntimeInboundLaneStorage::::from_lane_id(T::bench_lane_id()); inbound_lane_storage.set_data(InboundLaneData { relayers: vec![UnrewardedRelayer { relayer: T::bridged_relayer_id(), diff --git a/bridges/modules/messages/src/inbound_lane.rs b/bridges/modules/messages/src/inbound_lane.rs index 5ec4444dbdf..b665b5516fc 100644 --- a/bridges/modules/messages/src/inbound_lane.rs +++ b/bridges/modules/messages/src/inbound_lane.rs @@ -40,7 +40,7 @@ pub trait InboundLaneStorage { /// Return maximal number of unconfirmed messages in inbound lane. fn max_unconfirmed_messages(&self) -> MessageNonce; /// Get lane data from the storage. - fn data(&self) -> InboundLaneData; + fn get_or_init_data(&mut self) -> InboundLaneData; /// Update lane data in the storage. fn set_data(&mut self, data: InboundLaneData); } @@ -117,9 +117,9 @@ impl InboundLane { InboundLane { storage } } - /// Returns storage reference. - pub fn storage(&self) -> &S { - &self.storage + /// Returns `mut` storage reference. + pub fn storage_mut(&mut self) -> &mut S { + &mut self.storage } /// Receive state of the corresponding outbound lane. @@ -127,7 +127,7 @@ impl InboundLane { &mut self, outbound_lane_data: OutboundLaneData, ) -> Option { - let mut data = self.storage.data(); + let mut data = self.storage.get_or_init_data(); let last_delivered_nonce = data.last_delivered_nonce(); if outbound_lane_data.latest_received_nonce > last_delivered_nonce { @@ -170,9 +170,8 @@ impl InboundLane { nonce: MessageNonce, message_data: DispatchMessageData, ) -> ReceivalResult { - let mut data = self.storage.data(); - let is_correct_message = nonce == data.last_delivered_nonce() + 1; - if !is_correct_message { + let mut data = self.storage.get_or_init_data(); + if Some(nonce) != data.last_delivered_nonce().checked_add(1) { return ReceivalResult::InvalidNonce } @@ -252,7 +251,7 @@ mod tests { None, ); - assert_eq!(lane.storage.data().last_confirmed_nonce, 0); + assert_eq!(lane.storage.get_or_init_data().last_confirmed_nonce, 0); }); } @@ -270,7 +269,7 @@ mod tests { }), Some(3), ); - assert_eq!(lane.storage.data().last_confirmed_nonce, 3); + assert_eq!(lane.storage.get_or_init_data().last_confirmed_nonce, 3); assert_eq!( lane.receive_state_update(OutboundLaneData { @@ -279,7 +278,7 @@ mod tests { }), None, ); - assert_eq!(lane.storage.data().last_confirmed_nonce, 3); + assert_eq!(lane.storage.get_or_init_data().last_confirmed_nonce, 3); }); } @@ -290,9 +289,9 @@ mod tests { receive_regular_message(&mut lane, 1); receive_regular_message(&mut lane, 2); receive_regular_message(&mut lane, 3); - assert_eq!(lane.storage.data().last_confirmed_nonce, 0); + assert_eq!(lane.storage.get_or_init_data().last_confirmed_nonce, 0); assert_eq!( - lane.storage.data().relayers, + lane.storage.get_or_init_data().relayers, vec![unrewarded_relayer(1, 3, TEST_RELAYER_A)] ); @@ -303,9 +302,9 @@ mod tests { }), Some(2), ); - assert_eq!(lane.storage.data().last_confirmed_nonce, 2); + assert_eq!(lane.storage.get_or_init_data().last_confirmed_nonce, 2); assert_eq!( - lane.storage.data().relayers, + lane.storage.get_or_init_data().relayers, vec![unrewarded_relayer(3, 3, TEST_RELAYER_A)] ); @@ -316,8 +315,8 @@ mod tests { }), Some(3), ); - assert_eq!(lane.storage.data().last_confirmed_nonce, 3); - assert_eq!(lane.storage.data().relayers, vec![]); + assert_eq!(lane.storage.get_or_init_data().last_confirmed_nonce, 3); + assert_eq!(lane.storage.get_or_init_data().relayers, vec![]); }); } @@ -325,7 +324,7 @@ mod tests { fn receive_status_update_works_with_batches_from_relayers() { run_test(|| { let mut lane = inbound_lane::(TEST_LANE_ID); - let mut seed_storage_data = lane.storage.data(); + let mut seed_storage_data = lane.storage.get_or_init_data(); // Prepare data seed_storage_data.last_confirmed_nonce = 0; seed_storage_data.relayers.push_back(unrewarded_relayer(1, 1, TEST_RELAYER_A)); @@ -341,9 +340,9 @@ mod tests { }), Some(3), ); - assert_eq!(lane.storage.data().last_confirmed_nonce, 3); + assert_eq!(lane.storage.get_or_init_data().last_confirmed_nonce, 3); assert_eq!( - lane.storage.data().relayers, + lane.storage.get_or_init_data().relayers, vec![ unrewarded_relayer(4, 4, TEST_RELAYER_B), unrewarded_relayer(5, 5, TEST_RELAYER_C) @@ -364,7 +363,7 @@ mod tests { ), ReceivalResult::InvalidNonce ); - assert_eq!(lane.storage.data().last_delivered_nonce(), 0); + assert_eq!(lane.storage.get_or_init_data().last_delivered_nonce(), 0); }); } @@ -470,7 +469,7 @@ mod tests { ReceivalResult::Dispatched(dispatch_result(0)) ); assert_eq!( - lane.storage.data().relayers, + lane.storage.get_or_init_data().relayers, vec![ unrewarded_relayer(1, 1, TEST_RELAYER_A), unrewarded_relayer(2, 2, TEST_RELAYER_B), @@ -508,7 +507,7 @@ mod tests { run_test(|| { let mut lane = inbound_lane::(TEST_LANE_ID); receive_regular_message(&mut lane, 1); - assert_eq!(lane.storage.data().last_delivered_nonce(), 1); + assert_eq!(lane.storage.get_or_init_data().last_delivered_nonce(), 1); }); } diff --git a/bridges/modules/messages/src/lib.rs b/bridges/modules/messages/src/lib.rs index 045015b7751..51e6857d777 100644 --- a/bridges/modules/messages/src/lib.rs +++ b/bridges/modules/messages/src/lib.rs @@ -48,7 +48,7 @@ pub use weights_ext::{ use crate::{ inbound_lane::{InboundLane, InboundLaneStorage}, - outbound_lane::{OutboundLane, OutboundLaneStorage, ReceivalConfirmationResult}, + outbound_lane::{OutboundLane, OutboundLaneStorage, ReceivalConfirmationError}, }; use bp_messages::{ @@ -59,15 +59,15 @@ use bp_messages::{ DeliveryPayments, DispatchMessage, MessageDispatch, ProvedLaneMessages, ProvedMessages, SourceHeaderChain, }, - total_unrewarded_messages, DeliveredMessages, InboundLaneData, InboundMessageDetails, LaneId, - MessageKey, MessageNonce, MessagePayload, MessagesOperatingMode, OutboundLaneData, - OutboundMessageDetails, UnrewardedRelayersState, + DeliveredMessages, InboundLaneData, InboundMessageDetails, LaneId, MessageKey, MessageNonce, + MessagePayload, MessagesOperatingMode, OutboundLaneData, OutboundMessageDetails, + UnrewardedRelayersState, VerificationError, }; use bp_runtime::{BasicOperatingMode, ChainId, OwnedBridgeModule, PreComputedSize, Size}; use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get}; +use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get, DefaultNoBound}; use sp_runtime::traits::UniqueSaturatedFrom; -use sp_std::{cell::RefCell, marker::PhantomData, prelude::*}; +use sp_std::{marker::PhantomData, prelude::*}; mod inbound_lane; mod outbound_lane; @@ -319,7 +319,7 @@ pub mod pallet { // subtract extra storage proof bytes from the actual PoV size - there may be // less unrewarded relayers than the maximal configured value - let lane_extra_proof_size_bytes = lane.storage().extra_proof_size_bytes(); + let lane_extra_proof_size_bytes = lane.storage_mut().extra_proof_size_bytes(); actual_weight = actual_weight.set_proof_size( actual_weight.proof_size().saturating_sub(lane_extra_proof_size_bytes), ); @@ -332,7 +332,7 @@ pub mod pallet { "Received lane {:?} state update: latest_confirmed_nonce={}. Unrewarded relayers: {:?}", lane_id, updated_latest_confirmed_nonce, - UnrewardedRelayersState::from(&lane.storage().data()), + UnrewardedRelayersState::from(&lane.storage_mut().get_or_init_data()), ); } } @@ -437,57 +437,21 @@ pub mod pallet { Error::::InvalidMessagesDeliveryProof })?; - - // verify that the relayer has declared correct `lane_data::relayers` state - // (we only care about total number of entries and messages, because this affects call - // weight) - ensure!( - total_unrewarded_messages(&lane_data.relayers).unwrap_or(MessageNonce::MAX) == - relayers_state.total_messages && - lane_data.relayers.len() as MessageNonce == - relayers_state.unrewarded_relayer_entries, - Error::::InvalidUnrewardedRelayersState - ); - // the `last_delivered_nonce` field may also be used by the signed extension. Even - // though providing wrong value isn't critical, let's also check it here. ensure!( - lane_data.last_delivered_nonce() == relayers_state.last_delivered_nonce, + relayers_state.is_valid(&lane_data), Error::::InvalidUnrewardedRelayersState ); // mark messages as delivered let mut lane = outbound_lane::(lane_id); let last_delivered_nonce = lane_data.last_delivered_nonce(); - let confirmed_messages = match lane.confirm_delivery( - relayers_state.total_messages, - last_delivered_nonce, - &lane_data.relayers, - ) { - ReceivalConfirmationResult::ConfirmedMessages(confirmed_messages) => - Some(confirmed_messages), - ReceivalConfirmationResult::NoNewConfirmations => None, - ReceivalConfirmationResult::TryingToConfirmMoreMessagesThanExpected( - to_confirm_messages_count, - ) => { - log::trace!( - target: LOG_TARGET, - "Messages delivery proof contains too many messages to confirm: {} vs declared {}", - to_confirm_messages_count, - relayers_state.total_messages, - ); - - fail!(Error::::TryingToConfirmMoreMessagesThanExpected); - }, - error => { - log::trace!( - target: LOG_TARGET, - "Messages delivery proof contains invalid unrewarded relayers vec: {:?}", - error, - ); - - fail!(Error::::InvalidUnrewardedRelayers); - }, - }; + let confirmed_messages = lane + .confirm_delivery( + relayers_state.total_messages, + last_delivered_nonce, + &lane_data.relayers, + ) + .map_err(Error::::ReceivalConfirmation)?; if let Some(confirmed_messages) = confirmed_messages { // emit 'delivered' event @@ -554,12 +518,12 @@ pub mod pallet { NotOperatingNormally, /// The outbound lane is inactive. InactiveOutboundLane, - /// The message is too large to be sent over the bridge. - MessageIsTooLarge, /// Message has been treated as invalid by chain verifier. - MessageRejectedByChainVerifier, + MessageRejectedByChainVerifier(VerificationError), /// Message has been treated as invalid by lane verifier. - MessageRejectedByLaneVerifier, + MessageRejectedByLaneVerifier(VerificationError), + /// Message has been treated as invalid by the pallet logic. + MessageRejectedByPallet(VerificationError), /// Submitter has failed to pay fee for delivering and dispatching messages. FailedToWithdrawMessageFee, /// The transaction brings too many messages. @@ -568,8 +532,6 @@ pub mod pallet { InvalidMessagesProof, /// Invalid messages delivery proof has been submitted. InvalidMessagesDeliveryProof, - /// The bridged chain has invalid `UnrewardedRelayers` in its storage (fatal for the lane). - InvalidUnrewardedRelayers, /// The relayer has declared invalid unrewarded relayers state in the /// `receive_messages_delivery_proof` call. InvalidUnrewardedRelayersState, @@ -578,9 +540,8 @@ pub mod pallet { InsufficientDispatchWeight, /// The message someone is trying to work with (i.e. increase fee) is not yet sent. MessageIsNotYetSent, - /// The number of actually confirmed messages is going to be larger than the number of - /// messages in the proof. This may mean that this or bridged chain storage is corrupted. - TryingToConfirmMoreMessagesThanExpected, + /// Error confirming messages receival. + ReceivalConfirmation(ReceivalConfirmationError), /// Error generated by the `OwnedBridgeModule` trait. BridgeModule(bp_runtime::OwnedBridgeModuleError), } @@ -625,6 +586,7 @@ pub mod pallet { StorageMap<_, Blake2_128Concat, MessageKey, StoredMessagePayload>; #[pallet::genesis_config] + #[derive(DefaultNoBound)] pub struct GenesisConfig, I: 'static = ()> { /// Initial pallet operating mode. pub operating_mode: MessagesOperatingMode, @@ -634,17 +596,6 @@ pub mod pallet { pub phantom: sp_std::marker::PhantomData, } - #[cfg(feature = "std")] - impl, I: 'static> Default for GenesisConfig { - fn default() -> Self { - Self { - operating_mode: Default::default(), - owner: Default::default(), - phantom: Default::default(), - } - } - } - #[pallet::genesis_build] impl, I: 'static> GenesisBuild for GenesisConfig { fn build(&self) { @@ -732,7 +683,7 @@ fn send_message, I: 'static>( err, ); - Error::::MessageRejectedByChainVerifier + Error::::MessageRejectedByChainVerifier(err) })?; // now let's enforce any additional lane rules @@ -746,18 +697,16 @@ fn send_message, I: 'static>( err, ); - Error::::MessageRejectedByLaneVerifier + Error::::MessageRejectedByLaneVerifier(err) }, )?; // finally, save message in outbound storage and emit event let encoded_payload = payload.encode(); let encoded_payload_len = encoded_payload.len(); - ensure!( - encoded_payload_len <= T::MaximalOutboundPayloadSize::get() as usize, - Error::::MessageIsTooLarge - ); - let nonce = lane.send_message(encoded_payload); + let nonce = lane + .send_message(encoded_payload) + .map_err(Error::::MessageRejectedByPallet)?; log::trace!( target: LOG_TARGET, @@ -787,18 +736,7 @@ fn ensure_normal_operating_mode, I: 'static>() -> Result<(), Error< fn inbound_lane, I: 'static>( lane_id: LaneId, ) -> InboundLane> { - InboundLane::new(inbound_lane_storage::(lane_id)) -} - -/// Creates new runtime inbound lane storage. -fn inbound_lane_storage, I: 'static>( - lane_id: LaneId, -) -> RuntimeInboundLaneStorage { - RuntimeInboundLaneStorage { - lane_id, - cached_data: RefCell::new(None), - _phantom: Default::default(), - } + InboundLane::new(RuntimeInboundLaneStorage::from_lane_id(lane_id)) } /// Creates new outbound lane object, backed by runtime storage. @@ -811,10 +749,17 @@ fn outbound_lane, I: 'static>( /// Runtime inbound lane storage. struct RuntimeInboundLaneStorage, I: 'static = ()> { lane_id: LaneId, - cached_data: RefCell>>, + cached_data: Option>, _phantom: PhantomData, } +impl, I: 'static> RuntimeInboundLaneStorage { + /// Creates new runtime inbound lane storage. + fn from_lane_id(lane_id: LaneId) -> RuntimeInboundLaneStorage { + RuntimeInboundLaneStorage { lane_id, cached_data: None, _phantom: Default::default() } + } +} + impl, I: 'static> RuntimeInboundLaneStorage { /// Returns number of bytes that may be subtracted from the PoV component of /// `receive_messages_proof` call, because the actual inbound lane state is smaller than the @@ -824,9 +769,9 @@ impl, I: 'static> RuntimeInboundLaneStorage { /// `MaxUnrewardedRelayerEntriesAtInboundLane` constant from the pallet configuration. The PoV /// of the call includes the maximal size of inbound lane state. If the actual size is smaller, /// we may subtract extra bytes from this component. - pub fn extra_proof_size_bytes(&self) -> u64 { + pub fn extra_proof_size_bytes(&mut self) -> u64 { let max_encoded_len = StoredInboundLaneData::::max_encoded_len(); - let relayers_count = self.data().relayers.len(); + let relayers_count = self.get_or_init_data().relayers.len(); let actual_encoded_len = InboundLaneData::::encoded_size_hint(relayers_count) .unwrap_or(usize::MAX); @@ -849,26 +794,20 @@ impl, I: 'static> InboundLaneStorage for RuntimeInboundLaneStorage< T::MaxUnconfirmedMessagesAtInboundLane::get() } - fn data(&self) -> InboundLaneData { - match self.cached_data.clone().into_inner() { - Some(data) => data, + fn get_or_init_data(&mut self) -> InboundLaneData { + match self.cached_data { + Some(ref data) => data.clone(), None => { let data: InboundLaneData = InboundLanes::::get(self.lane_id).into(); - *self.cached_data.try_borrow_mut().expect( - "we're in the single-threaded environment;\ - we have no recursive borrows; qed", - ) = Some(data.clone()); + self.cached_data = Some(data.clone()); data }, } } fn set_data(&mut self, data: InboundLaneData) { - *self.cached_data.try_borrow_mut().expect( - "we're in the single-threaded environment;\ - we have no recursive borrows; qed", - ) = Some(data.clone()); + self.cached_data = Some(data.clone()); InboundLanes::::insert(self.lane_id, StoredInboundLaneData::(data)) } } @@ -898,15 +837,17 @@ impl, I: 'static> OutboundLaneStorage for RuntimeOutboundLaneStorag .map(Into::into) } - fn save_message(&mut self, nonce: MessageNonce, message_payload: MessagePayload) { + fn save_message( + &mut self, + nonce: MessageNonce, + message_payload: MessagePayload, + ) -> Result<(), VerificationError> { OutboundMessages::::insert( MessageKey { lane_id: self.lane_id, nonce }, - StoredMessagePayload::::try_from(message_payload).expect( - "save_message is called after all checks in send_message; \ - send_message checks message size; \ - qed", - ), + StoredMessagePayload::::try_from(message_payload) + .map_err(|_| VerificationError::MessageTooLarge)?, ); + Ok(()) } fn remove_message(&mut self, nonce: &MessageNonce) { @@ -918,7 +859,7 @@ impl, I: 'static> OutboundLaneStorage for RuntimeOutboundLaneStorag fn verify_and_decode_messages_proof( proof: Chain::MessagesProof, messages_count: u32, -) -> Result>, Chain::Error> { +) -> Result>, VerificationError> { // `receive_messages_proof` weight formula and `MaxUnconfirmedMessagesAtInboundLane` check // guarantees that the `message_count` is sane and Vec may be allocated. // (tx with too many messages will either be rejected from the pool, or will fail earlier) @@ -941,13 +882,16 @@ fn verify_and_decode_messages_proof::MessageIsTooLarge, + Error::::MessageRejectedByPallet( + VerificationError::MessageTooLarge + ), ); // let's check that we're able to send `MAX_OUTBOUND_PAYLOAD_SIZE` messages @@ -1177,7 +1123,9 @@ mod tests { TEST_LANE_ID, PAYLOAD_REJECTED_BY_TARGET_CHAIN, ), - Error::::MessageRejectedByChainVerifier, + Error::::MessageRejectedByChainVerifier(VerificationError::Other( + mock::TEST_ERROR + )), ); }); } @@ -1190,7 +1138,9 @@ mod tests { message.reject_by_lane_verifier = true; assert_noop!( send_message::(RuntimeOrigin::signed(1), TEST_LANE_ID, message,), - Error::::MessageRejectedByLaneVerifier, + Error::::MessageRejectedByLaneVerifier(VerificationError::Other( + mock::TEST_ERROR + )), ); }); } @@ -1368,9 +1318,9 @@ mod tests { single_message_delivery_proof, UnrewardedRelayersState { unrewarded_relayer_entries: 1, + messages_in_oldest_entry: 1, total_messages: 1, last_delivered_nonce: 1, - ..Default::default() }, ); assert_ok!(result); @@ -1408,9 +1358,9 @@ mod tests { two_messages_delivery_proof, UnrewardedRelayersState { unrewarded_relayer_entries: 2, + messages_in_oldest_entry: 1, total_messages: 2, last_delivered_nonce: 2, - ..Default::default() }, ); assert_ok!(result); @@ -1773,9 +1723,9 @@ mod tests { TestMessagesDeliveryProof(messages_1_and_2_proof), UnrewardedRelayersState { unrewarded_relayer_entries: 1, + messages_in_oldest_entry: 2, total_messages: 2, last_delivered_nonce: 2, - ..Default::default() }, )); // second tx with message 3 @@ -1784,9 +1734,9 @@ mod tests { TestMessagesDeliveryProof(messages_3_proof), UnrewardedRelayersState { unrewarded_relayer_entries: 1, + messages_in_oldest_entry: 1, total_messages: 1, last_delivered_nonce: 3, - ..Default::default() }, )); }); @@ -1814,7 +1764,9 @@ mod tests { ))), UnrewardedRelayersState { last_delivered_nonce: 1, ..Default::default() }, ), - Error::::TryingToConfirmMoreMessagesThanExpected, + Error::::ReceivalConfirmation( + ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected + ), ); }); } @@ -2114,10 +2066,10 @@ mod tests { fn storage(relayer_entries: usize) -> RuntimeInboundLaneStorage { RuntimeInboundLaneStorage { lane_id: Default::default(), - cached_data: RefCell::new(Some(InboundLaneData { + cached_data: Some(InboundLaneData { relayers: vec![relayer_entry(); relayer_entries].into_iter().collect(), last_confirmed_nonce: 0, - })), + }), _phantom: Default::default(), } } diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index 2e45d5b601f..8716c5bc3ac 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/modules/messages/src/mock.rs @@ -27,7 +27,7 @@ use bp_messages::{ ProvedLaneMessages, ProvedMessages, SourceHeaderChain, }, DeliveredMessages, InboundLaneData, LaneId, Message, MessageKey, MessageNonce, MessagePayload, - OutboundLaneData, UnrewardedRelayer, UnrewardedRelayersState, + OutboundLaneData, UnrewardedRelayer, UnrewardedRelayersState, VerificationError, }; use bp_runtime::{messages::MessageDispatchResult, Size}; use codec::{Decode, Encode}; @@ -133,7 +133,7 @@ impl pallet_balances::Config for TestRuntime { type WeightInfo = (); type MaxReserves = (); type ReserveIdentifier = (); - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -295,13 +295,11 @@ impl Size for TestMessagesDeliveryProof { pub struct TestTargetHeaderChain; impl TargetHeaderChain for TestTargetHeaderChain { - type Error = &'static str; - type MessagesDeliveryProof = TestMessagesDeliveryProof; - fn verify_message(payload: &TestPayload) -> Result<(), Self::Error> { + fn verify_message(payload: &TestPayload) -> Result<(), VerificationError> { if *payload == PAYLOAD_REJECTED_BY_TARGET_CHAIN { - Err(TEST_ERROR) + Err(VerificationError::Other(TEST_ERROR)) } else { Ok(()) } @@ -309,8 +307,8 @@ impl TargetHeaderChain for TestTargetHeaderChain { fn verify_messages_delivery_proof( proof: Self::MessagesDeliveryProof, - ) -> Result<(LaneId, InboundLaneData), Self::Error> { - proof.0.map_err(|_| TEST_ERROR) + ) -> Result<(LaneId, InboundLaneData), VerificationError> { + proof.0.map_err(|_| VerificationError::Other(TEST_ERROR)) } } @@ -319,18 +317,16 @@ impl TargetHeaderChain for TestTargetHeaderChain { pub struct TestLaneMessageVerifier; impl LaneMessageVerifier for TestLaneMessageVerifier { - type Error = &'static str; - fn verify_message( _submitter: &RuntimeOrigin, _lane: &LaneId, _lane_outbound_data: &OutboundLaneData, payload: &TestPayload, - ) -> Result<(), Self::Error> { + ) -> Result<(), VerificationError> { if !payload.reject_by_lane_verifier { Ok(()) } else { - Err(TEST_ERROR) + Err(VerificationError::Other(TEST_ERROR)) } } } @@ -400,15 +396,16 @@ impl DeliveryConfirmationPayments for TestDeliveryConfirmationPayment pub struct TestSourceHeaderChain; impl SourceHeaderChain for TestSourceHeaderChain { - type Error = &'static str; - type MessagesProof = TestMessagesProof; fn verify_messages_proof( proof: Self::MessagesProof, _messages_count: u32, - ) -> Result, Self::Error> { - proof.result.map(|proof| proof.into_iter().collect()).map_err(|_| TEST_ERROR) + ) -> Result, VerificationError> { + proof + .result + .map(|proof| proof.into_iter().collect()) + .map_err(|_| VerificationError::Other(TEST_ERROR)) } } diff --git a/bridges/modules/messages/src/outbound_lane.rs b/bridges/modules/messages/src/outbound_lane.rs index 3d0d4de966a..0cf0c4ccb42 100644 --- a/bridges/modules/messages/src/outbound_lane.rs +++ b/bridges/modules/messages/src/outbound_lane.rs @@ -16,16 +16,19 @@ //! Everything about outgoing messages sending. -use crate::Config; +use crate::{Config, LOG_TARGET}; use bp_messages::{ DeliveredMessages, LaneId, MessageNonce, MessagePayload, OutboundLaneData, UnrewardedRelayer, + VerificationError, }; +use codec::{Decode, Encode}; use frame_support::{ weights::{RuntimeDbWeight, Weight}, - BoundedVec, RuntimeDebug, + BoundedVec, PalletError, RuntimeDebug, }; use num_traits::Zero; +use scale_info::TypeInfo; use sp_std::collections::vec_deque::VecDeque; /// Outbound lane storage. @@ -40,7 +43,11 @@ pub trait OutboundLaneStorage { #[cfg(test)] fn message(&self, nonce: &MessageNonce) -> Option; /// Save outbound message in the storage. - fn save_message(&mut self, nonce: MessageNonce, message_payload: MessagePayload); + fn save_message( + &mut self, + nonce: MessageNonce, + message_payload: MessagePayload, + ) -> Result<(), VerificationError>; /// Remove outbound message from the storage. fn remove_message(&mut self, nonce: &MessageNonce); } @@ -49,13 +56,8 @@ pub trait OutboundLaneStorage { pub type StoredMessagePayload = BoundedVec>::MaximalOutboundPayloadSize>; /// Result of messages receival confirmation. -#[derive(RuntimeDebug, PartialEq, Eq)] -pub enum ReceivalConfirmationResult { - /// New messages have been confirmed by the confirmation transaction. - ConfirmedMessages(DeliveredMessages), - /// Confirmation transaction brings no new confirmation. This may be a result of relayer - /// error or several relayers running. - NoNewConfirmations, +#[derive(Encode, Decode, RuntimeDebug, PartialEq, Eq, PalletError, TypeInfo)] +pub enum ReceivalConfirmationError { /// Bridged chain is trying to confirm more messages than we have generated. May be a result /// of invalid bridged chain storage. FailedToConfirmFutureMessages, @@ -66,7 +68,7 @@ pub enum ReceivalConfirmationResult { /// bridged chain storage. NonConsecutiveUnrewardedRelayerEntries, /// The chain has more messages that need to be confirmed than there is in the proof. - TryingToConfirmMoreMessagesThanExpected(MessageNonce), + TryingToConfirmMoreMessagesThanExpected, } /// Outbound messages lane. @@ -88,15 +90,18 @@ impl OutboundLane { /// Send message over lane. /// /// Returns new message nonce. - pub fn send_message(&mut self, message_payload: MessagePayload) -> MessageNonce { + pub fn send_message( + &mut self, + message_payload: MessagePayload, + ) -> Result { let mut data = self.storage.data(); let nonce = data.latest_generated_nonce + 1; data.latest_generated_nonce = nonce; - self.storage.save_message(nonce, message_payload); + self.storage.save_message(nonce, message_payload)?; self.storage.set_data(data); - nonce + Ok(nonce) } /// Confirm messages delivery. @@ -105,37 +110,39 @@ impl OutboundLane { max_allowed_messages: MessageNonce, latest_delivered_nonce: MessageNonce, relayers: &VecDeque>, - ) -> ReceivalConfirmationResult { + ) -> Result, ReceivalConfirmationError> { let mut data = self.storage.data(); - if latest_delivered_nonce <= data.latest_received_nonce { - return ReceivalConfirmationResult::NoNewConfirmations + let confirmed_messages = DeliveredMessages { + begin: data.latest_received_nonce.saturating_add(1), + end: latest_delivered_nonce, + }; + if confirmed_messages.total_messages() == 0 { + return Ok(None) } - if latest_delivered_nonce > data.latest_generated_nonce { - return ReceivalConfirmationResult::FailedToConfirmFutureMessages + if confirmed_messages.end > data.latest_generated_nonce { + return Err(ReceivalConfirmationError::FailedToConfirmFutureMessages) } - if latest_delivered_nonce - data.latest_received_nonce > max_allowed_messages { + if confirmed_messages.total_messages() > max_allowed_messages { // that the relayer has declared correct number of messages that the proof contains (it // is checked outside of the function). But it may happen (but only if this/bridged // chain storage is corrupted, though) that the actual number of confirmed messages if // larger than declared. This would mean that 'reward loop' will take more time than the // weight formula accounts, so we can't allow that. - return ReceivalConfirmationResult::TryingToConfirmMoreMessagesThanExpected( - latest_delivered_nonce - data.latest_received_nonce, - ) + log::trace!( + target: LOG_TARGET, + "Messages delivery proof contains too many messages to confirm: {} vs declared {}", + confirmed_messages.total_messages(), + max_allowed_messages, + ); + return Err(ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected) } - if let Err(e) = ensure_unrewarded_relayers_are_correct(latest_delivered_nonce, relayers) { - return e - } + ensure_unrewarded_relayers_are_correct(confirmed_messages.end, relayers)?; - let prev_latest_received_nonce = data.latest_received_nonce; - data.latest_received_nonce = latest_delivered_nonce; + data.latest_received_nonce = confirmed_messages.end; self.storage.set_data(data); - ReceivalConfirmationResult::ConfirmedMessages(DeliveredMessages { - begin: prev_latest_received_nonce + 1, - end: latest_delivered_nonce, - }) + Ok(Some(confirmed_messages)) } /// Prune at most `max_messages_to_prune` already received messages. @@ -176,27 +183,24 @@ impl OutboundLane { fn ensure_unrewarded_relayers_are_correct( latest_received_nonce: MessageNonce, relayers: &VecDeque>, -) -> Result<(), ReceivalConfirmationResult> { - let mut last_entry_end: Option = None; +) -> Result<(), ReceivalConfirmationError> { + let mut expected_entry_begin = relayers.front().map(|entry| entry.messages.begin); for entry in relayers { // unrewarded relayer entry must have at least 1 unconfirmed message // (guaranteed by the `InboundLane::receive_message()`) if entry.messages.end < entry.messages.begin { - return Err(ReceivalConfirmationResult::EmptyUnrewardedRelayerEntry) + return Err(ReceivalConfirmationError::EmptyUnrewardedRelayerEntry) } // every entry must confirm range of messages that follows previous entry range // (guaranteed by the `InboundLane::receive_message()`) - if let Some(last_entry_end) = last_entry_end { - let expected_entry_begin = last_entry_end.checked_add(1); - if expected_entry_begin != Some(entry.messages.begin) { - return Err(ReceivalConfirmationResult::NonConsecutiveUnrewardedRelayerEntries) - } + if expected_entry_begin != Some(entry.messages.begin) { + return Err(ReceivalConfirmationError::NonConsecutiveUnrewardedRelayerEntries) } - last_entry_end = Some(entry.messages.end); + expected_entry_begin = entry.messages.end.checked_add(1); // entry can't confirm messages larger than `inbound_lane_data.latest_received_nonce()` // (guaranteed by the `InboundLane::receive_message()`) if entry.messages.end > latest_received_nonce { - return Err(ReceivalConfirmationResult::FailedToConfirmFutureMessages) + return Err(ReceivalConfirmationError::FailedToConfirmFutureMessages) } } @@ -213,7 +217,7 @@ mod tests { }, outbound_lane, }; - use frame_support::weights::constants::RocksDbWeight; + use frame_support::{assert_ok, weights::constants::RocksDbWeight}; use sp_std::ops::RangeInclusive; fn unrewarded_relayers( @@ -231,12 +235,12 @@ mod tests { fn assert_3_messages_confirmation_fails( latest_received_nonce: MessageNonce, relayers: &VecDeque>, - ) -> ReceivalConfirmationResult { + ) -> Result, ReceivalConfirmationError> { run_test(|| { let mut lane = outbound_lane::(TEST_LANE_ID); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); assert_eq!(lane.storage.data().latest_generated_nonce, 3); assert_eq!(lane.storage.data().latest_received_nonce, 0); let result = lane.confirm_delivery(3, latest_received_nonce, relayers); @@ -251,7 +255,7 @@ mod tests { run_test(|| { let mut lane = outbound_lane::(TEST_LANE_ID); assert_eq!(lane.storage.data().latest_generated_nonce, 0); - assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), 1); + assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), Ok(1)); assert!(lane.storage.message(&1).is_some()); assert_eq!(lane.storage.data().latest_generated_nonce, 1); }); @@ -261,14 +265,14 @@ mod tests { fn confirm_delivery_works() { run_test(|| { let mut lane = outbound_lane::(TEST_LANE_ID); - assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), 1); - assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), 2); - assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), 3); + assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), Ok(1)); + assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), Ok(2)); + assert_eq!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD)), Ok(3)); assert_eq!(lane.storage.data().latest_generated_nonce, 3); assert_eq!(lane.storage.data().latest_received_nonce, 0); assert_eq!( lane.confirm_delivery(3, 3, &unrewarded_relayers(1..=3)), - ReceivalConfirmationResult::ConfirmedMessages(delivered_messages(1..=3)), + Ok(Some(delivered_messages(1..=3))), ); assert_eq!(lane.storage.data().latest_generated_nonce, 3); assert_eq!(lane.storage.data().latest_received_nonce, 3); @@ -279,26 +283,20 @@ mod tests { fn confirm_delivery_rejects_nonce_lesser_than_latest_received() { run_test(|| { let mut lane = outbound_lane::(TEST_LANE_ID); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); assert_eq!(lane.storage.data().latest_generated_nonce, 3); assert_eq!(lane.storage.data().latest_received_nonce, 0); assert_eq!( lane.confirm_delivery(3, 3, &unrewarded_relayers(1..=3)), - ReceivalConfirmationResult::ConfirmedMessages(delivered_messages(1..=3)), - ); - assert_eq!( - lane.confirm_delivery(3, 3, &unrewarded_relayers(1..=3)), - ReceivalConfirmationResult::NoNewConfirmations, + Ok(Some(delivered_messages(1..=3))), ); + assert_eq!(lane.confirm_delivery(3, 3, &unrewarded_relayers(1..=3)), Ok(None),); assert_eq!(lane.storage.data().latest_generated_nonce, 3); assert_eq!(lane.storage.data().latest_received_nonce, 3); - assert_eq!( - lane.confirm_delivery(1, 2, &unrewarded_relayers(1..=1)), - ReceivalConfirmationResult::NoNewConfirmations, - ); + assert_eq!(lane.confirm_delivery(1, 2, &unrewarded_relayers(1..=1)), Ok(None),); assert_eq!(lane.storage.data().latest_generated_nonce, 3); assert_eq!(lane.storage.data().latest_received_nonce, 3); }); @@ -308,7 +306,7 @@ mod tests { fn confirm_delivery_rejects_nonce_larger_than_last_generated() { assert_eq!( assert_3_messages_confirmation_fails(10, &unrewarded_relayers(1..=10),), - ReceivalConfirmationResult::FailedToConfirmFutureMessages, + Err(ReceivalConfirmationError::FailedToConfirmFutureMessages), ); } @@ -323,7 +321,7 @@ mod tests { .chain(unrewarded_relayers(3..=3).into_iter()) .collect(), ), - ReceivalConfirmationResult::FailedToConfirmFutureMessages, + Err(ReceivalConfirmationError::FailedToConfirmFutureMessages), ); } @@ -339,7 +337,7 @@ mod tests { .chain(unrewarded_relayers(2..=3).into_iter()) .collect(), ), - ReceivalConfirmationResult::EmptyUnrewardedRelayerEntry, + Err(ReceivalConfirmationError::EmptyUnrewardedRelayerEntry), ); } @@ -354,7 +352,7 @@ mod tests { .chain(unrewarded_relayers(2..=2).into_iter()) .collect(), ), - ReceivalConfirmationResult::NonConsecutiveUnrewardedRelayerEntries, + Err(ReceivalConfirmationError::NonConsecutiveUnrewardedRelayerEntries), ); } @@ -369,9 +367,9 @@ mod tests { ); assert_eq!(lane.storage.data().oldest_unpruned_nonce, 1); // when nothing is confirmed, nothing is pruned - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); assert!(lane.storage.message(&1).is_some()); assert!(lane.storage.message(&2).is_some()); assert!(lane.storage.message(&3).is_some()); @@ -383,7 +381,7 @@ mod tests { // after confirmation, some messages are received assert_eq!( lane.confirm_delivery(2, 2, &unrewarded_relayers(1..=2)), - ReceivalConfirmationResult::ConfirmedMessages(delivered_messages(1..=2)), + Ok(Some(delivered_messages(1..=2))), ); assert_eq!( lane.prune_messages(RocksDbWeight::get(), RocksDbWeight::get().writes(101)), @@ -396,7 +394,7 @@ mod tests { // after last message is confirmed, everything is pruned assert_eq!( lane.confirm_delivery(1, 3, &unrewarded_relayers(3..=3)), - ReceivalConfirmationResult::ConfirmedMessages(delivered_messages(3..=3)), + Ok(Some(delivered_messages(3..=3))), ); assert_eq!( lane.prune_messages(RocksDbWeight::get(), RocksDbWeight::get().writes(101)), @@ -413,20 +411,20 @@ mod tests { fn confirm_delivery_detects_when_more_than_expected_messages_are_confirmed() { run_test(|| { let mut lane = outbound_lane::(TEST_LANE_ID); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); - lane.send_message(outbound_message_data(REGULAR_PAYLOAD)); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); + assert_ok!(lane.send_message(outbound_message_data(REGULAR_PAYLOAD))); assert_eq!( lane.confirm_delivery(0, 3, &unrewarded_relayers(1..=3)), - ReceivalConfirmationResult::TryingToConfirmMoreMessagesThanExpected(3), + Err(ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected), ); assert_eq!( lane.confirm_delivery(2, 3, &unrewarded_relayers(1..=3)), - ReceivalConfirmationResult::TryingToConfirmMoreMessagesThanExpected(3), + Err(ReceivalConfirmationError::TryingToConfirmMoreMessagesThanExpected), ); assert_eq!( lane.confirm_delivery(3, 3, &unrewarded_relayers(1..=3)), - ReceivalConfirmationResult::ConfirmedMessages(delivered_messages(1..=3)), + Ok(Some(delivered_messages(1..=3))), ); }); } diff --git a/bridges/modules/parachains/Cargo.toml b/bridges/modules/parachains/Cargo.toml index d8c89b79991..147111fd4ce 100644 --- a/bridges/modules/parachains/Cargo.toml +++ b/bridges/modules/parachains/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/modules/parachains/src/lib.rs b/bridges/modules/parachains/src/lib.rs index 6c89b09513c..b17b52163d8 100644 --- a/bridges/modules/parachains/src/lib.rs +++ b/bridges/modules/parachains/src/lib.rs @@ -30,7 +30,7 @@ use bp_header_chain::{HeaderChain, HeaderChainError}; use bp_parachains::{parachain_head_storage_key_at_source, ParaInfo, ParaStoredHeaderData}; use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId}; use bp_runtime::{Chain, HashOf, HeaderId, HeaderIdOf, Parachain, StorageProofError}; -use frame_support::dispatch::PostDispatchInfo; +use frame_support::{dispatch::PostDispatchInfo, DefaultNoBound}; use sp_std::{marker::PhantomData, vec::Vec}; #[cfg(feature = "runtime-benchmarks")] @@ -91,6 +91,8 @@ pub mod pallet { BoundedStorageValue<>::MaxParaHeadDataSize, ParaStoredHeaderData>; /// Weight info of the given parachains pallet. pub type WeightInfoOf = >::WeightInfo; + type GrandpaPalletOf = + pallet_bridge_grandpa::Pallet>::BridgesGrandpaPalletInstance>; #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] @@ -125,14 +127,8 @@ pub mod pallet { UnknownRelayChainBlock, /// The number of stored relay block is different from what the relayer has provided. InvalidRelayChainBlockNumber, - /// Error generated by a method defined in `bp-header-chain`. - HeaderChain(HeaderChainError), - /// Given parachain head is unknown. - UnknownParaHead, - /// The storage proof doesn't contains storage root. So it is invalid for given header. - StorageRootMismatch, - /// Failed to extract state root from given parachain head. - FailedToExtractStateRoot, + /// Parachain heads storage proof is invalid. + HeaderChainStorageProof(HeaderChainError), /// Error generated by the `OwnedBridgeModule` trait. BridgeModule(bp_runtime::OwnedBridgeModuleError), } @@ -337,112 +333,113 @@ pub mod pallet { parachains.len() as _, ); - pallet_bridge_grandpa::Pallet::::parse_finalized_storage_proof( + let mut storage = GrandpaPalletOf::::storage_proof_checker( relay_block_hash, parachain_heads_proof.0, - move |mut storage| { - for (parachain, parachain_head_hash) in parachains { - let parachain_head = match Pallet::::read_parachain_head(&mut storage, parachain) { - Ok(Some(parachain_head)) => parachain_head, - Ok(None) => { - log::trace!( - target: LOG_TARGET, - "The head of parachain {:?} is None. {}", - parachain, - if ParasInfo::::contains_key(parachain) { - "Looks like it is not yet registered at the source relay chain" - } else { - "Looks like it has been deregistered from the source relay chain" - }, - ); - Self::deposit_event(Event::MissingParachainHead { parachain }); - continue; - }, - Err(e) => { - log::trace!( - target: LOG_TARGET, - "The read of head of parachain {:?} has failed: {:?}", - parachain, - e, - ); - Self::deposit_event(Event::MissingParachainHead { parachain }); - continue; + ) + .map_err(Error::::HeaderChainStorageProof)?; + + for (parachain, parachain_head_hash) in parachains { + let parachain_head = match Self::read_parachain_head(&mut storage, parachain) { + Ok(Some(parachain_head)) => parachain_head, + Ok(None) => { + log::trace!( + target: LOG_TARGET, + "The head of parachain {:?} is None. {}", + parachain, + if ParasInfo::::contains_key(parachain) { + "Looks like it is not yet registered at the source relay chain" + } else { + "Looks like it has been deregistered from the source relay chain" }, - }; + ); + Self::deposit_event(Event::MissingParachainHead { parachain }); + continue + }, + Err(e) => { + log::trace!( + target: LOG_TARGET, + "The read of head of parachain {:?} has failed: {:?}", + parachain, + e, + ); + Self::deposit_event(Event::MissingParachainHead { parachain }); + continue + }, + }; + + // if relayer has specified invalid parachain head hash, ignore the head + // (this isn't strictly necessary, but better safe than sorry) + let actual_parachain_head_hash = parachain_head.hash(); + if parachain_head_hash != actual_parachain_head_hash { + log::trace!( + target: LOG_TARGET, + "The submitter has specified invalid parachain {:?} head hash: \ + {:?} vs {:?}", + parachain, + parachain_head_hash, + actual_parachain_head_hash, + ); + Self::deposit_event(Event::IncorrectParachainHeadHash { + parachain, + parachain_head_hash, + actual_parachain_head_hash, + }); + continue + } - // if relayer has specified invalid parachain head hash, ignore the head - // (this isn't strictly necessary, but better safe than sorry) - let actual_parachain_head_hash = parachain_head.hash(); - if parachain_head_hash != actual_parachain_head_hash { + // convert from parachain head into stored parachain head data + let parachain_head_data = + match T::ParaStoredHeaderDataBuilder::try_build(parachain, ¶chain_head) { + Some(parachain_head_data) => parachain_head_data, + None => { log::trace!( target: LOG_TARGET, - "The submitter has specified invalid parachain {:?} head hash: {:?} vs {:?}", + "The head of parachain {:?} has been provided, but it is not tracked by the pallet", parachain, - parachain_head_hash, - actual_parachain_head_hash, ); - Self::deposit_event(Event::IncorrectParachainHeadHash { - parachain, - parachain_head_hash, - actual_parachain_head_hash, - }); - continue; - } - - // convert from parachain head into stored parachain head data - let parachain_head_data = match T::ParaStoredHeaderDataBuilder::try_build( + Self::deposit_event(Event::UntrackedParachainRejected { parachain }); + continue + }, + }; + + let update_result: Result<_, ()> = + ParasInfo::::try_mutate(parachain, |stored_best_head| { + let artifacts = Pallet::::update_parachain_head( parachain, - ¶chain_head, - ) { - Some(parachain_head_data) => parachain_head_data, - None => { - log::trace!( - target: LOG_TARGET, - "The head of parachain {:?} has been provided, but it is not tracked by the pallet", - parachain, - ); - Self::deposit_event(Event::UntrackedParachainRejected { parachain }); - continue; - }, - }; - - let update_result: Result<_, ()> = ParasInfo::::try_mutate(parachain, |stored_best_head| { - let artifacts = Pallet::::update_parachain_head( - parachain, - stored_best_head.take(), - relay_block_number, - parachain_head_data, - parachain_head_hash, - )?; - *stored_best_head = Some(artifacts.best_head); - Ok(artifacts.prune_happened) - }); - - // we're refunding weight if update has not happened and if pruning has not happened - let is_update_happened = matches!(update_result, Ok(_)); - if !is_update_happened { - actual_weight = actual_weight - .saturating_sub(WeightInfoOf::::parachain_head_storage_write_weight(T::DbWeight::get())); - } - let is_prune_happened = matches!(update_result, Ok(true)); - if !is_prune_happened { - actual_weight = actual_weight - .saturating_sub(WeightInfoOf::::parachain_head_pruning_weight(T::DbWeight::get())); - } - } + stored_best_head.take(), + relay_block_number, + parachain_head_data, + parachain_head_hash, + )?; + *stored_best_head = Some(artifacts.best_head); + Ok(artifacts.prune_happened) + }); + + // we're refunding weight if update has not happened and if pruning has not happened + let is_update_happened = matches!(update_result, Ok(_)); + if !is_update_happened { + actual_weight = actual_weight.saturating_sub( + WeightInfoOf::::parachain_head_storage_write_weight( + T::DbWeight::get(), + ), + ); + } + let is_prune_happened = matches!(update_result, Ok(true)); + if !is_prune_happened { + actual_weight = actual_weight.saturating_sub( + WeightInfoOf::::parachain_head_pruning_weight(T::DbWeight::get()), + ); + } + } - // even though we may have accepted some parachain heads, we can't allow relayers to submit - // proof with unused trie nodes - // => treat this as an error - // - // (we can throw error here, because now all our calls are transactional) - storage.ensure_no_unused_nodes() - }, - ) - .and_then(|r| r.map_err(HeaderChainError::StorageProof)) - .map_err(|e| { - log::trace!(target: LOG_TARGET, "Parachain heads storage proof is invalid: {:?}", e); - Error::::HeaderChain(e) + // even though we may have accepted some parachain heads, we can't allow relayers to + // submit proof with unused trie nodes + // => treat this as an error + // + // (we can throw error here, because now all our calls are transactional) + storage.ensure_no_unused_nodes().map_err(|e| { + Error::::HeaderChainStorageProof(HeaderChainError::StorageProof(e)) })?; Ok(PostDispatchInfo { actual_weight: Some(actual_weight), pays_fee: Pays::Yes }) @@ -614,6 +611,7 @@ pub mod pallet { } #[pallet::genesis_config] + #[derive(DefaultNoBound)] pub struct GenesisConfig, I: 'static = ()> { /// Initial pallet operating mode. pub operating_mode: BasicOperatingMode, @@ -623,17 +621,6 @@ pub mod pallet { pub phantom: sp_std::marker::PhantomData, } - #[cfg(feature = "std")] - impl, I: 'static> Default for GenesisConfig { - fn default() -> Self { - Self { - operating_mode: Default::default(), - owner: Default::default(), - phantom: Default::default(), - } - } - } - #[pallet::genesis_build] impl, I: 'static> GenesisBuild for GenesisConfig { fn build(&self) { @@ -704,16 +691,17 @@ pub(crate) mod tests { use crate::mock::{ run_test, test_relay_header, BigParachainHeader, RegularParachainHasher, RegularParachainHeader, RuntimeEvent as TestEvent, RuntimeOrigin, TestRuntime, - PARAS_PALLET_NAME, UNTRACKED_PARACHAIN_ID, + UNTRACKED_PARACHAIN_ID, }; + use bp_test_utils::prepare_parachain_heads_proof; use codec::Encode; use bp_parachains::{ BestParaHeadHash, BridgeParachainCall, ImportedParaHeadsKeyProvider, ParasInfoKeyProvider, }; use bp_runtime::{ - record_all_trie_keys, BasicOperatingMode, OwnedBridgeModuleError, - StorageDoubleMapKeyProvider, StorageMapKeyProvider, + BasicOperatingMode, OwnedBridgeModuleError, StorageDoubleMapKeyProvider, + StorageMapKeyProvider, }; use bp_test_utils::{ authority_list, generate_owned_bridge_module_tests, make_default_justification, @@ -728,7 +716,6 @@ pub(crate) mod tests { use frame_system::{EventRecord, Pallet as System, Phase}; use sp_core::Hasher; use sp_runtime::{traits::Header as HeaderT, DispatchError}; - use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut}; type BridgesGrandpaPalletInstance = pallet_bridge_grandpa::Instance1; type WeightInfo = ::WeightInfo; @@ -771,32 +758,6 @@ pub(crate) mod tests { hash } - pub(crate) fn prepare_parachain_heads_proof( - heads: Vec<(u32, ParaHead)>, - ) -> (RelayBlockHash, ParaHeadsProof, Vec<(ParaId, ParaHash)>) { - let mut parachains = Vec::with_capacity(heads.len()); - let mut root = Default::default(); - let mut mdb = MemoryDB::default(); - { - let mut trie = TrieDBMutBuilderV1::::new(&mut mdb, &mut root).build(); - for (parachain, head) in heads { - let storage_key = - parachain_head_storage_key_at_source(PARAS_PALLET_NAME, ParaId(parachain)); - trie.insert(&storage_key.0, &head.encode()) - .map_err(|_| "TrieMut::insert has failed") - .expect("TrieMut::insert should not fail in tests"); - parachains.push((ParaId(parachain), head.hash())); - } - } - - // generate storage proof to be delivered to This chain - let storage_proof = record_all_trie_keys::, _>(&mdb, &root) - .map_err(|_| "record_all_trie_keys has failed") - .expect("record_all_trie_keys should not fail in benchmarks"); - - (root, ParaHeadsProof(storage_proof), parachains) - } - fn initial_best_head(parachain: u32) -> ParaInfo { ParaInfo { best_head_hash: BestParaHeadHash { @@ -878,7 +839,7 @@ pub(crate) mod tests { #[test] fn submit_parachain_heads_checks_operating_mode() { let (state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 0))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 0))]); run_test(|| { initialize(state_root); @@ -909,7 +870,10 @@ pub(crate) mod tests { #[test] fn imports_initial_parachain_heads() { let (state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 0)), (3, head_data(3, 10))]); + prepare_parachain_heads_proof::(vec![ + (1, head_data(1, 0)), + (3, head_data(3, 10)), + ]); run_test(|| { initialize(state_root); @@ -988,9 +952,9 @@ pub(crate) mod tests { #[test] fn imports_parachain_heads_is_able_to_progress() { let (state_root_5, proof_5, parachains_5) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 5))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 5))]); let (state_root_10, proof_10, parachains_10) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 10))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 10))]); run_test(|| { // start with relay block #0 and import head#5 of parachain#1 initialize(state_root_5); @@ -1086,11 +1050,12 @@ pub(crate) mod tests { #[test] fn ignores_untracked_parachain() { - let (state_root, proof, parachains) = prepare_parachain_heads_proof(vec![ - (1, head_data(1, 5)), - (UNTRACKED_PARACHAIN_ID, head_data(1, 5)), - (2, head_data(1, 5)), - ]); + let (state_root, proof, parachains) = + prepare_parachain_heads_proof::(vec![ + (1, head_data(1, 5)), + (UNTRACKED_PARACHAIN_ID, head_data(1, 5)), + (2, head_data(1, 5)), + ]); run_test(|| { // start with relay block #0 and try to import head#5 of parachain#1 and untracked // parachain @@ -1163,7 +1128,7 @@ pub(crate) mod tests { #[test] fn does_nothing_when_already_imported_this_head_at_previous_relay_header() { let (state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 0))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 0))]); run_test(|| { // import head#0 of parachain#1 at relay block#0 initialize(state_root); @@ -1223,9 +1188,9 @@ pub(crate) mod tests { #[test] fn does_nothing_when_already_imported_head_at_better_relay_header() { let (state_root_5, proof_5, parachains_5) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 5))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 5))]); let (state_root_10, proof_10, parachains_10) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 10))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 10))]); run_test(|| { // start with relay block #0 initialize(state_root_5); @@ -1317,7 +1282,10 @@ pub(crate) mod tests { #[test] fn does_nothing_when_parachain_head_is_too_large() { let (state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 5)), (4, big_head_data(1, 5))]); + prepare_parachain_heads_proof::(vec![ + (1, head_data(1, 5)), + (4, big_head_data(1, 5)), + ]); run_test(|| { // start with relay block #0 and try to import head#5 of parachain#1 and big parachain initialize(state_root); @@ -1371,8 +1339,9 @@ pub(crate) mod tests { // import exactly `HeadsToKeep` headers for i in 0..heads_to_keep { - let (state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, i))]); + let (state_root, proof, parachains) = prepare_parachain_heads_proof::< + RegularParachainHeader, + >(vec![(1, head_data(1, i))]); if i == 0 { initialize(state_root); } else { @@ -1392,8 +1361,9 @@ pub(crate) mod tests { } // import next relay chain header and next parachain head - let (state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, heads_to_keep))]); + let (state_root, proof, parachains) = prepare_parachain_heads_proof::< + RegularParachainHeader, + >(vec![(1, head_data(1, heads_to_keep))]); proceed(heads_to_keep, state_root); let expected_weight = weight_of_import_parachain_1_head(&proof, true); let result = import_parachain_1_head(heads_to_keep, state_root, parachains, proof); @@ -1414,7 +1384,7 @@ pub(crate) mod tests { #[test] fn fails_on_unknown_relay_chain_block() { let (state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 5))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 5))]); run_test(|| { // start with relay block #0 initialize(state_root); @@ -1430,7 +1400,7 @@ pub(crate) mod tests { #[test] fn fails_on_invalid_storage_proof() { let (_state_root, proof, parachains) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 5))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 5))]); run_test(|| { // start with relay block #0 initialize(Default::default()); @@ -1438,7 +1408,7 @@ pub(crate) mod tests { // try to import head#5 of parachain#1 at relay chain block #0 assert_noop!( import_parachain_1_head(0, Default::default(), parachains, proof), - Error::::HeaderChain(HeaderChainError::StorageProof( + Error::::HeaderChainStorageProof(HeaderChainError::StorageProof( StorageProofError::StorageRootMismatch )) ); @@ -1448,11 +1418,11 @@ pub(crate) mod tests { #[test] fn is_not_rewriting_existing_head_if_failed_to_read_updated_head() { let (state_root_5, proof_5, parachains_5) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 5))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 5))]); let (state_root_10_at_20, proof_10_at_20, parachains_10_at_20) = - prepare_parachain_heads_proof(vec![(2, head_data(2, 10))]); + prepare_parachain_heads_proof::(vec![(2, head_data(2, 10))]); let (state_root_10_at_30, proof_10_at_30, parachains_10_at_30) = - prepare_parachain_heads_proof(vec![(1, head_data(1, 10))]); + prepare_parachain_heads_proof::(vec![(1, head_data(1, 10))]); run_test(|| { // we've already imported head#5 of parachain#1 at relay block#10 initialize(state_root_5); @@ -1520,7 +1490,8 @@ pub(crate) mod tests { #[test] fn ignores_parachain_head_if_it_is_missing_from_storage_proof() { - let (state_root, proof, _) = prepare_parachain_heads_proof(vec![]); + let (state_root, proof, _) = + prepare_parachain_heads_proof::(vec![]); let parachains = vec![(ParaId(2), Default::default())]; run_test(|| { initialize(state_root); @@ -1545,7 +1516,8 @@ pub(crate) mod tests { #[test] fn ignores_parachain_head_if_parachain_head_hash_is_wrong() { - let (state_root, proof, _) = prepare_parachain_heads_proof(vec![(1, head_data(1, 0))]); + let (state_root, proof, _) = + prepare_parachain_heads_proof::(vec![(1, head_data(1, 0))]); let parachains = vec![(ParaId(1), head_data(1, 10).hash())]; run_test(|| { initialize(state_root); @@ -1572,7 +1544,8 @@ pub(crate) mod tests { #[test] fn test_bridge_parachain_call_is_correctly_defined() { - let (state_root, proof, _) = prepare_parachain_heads_proof(vec![(1, head_data(1, 0))]); + let (state_root, proof, _) = + prepare_parachain_heads_proof::(vec![(1, head_data(1, 0))]); let parachains = vec![(ParaId(2), Default::default())]; let relay_header_id = (0, test_relay_header(0, state_root).hash()); diff --git a/bridges/modules/parachains/src/mock.rs b/bridges/modules/parachains/src/mock.rs index 3086adc1cc2..0a61d91d7b2 100644 --- a/bridges/modules/parachains/src/mock.rs +++ b/bridges/modules/parachains/src/mock.rs @@ -250,9 +250,10 @@ impl pallet_bridge_parachains::benchmarking::Config<()> for TestRuntime { ) { // in mock run we only care about benchmarks correctness, not the benchmark results // => ignore size related arguments - let (state_root, proof, parachains) = crate::tests::prepare_parachain_heads_proof( - parachains.iter().map(|p| (p.0, crate::tests::head_data(p.0, 1))).collect(), - ); + let (state_root, proof, parachains) = + bp_test_utils::prepare_parachain_heads_proof::( + parachains.iter().map(|p| (p.0, crate::tests::head_data(p.0, 1))).collect(), + ); let relay_genesis_hash = crate::tests::initialize(state_root); (0, relay_genesis_hash, proof, parachains) } diff --git a/bridges/modules/relayers/Cargo.toml b/bridges/modules/relayers/Cargo.toml index 857d47cc65a..2a504b0e090 100644 --- a/bridges/modules/relayers/Cargo.toml +++ b/bridges/modules/relayers/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/modules/relayers/src/mock.rs b/bridges/modules/relayers/src/mock.rs index 69d8418a024..d8c5bd90967 100644 --- a/bridges/modules/relayers/src/mock.rs +++ b/bridges/modules/relayers/src/mock.rs @@ -102,7 +102,7 @@ impl pallet_balances::Config for TestRuntime { type WeightInfo = (); type MaxReserves = ConstU32<1>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; diff --git a/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs b/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs index 6ca2cd047fb..00b6c8301e4 100644 --- a/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs @@ -72,12 +72,10 @@ pub type Address = MultiAddress; pub const BRIDGE_HUB_KUSAMA_PARACHAIN_ID: u32 = 1002; /// Name of the With-BridgeHubKusama messages pallet instance that is deployed at bridged chains. -// TODO: check me (https://github.com/paritytech/parity-bridges-common/issues/1945) pub const WITH_BRIDGE_HUB_KUSAMA_MESSAGES_PALLET_NAME: &str = "BridgeKusamaMessages"; /// Name of the With-BridgeHubKusama bridge-relayers pallet instance that is deployed at bridged /// chains. -// TODO: check me (https://github.com/paritytech/parity-bridges-common/issues/1945) pub const WITH_BRIDGE_HUB_KUSAMA_RELAYERS_PALLET_NAME: &str = "BridgeRelayers"; decl_bridge_finality_runtime_apis!(bridge_hub_kusama); diff --git a/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs b/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs index 646fb0a6e41..8bd9167b618 100644 --- a/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs @@ -59,16 +59,13 @@ impl Parachain for BridgeHubPolkadot { } /// Identifier of BridgeHubPolkadot in the Polkadot relay chain. -// TODO: check me (https://github.com/paritytech/parity-bridges-common/issues/1945) pub const BRIDGE_HUB_POLKADOT_PARACHAIN_ID: u32 = 1002; /// Name of the With-BridgeHubPolkadot messages pallet instance that is deployed at bridged chains. -// TODO: check me (https://github.com/paritytech/parity-bridges-common/issues/1945) pub const WITH_BRIDGE_HUB_POLKADOT_MESSAGES_PALLET_NAME: &str = "BridgePolkadotMessages"; /// Name of the With-BridgeHubPolkadot bridge-relayers pallet instance that is deployed at bridged /// chains. -// TODO: check me (https://github.com/paritytech/parity-bridges-common/issues/1945) pub const WITH_BRIDGE_HUB_POLKADOT_RELAYERS_PALLET_NAME: &str = "BridgeRelayers"; decl_bridge_finality_runtime_apis!(bridge_hub_polkadot); diff --git a/bridges/primitives/chain-kusama/src/lib.rs b/bridges/primitives/chain-kusama/src/lib.rs index 8e5aec8afda..5cef6ae0ee6 100644 --- a/bridges/primitives/chain-kusama/src/lib.rs +++ b/bridges/primitives/chain-kusama/src/lib.rs @@ -62,4 +62,11 @@ pub const PARAS_PALLET_NAME: &str = "Paras"; /// Name of the With-Kusama GRANDPA pallet instance that is deployed at bridged chains. pub const WITH_KUSAMA_GRANDPA_PALLET_NAME: &str = "BridgeKusamaGrandpa"; +/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Polkadot +/// parachains. +/// +/// It includes the block number and state root, so it shall be near 40 bytes, but let's have some +/// reserve. +pub const MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE: u32 = 128; + decl_bridge_finality_runtime_apis!(kusama); diff --git a/bridges/primitives/chain-polkadot/src/lib.rs b/bridges/primitives/chain-polkadot/src/lib.rs index 92995601698..51d9f6f0233 100644 --- a/bridges/primitives/chain-polkadot/src/lib.rs +++ b/bridges/primitives/chain-polkadot/src/lib.rs @@ -62,4 +62,11 @@ pub const PARAS_PALLET_NAME: &str = "Paras"; /// Name of the With-Polkadot GRANDPA pallet instance that is deployed at bridged chains. pub const WITH_POLKADOT_GRANDPA_PALLET_NAME: &str = "BridgePolkadotGrandpa"; +/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Polkadot +/// parachains. +/// +/// It includes the block number and state root, so it shall be near 40 bytes, but let's have some +/// reserve. +pub const MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE: u32 = 128; + decl_bridge_finality_runtime_apis!(polkadot); diff --git a/bridges/primitives/header-chain/src/justification.rs b/bridges/primitives/header-chain/src/justification.rs index 06ed782763d..8433107fce2 100644 --- a/bridges/primitives/header-chain/src/justification.rs +++ b/bridges/primitives/header-chain/src/justification.rs @@ -38,7 +38,7 @@ use sp_std::{ /// /// This particular proof is used to prove that headers on a bridged chain /// (so not our chain) have been finalized correctly. -#[derive(Encode, Decode, RuntimeDebug, Clone, PartialEq, Eq, TypeInfo)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] pub struct GrandpaJustification { /// The round (voting period) this justification is valid for. pub round: u64, @@ -49,6 +49,25 @@ pub struct GrandpaJustification { pub votes_ancestries: Vec
, } +// TODO: remove and use `RuntimeDebug` (https://github.com/paritytech/parity-bridges-common/issues/2136) +impl sp_std::fmt::Debug for GrandpaJustification
{ + fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + #[cfg(feature = "std")] + { + fmt.debug_struct("GrandpaJustification") + .field("round", &self.round) + .field("commit", &self.commit) + .field("votes_ancestries", &self.votes_ancestries) + .finish() + } + + #[cfg(not(feature = "std"))] + { + fmt.write_str("") + } + } +} + impl GrandpaJustification { /// Returns reasonable size of justification using constants from the provided chain. /// diff --git a/bridges/primitives/header-chain/src/lib.rs b/bridges/primitives/header-chain/src/lib.rs index 5e2bbad242e..5b278454728 100644 --- a/bridges/primitives/header-chain/src/lib.rs +++ b/bridges/primitives/header-chain/src/lib.rs @@ -73,18 +73,14 @@ impl StoredHeaderDataBuilder for H { pub trait HeaderChain { /// Returns state (storage) root of given finalized header. fn finalized_header_state_root(header_hash: HashOf) -> Option>; - /// Parse storage proof using finalized header. - fn parse_finalized_storage_proof( + /// Get storage proof checker using finalized header. + fn storage_proof_checker( header_hash: HashOf, storage_proof: RawStorageProof, - parse: impl FnOnce(StorageProofChecker>) -> R, - ) -> Result { + ) -> Result>, HeaderChainError> { let state_root = Self::finalized_header_state_root(header_hash) .ok_or(HeaderChainError::UnknownHeader)?; - let storage_proof_checker = bp_runtime::StorageProofChecker::new(state_root, storage_proof) - .map_err(HeaderChainError::StorageProof)?; - - Ok(parse(storage_proof_checker)) + StorageProofChecker::new(state_root, storage_proof).map_err(HeaderChainError::StorageProof) } } diff --git a/bridges/primitives/messages/Cargo.toml b/bridges/primitives/messages/Cargo.toml index 32a89f6cf78..cb35b4ae65b 100644 --- a/bridges/primitives/messages/Cargo.toml +++ b/bridges/primitives/messages/Cargo.toml @@ -14,6 +14,7 @@ serde = { version = "1.0", optional = true, features = ["derive"] } # Bridge dependencies bp-runtime = { path = "../runtime", default-features = false } +bp-header-chain = { path = "../header-chain", default-features = false } # Substrate Dependencies @@ -29,6 +30,7 @@ hex-literal = "0.4" default = ["std"] std = [ "bp-runtime/std", + "bp-header-chain/std", "codec/std", "frame-support/std", "scale-info/std", diff --git a/bridges/primitives/messages/src/lib.rs b/bridges/primitives/messages/src/lib.rs index e485aa2f801..8f6c9466109 100644 --- a/bridges/primitives/messages/src/lib.rs +++ b/bridges/primitives/messages/src/lib.rs @@ -20,9 +20,15 @@ // RuntimeApi generated functions #![allow(clippy::too_many_arguments)] -use bp_runtime::{BasicOperatingMode, OperatingMode, RangeInclusiveExt}; +use bp_header_chain::HeaderChainError; +use bp_runtime::{ + messages::MessageDispatchResult, BasicOperatingMode, OperatingMode, RangeInclusiveExt, + StorageProofError, +}; use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::RuntimeDebug; +use frame_support::{PalletError, RuntimeDebug}; +// Weight is reexported to avoid additional frame-support dependencies in related crates. +pub use frame_support::weights::Weight; use scale_info::TypeInfo; use source_chain::RelayersRewards; use sp_core::TypeId; @@ -32,10 +38,6 @@ pub mod source_chain; pub mod storage_keys; pub mod target_chain; -use bp_runtime::messages::MessageDispatchResult; -// Weight is reexported to avoid additional frame-support dependencies in related crates. -pub use frame_support::weights::Weight; - /// Messages pallet operating mode. #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] @@ -189,6 +191,17 @@ impl InboundLaneData { .map(|entry| entry.messages.end) .unwrap_or(self.last_confirmed_nonce) } + + /// Returns the total number of messages in the `relayers` vector, + /// saturating in case of underflow or overflow. + pub fn total_unrewarded_messages(&self) -> MessageNonce { + let relayers = &self.relayers; + match (relayers.front(), relayers.back()) { + (Some(front), Some(back)) => + (front.messages.begin..=back.messages.end).saturating_len(), + _ => 0, + } + } } /// Outbound message details, returned by runtime APIs. @@ -285,7 +298,7 @@ impl DeliveredMessages { /// Return total count of delivered messages. pub fn total_messages(&self) -> MessageNonce { - (self.begin..=self.end).checked_len().unwrap_or(0) + (self.begin..=self.end).saturating_len() } /// Note new dispatched message. @@ -316,6 +329,13 @@ pub struct UnrewardedRelayersState { pub last_delivered_nonce: MessageNonce, } +impl UnrewardedRelayersState { + // Verify that the relayers state corresponds with the `InboundLaneData`. + pub fn is_valid(&self, lane_data: &InboundLaneData) -> bool { + self == &lane_data.into() + } +} + impl From<&InboundLaneData> for UnrewardedRelayersState { fn from(lane: &InboundLaneData) -> UnrewardedRelayersState { UnrewardedRelayersState { @@ -323,9 +343,9 @@ impl From<&InboundLaneData> for UnrewardedRelayersState { messages_in_oldest_entry: lane .relayers .front() - .and_then(|entry| (entry.messages.begin..=entry.messages.end).checked_len()) + .map(|entry| entry.messages.total_messages()) .unwrap_or(0), - total_messages: total_unrewarded_messages(&lane.relayers).unwrap_or(MessageNonce::MAX), + total_messages: lane.total_unrewarded_messages(), last_delivered_nonce: lane.last_delivered_nonce(), } } @@ -355,24 +375,6 @@ impl Default for OutboundLaneData { } } -/// Returns total number of messages in the `InboundLaneData::relayers` vector. -/// -/// Returns `None` if there are more messages that `MessageNonce` may fit (i.e. `MessageNonce + 1`). -pub fn total_unrewarded_messages( - relayers: &VecDeque>, -) -> Option { - match (relayers.front(), relayers.back()) { - (Some(front), Some(back)) => { - if let Some(difference) = back.messages.end.checked_sub(front.messages.begin) { - difference.checked_add(1) - } else { - Some(0) - } - }, - _ => Some(0), - } -} - /// Calculate the number of messages that the relayers have delivered. pub fn calc_relayers_rewards( messages_relayers: VecDeque>, @@ -414,26 +416,50 @@ pub enum BridgeMessagesCall { }, } +/// Error that happens during message verification. +#[derive(Encode, Decode, RuntimeDebug, PartialEq, Eq, PalletError, TypeInfo)] +pub enum VerificationError { + /// The message proof is empty. + EmptyMessageProof, + /// Error returned by the bridged header chain. + HeaderChain(HeaderChainError), + /// Error returned while reading/decoding inbound lane data from the storage proof. + InboundLaneStorage(StorageProofError), + /// The declared message weight is incorrect. + InvalidMessageWeight, + /// Declared messages count doesn't match actual value. + MessagesCountMismatch, + /// Error returned while reading/decoding message data from the storage proof. + MessageStorage(StorageProofError), + /// The message is too large. + MessageTooLarge, + /// Error returned while reading/decoding outbound lane data from the storage proof. + OutboundLaneStorage(StorageProofError), + /// Storage proof related error. + StorageProof(StorageProofError), + /// Custom error + Other(#[codec(skip)] &'static str), +} + #[cfg(test)] mod tests { use super::*; #[test] fn total_unrewarded_messages_does_not_overflow() { - assert_eq!( - total_unrewarded_messages( - &vec![ - UnrewardedRelayer { relayer: 1, messages: DeliveredMessages::new(0) }, - UnrewardedRelayer { - relayer: 2, - messages: DeliveredMessages::new(MessageNonce::MAX) - }, - ] - .into_iter() - .collect() - ), - None, - ); + let lane_data = InboundLaneData { + relayers: vec![ + UnrewardedRelayer { relayer: 1, messages: DeliveredMessages::new(0) }, + UnrewardedRelayer { + relayer: 2, + messages: DeliveredMessages::new(MessageNonce::MAX), + }, + ] + .into_iter() + .collect(), + last_confirmed_nonce: 0, + }; + assert_eq!(lane_data.total_unrewarded_messages(), MessageNonce::MAX); } #[test] diff --git a/bridges/primitives/messages/src/source_chain.rs b/bridges/primitives/messages/src/source_chain.rs index 394a934171f..f3c50b84a09 100644 --- a/bridges/primitives/messages/src/source_chain.rs +++ b/bridges/primitives/messages/src/source_chain.rs @@ -16,7 +16,7 @@ //! Primitives of messages module, that are used on the source chain. -use crate::{InboundLaneData, LaneId, MessageNonce, OutboundLaneData}; +use crate::{InboundLaneData, LaneId, MessageNonce, OutboundLaneData, VerificationError}; use crate::UnrewardedRelayer; use bp_runtime::Size; @@ -40,9 +40,6 @@ pub type RelayersRewards = BTreeMap; /// source chain to the target chain. The `AccountId` type here means the account /// type used by the source chain. pub trait TargetHeaderChain { - /// Error type. - type Error: Debug; - /// Proof that messages have been received by target chain. type MessagesDeliveryProof: Parameter + Size; @@ -58,12 +55,12 @@ pub trait TargetHeaderChain { /// 1MB. BTC nodes aren't accepting transactions that are larger than 1MB, so relayer /// will be unable to craft valid transaction => this (and all subsequent) messages will /// never be delivered. - fn verify_message(payload: &Payload) -> Result<(), Self::Error>; + fn verify_message(payload: &Payload) -> Result<(), VerificationError>; /// Verify messages delivery proof and return lane && nonce of the latest received message. fn verify_messages_delivery_proof( proof: Self::MessagesDeliveryProof, - ) -> Result<(LaneId, InboundLaneData), Self::Error>; + ) -> Result<(LaneId, InboundLaneData), VerificationError>; } /// Lane message verifier. @@ -75,9 +72,6 @@ pub trait TargetHeaderChain { /// /// Any fee requirements should also be enforced here. pub trait LaneMessageVerifier { - /// Error type. - type Error: Debug + Into<&'static str>; - /// Verify message payload and return Ok(()) if message is valid and allowed to be sent over the /// lane. fn verify_message( @@ -85,7 +79,7 @@ pub trait LaneMessageVerifier { lane: &LaneId, outbound_data: &OutboundLaneData, payload: &Payload, - ) -> Result<(), Self::Error>; + ) -> Result<(), VerificationError>; } /// Manages payments that are happening at the source chain during delivery confirmation @@ -169,31 +163,27 @@ const ALL_OUTBOUND_MESSAGES_REJECTED: &str = "This chain is configured to reject all outbound messages"; impl TargetHeaderChain for ForbidOutboundMessages { - type Error = &'static str; - type MessagesDeliveryProof = (); - fn verify_message(_payload: &Payload) -> Result<(), Self::Error> { - Err(ALL_OUTBOUND_MESSAGES_REJECTED) + fn verify_message(_payload: &Payload) -> Result<(), VerificationError> { + Err(VerificationError::Other(ALL_OUTBOUND_MESSAGES_REJECTED)) } fn verify_messages_delivery_proof( _proof: Self::MessagesDeliveryProof, - ) -> Result<(LaneId, InboundLaneData), Self::Error> { - Err(ALL_OUTBOUND_MESSAGES_REJECTED) + ) -> Result<(LaneId, InboundLaneData), VerificationError> { + Err(VerificationError::Other(ALL_OUTBOUND_MESSAGES_REJECTED)) } } impl LaneMessageVerifier for ForbidOutboundMessages { - type Error = &'static str; - fn verify_message( _submitter: &SenderOrigin, _lane: &LaneId, _outbound_data: &OutboundLaneData, _payload: &Payload, - ) -> Result<(), Self::Error> { - Err(ALL_OUTBOUND_MESSAGES_REJECTED) + ) -> Result<(), VerificationError> { + Err(VerificationError::Other(ALL_OUTBOUND_MESSAGES_REJECTED)) } } diff --git a/bridges/primitives/messages/src/target_chain.rs b/bridges/primitives/messages/src/target_chain.rs index 3c2e8cf0cb0..385bc4ac373 100644 --- a/bridges/primitives/messages/src/target_chain.rs +++ b/bridges/primitives/messages/src/target_chain.rs @@ -16,7 +16,9 @@ //! Primitives of messages module, that are used on the target chain. -use crate::{LaneId, Message, MessageKey, MessageNonce, MessagePayload, OutboundLaneData}; +use crate::{ + LaneId, Message, MessageKey, MessageNonce, MessagePayload, OutboundLaneData, VerificationError, +}; use bp_runtime::{messages::MessageDispatchResult, Size}; use codec::{Decode, Encode, Error as CodecError}; @@ -58,9 +60,6 @@ pub struct DispatchMessage { /// can't change. Wrong implementation may lead to invalid lane states (i.e. lane /// that's stuck) and/or processing messages without paying fees. pub trait SourceHeaderChain { - /// Error type. - type Error: Debug; - /// Proof that messages are sent from source chain. This may also include proof /// of corresponding outbound lane states. type MessagesProof: Parameter + Size; @@ -79,7 +78,7 @@ pub trait SourceHeaderChain { fn verify_messages_proof( proof: Self::MessagesProof, messages_count: u32, - ) -> Result, Self::Error>; + ) -> Result, VerificationError>; } /// Called when inbound message is received. @@ -164,21 +163,20 @@ pub struct ForbidInboundMessages( PhantomData<(MessagesProof, DispatchPayload)>, ); -/// Error message that is used in `ForbidOutboundMessages` implementation. +/// Error message that is used in `ForbidInboundMessages` implementation. const ALL_INBOUND_MESSAGES_REJECTED: &str = "This chain is configured to reject all inbound messages"; impl SourceHeaderChain for ForbidInboundMessages { - type Error = &'static str; type MessagesProof = MessagesProof; fn verify_messages_proof( _proof: Self::MessagesProof, _messages_count: u32, - ) -> Result, Self::Error> { - Err(ALL_INBOUND_MESSAGES_REJECTED) + ) -> Result, VerificationError> { + Err(VerificationError::Other(ALL_INBOUND_MESSAGES_REJECTED)) } } diff --git a/bridges/primitives/polkadot-core/src/parachains.rs b/bridges/primitives/polkadot-core/src/parachains.rs index 0b410dff49f..9cac3279c72 100644 --- a/bridges/primitives/polkadot-core/src/parachains.rs +++ b/bridges/primitives/polkadot-core/src/parachains.rs @@ -18,8 +18,8 @@ //! //! Even though this (bridges) repository references polkadot repository, we can't //! reference polkadot crates from pallets. That's because bridges repository is -//! included in the polkadot repository and included pallets are used by polkadot -//! chains. Having pallets that are referencing polkadot, would mean that there may +//! included in the Cumulus repository and included pallets are used by Cumulus +//! parachains. Having pallets that are referencing polkadot, would mean that there may //! be two versions of polkadot crates included in the runtime. Which is bad. use bp_runtime::{RawStorageProof, Size}; diff --git a/bridges/primitives/runtime/src/chain.rs b/bridges/primitives/runtime/src/chain.rs index 94b3a193c58..c79058cea90 100644 --- a/bridges/primitives/runtime/src/chain.rs +++ b/bridges/primitives/runtime/src/chain.rs @@ -232,6 +232,14 @@ where const PARACHAIN_ID: u32 = <::Chain as Parachain>::PARACHAIN_ID; } +/// Adapter for `Get` to access `PARACHAIN_ID` from `trait Parachain` +pub struct ParachainIdOf(sp_std::marker::PhantomData); +impl frame_support::traits::Get for ParachainIdOf { + fn get() -> u32 { + Para::PARACHAIN_ID + } +} + /// Underlying chain type. pub type UnderlyingChainOf = ::Chain; diff --git a/bridges/primitives/runtime/src/lib.rs b/bridges/primitives/runtime/src/lib.rs index df77745bc02..1922a2eb160 100644 --- a/bridges/primitives/runtime/src/lib.rs +++ b/bridges/primitives/runtime/src/lib.rs @@ -31,11 +31,11 @@ use sp_std::{convert::TryFrom, fmt::Debug, ops::RangeInclusive, vec, vec::Vec}; pub use chain::{ AccountIdOf, AccountPublicOf, BalanceOf, BlockNumberOf, Chain, EncodedOrDecodedCall, HashOf, - HasherOf, HeaderOf, IndexOf, Parachain, SignatureOf, TransactionEraOf, UnderlyingChainOf, - UnderlyingChainProvider, + HasherOf, HeaderOf, IndexOf, Parachain, ParachainIdOf, SignatureOf, TransactionEraOf, + UnderlyingChainOf, UnderlyingChainProvider, }; pub use frame_support::storage::storage_prefix as storage_value_final_key; -use num_traits::{CheckedAdd, CheckedSub, One}; +use num_traits::{CheckedAdd, CheckedSub, One, SaturatingAdd, Zero}; pub use storage_proof::{ record_all_keys as record_all_trie_keys, Error as StorageProofError, ProofSize as StorageProofSize, RawStorageProof, StorageProofChecker, @@ -95,7 +95,7 @@ pub const BRIDGE_HUB_WOCOCO_CHAIN_ID: ChainId = *b"bhwo"; pub const BRIDGE_HUB_KUSAMA_CHAIN_ID: ChainId = *b"bhks"; /// BridgeHubPolkadot chain id. -pub const BRIDGE_HUB_POLKADOT_CHAIN_ID: ChainId = *b"bhwo"; +pub const BRIDGE_HUB_POLKADOT_CHAIN_ID: ChainId = *b"bhpd"; /// Generic header Id. #[derive( @@ -527,17 +527,27 @@ impl Debug for StrippableError { pub trait RangeInclusiveExt { /// Computes the length of the `RangeInclusive`, checking for underflow and overflow. fn checked_len(&self) -> Option; + /// Computes the length of the `RangeInclusive`, saturating in case of underflow or overflow. + fn saturating_len(&self) -> Idx; } impl RangeInclusiveExt for RangeInclusive where - Idx: CheckedSub + CheckedAdd + One, + Idx: CheckedSub + CheckedAdd + SaturatingAdd + One + Zero, { fn checked_len(&self) -> Option { self.end() .checked_sub(self.start()) .and_then(|len| len.checked_add(&Idx::one())) } + + fn saturating_len(&self) -> Idx { + let len = match self.end().checked_sub(self.start()) { + Some(len) => len, + None => return Idx::zero(), + }; + len.saturating_add(&Idx::one()) + } } #[cfg(test)] diff --git a/bridges/primitives/test-utils/Cargo.toml b/bridges/primitives/test-utils/Cargo.toml index 5ed835857d1..2e2af99332e 100644 --- a/bridges/primitives/test-utils/Cargo.toml +++ b/bridges/primitives/test-utils/Cargo.toml @@ -7,23 +7,30 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] bp-header-chain = { path = "../header-chain", default-features = false } +bp-parachains = { path = "../parachains", default-features = false } +bp-polkadot-core = { path = "../polkadot-core", default-features = false } +bp-runtime = { path = "../runtime", default-features = false } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] } finality-grandpa = { version = "0.16.2", default-features = false } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } [features] default = ["std"] std = [ "bp-header-chain/std", + "bp-polkadot-core/std", "codec/std", "ed25519-dalek/std", "finality-grandpa/std", "sp-application-crypto/std", "sp-consensus-grandpa/std", + "sp-core/std", "sp-runtime/std", "sp-std/std", ] diff --git a/bridges/primitives/test-utils/src/lib.rs b/bridges/primitives/test-utils/src/lib.rs index 6bb4adbf450..5a7d0cca279 100644 --- a/bridges/primitives/test-utils/src/lib.rs +++ b/bridges/primitives/test-utils/src/lib.rs @@ -19,10 +19,14 @@ #![cfg_attr(not(feature = "std"), no_std)] use bp_header_chain::justification::{required_justification_precommits, GrandpaJustification}; +use bp_parachains::parachain_head_storage_key_at_source; +use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId}; +use bp_runtime::record_all_trie_keys; use codec::Encode; use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, AuthorityWeight, SetId}; use sp_runtime::traits::{Header as HeaderT, One, Zero}; use sp_std::prelude::*; +use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut}; // Re-export all our test account utilities pub use keyring::*; @@ -31,6 +35,7 @@ mod keyring; pub const TEST_GRANDPA_ROUND: u64 = 1; pub const TEST_GRANDPA_SET_ID: SetId = 1; +pub const PARAS_PALLET_NAME: &str = "Paras"; /// Configuration parameters when generating test GRANDPA justifications. #[derive(Clone)] @@ -161,6 +166,33 @@ fn generate_chain(fork_id: u32, depth: u32, ancestor: &H) -> Vec headers } +/// Make valid proof for parachain `heads` +pub fn prepare_parachain_heads_proof( + heads: Vec<(u32, ParaHead)>, +) -> (H::Hash, ParaHeadsProof, Vec<(ParaId, ParaHash)>) { + let mut parachains = Vec::with_capacity(heads.len()); + let mut root = Default::default(); + let mut mdb = MemoryDB::default(); + { + let mut trie = TrieDBMutBuilderV1::::new(&mut mdb, &mut root).build(); + for (parachain, head) in heads { + let storage_key = + parachain_head_storage_key_at_source(PARAS_PALLET_NAME, ParaId(parachain)); + trie.insert(&storage_key.0, &head.encode()) + .map_err(|_| "TrieMut::insert has failed") + .expect("TrieMut::insert should not fail in tests"); + parachains.push((ParaId(parachain), head.hash())); + } + } + + // generate storage proof to be delivered to This chain + let storage_proof = record_all_trie_keys::, _>(&mdb, &root) + .map_err(|_| "record_all_trie_keys has failed") + .expect("record_all_trie_keys should not fail in benchmarks"); + + (root, ParaHeadsProof(storage_proof), parachains) +} + /// Create signed precommit with given target. pub fn signed_precommit( signer: &Account, @@ -207,6 +239,15 @@ pub fn test_header(number: H::Number) -> H { header } +/// Get a header for testing with given `state_root`. +/// +/// The correct parent hash will be used if given a non-zero header. +pub fn test_header_with_root(number: H::Number, state_root: H::Hash) -> H { + let mut header: H = test_header(number); + header.set_state_root(state_root); + header +} + /// Convenience function for generating a Header ID at a given block number. pub fn header_id(index: u8) -> (H::Hash, H::Number) { (test_header::(index.into()).hash(), index.into()) diff --git a/bridges/scripts/verify-pallets-build.sh b/bridges/scripts/verify-pallets-build.sh index dfee5341673..2230d68a9c4 100755 --- a/bridges/scripts/verify-pallets-build.sh +++ b/bridges/scripts/verify-pallets-build.sh @@ -127,6 +127,7 @@ cargo check -p pallet-bridge-relayers --features runtime-benchmarks cargo check -p pallet-bridge-relayers --features try-runtime cargo check -p bridge-runtime-common cargo check -p bridge-runtime-common --features runtime-benchmarks +cargo check -p bridge-runtime-common --features integrity-test # we're removing lock file after all chechs are done. Otherwise we may use different # Substrate/Polkadot/Cumulus commits and our checks will fail diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 4aa1cfca298..6ba04507266 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -clap = { version = "4.2.7", features = ["derive"] } +clap = { version = "4.3.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } url = "2.3.1" diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index edf11d72a0b..d77db6baedf 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -93,7 +93,7 @@ impl PurgeChainCmd { io::stdin().read_line(&mut input)?; let input = input.trim(); - match input.chars().nth(0) { + match input.chars().next() { Some('y') | Some('Y') => {}, _ => { println!("Aborted"); @@ -103,7 +103,7 @@ impl PurgeChainCmd { } for db_path in &db_paths { - match fs::remove_dir_all(&db_path) { + match fs::remove_dir_all(db_path) { Ok(_) => { println!("{:?} removed.", &db_path); }, @@ -387,50 +387,34 @@ impl sc_cli::CliConfiguration for NormalizedRunCmd { self.base.disable_grandpa() } - fn rpc_ws_max_connections(&self) -> sc_cli::Result> { - self.base.rpc_ws_max_connections() + fn rpc_max_connections(&self) -> sc_cli::Result { + self.base.rpc_max_connections() } fn rpc_cors(&self, is_dev: bool) -> sc_cli::Result>> { self.base.rpc_cors(is_dev) } - fn rpc_http(&self, default_listen_port: u16) -> sc_cli::Result> { - self.base.rpc_http(default_listen_port) - } - - fn rpc_ipc(&self) -> sc_cli::Result> { - self.base.rpc_ipc() - } - - fn rpc_ws(&self, default_listen_port: u16) -> sc_cli::Result> { - self.base.rpc_ws(default_listen_port) + fn rpc_addr(&self, default_listen_port: u16) -> sc_cli::Result> { + self.base.rpc_addr(default_listen_port) } fn rpc_methods(&self) -> sc_cli::Result { self.base.rpc_methods() } - fn rpc_max_payload(&self) -> sc_cli::Result> { - self.base.rpc_max_payload() - } - - fn rpc_max_request_size(&self) -> sc_cli::Result> { + fn rpc_max_request_size(&self) -> sc_cli::Result { Ok(self.base.rpc_max_request_size) } - fn rpc_max_response_size(&self) -> sc_cli::Result> { + fn rpc_max_response_size(&self) -> sc_cli::Result { Ok(self.base.rpc_max_response_size) } - fn rpc_max_subscriptions_per_connection(&self) -> sc_cli::Result> { + fn rpc_max_subscriptions_per_connection(&self) -> sc_cli::Result { Ok(self.base.rpc_max_subscriptions_per_connection) } - fn ws_max_out_buffer_capacity(&self) -> sc_cli::Result> { - self.base.ws_max_out_buffer_capacity() - } - fn transaction_pool(&self, is_dev: bool) -> sc_cli::Result { self.base.transaction_pool(is_dev) } diff --git a/client/collator/Cargo.toml b/client/collator/Cargo.toml index b8e05fd37c5..6b04a319dcc 100644 --- a/client/collator/Cargo.toml +++ b/client/collator/Cargo.toml @@ -5,15 +5,15 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] +parking_lot = "0.12.1" codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] } futures = "0.3.21" -parking_lot = "0.12.0" tracing = "0.1.25" # Substrate sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/collator/src/lib.rs b/client/collator/src/lib.rs index a931201f6cc..aca40b2b342 100644 --- a/client/collator/src/lib.rs +++ b/client/collator/src/lib.rs @@ -16,50 +16,46 @@ //! Cumulus Collator implementation for Substrate. -use cumulus_client_network::WaitToAnnounce; use cumulus_primitives_core::{ - relay_chain::Hash as PHash, CollationInfo, CollectCollationInfo, ParachainBlockData, - PersistedValidationData, + relay_chain::Hash as PHash, CollectCollationInfo, PersistedValidationData, }; use sc_client_api::BlockBackend; -use sp_api::{ApiExt, ProvideRuntimeApi}; -use sp_consensus::BlockStatus; +use sp_api::ProvideRuntimeApi; use sp_core::traits::SpawnNamed; -use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT, Zero}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use cumulus_client_consensus_common::ParachainConsensus; -use polkadot_node_primitives::{ - BlockData, Collation, CollationGenerationConfig, CollationResult, MaybeCompressedPoV, PoV, -}; -use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProtocolMessage}; +use polkadot_node_primitives::{CollationResult, MaybeCompressedPoV}; use polkadot_overseer::Handle as OverseerHandle; use polkadot_primitives::{CollatorPair, Id as ParaId}; use codec::{Decode, Encode}; -use futures::{channel::oneshot, FutureExt}; -use parking_lot::Mutex; +use futures::prelude::*; use std::sync::Arc; -use tracing::Instrument; + +use crate::service::CollatorService; + +pub mod service; /// The logging target. const LOG_TARGET: &str = "cumulus-collator"; /// The implementation of the Cumulus `Collator`. +/// +/// Note that this implementation is soon to be deprecated and removed, and it is suggested to +/// directly use the [`CollatorService`] instead, so consensus engine implementations +/// live at the top level. pub struct Collator { - block_status: Arc, + service: CollatorService, parachain_consensus: Box>, - wait_to_announce: Arc>>, - runtime_api: Arc, } impl Clone for Collator { fn clone(&self) -> Self { - Self { - block_status: self.block_status.clone(), - wait_to_announce: self.wait_to_announce.clone(), + Collator { + service: self.service.clone(), parachain_consensus: self.parachain_consensus.clone(), - runtime_api: self.runtime_api.clone(), } } } @@ -73,159 +69,10 @@ where { /// Create a new instance. fn new( - block_status: Arc, - spawner: Arc, - announce_block: Arc>) + Send + Sync>, - runtime_api: Arc, + collator_service: CollatorService, parachain_consensus: Box>, ) -> Self { - let wait_to_announce = Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block))); - - Self { block_status, wait_to_announce, runtime_api, parachain_consensus } - } - - /// Checks the status of the given block hash in the Parachain. - /// - /// Returns `true` if the block could be found and is good to be build on. - fn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool { - match self.block_status.block_status(hash) { - Ok(BlockStatus::Queued) => { - tracing::debug!( - target: LOG_TARGET, - block_hash = ?hash, - "Skipping candidate production, because block is still queued for import.", - ); - false - }, - Ok(BlockStatus::InChainWithState) => true, - Ok(BlockStatus::InChainPruned) => { - tracing::error!( - target: LOG_TARGET, - "Skipping candidate production, because block `{:?}` is already pruned!", - hash, - ); - false - }, - Ok(BlockStatus::KnownBad) => { - tracing::error!( - target: LOG_TARGET, - block_hash = ?hash, - "Block is tagged as known bad and is included in the relay chain! Skipping candidate production!", - ); - false - }, - Ok(BlockStatus::Unknown) => { - if header.number().is_zero() { - tracing::error!( - target: LOG_TARGET, - block_hash = ?hash, - "Could not find the header of the genesis block in the database!", - ); - } else { - tracing::debug!( - target: LOG_TARGET, - block_hash = ?hash, - "Skipping candidate production, because block is unknown.", - ); - } - false - }, - Err(e) => { - tracing::error!( - target: LOG_TARGET, - block_hash = ?hash, - error = ?e, - "Failed to get block status.", - ); - false - }, - } - } - - /// Fetch the collation info from the runtime. - /// - /// Returns `Ok(Some(_))` on success, `Err(_)` on error or `Ok(None)` if the runtime api isn't implemented by the runtime. - fn fetch_collation_info( - &self, - block_hash: Block::Hash, - header: &Block::Header, - ) -> Result, sp_api::ApiError> { - let runtime_api = self.runtime_api.runtime_api(); - - let api_version = - match runtime_api.api_version::>(block_hash)? { - Some(version) => version, - None => { - tracing::error!( - target: LOG_TARGET, - "Could not fetch `CollectCollationInfo` runtime api version." - ); - return Ok(None) - }, - }; - - let collation_info = if api_version < 2 { - #[allow(deprecated)] - runtime_api - .collect_collation_info_before_version_2(block_hash)? - .into_latest(header.encode().into()) - } else { - runtime_api.collect_collation_info(block_hash, header)? - }; - - Ok(Some(collation_info)) - } - - fn build_collation( - &self, - block: ParachainBlockData, - block_hash: Block::Hash, - pov: PoV, - ) -> Option { - let collation_info = self - .fetch_collation_info(block_hash, block.header()) - .map_err(|e| { - tracing::error!( - target: LOG_TARGET, - error = ?e, - "Failed to collect collation info.", - ) - }) - .ok() - .flatten()?; - - let upward_messages = collation_info - .upward_messages - .try_into() - .map_err(|e| { - tracing::error!( - target: LOG_TARGET, - error = ?e, - "Number of upward messages should not be greater than `MAX_UPWARD_MESSAGE_NUM`", - ) - }) - .ok()?; - let horizontal_messages = collation_info - .horizontal_messages - .try_into() - .map_err(|e| { - tracing::error!( - target: LOG_TARGET, - error = ?e, - "Number of horizontal messages should not be greater than `MAX_HORIZONTAL_MESSAGE_NUM`", - ) - }) - .ok()?; - - Some(Collation { - upward_messages, - new_validation_code: collation_info.new_validation_code, - processed_downward_messages: collation_info.processed_downward_messages, - horizontal_messages, - hrmp_watermark: collation_info.hrmp_watermark, - head_data: collation_info.head_data, - proof_of_validity: MaybeCompressedPoV::Compressed(pov), - }) + Self { service: collator_service, parachain_consensus } } async fn produce_candidate( @@ -252,7 +99,7 @@ where }; let last_head_hash = last_head.hash(); - if !self.check_block_status(last_head_hash, &last_head) { + if !self.service.check_block_status(last_head_hash, &last_head) { return None } @@ -268,21 +115,9 @@ where .produce_candidate(&last_head, relay_parent, &validation_data) .await?; - let (header, extrinsics) = candidate.block.deconstruct(); + let block_hash = candidate.block.header().hash(); - let compact_proof = match candidate - .proof - .into_compact_proof::>(last_head.state_root().clone()) - { - Ok(proof) => proof, - Err(e) => { - tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e); - return None - }, - }; - - // Create the parachain block data for the validators. - let b = ParachainBlockData::::new(header, extrinsics, compact_proof); + let (collation, b) = self.service.build_collation(&last_head, block_hash, candidate)?; tracing::info!( target: LOG_TARGET, @@ -292,25 +127,109 @@ where b.storage_proof().encode().len() as f64 / 1024f64, ); - let pov = - polkadot_node_primitives::maybe_compress_pov(PoV { block_data: BlockData(b.encode()) }); + if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity { + tracing::info!( + target: LOG_TARGET, + "Compressed PoV size: {}kb", + pov.block_data.0.len() as f64 / 1024f64, + ); + } - tracing::info!( - target: LOG_TARGET, - "Compressed PoV size: {}kb", - pov.block_data.0.len() as f64 / 1024f64, - ); + let result_sender = self.service.announce_with_barrier(block_hash); - let block_hash = b.header().hash(); - let collation = self.build_collation(b, block_hash, pov)?; + tracing::info!(target: LOG_TARGET, ?block_hash, "Produced proof-of-validity candidate.",); - let (result_sender, signed_stmt_recv) = oneshot::channel(); + Some(CollationResult { collation, result_sender: Some(result_sender) }) + } +} - self.wait_to_announce.lock().wait_to_announce(block_hash, signed_stmt_recv); +/// Relay-chain-driven collators are those whose block production is driven purely +/// by new relay chain blocks and the most recently included parachain blocks +/// within them. +/// +/// This method of driving collators is not suited to anything but the most simple parachain +/// consensus mechanisms, and this module may soon be deprecated. +pub mod relay_chain_driven { + use futures::{ + channel::{mpsc, oneshot}, + prelude::*, + }; + use polkadot_node_primitives::{CollationGenerationConfig, CollationResult}; + use polkadot_node_subsystem::messages::{CollationGenerationMessage, CollatorProtocolMessage}; + use polkadot_overseer::Handle as OverseerHandle; + use polkadot_primitives::{CollatorPair, Id as ParaId}; - tracing::info!(target: LOG_TARGET, ?block_hash, "Produced proof-of-validity candidate.",); + use cumulus_primitives_core::{relay_chain::Hash as PHash, PersistedValidationData}; - Some(CollationResult { collation, result_sender: Some(result_sender) }) + /// A request to author a collation, based on the advancement of the relay chain. + /// + /// See the module docs for more info on relay-chain-driven collators. + pub struct CollationRequest { + relay_parent: PHash, + pvd: PersistedValidationData, + sender: oneshot::Sender>, + } + + impl CollationRequest { + /// Get the relay parent of the collation request. + pub fn relay_parent(&self) -> &PHash { + &self.relay_parent + } + + /// Get the [`PersistedValidationData`] for the request. + pub fn persisted_validation_data(&self) -> &PersistedValidationData { + &self.pvd + } + + /// Complete the request with a collation, if any. + pub fn complete(self, collation: Option) { + let _ = self.sender.send(collation); + } + } + + /// Initialize the collator with Polkadot's collation-generation + /// subsystem, returning a stream of collation requests to handle. + pub async fn init( + key: CollatorPair, + para_id: ParaId, + overseer_handle: OverseerHandle, + ) -> mpsc::Receiver { + let mut overseer_handle = overseer_handle; + + let (stream_tx, stream_rx) = mpsc::channel(0); + let config = CollationGenerationConfig { + key, + para_id, + collator: Box::new(move |relay_parent, validation_data| { + // Cloning the channel on each usage effectively makes the channel + // unbounded. The channel is actually bounded by the block production + // and consensus systems of Polkadot, which limits the amount of possible + // blocks. + let mut stream_tx = stream_tx.clone(); + let validation_data = validation_data.clone(); + Box::pin(async move { + let (this_tx, this_rx) = oneshot::channel(); + let request = + CollationRequest { relay_parent, pvd: validation_data, sender: this_tx }; + + if stream_tx.send(request).await.is_err() { + return None + } + + this_rx.await.ok().flatten() + }) + }), + }; + + overseer_handle + .send_msg(CollationGenerationMessage::Initialize(config), "StartCollator") + .await; + + overseer_handle + .send_msg(CollatorProtocolMessage::CollateOn(para_id), "StartCollator") + .await; + + stream_rx } } @@ -332,7 +251,7 @@ pub async fn start_collator( para_id, block_status, announce_block, - mut overseer_handle, + overseer_handle, spawner, key, parachain_consensus, @@ -345,34 +264,28 @@ pub async fn start_collator( RA: ProvideRuntimeApi + Send + Sync + 'static, RA::Api: CollectCollationInfo, { - let collator = Collator::new( - block_status, - Arc::new(spawner), - announce_block, - runtime_api, - parachain_consensus, - ); + let collator_service = + CollatorService::new(block_status, Arc::new(spawner.clone()), announce_block, runtime_api); - let span = tracing::Span::current(); - let config = CollationGenerationConfig { - key, - para_id, - collator: Box::new(move |relay_parent, validation_data| { - let collator = collator.clone(); - collator - .produce_candidate(relay_parent, validation_data.clone()) - .instrument(span.clone()) - .boxed() - }), - }; + let collator = Collator::new(collator_service, parachain_consensus); - overseer_handle - .send_msg(CollationGenerationMessage::Initialize(config), "StartCollator") - .await; + let mut request_stream = relay_chain_driven::init(key, para_id, overseer_handle).await; - overseer_handle - .send_msg(CollatorProtocolMessage::CollateOn(para_id), "StartCollator") - .await; + let collation_future = Box::pin(async move { + while let Some(request) = request_stream.next().await { + let collation = collator + .clone() + .produce_candidate( + *request.relay_parent(), + request.persisted_validation_data().clone(), + ) + .await; + + request.complete(collation); + } + }); + + spawner.spawn("cumulus-relay-driven-collator", None, collation_future); } #[cfg(test)] @@ -380,12 +293,14 @@ mod tests { use super::*; use async_trait::async_trait; use cumulus_client_consensus_common::ParachainCandidate; + use cumulus_primitives_core::ParachainBlockData; use cumulus_test_client::{ Client, ClientBlockImportExt, DefaultTestClientBuilderExt, InitBlockBuilder, TestClientBuilder, TestClientBuilderExt, }; use cumulus_test_runtime::{Block, Header}; use futures::{channel::mpsc, executor::block_on, StreamExt}; + use polkadot_node_subsystem::messages::CollationGenerationMessage; use polkadot_node_subsystem_test_helpers::ForwardSubsystem; use polkadot_overseer::{dummy::dummy_overseer_builder, HeadSupportsParachains}; use sp_consensus::BlockOrigin; @@ -451,7 +366,7 @@ mod tests { .build() .expect("Builds overseer"); - spawner.spawn("overseer", None, overseer.run().then(|_| async { () }).boxed()); + spawner.spawn("overseer", None, overseer.run().then(|_| async {}).boxed()); let collator_start = start_collator(StartCollatorParams { runtime_api: client.clone(), @@ -461,7 +376,7 @@ mod tests { spawner, para_id, key: CollatorPair::generate().0, - parachain_consensus: Box::new(DummyParachainConsensus { client: client.clone() }), + parachain_consensus: Box::new(DummyParachainConsensus { client }), }); block_on(collator_start); @@ -469,12 +384,10 @@ mod tests { .0 .expect("message should be send by `start_collator` above."); - let config = match msg { - CollationGenerationMessage::Initialize(config) => config, - }; + let CollationGenerationMessage::Initialize(config) = msg; - let mut validation_data = PersistedValidationData::default(); - validation_data.parent_head = header.encode().into(); + let validation_data = + PersistedValidationData { parent_head: header.encode().into(), ..Default::default() }; let relay_parent = Default::default(); let collation = block_on((config.collator)(relay_parent, &validation_data)) diff --git a/client/collator/src/service.rs b/client/collator/src/service.rs new file mode 100644 index 00000000000..7724b0a68a6 --- /dev/null +++ b/client/collator/src/service.rs @@ -0,0 +1,318 @@ +// Copyright 2023 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! The Cumulus [`CollatorService`] is a utility struct for performing common +//! operations used in parachain consensus/authoring. + +use cumulus_client_network::WaitToAnnounce; +use cumulus_primitives_core::{CollationInfo, CollectCollationInfo, ParachainBlockData}; + +use sc_client_api::BlockBackend; +use sp_api::{ApiExt, ProvideRuntimeApi}; +use sp_consensus::BlockStatus; +use sp_core::traits::SpawnNamed; +use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT, Zero}; + +use cumulus_client_consensus_common::ParachainCandidate; +use polkadot_node_primitives::{ + BlockData, Collation, CollationSecondedSignal, MaybeCompressedPoV, PoV, +}; + +use codec::Encode; +use futures::channel::oneshot; +use parking_lot::Mutex; +use std::sync::Arc; + +/// The logging target. +const LOG_TARGET: &str = "cumulus-collator"; + +/// Utility functions generally applicable to writing collators for Cumulus. +pub trait ServiceInterface { + /// Checks the status of the given block hash in the Parachain. + /// + /// Returns `true` if the block could be found and is good to be build on. + fn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool; + + /// Build a full [`Collation`] from a given [`ParachainCandidate`]. This requires + /// that the underlying block has been fully imported into the underlying client, + /// as implementations will fetch underlying runtime API data. + /// + /// This also returns the unencoded parachain block data, in case that is desired. + fn build_collation( + &self, + parent_header: &Block::Header, + block_hash: Block::Hash, + candidate: ParachainCandidate, + ) -> Option<(Collation, ParachainBlockData)>; + + /// Inform networking systems that the block should be announced after an appropriate + /// signal has been received. This returns the sending half of the signal. + fn announce_with_barrier( + &self, + block_hash: Block::Hash, + ) -> oneshot::Sender; +} + +/// The [`CollatorService`] provides common utilities for parachain consensus and authoring. +/// +/// This includes logic for checking the block status of arbitrary parachain headers +/// gathered from the relay chain state, creating full [`Collation`]s to be shared with validators, +/// and distributing new parachain blocks along the network. +pub struct CollatorService { + block_status: Arc, + wait_to_announce: Arc>>, + runtime_api: Arc, +} + +impl Clone for CollatorService { + fn clone(&self) -> Self { + Self { + block_status: self.block_status.clone(), + wait_to_announce: self.wait_to_announce.clone(), + runtime_api: self.runtime_api.clone(), + } + } +} + +impl CollatorService +where + Block: BlockT, + BS: BlockBackend, + RA: ProvideRuntimeApi, + RA::Api: CollectCollationInfo, +{ + /// Create a new instance. + pub fn new( + block_status: Arc, + spawner: Arc, + announce_block: Arc>) + Send + Sync>, + runtime_api: Arc, + ) -> Self { + let wait_to_announce = Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block))); + + Self { block_status, wait_to_announce, runtime_api } + } + + /// Checks the status of the given block hash in the Parachain. + /// + /// Returns `true` if the block could be found and is good to be build on. + pub fn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool { + match self.block_status.block_status(hash) { + Ok(BlockStatus::Queued) => { + tracing::debug!( + target: LOG_TARGET, + block_hash = ?hash, + "Skipping candidate production, because block is still queued for import.", + ); + false + }, + Ok(BlockStatus::InChainWithState) => true, + Ok(BlockStatus::InChainPruned) => { + tracing::error!( + target: LOG_TARGET, + "Skipping candidate production, because block `{:?}` is already pruned!", + hash, + ); + false + }, + Ok(BlockStatus::KnownBad) => { + tracing::error!( + target: LOG_TARGET, + block_hash = ?hash, + "Block is tagged as known bad and is included in the relay chain! Skipping candidate production!", + ); + false + }, + Ok(BlockStatus::Unknown) => { + if header.number().is_zero() { + tracing::error!( + target: LOG_TARGET, + block_hash = ?hash, + "Could not find the header of the genesis block in the database!", + ); + } else { + tracing::debug!( + target: LOG_TARGET, + block_hash = ?hash, + "Skipping candidate production, because block is unknown.", + ); + } + false + }, + Err(e) => { + tracing::error!( + target: LOG_TARGET, + block_hash = ?hash, + error = ?e, + "Failed to get block status.", + ); + false + }, + } + } + + /// Fetch the collation info from the runtime. + /// + /// Returns `Ok(Some(_))` on success, `Err(_)` on error or `Ok(None)` if the runtime api isn't implemented by the runtime. + pub fn fetch_collation_info( + &self, + block_hash: Block::Hash, + header: &Block::Header, + ) -> Result, sp_api::ApiError> { + let runtime_api = self.runtime_api.runtime_api(); + + let api_version = + match runtime_api.api_version::>(block_hash)? { + Some(version) => version, + None => { + tracing::error!( + target: LOG_TARGET, + "Could not fetch `CollectCollationInfo` runtime api version." + ); + return Ok(None) + }, + }; + + let collation_info = if api_version < 2 { + #[allow(deprecated)] + runtime_api + .collect_collation_info_before_version_2(block_hash)? + .into_latest(header.encode().into()) + } else { + runtime_api.collect_collation_info(block_hash, header)? + }; + + Ok(Some(collation_info)) + } + + /// Build a full [`Collation`] from a given [`ParachainCandidate`]. This requires + /// that the underlying block has been fully imported into the underlying client, + /// as it fetches underlying runtime API data. + /// + /// This also returns the unencoded parachain block data, in case that is desired. + pub fn build_collation( + &self, + parent_header: &Block::Header, + block_hash: Block::Hash, + candidate: ParachainCandidate, + ) -> Option<(Collation, ParachainBlockData)> { + let (header, extrinsics) = candidate.block.deconstruct(); + + let compact_proof = match candidate + .proof + .into_compact_proof::>(*parent_header.state_root()) + { + Ok(proof) => proof, + Err(e) => { + tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e); + return None + }, + }; + + // Create the parachain block data for the validators. + let collation_info = self + .fetch_collation_info(block_hash, &header) + .map_err(|e| { + tracing::error!( + target: LOG_TARGET, + error = ?e, + "Failed to collect collation info.", + ) + }) + .ok() + .flatten()?; + + let block_data = ParachainBlockData::::new(header, extrinsics, compact_proof); + + let pov = polkadot_node_primitives::maybe_compress_pov(PoV { + block_data: BlockData(block_data.encode()), + }); + + let upward_messages = collation_info + .upward_messages + .try_into() + .map_err(|e| { + tracing::error!( + target: LOG_TARGET, + error = ?e, + "Number of upward messages should not be greater than `MAX_UPWARD_MESSAGE_NUM`", + ) + }) + .ok()?; + let horizontal_messages = collation_info + .horizontal_messages + .try_into() + .map_err(|e| { + tracing::error!( + target: LOG_TARGET, + error = ?e, + "Number of horizontal messages should not be greater than `MAX_HORIZONTAL_MESSAGE_NUM`", + ) + }) + .ok()?; + + let collation = Collation { + upward_messages, + new_validation_code: collation_info.new_validation_code, + processed_downward_messages: collation_info.processed_downward_messages, + horizontal_messages, + hrmp_watermark: collation_info.hrmp_watermark, + head_data: collation_info.head_data, + proof_of_validity: MaybeCompressedPoV::Compressed(pov), + }; + + Some((collation, block_data)) + } + + /// Inform the networking systems that the block should be announced after an appropriate + /// signal has been received. This returns the sending half of the signal. + pub fn announce_with_barrier( + &self, + block_hash: Block::Hash, + ) -> oneshot::Sender { + let (result_sender, signed_stmt_recv) = oneshot::channel(); + self.wait_to_announce.lock().wait_to_announce(block_hash, signed_stmt_recv); + result_sender + } +} + +impl ServiceInterface for CollatorService +where + Block: BlockT, + BS: BlockBackend, + RA: ProvideRuntimeApi, + RA::Api: CollectCollationInfo, +{ + fn check_block_status(&self, hash: Block::Hash, header: &Block::Header) -> bool { + CollatorService::check_block_status(self, hash, header) + } + + fn build_collation( + &self, + parent_header: &Block::Header, + block_hash: Block::Hash, + candidate: ParachainCandidate, + ) -> Option<(Collation, ParachainBlockData)> { + CollatorService::build_collation(self, parent_header, block_hash, candidate) + } + + fn announce_with_barrier( + &self, + block_hash: Block::Hash, + ) -> oneshot::Sender { + CollatorService::announce_with_barrier(self, block_hash) + } +} diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index f284391494f..114e2ebed5b 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -27,8 +27,19 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } # Cumulus cumulus-client-consensus-common = { path = "../common" } +cumulus-relay-chain-interface = { path = "../../relay-chain-interface" } +cumulus-client-consensus-proposer = { path = "../proposer" } cumulus-primitives-core = { path = "../../../primitives/core" } +cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent" } +cumulus-client-collator = { path = "../../collator" } + +# Polkadot +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-overseer = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index 862abfb349a..725e841881c 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -51,7 +51,7 @@ pub struct ImportQueueParams<'a, I, C, CIDP, S> { } /// Start an import queue for the Aura consensus algorithm. -pub fn import_queue<'a, P, Block, I, C, S, CIDP>( +pub fn import_queue( ImportQueueParams { block_import, client, @@ -59,7 +59,7 @@ pub fn import_queue<'a, P, Block, I, C, S, CIDP>( spawner, registry, telemetry, - }: ImportQueueParams<'a, I, C, CIDP, S>, + }: ImportQueueParams<'_, I, C, CIDP, S>, ) -> Result, sp_consensus::Error> where Block: BlockT, diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index b95b5ecf39d..416ae776da1 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -50,6 +50,8 @@ pub use import_queue::{build_verifier, import_queue, BuildVerifierParams, Import pub use sc_consensus_aura::{slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotProportion}; pub use sc_consensus_slots::InherentDataProviderExt; +pub mod unstable_reimpl; + const LOG_TARGET: &str = "aura::cumulus"; /// The implementation of the AURA consensus for parachains. diff --git a/client/consensus/aura/src/unstable_reimpl.rs b/client/consensus/aura/src/unstable_reimpl.rs new file mode 100644 index 00000000000..f9602a363bf --- /dev/null +++ b/client/consensus/aura/src/unstable_reimpl.rs @@ -0,0 +1,529 @@ +// Copyright 2023 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! The AuRa consensus algorithm for parachains. +//! +//! This extends the Substrate provided AuRa consensus implementation to make it compatible for +//! parachains. This provides the option to run a "bare" relay-chain driven Aura implementation, +//! but also exposes the core functionalities separately to be composed into more complex implementations. +//! +//! For more information about AuRa, the Substrate crate should be checked. + +use codec::{Decode, Encode}; +use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface; +use cumulus_client_consensus_common::{ParachainBlockImportMarker, ParachainCandidate}; +use cumulus_client_consensus_proposer::ProposerInterface; +use cumulus_primitives_core::{ + relay_chain::Hash as PHash, CollectCollationInfo, PersistedValidationData, +}; +use cumulus_primitives_parachain_inherent::ParachainInherentData; +use cumulus_relay_chain_interface::RelayChainInterface; + +use polkadot_node_primitives::{CollationResult, MaybeCompressedPoV}; +use polkadot_overseer::Handle as OverseerHandle; +use polkadot_primitives::{CollatorPair, Id as ParaId}; + +use futures::prelude::*; +use sc_client_api::{backend::AuxStore, BlockBackend, BlockOf}; +use sc_consensus::{ + import_queue::{BasicQueue, Verifier as VerifierT}, + BlockImport, BlockImportParams, ForkChoiceStrategy, StateAction, +}; +use sc_consensus_aura::standalone as aura_internal; +use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_DEBUG, CONSENSUS_TRACE}; +use sp_api::ProvideRuntimeApi; +use sp_application_crypto::AppPublic; +use sp_block_builder::BlockBuilder as BlockBuilderApi; +use sp_blockchain::HeaderBackend; +use sp_consensus::{error::Error as ConsensusError, BlockOrigin, SyncOracle}; +use sp_consensus_aura::{AuraApi, Slot, SlotDuration}; +use sp_core::crypto::Pair; +use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider}; +use sp_keystore::KeystorePtr; +use sp_runtime::{ + generic::Digest, + traits::{Block as BlockT, HashFor, Header as HeaderT, Member}, +}; +use sp_state_machine::StorageChanges; +use std::{convert::TryFrom, error::Error, fmt::Debug, hash::Hash, sync::Arc, time::Duration}; + +/// Parameters for [`run_bare_relay_driven`]. +pub struct Params { + pub create_inherent_data_providers: CIDP, + pub block_import: BI, + pub para_client: Arc, + pub relay_client: Arc, + pub sync_oracle: SO, + pub keystore: KeystorePtr, + pub key: CollatorPair, + pub para_id: ParaId, + pub overseer_handle: OverseerHandle, + pub slot_duration: SlotDuration, + pub proposer: Proposer, + pub collator_service: CS, +} + +/// Run bare Aura consensus as a relay-chain-driven collator. +pub async fn run_bare_relay_driven( + params: Params, +) where + Block: BlockT, + Client: ProvideRuntimeApi + + BlockOf + + AuxStore + + HeaderBackend + + BlockBackend + + Send + + Sync + + 'static, + Client::Api: AuraApi + CollectCollationInfo, + RClient: RelayChainInterface, + CIDP: CreateInherentDataProviders + 'static, + BI: BlockImport + ParachainBlockImportMarker + Send + Sync + 'static, + SO: SyncOracle + Send + Sync + Clone + 'static, + Proposer: ProposerInterface, + Proposer::Transaction: Sync, + CS: CollatorServiceInterface, + P: Pair + Send + Sync, + P::Public: AppPublic + Hash + Member + Encode + Decode, + P::Signature: TryFrom> + Hash + Member + Encode + Decode, +{ + let mut proposer = params.proposer; + let mut block_import = params.block_import; + + let mut collation_requests = cumulus_client_collator::relay_chain_driven::init( + params.key, + params.para_id, + params.overseer_handle, + ) + .await; + + while let Some(request) = collation_requests.next().await { + macro_rules! reject_with_error { + ($err:expr) => {{ + request.complete(None); + tracing::error!(target: crate::LOG_TARGET, err = ?{ $err }); + continue; + }}; + } + + let validation_data = request.persisted_validation_data(); + + let parent_header = match Block::Header::decode(&mut &validation_data.parent_head.0[..]) { + Ok(x) => x, + Err(e) => reject_with_error!(e), + }; + + let parent_hash = parent_header.hash(); + + if !params.collator_service.check_block_status(parent_hash, &parent_header) { + continue + } + + let claim = match claim_slot::<_, _, P>( + &*params.para_client, + parent_hash, + params.slot_duration, + ¶ms.keystore, + ) + .await + { + Ok(None) => continue, + Ok(Some(c)) => c, + Err(e) => reject_with_error!(e), + }; + + let (parachain_inherent_data, other_inherent_data) = match create_inherent_data( + *request.relay_parent(), + &validation_data, + parent_hash, + params.para_id, + ¶ms.relay_client, + ¶ms.create_inherent_data_providers, + ) + .await + { + Ok(x) => x, + Err(e) => reject_with_error!(e), + }; + + let proposal = match proposer + .propose( + &parent_header, + ¶chain_inherent_data, + other_inherent_data, + Digest { logs: vec![claim.pre_digest] }, + // TODO [https://github.com/paritytech/cumulus/issues/2439] + // We should call out to a pluggable interface that provides + // the proposal duration. + Duration::from_millis(500), + // Set the block limit to 50% of the maximum PoV size. + // + // TODO: If we got benchmarking that includes the proof size, + // we should be able to use the maximum pov size. + Some((validation_data.max_pov_size / 2) as usize), + ) + .await + { + Ok(p) => p, + Err(e) => reject_with_error!(e), + }; + + let sealed_importable = match seal::<_, _, P>( + proposal.block, + proposal.storage_changes, + &claim.author_pub, + ¶ms.keystore, + ) { + Ok(s) => s, + Err(e) => reject_with_error!(e), + }; + + let post_hash = sealed_importable.post_hash(); + let block = Block::new( + sealed_importable.post_header(), + sealed_importable + .body + .as_ref() + .expect("body always created with this `propose` fn; qed") + .clone(), + ); + + if let Err(e) = block_import.import_block(sealed_importable).await { + reject_with_error!(e); + } + + let response = if let Some((collation, b)) = params.collator_service.build_collation( + &parent_header, + post_hash, + ParachainCandidate { block, proof: proposal.proof }, + ) { + tracing::info!( + target: crate::LOG_TARGET, + "PoV size {{ header: {}kb, extrinsics: {}kb, storage_proof: {}kb }}", + b.header().encode().len() as f64 / 1024f64, + b.extrinsics().encode().len() as f64 / 1024f64, + b.storage_proof().encode().len() as f64 / 1024f64, + ); + + if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity { + tracing::info!( + target: crate::LOG_TARGET, + "Compressed PoV size: {}kb", + pov.block_data.0.len() as f64 / 1024f64, + ); + } + + let result_sender = params.collator_service.announce_with_barrier(post_hash); + Some(CollationResult { collation, result_sender: Some(result_sender) }) + } else { + None + }; + + request.complete(response); + } +} + +fn slot_now(slot_duration: SlotDuration) -> Slot { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time().timestamp(); + Slot::from_timestamp(timestamp, slot_duration) +} + +/// A claim on an Aura slot. +struct SlotClaim { + author_pub: Pub, + pre_digest: sp_runtime::DigestItem, +} + +async fn claim_slot( + client: &C, + parent_hash: B::Hash, + slot_duration: SlotDuration, + keystore: &KeystorePtr, +) -> Result>, Box> +where + B: BlockT, + C: ProvideRuntimeApi + Send + Sync + 'static, + C::Api: AuraApi, + P: Pair, + P::Public: Encode + Decode, + P::Signature: Encode + Decode, +{ + // load authorities + let authorities = client.runtime_api().authorities(parent_hash).map_err(Box::new)?; + + // Determine the current slot. + let slot_now = slot_now(slot_duration); + + // Try to claim the slot locally. + let author_pub = { + let res = aura_internal::claim_slot::

(slot_now, &authorities, keystore).await; + match res { + Some(p) => p, + None => return Ok(None), + } + }; + + // Produce the pre-digest. + let pre_digest = aura_internal::pre_digest::

(slot_now); + + Ok(Some(SlotClaim { author_pub, pre_digest })) +} + +async fn create_inherent_data( + relay_parent: PHash, + validation_data: &PersistedValidationData, + parent_hash: B::Hash, + para_id: ParaId, + relay_chain_interface: &impl RelayChainInterface, + create_inherent_data_providers: &impl CreateInherentDataProviders, +) -> Result<(ParachainInherentData, InherentData), Box> { + let paras_inherent_data = ParachainInherentData::create_at( + relay_parent, + relay_chain_interface, + validation_data, + para_id, + ) + .await; + + let paras_inherent_data = match paras_inherent_data { + Some(p) => p, + None => + return Err(format!("Could not create paras inherent data at {:?}", relay_parent).into()), + }; + + let other_inherent_data = create_inherent_data_providers + .create_inherent_data_providers(parent_hash, ()) + .map_err(|e| e as Box) + .await? + .create_inherent_data() + .await + .map_err(Box::new)?; + + Ok((paras_inherent_data, other_inherent_data)) +} + +fn seal( + pre_sealed: B, + storage_changes: StorageChanges>, + author_pub: &P::Public, + keystore: &KeystorePtr, +) -> Result, Box> +where + P: Pair, + P::Signature: Encode + Decode + TryFrom>, + P::Public: AppPublic, +{ + let (pre_header, body) = pre_sealed.deconstruct(); + let pre_hash = pre_header.hash(); + let block_number = *pre_header.number(); + + // seal the block. + let block_import_params = { + let seal_digest = + aura_internal::seal::<_, P>(&pre_hash, &author_pub, keystore).map_err(Box::new)?; + let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, pre_header); + block_import_params.post_digests.push(seal_digest); + block_import_params.body = Some(body.clone()); + block_import_params.state_action = + StateAction::ApplyChanges(sc_consensus::StorageChanges::Changes(storage_changes)); + block_import_params.fork_choice = Some(ForkChoiceStrategy::LongestChain); + block_import_params + }; + let post_hash = block_import_params.post_hash(); + + tracing::info!( + target: crate::LOG_TARGET, + "🔖 Pre-sealed block for proposal at {}. Hash now {:?}, previously {:?}.", + block_number, + post_hash, + pre_hash, + ); + + Ok(block_import_params) +} + +struct Verifier { + client: Arc, + create_inherent_data_providers: CIDP, + slot_duration: SlotDuration, + telemetry: Option, + _marker: std::marker::PhantomData<(Block, P)>, +} + +#[async_trait::async_trait] +impl VerifierT for Verifier +where + P: Pair, + P::Signature: Encode + Decode, + P::Public: Encode + Decode + PartialEq + Clone + Debug, + Block: BlockT, + Client: ProvideRuntimeApi + Send + Sync, + >::Api: BlockBuilderApi + AuraApi, + + CIDP: CreateInherentDataProviders, +{ + async fn verify( + &mut self, + mut block_params: BlockImportParams, + ) -> Result, String> { + // Skip checks that include execution, if being told so, or when importing only state. + // + // This is done for example when gap syncing and it is expected that the block after the gap + // was checked/chosen properly, e.g. by warp syncing to this block using a finality proof. + if block_params.state_action.skip_execution_checks() || block_params.with_state() { + return Ok(block_params) + } + + let post_hash = block_params.header.hash(); + let parent_hash = *block_params.header.parent_hash(); + + // check seal and update pre-hash/post-hash + { + let authorities = aura_internal::fetch_authorities(self.client.as_ref(), parent_hash) + .map_err(|e| { + format!("Could not fetch authorities at {:?}: {}", parent_hash, e) + })?; + + let slot_now = slot_now(self.slot_duration); + let res = aura_internal::check_header_slot_and_seal::( + slot_now, + block_params.header, + &authorities, + ); + + match res { + Ok((pre_header, _slot, seal_digest)) => { + telemetry!( + self.telemetry; + CONSENSUS_TRACE; + "aura.checked_and_importing"; + "pre_header" => ?pre_header, + ); + + block_params.header = pre_header; + block_params.post_digests.push(seal_digest); + block_params.fork_choice = Some(ForkChoiceStrategy::LongestChain); + block_params.post_hash = Some(post_hash); + }, + Err(aura_internal::SealVerificationError::Deferred(hdr, slot)) => { + telemetry!( + self.telemetry; + CONSENSUS_DEBUG; + "aura.header_too_far_in_future"; + "hash" => ?post_hash, + "a" => ?hdr, + "b" => ?slot, + ); + + return Err(format!( + "Rejecting block ({:?}) from future slot {:?}", + post_hash, slot + )) + }, + Err(e) => + return Err(format!( + "Rejecting block ({:?}) with invalid seal ({:?})", + post_hash, e + )), + } + } + + // check inherents. + if let Some(body) = block_params.body.clone() { + let block = Block::new(block_params.header.clone(), body); + let create_inherent_data_providers = self + .create_inherent_data_providers + .create_inherent_data_providers(parent_hash, ()) + .await + .map_err(|e| format!("Could not create inherent data {:?}", e))?; + + let inherent_data = create_inherent_data_providers + .create_inherent_data() + .await + .map_err(|e| format!("Could not create inherent data {:?}", e))?; + + let inherent_res = self + .client + .runtime_api() + .check_inherents_with_context( + parent_hash, + block_params.origin.into(), + block, + inherent_data, + ) + .map_err(|e| format!("Unable to check block inherents {:?}", e))?; + + if !inherent_res.ok() { + for (i, e) in inherent_res.into_errors() { + match create_inherent_data_providers.try_handle_error(&i, &e).await { + Some(res) => res.map_err(|e| format!("Inherent Error {:?}", e))?, + None => + return Err(format!( + "Unknown inherent error, source {:?}", + String::from_utf8_lossy(&i[..]) + )), + } + } + } + } + + Ok(block_params) + } +} + +/// Start an import queue for a Cumulus node which checks blocks' seals and inherent data. +/// +/// Pass in only inherent data providers which don't include aura or parachain consensus inherents, +/// e.g. things like timestamp and custom inherents for the runtime. +/// +/// The others are generated explicitly internally. +/// +/// This should only be used for runtimes where the runtime does not check all inherents and +/// seals in `execute_block` (see ) +pub fn fully_verifying_import_queue( + client: Arc, + block_import: I, + create_inherent_data_providers: CIDP, + slot_duration: SlotDuration, + spawner: &impl sp_core::traits::SpawnEssentialNamed, + registry: Option<&substrate_prometheus_endpoint::Registry>, + telemetry: Option, +) -> BasicQueue +where + P: Pair, + P::Signature: Encode + Decode, + P::Public: Encode + Decode + PartialEq + Clone + Debug, + I: BlockImport + + ParachainBlockImportMarker + + Send + + Sync + + 'static, + I::Transaction: Send, + Client: ProvideRuntimeApi + Send + Sync + 'static, + >::Api: BlockBuilderApi + AuraApi, + CIDP: CreateInherentDataProviders + 'static, +{ + let verifier = Verifier:: { + client, + create_inherent_data_providers, + slot_duration, + telemetry, + _marker: std::marker::PhantomData, + }; + + BasicQueue::new(verifier, Box::new(block_import), None, spawner, registry) +} diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index d0bc28171fb..02b36320062 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -18,8 +18,10 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/client/consensus/common/src/import_queue.rs b/client/consensus/common/src/import_queue.rs new file mode 100644 index 00000000000..948fe065c42 --- /dev/null +++ b/client/consensus/common/src/import_queue.rs @@ -0,0 +1,77 @@ +// Copyright 2019-2023 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! (unstable) Composable utilities for constructing import queues for parachains. +//! +//! Unlike standalone chains, parachains have the requirement that all consensus logic +//! must be checked within the runtime. This property means that work which is normally +//! done in the import queue per-block, such as checking signatures, quorums, and whether +//! inherent extrinsics were constructed faithfully do not need to be done, per se. +//! +//! It may seem that it would be beneficial for the client to do these checks regardless, +//! but in practice this means that clients would just reject blocks which are _valid_ according +//! to their Parachain Validation Function, which is the ultimate source of consensus truth. +//! +//! However, parachain runtimes expose two different access points for executing blocks +//! in full nodes versus executing those blocks in the parachain validation environment. +//! At the time of writing, the inherent and consensus checks in most Cumulus runtimes +//! are only performed during parachain validation, not full node block execution. +//! +//! See for details. + +use sp_consensus::error::Error as ConsensusError; +use sp_runtime::traits::Block as BlockT; + +use sc_consensus::{ + block_import::{BlockImport, BlockImportParams}, + import_queue::{BasicQueue, Verifier}, +}; + +use crate::ParachainBlockImportMarker; + +/// A [`Verifier`] for blocks which verifies absolutely nothing. +/// +/// This should only be used when the runtime is responsible for checking block seals and inherents. +pub struct VerifyNothing; + +#[async_trait::async_trait] +impl Verifier for VerifyNothing { + async fn verify( + &mut self, + params: BlockImportParams, + ) -> Result, String> { + Ok(params) + } +} + +/// An import queue which does no verification. +/// +/// This should only be used when the runtime is responsible for checking block seals and inherents. +pub fn verify_nothing_import_queue( + block_import: I, + spawner: &impl sp_core::traits::SpawnEssentialNamed, + registry: Option<&substrate_prometheus_endpoint::Registry>, +) -> BasicQueue +where + I: BlockImport + + ParachainBlockImportMarker + + Send + + Sync + + 'static, + I::Transaction: Send, +{ + BasicQueue::new(VerifyNothing, Box::new(block_import), None, spawner, registry) +} diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 3576ced1858..ebdfaaf26ca 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -22,7 +22,7 @@ use std::{ sync::Arc, }; -const LOG_TARGET: &'static str = "level-monitor"; +const LOG_TARGET: &str = "level-monitor"; /// Value good enough to be used with parachains using the current backend implementation /// that ships with Substrate. This value may change in the future. diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index 86a781adc01..b74829e191f 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -32,6 +32,8 @@ pub use parachain_consensus::run_parachain_consensus; use level_monitor::LevelMonitor; pub use level_monitor::{LevelLimit, MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT}; +pub mod import_queue; + /// The result of [`ParachainConsensus::produce_candidate`]. pub struct ParachainCandidate { /// The block that was built for this candidate. diff --git a/client/consensus/common/src/parachain_consensus.rs b/client/consensus/common/src/parachain_consensus.rs index 734f682d25b..78f4e45cd81 100644 --- a/client/consensus/common/src/parachain_consensus.rs +++ b/client/consensus/common/src/parachain_consensus.rs @@ -325,7 +325,6 @@ async fn handle_new_block_imported( match parachain.block_status(unset_hash) { Ok(BlockStatus::InChainWithState) => { - drop(unset_best_header); let unset_best_header = unset_best_header_opt .take() .expect("We checked above that the value is set; qed"); @@ -433,8 +432,11 @@ async fn handle_new_best_parachain_head( } } -async fn import_block_as_new_best(hash: Block::Hash, header: Block::Header, parachain: &P) -where +async fn import_block_as_new_best( + hash: Block::Hash, + header: Block::Header, + mut parachain: &P, +) where Block: BlockT, P: UsageProvider + Send + Sync + BlockBackend, for<'a> &'a P: BlockImport, @@ -456,7 +458,7 @@ where block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(true)); block_import_params.import_existing = true; - if let Err(err) = (&*parachain).import_block(block_import_params).await { + if let Err(err) = parachain.import_block(block_import_params).await { tracing::warn!( target: LOG_TARGET, block_hash = ?hash, diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 23516d96388..f1bc4d42b8a 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -337,7 +337,7 @@ fn follow_new_best_with_dummy_recovery_works() { Some(recovery_chan_tx), ); - let block = build_block(&*client.clone(), None, None); + let block = build_block(&*client, None, None); let block_clone = block.clone(); let client_clone = client.clone(); @@ -547,7 +547,6 @@ fn do_not_set_best_block_to_older_block() { let client = Arc::new(TestClientBuilder::with_backend(backend).build()); let blocks = (0..NUM_BLOCKS) - .into_iter() .map(|_| build_and_import_block(client.clone(), true)) .collect::>(); @@ -559,7 +558,6 @@ fn do_not_set_best_block_to_older_block() { let consensus = run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); - let client2 = client.clone(); let work = async move { new_best_heads_sender .unbounded_send(blocks[NUM_BLOCKS - 2].header().clone()) @@ -579,7 +577,7 @@ fn do_not_set_best_block_to_older_block() { }); // Build and import a new best block. - build_and_import_block(client2.clone(), true); + build_and_import_block(client, true); } #[test] @@ -607,7 +605,6 @@ fn prune_blocks_on_level_overflow() { let id0 = block0.header.hash(); let blocks1 = (0..LEVEL_LIMIT) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -622,7 +619,6 @@ fn prune_blocks_on_level_overflow() { let id10 = blocks1[0].header.hash(); let blocks2 = (0..2) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -720,7 +716,6 @@ fn restore_limit_monitor() { let id00 = block00.header.hash(); let blocks1 = (0..LEVEL_LIMIT + 1) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -735,7 +730,6 @@ fn restore_limit_monitor() { let id10 = blocks1[0].header.hash(); let _ = (0..LEVEL_LIMIT) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, diff --git a/client/consensus/proposer/Cargo.toml b/client/consensus/proposer/Cargo.toml new file mode 100644 index 00000000000..7dff8d31950 --- /dev/null +++ b/client/consensus/proposer/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "cumulus-client-consensus-proposer" +description = "A Substrate `Proposer` for building parachain blocks" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2021" + +[dependencies] +anyhow = "1.0" +async-trait = "0.1.68" +thiserror = "1.0.40" + +# Substrate +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" } + +# Cumulus +cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent" } diff --git a/client/consensus/proposer/src/lib.rs b/client/consensus/proposer/src/lib.rs new file mode 100644 index 00000000000..514ad58da74 --- /dev/null +++ b/client/consensus/proposer/src/lib.rs @@ -0,0 +1,137 @@ +// Copyright 2023 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! The Cumulus [`Proposer`] is a wrapper around a Substrate [`sp_consensus::Environment`] +//! for creating new parachain blocks. +//! +//! This utility is designed to be composed within any collator consensus algorithm. + +use async_trait::async_trait; + +use cumulus_primitives_parachain_inherent::ParachainInherentData; +use sp_consensus::{EnableProofRecording, Environment, Proposal, Proposer as SubstrateProposer}; +use sp_inherents::InherentData; +use sp_runtime::{traits::Block as BlockT, Digest}; +use sp_state_machine::StorageProof; + +use std::{fmt::Debug, time::Duration}; + +/// Errors that can occur when proposing a parachain block. +#[derive(thiserror::Error, Debug)] +#[error(transparent)] +pub struct Error { + inner: anyhow::Error, +} + +impl Error { + /// Create an error tied to the creation of a proposer. + pub fn proposer_creation(err: impl Into) -> Self { + Error { inner: err.into().context("Proposer Creation") } + } + + /// Create an error tied to the proposing logic itself. + pub fn proposing(err: impl Into) -> Self { + Error { inner: err.into().context("Proposing") } + } +} + +/// A type alias for easily referring to the type of a proposal produced by a specific +/// [`Proposer`]. +pub type ProposalOf = Proposal>::Transaction, StorageProof>; + +/// An interface for proposers. +#[async_trait] +pub trait ProposerInterface { + /// The underlying DB transaction type produced with the block proposal. + type Transaction: Default + Send + 'static; + + /// Propose a collation using the supplied `InherentData` and the provided + /// `ParachainInherentData`. + /// + /// Also specify any required inherent digests, the maximum proposal duration, + /// and the block size limit in bytes. See the documentation on [`sp_consensus::Proposer::propose`] + /// for more details on how to interpret these parameters. + /// + /// The `InherentData` and `Digest` are left deliberately general in order to accommodate + /// all possible collator selection algorithms or inherent creation mechanisms, + /// while the `ParachainInherentData` is made explicit so it will be constructed appropriately. + /// + /// If the `InherentData` passed into this function already has a `ParachainInherentData`, + /// this should throw an error. + async fn propose( + &mut self, + parent_header: &Block::Header, + paras_inherent_data: &ParachainInherentData, + other_inherent_data: InherentData, + inherent_digests: Digest, + max_duration: Duration, + block_size_limit: Option, + ) -> Result, Error>; +} + +/// A simple wrapper around a Substrate proposer for creating collations. +pub struct Proposer { + inner: T, + _marker: std::marker::PhantomData, +} + +impl Proposer { + /// Create a new Cumulus [`Proposer`]. + pub fn new(inner: T) -> Self { + Proposer { inner, _marker: std::marker::PhantomData } + } +} + +#[async_trait] +impl ProposerInterface for Proposer +where + B: sp_runtime::traits::Block, + T: Environment + Send, + T::Error: Send + Sync + 'static, + T::Proposer: SubstrateProposer, + >::Error: Send + Sync + 'static, +{ + type Transaction = <>::Proposer as SubstrateProposer>::Transaction; + + async fn propose( + &mut self, + parent_header: &B::Header, + paras_inherent_data: &ParachainInherentData, + other_inherent_data: InherentData, + inherent_digests: Digest, + max_duration: Duration, + block_size_limit: Option, + ) -> Result, Error> { + let proposer = self + .inner + .init(parent_header) + .await + .map_err(|e| Error::proposer_creation(anyhow::Error::new(e)))?; + + let mut inherent_data = other_inherent_data; + inherent_data + .put_data( + cumulus_primitives_parachain_inherent::INHERENT_IDENTIFIER, + ¶s_inherent_data, + ) + .map_err(|e| Error::proposing(anyhow::Error::new(e)))?; + + proposer + .propose(inherent_data, inherent_digests, max_duration, block_size_limit) + .await + .map_err(|e| Error::proposing(anyhow::Error::new(e)).into()) + } +} diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index a31a9ec8b2a..529b78c1319 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -161,7 +161,7 @@ where relay_parent: PHash, validation_data: &PersistedValidationData, ) -> Option> { - let proposer_future = self.proposer_factory.lock().init(&parent); + let proposer_future = self.proposer_factory.lock().init(parent); let proposer = proposer_future .await @@ -171,7 +171,7 @@ where .ok()?; let inherent_data = - self.inherent_data(parent.hash(), &validation_data, relay_parent).await?; + self.inherent_data(parent.hash(), validation_data, relay_parent).await?; let Proposal { block, storage_changes, proof } = proposer .propose( diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index f208d9919ce..68b6054cb70 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -31,7 +31,7 @@ cumulus-relay-chain-interface = { path = "../relay-chain-interface" } [dev-dependencies] portpicker = "0.1.1" -tokio = { version = "1.28.0", features = ["macros"] } +tokio = { version = "1.28.1", features = ["macros"] } url = "2.3.1" # Substrate diff --git a/client/network/src/lib.rs b/client/network/src/lib.rs index 0c15ab3add5..e226170d7c5 100644 --- a/client/network/src/lib.rs +++ b/client/network/src/lib.rs @@ -89,14 +89,13 @@ impl BlockAnnounceData { /// /// This will not check the signature, for this you should use [`BlockAnnounceData::check_signature`]. fn validate(&self, encoded_header: Vec) -> Result<(), Validation> { - let candidate_hash = if let CompactStatement::Seconded(h) = - self.statement.unchecked_payload() - { - h - } else { - tracing::debug!(target: LOG_TARGET, "`CompactStatement` isn't the candidate variant!",); - return Err(Validation::Failure { disconnect: true }) - }; + let candidate_hash = + if let CompactStatement::Seconded(h) = self.statement.unchecked_payload() { + h + } else { + tracing::debug!(target: LOG_TARGET, "`CompactStatement` isn't the candidate variant!",); + return Err(Validation::Failure { disconnect: true }) + }; if *candidate_hash != self.receipt.hash() { tracing::debug!( @@ -334,9 +333,9 @@ where let relay_chain_is_syncing = relay_chain_interface .is_major_syncing() .await - .map_err(|e| { - tracing::error!(target: LOG_TARGET, "Unable to determine sync status. {}", e) - }) + .map_err( + |e| tracing::error!(target: LOG_TARGET, "Unable to determine sync status. {}", e), + ) .unwrap_or(false); if relay_chain_is_syncing { diff --git a/client/network/src/tests.rs b/client/network/src/tests.rs index eefb88f2f7b..08127fe390a 100644 --- a/client/network/src/tests.rs +++ b/client/network/src/tests.rs @@ -129,7 +129,7 @@ impl RelayChainInterface for DummyRelayChainInterface { para_id: 0u32.into(), relay_parent: PHash::random(), collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), @@ -293,7 +293,7 @@ async fn make_gossip_message_and_header( para_id: 0u32.into(), relay_parent, collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), @@ -484,7 +484,7 @@ async fn check_statement_seconded() { para_id: 0u32.into(), relay_parent: PHash::random(), collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), diff --git a/client/pov-recovery/Cargo.toml b/client/pov-recovery/Cargo.toml index 4bdfc9d60aa..e5034da396e 100644 --- a/client/pov-recovery/Cargo.toml +++ b/client/pov-recovery/Cargo.toml @@ -31,7 +31,7 @@ cumulus-relay-chain-interface = {path = "../relay-chain-interface"} async-trait = "0.1.68" [dev-dependencies] -tokio = { version = "1.28.0", features = ["macros"] } +tokio = { version = "1.28.1", features = ["macros"] } portpicker = "0.1.1" # Cumulus diff --git a/client/pov-recovery/src/lib.rs b/client/pov-recovery/src/lib.rs index 7d92934c784..62f31b6c061 100644 --- a/client/pov-recovery/src/lib.rs +++ b/client/pov-recovery/src/lib.rs @@ -40,7 +40,7 @@ //! 4a. After it is recovered, we restore the block and import it. //! //! 4b. Since we are trying to recover pending candidates, availability is not guaranteed. If the block -//! PoV is not yet available, we retry. +//! PoV is not yet available, we retry. //! //! If we need to recover multiple PoV blocks (which should hopefully not happen in real life), we //! make sure that the blocks are imported in the correct order. @@ -190,7 +190,7 @@ impl RecoveryQueue { /// Get the next hash for block recovery. pub async fn next_recovery(&mut self) -> Block::Hash { loop { - if let Some(_) = self.signaling_queue.next().await { + if self.signaling_queue.next().await.is_some() { if let Some(hash) = self.recovery_queue.pop_front() { return hash } else { @@ -309,10 +309,10 @@ where /// Block is no longer waiting for recovery fn clear_waiting_recovery(&mut self, block_hash: &Block::Hash) { - self.candidates.get_mut(block_hash).map(|candidate| { + if let Some(candidate) = self.candidates.get_mut(block_hash) { // Prevents triggering an already enqueued recovery request candidate.waiting_recovery = false; - }); + } } /// Handle a finalized block with the given `block_number`. diff --git a/client/relay-chain-inprocess-interface/src/lib.rs b/client/relay-chain-inprocess-interface/src/lib.rs index f230a23bd25..c1e19bd20b6 100644 --- a/client/relay-chain-inprocess-interface/src/lib.rs +++ b/client/relay-chain-inprocess-interface/src/lib.rs @@ -241,7 +241,7 @@ where self.full_client .import_notification_stream() .filter_map(|notification| async move { - notification.is_new_best.then(|| notification.header) + notification.is_new_best.then_some(notification.header) }); Ok(Box::pin(notifications_stream)) } @@ -428,7 +428,7 @@ mod tests { ( client.clone(), block, - RelayChainInProcessInterface::new(client, backend.clone(), dummy_network, mock_handle), + RelayChainInProcessInterface::new(client, backend, dummy_network, mock_handle), ) } @@ -483,7 +483,7 @@ mod tests { let hash = block.hash(); let ext = construct_transfer_extrinsic( - &*client, + &client, sp_keyring::Sr25519Keyring::Alice, sp_keyring::Sr25519Keyring::Bob, 1000, diff --git a/client/relay-chain-interface/Cargo.toml b/client/relay-chain-interface/Cargo.toml index 421c9c9aa9c..c4ee9d2fb59 100644 --- a/client/relay-chain-interface/Cargo.toml +++ b/client/relay-chain-interface/Cargo.toml @@ -18,4 +18,4 @@ futures = "0.3.28" async-trait = "0.1.68" thiserror = "1.0.40" jsonrpsee-core = "0.16.2" -parity-scale-codec = "3.4.0" +parity-scale-codec = "3.5.0" diff --git a/client/relay-chain-minimal-node/Cargo.toml b/client/relay-chain-minimal-node/Cargo.toml index 17ad78f3c85..866408b2cbb 100644 --- a/client/relay-chain-minimal-node/Cargo.toml +++ b/client/relay-chain-minimal-node/Cargo.toml @@ -37,9 +37,9 @@ cumulus-relay-chain-interface = { path = "../relay-chain-interface" } cumulus-relay-chain-rpc-interface = { path = "../relay-chain-rpc-interface" } cumulus-primitives-core = { path = "../../primitives/core" } -array-bytes = "6.0" +array-bytes = "6.1" lru = "0.9" tracing = "0.1.37" async-trait = "0.1.68" futures = "0.3.28" -tokio = { version = "1.28.0", features = ["macros"] } +tokio = { version = "1.28.1", features = ["macros"] } diff --git a/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs b/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs index b8939df5fd5..10b48296bff 100644 --- a/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs +++ b/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs @@ -21,6 +21,7 @@ use cumulus_relay_chain_rpc_interface::RelayChainRpcClient; use futures::{Stream, StreamExt}; use polkadot_core_primitives::{Block, BlockNumber, Hash, Header}; use polkadot_overseer::RuntimeApiSubsystemClient; +use polkadot_primitives::vstaging; use sc_authority_discovery::{AuthorityDiscovery, Error as AuthorityDiscoveryError}; use sp_api::{ApiError, RuntimeApiInfo}; @@ -297,7 +298,41 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient { )>, ApiError, > { - Ok(self.rpc_client.parachain_host_staging_get_disputes(at).await?) + Ok(self.rpc_client.parachain_host_disputes(at).await?) + } + + async fn unapplied_slashes( + &self, + at: Hash, + ) -> Result< + Vec<( + polkadot_primitives::SessionIndex, + polkadot_primitives::CandidateHash, + vstaging::slashing::PendingSlashes, + )>, + ApiError, + > { + Ok(self.rpc_client.parachain_host_unapplied_slashes(at).await?) + } + + async fn key_ownership_proof( + &self, + at: Hash, + validator_id: polkadot_primitives::ValidatorId, + ) -> Result, ApiError> { + Ok(self.rpc_client.parachain_host_key_ownership_proof(at, validator_id).await?) + } + + async fn submit_report_dispute_lost( + &self, + at: Hash, + dispute_proof: vstaging::slashing::DisputeProof, + key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof, + ) -> Result, ApiError> { + Ok(self + .rpc_client + .parachain_host_submit_report_dispute_lost(at, dispute_proof, key_ownership_proof) + .await?) } } diff --git a/client/relay-chain-minimal-node/src/collator_overseer.rs b/client/relay-chain-minimal-node/src/collator_overseer.rs index a2ad87fa758..b488db962f3 100644 --- a/client/relay-chain-minimal-node/src/collator_overseer.rs +++ b/client/relay-chain-minimal-node/src/collator_overseer.rs @@ -76,7 +76,7 @@ pub(crate) struct CollatorOverseerGenArgs<'a> { pub peer_set_protocol_names: PeerSetProtocolNames, } -fn build_overseer<'a>( +fn build_overseer( connector: OverseerConnector, CollatorOverseerGenArgs { runtime_client, @@ -90,7 +90,7 @@ fn build_overseer<'a>( collator_pair, req_protocol_names, peer_set_protocol_names, - }: CollatorOverseerGenArgs<'a>, + }: CollatorOverseerGenArgs<'_>, ) -> Result< (Overseer, Arc>, OverseerHandle), RelayChainError, diff --git a/client/relay-chain-minimal-node/src/lib.rs b/client/relay-chain-minimal-node/src/lib.rs index 102a8582745..6def072913b 100644 --- a/client/relay-chain-minimal-node/src/lib.rs +++ b/client/relay-chain-minimal-node/src/lib.rs @@ -29,7 +29,7 @@ use polkadot_node_subsystem_util::metrics::prometheus::Registry; use polkadot_primitives::CollatorPair; use sc_authority_discovery::Service as AuthorityDiscoveryService; -use sc_network::{Event, NetworkEventStream, NetworkService}; +use sc_network::{config::FullNetworkConfiguration, Event, NetworkEventStream, NetworkService}; use sc_service::{Configuration, TaskManager}; use sp_runtime::{app_crypto::Pair, traits::Block as BlockT}; @@ -119,11 +119,12 @@ pub async fn build_minimal_relay_chain_node( /// - AvailabilityDistribution #[sc_tracing::logging::prefix_logs_with("Relaychain")] async fn new_minimal_relay_chain( - mut config: Configuration, + config: Configuration, collator_pair: CollatorPair, relay_chain_rpc_client: Arc, ) -> Result { let role = config.role.clone(); + let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.network); let task_manager = { let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry); @@ -141,22 +142,27 @@ async fn new_minimal_relay_chain( let peer_set_protocol_names = PeerSetProtocolNames::new(genesis_hash, config.chain_spec.fork_id()); let is_authority = if role.is_authority() { IsAuthority::Yes } else { IsAuthority::No }; - config - .network - .extra_sets - .extend(peer_sets_info(is_authority, &peer_set_protocol_names)); + + for config in peer_sets_info(is_authority, &peer_set_protocol_names) { + net_config.add_notification_protocol(config); + } let request_protocol_names = ReqProtocolNames::new(genesis_hash, config.chain_spec.fork_id()); let (collation_req_receiver, available_data_req_receiver) = - build_request_response_protocol_receivers(&request_protocol_names, &mut config); + build_request_response_protocol_receivers(&request_protocol_names, &mut net_config); let best_header = relay_chain_rpc_client .chain_get_header(None) .await? .ok_or_else(|| RelayChainError::RpcCallError("Unable to fetch best header".to_string()))?; - let (network, network_starter, sync_oracle) = - build_collator_network(&config, task_manager.spawn_handle(), genesis_hash, best_header) - .map_err(|e| RelayChainError::Application(Box::new(e) as Box<_>))?; + let (network, network_starter, sync_oracle) = build_collator_network( + &config, + net_config, + task_manager.spawn_handle(), + genesis_hash, + best_header, + ) + .map_err(|e| RelayChainError::Application(Box::new(e) as Box<_>))?; let authority_discovery_service = build_authority_discovery_service( &task_manager, @@ -190,18 +196,18 @@ async fn new_minimal_relay_chain( fn build_request_response_protocol_receivers( request_protocol_names: &ReqProtocolNames, - config: &mut Configuration, + config: &mut FullNetworkConfiguration, ) -> ( IncomingRequestReceiver, IncomingRequestReceiver, ) { let (collation_req_receiver, cfg) = IncomingRequest::get_config_receiver(request_protocol_names); - config.network.request_response_protocols.push(cfg); + config.add_request_response_protocol(cfg); let (available_data_req_receiver, cfg) = IncomingRequest::get_config_receiver(request_protocol_names); - config.network.request_response_protocols.push(cfg); + config.add_request_response_protocol(cfg); let cfg = Protocol::ChunkFetchingV1.get_outbound_only_config(request_protocol_names); - config.network.request_response_protocols.push(cfg); + config.add_request_response_protocol(cfg); (collation_req_receiver, available_data_req_receiver) } diff --git a/client/relay-chain-minimal-node/src/network.rs b/client/relay-chain-minimal-node/src/network.rs index 5225fa053cc..022e7e696b7 100644 --- a/client/relay-chain-minimal-node/src/network.rs +++ b/client/relay-chain-minimal-node/src/network.rs @@ -24,6 +24,7 @@ use sc_network::{ NetworkService, }; +use sc_network::config::FullNetworkConfiguration; use sc_network_common::{role::Roles, sync::message::BlockAnnouncesHandshake}; use sc_service::{error::Error, Configuration, NetworkStarter, SpawnTaskHandle}; use sc_utils::mpsc::tracing_unbounded; @@ -33,6 +34,7 @@ use std::{iter, sync::Arc}; /// Build the network service, the network status sinks and an RPC sender. pub(crate) fn build_collator_network( config: &Configuration, + network_config: FullNetworkConfiguration, spawn_handle: SpawnTaskHandle, genesis_hash: Hash, best_header: Header, @@ -61,12 +63,11 @@ pub(crate) fn build_collator_network( }) }, fork_id: None, - network_config: config.network.clone(), + network_config, genesis_hash, protocol_id, metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()), block_announce_config, - request_response_protocol_configs: Vec::new(), tx, }; diff --git a/client/relay-chain-rpc-interface/Cargo.toml b/client/relay-chain-rpc-interface/Cargo.toml index 6380abe066d..a3a5629e4e1 100644 --- a/client/relay-chain-rpc-interface/Cargo.toml +++ b/client/relay-chain-rpc-interface/Cargo.toml @@ -21,15 +21,15 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" } -tokio = { version = "1.28.0", features = ["sync"] } +tokio = { version = "1.28.1", features = ["sync"] } futures = "0.3.28" futures-timer = "3.0.2" -parity-scale-codec = "3.4.0" +parity-scale-codec = "3.5.0" jsonrpsee = { version = "0.16.2", features = ["ws-client"] } tracing = "0.1.37" async-trait = "0.1.68" url = "2.3.1" serde_json = "1.0.96" -serde = "1.0.160" +serde = "1.0.163" lru = "0.9.0" diff --git a/client/relay-chain-rpc-interface/src/rpc_client.rs b/client/relay-chain-rpc-interface/src/rpc_client.rs index 6bd2d33d3a2..70c64eeeffc 100644 --- a/client/relay-chain-rpc-interface/src/rpc_client.rs +++ b/client/relay-chain-rpc-interface/src/rpc_client.rs @@ -30,7 +30,7 @@ use sp_storage::StorageKey; use cumulus_primitives_core::{ relay_chain::{ - BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash, + vstaging, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupRotationInfo, Hash as RelayHash, Header as RelayHeader, InboundHrmpMessage, OccupiedCoreAssumption, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, @@ -320,15 +320,62 @@ impl RelayChainRpcClient { } /// Returns all onchain disputes. - /// This is a staging method! Do not use on production runtimes! - pub async fn parachain_host_staging_get_disputes( + pub async fn parachain_host_disputes( &self, at: RelayHash, ) -> Result)>, RelayChainError> { - self.call_remote_runtime_function("ParachainHost_staging_get_disputes", at, None::<()>) + self.call_remote_runtime_function("ParachainHost_disputes", at, None::<()>) + .await + } + + /// Returns a list of validators that lost a past session dispute and need to be slashed. + /// + /// This is a staging method! Do not use on production runtimes! + pub async fn parachain_host_unapplied_slashes( + &self, + at: RelayHash, + ) -> Result< + Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>, + RelayChainError, + > { + self.call_remote_runtime_function("ParachainHost_unapplied_slashes", at, None::<()>) .await } + /// Returns a merkle proof of a validator session key in a past session. + /// + /// This is a staging method! Do not use on production runtimes! + pub async fn parachain_host_key_ownership_proof( + &self, + at: RelayHash, + validator_id: ValidatorId, + ) -> Result, RelayChainError> { + self.call_remote_runtime_function( + "ParachainHost_key_ownership_proof", + at, + Some(validator_id), + ) + .await + } + + /// Submits an unsigned extrinsic to slash validators who lost a dispute about + /// a candidate of a past session. + /// + /// This is a staging method! Do not use on production runtimes! + pub async fn parachain_host_submit_report_dispute_lost( + &self, + at: RelayHash, + dispute_proof: vstaging::slashing::DisputeProof, + key_ownership_proof: vstaging::slashing::OpaqueKeyOwnershipProof, + ) -> Result, RelayChainError> { + self.call_remote_runtime_function( + "ParachainHost_submit_report_dispute_lost", + at, + Some((dispute_proof, key_ownership_proof)), + ) + .await + } + pub async fn authority_discovery_authorities( &self, at: RelayHash, diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 894db91ba8f..42b9916d468 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -301,6 +301,7 @@ pub struct BuildNetworkParams< Client::Api: sp_transaction_pool::runtime_api::TaggedTransactionQueue, { pub parachain_config: &'a Configuration, + pub net_config: sc_network::config::FullNetworkConfiguration, pub client: Arc, pub transaction_pool: Arc>, pub para_id: ParaId, @@ -313,6 +314,7 @@ pub struct BuildNetworkParams< pub async fn build_network<'a, Block, Client, RCInterface, IQ>( BuildNetworkParams { parachain_config, + net_config, client, transaction_pool, para_id, @@ -364,6 +366,7 @@ where sc_service::build_network(sc_service::BuildNetworkParams { config: parachain_config, + net_config, client, transaction_pool, spawn_handle, @@ -441,7 +444,7 @@ where ) .await .map_err(|e| format!("{e:?}"))? - .ok_or_else(|| "Could not find parachain head in relay chain")?; + .ok_or("Could not find parachain head in relay chain")?; let target_block = B::Header::decode(&mut &validation_data.parent_head.0[..]) .map_err(|e| format!("Failed to decode parachain head: {e}"))?; diff --git a/pallets/aura-ext/Cargo.toml b/pallets/aura-ext/Cargo.toml index 6c890eeceb0..23f70e4be9b 100644 --- a/pallets/aura-ext/Cargo.toml +++ b/pallets/aura-ext/Cargo.toml @@ -7,7 +7,7 @@ description = "AURA consensus extension pallet for parachains" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/collator-selection/Cargo.toml b/pallets/collator-selection/Cargo.toml index 837b0c0287c..f3bec9567cd 100644 --- a/pallets/collator-selection/Cargo.toml +++ b/pallets/collator-selection/Cargo.toml @@ -1,6 +1,6 @@ [package] -authors = ["Anonymous"] -description = "Simple staking pallet with a fixed stake." +authors = ["Parity Technologies "] +description = "Simple pallet to select collators for a parachain." edition = "2021" homepage = "https://substrate.io" license = "Apache-2.0" @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] log = { version = "0.4.17", default-features = false } codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.0.0" } rand = { version = "0.8.5", features = ["std_rng"], default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/pallets/collator-selection/src/benchmarking.rs b/pallets/collator-selection/src/benchmarking.rs index 8a222511137..63c9561e7dd 100644 --- a/pallets/collator-selection/src/benchmarking.rs +++ b/pallets/collator-selection/src/benchmarking.rs @@ -110,17 +110,61 @@ benchmarks! { where_clause { where T: pallet_authorship::Config + session::Config } set_invulnerables { + let origin = + T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; let b in 1 .. T::MaxInvulnerables::get(); let new_invulnerables = register_validators::(b); + let mut sorted_new_invulnerables = new_invulnerables.clone(); + sorted_new_invulnerables.sort(); + }: { + assert_ok!( + // call the function with the unsorted list + >::set_invulnerables(origin, new_invulnerables.clone()) + ); + } + verify { + // assert that it comes out sorted + assert_last_event::(Event::NewInvulnerables{invulnerables: sorted_new_invulnerables}.into()); + } + + add_invulnerable { let origin = T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + // we're going to add one, so need one less than max set as invulnerables to start + let b in 1 .. T::MaxInvulnerables::get() - 1; + let mut invulnerables = register_validators::(b); + invulnerables.sort(); + let invulnerables: frame_support::BoundedVec<_, T::MaxInvulnerables> = frame_support::BoundedVec::try_from(invulnerables).unwrap(); + >::put(invulnerables); + + // now let's set up a new one to add + let (new, keys) = validator::(b + 1); + >::set_keys(RawOrigin::Signed(new.clone()).into(), keys, Vec::new()).unwrap(); }: { assert_ok!( - >::set_invulnerables(origin, new_invulnerables.clone()) + >::add_invulnerable(origin, new.clone()) + ); + } + verify { + assert_last_event::(Event::InvulnerableAdded{account_id: new}.into()); + } + + remove_invulnerable { + let origin = + T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + let b in 1 .. T::MaxInvulnerables::get(); + let mut invulnerables = register_validators::(b); + invulnerables.sort(); + let invulnerables: frame_support::BoundedVec<_, T::MaxInvulnerables> = frame_support::BoundedVec::try_from(invulnerables).unwrap(); + >::put(invulnerables); + let to_remove = >::get().first().unwrap().clone(); + }: { + assert_ok!( + >::remove_invulnerable(origin, to_remove.clone()) ); } verify { - assert_last_event::(Event::NewInvulnerables{invulnerables: new_invulnerables}.into()); + assert_last_event::(Event::InvulnerableRemoved{account_id: to_remove}.into()); } set_desired_candidates { @@ -129,7 +173,7 @@ benchmarks! { T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: { assert_ok!( - >::set_desired_candidates(origin, max.clone()) + >::set_desired_candidates(origin, max) ); } verify { @@ -142,7 +186,7 @@ benchmarks! { T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: { assert_ok!( - >::set_candidacy_bond(origin, bond_amount.clone()) + >::set_candidacy_bond(origin, bond_amount) ); } verify { @@ -162,7 +206,7 @@ benchmarks! { let caller: T::AccountId = whitelisted_caller(); let bond: BalanceOf = T::Currency::minimum_balance() * 2u32.into(); - T::Currency::make_free_balance_be(&caller, bond.clone()); + T::Currency::make_free_balance_be(&caller, bond); >::set_keys( RawOrigin::Signed(caller.clone()).into(), diff --git a/pallets/collator-selection/src/lib.rs b/pallets/collator-selection/src/lib.rs index 3dba6846cc3..daccc4ce93c 100644 --- a/pallets/collator-selection/src/lib.rs +++ b/pallets/collator-selection/src/lib.rs @@ -70,8 +70,11 @@ mod tests; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; +pub mod migration; pub mod weights; +const LOG_TARGET: &str = "runtime::collator-selection"; + #[frame_support::pallet] pub mod pallet { pub use crate::weights::WeightInfo; @@ -88,13 +91,16 @@ pub mod pallet { Currency, EnsureOrigin, ExistenceRequirement::KeepAlive, ReservableCurrency, ValidatorRegistration, }, - BoundedVec, PalletId, + BoundedVec, DefaultNoBound, PalletId, }; use frame_system::{pallet_prelude::*, Config as SystemConfig}; use pallet_session::SessionManager; use sp_runtime::traits::Convert; use sp_staking::SessionIndex; + /// The current storage version. + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -165,9 +171,10 @@ pub mod pallet { } #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); - /// The invulnerable, fixed collators. + /// The invulnerable, permissioned collators. This list must be sorted. #[pallet::storage] #[pallet::getter(fn invulnerables)] pub type Invulnerables = @@ -203,34 +210,26 @@ pub mod pallet { pub type CandidacyBond = StorageValue<_, BalanceOf, ValueQuery>; #[pallet::genesis_config] + #[derive(DefaultNoBound)] pub struct GenesisConfig { pub invulnerables: Vec, pub candidacy_bond: BalanceOf, pub desired_candidates: u32, } - #[cfg(feature = "std")] - impl Default for GenesisConfig { - fn default() -> Self { - Self { - invulnerables: Default::default(), - candidacy_bond: Default::default(), - desired_candidates: Default::default(), - } - } - } - #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - let duplicate_invulnerables = - self.invulnerables.iter().collect::>(); + let duplicate_invulnerables = self + .invulnerables + .iter() + .collect::>(); assert!( duplicate_invulnerables.len() == self.invulnerables.len(), "duplicate invulnerables in genesis." ); - let bounded_invulnerables = + let mut bounded_invulnerables = BoundedVec::<_, T::MaxInvulnerables>::try_from(self.invulnerables.clone()) .expect("genesis invulnerables are more than T::MaxInvulnerables"); assert!( @@ -238,8 +237,10 @@ pub mod pallet { "genesis desired_candidates are more than T::MaxCandidates", ); - >::put(&self.desired_candidates); - >::put(&self.candidacy_bond); + bounded_invulnerables.sort(); + + >::put(self.desired_candidates); + >::put(self.candidacy_bond); >::put(bounded_invulnerables); } } @@ -247,35 +248,41 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { + /// New Invulnerables were set. NewInvulnerables { invulnerables: Vec }, + /// A new Invulnerable was added. + InvulnerableAdded { account_id: T::AccountId }, + /// An Invulnerable was removed. + InvulnerableRemoved { account_id: T::AccountId }, + /// The number of desired candidates was set. NewDesiredCandidates { desired_candidates: u32 }, + /// The candidacy bond was set. NewCandidacyBond { bond_amount: BalanceOf }, + /// A new candidate joined. CandidateAdded { account_id: T::AccountId, deposit: BalanceOf }, + /// A candidate was removed. CandidateRemoved { account_id: T::AccountId }, } - // Errors inform users that something went wrong. #[pallet::error] pub enum Error { - /// Too many candidates + /// The pallet has too many candidates. TooManyCandidates, - /// Too few candidates + /// Leaving would result in too few candidates. TooFewCandidates, - /// Unknown error - Unknown, - /// Permission issue - Permission, - /// User is already a candidate + /// Account is already a candidate. AlreadyCandidate, - /// User is not a candidate + /// Account is not a candidate. NotCandidate, - /// Too many invulnerables + /// There are too many Invulnerables. TooManyInvulnerables, - /// User is already an Invulnerable + /// Account is already an Invulnerable. AlreadyInvulnerable, - /// Account has no associated validator ID + /// Account is not an Invulnerable. + NotInvulnerable, + /// Account has no associated validator ID. NoAssociatedValidatorId, - /// Validator ID is not yet registered + /// Validator ID is not yet registered. ValidatorNotRegistered, } @@ -292,7 +299,7 @@ pub mod pallet { new: Vec, ) -> DispatchResultWithPostInfo { T::UpdateOrigin::ensure_origin(origin)?; - let bounded_invulnerables = BoundedVec::<_, T::MaxInvulnerables>::try_from(new) + let mut bounded_invulnerables = BoundedVec::<_, T::MaxInvulnerables>::try_from(new) .map_err(|_| Error::::TooManyInvulnerables)?; // check if the invulnerables have associated validator keys before they are set @@ -305,6 +312,9 @@ pub mod pallet { ); } + // Invulnerables must be sorted for removal. + bounded_invulnerables.sort(); + >::put(&bounded_invulnerables); Self::deposit_event(Event::NewInvulnerables { invulnerables: bounded_invulnerables.to_vec(), @@ -326,7 +336,7 @@ pub mod pallet { if max > T::MaxCandidates::get() { log::warn!("max > T::MaxCandidates; you might need to run benchmarks again"); } - >::put(&max); + >::put(max); Self::deposit_event(Event::NewDesiredCandidates { desired_candidates: max }); Ok(().into()) } @@ -339,7 +349,7 @@ pub mod pallet { bond: BalanceOf, ) -> DispatchResultWithPostInfo { T::UpdateOrigin::ensure_origin(origin)?; - >::put(&bond); + >::put(bond); Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond }); Ok(().into()) } @@ -406,6 +416,56 @@ pub mod pallet { Ok(Some(T::WeightInfo::leave_intent(current_count as u32)).into()) } + + /// Add a new account `who` to the list of `Invulnerables` collators. + /// + /// The origin for this call must be the `UpdateOrigin`. + #[pallet::call_index(5)] + #[pallet::weight(T::WeightInfo::add_invulnerable(T::MaxInvulnerables::get() - 1))] + pub fn add_invulnerable(origin: OriginFor, who: T::AccountId) -> DispatchResult { + T::UpdateOrigin::ensure_origin(origin)?; + + // ensure `who` has registered a validator key + let validator_key = T::ValidatorIdOf::convert(who.clone()) + .ok_or(Error::::NoAssociatedValidatorId)?; + ensure!( + T::ValidatorRegistration::is_registered(&validator_key), + Error::::ValidatorNotRegistered + ); + + >::try_mutate(|invulnerables| -> DispatchResult { + match invulnerables.binary_search(&who) { + Ok(_) => return Err(Error::::AlreadyInvulnerable)?, + Err(pos) => invulnerables + .try_insert(pos, who.clone()) + .map_err(|_| Error::::TooManyInvulnerables)?, + } + Ok(()) + })?; + + Self::deposit_event(Event::InvulnerableAdded { account_id: who }); + Ok(()) + } + + /// Remove an account `who` from the list of `Invulnerables` collators. `Invulnerables` must + /// be sorted. + /// + /// The origin for this call must be the `UpdateOrigin`. + #[pallet::call_index(6)] + #[pallet::weight(T::WeightInfo::remove_invulnerable(T::MaxInvulnerables::get()))] + pub fn remove_invulnerable(origin: OriginFor, who: T::AccountId) -> DispatchResult { + T::UpdateOrigin::ensure_origin(origin)?; + + >::try_mutate(|invulnerables| -> DispatchResult { + let pos = + invulnerables.binary_search(&who).map_err(|_| Error::::NotInvulnerable)?; + invulnerables.remove(pos); + Ok(()) + })?; + + Self::deposit_event(Event::InvulnerableRemoved { account_id: who }); + Ok(()) + } } impl Pallet { diff --git a/pallets/collator-selection/src/migration.rs b/pallets/collator-selection/src/migration.rs new file mode 100644 index 00000000000..e26d9f08b5b --- /dev/null +++ b/pallets/collator-selection/src/migration.rs @@ -0,0 +1,91 @@ +// Copyright 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 . + +//! A module that is responsible for migration of storage for Collator Selection. + +use super::*; +use frame_support::{log, traits::OnRuntimeUpgrade}; + +/// Version 1 Migration +/// This migration ensures that any existing `Invulnerables` storage lists are sorted. +pub mod v1 { + use super::*; + use frame_support::pallet_prelude::*; + #[cfg(feature = "try-runtime")] + use sp_std::prelude::*; + + pub struct MigrateToV1(sp_std::marker::PhantomData); + impl OnRuntimeUpgrade for MigrateToV1 { + fn on_runtime_upgrade() -> Weight { + let onchain_version = Pallet::::on_chain_storage_version(); + if onchain_version == 0 { + let invulnerables_len = Invulnerables::::get().to_vec().len(); + >::mutate(|invulnerables| { + invulnerables.sort(); + }); + + StorageVersion::new(1).put::>(); + log::info!( + target: LOG_TARGET, + "Sorted {} Invulnerables, upgraded storage to version 1", + invulnerables_len, + ); + // Similar complexity to `set_invulnerables` (put storage value) + // Plus 1 read for length, 1 read for `onchain_version`, 1 write to put version + T::WeightInfo::set_invulnerables(invulnerables_len as u32) + .saturating_add(T::DbWeight::get().reads_writes(2, 1)) + } else { + log::info!( + target: LOG_TARGET, + "Migration did not execute. This probably should be removed" + ); + T::DbWeight::get().reads(1) + } + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, sp_runtime::DispatchError> { + let number_of_invulnerables = Invulnerables::::get().to_vec().len(); + Ok((number_of_invulnerables as u32).encode()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(number_of_invulnerables: Vec) -> Result<(), sp_runtime::DispatchError> { + let stored_invulnerables = Invulnerables::::get().to_vec(); + let mut sorted_invulnerables = stored_invulnerables.clone(); + sorted_invulnerables.sort(); + assert_eq!( + stored_invulnerables, sorted_invulnerables, + "after migration, the stored invulnerables should be sorted" + ); + + let number_of_invulnerables: u32 = Decode::decode( + &mut number_of_invulnerables.as_slice(), + ) + .expect("the state parameter should be something that was generated by pre_upgrade"); + let stored_invulnerables_len = stored_invulnerables.len() as u32; + assert_eq!( + number_of_invulnerables, stored_invulnerables_len, + "after migration, there should be the same number of invulnerables" + ); + + let onchain_version = Pallet::::on_chain_storage_version(); + frame_support::ensure!(onchain_version >= 1, "must_upgrade"); + + Ok(()) + } + } +} diff --git a/pallets/collator-selection/src/mock.rs b/pallets/collator-selection/src/mock.rs index ac776e3d216..d7b9c2bf74d 100644 --- a/pallets/collator-selection/src/mock.rs +++ b/pallets/collator-selection/src/mock.rs @@ -96,7 +96,7 @@ impl pallet_balances::Config for Test { type MaxLocks = (); type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -152,12 +152,12 @@ pub struct TestSessionHandler; impl pallet_session::SessionHandler for TestSessionHandler { const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = &[UintAuthorityId::ID]; fn on_genesis_session(keys: &[(u64, Ks)]) { - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_new_session(_: bool, keys: &[(u64, Ks)], _: &[(u64, Ks)]) { SessionChangeBlock::set(System::block_number()); dbg!(keys.len()); - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_before_session_ending() {} fn on_disabled(_: u32) {} @@ -195,11 +195,7 @@ parameter_types! { pub struct IsRegistered; impl ValidatorRegistration for IsRegistered { fn is_registered(id: &u64) -> bool { - if *id == 7u64 { - false - } else { - true - } + *id != 42u64 } } @@ -221,7 +217,7 @@ impl Config for Test { pub fn new_test_ext() -> sp_io::TestExternalities { sp_tracing::try_init_simple(); let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - let invulnerables = vec![1, 2]; + let invulnerables = vec![2, 1]; // unsorted let balances = vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)]; let keys = balances diff --git a/pallets/collator-selection/src/tests.rs b/pallets/collator-selection/src/tests.rs index 459b107ecc5..9014b6eff65 100644 --- a/pallets/collator-selection/src/tests.rs +++ b/pallets/collator-selection/src/tests.rs @@ -20,7 +20,7 @@ use frame_support::{ traits::{Currency, GenesisBuild, OnInitialize}, }; use pallet_balances::Error as BalancesError; -use sp_runtime::traits::BadOrigin; +use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin}; #[test] fn basic_setup_works() { @@ -29,6 +29,7 @@ fn basic_setup_works() { assert_eq!(CollatorSelection::candidacy_bond(), 10); assert!(CollatorSelection::candidates().is_empty()); + // genesis should sort input assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); }); } @@ -36,31 +37,159 @@ fn basic_setup_works() { #[test] fn it_should_set_invulnerables() { new_test_ext().execute_with(|| { - let new_set = vec![1, 2, 3, 4]; + let mut new_set = vec![1, 4, 3, 2]; assert_ok!(CollatorSelection::set_invulnerables( RuntimeOrigin::signed(RootAccount::get()), new_set.clone() )); + new_set.sort(); assert_eq!(CollatorSelection::invulnerables(), new_set); // cannot set with non-root. assert_noop!( - CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set.clone()), + CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set), BadOrigin ); // cannot set invulnerables without associated validator keys - let invulnerables = vec![7]; + let invulnerables = vec![42]; assert_noop!( CollatorSelection::set_invulnerables( RuntimeOrigin::signed(RootAccount::get()), - invulnerables.clone() + invulnerables ), Error::::ValidatorNotRegistered ); }); } +#[test] +fn add_invulnerable_works() { + new_test_ext().execute_with(|| { + initialize_to_block(1); + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); + let new = 3; + + // function runs + assert_ok!(CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + new + )); + + System::assert_last_event(RuntimeEvent::CollatorSelection( + crate::Event::InvulnerableAdded { account_id: new }, + )); + + // same element cannot be added more than once + assert_noop!( + CollatorSelection::add_invulnerable(RuntimeOrigin::signed(RootAccount::get()), new), + Error::::AlreadyInvulnerable + ); + + // new element is now part of the invulnerables list + assert!(CollatorSelection::invulnerables().to_vec().contains(&new)); + + // cannot add with non-root + assert_noop!(CollatorSelection::add_invulnerable(RuntimeOrigin::signed(1), new), BadOrigin); + + // cannot add invulnerable without associated validator keys + let not_validator = 42; + assert_noop!( + CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + not_validator + ), + Error::::ValidatorNotRegistered + ); + }); +} + +#[test] +fn invulnerable_limit_works() { + new_test_ext().execute_with(|| { + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); + + // MaxInvulnerables: u32 = 20 + for ii in 3..=21 { + // only keys were registered in mock for 1 to 5 + if ii > 5 { + Balances::make_free_balance_be(&ii, 100); + let key = MockSessionKeys { aura: UintAuthorityId(ii) }; + Session::set_keys(RuntimeOrigin::signed(ii).into(), key, Vec::new()).unwrap(); + } + assert_eq!(Balances::free_balance(ii), 100); + if ii < 21 { + assert_ok!(CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + ii + )); + } else { + assert_noop!( + CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + ii + ), + Error::::TooManyInvulnerables + ); + } + } + let expected: Vec = (1..=20).collect(); + assert_eq!(CollatorSelection::invulnerables(), expected); + + // Cannot set too many Invulnerables + let too_many_invulnerables: Vec = (1..=21).collect(); + assert_noop!( + CollatorSelection::set_invulnerables( + RuntimeOrigin::signed(RootAccount::get()), + too_many_invulnerables + ), + Error::::TooManyInvulnerables + ); + assert_eq!(CollatorSelection::invulnerables(), expected); + }); +} + +#[test] +fn remove_invulnerable_works() { + new_test_ext().execute_with(|| { + initialize_to_block(1); + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); + + assert_ok!(CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 4 + )); + assert_ok!(CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 3 + )); + + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2, 3, 4]); + + assert_ok!(CollatorSelection::remove_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 2 + )); + + System::assert_last_event(RuntimeEvent::CollatorSelection( + crate::Event::InvulnerableRemoved { account_id: 2 }, + )); + assert_eq!(CollatorSelection::invulnerables(), vec![1, 3, 4]); + + // cannot remove invulnerable not in the list + assert_noop!( + CollatorSelection::remove_invulnerable(RuntimeOrigin::signed(RootAccount::get()), 2), + Error::::NotInvulnerable + ); + + // cannot remove without privilege + assert_noop!( + CollatorSelection::remove_invulnerable(RuntimeOrigin::signed(1), 3), + BadOrigin + ); + }); +} + #[test] fn set_desired_candidates_works() { new_test_ext().execute_with(|| { @@ -157,7 +286,7 @@ fn cannot_register_as_candidate_if_keys_not_registered() { new_test_ext().execute_with(|| { // can't 7 because keys not registered. assert_noop!( - CollatorSelection::register_as_candidate(RuntimeOrigin::signed(7)), + CollatorSelection::register_as_candidate(RuntimeOrigin::signed(42)), Error::::ValidatorNotRegistered ); }) @@ -184,8 +313,8 @@ fn cannot_register_dupe_candidate() { #[test] fn cannot_register_as_candidate_if_poor() { new_test_ext().execute_with(|| { - assert_eq!(Balances::free_balance(&3), 100); - assert_eq!(Balances::free_balance(&33), 0); + assert_eq!(Balances::free_balance(3), 100); + assert_eq!(Balances::free_balance(33), 0); // works assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); @@ -208,14 +337,14 @@ fn register_as_candidate_works() { assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); // take two endowed, non-invulnerables accounts. - assert_eq!(Balances::free_balance(&3), 100); - assert_eq!(Balances::free_balance(&4), 100); + assert_eq!(Balances::free_balance(3), 100); + assert_eq!(Balances::free_balance(4), 100); assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4))); - assert_eq!(Balances::free_balance(&3), 90); - assert_eq!(Balances::free_balance(&4), 90); + assert_eq!(Balances::free_balance(3), 90); + assert_eq!(Balances::free_balance(4), 90); assert_eq!(CollatorSelection::candidates().len(), 2); }); diff --git a/pallets/collator-selection/src/weights.rs b/pallets/collator-selection/src/weights.rs index 32e816b5dbe..6b02d28d673 100644 --- a/pallets/collator-selection/src/weights.rs +++ b/pallets/collator-selection/src/weights.rs @@ -27,6 +27,8 @@ use sp_std::marker::PhantomData; // The weight info trait for `pallet_collator_selection`. pub trait WeightInfo { fn set_invulnerables(_b: u32) -> Weight; + fn add_invulnerable(_b: u32) -> Weight; + fn remove_invulnerable(_b: u32) -> Weight; fn set_desired_candidates() -> Weight; fn set_candidacy_bond() -> Weight; fn register_as_candidate(_c: u32) -> Weight; @@ -39,93 +41,157 @@ pub trait WeightInfo { pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { fn set_invulnerables(b: u32) -> Weight { - Weight::from_parts(18_563_000 as u64, 0) + Weight::from_parts(18_563_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn set_desired_candidates() -> Weight { - Weight::from_parts(16_363_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(16_363_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } fn set_candidacy_bond() -> Weight { - Weight::from_parts(16_840_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(16_840_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } fn register_as_candidate(c: u32) -> Weight { - Weight::from_parts(71_196_000 as u64, 0) + Weight::from_parts(71_196_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } fn leave_intent(c: u32) -> Weight { - Weight::from_parts(55_336_000 as u64, 0) + Weight::from_parts(55_336_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } fn note_author() -> Weight { - Weight::from_parts(71_461_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + Weight::from_parts(71_461_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } fn new_session(r: u32, c: u32) -> Weight { - Weight::from_parts(0 as u64, 0) + Weight::from_parts(0_u64, 0) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64)) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) - .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64))) - .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64))) - .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64))) + .saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1_u64.saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().reads(2_u64.saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(c as u64))) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } // For backwards compatibility and tests impl WeightInfo for () { fn set_invulnerables(b: u32) -> Weight { - Weight::from_parts(18_563_000 as u64, 0) + Weight::from_parts(18_563_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + .saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn set_desired_candidates() -> Weight { - Weight::from_parts(16_363_000 as u64, 0) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(16_363_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64)) } fn set_candidacy_bond() -> Weight { - Weight::from_parts(16_840_000 as u64, 0) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(16_840_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64)) } fn register_as_candidate(c: u32) -> Weight { - Weight::from_parts(71_196_000 as u64, 0) + Weight::from_parts(71_196_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } fn leave_intent(c: u32) -> Weight { - Weight::from_parts(55_336_000 as u64, 0) + Weight::from_parts(55_336_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } fn note_author() -> Weight { - Weight::from_parts(71_461_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(4 as u64)) + Weight::from_parts(71_461_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } fn new_session(r: u32, c: u32) -> Weight { - Weight::from_parts(0 as u64, 0) + Weight::from_parts(0_u64, 0) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64)) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64))) - .saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64))) - .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64))) - .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64))) + .saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(1_u64.saturating_mul(r as u64))) + .saturating_add(RocksDbWeight::get().reads(2_u64.saturating_mul(c as u64))) + .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(r as u64))) + .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(c as u64))) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(RocksDbWeight::get().reads(2)) + .saturating_add(RocksDbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) } } diff --git a/pallets/dmp-queue/Cargo.toml b/pallets/dmp-queue/Cargo.toml index 81cb05d8af1..c2e914cf282 100644 --- a/pallets/dmp-queue/Cargo.toml +++ b/pallets/dmp-queue/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ], default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index cfb392caba8..2c4a8002a85 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -76,7 +76,7 @@ pub struct PageIndexData { /// Simple type used to identify messages for the purpose of reporting events. Secure if and only /// if the message content is unique. -pub type MessageId = [u8; 32]; +pub type MessageId = XcmHash; /// Index used to identify overweight messages. pub type OverweightIndex = u64; @@ -175,23 +175,39 @@ pub mod pallet { #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// Downward message is invalid XCM. - InvalidFormat { message_id: MessageId }, + InvalidFormat { message_hash: XcmHash }, /// Downward message is unsupported version of XCM. - UnsupportedVersion { message_id: MessageId }, + UnsupportedVersion { message_hash: XcmHash }, /// Downward message executed with the given outcome. - ExecutedDownward { message_id: MessageId, outcome: Outcome }, + ExecutedDownward { message_hash: XcmHash, message_id: XcmHash, outcome: Outcome }, /// The weight limit for handling downward messages was reached. - WeightExhausted { message_id: MessageId, remaining_weight: Weight, required_weight: Weight }, + WeightExhausted { + message_hash: XcmHash, + message_id: XcmHash, + remaining_weight: Weight, + required_weight: Weight, + }, /// Downward message is overweight and was placed in the overweight queue. OverweightEnqueued { - message_id: MessageId, + message_hash: XcmHash, + message_id: XcmHash, overweight_index: OverweightIndex, required_weight: Weight, }, /// Downward message from the overweight queue was executed. OverweightServiced { overweight_index: OverweightIndex, weight_used: Weight }, - /// The maximum number of downward messages was. - MaxMessagesExhausted { message_id: MessageId }, + /// The maximum number of downward messages was reached. + MaxMessagesExhausted { message_hash: XcmHash }, + } + + /// Error type when a message was failed to be serviced. + pub(crate) struct ServiceMessageError { + /// The message's hash. + message_hash: XcmHash, + /// The message's ID (which could also be its hash if nothing overrides it). + message_id: XcmHash, + /// Weight required for the message to be executed. + required_weight: Weight, } impl Pallet { @@ -251,8 +267,9 @@ pub mod pallet { limit: Weight, _sent_at: RelayBlockNumber, mut data: &[u8], - ) -> Result { - let message_id = sp_io::hashing::blake2_256(data); + ) -> Result { + let message_hash = sp_io::hashing::blake2_256(data); + let mut message_id = message_hash; let maybe_msg = VersionedXcm::::decode_all_with_depth_limit( MAX_XCM_DECODE_DEPTH, &mut data, @@ -260,21 +277,31 @@ pub mod pallet { .map(Xcm::::try_from); match maybe_msg { Err(_) => { - Self::deposit_event(Event::InvalidFormat { message_id }); + Self::deposit_event(Event::InvalidFormat { message_hash }); Ok(Weight::zero()) }, Ok(Err(())) => { - Self::deposit_event(Event::UnsupportedVersion { message_id }); + Self::deposit_event(Event::UnsupportedVersion { message_hash }); Ok(Weight::zero()) }, Ok(Ok(x)) => { - let outcome = T::XcmExecutor::execute_xcm(Parent, x, message_id, limit); + let outcome = T::XcmExecutor::prepare_and_execute( + Parent, + x, + &mut message_id, + limit, + Weight::zero(), + ); match outcome { - Outcome::Error(XcmError::WeightLimitReached(required)) => - Err((message_id, required)), + Outcome::Error(XcmError::WeightLimitReached(required_weight)) => + Err(ServiceMessageError { message_hash, message_id, required_weight }), outcome => { let weight_used = outcome.weight_used(); - Self::deposit_event(Event::ExecutedDownward { message_id, outcome }); + Self::deposit_event(Event::ExecutedDownward { + message_hash, + message_id, + outcome, + }); Ok(weight_used) }, } @@ -315,7 +342,7 @@ pub mod pallet { maybe_enqueue_page = Some(Vec::with_capacity(item_count_left)); Self::deposit_event(Event::MaxMessagesExhausted { - message_id: sp_io::hashing::blake2_256(&data), + message_hash: sp_io::hashing::blake2_256(&data), }); } else { // We're not currently enqueuing - try to execute inline. @@ -323,7 +350,11 @@ pub mod pallet { messages_processed += 1; match Self::try_service_message(remaining_weight, sent_at, &data[..]) { Ok(consumed) => used += consumed, - Err((message_id, required_weight)) => + Err(ServiceMessageError { + message_hash, + message_id, + required_weight, + }) => // Too much weight required right now. { let is_under_limit = @@ -335,6 +366,7 @@ pub mod pallet { let overweight_index = page_index.overweight_count; Overweight::::insert(overweight_index, (sent_at, data)); Self::deposit_event(Event::OverweightEnqueued { + message_hash, message_id, overweight_index, required_weight, @@ -349,6 +381,7 @@ pub mod pallet { let item_count_left = item_count.saturating_sub(i); maybe_enqueue_page = Some(Vec::with_capacity(item_count_left)); Self::deposit_event(Event::WeightExhausted { + message_hash, message_id, remaining_weight, required_weight, @@ -467,50 +500,36 @@ mod tests { }) } - pub enum Weightless {} - impl PreparedMessage for Weightless { + pub struct MockPrepared(Xcm); + impl PreparedMessage for MockPrepared { fn weight_of(&self) -> Weight { - unreachable!() + match ((self.0).0.len(), &(self.0).0.first()) { + (1, Some(Transact { require_weight_at_most, .. })) => *require_weight_at_most, + _ => Weight::from_parts(1, 1), + } } } pub struct MockExec; impl ExecuteXcm for MockExec { - type Prepared = Weightless; + type Prepared = MockPrepared; - fn prepare(_message: Xcm) -> Result { - unreachable!() + fn prepare(message: Xcm) -> Result { + Ok(MockPrepared(message)) } fn execute( _origin: impl Into, - _pre: Weightless, - _hash: XcmHash, - _weight_credit: Weight, - ) -> Outcome { - unreachable!() - } - - fn execute_xcm_in_credit( - _origin: impl Into, - message: Xcm, - _hash: XcmHash, - weight_limit: Weight, + prepared: MockPrepared, + _id: &mut XcmHash, _weight_credit: Weight, ) -> Outcome { + let message = prepared.0; let o = match (message.0.len(), &message.0.first()) { - (1, Some(Transact { require_weight_at_most, .. })) => { - if require_weight_at_most.all_lte(weight_limit) { - Outcome::Complete(*require_weight_at_most) - } else { - Outcome::Error(XcmError::WeightLimitReached(*require_weight_at_most)) - } - }, + (1, Some(Transact { require_weight_at_most, .. })) => + Outcome::Complete(*require_weight_at_most), // use 1000 to decide that it's not supported. - _ => Outcome::Incomplete( - Weight::from_parts(1000, 1000).min(weight_limit), - XcmError::Unimplemented, - ), + _ => Outcome::Incomplete(Weight::from_parts(1, 1), XcmError::Unimplemented), }; TRACE.with(|q| q.borrow_mut().push((message, o.clone()))); o @@ -565,13 +584,6 @@ mod tests { (msg(weight), Outcome::Complete(Weight::from_parts(weight, weight))) } - fn msg_limit_reached(weight: u64) -> (Xcm, Outcome) { - ( - msg(weight), - Outcome::Error(XcmError::WeightLimitReached(Weight::from_parts(weight, weight))), - ) - } - fn pages_queued() -> PageCounter { PageIndex::::get().end_used - PageIndex::::get().begin_used } @@ -614,10 +626,7 @@ mod tests { enqueue(&enqueued); let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); assert_eq!(weight_used, Weight::from_parts(2001, 2001)); - assert_eq!( - take_trace(), - vec![msg_complete(1000), msg_complete(1001), msg_limit_reached(1002),] - ); + assert_eq!(take_trace(), vec![msg_complete(1000), msg_complete(1001),]); }); } @@ -632,18 +641,15 @@ mod tests { PageIndexData { begin_used: 0, end_used: 1, overweight_count: 0 } ); assert_eq!(Pages::::get(0).len(), 3); - assert_eq!(take_trace(), vec![msg_limit_reached(1000)]); + assert_eq!(take_trace(), vec![]); let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); assert_eq!(weight_used, Weight::from_parts(2001, 2001)); - assert_eq!( - take_trace(), - vec![msg_complete(1000), msg_complete(1001), msg_limit_reached(1002),] - ); + assert_eq!(take_trace(), vec![msg_complete(1000), msg_complete(1001)]); let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); assert_eq!(weight_used, Weight::from_parts(1002, 1002)); - assert_eq!(take_trace(), vec![msg_complete(1002),]); + assert_eq!(take_trace(), vec![msg_complete(1002)]); assert!(queue_is_empty()); }); } @@ -656,7 +662,7 @@ mod tests { assert_eq!(weight_used, Weight::from_parts(1000, 1000)); assert_eq!(pages_queued(), 1); assert_eq!(Pages::::get(0).len(), 2); - assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(1001),]); + assert_eq!(take_trace(), vec![msg_complete(1000)]); let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); assert_eq!(weight_used, Weight::from_parts(2003, 2003)); @@ -694,13 +700,13 @@ mod tests { enqueue(&enqueued); let weight_used = handle_messages(&incoming, Weight::from_parts(5000, 5000)); assert_eq!(weight_used, Weight::from_parts(1000, 1000)); - assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(10001),]); + assert_eq!(take_trace(), vec![msg_complete(1000)]); assert_eq!(pages_queued(), 2); // 5000 is not enough to process the 10001 blocker, so nothing happens. let weight_used = handle_messages(&[], Weight::from_parts(5000, 5000)); assert_eq!(weight_used, Weight::zero()); - assert_eq!(take_trace(), vec![msg_limit_reached(10001),]); + assert_eq!(take_trace(), vec![]); // 20000 is now enough to process everything. let weight_used = handle_messages(&[], Weight::from_parts(20000, 20000)); @@ -721,10 +727,7 @@ mod tests { enqueue(&enqueued); let weight_used = handle_messages(&incoming, Weight::from_parts(5000, 5000)); assert_eq!(weight_used, Weight::from_parts(2001, 2001)); - assert_eq!( - take_trace(), - vec![msg_complete(1000), msg_complete(1001), msg_limit_reached(10002),] - ); + assert_eq!(take_trace(), vec![msg_complete(1000), msg_complete(1001)]); assert_eq!(pages_queued(), 1); // 20000 is now enough to process everything. @@ -745,12 +748,7 @@ mod tests { assert_eq!(weight_used, Weight::from_parts(3003, 3003)); assert_eq!( take_trace(), - vec![ - msg_complete(1000), - msg_complete(1001), - msg_complete(1002), - msg_limit_reached(10003), - ] + vec![msg_complete(1000), msg_complete(1001), msg_complete(1002),] ); assert_eq!(pages_queued(), 1); @@ -767,21 +765,21 @@ mod tests { new_test_ext().execute_with(|| { let enqueued = vec![msg(1000), msg(1001)]; enqueue(&enqueued); - let weight_used = handle_messages(&vec![msg(1002)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1002)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1000, 1000)); - assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(1001),]); + assert_eq!(take_trace(), vec![msg_complete(1000)]); assert_eq!(pages_queued(), 2); assert_eq!(PageIndex::::get().begin_used, 0); - let weight_used = handle_messages(&vec![msg(1003)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1003)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1001, 1001)); - assert_eq!(take_trace(), vec![msg_complete(1001), msg_limit_reached(1002),]); + assert_eq!(take_trace(), vec![msg_complete(1001)]); assert_eq!(pages_queued(), 2); assert_eq!(PageIndex::::get().begin_used, 1); - let weight_used = handle_messages(&vec![msg(1004)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1004)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1002, 1002)); - assert_eq!(take_trace(), vec![msg_complete(1002), msg_limit_reached(1003),]); + assert_eq!(take_trace(), vec![msg_complete(1002)]); assert_eq!(pages_queued(), 2); assert_eq!(PageIndex::::get().begin_used, 2); }); @@ -799,10 +797,7 @@ mod tests { let weight_used = handle_messages(&incoming, Weight::from_parts(2500, 2500)); assert_eq!(weight_used, Weight::from_parts(2002, 2002)); assert!(queue_is_empty()); - assert_eq!( - take_trace(), - vec![msg_complete(1000), msg_limit_reached(10001), msg_complete(1002),] - ); + assert_eq!(take_trace(), vec![msg_complete(1000), msg_complete(1002),]); assert_eq!(overweights(), vec![0]); }); @@ -819,7 +814,7 @@ mod tests { let incoming = vec![msg(10000)]; let weight_used = handle_messages(&incoming, Weight::from_parts(2500, 2500)); assert_eq!(weight_used, Weight::zero()); - assert_eq!(take_trace(), vec![msg_limit_reached(10000)]); + assert_eq!(take_trace(), vec![]); assert_eq!(overweights(), vec![0]); assert_noop!( @@ -846,7 +841,7 @@ mod tests { ), Error::::OverLimit ); - assert_eq!(take_trace(), vec![msg_limit_reached(10000)]); + assert_eq!(take_trace(), vec![]); let base_weight = super::Call::::service_overweight { index: 0, weight_limit: Weight::zero() } @@ -878,9 +873,9 @@ mod tests { #[test] fn on_idle_should_service_queue() { new_test_ext().execute_with(|| { - enqueue(&vec![msg(1000), msg(1001)]); - enqueue(&vec![msg(1002), msg(1003)]); - enqueue(&vec![msg(1004), msg(1005)]); + enqueue(&[msg(1000), msg(1001)]); + enqueue(&[msg(1002), msg(1003)]); + enqueue(&[msg(1004), msg(1005)]); let weight_used = DmpQueue::on_idle(1, Weight::from_parts(6000, 6000)); assert_eq!(weight_used, Weight::from_parts(5010, 5010)); @@ -892,7 +887,6 @@ mod tests { msg_complete(1002), msg_complete(1003), msg_complete(1004), - msg_limit_reached(1005), ] ); assert_eq!(pages_queued(), 1); @@ -902,20 +896,17 @@ mod tests { #[test] fn handle_max_messages_per_block() { new_test_ext().execute_with(|| { - enqueue(&vec![msg(1000), msg(1001)]); - enqueue(&vec![msg(1002), msg(1003)]); - enqueue(&vec![msg(1004), msg(1005)]); - - let incoming = (0..MAX_MESSAGES_PER_BLOCK) - .into_iter() - .map(|i| msg(1006 + i as u64)) - .collect::>(); + enqueue(&[msg(1000), msg(1001)]); + enqueue(&[msg(1002), msg(1003)]); + enqueue(&[msg(1004), msg(1005)]); + + let incoming = + (0..MAX_MESSAGES_PER_BLOCK).map(|i| msg(1006 + i as u64)).collect::>(); handle_messages(&incoming, Weight::from_parts(25000, 25000)); assert_eq!( take_trace(), (0..MAX_MESSAGES_PER_BLOCK) - .into_iter() .map(|i| msg_complete(1000 + i as u64)) .collect::>(), ); @@ -925,7 +916,6 @@ mod tests { assert_eq!( take_trace(), (MAX_MESSAGES_PER_BLOCK..MAX_MESSAGES_PER_BLOCK + 6) - .into_iter() .map(|i| msg_complete(1000 + i as u64)) .collect::>(), ); diff --git a/pallets/dmp-queue/src/migration.rs b/pallets/dmp-queue/src/migration.rs index b360f5a7bd4..5e1d357e142 100644 --- a/pallets/dmp-queue/src/migration.rs +++ b/pallets/dmp-queue/src/migration.rs @@ -74,7 +74,7 @@ pub fn migrate_to_v1() -> Weight { } }; - if let Err(_) = Configuration::::translate(|pre| pre.map(translate)) { + if Configuration::::translate(|pre| pre.map(translate)).is_err() { log::error!( target: "dmp_queue", "unexpected error when performing translation of the QueueConfig type during storage upgrade to v2" diff --git a/pallets/parachain-system/Cargo.toml b/pallets/parachain-system/Cargo.toml index 3a67e2eef4c..23db13bca7c 100644 --- a/pallets/parachain-system/Cargo.toml +++ b/pallets/parachain-system/Cargo.toml @@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = environmental = { version = "1.1.4", default-features = false } impl-trait-for-tuples = "0.2.1" log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/parachain-system/proc-macro/Cargo.toml b/pallets/parachain-system/proc-macro/Cargo.toml index 2eb35fe4f0b..5caf7cb7b3b 100644 --- a/pallets/parachain-system/proc-macro/Cargo.toml +++ b/pallets/parachain-system/proc-macro/Cargo.toml @@ -10,8 +10,8 @@ proc-macro = true [dependencies] syn = "2.0.15" -proc-macro2 = "1.0.54" -quote = "1.0.26" +proc-macro2 = "1.0.59" +quote = "1.0.28" proc-macro-crate = "1.3.1" [features] diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index 4025368904b..5f7e1501570 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -233,13 +233,13 @@ pub mod pallet { }; >::mutate(|up| { - let (count, size) = relevant_messaging_state.relay_dispatch_queue_size; + let queue_size = relevant_messaging_state.relay_dispatch_queue_size; let available_capacity = cmp::min( - host_config.max_upward_queue_count.saturating_sub(count), - host_config.max_upward_message_num_per_candidate, + queue_size.remaining_count, + host_config.max_upward_message_num_per_candidate.into(), ); - let available_size = host_config.max_upward_queue_size.saturating_sub(size); + let available_size = queue_size.remaining_size; // Count the number of messages we can possibly fit in the given constraints, i.e. // available_capacity and available_size. @@ -385,6 +385,16 @@ pub mod pallet { ) .expect("Invalid relay chain state proof"); + // Deposit a log indicating the relay-parent storage root. + // TODO: remove this in favor of the relay-parent's hash after + // https://github.com/paritytech/cumulus/issues/303 + frame_system::Pallet::::deposit_log( + cumulus_primitives_core::rpsr_digest::relay_parent_storage_root_item( + vfp.relay_parent_storage_root, + vfp.relay_parent_number, + ), + ); + // initialization logic: we know that this runs exactly once every block, // which means we can put the initialization logic here to remove the // sequencing problem. @@ -421,7 +431,7 @@ pub mod pallet { .read_abridged_host_configuration() .expect("Invalid host configuration in relay chain state proof"); let relevant_messaging_state = relay_state_proof - .read_messaging_state_snapshot() + .read_messaging_state_snapshot(&host_config) .expect("Invalid messaging state in relay chain state proof"); >::put(&vfp); @@ -473,10 +483,7 @@ pub mod pallet { check_version: bool, ) -> DispatchResult { ensure_root(origin)?; - AuthorizedUpgrade::::put(CodeUpgradeAuthorization { - code_hash: code_hash.clone(), - check_version, - }); + AuthorizedUpgrade::::put(CodeUpgradeAuthorization { code_hash, check_version }); Self::deposit_event(Event::UpgradeAuthorized { code_hash }); Ok(()) @@ -753,7 +760,7 @@ impl Pallet { let authorization = AuthorizedUpgrade::::get().ok_or(Error::::NothingAuthorized)?; // ensure that the actual hash matches the authorized hash - let actual_hash = T::Hashing::hash(&code[..]); + let actual_hash = T::Hashing::hash(code); ensure!(actual_hash == authorization.code_hash, Error::::Unauthorized); // check versions if required as part of the authorization @@ -941,10 +948,10 @@ impl Pallet { // `running_mqc_heads`. Otherwise, in a block where no messages were sent in a channel // it won't get into next block's `last_mqc_heads` and thus will be all zeros, which // would corrupt the message queue chain. - for &(ref sender, ref channel) in ingress_channels { + for (sender, channel) in ingress_channels { let cur_head = running_mqc_heads .entry(sender) - .or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default()) + .or_insert_with(|| last_mqc_heads.get(sender).cloned().unwrap_or_default()) .head(); let target_head = channel.mqc_head.unwrap_or_default(); @@ -1090,22 +1097,20 @@ impl Pallet { // may change so that the message is no longer valid. // // However, changing this setting is expected to be rare. - match Self::host_configuration() { - Some(cfg) => - if message.len() > cfg.max_upward_message_size as usize { - return Err(MessageSendError::TooBig) - }, - None => { - // This storage field should carry over from the previous block. So if it's None - // then it must be that this is an edge-case where a message is attempted to be - // sent at the first block. - // - // Let's pass this message through. I think it's not unreasonable to expect that - // the message is not huge and it comes through, but if it doesn't it can be - // returned back to the sender. - // - // Thus fall through here. - }, + if let Some(cfg) = Self::host_configuration() { + if message.len() > cfg.max_upward_message_size as usize { + return Err(MessageSendError::TooBig) + } + } else { + // This storage field should carry over from the previous block. So if it's None + // then it must be that this is an edge-case where a message is attempted to be + // sent at the first block. + // + // Let's pass this message through. I think it's not unreasonable to expect that + // the message is not huge and it comes through, but if it doesn't it can be + // returned back to the sender. + // + // Thus fall through here. }; >::append(message.clone()); diff --git a/pallets/parachain-system/src/relay_state_snapshot.rs b/pallets/parachain-system/src/relay_state_snapshot.rs index 0a6426a8012..e3763549d44 100644 --- a/pallets/parachain-system/src/relay_state_snapshot.rs +++ b/pallets/parachain-system/src/relay_state_snapshot.rs @@ -24,6 +24,17 @@ use sp_state_machine::{Backend, TrieBackend, TrieBackendBuilder}; use sp_std::vec::Vec; use sp_trie::{HashDBT, MemoryDB, StorageProof, EMPTY_PREFIX}; +/// The capacity of the upward message queue of a parachain on the relay chain. +// The field order should stay the same as the data can be found in the proof to ensure both are +// have the same encoded representation. +#[derive(Clone, Encode, Decode, TypeInfo, Default)] +pub struct RelayDispachQueueSize { + /// The number of additional messages that can be enqueued. + pub remaining_count: u32, + /// The total size of additional messages that can be enqueued. + pub remaining_size: u32, +} + /// A snapshot of some messaging related state of relay chain pertaining to the current parachain. /// /// This data is essential for making sure that the parachain is aware of current resource use on @@ -37,10 +48,7 @@ pub struct MessagingStateSnapshot { pub dmq_mqc_head: relay_chain::Hash, /// The current capacity of the upward message queue of the current parachain on the relay chain. - /// - /// The capacity is represented by a tuple that consist of the `count` of the messages and the - /// `total_size` expressed as the sum of byte sizes of all messages in the queue. - pub relay_dispatch_queue_size: (u32, u32), + pub relay_dispatch_queue_size: RelayDispachQueueSize, /// Information about all the inbound HRMP channels. /// @@ -164,7 +172,10 @@ impl RelayChainStateProof { /// Read the [`MessagingStateSnapshot`] from the relay chain state proof. /// /// Returns an error if anything failed at reading or decoding. - pub fn read_messaging_state_snapshot(&self) -> Result { + pub fn read_messaging_state_snapshot( + &self, + host_config: &AbridgedHostConfiguration, + ) -> Result { let dmq_mqc_head: relay_chain::Hash = read_entry( &self.trie_backend, &relay_chain::well_known_keys::dmq_mqc_head(self.para_id), @@ -172,12 +183,35 @@ impl RelayChainStateProof { ) .map_err(Error::DmqMqcHead)?; - let relay_dispatch_queue_size: (u32, u32) = read_entry( + let relay_dispatch_queue_size = read_optional_entry::( &self.trie_backend, - &relay_chain::well_known_keys::relay_dispatch_queue_size(self.para_id), - Some((0, 0)), - ) - .map_err(Error::RelayDispatchQueueSize)?; + &relay_chain::well_known_keys::relay_dispatch_queue_remaining_capacity(self.para_id) + .key, + ); + + // TODO paritytech/polkadot#6283: Remove all usages of `relay_dispatch_queue_size` + // + // When the relay chain and all parachains support `relay_dispatch_queue_remaining_capacity`, + // this code here needs to be removed and above needs to be changed to `read_entry` that + // returns an error if `relay_dispatch_queue_remaining_capacity` can not be found/decoded. + // + // For now we just fallback to the old dispatch queue size if there is an error. + let relay_dispatch_queue_size = match relay_dispatch_queue_size { + Ok(Some(r)) => r, + _ => { + let res = read_entry::<(u32, u32), _>( + &self.trie_backend, + #[allow(deprecated)] + &relay_chain::well_known_keys::relay_dispatch_queue_size(self.para_id), + Some((0, 0)), + ) + .map_err(Error::RelayDispatchQueueSize)?; + + let remaining_count = host_config.max_upward_queue_count.saturating_sub(res.0); + let remaining_size = host_config.max_upward_queue_size.saturating_sub(res.1); + RelayDispachQueueSize { remaining_count, remaining_size } + }, + }; let ingress_channel_index: Vec = read_entry( &self.trie_backend, diff --git a/pallets/parachain-system/src/tests.rs b/pallets/parachain-system/src/tests.rs index 70e4c106bf2..d1dd6a83736 100755 --- a/pallets/parachain-system/src/tests.rs +++ b/pallets/parachain-system/src/tests.rs @@ -304,7 +304,7 @@ impl BlockTests { // begin initialization System::reset_events(); - System::initialize(&n, &Default::default(), &Default::default()); + System::initialize(n, &Default::default(), &Default::default()); // now mess with the storage the way validate_block does let mut sproof_builder = RelayStateSproofBuilder::default(); @@ -357,10 +357,8 @@ impl BlockTests { ParachainSystem::on_finalize(*n); // did block execution set new validation code? - if NewValidationCode::::exists() { - if self.pending_upgrade.is_some() { - panic!("attempted to set validation code while upgrade was pending"); - } + if NewValidationCode::::exists() && self.pending_upgrade.is_some() { + panic!("attempted to set validation code while upgrade was pending"); } // clean up @@ -404,7 +402,7 @@ fn events() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored.into()) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored) ); }, ) @@ -415,10 +413,9 @@ fn events() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem( - crate::Event::ValidationFunctionApplied { relay_chain_block_num: 1234 } - .into() - ) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionApplied { + relay_chain_block_num: 1234 + }) ); }, ); @@ -491,7 +488,7 @@ fn aborted_upgrade() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded.into()) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded) ); }, ); @@ -516,7 +513,7 @@ fn send_upward_message_num_per_candidate() { BlockTests::new() .with_relay_sproof_builder(|_, _, sproof| { sproof.host_config.max_upward_message_num_per_candidate = 1; - sproof.relay_dispatch_queue_size = None; + sproof.relay_dispatch_queue_remaining_capacity = None; }) .add_with_post_test( 1, @@ -547,8 +544,8 @@ fn send_upward_message_relay_bottleneck() { sproof.host_config.max_upward_queue_count = 5; match relay_block_num { - 1 => sproof.relay_dispatch_queue_size = Some((5, 0)), - 2 => sproof.relay_dispatch_queue_size = Some((4, 0)), + 1 => sproof.relay_dispatch_queue_remaining_capacity = Some((0, 2048)), + 2 => sproof.relay_dispatch_queue_remaining_capacity = Some((1, 2048)), _ => unreachable!(), } }) @@ -1009,3 +1006,18 @@ fn upgrade_version_checks_should_work() { }); } } + +#[test] +fn deposits_relay_parent_storage_root() { + BlockTests::new().add_with_post_test( + 123, + || {}, + || { + let digest = System::digest(); + assert!(cumulus_primitives_core::rpsr_digest::extract_relay_parent_storage_root( + &digest + ) + .is_some()); + }, + ); +} diff --git a/pallets/parachain-system/src/validate_block/tests.rs b/pallets/parachain-system/src/validate_block/tests.rs index 2c39188a085..4801b62e7b5 100644 --- a/pallets/parachain-system/src/validate_block/tests.rs +++ b/pallets/parachain-system/src/validate_block/tests.rs @@ -41,7 +41,7 @@ fn call_validate_block_encoded_header( relay_parent_number: 1, relay_parent_storage_root, }, - &WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), + WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), ) .map(|v| v.head_data.0) } @@ -191,7 +191,7 @@ fn validate_block_invalid_parent_hash() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["validate_block_invalid_parent_hash", "--", "--nocapture"]) + .args(["validate_block_invalid_parent_hash", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -213,7 +213,7 @@ fn validate_block_fails_on_invalid_validation_data() { call_validate_block(parent_head, block, Hash::random()).unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"]) + .args(["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -242,7 +242,7 @@ fn check_inherent_fails_on_validate_block_as_expected() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"]) + .args(["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -276,7 +276,7 @@ fn check_inherents_are_unsigned_and_before_all_other_extrinsics() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&[ + .args([ "check_inherents_are_unsigned_and_before_all_other_extrinsics", "--", "--nocapture", diff --git a/pallets/session-benchmarking/Cargo.toml b/pallets/session-benchmarking/Cargo.toml index 11f985633e0..111cbb85ee6 100644 --- a/pallets/session-benchmarking/Cargo.toml +++ b/pallets/session-benchmarking/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -parity-scale-codec = { version = "3.4.0", default-features = false } +parity-scale-codec = { version = "3.5.0", default-features = false } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/pallets/solo-to-para/Cargo.toml b/pallets/solo-to-para/Cargo.toml index d4800733cee..c7398391b7f 100644 --- a/pallets/solo-to-para/Cargo.toml +++ b/pallets/solo-to-para/Cargo.toml @@ -7,7 +7,7 @@ description = "Adds functionality to migrate from a Solo to a Parachain" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/xcm/Cargo.toml b/pallets/xcm/Cargo.toml index 841c862557a..80436a841ea 100644 --- a/pallets/xcm/Cargo.toml +++ b/pallets/xcm/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/xcmp-queue/Cargo.toml b/pallets/xcmp-queue/Cargo.toml index 62419f78a08..2238469f05a 100644 --- a/pallets/xcmp-queue/Cargo.toml +++ b/pallets/xcmp-queue/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ], default-features = false } log = { version = "0.4.17", default-features = false } rand_chacha = { version = "0.3.0", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index df2b78ebc20..93c9100f520 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -282,15 +282,15 @@ pub mod pallet { #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// Some XCM was executed ok. - Success { message_hash: Option, weight: Weight }, + Success { message_hash: XcmHash, message_id: XcmHash, weight: Weight }, /// Some XCM failed. - Fail { message_hash: Option, error: XcmError, weight: Weight }, + Fail { message_hash: XcmHash, message_id: XcmHash, error: XcmError, weight: Weight }, /// Bad XCM version used. - BadVersion { message_hash: Option }, + BadVersion { message_hash: XcmHash }, /// Bad XCM format used. - BadFormat { message_hash: Option }, + BadFormat { message_hash: XcmHash }, /// An HRMP message was sent to a sibling parachain. - XcmpMessageSent { message_hash: Option }, + XcmpMessageSent { message_hash: XcmHash }, /// An XCM exceeded the individual message weight budget. OverweightEnqueued { sender: ParaId, @@ -538,7 +538,7 @@ impl Pallet { return false } s.extend_from_slice(&data[..]); - return true + true }); if appended { Ok((details.last_index - details.first_index - 1) as u32) @@ -619,27 +619,33 @@ impl Pallet { xcm: VersionedXcm, max_weight: Weight, ) -> Result { - let hash = xcm.using_encoded(sp_io::hashing::blake2_256); - log::debug!("Processing XCMP-XCM: {:?}", &hash); + let message_hash = xcm.using_encoded(sp_io::hashing::blake2_256); + log::debug!("Processing XCMP-XCM: {:?}", &message_hash); let (result, event) = match Xcm::::try_from(xcm) { Ok(xcm) => { let location = (Parent, Parachain(sender.into())); - - match T::XcmExecutor::execute_xcm(location, xcm, hash, max_weight) { - Outcome::Error(e) => ( - Err(e), - Event::Fail { message_hash: Some(hash), error: e, weight: Weight::zero() }, + let mut message_id = message_hash; + + match T::XcmExecutor::prepare_and_execute( + location, + xcm, + &mut message_id, + max_weight, + Weight::zero(), + ) { + Outcome::Error(error) => ( + Err(error), + Event::Fail { message_hash, message_id, error, weight: Weight::zero() }, ), - Outcome::Complete(w) => - (Ok(w), Event::Success { message_hash: Some(hash), weight: w }), + Outcome::Complete(weight) => + (Ok(weight), Event::Success { message_hash, message_id, weight }), // As far as the caller is concerned, this was dispatched without error, so // we just report the weight used. - Outcome::Incomplete(w, e) => - (Ok(w), Event::Fail { message_hash: Some(hash), error: e, weight: w }), + Outcome::Incomplete(weight, error) => + (Ok(weight), Event::Fail { message_hash, message_id, error, weight }), } }, - Err(()) => - (Err(XcmError::UnhandledXcmVersion), Event::BadVersion { message_hash: Some(hash) }), + Err(()) => (Err(XcmError::UnhandledXcmVersion), Event::BadVersion { message_hash }), }; Self::deposit_event(event); result @@ -1183,7 +1189,7 @@ impl SendXcm for Pallet { match Self::send_fragment(id, XcmpMessageFormat::ConcatenatedVersionedXcm, xcm) { Ok(_) => { - Self::deposit_event(Event::XcmpMessageSent { message_hash: Some(hash) }); + Self::deposit_event(Event::XcmpMessageSent { message_hash: hash }); Ok(hash) }, Err(e) => Err(SendError::Transport(<&'static str>::from(e))), diff --git a/pallets/xcmp-queue/src/migration.rs b/pallets/xcmp-queue/src/migration.rs index f6ece1da1a8..fd1301b9491 100644 --- a/pallets/xcmp-queue/src/migration.rs +++ b/pallets/xcmp-queue/src/migration.rs @@ -94,7 +94,7 @@ pub fn migrate_to_v2() -> Weight { } }; - if let Err(_) = QueueConfig::::translate(|pre| pre.map(translate)) { + if QueueConfig::::translate(|pre| pre.map(translate)).is_err() { log::error!( target: super::LOG_TARGET, "unexpected error when performing translation of the QueueConfig type during storage upgrade to v2" diff --git a/pallets/xcmp-queue/src/mock.rs b/pallets/xcmp-queue/src/mock.rs index 0d7d6eda00b..873ab463cc9 100644 --- a/pallets/xcmp-queue/src/mock.rs +++ b/pallets/xcmp-queue/src/mock.rs @@ -100,7 +100,7 @@ impl pallet_balances::Config for Test { type MaxLocks = (); type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -120,7 +120,7 @@ impl cumulus_pallet_parachain_system::Config for Test { parameter_types! { pub const RelayChain: MultiLocation = MultiLocation::parent(); - pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32.into())).into(); + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32)); pub UnitWeightCost: Weight = Weight::from_parts(1_000_000, 1024); pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; diff --git a/pallets/xcmp-queue/src/tests.rs b/pallets/xcmp-queue/src/tests.rs index 952a2758f30..ad0fa906da3 100644 --- a/pallets/xcmp-queue/src/tests.rs +++ b/pallets/xcmp-queue/src/tests.rs @@ -23,7 +23,7 @@ use sp_runtime::traits::BadOrigin; fn one_message_does_not_panic() { new_test_ext().execute_with(|| { let message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode(); - let messages = vec![(Default::default(), 1u32.into(), message_format.as_slice())]; + let messages = vec![(Default::default(), 1u32, message_format.as_slice())]; // This shouldn't cause a panic XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -128,7 +128,7 @@ fn suspend_xcm_execution_works() { .encode(); let mut message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode(); message_format.extend(xcm.clone()); - let messages = vec![(ParaId::from(999), 1u32.into(), message_format.as_slice())]; + let messages = vec![(ParaId::from(999), 1u32, message_format.as_slice())]; // This should have executed the incoming XCM, because it came from a system parachain XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -136,7 +136,7 @@ fn suspend_xcm_execution_works() { let queued_xcm = InboundXcmpMessages::::get(ParaId::from(999), 1u32); assert!(queued_xcm.is_empty()); - let messages = vec![(ParaId::from(2000), 1u32.into(), message_format.as_slice())]; + let messages = vec![(ParaId::from(2000), 1u32, message_format.as_slice())]; // This shouldn't have executed the incoming XCM XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -294,7 +294,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() { // XcmpQueue - check dest is really not applicable let dest = (Parent, Parent, Parent); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert_eq!( Err(SendError::NotApplicable), @@ -302,7 +302,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() { ); // check wrapper were not consumed - assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(dest.into()), dest_wrapper.take()); assert_eq!(Some(message.clone()), msg_wrapper.take()); // another try with router chain with asserting sender @@ -322,7 +322,7 @@ fn xcmp_queue_consumes_dest_and_msg_on_ok_validate() { // XcmpQueue - check dest/msg is valid let dest = (Parent, X1(Parachain(5555))); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert!(::validate(&mut dest_wrapper, &mut msg_wrapper).is_ok()); diff --git a/pallets/xcmp-queue/src/weights.rs b/pallets/xcmp-queue/src/weights.rs index b275982b003..cbb29ac3ae3 100644 --- a/pallets/xcmp-queue/src/weights.rs +++ b/pallets/xcmp-queue/src/weights.rs @@ -18,31 +18,31 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } impl WeightInfo for () { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/parachain-template/node/Cargo.toml b/parachain-template/node/Cargo.toml index a1734127c11..d45f915bad6 100644 --- a/parachain-template/node/Cargo.toml +++ b/parachain-template/node/Cargo.toml @@ -10,10 +10,10 @@ edition = "2021" build = "build.rs" [dependencies] -clap = { version = "4.2.7", features = ["derive"] } +clap = { version = "4.3.0", features = ["derive"] } log = "0.4.17" codec = { package = "parity-scale-codec", version = "3.0.0" } -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.163", features = ["derive"] } jsonrpsee = { version = "0.16.2", features = ["server"] } # Local diff --git a/parachain-template/node/src/cli.rs b/parachain-template/node/src/cli.rs index 2e64a53e96a..b72579c86b9 100644 --- a/parachain-template/node/src/cli.rs +++ b/parachain-template/node/src/cli.rs @@ -105,7 +105,11 @@ impl RelayChainCli { ) -> Self { let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec); let chain_id = extension.map(|e| e.relay_chain.clone()); - let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot")); - Self { base_path, chain_id, base: clap::Parser::parse_from(relay_chain_args) } + let base_path = para_config.base_path.path().join("polkadot"); + Self { + base_path: Some(base_path), + chain_id, + base: clap::Parser::parse_from(relay_chain_args), + } } } diff --git a/parachain-template/node/src/command.rs b/parachain-template/node/src/command.rs index 36e5ab635ac..c3e79ebe387 100644 --- a/parachain-template/node/src/command.rs +++ b/parachain-template/node/src/command.rs @@ -268,13 +268,13 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let hwbench = (!cli.no_hardware_benchmarks).then_some( config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) })).flatten(); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) - .ok_or_else(|| "Could not find parachain ID in chain-spec.")?; + .ok_or("Could not find parachain ID in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, @@ -301,7 +301,7 @@ pub fn run() -> Result<()> { info!("Parachain genesis state: {}", genesis_state); info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); - if !collator_options.relay_chain_rpc_urls.is_empty() && cli.relay_chain_args.len() > 0 { + if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relay_chain_args.is_empty() { warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); } @@ -325,14 +325,10 @@ impl DefaultConfigurationValues for RelayChainCli { 30334 } - fn rpc_ws_listen_port() -> u16 { + fn rpc_listen_port() -> u16 { 9945 } - fn rpc_http_listen_port() -> u16 { - 9934 - } - fn prometheus_listen_port() -> u16 { 9616 } @@ -362,16 +358,8 @@ impl CliConfiguration for RelayChainCli { .or_else(|| self.base_path.clone().map(Into::into))) } - fn rpc_http(&self, default_listen_port: u16) -> Result> { - self.base.base.rpc_http(default_listen_port) - } - - fn rpc_ipc(&self) -> Result> { - self.base.base.rpc_ipc() - } - - fn rpc_ws(&self, default_listen_port: u16) -> Result> { - self.base.base.rpc_ws(default_listen_port) + fn rpc_addr(&self, default_listen_port: u16) -> Result> { + self.base.base.rpc_addr(default_listen_port) } fn prometheus_config( @@ -417,8 +405,8 @@ impl CliConfiguration for RelayChainCli { self.base.base.rpc_methods() } - fn rpc_ws_max_connections(&self) -> Result> { - self.base.base.rpc_ws_max_connections() + fn rpc_max_connections(&self) -> Result { + self.base.base.rpc_max_connections() } fn rpc_cors(&self, is_dev: bool) -> Result>> { diff --git a/parachain-template/node/src/service.rs b/parachain-template/node/src/service.rs index 4c9e1febf70..fb311a48b48 100644 --- a/parachain-template/node/src/service.rs +++ b/parachain-template/node/src/service.rs @@ -157,6 +157,7 @@ async fn start_node_impl( let params = new_partial(¶chain_config)?; let (block_import, mut telemetry, telemetry_worker_handle) = params.other; + let net_config = sc_network::config::FullNetworkConfiguration::new(¶chain_config.network); let client = params.client.clone(); let backend = params.backend.clone(); @@ -182,6 +183,7 @@ async fn start_node_impl( let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = build_network(BuildNetworkParams { parachain_config: ¶chain_config, + net_config, client: client.clone(), transaction_pool: transaction_pool.clone(), para_id, diff --git a/parachain-template/pallets/template/Cargo.toml b/parachain-template/pallets/template/Cargo.toml index ca574f6c8d5..f47d82c9798 100644 --- a/parachain-template/pallets/template/Cargo.toml +++ b/parachain-template/pallets/template/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pallet-template" +name = "pallet-parachain-template" authors = ["Anonymous"] description = "FRAME pallet template for defining custom runtime logic." version = "0.1.0" diff --git a/parachain-template/pallets/template/src/benchmarking.rs b/parachain-template/pallets/template/src/benchmarking.rs index fea9e65969b..8bba2a09867 100644 --- a/parachain-template/pallets/template/src/benchmarking.rs +++ b/parachain-template/pallets/template/src/benchmarking.rs @@ -1,4 +1,4 @@ -//! Benchmarking setup for pallet-template +//! Benchmarking setup for pallet-parachain-template use super::*; diff --git a/parachain-template/pallets/template/src/mock.rs b/parachain-template/pallets/template/src/mock.rs index 4a7ebac0fa8..099c0af8acd 100644 --- a/parachain-template/pallets/template/src/mock.rs +++ b/parachain-template/pallets/template/src/mock.rs @@ -1,4 +1,3 @@ -use crate as pallet_template; use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; @@ -18,7 +17,7 @@ frame_support::construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - TemplateModule: pallet_template::{Pallet, Call, Storage, Event}, + TemplateModule: crate::{Pallet, Call, Storage, Event}, } ); @@ -54,7 +53,7 @@ impl system::Config for Test { type MaxConsumers = frame_support::traits::ConstU32<16>; } -impl pallet_template::Config for Test { +impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; } diff --git a/parachain-template/runtime/Cargo.toml b/parachain-template/runtime/Cargo.toml index 81a4cf811a8..7894ea2176e 100644 --- a/parachain-template/runtime/Cargo.toml +++ b/parachain-template/runtime/Cargo.toml @@ -18,11 +18,11 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Local -pallet-template = { path = "../pallets/template", default-features = false } +pallet-parachain-template = { path = "../pallets/template", default-features = false } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } @@ -99,7 +99,7 @@ std = [ "pallet-collator-selection/std", "pallet-session/std", "pallet-sudo/std", - "pallet-template/std", + "pallet-parachain-template/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", @@ -132,7 +132,7 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", - "pallet-template/runtime-benchmarks", + "pallet-parachain-template/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -156,7 +156,7 @@ try-runtime = [ "pallet-collator-selection/try-runtime", "pallet-session/try-runtime", "pallet-sudo/try-runtime", - "pallet-template/try-runtime", + "pallet-parachain-template/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-xcm/try-runtime", diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 61839e0a621..b87445826a1 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -58,7 +58,7 @@ use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; /// Import the template pallet. -pub use pallet_template; +pub use pallet_parachain_template; /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. pub type Signature = MultiSignature; @@ -340,7 +340,7 @@ impl pallet_balances::Config for Runtime { type WeightInfo = pallet_balances::weights::SubstrateWeight; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -457,7 +457,7 @@ impl pallet_collator_selection::Config for Runtime { } /// Configure the pallet template in pallets/template. -impl pallet_template::Config for Runtime { +impl pallet_parachain_template::Config for Runtime { type RuntimeEvent = RuntimeEvent; } @@ -492,7 +492,7 @@ construct_runtime!( DmpQueue: cumulus_pallet_dmp_queue = 33, // Template - TemplatePallet: pallet_template = 40, + TemplatePallet: pallet_parachain_template = 40, } ); @@ -686,13 +686,13 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{Benchmarking, BenchmarkBatch}; use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime {} diff --git a/parachain-template/runtime/src/xcm_config.rs b/parachain-template/runtime/src/xcm_config.rs index bd395c83d38..9eea16068d0 100644 --- a/parachain-template/runtime/src/xcm_config.rs +++ b/parachain-template/runtime/src/xcm_config.rs @@ -2,10 +2,9 @@ use super::{ AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; -use core::{marker::PhantomData, ops::ControlFlow}; use frame_support::{ - log, match_types, parameter_types, - traits::{ConstU32, Everything, Nothing, ProcessMessageError}, + match_types, parameter_types, + traits::{ConstU32, Everything, Nothing}, weights::Weight, }; use frame_system::EnsureRoot; @@ -15,12 +14,13 @@ use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom, - CreateMatcher, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, MatchXcm, - NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, + CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, + FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset, RelayChainAsNative, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, + UsingComponents, WithComputedOrigin, WithUniqueTopic, }; -use xcm_executor::{traits::ShouldExecute, XcmExecutor}; +use xcm_executor::XcmExecutor; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); @@ -63,7 +63,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // foreign chains who want to have a local sovereign account on this chain which they control. SovereignSignedViaLocation, - // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when // recognized. RelayChainAsNative, // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when @@ -90,88 +90,22 @@ match_types! { }; } -//TODO: move DenyThenTry to polkadot's xcm module. -/// Deny executing the xcm message if it matches any of the Deny filter regardless of anything else. -/// If it passes the Deny, and matches one of the Allow cases then it is let through. -pub struct DenyThenTry(PhantomData, PhantomData) -where - Deny: ShouldExecute, - Allow: ShouldExecute; - -impl ShouldExecute for DenyThenTry -where - Deny: ShouldExecute, - Allow: ShouldExecute, -{ - fn should_execute( - origin: &MultiLocation, - message: &mut [Instruction], - max_weight: Weight, - weight_credit: &mut Weight, - ) -> Result<(), ProcessMessageError> { - Deny::should_execute(origin, message, max_weight, weight_credit)?; - Allow::should_execute(origin, message, max_weight, weight_credit) - } -} - -// See issue -pub struct DenyReserveTransferToRelayChain; -impl ShouldExecute for DenyReserveTransferToRelayChain { - fn should_execute( - origin: &MultiLocation, - message: &mut [Instruction], - _max_weight: Weight, - _weight_credit: &mut Weight, - ) -> Result<(), ProcessMessageError> { - message.matcher().match_next_inst_while( - |_| true, - |inst| match inst { - InitiateReserveWithdraw { - reserve: MultiLocation { parents: 1, interior: Here }, - .. - } | - DepositReserveAsset { - dest: MultiLocation { parents: 1, interior: Here }, .. - } | - TransferReserveAsset { - dest: MultiLocation { parents: 1, interior: Here }, .. - } => { - Err(ProcessMessageError::Unsupported) // Deny - }, - // An unexpected reserve transfer has arrived from the Relay Chain. Generally, - // `IsReserve` should not allow this, but we just log it here. - ReserveAssetDeposited { .. } - if matches!(origin, MultiLocation { parents: 1, interior: Here }) => - { - log::warn!( - target: "xcm::barrier", - "Unexpected ReserveAssetDeposited from the Relay Chain", - ); - Ok(ControlFlow::Continue(())) - }, - _ => Ok(ControlFlow::Continue(())), - }, - )?; - - // Permit everything else - Ok(()) - } -} - -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - WithComputedOrigin< - ( - AllowTopLevelPaidExecutionFrom, - AllowExplicitUnpaidExecutionFrom, - // ^^^ Parent and its exec plurality get free execution - ), - UniversalLocation, - ConstU32<8>, - >, - ), +pub type Barrier = TrailingSetTopicAsId< + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + WithComputedOrigin< + ( + AllowTopLevelPaidExecutionFrom, + AllowExplicitUnpaidExecutionFrom, + // ^^^ Parent and its exec plurality get free execution + ), + UniversalLocation, + ConstU32<8>, + >, + ), + >, >; pub struct XcmConfig; @@ -208,12 +142,12 @@ pub type LocalOriginToLocation = SignedToAccountId32, // ..and XCMP to communicate with the sibling chains. XcmpQueue, -); +)>; #[cfg(feature = "runtime-benchmarks")] parameter_types! { @@ -248,6 +182,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/chain-specs/bridge-hub-kusama.json b/parachains/chain-specs/bridge-hub-kusama.json index f49420b1747..0b95abcb24b 100644 --- a/parachains/chain-specs/bridge-hub-kusama.json +++ b/parachains/chain-specs/bridge-hub-kusama.json @@ -27,7 +27,9 @@ "/dns/boot-node.helikon.io/tcp/10250/p2p/12D3KooWDJLkhqQdXcVKWX7CqJHnpAY6PzrPc4ZG2CUWnARbmguy", "/dns/boot-node.helikon.io/tcp/10252/wss/p2p/12D3KooWDJLkhqQdXcVKWX7CqJHnpAY6PzrPc4ZG2CUWnARbmguy", "/dns/bridge-hub-kusama.bootnode.amforc.com/tcp/30337/p2p/12D3KooWGNeQJ5rXnEJkVUuQqwHd8aV5GkTAheaRoCaK8ZwW94id", - "/dns/bridge-hub-kusama.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWGNeQJ5rXnEJkVUuQqwHd8aV5GkTAheaRoCaK8ZwW94id" + "/dns/bridge-hub-kusama.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWGNeQJ5rXnEJkVUuQqwHd8aV5GkTAheaRoCaK8ZwW94id", + "/dns/kusama-bridge-hub-boot-ng.dwellir.com/tcp/30337/p2p/12D3KooWBFskNCQDVjuUeBh6vrszWrUvYMBBhtZRLnoTZDdLYbW5", + "/dns/kusama-bridge-hub-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWBFskNCQDVjuUeBh6vrszWrUvYMBBhtZRLnoTZDdLYbW5" ], "telemetryEndpoints": null, "protocolId": null, diff --git a/parachains/chain-specs/bridge-hub-polkadot.json b/parachains/chain-specs/bridge-hub-polkadot.json index 4c28b9d419d..cf366c37794 100644 --- a/parachains/chain-specs/bridge-hub-polkadot.json +++ b/parachains/chain-specs/bridge-hub-polkadot.json @@ -10,7 +10,9 @@ "/dns/polkadot-bridge-hub-connect-a-0.polkadot.io/tcp/443/wss/p2p/12D3KooWAVQMhkXmc5ueSYasdsRWQbKus2YGZ6HDZUB4ViJMCxXy", "/dns/polkadot-bridge-hub-connect-a-1.polkadot.io/tcp/443/wss/p2p/12D3KooWG4ypDHLKGCv4BZ6PuaGUwQHKAH6p2D6arR2uQ1eiR1T3", "/dns/polkadot-bridge-hub-connect-b-0.polkadot.io/tcp/443/wss/p2p/12D3KooWCwGKxjpJXnx1mwXKvaxGQm769EM3b6Pg5vbU33wbhsNw", - "/dns/polkadot-bridge-hub-connect-b-1.polkadot.io/tcp/443/wss/p2p/12D3KooWLiSEdhriJUPdZKFtAjZrQncxN2ssEoDKVrt5mGM4Qu4J" + "/dns/polkadot-bridge-hub-connect-b-1.polkadot.io/tcp/443/wss/p2p/12D3KooWLiSEdhriJUPdZKFtAjZrQncxN2ssEoDKVrt5mGM4Qu4J", + "/dns/polkadot-bridge-hub-boot-ng.dwellir.com/tcp/30339/p2p/12D3KooWPZ38PL3PhRVcUVYDNn7nRcZF8MykmWWLBKeDV2yna1vV", + "/dns/polkadot-bridge-hub-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWPZ38PL3PhRVcUVYDNn7nRcZF8MykmWWLBKeDV2yna1vV" ], "telemetryEndpoints": null, "protocolId": null, diff --git a/parachains/chain-specs/bridge-hub-westend.json b/parachains/chain-specs/bridge-hub-westend.json index 460c25e8f50..3428695c309 100644 --- a/parachains/chain-specs/bridge-hub-westend.json +++ b/parachains/chain-specs/bridge-hub-westend.json @@ -6,7 +6,9 @@ "/dns/westend-bridge-hub-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKyEuqkkWvFSrwZWKWBAsHgLV3HGfHj7yH3LNJLAVhmxY", "/dns/westend-bridge-hub-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWBpvudthz61XC4oP2YYFFJdhWohBeQ1ffn1BMSGWhapjd", "/dns/westend-bridge-hub-collator-node-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPXqdRRthjKAMPFtaXUK7yBxsvh83QsmzXzALA3inoJfo", - "/dns/westend-bridge-hub-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWAp2YpVaiNBy7rozEHJGocDpaLFt3VFZsGMBEYh4BoEz7" + "/dns/westend-bridge-hub-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWAp2YpVaiNBy7rozEHJGocDpaLFt3VFZsGMBEYh4BoEz7", + "/dns/westend-bridge-hub-boot-ng.dwellir.com/tcp/30338/p2p/12D3KooWJWWRYTAwBLqYkh7iMBGDr5ouJ3MHj7M3fZ7zWS4zEk6F", + "/dns/westend-bridge-hub-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWJWWRYTAwBLqYkh7iMBGDr5ouJ3MHj7M3fZ7zWS4zEk6F" ], "telemetryEndpoints": null, "protocolId": null, diff --git a/parachains/chain-specs/collectives-polkadot.json b/parachains/chain-specs/collectives-polkadot.json index 99fc78ea4a6..084a92713ce 100644 --- a/parachains/chain-specs/collectives-polkadot.json +++ b/parachains/chain-specs/collectives-polkadot.json @@ -27,7 +27,9 @@ "/dns/boot-node.helikon.io/tcp/10230/p2p/12D3KooWS8CBz4P5CBny9aBy2EQUvAExFo9PUVT57X8r3zWMFkXT", "/dns/boot-node.helikon.io/tcp/10232/wss/p2p/12D3KooWS8CBz4P5CBny9aBy2EQUvAExFo9PUVT57X8r3zWMFkXT", "/dns/collectives-polkadot.bootnode.amforc.com/tcp/30335/p2p/12D3KooWQeAjDnGkrPe5vtpfnB6ydZfWyMxyrXLkBFmA6o4k9aiU", - "/dns/collectives-polkadot.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWQeAjDnGkrPe5vtpfnB6ydZfWyMxyrXLkBFmA6o4k9aiU" + "/dns/collectives-polkadot.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWQeAjDnGkrPe5vtpfnB6ydZfWyMxyrXLkBFmA6o4k9aiU", + "/dns/polkadot-collectives-boot-ng.dwellir.com/tcp/30341/p2p/12D3KooWDMFYCNRAQcSRNV7xu2xv8319goSEbSHW4TnXRz6EpPKc", + "/dns/polkadot-collectives-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWDMFYCNRAQcSRNV7xu2xv8319goSEbSHW4TnXRz6EpPKc" ], "telemetryEndpoints": null, "protocolId": null, diff --git a/parachains/chain-specs/collectives-westend.json b/parachains/chain-specs/collectives-westend.json index db4552e046b..e93611ee028 100644 --- a/parachains/chain-specs/collectives-westend.json +++ b/parachains/chain-specs/collectives-westend.json @@ -31,7 +31,9 @@ "/dns/boot-node.helikon.io/tcp/10260/p2p/12D3KooWMzfnt29VAmrJHQcJU6Vfn4RsMbqPqgyWHqt9VTTAbSrL", "/dns/boot-node.helikon.io/tcp/10262/wss/p2p/12D3KooWMzfnt29VAmrJHQcJU6Vfn4RsMbqPqgyWHqt9VTTAbSrL", "/dns/collectives-westend.bootnode.amforc.com/tcp/30340/p2p/12D3KooWERPzUhHau6o2XZRUi3tn7544rYiaHL418Nw5t8fYWP1F", - "/dns/collectives-westend.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWERPzUhHau6o2XZRUi3tn7544rYiaHL418Nw5t8fYWP1F" + "/dns/collectives-westend.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWERPzUhHau6o2XZRUi3tn7544rYiaHL418Nw5t8fYWP1F", + "/dns/westend-collectives-boot-ng.dwellir.com/tcp/30340/p2p/12D3KooWPFM93jgm4pgxx8PM8WJKAJF49qia8jRB95uciUQwYh7m", + "/dns/westend-collectives-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWPFM93jgm4pgxx8PM8WJKAJF49qia8jRB95uciUQwYh7m" ], "telemetryEndpoints": null, "protocolId": null, diff --git a/parachains/chain-specs/contracts-rococo.json b/parachains/chain-specs/contracts-rococo.json index a74ab22e05d..09108e9c099 100644 --- a/parachains/chain-specs/contracts-rococo.json +++ b/parachains/chain-specs/contracts-rococo.json @@ -3,11 +3,16 @@ "id": "contracts-rococo", "chainType": "Live", "bootNodes": [ - "/dns/contracts-collator-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", - "/dns/contracts-collator-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", - "/dns/contracts-collator-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", - "/dns/contracts-collator-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX" + "/dns/rococo-contracts-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", + "/dns/rococo-contracts-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", + "/dns/rococo-contracts-collator-node-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", + "/dns/rococo-contracts-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX", + "/dns/rococo-contracts-collator-node-0.polkadot.io/tcp/443/wss/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", + "/dns/rococo-contracts-collator-node-1.polkadot.io/tcp/443/wss/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", + "/dns/rococo-contracts-collator-node-2.polkadot.io/tcp/443/wss/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", + "/dns/rococo-contracts-collator-node-3.polkadot.io/tcp/443/wss/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX" ], + "telemetryEndpoints": null, "protocolId": null, "properties": { @@ -80,4 +85,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/chain-specs/statemine.json b/parachains/chain-specs/statemine.json index dd32b21adb5..bf296a173b9 100644 --- a/parachains/chain-specs/statemine.json +++ b/parachains/chain-specs/statemine.json @@ -25,7 +25,9 @@ "/dns/boot-node.helikon.io/tcp/10210/p2p/12D3KooWFXRQce3aMgZMn5SxvHtYH4PsR63TZLf8LrnBsEVTyzdr", "/dns/boot-node.helikon.io/tcp/10212/wss/p2p/12D3KooWFXRQce3aMgZMn5SxvHtYH4PsR63TZLf8LrnBsEVTyzdr", "/dns/statemine.bootnode.amforc.com/tcp/30336/p2p/12D3KooWHmSyrBWsc6fdpq8HtCFWasmLVLYGKWA2a78m4xAHKyBq", - "/dns/statemine.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWHmSyrBWsc6fdpq8HtCFWasmLVLYGKWA2a78m4xAHKyBq" + "/dns/statemine.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWHmSyrBWsc6fdpq8HtCFWasmLVLYGKWA2a78m4xAHKyBq", + "/dns/statemine-boot-ng.dwellir.com/tcp/30343/p2p/12D3KooWQNJKBaNfW6Nn7HZDi5pSSEFmHL2Qz7chr9RksQUDR1Wk", + "/dns/statemine-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWQNJKBaNfW6Nn7HZDi5pSSEFmHL2Qz7chr9RksQUDR1Wk" ], "telemetryEndpoints": null, "protocolId": null, @@ -56,4 +58,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/chain-specs/statemint.json b/parachains/chain-specs/statemint.json index 12d655ae7df..61ca655af6c 100644 --- a/parachains/chain-specs/statemint.json +++ b/parachains/chain-specs/statemint.json @@ -25,7 +25,9 @@ "/dns/boot-node.helikon.io/tcp/10220/p2p/12D3KooW9uybhguhDjVJc3U3kgZC3i8rWmAnSpbnJkmuR7C6ZsRW", "/dns/boot-node.helikon.io/tcp/10222/wss/p2p/12D3KooW9uybhguhDjVJc3U3kgZC3i8rWmAnSpbnJkmuR7C6ZsRW", "/dns/statemint.bootnode.amforc.com/tcp/30341/p2p/12D3KooWByohP9FXn7ao8syS167qJsbFdpa7fY2Y24xbKtt3r7Ls", - "/dns/statemint.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWByohP9FXn7ao8syS167qJsbFdpa7fY2Y24xbKtt3r7Ls" + "/dns/statemint.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWByohP9FXn7ao8syS167qJsbFdpa7fY2Y24xbKtt3r7Ls", + "/dns/statemint-boot-ng.dwellir.com/tcp/30344/p2p/12D3KooWEFrNuNk8fPdQS2hf34Gmqi6dGSvrETshGJUrqrvfRDZr", + "/dns/statemint-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWEFrNuNk8fPdQS2hf34Gmqi6dGSvrETshGJUrqrvfRDZr" ], "telemetryEndpoints": null, "protocolId": null, @@ -58,4 +60,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/chain-specs/westmint.json b/parachains/chain-specs/westmint.json index 3516fbfaa56..17d768e58d7 100644 --- a/parachains/chain-specs/westmint.json +++ b/parachains/chain-specs/westmint.json @@ -3,10 +3,10 @@ "id": "westmint", "chainType": "Live", "bootNodes": [ - "/ip4/35.204.21.205/tcp/30334/p2p/12D3KooWLjaXWhNTSiRVFbTJCKLRWt9XXHLGVnAFtxvnExKkVPqn", - "/ip4/34.141.171.170/tcp/30334/p2p/12D3KooWBNy2Jdrjv2P7sdfb1mzH1AGzwjip5rW4N2Ft1T3Hdq5c", - "/ip4/34.141.221.252/tcp/30334/p2p/12D3KooWC9YYdjQLwxTNVda6t4nmjAZG37gaRZLNi4Zuhr9xUveW", - "/ip4/34.90.92.174/tcp/30334/p2p/12D3KooWQcXpUyVqwC2zJkwECCC7ttLCUCLTjnbGxTVfhSgmH2sD", + "/dns/westend-westmint-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWJaAfPyiye7ZQBuHengTJJoMrcaz7Jj1UzHiKdNxA1Nkd", + "/dns/westend-westmint-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWGL3hpWycWyeqyL9gHNnmmsL474WkPZdqraBHu4L6fQrW", + "/dns/westend-westmint-collator-node-2.parity-testnet.parity.io./tcp/30333/p2p/12D3KooWBkKDWhHzu6Hhe492adEpVV7wzuaWGxUfEnr6g5JCr7Gr", + "/dns/westend-westmint-collator-node-3.parity-testnet.parity.io./tcp/30333/p2p/12D3KooWMGpzCmhD6np6eKqxL7AAunKn1dN86Dr7a9E2xgZ2rt6G", "/dns/boot.stake.plus/tcp/33333/p2p/12D3KooWNiB27rpXX7EYongoWWUeRKzLQxWGms6MQU2B9LX7Ztzo", "/dns/boot.stake.plus/tcp/33334/wss/p2p/12D3KooWNiB27rpXX7EYongoWWUeRKzLQxWGms6MQU2B9LX7Ztzo", "/dns/boot.metaspan.io/tcp/36052/p2p/12D3KooWBCqfNb6Y39DXTr4UBWXyjuS3hcZM1qTbHhDXxF6HkAJJ", @@ -19,7 +19,9 @@ "/dns/boot-node.helikon.io/tcp/10200/p2p/12D3KooWMRY8wb7rMT81LLuivvsy6ahUxKHQgYJw4zm1hC1uYLxb", "/dns/boot-node.helikon.io/tcp/10202/wss/p2p/12D3KooWMRY8wb7rMT81LLuivvsy6ahUxKHQgYJw4zm1hC1uYLxb", "/dns/westmint.bootnode.amforc.com/tcp/30339/p2p/12D3KooWNjKeaANaeZxBAPctmx8jugSYzuw4vnSCJmEDPB5mtRd6", - "/dns/westmint.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWNjKeaANaeZxBAPctmx8jugSYzuw4vnSCJmEDPB5mtRd6" + "/dns/westmint.bootnode.amforc.com/tcp/30333/wss/p2p/12D3KooWNjKeaANaeZxBAPctmx8jugSYzuw4vnSCJmEDPB5mtRd6", + "/dns/westmint-boot-ng.dwellir.com/tcp/30345/p2p/12D3KooWFZ9xqApB1wnFYkbe1qJ5Jqwxe2f3i8W25F3tKNXy59ux", + "/dns/westmint-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWFZ9xqApB1wnFYkbe1qJ5Jqwxe2f3i8W25F3tKNXy59ux" ], "telemetryEndpoints": null, "protocolId": null, @@ -49,4 +51,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/common/Cargo.toml b/parachains/common/Cargo.toml index bf16861894c..ba2955615f3 100644 --- a/parachains/common/Cargo.toml +++ b/parachains/common/Cargo.toml @@ -10,7 +10,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } diff --git a/parachains/common/src/impls.rs b/parachains/common/src/impls.rs index cc89a248e2e..75ddf230408 100644 --- a/parachains/common/src/impls.rs +++ b/parachains/common/src/impls.rs @@ -91,7 +91,7 @@ where Assets: fungibles::Inspect, { fn contains(id: &>::AssetId) -> bool { - !Assets::total_issuance(*id).is_zero() + !Assets::total_issuance(id.clone()).is_zero() } } @@ -103,7 +103,7 @@ where Assets: fungibles::Inspect, { fn contains(id: &>::AssetId) -> bool { - Assets::asset_exists(*id) + Assets::asset_exists(id.clone()) } } @@ -197,7 +197,7 @@ mod tests { type WeightInfo = (); type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<1>; type MaxFreezes = ConstU32<1>; @@ -278,7 +278,6 @@ mod tests { } let asset_location = SomeSiblingParachain::get() - .clone() .pushed_with_interior(GeneralIndex(42)) .expect("multilocation will only have 2 junctions; qed"); let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000u128.into() }; diff --git a/parachains/common/src/xcm_config.rs b/parachains/common/src/xcm_config.rs index 61e6f389e6d..529822cff16 100644 --- a/parachains/common/src/xcm_config.rs +++ b/parachains/common/src/xcm_config.rs @@ -1,86 +1,12 @@ use crate::impls::AccountIdOf; -use core::{marker::PhantomData, ops::ControlFlow}; +use core::marker::PhantomData; use frame_support::{ log, - traits::{ - fungibles::Inspect, tokens::ConversionToAssetBalance, ContainsPair, ProcessMessageError, - }, + traits::{fungibles::Inspect, tokens::ConversionToAssetBalance, ContainsPair}, weights::Weight, }; use sp_runtime::traits::Get; use xcm::latest::prelude::*; -use xcm_builder::{CreateMatcher, MatchXcm}; -use xcm_executor::traits::ShouldExecute; - -//TODO: move DenyThenTry to polkadot's xcm module. -/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else. -/// If it passes the Deny, and matches one of the Allow cases then it is let through. -pub struct DenyThenTry(PhantomData, PhantomData) -where - Deny: ShouldExecute, - Allow: ShouldExecute; - -impl ShouldExecute for DenyThenTry -where - Deny: ShouldExecute, - Allow: ShouldExecute, -{ - fn should_execute( - origin: &MultiLocation, - message: &mut [Instruction], - max_weight: Weight, - weight_credit: &mut Weight, - ) -> Result<(), ProcessMessageError> { - Deny::should_execute(origin, message, max_weight, weight_credit)?; - Allow::should_execute(origin, message, max_weight, weight_credit) - } -} - -// See issue -pub struct DenyReserveTransferToRelayChain; -impl ShouldExecute for DenyReserveTransferToRelayChain { - fn should_execute( - origin: &MultiLocation, - message: &mut [Instruction], - _max_weight: Weight, - _weight_credit: &mut Weight, - ) -> Result<(), ProcessMessageError> { - message.matcher().match_next_inst_while( - |_| true, - |inst| match inst { - InitiateReserveWithdraw { - reserve: MultiLocation { parents: 1, interior: Here }, - .. - } | - DepositReserveAsset { - dest: MultiLocation { parents: 1, interior: Here }, .. - } | - TransferReserveAsset { - dest: MultiLocation { parents: 1, interior: Here }, .. - } => { - Err(ProcessMessageError::Unsupported) // Deny - }, - - // An unexpected reserve transfer has arrived from the Relay Chain. Generally, - // `IsReserve` should not allow this, but we just log it here. - ReserveAssetDeposited { .. } - if matches!(origin, MultiLocation { parents: 1, interior: Here }) => - { - log::warn!( - target: "xcm::barrier", - "Unexpected ReserveAssetDeposited from the Relay Chain", - ); - Ok(ControlFlow::Continue(())) - }, - - _ => Ok(ControlFlow::Continue(())), - }, - )?; - - // Permit everything else - Ok(()) - } -} /// A `ChargeFeeInFungibles` implementation that converts the output of /// a given WeightToFee implementation an amount charged in diff --git a/parachains/integration-tests/collectives/0_xcm/2_reserve.yml b/parachains/integration-tests/collectives/0_xcm/2_reserve.yml deleted file mode 100644 index 0af20ba7daa..00000000000 --- a/parachains/integration-tests/collectives/0_xcm/2_reserve.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -settings: - chains: - relay_chain: &relay_chain - wsPort: 9700 - collectives_parachain: &collectives_parachain - wsPort: 9710 - paraId: &cp_id 1001 - variables: - xcm_version: &xcm_version '2' - weight_to_send_reserve: &weight_to_send_reserve 1,000,000,000 # must be same for both chains - chains: - accounts: - alice_signer: &alice_signer //Alice - alice_account32: &alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5' - -tests: - - name: Reserve assets from Relay Chain to Collectives Parachain fails - its: - - name: Reserve assets from Relay Chain to Collectives Parachain - actions: - - extrinsics: - - chain: *relay_chain - signer: *alice_signer - pallet: xcmPallet - call: reserveTransferAssets - args: [ - { v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination - { v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *alice_acc32 }}}}}, # beneficiary - { - v1: [ - { - id: { concrete: { 0, interior: { here: true }}}, - fun: { fungible: 20000000000000 } # 20_000_000_000_000 - } - ] - }, # assets - 0, # feeAssetItem - ] - events: - - name: xcmPallet.Attempted - chain: *relay_chain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # the weight must be static - value: *weight_to_send_reserve - - name: dmpQueue.ExecutedDownward - chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Incomplete - # the weight must be static - value: [1000000000, UntrustedReserveLocation] - - - name: Reserve assets from Collectives Parachain to Relay Chain fails - actions: - - extrinsics: - - chain: *collectives_parachain - signer: *alice_signer - pallet: polkadotXcm - call: reserveTransferAssets - args: [ - { v1: { parents: 1, interior: { here: true }}}, # destination - { v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *alice_acc32 }}}}}, # beneficiary - { - v1: [ - { - id: { concrete: { parents: 1, interior: { here: true }}}, - fun: { fungible: 10000000000000 } # 10_000_000_000_000 - } - ] - }, # assets - 0, # feeAssetItem - ] - events: - - name: system.ExtrinsicFailed - attributes: - - type: SpRuntimeDispatchError - key: dispatchError - # TODO assert variant - # issue - https://github.com/paritytech/parachains-integration-tests/issues/59 - value: {"Module":{"index":"31","error":"0x02000000"}} diff --git a/parachains/integration-tests/statemint/xcm/0_init.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml similarity index 67% rename from parachains/integration-tests/statemint/xcm/0_init.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml index b9640517719..ebcbe417bbb 100644 --- a/parachains/integration-tests/statemint/xcm/0_init.yml +++ b/parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml @@ -11,12 +11,13 @@ settings: paraId: &pp_id 2000 variables: common: - xcm_verison: &xcm_version '2' - require_weight_at_most: &weight_at_most 1000000000 + xcm_version: &xcm_version 3 + require_weight_at_most: &weight_at_most {refTime: 1000000000, proofSize: 200000} + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } chains: relay_chain: signer: &rc_signer //Alice - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}} penpal_parachain: signer: &pp_signer //Alice decodedCalls: @@ -37,7 +38,7 @@ tests: its: - name: XCM supported versions between chains actions: - - extrinsics: # Relay Chain sets supported version for Assset Parachain + - extrinsics: # Relay Chain sets supported version for Asset Parachain - chain: *relay_chain sudo: true signer: *rc_signer @@ -56,13 +57,9 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - attribute: - type: u32 - value: *xcm_version + result: [{ parents: 0, interior: { X1: { Parachain: *ap_id }}}, *xcm_version ] - extrinsics: # Relay Chain sets supported version for Penpal Parachain - chain: *relay_chain sudo: true @@ -82,14 +79,10 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - attribute: - type: u32 - value: *xcm_version - - extrinsics: # Assset Parachain sets supported version for Relay Chain through it + result: [{ parents: 0, interior: { X1: { Parachain: *pp_id }}}, *xcm_version ] + - extrinsics: # Asset Parachain sets supported version for Relay Chain through it - chain: *relay_chain signer: *rc_signer sudo: true @@ -98,10 +91,20 @@ tests: args: [ *ap_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 2200000000, + proofSize: 200000 + } + } + } + }, { Transact: { - originType: Superuser, + originKind: Superuser, requireWeightAtMost: *weight_at_most, call: $ap_force_xcm_version } @@ -111,15 +114,17 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent + - name: dmpQueue.ExecutedDownward + chain: *assets_parachain + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '1,019,210,000', proofSize: '200,000' }} + } - name: polkadotXcm.SupportedVersionChanged chain: *assets_parachain - attribute: - type: u32 - value: *xcm_version + result: [{ parents: 1, interior: Here }, *xcm_version ] - extrinsics: # Penpal Parachain sets supported version for Relay Chain - chain: *penpal_parachain signer: *pp_signer @@ -135,10 +140,6 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: polkadotXcm.SupportedVersionChanged - attribute: - type: u32 - value: *xcm_version + result: [{ parents: 1, interior: Here }, *xcm_version ] diff --git a/parachains/integration-tests/statemine/xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml similarity index 72% rename from parachains/integration-tests/statemine/xcm/1_dmp.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml index 9b08555a251..1fb4a8abb84 100644 --- a/parachains/integration-tests/statemine/xcm/1_dmp.yml +++ b/parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml @@ -7,20 +7,23 @@ settings: wsPort: 9910 paraId: &ap_id 1000 variables: - relay_chain: - signer: &rc_signer //Alice - wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - assets_parachain_destination: &ap_dest { v1: { parents: 0, interior: { x1: { parachain: *ap_id }}}} - assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}} - ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}} - amount: &amount 1000000000000 - ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} - require_weight_at_most: &rc_weight_at_most 1000000000 - assets_parachain_account: - wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - asset_id: &asset_id 1 - asset_min_balance: &asset_ed 1000 + common: + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } + chains: + relay_chain: + signer: &rc_signer //Alice + wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + assets_parachain_destination: &ap_dest { v3: { parents: 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + assets_parachain_beneficiary: &ap_benf { v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}} + ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}} + amount: &amount 1000000000000 + ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} + require_weight_at_most: &rc_weight_at_most { refTime: 1000000000, proofSize: 200000 } + assets_parachain_account: + wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + asset_id: &asset_id 1 + asset_min_balance: &asset_ed 1000 decodedCalls: force_create_asset: chain: *assets_parachain @@ -63,22 +66,20 @@ tests: args: [ *ap_dest, # destination *ap_benf, # beneficiary - { v1: [ *rc_ksm_fungible ] }, # assets + { v3: [ *rc_ksm_fungible ] }, 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: xcmPallet.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true + threshold: *weight_threshold + result: [{ Complete: { refTime: '764,772,000', proofSize: 0 }}] - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,973,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} + } - queries: balance_rc_sender_after: chain: *relay_chain @@ -131,10 +132,15 @@ tests: args: [ *ap_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, { Transact: { - originType: Superuser, + originKind: Superuser, requireWeightAtMost: *rc_weight_at_most, call: $force_create_asset } @@ -146,11 +152,10 @@ tests: - name: xcmPallet.Sent - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,258,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '1,014,103,000', proofSize: '200,000' }} + } - queries: forced_created_asset: chain: *assets_parachain @@ -173,10 +178,15 @@ tests: args: [ *ap_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, { Transact: { - originType: Native, + originKind: Native, requireWeightAtMost: *rc_weight_at_most, call: $force_create_asset } @@ -186,9 +196,7 @@ tests: ] events: - name: system.ExtrinsicFailed - attribute: - type: SpRuntimeDispatchError - value: BadOrigin + result: { dispatchError: BadOrigin } - name: xcmPallet.limitedReserveTransferAssets before: *before_get_balances @@ -203,23 +211,25 @@ tests: args: [ *ap_dest, # destination *ap_benf, # beneficiary - { v1: [ *rc_ksm_fungible ] }, # assets + { v3: [ *rc_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: xcmPallet.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 750,645,000 + threshold: *weight_threshold + result: [{ Complete: { refTime: '750,645,000', proofSize: 0 }}] - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isError: true - value: "WeightNotComputable" + threshold: *weight_threshold + result: { + outcome: { + Incomplete: [ + { refTime: '1,000,000,000', proofSize: 0 }, + UntrustedReserveLocation + ] + } + } - queries: balance_rc_sender_after: chain: *relay_chain diff --git a/parachains/integration-tests/statemine/xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml similarity index 65% rename from parachains/integration-tests/statemine/xcm/2_ump.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml index daddf927931..3cdb9547c35 100644 --- a/parachains/integration-tests/statemine/xcm/2_ump.yml +++ b/parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml @@ -9,23 +9,25 @@ settings: variables: common: amount: &amount 1000000000000 - require_weight_at_most: &weight_at_most 1000000000 - relay_chain: - signer: &rc_signer //Alice - wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F #Alice - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} - assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}} - ksm: &rc_ksm { concrete: { 0, interior: { here: true }}} - ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} - assets_parachain_account: - signer: &ap_signer //Alice - wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}} - assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' #Alice - relay_chain_beneficiary: &rc_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *rc_acc }}}}} - ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} - ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} + require_weight_at_most: &weight_at_most {refTime: 1000000000, proofSize: 0} + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } + chains: + relay_chain: + signer: &rc_signer //Alice + wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F #Alice + assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + assets_parachain_beneficiary: &ap_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}} + ksm: &rc_ksm { concrete: { 0, interior: { here: true }}} + ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} + assets_parachain_account: + signer: &ap_signer //Alice + wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + relay_chain_destination: &rc_dest { v3: { parents: 1, interior: { here: true }}} + assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' #Alice + relay_chain_beneficiary: &rc_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *rc_acc }}}}} + ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} + ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} decodedCalls: system_remark: chain: *relay_chain @@ -38,7 +40,7 @@ tests: describes: - name: polkadotXcm.limitedTeleportAssets before: - - name: DEPENDANCY | Do a 'limitedTeleportAssets' from the Relay Chain to the Assets Parachain to have funds to send them back + - name: DEPENDENCY | Do a 'limitedTeleportAssets' from the Relay Chain to the Assets Parachain to have funds to send them back actions: - extrinsics: - chain: *relay_chain @@ -48,22 +50,20 @@ tests: args: [ *ap_dest, # destination *ap_benf, # beneficiary - { v1: [ *rc_ksm_fungible ] }, # assets + { v3: [ *rc_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: xcmPallet.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true + threshold: *weight_threshold + result: [{ Complete: { refTime: '761,173,000', proofSize: 0 }}] - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,973,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} + } - name: Get the balances of the Assets Parachain's sender & Relay Chain's receiver actions: @@ -89,24 +89,18 @@ tests: args: [ *rc_dest, # destination *rc_benf, # beneficiary - { v1: [ *ap_ksm_fungible ] }, # assets + { v3: [ *ap_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 360,315,000 + threshold: *weight_threshold + result: [{ Complete: { refTime: '539,494,000', proofSize: '7,133' }}] - name: ump.ExecutedUpward chain: *relay_chain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 297,578,000 + threshold: *weight_threshold + result: [{ Complete: { refTime: '298,716,000', proofSize: 0 }}] - queries: balance_ap_sender_after: chain: *assets_parachain @@ -148,7 +142,7 @@ tests: - name: polkadotXcm.send | Native - Transact(system.remark) its: - - name: Assets Parachain SHOULD NOT be able to dipatch 'send' call + - name: Assets Parachain SHOULD NOT be able to dispatch 'send' call actions: - extrinsics: - chain: *assets_parachain @@ -158,10 +152,15 @@ tests: args: [ *rc_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, { Transact: { - originType: Native, + originKind: Native, requireWeightAtMost: *weight_at_most, call: $system_remark } @@ -171,9 +170,7 @@ tests: ] events: - name: system.ExtrinsicFailed - attribute: - type: SpRuntimeDispatchError - value: BadOrigin + result: { dispatchError: BadOrigin } - name: polkadotXcm.limitedReserveTransferAssets its: @@ -187,13 +184,10 @@ tests: args: [ *rc_dest, # destination *rc_benf, # beneficiary - { v1: [ *ap_ksm_fungible ] }, # assets + { v3: [ *ap_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isError: true - value: Barrier + result: [{ Error: Barrier }] diff --git a/parachains/integration-tests/e2e/assets/statemine/0_xcm/3_force_hrmp-open-channels.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/3_force_hrmp-open-channels.yml new file mode 100644 index 00000000000..dfdae028f00 --- /dev/null +++ b/parachains/integration-tests/e2e/assets/statemine/0_xcm/3_force_hrmp-open-channels.yml @@ -0,0 +1,122 @@ +--- +settings: + chains: + relay_chain: &relay_chain + wsPort: 9900 + assets_parachain: + wsPort: 9910 + paraId: &ap_id 1000 + penpal_parachain: + wsPort: 9920 + paraId: &pp_id 2000 + variables: + common: + amount: &amount 2000000000000 + hrmp_channels: + proposed_max_capacity: &max_capacity 8 + proposed_max_message_size: &max_message_size 8192 + channel: &channel { + maxCapacity: *max_capacity, + maxTotalSize: *max_message_size, + maxMessageSize: *max_message_size, + msgCount: 0, + totalSize: 0, + mqcHead: null, + senderDeposit: 0, + recipientDeposit: 0 + } + chains: + relay_chain: + signer: &rc_signer //Alice + assets_parachain_account: + sovereign_account: &ap_sovereign F7fq1jSNVTPfJmaHaXCMtatT1EZefCUsa7rRiQVNR5efcah + penpal_parachain: + sovereign_account: &pp_sovereign F7fq1jMZkfuCuoMTyiEVAP2DMpMt18WopgBqTJznLihLNbZ + +tests: + - name: HRMP + beforeEach: + - name: DEPENDENCY | Penpal Parachain Sovereign account in the Relay Chain needs to be funded + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + pallet: balances + call: transfer + args: [ + *pp_sovereign, # destination + *amount, # value + ] + events: + - name: balances.Transfer + + - name: DEPENDENCY | Assets Parachain Sovereign account in the Relay Chain needs to be funded + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + pallet: balances + call: transfer + args: [ + *ap_sovereign, # destination + *amount, # value + ] + events: + - name: balances.Transfer + describes: + - name: hrmp.forceOpenHrmpChannel (Penpal Parachain → Assets Parachain) + its: + - name: Open Penpal Parachain to Assets Parachain + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: hrmp + call: forceOpenHrmpChannel + args: [ + *pp_id, + *ap_id, + *max_capacity, + *max_message_size + ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } + - name: hrmp.HrmpChannelForceOpened + + - name: hrmp.forceOpenHrmpChannel (Assets Parachain → PenPal Parachain) + its: + - name: Open Assets Parachain to PenPal Parachain + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: hrmp + call: forceOpenHrmpChannel + args: [ + *ap_id, + *pp_id, + *max_capacity, + *max_message_size + ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } + - name: hrmp.HrmpChannelForceOpened + + - name: hrmp.forceProcessHrmpOpen (make sure all the channels are open) + its: + - name: Make sure all the pending channels are open + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: hrmp + call: forceProcessHrmpOpen + args: [ 2 ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } diff --git a/parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml new file mode 100644 index 00000000000..9e2decffe15 --- /dev/null +++ b/parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml @@ -0,0 +1,390 @@ +--- +# Note: This tests depends on the 3_hrmp-open-channels.yml for opening channels, otherwise teleports aren't going to +# work. +settings: + chains: + relay_chain: &relay_chain + wsPort: 9900 + assets_parachain: &assets_parachain + wsPort: 9910 + paraId: &ap_id 1000 + penpal_parachain: &penpal_parachain + wsPort: 9920 + paraId: &pp_id 2000 + variables: + common: + mint_amount: &mint_amount 1000000000000 + amount: &amount 100000000000 + require_weight_at_most: &weight_at_most {refTime: 1200000000, proofSize: 20000} + amount_to_send: &amount_to_send 500000000000 + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } + chains: + relay_chain: + signer: &rc_signer //Alice + assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_dest_routed: &ap_dest_routed { v3: { parents: 1, interior: { x1: { parachain: *ap_id } }}} + assets_parachain_account: + signer: &ap_signer //Alice + wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + asset_id: &asset_id 2 + assets_pallet_id: &assets_pallet_id 50 + asset_min_balance: &asset_ed 1000 + penpal_parachain_destination: &pp_dest { v3: { parents: 1, interior: { x1: { parachain: *pp_id } }}} + ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} + ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} + suff_asset: &suff_asset { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: *asset_id } ] }}} + suff_asset_fail: &suff_asset_fail { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: 3 } ] }}} + suff_asset_fungible_fail: &ap_suff_asset_fungible_fail { id: *suff_asset_fail, fun: { fungible: 200000000000 }} + penpal_parachain: + sovereign_account: &pp_sovereign_sibl FBeL7EAeUroLWXW1yfKboiqTqVfbRBcsUKd6QqVf4kGBySS + signer: &pp_signer //Alice + penpal_parachain_account: &pp_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + decodedCalls: + force_create_asset: + chain: *assets_parachain + pallet: assets + call: forceCreate + args: [ + *asset_id, + { Id: *ap_wallet }, # owner + true, # isSufficient + *asset_ed # minBalance + ] + force_create_asset2: + chain: *assets_parachain + pallet: assets + call: forceCreate + args: [ + *asset_id, + { Id: *ap_wallet }, # owner + true, # isSufficient + *asset_ed # minBalance + ] + +tests: + - name: HRMP + describes: + - name: polkadotXcm.limitedReserveTransferAssets (Asset) | Assets Parachain -> Penpal Parachain + before: + - name: DEPENDENCY | A sufficient Asset should exist in the Assets Parachain + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: xcmPallet + call: send + args: [ + *ap_dest, # destination + { + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, + { + SetTopic: '0x0123456789012345678901234567891201234567890123456789012345678912' + }, + { + Transact: { + originKind: Superuser, + requireWeightAtMost: *weight_at_most, + call: $force_create_asset + } + } + ] + } + ] + events: + - name: xcmPallet.Sent + - name: dmpQueue.ExecutedDownward + chain: *assets_parachain + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '1,216,703,000', proofSize: '20,000' }} + } + - queries: + forced_created_asset: + chain: *assets_parachain + pallet: assets + call: asset + args: [ *asset_id ] + - asserts: + isSome: + args: [ $forced_created_asset ] + + - name: DEPENDENCY | Some Assets should be minted for the sender + actions: + - extrinsics: + - chain: *assets_parachain + signer: *ap_signer + pallet: assets + call: mint + args: [ + *asset_id, + *ap_wallet, + *mint_amount + ] + events: + - name: assets.Issued + result: { assetId: *asset_id, owner: *ap_wallet, amount: *mint_amount } + + its: + - name: Assets Parachain should be able to reserve transfer an Asset to Penpal Parachain + actions: + - extrinsics: + - chain: *assets_parachain + signer: *ap_signer + pallet: polkadotXcm + call: limitedReserveTransferAssets + args: [ + *pp_dest, # destination + { # beneficiary + V3: { + parents: 0, + interior: { + X1: { + AccountId32: { + id: *pp_acc + } + } + } + } + }, + { # assets + V3: [ + { + id: { + Concrete: { + parents: 0, + interior: { + X2: [ + { + PalletInstance: *assets_pallet_id + }, + { + GeneralIndex: *asset_id + } + ] + } + } + }, + fun: { + Fungible: *amount_to_send + } + } + ] + }, + 0, # feeAssetItem + Unlimited # weightLimit + ] + events: + - name: polkadotXcm.Attempted + threshold: *weight_threshold + result: [{ Complete: { refTime: '679,150,000', proofSize: '6,196' }}] + - name: assets.Transferred + result: { + assetId: *asset_id, + from: *ap_wallet, + to: *pp_sovereign_sibl, + amount: *amount_to_send + } + + - name: polkadotXcm.limitedReserveTransferAssets (KSM) | Assets Parachain -> Penpal Parachain + its: + - name: Assets Parachain should be able to reserve transfer KSM to Penpal Parachain + actions: + - extrinsics: + - chain: *assets_parachain + signer: *ap_signer + pallet: polkadotXcm + call: limitedReserveTransferAssets + args: [ + *pp_dest, # destination + { # beneficiary + V3: { + parents: 0, + interior: { + X1: { + AccountId32: { + id: *pp_acc + } + } + } + } + }, + { # assets + V3: [ + *ap_ksm_fungible + ] + }, + 0, # feeAssetItem + Unlimited # weightLimit + ] + events: + - name: polkadotXcm.Attempted + threshold: *weight_threshold + result: [{ Complete: { refTime: '679,150,000', proofSize: '6,196' }}] + - name: balances.Endowed + result: { + account: *pp_sovereign_sibl, + freeBalance: *amount + } + + - name: polkadotXcm.send( assets.forceCreateAsset ) | Penpal Parachain -> Assets Parachain + before: + - name: Get the asset balance of the Penpal Parachain Sovereign account in Assets Parachain + actions: + - queries: + assets_balance_pp_sovereign_before: + chain: *assets_parachain + pallet: assets + call: account + args: [ + *asset_id, + *pp_sovereign_sibl + ] + its: + - name: Penpal Parachain should be able to send XCM message paying its fee with sufficient asset in Assets Parachain + actions: + - extrinsics: + - chain: *penpal_parachain + signer: *pp_signer + sudo: true + pallet: polkadotXcm + call: send + args: [ + *ap_dest_routed, # destination + { + v3: [ #message + { + WithdrawAsset: [ + { + id: { + concrete: { + parents: 0, + interior: { + X2: [ + { PalletInstance: *assets_pallet_id }, + { GeneralIndex: *asset_id } + ] + } + } + }, + fun: { fungible: *amount }} + ] + }, + { + BuyExecution: { + fees: { id: *suff_asset, fun: { fungible: *amount }}, + weightLimit: Unlimited + } + }, + { + Transact: { + originKind: SovereignAccount, + requireWeightAtMost: *weight_at_most, + call: $force_create_asset2 + } + }, + { + RefundSurplus + }, + { + DepositAsset: { + assets: { Wild: All }, + beneficiary: { + parents: 0, + interior: { + X1: { + AccountId32: { + network: , # None + id: *pp_acc + } + } + }} + } + } + ] + } + ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } + - name: polkadotXcm.Sent + - name: assets.Burned + chain: *assets_parachain + result: { assetId: *asset_id, owner: *pp_sovereign_sibl } + - name: assets.Issued + chain: *assets_parachain + result: { assetId: *asset_id } + - queries: + assets_balance_pp_sovereign_after: + chain: *assets_parachain + pallet: assets + call: account + args: [ + *asset_id, + *pp_sovereign_sibl + ] + forced_created_asset2: + chain: *assets_parachain + pallet: assets + call: asset + args: [ 3 ] + - asserts: + isSome: + args: [ $forced_created_asset2 ] + - name: Should reduce the assets balance of the Penpal Parachain's SovereignAccount in the Assets Parachain + actions: + - asserts: + assetsDecreased: + args: [ + { + balances: { + before: $assets_balance_pp_sovereign_before, + after: $assets_balance_pp_sovereign_after, + }, + } + ] + + - name: Penpal Parachain SHOULD NOT be able to send XCM message paying its fee with sufficient assets if not enough balance + actions: + - extrinsics: + - chain: *penpal_parachain + signer: *pp_signer + sudo: true + pallet: polkadotXcm + call: send + args: [ + *ap_dest_routed, # destination + { + v3: [ #message + { + WithdrawAsset: [*ap_suff_asset_fungible_fail] + }, + { + BuyExecution: { + fees: *ap_suff_asset_fungible_fail, + weightLimit: Unlimited + } + }, + { + Transact: { + originKind: SovereignAccount, + requireWeightAtMost: *weight_at_most, + call: $force_create_asset2 + } + } + ] + } + ] + events: + - name: xcmpQueue.Fail + chain: *assets_parachain + threshold: *weight_threshold + result: { + error: FailedToTransactAsset, + weight: { refTime: '152,426,000', proofSize: '3,593' } + } diff --git a/parachains/integration-tests/e2e/assets/statemine/config.toml b/parachains/integration-tests/e2e/assets/statemine/config.toml new file mode 100644 index 00000000000..57c8f37e24b --- /dev/null +++ b/parachains/integration-tests/e2e/assets/statemine/config.toml @@ -0,0 +1,71 @@ +[relaychain] +default_command = "./bin/polkadot" +default_args = [ "-lparachain=debug", "-lxcm=trace" ] +chain = "kusama-local" + + [[relaychain.nodes]] + name = "alice" + ws_port = 9900 + validator = true + args = ["--state-cache-size=0"] + + [[relaychain.nodes]] + name = "bob" + ws_port = 9901 + validator = true + + [[relaychain.nodes]] + name = "charlie" + ws_port = 9902 + validator = true + + [[relaychain.nodes]] + name = "dave" + ws_port = 9903 + validator = true + +[[parachains]] +id = 1000 +chain = "statemine-local" +cumulus_based = true + + [[parachains.collators]] + name = "collator1" + ws_port = 9910 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace", "--state-cache-size=0" ] + + [[parachains.collators]] + name = "collator2" + ws_port = 9911 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace" ] + +[[parachains]] +id = 2000 +chain = "penpal-kusama-2000" +cumulus_based = true + + [[parachains.collators]] + name = "collator3" + ws_port = 9920 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace", "--state-cache-size=0" ] + + [[parachains.collators]] + name = "collator4" + ws_port = 9921 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace" ] + +# [[hrmpChannels]] +# sender = 1000 +# recipient = 2000 +# maxCapacity = 8 +# maxMessageSize = 8192 + +# [[hrmpChannels]] +# sender = 2000 +# recipient = 1000 +# maxCapacity = 8 +# maxMessageSize = 8192 diff --git a/parachains/integration-tests/statemine/xcm/0_init.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/0_init.yml similarity index 66% rename from parachains/integration-tests/statemine/xcm/0_init.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/0_init.yml index b9640517719..55dbab6ba4c 100644 --- a/parachains/integration-tests/statemine/xcm/0_init.yml +++ b/parachains/integration-tests/e2e/assets/statemint/0_xcm/0_init.yml @@ -2,21 +2,22 @@ settings: chains: relay_chain: &relay_chain - wsPort: 9900 + wsPort: 9800 assets_parachain: &assets_parachain - wsPort: 9910 + wsPort: 9810 paraId: &ap_id 1000 penpal_parachain: &penpal_parachain - wsPort: 9920 + wsPort: 9820 paraId: &pp_id 2000 variables: common: - xcm_verison: &xcm_version '2' - require_weight_at_most: &weight_at_most 1000000000 + xcm_version: &xcm_version '3' + require_weight_at_most: &weight_at_most {refTime: 1000000000, proofSize: 200000} + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } chains: relay_chain: signer: &rc_signer //Alice - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}} penpal_parachain: signer: &pp_signer //Alice decodedCalls: @@ -37,7 +38,7 @@ tests: its: - name: XCM supported versions between chains actions: - - extrinsics: # Relay Chain sets supported version for Assset Parachain + - extrinsics: # Relay Chain sets supported version for Asset Parachain - chain: *relay_chain sudo: true signer: *rc_signer @@ -56,13 +57,9 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - attribute: - type: u32 - value: *xcm_version + result: [{ parents: 0, interior: { X1: { Parachain: *ap_id }}}, *xcm_version ] - extrinsics: # Relay Chain sets supported version for Penpal Parachain - chain: *relay_chain sudo: true @@ -82,14 +79,10 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - attribute: - type: u32 - value: *xcm_version - - extrinsics: # Assset Parachain sets supported version for Relay Chain through it + result: [{ parents: 0, interior: { X1: { Parachain: *pp_id }}}, *xcm_version ] + - extrinsics: # Asset Parachain sets supported version for Relay Chain through it - chain: *relay_chain signer: *rc_signer sudo: true @@ -98,10 +91,20 @@ tests: args: [ *ap_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 3200000000, + proofSize: 200000 + } + } + } + }, { Transact: { - originType: Superuser, + originKind: Superuser, requireWeightAtMost: *weight_at_most, call: $ap_force_xcm_version } @@ -111,15 +114,17 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent + - name: dmpQueue.ExecutedDownward + chain: *assets_parachain + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '1,019,210,000', proofSize: '200,000' }} + } - name: polkadotXcm.SupportedVersionChanged chain: *assets_parachain - attribute: - type: u32 - value: *xcm_version + result: [{ parents: 1, interior: Here }, *xcm_version ] - extrinsics: # Penpal Parachain sets supported version for Relay Chain - chain: *penpal_parachain signer: *pp_signer @@ -135,10 +140,6 @@ tests: ] events: - name: sudo.Sudid - attribute: - type: Result - value: Ok + result: { sudoResult: Ok } - name: polkadotXcm.SupportedVersionChanged - attribute: - type: u32 - value: *xcm_version + result: [{ parents: 1, interior: Here }, *xcm_version ] diff --git a/parachains/integration-tests/statemint/xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/1_dmp.yml similarity index 72% rename from parachains/integration-tests/statemint/xcm/1_dmp.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/1_dmp.yml index 5f0fa349072..823974ad806 100644 --- a/parachains/integration-tests/statemint/xcm/1_dmp.yml +++ b/parachains/integration-tests/e2e/assets/statemint/0_xcm/1_dmp.yml @@ -2,25 +2,28 @@ settings: chains: relay_chain: &relay_chain - wsPort: 9900 + wsPort: 9800 assets_parachain: &assets_parachain - wsPort: 9910 + wsPort: 9810 paraId: &ap_id 1000 variables: - relay_chain: - signer: &rc_signer //Alice - wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - assets_parachain_destination: &ap_dest { v1: { parents: 0, interior: { x1: { parachain: *ap_id }}}} - assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}} - ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}} - amount: &amount 1000000000000 - ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} - require_weight_at_most: &rc_weight_at_most 1000000000 - assets_parachain_account: - wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - asset_id: &asset_id 1 - asset_min_balance: &asset_ed 1000 + common: + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } + chains: + relay_chain: + signer: &rc_signer //Alice + wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + assets_parachain_destination: &ap_dest { v3: { parents: 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + assets_parachain_beneficiary: &ap_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}} + ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}} + amount: &amount 1000000000000 + ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} + require_weight_at_most: &rc_weight_at_most {refTime: 1000000000, proofSize: 200000} + assets_parachain_account: + wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + asset_id: &asset_id 1 + asset_min_balance: &asset_ed 1000 decodedCalls: force_create_asset: chain: *assets_parachain @@ -63,22 +66,20 @@ tests: args: [ *ap_dest, # destination *ap_benf, # beneficiary - { v1: [ *rc_ksm_fungible ] }, # assets + { v3: [ *rc_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: xcmPallet.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true + threshold: *weight_threshold + result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,635,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} + } - queries: balance_rc_sender_after: chain: *relay_chain @@ -131,7 +132,12 @@ tests: args: [ *ap_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, { Transact: { originType: Superuser, @@ -146,11 +152,10 @@ tests: - name: xcmPallet.Sent - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,020,807,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '1,014,103,000', proofSize: '200,000' }} + } - queries: forced_created_asset: chain: *assets_parachain @@ -173,7 +178,12 @@ tests: args: [ *ap_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, { Transact: { originType: Native, @@ -186,9 +196,7 @@ tests: ] events: - name: system.ExtrinsicFailed - attribute: - type: SpRuntimeDispatchError - value: BadOrigin + result: { dispatchError: BadOrigin } - name: xcmPallet.limitedReserveTransferAssets before: *before_get_balances @@ -203,22 +211,25 @@ tests: args: [ *ap_dest, # destination *ap_benf, # beneficiary - { v1: [ *rc_ksm_fungible ] }, # assets + { v3: [ *rc_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: xcmPallet.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - value: 1,000,000,000 + threshold: *weight_threshold + result: [{ Complete: { refTime: '2,000,000,000', proofSize: 0 }}] - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isError: true - value: "WeightNotComputable" + threshold: *weight_threshold + result: { + outcome: { + Incomplete: [ + { refTime: '1,000,000,000', proofSize: 0 }, + UntrustedReserveLocation + ] + } + } - queries: balance_rc_sender_after: chain: *relay_chain diff --git a/parachains/integration-tests/statemint/xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/2_ump.yml similarity index 65% rename from parachains/integration-tests/statemint/xcm/2_ump.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/2_ump.yml index f51823eb3e8..4bdeceb765c 100644 --- a/parachains/integration-tests/statemint/xcm/2_ump.yml +++ b/parachains/integration-tests/e2e/assets/statemint/0_xcm/2_ump.yml @@ -2,30 +2,32 @@ settings: chains: relay_chain: &relay_chain - wsPort: 9900 + wsPort: 9800 assets_parachain: &assets_parachain - wsPort: 9910 + wsPort: 9810 paraId: &ap_id 1000 variables: common: amount: &amount 1000000000000 - require_weight_at_most: &weight_at_most 1000000000 - relay_chain: - signer: &rc_signer //Alice - wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} - assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}} - ksm: &rc_ksm { concrete: { 0, interior: { here: true }}} - ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} - assets_parachain_account: - signer: &ap_signer //Alice - wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}} - assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - relay_chain_beneficiary: &rc_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *rc_acc }}}}} - ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} - ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} + require_weight_at_most: &weight_at_most {refTime: 1000000000, proofSize: 0} + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } + chains: + relay_chain: + signer: &rc_signer //Alice + wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + assets_parachain_beneficiary: &ap_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}} + ksm: &rc_ksm { concrete: { 0, interior: { here: true }}} + ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} + assets_parachain_account: + signer: &ap_signer //Alice + wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F + relay_chain_destination: &rc_dest { v3: { parents: 1, interior: { here: true }}} + assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + relay_chain_beneficiary: &rc_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *rc_acc }}}}} + ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} + ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} decodedCalls: system_remark: chain: *relay_chain @@ -38,7 +40,7 @@ tests: describes: - name: polkadotXcm.limitedTeleportAssets before: - - name: DEPENDANCY | Do a 'limitedTeleportAssets' from the Relay Chain to the Assets Parachain to have funds to send them back + - name: DEPENDENCY | Do a 'limitedTeleportAssets' from the Relay Chain to the Assets Parachain to have funds to send them back actions: - extrinsics: - chain: *relay_chain @@ -48,22 +50,20 @@ tests: args: [ *ap_dest, # destination *ap_benf, # beneficiary - { v1: [ *rc_ksm_fungible ] }, # assets + { v3: [ *rc_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: xcmPallet.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true + threshold: *weight_threshold + result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] - name: dmpQueue.ExecutedDownward chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,635,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} + } - name: Get the balances of the Assets Parachain's sender & Relay Chain's receiver actions: @@ -90,23 +90,18 @@ tests: args: [ *rc_dest, # destination *rc_benf, # beneficiary - { v1: [ *ap_ksm_fungible ] }, # assets + { v3: [ *ap_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 358,878,000 + threshold: *weight_threshold + result: [{ Complete: { refTime: '533,283,000', proofSize: '7,096' }}] - name: ump.ExecutedUpward chain: *relay_chain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - value: 4,000,000,000 + threshold: *weight_threshold + result: [{ Complete: { refTime: '4,000,000,000', proofSize: 0 }}] - queries: balance_ap_sender_after: chain: *assets_parachain @@ -148,7 +143,7 @@ tests: - name: polkadotXcm.send | Native - Transact(system.remark) its: - - name: Assets Parachain SHOULD NOT be able to dipatch 'send' call + - name: Assets Parachain SHOULD NOT be able to dispatch 'send' call actions: - extrinsics: - chain: *assets_parachain @@ -158,7 +153,12 @@ tests: args: [ *rc_dest, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, { Transact: { originType: Native, @@ -171,9 +171,9 @@ tests: ] events: - name: system.ExtrinsicFailed - attribute: - type: SpRuntimeDispatchError - value: BadOrigin + attributes: + - type: SpRuntimeDispatchError + value: BadOrigin - name: polkadotXcm.limitedReserveTransferAssets its: @@ -187,13 +187,10 @@ tests: args: [ *rc_dest, # destination *rc_benf, # beneficiary - { v1: [ *ap_ksm_fungible ] }, # assets + { v3: [ *ap_ksm_fungible ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isError: true - value: Barrier + result: [{ Error: Barrier }] diff --git a/parachains/integration-tests/e2e/assets/statemint/0_xcm/3_force_hrmp-open-channels.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/3_force_hrmp-open-channels.yml new file mode 100644 index 00000000000..ecf344a073b --- /dev/null +++ b/parachains/integration-tests/e2e/assets/statemint/0_xcm/3_force_hrmp-open-channels.yml @@ -0,0 +1,120 @@ +--- +settings: + chains: + relay_chain: &relay_chain + wsPort: 9800 + assets_parachain: + wsPort: 9810 + paraId: &ap_id 1000 + penpal_parachain: + wsPort: 9820 + paraId: &pp_id 2000 + variables: + common: + amount: &amount 2000000000000 + hrmp_channels: + proposed_max_capacity: &max_capacity 8 + proposed_max_message_size: &max_message_size 8192 + channel: &channel { + maxCapacity: *max_capacity, + maxTotalSize: *max_message_size, + maxMessageSize: *max_message_size, + msgCount: 0, + totalSize: 0, + mqcHead: null, + senderDeposit: 0, + recipientDeposit: 0 + } + chains: + relay_chain: + signer: &rc_signer //Alice + assets_parachain_account: + sovereign_account: &ap_sovereign 5Ec4AhPZk8STuex8Wsi9TwDtJQxKqzPJRCH7348Xtcs9vZLJ + penpal_parachain: + sovereign_account: &pp_sovereign F7fq1jMZkfuCuoMTyiEVAP2DMpMt18WopgBqTJznLihLNbZ + +tests: + - name: HRMP + beforeEach: + - name: DEPENDENCY | Penpal Parachain Sovereign account in the Relay Chain needs to be funded + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + pallet: balances + call: transfer + args: [ + *pp_sovereign, # destination + *amount, # value + ] + events: + - name: balances.Transfer + + - name: DEPENDENCY | Assets Parachain Sovereign account in the Relay Chain needs to be funded + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + pallet: balances + call: transfer + args: [ + *ap_sovereign, # destination + *amount, # value + ] + events: + - name: balances.Transfer + describes: + - name: hrmp.hrmpInitOpenChannel (Penpal Parachain → Assets Parachain) + its: + - name: Open Penpal Parachain to Assets Parachain + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: hrmp + call: forceOpenHrmpChannel + args: [ + *pp_id, + *ap_id, + *max_capacity, + *max_message_size + ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } + - name: hrmp.HrmpChannelForceOpened + - name: hrmp.hrmpInitOpenChannel (Assets Parachain → PenPal Parachain) + its: + - name: Open Assets Parachain to PenPal Parachain + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: hrmp + call: forceOpenHrmpChannel + args: [ + *ap_id, + *pp_id, + *max_capacity, + *max_message_size + ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } + - name: hrmp.HrmpChannelForceOpened + - name: hrmp.forceProcessHrmpOpen (make sure all the channels are open) + its: + - name: Make sure all the pending channels are open + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: hrmp + call: forceProcessHrmpOpen + args: [ 2 ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } diff --git a/parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml new file mode 100644 index 00000000000..4ff2fbc59a4 --- /dev/null +++ b/parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml @@ -0,0 +1,390 @@ +--- +# Note: This tests depends on the 3_hrmp-open-channels.yml for opening channels, otherwise teleports aren't going to +# work. +settings: + chains: + relay_chain: &relay_chain + wsPort: 9800 + assets_parachain: &assets_parachain + wsPort: 9810 + paraId: &ap_id 1000 + penpal_parachain: &penpal_parachain + wsPort: 9820 + paraId: &pp_id 2000 + variables: + common: + mint_amount: &mint_amount 1000000000000 + amount: &amount 1000000000000 + require_weight_at_most: &weight_at_most {refTime: 1200000000, proofSize: 20000} + amount_to_send: &amount_to_send 500000000000 + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } + chains: + relay_chain: + signer: &rc_signer //Alice + assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}} + assets_parachain_dest_routed: &ap_dest_routed { v3: { parents: 1, interior: { x1: { parachain: *ap_id } }}} + assets_parachain_account: + signer: &ap_signer //Alice + wallet: &ap_wallet 15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5 + asset_id: &asset_id 2 + assets_pallet_id: &assets_pallet_id 50 + asset_min_balance: &asset_ed 1000 + penpal_parachain_destination: &pp_dest { v3: { parents: 1, interior: { x1: { parachain: *pp_id } }}} + ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} + ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} + suff_asset: &suff_asset { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: *asset_id } ] }}} + suff_asset_fail: &suff_asset_fail { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: 3 } ] }}} + suff_asset_fungible_fail: &ap_suff_asset_fungible_fail { id: *suff_asset_fail, fun: { fungible: 200000000000 }} + penpal_parachain: + sovereign_account: &pp_sovereign_sibl 13cKp89Msu7M2PiaCuuGr1BzAsD5V3vaVbDMs3YtjMZHdGwR + signer: &pp_signer //Alice + penpal_parachain_account: &pp_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + decodedCalls: + force_create_asset: + chain: *assets_parachain + pallet: assets + call: forceCreate + args: [ + *asset_id, + { Id: *ap_wallet }, # owner + true, # isSufficient + *asset_ed # minBalance + ] + force_create_asset2: + chain: *assets_parachain + pallet: assets + call: forceCreate + args: [ + *asset_id, + { Id: *ap_wallet }, # owner + true, # isSufficient + *asset_ed # minBalance + ] + +tests: + - name: HRMP + describes: + - name: polkadotXcm.limitedReserveTransferAssets (Asset) | Assets Parachain -> Penpal Parachain + before: + - name: DEPENDENCY | A sufficient Asset should exist in the Assets Parachain + actions: + - extrinsics: + - chain: *relay_chain + signer: *rc_signer + sudo: true + pallet: xcmPallet + call: send + args: [ + *ap_dest, # destination + { + v3: [ #message + { + UnpaidExecution: { + weightLimit: Unlimited + } + }, + { + SetTopic: '0x0123456789012345678901234567891201234567890123456789012345678912' + }, + { + Transact: { + originKind: Superuser, + requireWeightAtMost: *weight_at_most, + call: $force_create_asset + } + } + ] + } + ] + events: + - name: xcmPallet.Sent + - name: dmpQueue.ExecutedDownward + chain: *assets_parachain + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '1,216,703,000', proofSize: '20,000' }} + } + - queries: + forced_created_asset: + chain: *assets_parachain + pallet: assets + call: asset + args: [ *asset_id ] + - asserts: + isSome: + args: [ $forced_created_asset ] + + - name: DEPENDENCY | Some Assets should be minted for the sender + actions: + - extrinsics: + - chain: *assets_parachain + signer: *ap_signer + pallet: assets + call: mint + args: [ + *asset_id, + *ap_wallet, + *mint_amount + ] + events: + - name: assets.Issued + result: { assetId: *asset_id, owner: *ap_wallet, amount: *mint_amount } + + its: + - name: Assets Parachain should be able to reserve transfer an Asset to Penpal Parachain + actions: + - extrinsics: + - chain: *assets_parachain + signer: *ap_signer + pallet: polkadotXcm + call: limitedReserveTransferAssets + args: [ + *pp_dest, # destination + { # beneficiary + V3: { + parents: 0, + interior: { + X1: { + AccountId32: { + id: *pp_acc + } + } + } + } + }, + { # assets + V3: [ + { + id: { + Concrete: { + parents: 0, + interior: { + X2: [ + { + PalletInstance: *assets_pallet_id + }, + { + GeneralIndex: *asset_id + } + ] + } + } + }, + fun: { + Fungible: *amount_to_send + } + } + ] + }, + 0, # feeAssetItem + Unlimited # weightLimit + ] + events: + - name: polkadotXcm.Attempted + threshold: *weight_threshold + result: [{ Complete: { refTime: '673,627,000', proofSize: '6,196' }}] + - name: assets.Transferred + result: { + assetId: *asset_id, + from: *ap_wallet, + to: *pp_sovereign_sibl, + amount: *amount_to_send + } + + - name: polkadotXcm.limitedReserveTransferAssets (KSM) | Assets Parachain -> Penpal Parachain + its: + - name: Assets Parachain should be able to reserve transfer KSM to Penpal Parachain + actions: + - extrinsics: + - chain: *assets_parachain + signer: *ap_signer + pallet: polkadotXcm + call: limitedReserveTransferAssets + args: [ + *pp_dest, # destination + { # beneficiary + V3: { + parents: 0, + interior: { + X1: { + AccountId32: { + id: *pp_acc + } + } + } + } + }, + { # assets + V3: [ + *ap_ksm_fungible + ] + }, + 0, # feeAssetItem + Unlimited # weightLimit + ] + events: + - name: polkadotXcm.Attempted + threshold: *weight_threshold + result: [{ Complete: { refTime: '679,150,000', proofSize: '6,196' }}] + - name: balances.Endowed + result: { + account: *pp_sovereign_sibl, + freeBalance: *amount + } + + - name: polkadotXcm.send( assets.forceCreateAsset ) | Penpal Parachain -> Assets Parachain + before: + - name: Get the asset balance of the Penpal Parachain Sovereign account in Assets Parachain + actions: + - queries: + assets_balance_pp_sovereign_before: + chain: *assets_parachain + pallet: assets + call: account + args: [ + *asset_id, + *pp_sovereign_sibl + ] + its: + - name: Penpal Parachain should be able to send XCM message paying its fee with sufficient asset in Assets Parachain + actions: + - extrinsics: + - chain: *penpal_parachain + signer: *pp_signer + sudo: true + pallet: polkadotXcm + call: send + args: [ + *ap_dest_routed, # destination + { + v3: [ #message + { + WithdrawAsset: [ + { + id: { + concrete: { + parents: 0, + interior: { + X2: [ + { PalletInstance: *assets_pallet_id }, + { GeneralIndex: *asset_id } + ] + } + } + }, + fun: { fungible: *amount_to_send }} + ] + }, + { + BuyExecution: { + fees: { id: *suff_asset, fun: { fungible: *amount_to_send }}, + weightLimit: Unlimited + } + }, + { + Transact: { + originKind: SovereignAccount, + requireWeightAtMost: *weight_at_most, + call: $force_create_asset2 + } + }, + { + RefundSurplus + }, + { + DepositAsset: { + assets: { Wild: All }, + beneficiary: { + parents: 0, + interior: { + X1: { + AccountId32: { + network: , # None + id: *pp_acc + } + } + }} + } + } + ] + } + ] + events: + - name: sudo.Sudid + result: { sudoResult: Ok } + - name: polkadotXcm.Sent + - name: assets.Burned + chain: *assets_parachain + result: { assetId: *asset_id, owner: *pp_sovereign_sibl } + - name: assets.Issued + chain: *assets_parachain + result: { assetId: *asset_id } + - queries: + assets_balance_pp_sovereign_after: + chain: *assets_parachain + pallet: assets + call: account + args: [ + *asset_id, + *pp_sovereign_sibl + ] + forced_created_asset2: + chain: *assets_parachain + pallet: assets + call: asset + args: [ 3 ] + - asserts: + isSome: + args: [ $forced_created_asset2 ] + - name: Should reduce the assets balance of the Penpal Parachain's SovereignAccount in the Assets Parachain + actions: + - asserts: + assetsDecreased: + args: [ + { + balances: { + before: $assets_balance_pp_sovereign_before, + after: $assets_balance_pp_sovereign_after, + }, + } + ] + + - name: Penpal Parachain SHOULD NOT be able to send XCM message paying its fee with sufficient assets if not enough balance + actions: + - extrinsics: + - chain: *penpal_parachain + signer: *pp_signer + sudo: true + pallet: polkadotXcm + call: send + args: [ + *ap_dest_routed, # destination + { + v3: [ #message + { + WithdrawAsset: [*ap_suff_asset_fungible_fail] + }, + { + BuyExecution: { + fees: *ap_suff_asset_fungible_fail, + weightLimit: Unlimited + } + }, + { + Transact: { + originKind: SovereignAccount, + requireWeightAtMost: *weight_at_most, + call: $force_create_asset2 + } + } + ] + } + ] + events: + - name: xcmpQueue.Fail + chain: *assets_parachain + threshold: *weight_threshold + result: { + error: FailedToTransactAsset, + weight: { refTime: '152,426,000', proofSize: '3,593' } + } diff --git a/parachains/integration-tests/e2e/assets/statemint/config.toml b/parachains/integration-tests/e2e/assets/statemint/config.toml new file mode 100644 index 00000000000..2e68734e09f --- /dev/null +++ b/parachains/integration-tests/e2e/assets/statemint/config.toml @@ -0,0 +1,72 @@ +[relaychain] +default_command = "./bin/polkadot" +default_args = [ "-lparachain=debug", "-lxcm=trace" ] +chain = "polkadot-local" + + [[relaychain.nodes]] + name = "alice" + ws_port = 9800 + validator = true + args = ["--state-cache-size=0"] + + [[relaychain.nodes]] + name = "bob" + ws_port = 9801 + validator = true + + [[relaychain.nodes]] + name = "charlie" + ws_port = 9802 + validator = true + + [[relaychain.nodes]] + name = "dave" + ws_port = 9803 + validator = true + +[[parachains]] +id = 1000 +chain = "statemint-local" +cumulus_based = true + + [[parachains.collators]] + name = "collator1" + ws_port = 9810 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace", "--state-cache-size=0" ] + + [[parachains.collators]] + name = "collator2" + ws_port = 9811 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace" ] + + +[[parachains]] +id = 2000 +chain = "penpal-polkadot-2000" +cumulus_based = true + + [[parachains.collators]] + name = "collator3" + ws_port = 9820 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace", "--state-cache-size=0" ] + + [[parachains.collators]] + name = "collator4" + ws_port = 9821 + command = "./bin/polkadot-parachain" + args = [ "-lxcm=trace" ] + +# [[hrmpChannels]] +# sender = 1000 +# recipient = 2000 +# maxCapacity = 8 +# maxMessageSize = 8192 + +# [[hrmpChannels]] +# sender = 2000 +# recipient = 1000 +# maxCapacity = 8 +# maxMessageSize = 8192 diff --git a/parachains/integration-tests/collectives/0_xcm/0_init.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/0_init.yml similarity index 60% rename from parachains/integration-tests/collectives/0_xcm/0_init.yml rename to parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/0_init.yml index 8c03348025d..d4824469523 100644 --- a/parachains/integration-tests/collectives/0_xcm/0_init.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/0_init.yml @@ -7,12 +7,13 @@ settings: wsPort: 9710 paraId: &cp_id 1001 variables: - xcm_version: &xcm_version '2' + xcm_version: &xcm_version 3 + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } chains: accounts: alice_signer: &alice_signer //Alice decodedCalls: - ap_force_xcm_version: + cp_force_xcm_version: chain: *collectives_parachain pallet: polkadotXcm call: forceXcmVersion @@ -48,13 +49,9 @@ tests: ] events: - name: sudo.Sudid - attributes: - - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - attributes: - - type: u32 - value: *xcm_version + result: [{ parents: 0, interior: { X1: { Parachain: *cp_id }}}, *xcm_version ] - extrinsics: # Collectives Parachain sets supported version for Relay Chain through it - chain: *relay_chain signer: *alice_signer @@ -62,14 +59,27 @@ tests: pallet: xcmPallet call: send args: [ - { v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination + { v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination { - v2: [ # message + v3: [ # message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 2200000000, # 2_200_000_000 + proofSize: 200000, # 200_000 + }, + } + } + }, { Transact: { - originType: Superuser, - requireWeightAtMost: 1000000000, # 1_000_000_000 - call: $ap_force_xcm_version + originKind: Superuser, + requireWeightAtMost: { + refTime: 200000000, # 200_000_000 + proofSize: 0, + }, + call: $cp_force_xcm_version } } ] @@ -77,19 +87,14 @@ tests: ] events: - name: sudo.Sudid - attributes: - - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent - - name: polkadotXcm.SupportedVersionChanged - chain: *collectives_parachain - attributes: - - type: u32 - value: *xcm_version - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # the weight must be static - value: 2,000,000,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '2,200,000,000', proofSize: 0 }} + } + - name: polkadotXcm.SupportedVersionChanged + chain: *collectives_parachain + result: [{ parents: 1, interior: Here }, *xcm_version ] diff --git a/parachains/integration-tests/collectives/0_xcm/1_teleport.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/1_teleport.yml similarity index 69% rename from parachains/integration-tests/collectives/0_xcm/1_teleport.yml rename to parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/1_teleport.yml index cedd08438ad..2cd1fa68168 100644 --- a/parachains/integration-tests/collectives/0_xcm/1_teleport.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/1_teleport.yml @@ -7,12 +7,13 @@ settings: wsPort: 9710 paraId: &cp_id 1001 variables: - weight_to_send_teleport: &weight_to_send_teleport 2,000,000,000 # must be same for both chains - weight_to_receive_teleport: &weight_to_receive_teleport 4,000,000,000 # must be same for both chains + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } accounts: alice_signer: &acc_alice_signer //Alice alice_account32: &acc_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5' + checking_account: &checking_account '13UVJyLnbVp9x5XDyJv8g8r3UddNwBrdaH7AADCmw9XQWvYW' + tests: - name: Teleport assets from Relay Chain to Collectives Parachain successful. @@ -39,39 +40,34 @@ tests: pallet: xcmPallet call: teleportAssets args: [ - { v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination - { v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *acc_alice_acc32 }}}}}, # beneficiary - { - v1: [ - # { + { v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary + { + v3: [ + # { # # TODO use a separate Assets to pay a fee, to receive an exact amount of assets on beneficiary account. # # a call with two assets fails with an error right now. - # id: { concrete: { 0, interior: { here: true }}}, - # fun: { fungible: 1000000000000 } # 1_000_000_000_000 + # id: { concrete: { 0, interior: { here: true }}}, + # fun: { fungible: 1000000000000 } # 1_000_000_000_000 # }, - { - id: { concrete: { 0, interior: { here: true }}}, + { + id: { concrete: { 0, interior: { here: true }}}, fun: { fungible: 20000000000000 } # 20_000_000_000_000 } - ] + ] }, # assets 0, # feeAssetItem ] events: - name: xcmPallet.Attempted - chain: *relay_chain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # the weight must be static - value: *weight_to_send_teleport + threshold: *weight_threshold + result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # the weight must be static - value: *weight_to_receive_teleport + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '4,000,000,000', proofSize: 0 }} + } - queries: balance_rc_alice_2: chain: *relay_chain @@ -113,46 +109,31 @@ tests: pallet: polkadotXcm call: teleportAssets args: [ - { v1: { parents: 1, interior: { here: true }}}, # destination - { v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *acc_alice_acc32 }}}}}, # beneficiary - { - v1: [ - { - id: { concrete: { parents: 1, interior: { here: true }}}, + { v3: { parents: 1, interior: { here: true }}}, # destination + { v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary + { + v3: [ + { + id: { concrete: { parents: 1, interior: { here: true }}}, fun: { fungible: 10000000000000 } # 10_000_000_000_000 } - ] + ] }, # assets 0, # feeAssetItem ] events: - name: balances.Withdraw - attributes: - - type: AccountId32 - key: who - value: *acc_alice_ss58 - - type: u128 - key: amount - value: 10000000000000 + result: { who: *acc_alice_ss58, amount: 10000000000000 } - name: polkadotXcm.Attempted - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # the weight must be static - value: *weight_to_send_teleport + threshold: *weight_threshold + result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] - name: balances.Withdraw chain: *relay_chain - attributes: - - type: u128 - key: amount - value: 10000000000000 # amount received and withdrawn from registry account + result: { who: *checking_account, amount: 10000000000000 } # amount received and withdrawn from registry account - name: ump.ExecutedUpward chain: *relay_chain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # the weight must be static - value: *weight_to_receive_teleport + threshold: *weight_threshold + result: [{ Complete: { refTime: '4,000,000,000', proofSize: 0 }}] - queries: balance_rc_alice_3: chain: *relay_chain diff --git a/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml new file mode 100644 index 00000000000..0695f1201b0 --- /dev/null +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml @@ -0,0 +1,53 @@ +--- +settings: + chains: + relay_chain: &relay_chain + wsPort: 9700 + collectives_parachain: &collectives_parachain + wsPort: 9710 + paraId: &cp_id 1001 + variables: + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } + chains: + accounts: + alice_signer: &alice_signer //Alice + alice_account32: &alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + +tests: + - name: Reserve assets from Relay Chain to Collectives Parachain fails + its: + - name: Reserve assets from Relay Chain to Collectives Parachain + actions: + - extrinsics: + - chain: *relay_chain + signer: *alice_signer + pallet: xcmPallet + call: reserveTransferAssets + args: [ + { v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { accountId32: { id: *alice_acc32 }}}}}, # beneficiary + { + v3: [ + { + id: { concrete: { 0, interior: { here: true }}}, + fun: { fungible: 20000000000000 } # 20_000_000_000_000 + } + ] + }, # assets + 0, # feeAssetItem + ] + events: + - name: xcmPallet.Attempted + threshold: *weight_threshold + result: [{ Complete: { refTime: '2,000,000,000', proofSize: 0 }}] + - name: dmpQueue.ExecutedDownward + chain: *collectives_parachain + threshold: *weight_threshold + result: { + outcome: { + Incomplete: [ + { refTime: '1,000,000,000', proofSize: 0 }, + UntrustedReserveLocation + ] + } + } diff --git a/parachains/integration-tests/collectives/1_alliance/0_join_alliance_fails.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/0_join_alliance_fails.yml similarity index 53% rename from parachains/integration-tests/collectives/1_alliance/0_join_alliance_fails.yml rename to parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/0_join_alliance_fails.yml index 11778830562..9aff8b1db10 100644 --- a/parachains/integration-tests/collectives/1_alliance/0_join_alliance_fails.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/0_join_alliance_fails.yml @@ -1,15 +1,13 @@ --- settings: chains: - relay_chain: &relay_chain + relay_chain: wsPort: 9700 collectives_parachain: &collectives_parachain wsPort: 9710 - paraId: &cp_id 1001 variables: accounts: alice_signer: &alice_signer //Alice - alice_account32: &cp_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' tests: - name: Alice fails to join an the Alliance, since it is not initialized yet. @@ -24,11 +22,8 @@ tests: args: [] events: - name: system.ExtrinsicFailed - attributes: - - type: SpRuntimeDispatchError - key: dispatchError - # TODO assert with Alliance Error variant - alliance.AllianceNotYetInitialized - # issue - https://github.com/paritytech/parachains-integration-tests/issues/59 - value: {"Module":{"index":"50","error":"0x00000000"}} - - + result: { + dispatchError: { Module: { index: 50, error: '0x00000000' }} + } + # TODO assert with Alliance Error variant - alliance.AllianceNotYetInitialized + # issue - https://github.com/paritytech/parachains-integration-tests/issues/59 diff --git a/parachains/integration-tests/collectives/1_alliance/1_init_alliance.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/1_init_alliance.yml similarity index 55% rename from parachains/integration-tests/collectives/1_alliance/1_init_alliance.yml rename to parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/1_init_alliance.yml index 2891d01ca02..15140e6946c 100644 --- a/parachains/integration-tests/collectives/1_alliance/1_init_alliance.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/1_init_alliance.yml @@ -7,24 +7,17 @@ settings: wsPort: 9710 paraId: &coll_para_id 1001 variables: + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } accounts: alice_signer: &acc_alice_signer //Alice - alice_account32: &acc_alice_acc32 "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" - liam_signer: &acc_liam_signer //Liam - liam_account32: &acc_liam_acc32 "0x3614671a5de540d891eb8c4939c8153a4aa790602b347c18177b86d0fc546221" - olivia_signer: &acc_olivia_signer //Olivia - olivia_account32: &acc_olivia_acc32 "0x24ee8a659c6716fe9f7cb4e9e028602aa12867654ca02737da9171b7ff697d5c" - noah_signer: &acc_noah_signer //Noah - noah_account32: &acc_noah_acc32 "0x9c6ad3bc3aa2f1b2e837898e6da9980445f7ef8b3eee0b8c8e305f8cfae68517" - emma_signer: &acc_emma_signer //Emma - emma_account32: &acc_emma_acc32 "0x8ac272b333ba1127c8db57fa777ec820b24598a236efa648caf0d26d86f64572" - james_signer: &acc_james_signer //James - james_account32: &acc_james_acc32 "0x9a52805151a0b5effc084af9264011139872a21a3950cb9ae0b2955c4bf92c18" - ava_signer: &acc_ava_signer //Ava - ava_account32: &acc_ava_acc32 "0x348ef0b8776adbc09c862ddc29b1d193b9e24738e54eea3b0609c83856dc101c" - mia_signer: &acc_mia_signer //Mia - mia_account32: &acc_mia_acc32 "0xaebf15374cf7e758d10232514c569a7abf81cc1b8f1e81a73dbc608a0e335264" - decodedCalls: + liam_account32: &acc_liam_acc32 "0x3614671a5de540d891eb8c4939c8153a4aa790602b347c18177b86d0fc546221" # //Liam + olivia_account32: &acc_olivia_acc32 "0x24ee8a659c6716fe9f7cb4e9e028602aa12867654ca02737da9171b7ff697d5c" # //Olivia + noah_account32: &acc_noah_acc32 "0x9c6ad3bc3aa2f1b2e837898e6da9980445f7ef8b3eee0b8c8e305f8cfae68517" # //Noah + emma_account32: &acc_emma_acc32 "0x8ac272b333ba1127c8db57fa777ec820b24598a236efa648caf0d26d86f64572" # //Emma + james_account32: &acc_james_acc32 "0x9a52805151a0b5effc084af9264011139872a21a3950cb9ae0b2955c4bf92c18" # //James + ava_account32: &acc_ava_acc32 "0x348ef0b8776adbc09c862ddc29b1d193b9e24738e54eea3b0609c83856dc101c" # //Ava + mia_account32: &acc_mia_acc32 "0xaebf15374cf7e758d10232514c569a7abf81cc1b8f1e81a73dbc608a0e335264" # //Mia + decodedCalls: init_alliance_members: chain: *collectives_parachain pallet: alliance @@ -81,13 +74,26 @@ tests: pallet: xcmPallet call: send args: [ - { v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination { - v2: [ # message + v3: [ # message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 3000000000, # 3_000_000_000 + proofSize: 2000000, # 2_000_000 + }, + } + } + }, { Transact: { - originType: Superuser, - requireWeightAtMost: 1000000000, # 1_000_000_000 + originKind: Superuser, + requireWeightAtMost: { + refTime: 1000000000, # 1_000_000_000 + proofSize: 1000000, # 1_000_000 + }, call: $init_alliance_members } } @@ -96,20 +102,17 @@ tests: ] events: - name: sudo.Sudid - attributes: - - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent - name: alliance.MembersInitialized chain: *collectives_parachain - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # we don't know how much weight will be spent for custom call within Transact operation - # value: skipping the assertion - + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }} + } + - name: Alliance init call fails. actions: - extrinsics: @@ -119,13 +122,26 @@ tests: pallet: xcmPallet call: send args: [ - { v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination { - v2: [ # message + v3: [ # message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 3000000000, # 3_000_000_000 + proofSize: 2000000, # 2_000_000 + }, + } + } + }, { Transact: { - originType: Superuser, - requireWeightAtMost: 1000000000, # 1_000_000_000 + originKind: Superuser, + requireWeightAtMost: { + refTime: 1000000000, # 1_000_000_000 + proofSize: 1000000, # 1_000_000 + }, call: $init_alliance_voting_members } } @@ -138,17 +154,14 @@ tests: # Next test with a disband call will fail, if this call does not fail, # since a witness data from a disband call will be invalid. - name: sudo.Sudid - attributes: - - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # the call must fail, the weight spent is static - value: 2,000,000,000 + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }} + } - name: Alliance disbanded and initialized again. actions: @@ -159,13 +172,26 @@ tests: pallet: xcmPallet call: send args: [ - { v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination { - v2: [ # message + v3: [ # message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 5000000000, # 3_000_000_000 + proofSize: 1000000, # 1_000_000 + }, + } + } + }, { Transact: { - originType: Superuser, - requireWeightAtMost: 100000000000, # 100_000_000_000 + originKind: Superuser, + requireWeightAtMost: { + refTime: 3000000000, # 3_000_000_000 + proofSize: 200000, # 200_000 + }, call: $disband } } @@ -174,29 +200,17 @@ tests: ] events: - name: sudo.Sudid - attributes: - - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent - name: alliance.AllianceDisbanded chain: *collectives_parachain - attributes: - - type: u32 - key: fellowMembers - value: 6 - - type: u32 - key: allyMembers - value: 1 - - type: u32 - key: unreserved - value: 0 + result: { fellowMembers: 6, allyMembers: 1, unreserved: 0 } - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # we don't know how much weight will be spent for custom call within Transact operation - # value: skipping the assertion + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '3,321,495,872', proofSize: '181,779' }} + } - name: Alliance initiated, founders and fellows are set. actions: - extrinsics: @@ -206,13 +220,26 @@ tests: pallet: xcmPallet call: send args: [ - { v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination { - v2: [ # message + v3: [ # message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 3000000000, # 3_000_000_000 + proofSize: 2000000, # 2_000_000 + }, + } + } + }, { Transact: { - originType: Superuser, - requireWeightAtMost: 1000000000, # 1_000_000_000 + originKind: Superuser, + requireWeightAtMost: { + refTime: 1000000000, # 1_000_000_000 + proofSize: 1000000, # 1_000_000 + }, call: $init_alliance_members } } @@ -221,17 +248,13 @@ tests: ] events: - name: sudo.Sudid - attributes: - - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent - name: alliance.MembersInitialized chain: *collectives_parachain - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # we don't know how much weight will be spent for custom call within Transact operation - # value: skipping the assertion - + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }} + } diff --git a/parachains/integration-tests/collectives/1_alliance/2_join_alliance_fails.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/2_join_alliance_fails.yml similarity index 53% rename from parachains/integration-tests/collectives/1_alliance/2_join_alliance_fails.yml rename to parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/2_join_alliance_fails.yml index 574df004512..2afdadae602 100644 --- a/parachains/integration-tests/collectives/1_alliance/2_join_alliance_fails.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/2_join_alliance_fails.yml @@ -1,15 +1,14 @@ --- settings: chains: - relay_chain: &relay_chain + relay_chain: wsPort: 9700 collectives_parachain: &collectives_parachain wsPort: 9710 - paraId: &cp_id 1001 + paraId: 1001 variables: accounts: liam_signer: &acc_liam_signer //Liam - liam_account32: &acc_liam_acc32 "0x3614671a5de540d891eb8c4939c8153a4aa790602b347c18177b86d0fc546221" tests: - name: Liam fails to join an the Alliance, Liam is already a member. @@ -24,11 +23,8 @@ tests: args: [] events: - name: system.ExtrinsicFailed - attributes: - - type: SpRuntimeDispatchError - key: dispatchError - # TODO assert with Alliance Error variant - alliance.AllianceNotYetInitialized - # issue - https://github.com/paritytech/parachains-integration-tests/issues/59 - value: {"Module":{"index":"50","error":"0x02000000"}} - - + result: { + dispatchError: { Module: { index: 50, error: '0x02000000' }} + } + # TODO assert with Alliance Error variant - alliance.AllianceNotYetInitialized + # issue - https://github.com/paritytech/parachains-integration-tests/issues/59 diff --git a/parachains/integration-tests/collectives/1_alliance/3_kick_member.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/3_kick_member.yml similarity index 67% rename from parachains/integration-tests/collectives/1_alliance/3_kick_member.yml rename to parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/3_kick_member.yml index 6283bacfdb9..0c07a281e14 100644 --- a/parachains/integration-tests/collectives/1_alliance/3_kick_member.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/3_kick_member.yml @@ -7,10 +7,8 @@ settings: wsPort: 9710 paraId: &cp_id 1001 variables: + weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] } init_teleport_amount: &init_teleport_amount 20000000000000 # 20_000_000_000_000 - weight_to_send_teleport: &weight_to_send_teleport 2,000,000,000 # must be same for both chains - weight_to_receive_teleport: &weight_to_receive_teleport 4,000,000,000 # must be same for both chains - weight_to_receive_transact: &weight_to_receive_transact 3,000,000,000 # must be same for both chains accounts: alice_signer: &acc_alice_signer //Alice treasury_account32: &acc_treasury_acc32 '0x6d6f646c70792f74727372790000000000000000000000000000000000000000' @@ -36,34 +34,25 @@ tests: pallet: xcmPallet call: limitedTeleportAssets args: [ - { v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination - { v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *acc_alice_acc32 }}}}}, # beneficiary - { v1: [ { id: { concrete: { 0, interior: { here: true }}}, fun: { fungible: *init_teleport_amount }} ] }, # assets + { v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary + { v3: [ { id: { concrete: { 0, interior: { here: true }}}, fun: { fungible: *init_teleport_amount }} ] }, # assets 0, # feeAssetItem { unlimited: true } # weightLimit ] events: - name: xcmPallet.Attempted - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - value: *weight_to_send_teleport + threshold: *weight_threshold + result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] - name: balances.Deposit chain: *collectives_parachain - attributes: - - type: AccountId32 - key: who - value: *acc_alice_ss58 - - type: u128 - key: amount - value: 20,000,000,000,000 + result: { who: *acc_alice_ss58 } - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # must be static - value: *weight_to_receive_teleport + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '4,000,000,000', proofSize: 0 }} + } - name: Get the balances of the Relay Chain's treasury & Collectives parachain's future alliance member actions: - queries: @@ -89,18 +78,9 @@ tests: events: - name: balances.Reserved chain: *collectives_parachain - attributes: - - type: AccountId32 - key: who - value: *acc_alice_ss58 - - type: u128 - key: amount - value: 10,000,000,000,000 + result: { who: *acc_alice_ss58, amount: '10,000,000,000,000' } - name: alliance.NewAllyJoined - attributes: - - type: AccountId32 - key: ally - value: *acc_alice_ss58 + result: { ally: *acc_alice_ss58 } - queries: balance_cp_alice_after: chain: *collectives_parachain @@ -129,13 +109,26 @@ tests: pallet: xcmPallet call: send args: [ - { v1: { parents: 0, interior: { x1: { parachain: *cp_id }}}}, # destination + { v3: { parents: 0, interior: { x1: { parachain: *cp_id }}}}, # destination { - v2: [ #message + v3: [ #message + { + UnpaidExecution: { + weightLimit: { + limited: { + refTime: 4000000000, # 4_000_000_000 + proofSize: 2000000, # 2_000_000 + }, + } + } + }, { Transact: { - originType: Superuser, - requireWeightAtMost: 2000000000, + originKind: Superuser, + requireWeightAtMost: { + refTime: 2000000000, # 2_000_000_000 + proofSize: 1000000, # 1_000_000 + }, call: $alliance_kick_member } } @@ -144,23 +137,17 @@ tests: ] events: - name: sudo.Sudid - attributes: - - type: Result - value: Ok + result: { sudoResult: Ok } - name: xcmPallet.Sent - name: alliance.MemberKicked chain: *collectives_parachain - attributes: - - type: AccountId32 - key: member - value: *acc_alice_ss58 + result: { member: *acc_alice_ss58 } - name: dmpQueue.ExecutedDownward chain: *collectives_parachain - attributes: - - type: XcmV2TraitsOutcome - xcmOutcome: Complete - # must be static - value: *weight_to_receive_transact + threshold: *weight_threshold + result: { + outcome: { Complete: { refTime: '4,000,000,000', proofSize: '1,000,000' }} + } - queries: balance_rc_treasury_after: diff --git a/parachains/integration-tests/collectives/config.toml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/config.toml similarity index 74% rename from parachains/integration-tests/collectives/config.toml rename to parachains/integration-tests/e2e/collectives/collectives-polkadot/config.toml index 9d138be11ba..20fda92bd08 100644 --- a/parachains/integration-tests/collectives/config.toml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/config.toml @@ -7,13 +7,21 @@ chain = "polkadot-local" name = "alice" ws_port = 9700 validator = true + args = ["--state-cache-size=0"] [[relaychain.nodes]] name = "bob" + ws_port = 9701 validator = true [[relaychain.nodes]] name = "charlie" + ws_port = 9702 + validator = true + + [[relaychain.nodes]] + name = "dave" + ws_port = 9703 validator = true [[parachains]] @@ -25,9 +33,10 @@ cumulus_based = true name = "collator1" ws_port = 9710 command = "./bin/polkadot-parachain" - args = ["-lxcm=trace"] + args = [ "-lxcm=trace", "--state-cache-size=0" ] [[parachains.collators]] name = "collator2" + ws_port = 9711 command = "./bin/polkadot-parachain" args = ["-lxcm=trace"] diff --git a/parachains/integration-tests/emulated/assets/statemine/Cargo.toml b/parachains/integration-tests/emulated/assets/statemine/Cargo.toml new file mode 100644 index 00000000000..42ed5ac0605 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemine/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "statemine-it" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Statemine parachain runtime integration tests with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + +# Polkadot +polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } + +# Cumulus +parachains-common = { path = "../../../../common" } +penpal-runtime = { path = "../../../../runtimes/testing/penpal" } +statemine-runtime = { path = "../../../../runtimes/assets/statemine" } + +# Local +xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } +integration-tests-common = { default-features = false, path = "../../common" } diff --git a/parachains/integration-tests/emulated/assets/statemine/src/lib.rs b/parachains/integration-tests/emulated/assets/statemine/src/lib.rs new file mode 100644 index 00000000000..7616a871b84 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemine/src/lib.rs @@ -0,0 +1,30 @@ +pub use codec::Encode; +pub use frame_support::{ + assert_ok, instances::Instance1, pallet_prelude::Weight, traits::fungibles::Inspect, +}; +pub use integration_tests_common::{ + constants::{ + accounts::{ALICE, BOB}, + kusama::ED as KUSAMA_ED, + PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3, + }, + AccountId, BHKusama, BHKusamaPallet, BHKusamaReceiver, BHKusamaSender, BHPolkadot, + BHPolkadotPallet, BHPolkadotReceiver, BHPolkadotSender, Collectives, CollectivesPallet, + CollectivesReceiver, CollectivesSender, Kusama, KusamaMockNet, KusamaPallet, KusamaReceiver, + KusamaSender, PenpalKusama, PenpalKusamaReceiver, PenpalKusamaSender, PenpalPolkadot, + PenpalPolkadotReceiver, PenpalPolkadotSender, Polkadot, PolkadotMockNet, PolkadotPallet, + PolkadotReceiver, PolkadotSender, Statemine, StateminePallet, StatemineReceiver, + StatemineSender, +}; +pub use polkadot_core_primitives::InboundDownwardMessage; +pub use xcm::{ + prelude::*, + v3::{Error, NetworkId::Kusama as KusamaId}, +}; +pub use xcm_emulator::{ + assert_expected_events, bx, cumulus_pallet_dmp_queue, helpers::weight_within_threshold, + Parachain as Para, RelayChain as Relay, TestExt, +}; + +#[cfg(test)] +mod tests; diff --git a/parachains/integration-tests/emulated/assets/statemine/src/tests/mod.rs b/parachains/integration-tests/emulated/assets/statemine/src/tests/mod.rs new file mode 100644 index 00000000000..996f9fd0aae --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemine/src/tests/mod.rs @@ -0,0 +1,3 @@ +mod reserve_transfer; +mod teleport; +mod transact; diff --git a/parachains/integration-tests/emulated/assets/statemine/src/tests/reserve_transfer.rs b/parachains/integration-tests/emulated/assets/statemine/src/tests/reserve_transfer.rs new file mode 100644 index 00000000000..bbf272572ac --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemine/src/tests/reserve_transfer.rs @@ -0,0 +1,63 @@ +use crate::*; + +#[test] +fn reserve_transfer_native_asset_from_relay_to_assets() { + // Init tests variables + let amount = KUSAMA_ED * 1000; + let relay_sender_balance_before = Kusama::account_data_of(KusamaSender::get()).free; + let para_receiver_balance_before = Statemine::account_data_of(StatemineReceiver::get()).free; + + let origin = ::RuntimeOrigin::signed(KusamaSender::get()); + let assets_para_destination: VersionedMultiLocation = + Kusama::child_location_of(Statemine::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemineReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain + Kusama::execute_with(|| { + assert_ok!(::XcmPallet::limited_reserve_transfer_assets( + origin, + bx!(assets_para_destination), + bx!(beneficiary), + bx!(native_assets), + fee_asset_item, + weight_limit, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Kusama, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted { outcome: Outcome::Complete(weight) }) => { + weight: weight_within_threshold((REF_TIME_THRESHOLD, PROOF_SIZE_THRESHOLD), Weight::from_parts(754_244_000, 0), *weight), + }, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemine::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Statemine, + vec![ + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { + outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), + .. + }) => {}, + ] + ); + }); + + // Check if balances are updated accordingly in Relay Chain and Assets Parachain + let relay_sender_balance_after = Kusama::account_data_of(KusamaSender::get()).free; + let para_sender_balance_after = Statemine::account_data_of(StatemineReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert_eq!(para_sender_balance_after, para_receiver_balance_before); +} diff --git a/parachains/integration-tests/emulated/assets/statemine/src/tests/teleport.rs b/parachains/integration-tests/emulated/assets/statemine/src/tests/teleport.rs new file mode 100644 index 00000000000..cbb07e4592e --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemine/src/tests/teleport.rs @@ -0,0 +1,62 @@ +use crate::*; + +#[test] +fn teleport_native_assets_from_relay_to_assets_para() { + // Init tests variables + let amount = KUSAMA_ED * 1000; + let relay_sender_balance_before = Kusama::account_data_of(KusamaSender::get()).free; + let para_receiver_balance_before = Statemine::account_data_of(StatemineReceiver::get()).free; + + let origin = ::RuntimeOrigin::signed(KusamaSender::get()); + let assets_para_destination: VersionedMultiLocation = + Kusama::child_location_of(Statemine::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemineReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain + Kusama::execute_with(|| { + assert_ok!(::XcmPallet::limited_teleport_assets( + origin, + bx!(assets_para_destination), + bx!(beneficiary), + bx!(native_assets), + fee_asset_item, + weight_limit, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Kusama, + vec![ + RuntimeEvent::XcmPallet( + pallet_xcm::Event::Attempted { outcome: Outcome::Complete { .. } } + ) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemine::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Statemine, + vec![ + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => { + who: *who == StatemineReceiver::get().into(), + }, + ] + ); + }); + + // Check if balances are updated accordingly in Relay Chain and Assets Parachain + let relay_sender_balance_after = Kusama::account_data_of(KusamaSender::get()).free; + let para_sender_balance_after = Statemine::account_data_of(StatemineReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert!(para_sender_balance_after > para_receiver_balance_before); +} diff --git a/parachains/integration-tests/emulated/assets/statemine/src/tests/transact.rs b/parachains/integration-tests/emulated/assets/statemine/src/tests/transact.rs new file mode 100644 index 00000000000..144c8cc9f21 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemine/src/tests/transact.rs @@ -0,0 +1,58 @@ +use crate::*; + +#[test] +fn transact_sudo_from_relay_to_assets_para() { + // Init tests variables + // Call to be executed in Assets Parachain + const ASSET_ID: u32 = 1; + + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_create { + id: ASSET_ID.into(), + is_sufficient: true, + min_balance: 1000, + owner: StatemineSender::get().into(), + }) + .encode() + .into(); + + // XcmPallet send arguments + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Kusama::child_location_of(Statemine::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + // Send XCM message from Relay Chain + Kusama::execute_with(|| { + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Kusama, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemine::execute_with(|| { + assert!(::Assets::asset_exists(ASSET_ID)); + }); +} diff --git a/parachains/integration-tests/emulated/assets/statemint/Cargo.toml b/parachains/integration-tests/emulated/assets/statemint/Cargo.toml new file mode 100644 index 00000000000..8c6077b67e4 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "statemint-it" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Statemint parachain runtime integration tests with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + +# Polkadot +polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } + +# Cumulus +parachains-common = { path = "../../../../common" } +penpal-runtime = { path = "../../../../runtimes/testing/penpal" } +statemint-runtime = { path = "../../../../runtimes/assets/statemint" } + +# Local +xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } +integration-tests-common = { default-features = false, path = "../../common" } diff --git a/parachains/integration-tests/emulated/assets/statemint/src/lib.rs b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs new file mode 100644 index 00000000000..f7ca680a800 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs @@ -0,0 +1,33 @@ +pub use codec::Encode; +pub use frame_support::{ + assert_ok, instances::Instance1, pallet_prelude::Weight, traits::fungibles::Inspect, +}; +pub use integration_tests_common::{ + constants::{ + accounts::{ALICE, BOB}, + polkadot::ED as POLKADOT_ED, + PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3, + }, + AccountId, BHKusama, BHKusamaPallet, BHKusamaReceiver, BHKusamaSender, BHPolkadot, + BHPolkadotPallet, BHPolkadotReceiver, BHPolkadotSender, Collectives, CollectivesPallet, + CollectivesReceiver, CollectivesSender, Kusama, KusamaMockNet, KusamaPallet, KusamaReceiver, + KusamaSender, PenpalKusama, PenpalKusamaReceiver, PenpalKusamaSender, PenpalPolkadot, + PenpalPolkadotReceiver, PenpalPolkadotSender, Polkadot, PolkadotMockNet, PolkadotPallet, + PolkadotReceiver, PolkadotSender, Statemine, StateminePallet, StatemineReceiver, + StatemineSender, Statemint, StatemintPallet, StatemintReceiver, StatemintSender, +}; +pub use polkadot_core_primitives::InboundDownwardMessage; +pub use xcm::{ + prelude::*, + v3::{ + Error, + NetworkId::{Kusama as KusamaId, Polkadot as PolkadotId}, + }, +}; +pub use xcm_emulator::{ + assert_expected_events, bx, cumulus_pallet_dmp_queue, helpers::weight_within_threshold, + Parachain as Para, RelayChain as Relay, TestExt, +}; + +#[cfg(test)] +mod tests; diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs new file mode 100644 index 00000000000..996f9fd0aae --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs @@ -0,0 +1,3 @@ +mod reserve_transfer; +mod teleport; +mod transact; diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs new file mode 100644 index 00000000000..b69222670b1 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs @@ -0,0 +1,63 @@ +use crate::*; + +#[test] +fn reserve_transfer_native_asset_from_relay_to_assets() { + // Init tests variables + let amount = POLKADOT_ED * 1000; + let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + + let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::limited_reserve_transfer_assets( + origin, + bx!(assets_para_destination), + bx!(beneficiary), + bx!(native_assets), + fee_asset_item, + weight_limit, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted { outcome: Outcome::Complete(weight) }) => { + weight: weight_within_threshold((REF_TIME_THRESHOLD, PROOF_SIZE_THRESHOLD), Weight::from_parts(2_000_000_000, 0), *weight), + }, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Statemint, + vec![ + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { + outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), + .. + }) => {}, + ] + ); + }); + + // Check if balances are updated accordingly in Relay Chain and Assets Parachain + let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert_eq!(para_sender_balance_after, para_receiver_balance_before); +} diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs new file mode 100644 index 00000000000..19aa5fe1f9e --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs @@ -0,0 +1,60 @@ +use crate::*; + +#[test] +fn teleport_native_assets_from_relay_to_assets_para() { + // Init tests variables + let amount = POLKADOT_ED * 1000; + let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + + let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::limited_teleport_assets( + origin, + bx!(assets_para_destination), + bx!(beneficiary), + bx!(native_assets), + fee_asset_item, + weight_limit, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted { outcome: Outcome::Complete { .. } }) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Statemint, + vec![ + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => { + who: *who == StatemintReceiver::get().into(), + }, + ] + ); + }); + + // Check if balances are updated accordingly in Relay Chain and Assets Parachain + let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert!(para_sender_balance_after > para_receiver_balance_before); +} diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs new file mode 100644 index 00000000000..9220d914e47 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs @@ -0,0 +1,58 @@ +use crate::*; + +#[test] +fn transact_sudo_from_relay_to_assets_para() { + // Init tests variables + // Call to be executed in Assets Parachain + const ASSET_ID: u32 = 1; + + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_create { + id: ASSET_ID.into(), + is_sufficient: true, + min_balance: 1000, + owner: StatemintSender::get().into(), + }) + .encode() + .into(); + + // XcmPallet send arguments + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + assert!(::Assets::asset_exists(ASSET_ID)); + }); +} diff --git a/parachains/integration-tests/emulated/common/Cargo.toml b/parachains/integration-tests/emulated/common/Cargo.toml new file mode 100644 index 00000000000..a13ceac2cff --- /dev/null +++ b/parachains/integration-tests/emulated/common/Cargo.toml @@ -0,0 +1,54 @@ +[package] +name = "integration-tests-common" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Common resources for integration testing with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +grandpa = { package = "sc-consensus-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } +sp-authority-discovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-babe = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-staking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-im-online = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + +# Polkadot +polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-service = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } +kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } + +# Cumulus +parachains-common = { path = "../../../common" } +parachain-info = { path = "../../../pallets/parachain-info" } +cumulus-primitives-core = { path = "../../../../primitives/core" } +penpal-runtime = { path = "../../../runtimes/testing/penpal" } +statemint-runtime = { path = "../../../runtimes/assets/statemint" } +statemine-runtime = { path = "../../../runtimes/assets/statemine" } +collectives-polkadot-runtime = { path = "../../../runtimes/collectives/collectives-polkadot" } +bridge-hub-kusama-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-kusama" } +bridge-hub-polkadot-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-polkadot" } +xcm-emulator = { default-features = false, path = "../../../../xcm/xcm-emulator" } + +[features] +runtime-benchmarks = [ + "kusama-runtime/runtime-benchmarks", +] diff --git a/parachains/integration-tests/emulated/common/src/constants.rs b/parachains/integration-tests/emulated/common/src/constants.rs new file mode 100644 index 00000000000..694137fe094 --- /dev/null +++ b/parachains/integration-tests/emulated/common/src/constants.rs @@ -0,0 +1,641 @@ +use grandpa::AuthorityId as GrandpaId; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +pub use parachains_common::{AccountId, AuraId, Balance, BlockNumber, StatemintAuraId}; +use polkadot_primitives::{AssignmentId, ValidatorId}; +pub use polkadot_runtime_parachains::configuration::HostConfiguration; +use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; +use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; +use sp_consensus_babe::AuthorityId as BabeId; +use sp_core::{sr25519, storage::Storage, Pair, Public}; +use sp_runtime::{ + traits::{IdentifyAccount, Verify}, + BuildStorage, MultiSignature, Perbill, +}; +pub use xcm; + +pub const XCM_V2: u32 = 3; +pub const XCM_V3: u32 = 2; +pub const REF_TIME_THRESHOLD: u64 = 33; +pub const PROOF_SIZE_THRESHOLD: u64 = 33; + +type AccountPublic = ::Signer; + +/// Helper function to generate a crypto pair from seed +fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate an account ID from seed. +fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +pub mod accounts { + use super::*; + pub const ALICE: &str = "Alice"; + pub const BOB: &str = "Bob"; + pub const CHARLIE: &str = "Charlie"; + pub const DAVE: &str = "Dave"; + pub const EVE: &str = "Eve"; + pub const FERDIE: &str = "Ferdei"; + pub const ALICE_STASH: &str = "Alice//stash"; + pub const BOB_STASH: &str = "Bob//stash"; + pub const CHARLIE_STASH: &str = "Charlie//stash"; + pub const DAVE_STASH: &str = "Dave//stash"; + pub const EVE_STASH: &str = "Eve//stash"; + pub const FERDIE_STASH: &str = "Ferdie//stash"; + + pub fn init_balances() -> Vec { + vec![ + get_account_id_from_seed::(ALICE), + get_account_id_from_seed::(BOB), + get_account_id_from_seed::(CHARLIE), + get_account_id_from_seed::(DAVE), + get_account_id_from_seed::(EVE), + get_account_id_from_seed::(FERDIE), + get_account_id_from_seed::(ALICE_STASH), + get_account_id_from_seed::(BOB_STASH), + get_account_id_from_seed::(CHARLIE_STASH), + get_account_id_from_seed::(DAVE_STASH), + get_account_id_from_seed::(EVE_STASH), + get_account_id_from_seed::(FERDIE_STASH), + ] + } +} + +pub mod collators { + use super::*; + + pub fn invulnerables_statemint() -> Vec<(AccountId, StatemintAuraId)> { + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_from_seed::("Bob"), + ), + ] + } + + pub fn invulnerables() -> Vec<(AccountId, AuraId)> { + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), + ] + } +} + +pub mod validators { + use super::*; + + pub fn initial_authorities() -> Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + ImOnlineId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + )> { + vec![get_authority_keys_from_seed_no_beefy("Alice")] + } +} + +/// The default XCM version to set in genesis config. +const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; +// Polkadot +pub mod polkadot { + use super::*; + pub const ED: Balance = polkadot_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + const STASH: u128 = 100 * polkadot_runtime_constants::currency::UNITS; + + pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + ..Default::default() + } + } + + fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + ) -> polkadot_runtime::SessionKeys { + polkadot_runtime::SessionKeys { + babe, + grandpa, + im_online, + para_validator, + para_assignment, + authority_discovery, + } + } + + pub fn genesis() -> Storage { + let genesis_config = polkadot_runtime::GenesisConfig { + system: polkadot_runtime::SystemConfig { + code: polkadot_runtime::WASM_BINARY.unwrap().to_vec(), + }, + balances: polkadot_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + session: polkadot_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + polkadot::session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + staking: polkadot_runtime::StakingConfig { + validator_count: validators::initial_authorities().len() as u32, + minimum_validator_count: 1, + stakers: validators::initial_authorities() + .iter() + .map(|x| { + (x.0.clone(), x.1.clone(), STASH, polkadot_runtime::StakerStatus::Validator) + }) + .collect(), + invulnerables: validators::initial_authorities() + .iter() + .map(|x| x.0.clone()) + .collect(), + force_era: pallet_staking::Forcing::ForceNone, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }, + babe: polkadot_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(polkadot_runtime::BABE_GENESIS_EPOCH_CONFIG), + }, + configuration: polkadot_runtime::ConfigurationConfig { config: get_host_config() }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() + } +} + +// Kusama +pub mod kusama { + use super::*; + pub const ED: Balance = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + use kusama_runtime_constants::currency::UNITS as KSM; + const ENDOWMENT: u128 = 1_000_000 * KSM; + const STASH: u128 = 100 * KSM; + + pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + ..Default::default() + } + } + + fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + ) -> kusama_runtime::SessionKeys { + kusama_runtime::SessionKeys { + babe, + grandpa, + im_online, + para_validator, + para_assignment, + authority_discovery, + } + } + + pub fn genesis() -> Storage { + let genesis_config = kusama_runtime::GenesisConfig { + system: kusama_runtime::SystemConfig { + code: kusama_runtime::WASM_BINARY.unwrap().to_vec(), + }, + balances: kusama_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .map(|k: &AccountId| (k.clone(), ENDOWMENT)) + .collect(), + }, + session: kusama_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + kusama::session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + staking: kusama_runtime::StakingConfig { + validator_count: validators::initial_authorities().len() as u32, + minimum_validator_count: 1, + stakers: validators::initial_authorities() + .iter() + .map(|x| { + (x.0.clone(), x.1.clone(), STASH, kusama_runtime::StakerStatus::Validator) + }) + .collect(), + invulnerables: validators::initial_authorities() + .iter() + .map(|x| x.0.clone()) + .collect(), + force_era: pallet_staking::Forcing::NotForcing, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }, + babe: kusama_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(kusama_runtime::BABE_GENESIS_EPOCH_CONFIG), + }, + configuration: kusama_runtime::ConfigurationConfig { config: get_host_config() }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() + } +} + +// Statemint +pub mod statemint { + use super::*; + pub const PARA_ID: u32 = 1000; + pub const ED: Balance = statemint_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = statemint_runtime::GenesisConfig { + system: statemint_runtime::SystemConfig { + code: statemint_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: statemint_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: statemint_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: statemint_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables_statemint() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: statemint_runtime::SessionConfig { + keys: collators::invulnerables_statemint() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + statemint_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: statemint_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +// Statemint +pub mod statemine { + use super::*; + pub const PARA_ID: u32 = 1000; + pub const ED: Balance = statemine_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = statemine_runtime::GenesisConfig { + system: statemine_runtime::SystemConfig { + code: statemine_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: statemine_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: statemine_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: statemine_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: statemine_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + statemine_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: statemine_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +// Penpal +pub mod penpal { + use super::*; + pub const PARA_ID: u32 = 2000; + pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT; + + pub fn genesis(para_id: u32) -> Storage { + let genesis_config = penpal_runtime::GenesisConfig { + system: penpal_runtime::SystemConfig { + code: penpal_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: penpal_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: penpal_runtime::ParachainInfoConfig { parachain_id: para_id.into() }, + collator_selection: penpal_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: penpal_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + penpal_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: penpal_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + sudo: penpal_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +// Collectives +pub mod collectives { + use super::*; + pub const PARA_ID: u32 = 1001; + pub const ED: Balance = collectives_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = collectives_polkadot_runtime::GenesisConfig { + system: collectives_polkadot_runtime::SystemConfig { + code: collectives_polkadot_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: collectives_polkadot_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + }, + collator_selection: collectives_polkadot_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: collectives_polkadot_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + collectives_polkadot_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: collectives_polkadot_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + alliance: Default::default(), + alliance_motion: Default::default(), + }; + + genesis_config.build_storage().unwrap() + } +} + +pub mod bridge_hub_kusama { + use super::*; + pub const PARA_ID: u32 = 1002; + pub const ED: Balance = bridge_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = bridge_hub_kusama_runtime::GenesisConfig { + system: bridge_hub_kusama_runtime::SystemConfig { + code: bridge_hub_kusama_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: bridge_hub_kusama_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + }, + collator_selection: bridge_hub_kusama_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: bridge_hub_kusama_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + bridge_hub_kusama_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: bridge_hub_kusama_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +pub mod bridge_hub_polkadot { + use super::*; + pub const PARA_ID: u32 = 1002; + pub const ED: Balance = bridge_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = bridge_hub_polkadot_runtime::GenesisConfig { + system: bridge_hub_polkadot_runtime::SystemConfig { + code: bridge_hub_polkadot_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: bridge_hub_polkadot_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + }, + collator_selection: bridge_hub_polkadot_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: bridge_hub_polkadot_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + bridge_hub_polkadot_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: bridge_hub_polkadot_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} diff --git a/parachains/integration-tests/emulated/common/src/lib.rs b/parachains/integration-tests/emulated/common/src/lib.rs new file mode 100644 index 00000000000..49e919b5de9 --- /dev/null +++ b/parachains/integration-tests/emulated/common/src/lib.rs @@ -0,0 +1,255 @@ +pub mod constants; + +pub use constants::{ + accounts::{ALICE, BOB}, + bridge_hub_kusama, bridge_hub_polkadot, collectives, kusama, penpal, polkadot, statemine, + statemint, +}; +use frame_support::{parameter_types, sp_io, sp_tracing}; +pub use parachains_common::{AccountId, AuraId, Balance, BlockNumber, StatemintAuraId}; +pub use sp_core::{sr25519, storage::Storage, Get}; +use xcm::prelude::*; +use xcm_emulator::{ + decl_test_networks, decl_test_parachains, decl_test_relay_chains, Parachain, RelayChain, + TestExt, +}; +use xcm_executor::traits::Convert; + +decl_test_relay_chains! { + pub struct Polkadot { + genesis = polkadot::genesis(), + on_init = (), + runtime = { + Runtime: polkadot_runtime::Runtime, + RuntimeOrigin: polkadot_runtime::RuntimeOrigin, + RuntimeCall: polkadot_runtime::RuntimeCall, + RuntimeEvent: polkadot_runtime::RuntimeEvent, + MessageQueue: polkadot_runtime::MessageQueue, + XcmConfig: polkadot_runtime::xcm_config::XcmConfig, + SovereignAccountOf: polkadot_runtime::xcm_config::SovereignAccountOf, + System: polkadot_runtime::System, + Balances: polkadot_runtime::Balances, + }, + pallets_extra = { + XcmPallet: polkadot_runtime::XcmPallet, + } + }, + pub struct Kusama { + genesis = kusama::genesis(), + on_init = (), + runtime = { + Runtime: kusama_runtime::Runtime, + RuntimeOrigin: kusama_runtime::RuntimeOrigin, + RuntimeCall: kusama_runtime::RuntimeCall, + RuntimeEvent: kusama_runtime::RuntimeEvent, + MessageQueue: kusama_runtime::MessageQueue, + XcmConfig: kusama_runtime::xcm_config::XcmConfig, + SovereignAccountOf: kusama_runtime::xcm_config::SovereignAccountOf, + System: kusama_runtime::System, + Balances: kusama_runtime::Balances, + }, + pallets_extra = { + XcmPallet: kusama_runtime::XcmPallet, + } + } +} + +decl_test_parachains! { + // Polkadot + pub struct Statemint { + genesis = statemint::genesis(), + on_init = (), + runtime = { + Runtime: statemint_runtime::Runtime, + RuntimeOrigin: statemint_runtime::RuntimeOrigin, + RuntimeCall: statemint_runtime::RuntimeCall, + RuntimeEvent: statemint_runtime::RuntimeEvent, + XcmpMessageHandler: statemint_runtime::XcmpQueue, + DmpMessageHandler: statemint_runtime::DmpQueue, + LocationToAccountId: statemint_runtime::xcm_config::LocationToAccountId, + System: statemint_runtime::System, + Balances: statemint_runtime::Balances, + ParachainSystem: statemint_runtime::ParachainSystem, + ParachainInfo: statemint_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: statemint_runtime::PolkadotXcm, + Assets: statemint_runtime::Assets, + } + }, + pub struct PenpalPolkadot { + genesis = penpal::genesis(penpal::PARA_ID), + on_init = (), + runtime = { + Runtime: penpal_runtime::Runtime, + RuntimeOrigin: penpal_runtime::RuntimeOrigin, + RuntimeCall: penpal_runtime::RuntimeCall, + RuntimeEvent: penpal_runtime::RuntimeEvent, + XcmpMessageHandler: penpal_runtime::XcmpQueue, + DmpMessageHandler: penpal_runtime::DmpQueue, + LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId, + System: penpal_runtime::System, + Balances: penpal_runtime::Balances, + ParachainSystem: penpal_runtime::ParachainSystem, + ParachainInfo: penpal_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: penpal_runtime::PolkadotXcm, + Assets: penpal_runtime::Assets, + } + }, + // Kusama + pub struct Statemine { + genesis = statemine::genesis(), + on_init = (), + runtime = { + Runtime: statemine_runtime::Runtime, + RuntimeOrigin: statemine_runtime::RuntimeOrigin, + RuntimeCall: statemine_runtime::RuntimeCall, + RuntimeEvent: statemine_runtime::RuntimeEvent, + XcmpMessageHandler: statemine_runtime::XcmpQueue, + DmpMessageHandler: statemine_runtime::DmpQueue, + LocationToAccountId: statemine_runtime::xcm_config::LocationToAccountId, + System: statemine_runtime::System, + Balances: statemine_runtime::Balances, + ParachainSystem: statemine_runtime::ParachainSystem, + ParachainInfo: statemine_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: statemine_runtime::PolkadotXcm, + Assets: statemine_runtime::Assets, + ForeignAssets: statemine_runtime::Assets, + } + }, + pub struct PenpalKusama { + genesis = penpal::genesis(penpal::PARA_ID), + on_init = (), + runtime = { + Runtime: penpal_runtime::Runtime, + RuntimeOrigin: penpal_runtime::RuntimeOrigin, + RuntimeCall: penpal_runtime::RuntimeCall, + RuntimeEvent: penpal_runtime::RuntimeEvent, + XcmpMessageHandler: penpal_runtime::XcmpQueue, + DmpMessageHandler: penpal_runtime::DmpQueue, + LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId, + System: penpal_runtime::System, + Balances: penpal_runtime::Balances, + ParachainSystem: penpal_runtime::ParachainSystem, + ParachainInfo: penpal_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: penpal_runtime::PolkadotXcm, + Assets: penpal_runtime::Assets, + } + }, + pub struct Collectives { + genesis = collectives::genesis(), + on_init = (), + runtime = { + Runtime: collectives_polkadot_runtime::Runtime, + RuntimeOrigin: collectives_polkadot_runtime::RuntimeOrigin, + RuntimeCall: collectives_polkadot_runtime::RuntimeCall, + RuntimeEvent: collectives_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: collectives_polkadot_runtime::XcmpQueue, + DmpMessageHandler: collectives_polkadot_runtime::DmpQueue, + LocationToAccountId: collectives_polkadot_runtime::xcm_config::LocationToAccountId, + System: collectives_polkadot_runtime::System, + Balances: collectives_polkadot_runtime::Balances, + ParachainSystem: collectives_polkadot_runtime::ParachainSystem, + ParachainInfo: collectives_polkadot_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: collectives_polkadot_runtime::PolkadotXcm, + } + }, + pub struct BHKusama { + genesis = bridge_hub_kusama::genesis(), + on_init = (), + runtime = { + Runtime: bridge_hub_kusama_runtime::Runtime, + RuntimeOrigin: bridge_hub_kusama_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_kusama_runtime::RuntimeCall, + RuntimeEvent: bridge_hub_kusama_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_kusama_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_kusama_runtime::DmpQueue, + LocationToAccountId: bridge_hub_kusama_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_kusama_runtime::System, + Balances: bridge_hub_kusama_runtime::Balances, + ParachainSystem: bridge_hub_kusama_runtime::ParachainSystem, + ParachainInfo:bridge_hub_kusama_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: bridge_hub_kusama_runtime::PolkadotXcm, + } + }, + pub struct BHPolkadot { + genesis = bridge_hub_polkadot::genesis(), + on_init = (), + runtime = { + Runtime: bridge_hub_polkadot_runtime::Runtime, + RuntimeOrigin: bridge_hub_polkadot_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_polkadot_runtime::RuntimeCall, + RuntimeEvent: bridge_hub_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_polkadot_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_polkadot_runtime::DmpQueue, + LocationToAccountId: bridge_hub_polkadot_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_polkadot_runtime::System, + Balances: bridge_hub_polkadot_runtime::Balances, + ParachainSystem: bridge_hub_polkadot_runtime::ParachainSystem, + ParachainInfo:bridge_hub_polkadot_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: bridge_hub_polkadot_runtime::PolkadotXcm, + } + } +} + +decl_test_networks! { + pub struct PolkadotMockNet { + relay_chain = Polkadot, + parachains = vec![ + Statemint, + PenpalPolkadot, + Collectives, + BHPolkadot, + ], + }, + pub struct KusamaMockNet { + relay_chain = Kusama, + parachains = vec![ + Statemine, + PenpalKusama, + BHKusama, + ], + } +} + +parameter_types! { + // Polkadot + pub PolkadotSender: AccountId = Polkadot::account_id_of(ALICE); + pub PolkadotReceiver: AccountId = Polkadot::account_id_of(BOB); + // Kusama + pub KusamaSender: AccountId = Kusama::account_id_of(ALICE); + pub KusamaReceiver: AccountId = Kusama::account_id_of(BOB); + // Statemint + pub StatemintSender: AccountId = Statemint::account_id_of(ALICE); + pub StatemintReceiver: AccountId = Statemint::account_id_of(BOB); + // Statemine + pub StatemineSender: AccountId = Statemine::account_id_of(ALICE); + pub StatemineReceiver: AccountId = Statemine::account_id_of(BOB); + // Penpal Polkadot + pub PenpalPolkadotSender: AccountId = PenpalPolkadot::account_id_of(ALICE); + pub PenpalPolkadotReceiver: AccountId = PenpalPolkadot::account_id_of(BOB); + // Penpal Kusama + pub PenpalKusamaSender: AccountId = PenpalKusama::account_id_of(ALICE); + pub PenpalKusamaReceiver: AccountId = PenpalKusama::account_id_of(BOB); + // Collectives + pub CollectivesSender: AccountId = Collectives::account_id_of(ALICE); + pub CollectivesReceiver: AccountId = Collectives::account_id_of(BOB); + // Bridge Hub Polkadot + pub BHPolkadotSender: AccountId = BHPolkadot::account_id_of(ALICE); + pub BHPolkadotReceiver: AccountId = BHPolkadot::account_id_of(BOB); + // Bridge Hub Kusama + pub BHKusamaSender: AccountId = BHKusama::account_id_of(ALICE); + pub BHKusamaReceiver: AccountId = BHKusama::account_id_of(BOB); +} diff --git a/parachains/integration-tests/statemine/config.toml b/parachains/integration-tests/statemine/config.toml deleted file mode 100644 index 510f3cd3b04..00000000000 --- a/parachains/integration-tests/statemine/config.toml +++ /dev/null @@ -1,49 +0,0 @@ -[relaychain] -default_command = "./bin/polkadot" -default_args = [ "-lparachain=debug" ] -chain = "kusama-local" - - [[relaychain.nodes]] - name = "alice" - ws_port = 9900 - validator = true - - [[relaychain.nodes]] - name = "bob" - validator = true - - [[relaychain.nodes]] - name = "charlie" - validator = true - - [[relaychain.nodes]] - name = "dave" - validator = true - -[[parachains]] -id = 1000 -chain = "statemine-local" -cumulus_based = true - - [[parachains.collators]] - name = "collator1" - ws_port = 9910 - command = "./bin/polkadot-parachain" - - [[parachains.collators]] - name = "collator2" - command = "./bin/polkadot-parachain" - -[[parachains]] -id = 2000 -chain = "penpal-kusama-2000" -cumulus_based = true - - [[parachains.collators]] - name = "collator3" - ws_port = 9920 - command = "./bin/polkadot-parachain" - - [[parachains.collators]] - name = "collator4" - command = "./bin/polkadot-parachain" diff --git a/parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml b/parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml deleted file mode 100644 index 45bf89e2b05..00000000000 --- a/parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml +++ /dev/null @@ -1,408 +0,0 @@ ---- -settings: - chains: - relay_chain: &relay_chain - wsPort: 9900 - assets_parachain: &assets_parachain - wsPort: 9910 - paraId: &ap_id 1000 - penpal_parachain: &penpal_parachain - wsPort: 9920 - paraId: &pp_id 2000 - variables: - common: - amount: &amount 2000000000000 - require_weight_at_most: &weight_at_most 1000000000 - hrmp_channels: - proposed_max_capacity: &max_capacity 8 - proposed_max_message_size: &max_message_size 8192 - channel: &channel { - maxCapacity: 8, - maxTotalSize: 8192, - maxMessageSize: 8192, - msgCount: 0, - totalSize: 0, - mqcHead: null, - senderDeposit: 0, - recipientDeposit: 0 - } - chains: - relay_chain: - signer: &rc_signer //Alice - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} - assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}} - ksm: &rc_ksm { concrete: { 0, interior: { here: true }}} - ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} - assets_parachain_account: - sovereign_account: &ap_sovereign F7fq1jSNVTPfJmaHaXCMtatT1EZefCUsa7rRiQVNR5efcah - relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}} - penpal_parachain: - sovereign_account: &pp_sovereign F7fq1jMZkfuCuoMTyiEVAP2DMpMt18WopgBqTJznLihLNbZ - signer: &pp_signer //Alice - decodedCalls: - init_open_channel_with_ap: - chain: *relay_chain - pallet: hrmp - call: hrmpInitOpenChannel - args: [ - *ap_id, # recipient - *max_capacity, # proposedMaxCapacity - *max_message_size # proposedMaxMessageSize - ] - init_open_channel_with_cp: - chain: *relay_chain - pallet: hrmp - call: hrmpInitOpenChannel - args: [ - *pp_id, # recipient - *max_capacity, # proposedMaxCapacity - *max_message_size # proposedMaxMessageSize - ] - accept_open_channel_with_ap: - chain: *relay_chain - pallet: hrmp - call: hrmpAcceptOpenChannel - args: [ - *ap_id, # recipient - ] - accept_init_open_request_from_cp: - chain: *relay_chain - pallet: hrmp - call: hrmpAcceptOpenChannel - args: [ - *pp_id, # sender - ] - xcm_accept_init_open_request_from_cp: - chain: *assets_parachain - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $accept_init_open_request_from_cp - } - } - ] - } - ] - xcm_init_open_channel_with_cp: - chain: *assets_parachain - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $init_open_channel_with_cp - } - } - ] - } - ] - -tests: - - name: HRMP - beforeEach: - - name: DEPENDANCY | Penpal Parachain Sovereign account in the Relay Chain needs to be funded - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - pallet: balances - call: transfer - args: [ - *pp_sovereign, # destination - *amount, # value - ] - events: - - name: balances.Transfer - - - name: DEPENDANCY | Assets Parachain Sovereign account in the Relay Chain needs to be funded - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - pallet: balances - call: transfer - args: [ - *ap_sovereign, # destination - *amount, # value - ] - events: - - name: balances.Transfer - describes: - - name: hrmp.hrmpInitOpenChannel (Penpal Parachain → Assets Parachain) - its: - - name: Penpal Parachain sends a request to the Relay Chain to open a channel with the Assets Parchain - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $init_open_channel_with_ap - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: polkadotXcm.Sent - - name: ump.ExecutedUpward - chain: *relay_chain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,160,892,000 - - name: hrmp.OpenChannelRequested - chain: *relay_chain - - queries: - requested_channels: - chain: *relay_chain - pallet: hrmp - call: hrmpOpenChannelRequestsList - args: [] - - asserts: - equal: - args: [ - $requested_channels, - [ - { - sender: *pp_id, - recipient: *ap_id - } - ] - ] - - - name: hrmp.hrmpAcceptOpenChannel (Assets Parachain → Penpal Parachain) - its: - - name: Assets Parachain sends a response to the Relay Chain accepting the Penpal Parachain's request for openning a HRMP channel - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - sudo: true - pallet: xcmPallet - call: send - args: [ - *ap_dest, # destination - { - v2: [ #message - { - Transact: { - originType: Superuser, - requireWeightAtMost: *weight_at_most, - call: $xcm_accept_init_open_request_from_cp - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: xcmPallet.Sent - - name: dmpQueue.ExecutedDownward - chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,258,000 - - name: polkadotXcm.Sent - chain: *assets_parachain - - name: ump.ExecutedUpward - timeout: 40000 - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,160,892,000 - - name: hrmp.OpenChannelAccepted - timeout: 40000 - - queries: - open_channels: - chain: *relay_chain - pallet: hrmp - call: hrmpChannels - delay: 80000 - args: [ - { - sender: *pp_id, - recipient: *ap_id - } - ] - - asserts: - equal: - args: [ - $open_channels, - *channel - ] - - - name: hrmp.hrmpInitOpenChannel (Assets Parachain → Penpal Parachain) - its: - - name: Assets Parchain sends a request to the Relay Chain to open a channel with a Penpal Parachain - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - sudo: true - pallet: xcmPallet - call: send - args: [ - *ap_dest, # destination - { - v2: [ #message - { - Transact: { - originType: Superuser, - requireWeightAtMost: *weight_at_most, - call: $xcm_init_open_channel_with_cp - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: xcmPallet.Sent - - name: dmpQueue.ExecutedDownward - chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,258,000 - - name: polkadotXcm.Sent - chain: *assets_parachain - - name: ump.ExecutedUpward - timeout: 40000 - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,160,892,000 - - name: hrmp.OpenChannelRequested - timeout: 40000 - - queries: - requested_channels: - chain: *relay_chain - pallet: hrmp - call: hrmpOpenChannelRequestsList - args: [] - - asserts: - equal: - args: [ - $requested_channels, - [ - { - sender: *ap_id, - recipient: *pp_id - } - ] - ] - - - name: hrmp.hrmpAcceptOpenChannel (Penpal Parachain → Assets Parachain) - its: - - name: Penpal Parachain sends a response to the Relay Chain accepting the Assets Parachain's request for openning a HRMP channel - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $accept_open_channel_with_ap - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: polkadotXcm.Sent - - name: ump.ExecutedUpward - chain: *relay_chain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,160,892,000 - - name: hrmp.OpenChannelAccepted - chain: *relay_chain diff --git a/parachains/integration-tests/statemine/xcm/4_hrmp.yml b/parachains/integration-tests/statemine/xcm/4_hrmp.yml deleted file mode 100644 index 28ef7bc803a..00000000000 --- a/parachains/integration-tests/statemine/xcm/4_hrmp.yml +++ /dev/null @@ -1,356 +0,0 @@ ---- -settings: - chains: - relay_chain: &relay_chain - wsPort: 9900 - assets_parachain: &assets_parachain - wsPort: 9910 - paraId: &ap_id 1000 - penpal_parachain: &penpal_parachain - wsPort: 9920 - paraId: &pp_id 2000 - variables: - common: - amount: &amount 1000000000000 - require_weight_at_most: &weight_at_most 1000000000 - amount_to_send: &amount_to_send 500000000000 - chains: - relay_chain: - signer: &rc_signer //Alice - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} - assets_parachain_dest_routed: &ap_dest_routed { v1: { parents: 1, interior: { x1: { parachain: *ap_id } }}} - assets_parachain_account: - signer: &ap_signer //Alice - wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - asset_id: &asset_id 2 - assets_pallet_id: &assets_pallet_id 50 - asset_min_balance: &asset_ed 1000 - penpal_parachain_destination: &pp_dest { v1: { parents: 1, interior: { x1: { parachain: *pp_id } }}} - ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} - ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} - suff_asset: &suff_asset { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: *asset_id } ] }}} - suff_asset_fail: &suff_asset_fail { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: 3 } ] }}} - suff_asset_fungible: &ap_suff_asset_fungible { id: *suff_asset, fun: { fungible: *weight_at_most }} - suff_asset_fungible_fail: &ap_suff_asset_fungible_fail { id: *suff_asset_fail, fun: { fungible: *weight_at_most }} - penpal_parachain: - sovereign_account: &pp_sovereign_sibl FBeL7EAeUroLWXW1yfKboiqTqVfbRBcsUKd6QqVf4kGBySS - signer: &pp_signer //Alice - penpal_parachain_account: &pp_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - decodedCalls: - force_create_asset: - chain: *assets_parachain - pallet: assets - call: forceCreate - args: [ - *asset_id, - { Id: *ap_wallet }, # owner - true, # isSufficient - *asset_ed # minBalance - ] - system_remark_with_event: - chain: *assets_parachain - pallet: system - call: remarkWithEvent - args: [ 0x0011 ] - -tests: - - name: HRMP - describes: - - name: polkadotXcm.limitedReserveTransferAssets (Asset) | Assets Parachain -> Penpal Parachain - before: - - name: DEPENDANCY | A sufficient Asset should exist in the Assets Parachain - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - sudo: true - pallet: xcmPallet - call: send - args: [ - *ap_dest, # destination - { - v2: [ #message - { - Transact: { - originType: Superuser, - requireWeightAtMost: *weight_at_most, - call: $force_create_asset - } - } - ] - } - ] - events: - - name: xcmPallet.Sent - - name: dmpQueue.ExecutedDownward - chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,021,258,000 - - queries: - forced_created_asset: - chain: *assets_parachain - pallet: assets - call: asset - args: [ *asset_id ] - - asserts: - isSome: - args: [ $forced_created_asset ] - - - name: DEPENDANCY | Some Assets should be minted for the sender - actions: - - extrinsics: - - chain: *assets_parachain - signer: *ap_signer - pallet: assets - call: mint - args: [ - *asset_id, - *ap_wallet, - *amount - ] - events: - - name: assets.Issued - - its: - - name: Assets Parachain should be able to reserve transfer an Asset to Penpal Parachain - actions: - - extrinsics: - - chain: *assets_parachain - signer: *ap_signer - pallet: polkadotXcm - call: limitedReserveTransferAssets - args: [ - *pp_dest, # destination - { # beneficiary - V1: { - parents: 0, - interior: { - X1: { - AccountId32: { - network: Any, - id: *pp_acc - } - } - } - } - }, - { # assets - V1: [ - { - id: { - Concrete: { - parents: 0, - interior: { - X2: [ - { - PalletInstance: 50 - }, - { - GeneralIndex: *asset_id - } - ] - } - } - }, - fun: { - Fungible: *amount_to_send - } - } - ] - }, - 0, # feeAssetItem - Unlimited # weightLimit - ] - events: - - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 654,608,000 - - name: assets.Transferred - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - name: assets.Transferred - attribute: - type: u128 - value: *amount_to_send - - - name: polkadotXcm.limitedReserveTransferAssets (KSM) | Assets Parachain -> Penpal Parachain - its: - - name: Assets Parachain should be able to reserve transfer KSM to Penpal Parachain - actions: - - extrinsics: - - chain: *assets_parachain - signer: *ap_signer - pallet: polkadotXcm - call: limitedReserveTransferAssets - args: [ - *pp_dest, # destination - { # beneficiary - V1: { - parents: 0, - interior: { - X1: { - AccountId32: { - network: Any, - id: *pp_acc - } - } - } - } - }, - { # assets - V1: [ - *ap_ksm_fungible - ] - }, - 0, # feeAssetItem - Unlimited # weightLimit - ] - events: - - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 654,608,000 - - name: balances.Endowed - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - name: balances.Endowed - attribute: - type: u128 - value: *amount - - - name: polkadotXcm.send( system.remarkWithEvent() ) | Penpal Parachain -> Assets Parachain - before: - - name: Get the asset balance of the Penpal Parachain Sovereign account in Assets Parachain - actions: - - queries: - assets_balance_pp_sovereign_before: - chain: *assets_parachain - pallet: assets - call: account - args: [ - *asset_id, - *pp_sovereign_sibl - ] - its: - - name: Penpal Parachain should be able to send XCM message paying its fee with sufficient asset in Assets Parachain - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *ap_dest_routed, # destination - { - v2: [ #message - { - WithdrawAsset: [*ap_suff_asset_fungible] - }, - { - BuyExecution: { - fees: *ap_suff_asset_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: SovereignAccount, - requireWeightAtMost: *weight_at_most, - call: $system_remark_with_event - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: polkadotXcm.Sent - - name: assets.Burned - chain: *assets_parachain - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - name: assets.Issued - chain: *assets_parachain - attribute: - type: u32 - value: *asset_id - - name: system.Remarked - chain: *assets_parachain - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - queries: - assets_balance_pp_sovereign_after: - chain: *assets_parachain - pallet: assets - call: account - args: [ - *asset_id, - *pp_sovereign_sibl - ] - - - name: Should reduce the assets balance of the Penpal Parachain's SovereignAccount in the Assets Parachain - actions: - - asserts: - assetsDecreased: - args: [ - { - balances: { - before: $assets_balance_pp_sovereign_before, - after: $assets_balance_pp_sovereign_after, - }, - } - ] - - - name: Penpal Parachain SHOULD NOT be able to send XCM message paying its fee with sufficient assets if not enough balance - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *ap_dest_routed, # destination - { - v2: [ #message - { - WithdrawAsset: [*ap_suff_asset_fungible_fail] - }, - { - BuyExecution: { - fees: *ap_suff_asset_fungible_fail, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: SovereignAccount, - requireWeightAtMost: *weight_at_most, - call: $system_remark_with_event - } - } - ] - } - ] - events: - - name: xcmpQueue.Fail - chain: *assets_parachain - attribute: - type: XcmV2TraitsError - value: FailedToTransactAsset diff --git a/parachains/integration-tests/statemint/config.toml b/parachains/integration-tests/statemint/config.toml deleted file mode 100644 index f989d366ef3..00000000000 --- a/parachains/integration-tests/statemint/config.toml +++ /dev/null @@ -1,49 +0,0 @@ -[relaychain] -default_command = "./bin/polkadot" -default_args = [ "-lparachain=debug" ] -chain = "polkadot-local" - - [[relaychain.nodes]] - name = "alice" - ws_port = 9900 - validator = true - - [[relaychain.nodes]] - name = "bob" - validator = true - - [[relaychain.nodes]] - name = "charlie" - validator = true - - [[relaychain.nodes]] - name = "dave" - validator = true - -[[parachains]] -id = 1000 -chain = "statemint-local" -cumulus_based = true - - [[parachains.collators]] - name = "collator1" - ws_port = 9910 - command = "./bin/polkadot-parachain" - - [[parachains.collators]] - name = "collator2" - command = "./bin/polkadot-parachain" - -[[parachains]] -id = 2000 -chain = "penpal-polkadot-2000" -cumulus_based = true - - [[parachains.collators]] - name = "collator3" - ws_port = 9920 - command = "./bin/polkadot-parachain" - - [[parachains.collators]] - name = "collator4" - command = "./bin/polkadot-parachain" diff --git a/parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml b/parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml deleted file mode 100644 index f83e778f1c0..00000000000 --- a/parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml +++ /dev/null @@ -1,402 +0,0 @@ ---- -settings: - chains: - relay_chain: &relay_chain - wsPort: 9900 - assets_parachain: &assets_parachain - wsPort: 9910 - paraId: &ap_id 1000 - penpal_parachain: &penpal_parachain - wsPort: 9920 - paraId: &pp_id 2000 - variables: - common: - amount: &amount 2000000000000 - require_weight_at_most: &weight_at_most 1000000000 - hrmp_channels: - proposed_max_capacity: &max_capacity 8 - proposed_max_message_size: &max_message_size 8192 - channel: &channel { - maxCapacity: 8, - maxTotalSize: 8192, - maxMessageSize: 8192, - msgCount: 0, - totalSize: 0, - mqcHead: null, - senderDeposit: 0, - recipientDeposit: 0 - } - chains: - relay_chain: - signer: &rc_signer //Alice - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} - ksm: &rc_ksm { concrete: { 0, interior: { here: true }}} - ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }} - assets_parachain_account: - sovereign_account: &ap_sovereign F7fq1jSNVTPfJmaHaXCMtatT1EZefCUsa7rRiQVNR5efcah - relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}} - penpal_parachain: - sovereign_account: &pp_sovereign F7fq1jMZkfuCuoMTyiEVAP2DMpMt18WopgBqTJznLihLNbZ - signer: &pp_signer //Alice - decodedCalls: - init_open_channel_with_ap: - chain: *relay_chain - pallet: hrmp - call: hrmpInitOpenChannel - args: [ - *ap_id, # recipient - *max_capacity, # proposedMaxCapacity - *max_message_size # proposedMaxMessageSize - ] - init_open_channel_with_cp: - chain: *relay_chain - pallet: hrmp - call: hrmpInitOpenChannel - args: [ - *pp_id, # recipient - *max_capacity, # proposedMaxCapacity - *max_message_size # proposedMaxMessageSize - ] - accept_open_channel_with_ap: - chain: *relay_chain - pallet: hrmp - call: hrmpAcceptOpenChannel - args: [ - *ap_id, # recipient - ] - accept_init_open_request_from_cp: - chain: *relay_chain - pallet: hrmp - call: hrmpAcceptOpenChannel - args: [ - *pp_id, # sender - ] - xcm_accept_init_open_request_from_cp: - chain: *assets_parachain - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $accept_init_open_request_from_cp - } - } - ] - } - ] - xcm_init_open_channel_with_cp: - chain: *assets_parachain - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $init_open_channel_with_cp - } - } - ] - } - ] - -tests: - - name: HRMP - beforeEach: - - name: DEPENDANCY | Penpal Parachain Sovereign account in the Relay Chain needs to be funded - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - pallet: balances - call: transfer - args: [ - *pp_sovereign, # destination - *amount, # value - ] - events: - - name: balances.Transfer - - - name: DEPENDANCY | Assets Parachain Sovereign account in the Relay Chain needs to be funded - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - pallet: balances - call: transfer - args: [ - *ap_sovereign, # destination - *amount, # value - ] - events: - - name: balances.Transfer - describes: - - name: hrmp.hrmpInitOpenChannel (Penpal Parachain → Assets Parachain) - its: - - name: Penpal Parachain sends a request to the Relay Chain to open a channel with the Assets Parchain - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $init_open_channel_with_ap - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: polkadotXcm.Sent - - name: ump.ExecutedUpward - chain: *relay_chain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - value: 4,000,000,000 - - name: hrmp.OpenChannelRequested - chain: *relay_chain - - queries: - requested_channels: - chain: *relay_chain - pallet: hrmp - call: hrmpOpenChannelRequestsList - args: [] - - asserts: - equal: - args: [ - $requested_channels, - [ - { - sender: *pp_id, - recipient: *ap_id - } - ] - ] - - - name: hrmp.hrmpAcceptOpenChannel (Assets Parachain → Penpal Parachain) - its: - - name: Assets Parachain sends a response to the Relay Chain accepting the Penpal Parachain's request for openning a HRMP channel - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - sudo: true - pallet: xcmPallet - call: send - args: [ - *ap_dest, # destination - { - v2: [ #message - { - Transact: { - originType: Superuser, - requireWeightAtMost: *weight_at_most, - call: $xcm_accept_init_open_request_from_cp - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: xcmPallet.Sent - - name: dmpQueue.ExecutedDownward - chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,020,807,000 - - name: polkadotXcm.Sent - chain: *assets_parachain - - name: ump.ExecutedUpward - timeout: 40000 - attribute: - type: XcmV2TraitsOutcome - isComplete: true - value: 4,000,000,000 - - name: hrmp.OpenChannelAccepted - timeout: 40000 - - queries: - open_channels: - chain: *relay_chain - pallet: hrmp - call: hrmpChannels - delay: 80000 - args: [ - { - sender: *pp_id, - recipient: *ap_id - } - ] - - asserts: - equal: - args: [ - $open_channels, - *channel - ] - - - name: hrmp.hrmpInitOpenChannel (Assets Parachain → Penpal Parachain) - its: - - name: Assets Parchain sends a request to the Relay Chain to open a channel with a Penpal Parachain - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - sudo: true - pallet: xcmPallet - call: send - args: [ - *ap_dest, # destination - { - v2: [ #message - { - Transact: { - originType: Superuser, - requireWeightAtMost: *weight_at_most, - call: $xcm_init_open_channel_with_cp - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: xcmPallet.Sent - - name: dmpQueue.ExecutedDownward - chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,020,807,000 - - name: polkadotXcm.Sent - chain: *assets_parachain - - name: ump.ExecutedUpward - timeout: 40000 - attribute: - type: XcmV2TraitsOutcome - isComplete: true - value: 4,000,000,000 - - name: hrmp.OpenChannelRequested - timeout: 40000 - - queries: - requested_channels: - chain: *relay_chain - pallet: hrmp - call: hrmpOpenChannelRequestsList - args: [] - - asserts: - equal: - args: [ - $requested_channels, - [ - { - sender: *ap_id, - recipient: *pp_id - } - ] - ] - - - name: hrmp.hrmpAcceptOpenChannel (Penpal Parachain → Assets Parachain) - its: - - name: Penpal Parachain sends a response to the Relay Chain accepting the Assets Parachain's request for openning a HRMP channel - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *rc_dest, # destination - { - v2: [ #message - { - WithdrawAsset: [*rc_ksm_fungible] - }, - { - BuyExecution: { - fees: *rc_ksm_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: Native, - requireWeightAtMost: *weight_at_most, - call: $accept_open_channel_with_ap - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: polkadotXcm.Sent - - name: ump.ExecutedUpward - chain: *relay_chain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - value: 4,000,000,000 - - name: hrmp.OpenChannelAccepted - chain: *relay_chain diff --git a/parachains/integration-tests/statemint/xcm/4_hrmp.yml b/parachains/integration-tests/statemint/xcm/4_hrmp.yml deleted file mode 100644 index 00a3ff467bc..00000000000 --- a/parachains/integration-tests/statemint/xcm/4_hrmp.yml +++ /dev/null @@ -1,356 +0,0 @@ ---- -settings: - chains: - relay_chain: &relay_chain - wsPort: 9900 - assets_parachain: &assets_parachain - wsPort: 9910 - paraId: &ap_id 1000 - penpal_parachain: &penpal_parachain - wsPort: 9920 - paraId: &pp_id 2000 - variables: - common: - amount: &amount 1000000000000 - require_weight_at_most: &weight_at_most 1000000000 - amount_to_send: &amount_to_send 500000000000 - chains: - relay_chain: - signer: &rc_signer //Alice - assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}} - assets_parachain_dest_routed: &ap_dest_routed { v1: { parents: 1, interior: { x1: { parachain: *ap_id } }}} - assets_parachain_account: - signer: &ap_signer //Alice - wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F - asset_id: &asset_id 2 - assets_pallet_id: &assets_pallet_id 50 - asset_min_balance: &asset_ed 1000 - penpal_parachain_destination: &pp_dest { v1: { parents: 1, interior: { x1: { parachain: *pp_id } }}} - ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}} - ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }} - suff_asset: &suff_asset { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: *asset_id } ] }}} - suff_asset_fail: &suff_asset_fail { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: 3 } ] }}} - suff_asset_fungible: &ap_suff_asset_fungible { id: *suff_asset, fun: { fungible: *weight_at_most }} - suff_asset_fungible_fail: &ap_suff_asset_fungible_fail { id: *suff_asset_fail, fun: { fungible: *weight_at_most }} - penpal_parachain: - sovereign_account: &pp_sovereign_sibl 13cKp89Msu7M2PiaCuuGr1BzAsD5V3vaVbDMs3YtjMZHdGwR - signer: &pp_signer //Alice - penpal_parachain_account: &pp_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' - decodedCalls: - force_create_asset: - chain: *assets_parachain - pallet: assets - call: forceCreate - args: [ - *asset_id, - { Id: *ap_wallet }, # owner - true, # isSufficient - *asset_ed # minBalance - ] - system_remark_with_event: - chain: *assets_parachain - pallet: system - call: remarkWithEvent - args: [ 0x0011 ] - -tests: - - name: HRMP - describes: - - name: polkadotXcm.limitedReserveTransferAssets (Asset) | Assets Parachain -> Penpal Parachain - before: - - name: DEPENDANCY | A sufficient Asset should exist in the Assets Parachain - actions: - - extrinsics: - - chain: *relay_chain - signer: *rc_signer - sudo: true - pallet: xcmPallet - call: send - args: [ - *ap_dest, # destination - { - v2: [ #message - { - Transact: { - originType: Superuser, - requireWeightAtMost: *weight_at_most, - call: $force_create_asset - } - } - ] - } - ] - events: - - name: xcmPallet.Sent - - name: dmpQueue.ExecutedDownward - chain: *assets_parachain - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 1,020,807,000 - - queries: - forced_created_asset: - chain: *assets_parachain - pallet: assets - call: asset - args: [ *asset_id ] - - asserts: - isSome: - args: [ $forced_created_asset ] - - - name: DEPENDANCY | Some Assets should be minted for the sender - actions: - - extrinsics: - - chain: *assets_parachain - signer: *ap_signer - pallet: assets - call: mint - args: [ - *asset_id, - *ap_wallet, - *amount - ] - events: - - name: assets.Issued - - its: - - name: Assets Parachain should be able to reserve transfer an Asset to Penpal Parachain - actions: - - extrinsics: - - chain: *assets_parachain - signer: *ap_signer - pallet: polkadotXcm - call: limitedReserveTransferAssets - args: [ - *pp_dest, # destination - { # beneficiary - V1: { - parents: 0, - interior: { - X1: { - AccountId32: { - network: Any, - id: *pp_acc - } - } - } - } - }, - { # assets - V1: [ - { - id: { - Concrete: { - parents: 0, - interior: { - X2: [ - { - PalletInstance: 50 - }, - { - GeneralIndex: *asset_id - } - ] - } - } - }, - fun: { - Fungible: *amount_to_send - } - } - ] - }, - 0, # feeAssetItem - Unlimited # weightLimit - ] - events: - - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 654,404,000 - - name: assets.Transferred - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - name: assets.Transferred - attribute: - type: u128 - value: *amount_to_send - - - name: polkadotXcm.limitedReserveTransferAssets (KSM) | Assets Parachain -> Penpal Parachain - its: - - name: Assets Parachain should be able to reserve transfer KSM to Penpal Parachain - actions: - - extrinsics: - - chain: *assets_parachain - signer: *ap_signer - pallet: polkadotXcm - call: limitedReserveTransferAssets - args: [ - *pp_dest, # destination - { # beneficiary - V1: { - parents: 0, - interior: { - X1: { - AccountId32: { - network: Any, - id: *pp_acc - } - } - } - } - }, - { # assets - V1: [ - *ap_ksm_fungible - ] - }, - 0, # feeAssetItem - Unlimited # weightLimit - ] - events: - - name: polkadotXcm.Attempted - attribute: - type: XcmV2TraitsOutcome - isComplete: true - threshold: [10, 10] - value: 654,404,000 - - name: balances.Endowed - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - name: balances.Endowed - attribute: - type: u128 - value: *amount - - - name: polkadotXcm.send( system.remarkWithEvent() ) | Penpal Parachain -> Assets Parachain - before: - - name: Get the asset balance of the Penpal Parachain Sovereign account in Assets Parachain - actions: - - queries: - assets_balance_pp_sovereign_before: - chain: *assets_parachain - pallet: assets - call: account - args: [ - *asset_id, - *pp_sovereign_sibl - ] - its: - - name: Penpal Parachain should be able to send XCM message paying its fee with sufficient asset in Assets Parachain - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *ap_dest_routed, # destination - { - v2: [ #message - { - WithdrawAsset: [*ap_suff_asset_fungible] - }, - { - BuyExecution: { - fees: *ap_suff_asset_fungible, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: SovereignAccount, - requireWeightAtMost: *weight_at_most, - call: $system_remark_with_event - } - } - ] - } - ] - events: - - name: sudo.Sudid - attribute: - type: Result - value: Ok - - name: polkadotXcm.Sent - - name: assets.Burned - chain: *assets_parachain - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - name: assets.Issued - chain: *assets_parachain - attribute: - type: u32 - value: *asset_id - - name: system.Remarked - chain: *assets_parachain - attribute: - type: AccountId32 - value: *pp_sovereign_sibl - - queries: - assets_balance_pp_sovereign_after: - chain: *assets_parachain - pallet: assets - call: account - args: [ - *asset_id, - *pp_sovereign_sibl - ] - - - name: Should reduce the assets balance of the Penpal Parachain's SovereignAccount in the Assets Parachain - actions: - - asserts: - assetsDecreased: - args: [ - { - balances: { - before: $assets_balance_pp_sovereign_before, - after: $assets_balance_pp_sovereign_after, - }, - } - ] - - - name: Penpal Parachain SHOULD NOT be able to send XCM message paying its fee with sufficient assets if not enough balance - actions: - - extrinsics: - - chain: *penpal_parachain - signer: *pp_signer - sudo: true - pallet: polkadotXcm - call: send - args: [ - *ap_dest_routed, # destination - { - v2: [ #message - { - WithdrawAsset: [*ap_suff_asset_fungible_fail] - }, - { - BuyExecution: { - fees: *ap_suff_asset_fungible_fail, - weightLimit: Unlimited - } - }, - { - Transact: { - originType: SovereignAccount, - requireWeightAtMost: *weight_at_most, - call: $system_remark_with_event - } - } - ] - } - ] - events: - - name: xcmpQueue.Fail - chain: *assets_parachain - attribute: - type: XcmV2TraitsError - value: FailedToTransactAsset diff --git a/parachains/pallets/bridge-transfer/src/benchmarking.rs b/parachains/pallets/bridge-transfer/src/benchmarking.rs index 15adcb2fc42..08a9672fe4d 100644 --- a/parachains/pallets/bridge-transfer/src/benchmarking.rs +++ b/parachains/pallets/bridge-transfer/src/benchmarking.rs @@ -64,7 +64,8 @@ benchmarks! { // we don't care about message hash or sender cost here, just check that the transfer has been initiated let actual_event = frame_system::Pallet::::events().pop().map(|r| r.event); let expected_event: ::RuntimeEvent = Event::TransferInitiated { - message_hash: Default::default(), + message_id: Default::default(), + forwarded_message_id: Default::default(), sender_cost: Default::default(), }.into(); assert!(matches!(actual_event, Some(expected_event))); @@ -93,7 +94,8 @@ benchmarks! { // we don't care about message hash or sender cost here, just check that the transfer has been initiated let actual_event = frame_system::Pallet::::events().pop().map(|r| r.event); let expected_event: ::RuntimeEvent = Event::TransferInitiated { - message_hash: Default::default(), + message_id: Default::default(), + forwarded_message_id: Default::default(), sender_cost: Default::default(), }.into(); assert!(matches!(actual_event, Some(expected_event))); diff --git a/parachains/pallets/bridge-transfer/src/lib.rs b/parachains/pallets/bridge-transfer/src/lib.rs index f5488e8ba74..4ad8ef11cbb 100644 --- a/parachains/pallets/bridge-transfer/src/lib.rs +++ b/parachains/pallets/bridge-transfer/src/lib.rs @@ -66,7 +66,7 @@ pub mod impls; pub mod weights; /// The log target of this pallet. -pub const LOG_TARGET: &str = "runtime::bridge-assets-transfer"; +pub const LOG_TARGET: &str = "runtime::bridge-transfer"; #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] pub struct BridgeConfig { @@ -117,7 +117,7 @@ pub mod pallet { use super::*; use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; + use frame_system::{pallet_prelude::*, unique}; use xcm_executor::traits::TransactAsset; #[pallet::pallet] @@ -268,7 +268,14 @@ pub mod pallet { #[pallet::generate_deposit(pub (super) fn deposit_event)] pub enum Event { /// Transfer was successfully entered to the system (does not mean already delivered) - TransferInitiated { message_hash: XcmHash, sender_cost: MultiAssets }, + TransferInitiated { + /// `XcmHash` from `XcmContext` which is used for `AssetTransactor` processing and is related to the original message constructed here + message_id: XcmHash, + /// `XcmHash` from `SendXcm` (which is used for `ExportMessage` envelope) + forwarded_message_id: XcmHash, + /// `SendXcm` cost + sender_cost: MultiAssets, + }, /// Reserve asset passed ReserveAssetsDeposited { from: MultiLocation, to: MultiLocation, assets: MultiAssets }, @@ -358,7 +365,8 @@ pub mod pallet { .ok_or(Error::::UnsupportedPing)?; // Initiate bridge transfer - Self::initiate_bridge_transfer(allowed_target_location, xcm).map_err(Into::into) + Self::initiate_bridge_transfer(allowed_target_location, unique(&xcm), xcm) + .map_err(Into::into) } /// Adds new bridge configuration, which allows transfer to this `bridged_network`. @@ -612,10 +620,21 @@ pub mod pallet { assets: MultiAssets, bridge_config: BridgeConfig, ) -> Result<(), DispatchError> { - // Resolve reserve account as sovereign account of bridge - let reserve_account = bridge_config.bridge_location; + // Resolve reserve account + let reserve_account = + Self::resolve_reserve_account(&bridge_config, &remote_destination); - let allowed_target_location = bridge_config.allowed_target_location; + // Resolve target destination + let target_destination = bridge_config.allowed_target_location; + + // UniversalLocation as sovereign account location on target_location (as target_location sees UniversalLocation) + let universal_location_as_sovereign_account_on_target_location = + T::UniversalLocation::get() + .invert_target(&target_destination) + .map_err(|_| Error::::InvalidConfiguration)?; + + // Prepare some XcmContext + let xcm_context = XcmContext::with_message_id(unique(reserve_account)); // lets try to do a reserve for all assets let mut reserved_assets = xcm_executor::Assets::new(); @@ -632,9 +651,7 @@ pub mod pallet { &asset, &origin_location, &reserve_account, - // We aren't able to track the XCM that initiated the fee deposit, so we create a - // fake message hash here - &XcmContext::with_message_hash([0; 32]), + &xcm_context, ) .and_then(|reserved_asset| { Self::deposit_event(Event::ReserveAssetsDeposited { @@ -659,54 +676,86 @@ pub mod pallet { } // Prepare `ReserveAssetDeposited` msg to bridge to the other side. + // Reanchor stuff - we need to convert local asset id/MultiLocation to format that could be understood by different consensus and from their point-of-view - reserved_assets.reanchor(&allowed_target_location, T::UniversalLocation::get(), None); + reserved_assets.reanchor(&target_destination, T::UniversalLocation::get(), None); let remote_destination = remote_destination - .reanchored(&allowed_target_location, T::UniversalLocation::get()) + .reanchored(&target_destination, T::UniversalLocation::get()) .map_err(|errored_dest| { log::error!( target: LOG_TARGET, - "Failed to reanchor remote_destination: {:?} for allowed_target_location: {:?} and universal_location: {:?}", + "Failed to reanchor remote_destination: {:?} for target_destination: {:?} and universal_location: {:?}", errored_dest, - allowed_target_location, + target_destination, T::UniversalLocation::get() ); Error::::InvalidRemoteDestination })?; - // prepare xcm message (maybe_paid + ReserveAssetDeposited stuff) - let mut xcm_instructions = match bridge_config.max_target_location_fee { - Some(target_location_fee) => sp_std::vec![ - WithdrawAsset(target_location_fee.clone().into()), - BuyExecution { fees: target_location_fee, weight_limit: Unlimited }, - ], - None => + // prepare xcm message + // 1. buy execution (if needed) -> (we expect UniversalLocation's sovereign account should pay) + let (mut xcm_instructions, maybe_buy_execution) = match bridge_config + .max_target_location_fee + { + Some(target_location_fee) => ( + sp_std::vec![ + WithdrawAsset(target_location_fee.clone().into()), + BuyExecution { fees: target_location_fee.clone(), weight_limit: Unlimited }, + ], + Some(target_location_fee), + ), + None => ( sp_std::vec![UnpaidExecution { check_origin: None, weight_limit: Unlimited }], + None, + ), }; + // 2. add deposit reserved asset to destination account xcm_instructions.extend(sp_std::vec![ ReserveAssetDeposited(reserved_assets.clone().into()), - ClearOrigin, DepositAsset { assets: MultiAssetFilter::from(MultiAssets::from(reserved_assets)), beneficiary: remote_destination - } + }, ]); + // 3. add return unspent weight/asset back to the UniversalLocation's sovereign account on target + if let Some(target_location_fee) = maybe_buy_execution { + xcm_instructions.extend(sp_std::vec![ + RefundSurplus, + DepositAsset { + assets: MultiAssetFilter::from(MultiAssets::from(target_location_fee)), + beneficiary: universal_location_as_sovereign_account_on_target_location + }, + ]); + } - Self::initiate_bridge_transfer(allowed_target_location, xcm_instructions.into()) - .map_err(Into::into) + Self::initiate_bridge_transfer( + target_destination, + xcm_context.message_id, + xcm_instructions.into(), + ) + .map_err(Into::into) } - fn initiate_bridge_transfer(dest: MultiLocation, xcm: Xcm<()>) -> Result<(), Error> { + fn initiate_bridge_transfer( + dest: MultiLocation, + message_id: XcmHash, + mut xcm: Xcm<()>, + ) -> Result<(), Error> { + // append message_id + xcm.0.extend(sp_std::vec![SetTopic(message_id.clone())]); + log::info!( target: LOG_TARGET, - "[T::BridgeXcmSender] send to bridge, dest: {:?}, xcm: {:?}", + "[T::BridgeXcmSender] send to bridge, dest: {:?}, xcm: {:?}, message_id: {:?}", dest, xcm, + message_id, ); + // call bridge // TODO: check-parameter - should we handle `sender_cost` somehow ? - let (message_hash, sender_cost) = - send_xcm::(dest, xcm).map_err(|e| { + let (forwarded_message_id, sender_cost) = send_xcm::(dest, xcm) + .map_err(|e| { log::error!( target: LOG_TARGET, "[T::BridgeXcmSender] SendError occurred, error: {:?}", @@ -716,9 +765,22 @@ pub mod pallet { })?; // just fire event - Self::deposit_event(Event::TransferInitiated { message_hash, sender_cost }); + Self::deposit_event(Event::TransferInitiated { + message_id, + forwarded_message_id, + sender_cost, + }); Ok(()) } + + /// Resolve (sovereign) account which will be used as reserve account + fn resolve_reserve_account( + bridge_conig: &BridgeConfig, + _remote_destination: &MultiLocation, + ) -> MultiLocation { + // lets start with target_location + bridge_conig.allowed_target_location.clone() + } } } @@ -741,8 +803,9 @@ pub(crate) mod tests { }; use sp_version::RuntimeVersion; use xcm_builder::{ - AccountId32Aliases, CurrencyAdapter, EnsureXcmOrigin, ExporterFor, IsConcrete, - SiblingParachainConvertsVia, SignedToAccountId32, UnpaidRemoteExporter, + AccountId32Aliases, CurrencyAdapter, EnsureXcmOrigin, ExporterFor, + GlobalConsensusParachainConvertsFor, IsConcrete, SiblingParachainConvertsVia, + SignedToAccountId32, UnpaidRemoteExporter, }; use xcm_executor::traits::Convert; @@ -819,7 +882,7 @@ pub(crate) mod tests { type MaxLocks = (); type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -913,6 +976,9 @@ pub(crate) mod tests { SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, + // Different global consensus parachain sovereign account. + // (Used for over-bridge transfers and reserve processing) + GlobalConsensusParachainConvertsFor, ); /// Means for transacting the native currency on this chain. @@ -1118,17 +1184,16 @@ pub(crate) mod tests { bridged_network, Box::new(test_bridge_config().1), )); - let bridge_location = AllowedExporters::::get(bridged_network) + let target_location = AllowedExporters::::get(bridged_network) .expect("stored BridgeConfig for bridged_network") - .bridge_location; + .allowed_target_location; // checks before assert!(ROUTED_MESSAGE.with(|r| r.borrow().is_none())); assert_eq!(Balances::free_balance(&user_account), user_account_init_balance); - let bridge_location_as_sovereign_account = - LocationToAccountId::convert_ref(bridge_location) - .expect("converted bridge location as accountId"); - assert_eq!(Balances::free_balance(&bridge_location_as_sovereign_account), 0); + let reserve_account = LocationToAccountId::convert_ref(target_location) + .expect("converted target_location as accountId"); + assert_eq!(Balances::free_balance(&reserve_account), 0); // trigger transfer_asset_via_bridge - should trigger new ROUTED_MESSAGE let asset = MultiAsset { @@ -1156,7 +1221,7 @@ pub(crate) mod tests { user_account_init_balance - balance_to_transfer ); // check reserve account increased - assert_eq!(Balances::free_balance(&bridge_location_as_sovereign_account), 15); + assert_eq!(Balances::free_balance(&reserve_account), 15); // check events let events = System::events(); @@ -1184,8 +1249,8 @@ pub(crate) mod tests { }) { assert!(xcm.0.iter().any(|instr| matches!(instr, UnpaidExecution { .. }))); assert!(xcm.0.iter().any(|instr| matches!(instr, ReserveAssetDeposited(..)))); - assert!(xcm.0.iter().any(|instr| matches!(instr, ClearOrigin))); assert!(xcm.0.iter().any(|instr| matches!(instr, DepositAsset { .. }))); + assert!(xcm.0.iter().any(|instr| matches!(instr, SetTopic { .. }))); } else { assert!(false, "Does not contains [`ExportMessage`], fired_xcm: {:?}", fired_xcm); } @@ -1221,19 +1286,17 @@ pub(crate) mod tests { }), )); - let bridge_location = AllowedExporters::::get(bridged_network) + let target_location = AllowedExporters::::get(bridged_network) .expect("stored BridgeConfig for bridged_network") - .bridge_location; + .allowed_target_location; // checks before assert!(ROUTED_MESSAGE.with(|r| r.borrow().is_none())); let user_balance_before = Balances::free_balance(&user_account); assert_eq!(user_balance_before, user_account_init_balance); - let bridge_location_as_sovereign_account = - LocationToAccountId::convert_ref(bridge_location) - .expect("converted bridge location as accountId"); - let reserve_account_before = - Balances::free_balance(&bridge_location_as_sovereign_account); + let reserve_account = LocationToAccountId::convert_ref(target_location) + .expect("converted target_location as accountId"); + let reserve_account_before = Balances::free_balance(&reserve_account); assert_eq!(reserve_account_before, 0); // trigger transfer_asset_via_bridge - should trigger new ROUTED_MESSAGE @@ -1269,10 +1332,7 @@ pub(crate) mod tests { // checks after // balances are untouched assert_eq!(Balances::free_balance(&user_account), user_balance_before); - assert_eq!( - Balances::free_balance(&bridge_location_as_sovereign_account), - reserve_account_before - ); + assert_eq!(Balances::free_balance(&reserve_account), reserve_account_before); // no xcm messages fired assert!(ROUTED_MESSAGE.with(|r| r.borrow().is_none())); // check events (no events because of rollback) diff --git a/parachains/pallets/parachain-info/Cargo.toml b/parachains/pallets/parachain-info/Cargo.toml index 7ff346fe24b..3fbccc215e0 100644 --- a/parachains/pallets/parachain-info/Cargo.toml +++ b/parachains/pallets/parachain-info/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/pallets/parachain-info/src/lib.rs b/parachains/pallets/parachain-info/src/lib.rs index d61387aaeb6..1910d6cf241 100644 --- a/parachains/pallets/parachain-info/src/lib.rs +++ b/parachains/pallets/parachain-info/src/lib.rs @@ -43,7 +43,6 @@ pub mod pallet { pub parachain_id: ParaId, } - #[cfg(feature = "std")] impl Default for GenesisConfig { fn default() -> Self { Self { parachain_id: 100.into() } @@ -53,7 +52,7 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - >::put(&self.parachain_id); + >::put(self.parachain_id); } } diff --git a/parachains/pallets/ping/Cargo.toml b/parachains/pallets/ping/Cargo.toml index b705a9a2f10..2af482598c2 100644 --- a/parachains/pallets/ping/Cargo.toml +++ b/parachains/pallets/ping/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/assets/common/Cargo.toml b/parachains/runtimes/assets/common/Cargo.toml index 303b0bd9c64..db9d5674dad 100644 --- a/parachains/runtimes/assets/common/Cargo.toml +++ b/parachains/runtimes/assets/common/Cargo.toml @@ -7,7 +7,7 @@ description = "Assets common utilities" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } # Substrate diff --git a/parachains/runtimes/assets/common/src/foreign_creators.rs b/parachains/runtimes/assets/common/src/foreign_creators.rs index 3d7567409f6..dbdf4301d66 100644 --- a/parachains/runtimes/assets/common/src/foreign_creators.rs +++ b/parachains/runtimes/assets/common/src/foreign_creators.rs @@ -43,7 +43,7 @@ where asset_location: &MultiLocation, ) -> sp_std::result::Result { let origin_location = EnsureXcm::::try_origin(origin.clone())?; - if !IsForeign::contains(&asset_location, &origin_location) { + if !IsForeign::contains(asset_location, &origin_location) { return Err(origin) } AccountOf::convert(origin_location).map_err(|_| origin) @@ -51,6 +51,6 @@ where #[cfg(feature = "runtime-benchmarks")] fn try_successful_origin(a: &MultiLocation) -> Result { - Ok(pallet_xcm::Origin::Xcm(a.clone()).into()) + Ok(pallet_xcm::Origin::Xcm(*a).into()) } } diff --git a/parachains/runtimes/assets/common/src/lib.rs b/parachains/runtimes/assets/common/src/lib.rs index 6e29623d7e4..8a321ad97aa 100644 --- a/parachains/runtimes/assets/common/src/lib.rs +++ b/parachains/runtimes/assets/common/src/lib.rs @@ -17,7 +17,6 @@ pub mod foreign_creators; pub mod fungible_conversion; -pub mod location_conversion; pub mod matching; pub mod runtime_api; diff --git a/parachains/runtimes/assets/common/src/location_conversion.rs b/parachains/runtimes/assets/common/src/location_conversion.rs deleted file mode 100644 index 50e06f27b20..00000000000 --- a/parachains/runtimes/assets/common/src/location_conversion.rs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (C) 2023 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:check-parameter - is it worth to move it to the [`xcm-builder -> location_conversion.rs`]? - -use codec::Encode; -use frame_support::sp_io::hashing::blake2_256; -use sp_std::{borrow::Borrow, marker::PhantomData}; -use xcm::prelude::*; -use xcm_executor::traits::Convert; - -/// Tries to convert **foreign** global consensus parachain to accountId. -/// -/// **foreign** means `parents > 1` -/// -/// (E.g.: can be used for sovereign account conversion) -pub struct GlobalConsensusParachainConvert(PhantomData); - -impl + Clone> Convert - for GlobalConsensusParachainConvert -{ - fn convert_ref(location: impl Borrow) -> Result { - match location.borrow() { - MultiLocation { - parents, - interior: X2(GlobalConsensus(network), Parachain(para_id)), - } if parents > &1_u8 => - Ok(AccountId::from(GlobalConsensusParachainConvert::::from_params( - network, para_id, *parents, - ))), - _ => Err(()), - } - } - - fn reverse_ref(_: impl Borrow) -> Result { - // if this will be needed, we could implement some kind of guessing, if we have configuration for supported foreign networkId+paraId - Err(()) - } -} - -impl GlobalConsensusParachainConvert { - fn from_params(network: &NetworkId, para_id: &u32, parents: u8) -> [u8; 32] { - (network, para_id, parents).using_encoded(blake2_256) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn global_consensus_parachain_convert_works() { - let test_data = vec![ - ( - MultiLocation::new(0, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), - false, - ), - ( - MultiLocation::new(1, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), - false, - ), - ( - MultiLocation::new( - 2, - X3( - GlobalConsensus(ByGenesis([0; 32])), - Parachain(1000), - AccountId32 { network: None, id: [1; 32].into() }, - ), - ), - false, - ), - (MultiLocation::new(2, X1(GlobalConsensus(ByGenesis([0; 32])))), false), - (MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), true), - (MultiLocation::new(3, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), true), - (MultiLocation::new(4, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), true), - ( - MultiLocation::new(10, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), - true, - ), - ]; - - for (location, expected_result) in test_data { - let result = GlobalConsensusParachainConvert::<[u8; 32]>::convert_ref(&location); - match result { - Ok(account) => { - assert_eq!( - true, expected_result, - "expected_result: {}, but conversion passed: {:?}, location: {:?}", - expected_result, account, location - ); - match &location { - MultiLocation { parents, interior: X2(GlobalConsensus(network), Parachain(para_id)) } => - assert_eq!( - account, - GlobalConsensusParachainConvert::<[u8; 32]>::from_params(network, para_id, *parents), - "expected_result: {}, but conversion passed: {:?}, location: {:?}", expected_result, account, location - ), - _ => assert_eq!( - true, - expected_result, - "expected_result: {}, conversion passed: {:?}, but MultiLocation does not match expected pattern, location: {:?}", expected_result, account, location - ) - } - }, - Err(_) => { - assert_eq!( - false, expected_result, - "expected_result: {} - but conversion failed, location: {:?}", - expected_result, location - ); - }, - } - } - - // all success - let res_2_1000 = GlobalConsensusParachainConvert::<[u8; 32]>::convert_ref( - MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), - ) - .expect("conversion is ok"); - let res_2_1001 = GlobalConsensusParachainConvert::<[u8; 32]>::convert_ref( - MultiLocation::new(2, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1001))), - ) - .expect("conversion is ok"); - let res_3_1000 = GlobalConsensusParachainConvert::<[u8; 32]>::convert_ref( - MultiLocation::new(3, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1000))), - ) - .expect("conversion is ok"); - let res_3_1001 = GlobalConsensusParachainConvert::<[u8; 32]>::convert_ref( - MultiLocation::new(3, X2(GlobalConsensus(ByGenesis([0; 32])), Parachain(1001))), - ) - .expect("conversion is ok"); - assert_ne!(res_2_1000, res_2_1001); - assert_ne!(res_2_1000, res_3_1000); - assert_ne!(res_2_1000, res_3_1001); - assert_ne!(res_2_1001, res_3_1000); - assert_ne!(res_2_1001, res_3_1001); - assert_ne!(res_3_1000, res_3_1001); - } -} diff --git a/parachains/runtimes/assets/common/src/matching.rs b/parachains/runtimes/assets/common/src/matching.rs index 00793b65e67..ea6ae888e48 100644 --- a/parachains/runtimes/assets/common/src/matching.rs +++ b/parachains/runtimes/assets/common/src/matching.rs @@ -42,10 +42,7 @@ impl> Contains for StartsWithExplicitGlobalConsensus { fn contains(t: &MultiLocation) -> bool { - match t.interior.global_consensus() { - Ok(requested_network) if requested_network.eq(&Network::get()) => true, - _ => false, - } + matches!(t.interior.global_consensus(), Ok(requested_network) if requested_network.eq(&Network::get())) } } @@ -61,7 +58,7 @@ impl> ContainsPair bool { log::trace!(target: "xcm::contains", "IsForeignConcreteAsset asset: {:?}, origin: {:?}", asset, origin); - matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, &origin)) + matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, origin)) } } @@ -73,18 +70,14 @@ impl> ContainsPair { fn contains(&a: &MultiLocation, b: &MultiLocation) -> bool { // `a` needs to be from `b` at least - if !a.starts_with(&b) { + if !a.starts_with(b) { return false } // here we check if sibling match a { - MultiLocation { parents: 1, interior } => match interior.first() { - Some(Parachain(sibling_para_id)) - if sibling_para_id.ne(&u32::from(SelfParaId::get())) => - true, - _ => false, - }, + MultiLocation { parents: 1, interior } => + matches!(interior.first(), Some(Parachain(sibling_para_id)) if sibling_para_id.ne(&u32::from(SelfParaId::get()))), _ => false, } } diff --git a/parachains/runtimes/assets/statemine/Cargo.toml b/parachains/runtimes/assets/statemine/Cargo.toml index f4682c2f0c2..fe56ac17f82 100644 --- a/parachains/runtimes/assets/statemine/Cargo.toml +++ b/parachains/runtimes/assets/statemine/Cargo.toml @@ -9,7 +9,7 @@ description = "Kusama variant of Statemint parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate @@ -111,6 +111,7 @@ runtime-benchmarks = [ "xcm-builder/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "pallet-xcm-benchmarks/runtime-benchmarks", diff --git a/parachains/runtimes/assets/statemine/src/lib.rs b/parachains/runtimes/assets/statemine/src/lib.rs index cda2400203f..1255b326909 100644 --- a/parachains/runtimes/assets/statemine/src/lib.rs +++ b/parachains/runtimes/assets/statemine/src/lib.rs @@ -99,7 +99,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("statemine"), impl_name: create_runtime_str!("statemine"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 13, @@ -112,7 +112,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("statemine"), impl_name: create_runtime_str!("statemine"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 13, @@ -207,7 +207,7 @@ impl pallet_balances::Config for Runtime { type WeightInfo = weights::pallet_balances::WeightInfo; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -215,7 +215,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -700,10 +700,8 @@ impl pallet_bridge_transfer::Config for Runtime { type UniversalLocation = UniversalLocation; type WeightInfo = weights::pallet_bridge_transfer::WeightInfo; type AdminOrigin = AssetsForceOrigin; - // one for ethereum - type UniversalAliasesLimit = ConstU32<1>; - // one for ethereum native tokens. - type ReserveLocationsLimit = ConstU32<1>; + type UniversalAliasesLimit = ConstU32<24>; + type ReserveLocationsLimit = ConstU32<8>; type AssetTransactor = AssetTransactors; type BridgeXcmSender = BridgeXcmSender; type TransferAssetOrigin = EnsureXcmOrigin; @@ -790,7 +788,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (); +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -1049,7 +1047,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -1085,7 +1083,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -1105,7 +1102,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( KsmLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; @@ -1120,7 +1117,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(KsmLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } @@ -1137,7 +1134,15 @@ impl_runtime_apis! { } fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { - Err(BenchmarkError::Skip) + match <::BenchmarkHelper as pallet_bridge_transfer::BenchmarkHelper>::universal_alias() { + Some((location, junction)) => { + >::insert_universal_alias_for_benchmarks( + (location.clone().try_into().unwrap(), junction) + ); + Ok((location.clone().try_into().unwrap(), junction)) + }, + None => Err(BenchmarkError::Skip) + } } fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { @@ -1224,7 +1229,7 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(feature = "state-trie-version-1")] parameter_types! { // The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high) - pub const MigrationSignedDepositPerItem: Balance = 1 * CENTS; + pub const MigrationSignedDepositPerItem: Balance = CENTS; pub const MigrationSignedDepositBase: Balance = 2_000 * CENTS; pub const MigrationMaxKeyLen: u32 = 512; } diff --git a/parachains/runtimes/assets/statemine/src/weights/cumulus_pallet_xcmp_queue.rs b/parachains/runtimes/assets/statemine/src/weights/cumulus_pallet_xcmp_queue.rs index 5cad45cc0b0..b19f8098775 100644 --- a/parachains/runtimes/assets/statemine/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/parachains/runtimes/assets/statemine/src/weights/cumulus_pallet_xcmp_queue.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_483_000 picoseconds. - Weight::from_parts(5_808_000, 0) + // Minimum execution time: 5_800_000 picoseconds. + Weight::from_parts(5_998_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_773_000 picoseconds. - Weight::from_parts(5_913_000, 0) + // Minimum execution time: 5_975_000 picoseconds. + Weight::from_parts(6_136_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/assets/statemine/src/weights/frame_system.rs b/parachains/runtimes/assets/statemine/src/weights/frame_system.rs index 4f0967e636d..89098f48120 100644 --- a/parachains/runtimes/assets/statemine/src/weights/frame_system.rs +++ b/parachains/runtimes/assets/statemine/src/weights/frame_system.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `frame_system`. pub struct WeightInfo(PhantomData); @@ -52,22 +53,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_146_000 picoseconds. - Weight::from_parts(2_194_000, 0) + // Minimum execution time: 2_296_000 picoseconds. + Weight::from_parts(2_354_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(368, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(365, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_732_000 picoseconds. - Weight::from_parts(8_001_000, 0) + // Minimum execution time: 7_949_000 picoseconds. + Weight::from_parts(8_091_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_403, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_397, 0).saturating_mul(b.into())) + } + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -77,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_287_000 picoseconds. - Weight::from_parts(4_602_000, 0) + // Minimum execution time: 4_344_000 picoseconds. + Weight::from_parts(4_499_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -90,11 +94,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_319_000 picoseconds. - Weight::from_parts(2_401_000, 0) + // Minimum execution time: 2_562_000 picoseconds. + Weight::from_parts(2_599_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_933 - .saturating_add(Weight::from_parts(669_111, 0).saturating_mul(i.into())) + // Standard Error: 1_882 + .saturating_add(Weight::from_parts(660_746, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -104,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_381_000 picoseconds. - Weight::from_parts(2_405_000, 0) + // Minimum execution time: 2_423_000 picoseconds. + Weight::from_parts(2_466_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 779 - .saturating_add(Weight::from_parts(492_780, 0).saturating_mul(i.into())) + // Standard Error: 775 + .saturating_add(Weight::from_parts(486_467, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -117,12 +121,12 @@ impl frame_system::WeightInfo for WeightInfo { fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `84 + p * (69 ±0)` - // Estimated: `75 + p * (70 ±0)` - // Minimum execution time: 4_204_000 picoseconds. - Weight::from_parts(4_269_000, 0) - .saturating_add(Weight::from_parts(0, 75)) - // Standard Error: 1_101 - .saturating_add(Weight::from_parts(1_014_807, 0).saturating_mul(p.into())) + // Estimated: `77 + p * (70 ±0)` + // Minimum execution time: 4_216_000 picoseconds. + Weight::from_parts(4_281_000, 0) + .saturating_add(Weight::from_parts(0, 77)) + // Standard Error: 953 + .saturating_add(Weight::from_parts(1_023_931, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs index 94957ff84fa..29a01e5bb9a 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs @@ -441,4 +441,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_balances.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_balances.rs index 2d3be9da403..3842783d98c 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_balances.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_balances.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 34_132_000 picoseconds. - Weight::from_parts(34_669_000, 0) + // Minimum execution time: 54_579_000 picoseconds. + Weight::from_parts(55_271_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 25_052_000 picoseconds. - Weight::from_parts(25_681_000, 0) + // Minimum execution time: 41_342_000 picoseconds. + Weight::from_parts(41_759_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,8 +78,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_072_000 picoseconds. - Weight::from_parts(15_451_000, 0) + // Minimum execution time: 16_403_000 picoseconds. + Weight::from_parts(16_651_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -89,8 +90,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 18_416_000 picoseconds. - Weight::from_parts(18_742_000, 0) + // Minimum execution time: 23_225_000 picoseconds. + Weight::from_parts(23_577_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +102,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 36_626_000 picoseconds. - Weight::from_parts(37_176_000, 0) + // Minimum execution time: 56_084_000 picoseconds. + Weight::from_parts(56_374_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -113,25 +114,38 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_008_000 picoseconds. - Weight::from_parts(31_562_000, 0) + // Minimum execution time: 50_374_000 picoseconds. + Weight::from_parts(52_040_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn upgrade_accounts(_: u32) -> Weight { - Weight::from_parts(0, 0) - } fn force_unreserve() -> Weight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_214_000 picoseconds. - Weight::from_parts(14_535_000, 0) + // Minimum execution time: 18_975_000 picoseconds. + Weight::from_parts(19_317_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// 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]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (136 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 18_579_000 picoseconds. + Weight::from_parts(18_668_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 9_111 + .saturating_add(Weight::from_parts(14_381_916, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_bridge_transfer.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_bridge_transfer.rs index 47a63b0eb36..bafff1fbf0c 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_bridge_transfer.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_bridge_transfer.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_bridge_transfer` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -41,9 +41,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_transfer`. pub struct WeightInfo(PhantomData); @@ -52,7 +53,13 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BridgeTransfer AllowedExporters (r:1 w:0) /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) - /// Storage: System Account (r:2 w:2) + /// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + /// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + /// 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:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) @@ -68,18 +75,20 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured) fn transfer_asset_via_bridge() -> Weight { // Proof Size summary in bytes: - // Measured: `477` - // Estimated: `25954` - // Minimum execution time: 126_493_000 picoseconds. - Weight::from_parts(127_684_000, 0) - .saturating_add(Weight::from_parts(0, 25954)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(5)) + // Measured: `750` + // Estimated: `6208` + // Minimum execution time: 155_987_000 picoseconds. + Weight::from_parts(156_876_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(8)) } /// Storage: ParachainInfo ParachainId (r:1 w:0) /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BridgeTransfer AllowedExporters (r:1 w:0) /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) + /// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + /// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -94,13 +103,13 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured) fn ping_via_bridge() -> Weight { // Proof Size summary in bytes: - // Measured: `337` - // Estimated: `18918` - // Minimum execution time: 57_858_000 picoseconds. - Weight::from_parts(59_418_000, 0) - .saturating_add(Weight::from_parts(0, 18918)) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `347` + // Estimated: `6002` + // Minimum execution time: 66_830_000 picoseconds. + Weight::from_parts(67_314_000, 0) + .saturating_add(Weight::from_parts(0, 6002)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: BridgeTransfer AllowedExporters (r:1 w:1) /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) @@ -109,10 +118,10 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< fn add_exporter_config() -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `7491` - // Minimum execution time: 16_403_000 picoseconds. - Weight::from_parts(16_675_000, 0) - .saturating_add(Weight::from_parts(0, 7491)) + // Estimated: `6002` + // Minimum execution time: 16_697_000 picoseconds. + Weight::from_parts(16_997_000, 0) + .saturating_add(Weight::from_parts(0, 6002)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -120,10 +129,10 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) fn remove_exporter_config() -> Weight { // Proof Size summary in bytes: - // Measured: `165` + // Measured: `175` // Estimated: `6002` - // Minimum execution time: 13_993_000 picoseconds. - Weight::from_parts(14_352_000, 0) + // Minimum execution time: 13_282_000 picoseconds. + Weight::from_parts(13_616_000, 0) .saturating_add(Weight::from_parts(0, 6002)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -132,44 +141,60 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) fn update_exporter_config() -> Weight { // Proof Size summary in bytes: - // Measured: `165` + // Measured: `175` // Estimated: `6002` - // Minimum execution time: 18_944_000 picoseconds. - Weight::from_parts(19_371_000, 0) + // Minimum execution time: 16_726_000 picoseconds. + Weight::from_parts(17_111_000, 0) .saturating_add(Weight::from_parts(0, 6002)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: BridgeTransfer AllowedUniversalAliases (r:1 w:1) + /// Proof: BridgeTransfer AllowedUniversalAliases (max_values: None, max_size: Some(2419), added: 4894, mode: MaxEncodedLen) fn add_universal_alias() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `109` + // Estimated: `5884` + // Minimum execution time: 12_078_000 picoseconds. + Weight::from_parts(12_421_000, 0) + .saturating_add(Weight::from_parts(0, 5884)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: BridgeTransfer AllowedUniversalAliases (r:1 w:1) + /// Proof: BridgeTransfer AllowedUniversalAliases (max_values: None, max_size: Some(2419), added: 4894, mode: MaxEncodedLen) fn remove_universal_alias() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `158` + // Estimated: `5884` + // Minimum execution time: 15_011_000 picoseconds. + Weight::from_parts(15_361_000, 0) + .saturating_add(Weight::from_parts(0, 5884)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: BridgeTransfer AllowedReserveLocations (r:1 w:1) + /// Proof: BridgeTransfer AllowedReserveLocations (max_values: Some(1), max_size: Some(4817), added: 5312, mode: MaxEncodedLen) fn add_reserve_location() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `109` + // Estimated: `6302` + // Minimum execution time: 11_927_000 picoseconds. + Weight::from_parts(12_308_000, 0) + .saturating_add(Weight::from_parts(0, 6302)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: BridgeTransfer AllowedReserveLocations (r:1 w:1) + /// Proof: BridgeTransfer AllowedReserveLocations (max_values: Some(1), max_size: Some(4817), added: 5312, mode: MaxEncodedLen) fn remove_reserve_location() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `141` + // Estimated: `6302` + // Minimum execution time: 14_002_000 picoseconds. + Weight::from_parts(14_406_000, 0) + .saturating_add(Weight::from_parts(0, 6302)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_collator_selection.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_collator_selection.rs index 6165f030031..7c518a45ddf 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_collator_selection.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_collator_selection` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collator_selection`. pub struct WeightInfo(PhantomData); @@ -56,11 +57,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `178 + b * (78 ±0)` // Estimated: `1168 + b * (2554 ±0)` - // Minimum execution time: 15_415_000 picoseconds. - Weight::from_parts(15_521_960, 0) + // Minimum execution time: 15_571_000 picoseconds. + Weight::from_parts(15_554_982, 0) .saturating_add(Weight::from_parts(0, 1168)) - // Standard Error: 3_294 - .saturating_add(Weight::from_parts(2_582_035, 0).saturating_mul(b.into())) + // Standard Error: 2_818 + .saturating_add(Weight::from_parts(2_610_335, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) @@ -71,8 +72,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_363_000 picoseconds. - Weight::from_parts(7_715_000, 0) + // Minimum execution time: 7_816_000 picoseconds. + Weight::from_parts(8_030_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,8 +83,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_516_000 picoseconds. - Weight::from_parts(7_860_000, 0) + // Minimum execution time: 8_077_000 picoseconds. + Weight::from_parts(8_293_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,12 +104,12 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn register_as_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1108 + c * (48 ±0)` - // Estimated: `61671 + c * (49 ±0)` - // Minimum execution time: 38_063_000 picoseconds. - Weight::from_parts(30_924_306, 0) - .saturating_add(Weight::from_parts(0, 61671)) - // Standard Error: 1_232 - .saturating_add(Weight::from_parts(106_039, 0).saturating_mul(c.into())) + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 43_072_000 picoseconds. + Weight::from_parts(35_712_990, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_261 + .saturating_add(Weight::from_parts(112_854, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) @@ -122,11 +123,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `452 + c * (48 ±0)` // Estimated: `49487` - // Minimum execution time: 29_598_000 picoseconds. - Weight::from_parts(19_372_924, 0) + // Minimum execution time: 35_372_000 picoseconds. + Weight::from_parts(26_886_289, 0) .saturating_add(Weight::from_parts(0, 49487)) - // Standard Error: 1_253 - .saturating_add(Weight::from_parts(106_394, 0).saturating_mul(c.into())) + // Standard Error: 1_388 + .saturating_add(Weight::from_parts(106_632, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,13 +140,46 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn note_author() -> Weight { // Proof Size summary in bytes: // Measured: `103` - // Estimated: `7729` - // Minimum execution time: 28_647_000 picoseconds. - Weight::from_parts(28_951_000, 0) - .saturating_add(Weight::from_parts(0, 7729)) + // Estimated: `6196` + // Minimum execution time: 44_209_000 picoseconds. + Weight::from_parts(44_590_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: CollatorSelection Candidates (r:1 w:0) /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(48002), added: 48497, mode: MaxEncodedLen) /// Storage: CollatorSelection LastAuthoredBlock (r:999 w:0) @@ -160,18 +194,18 @@ impl pallet_collator_selection::WeightInfo for WeightIn /// The range of component `c` is `[1, 1000]`. fn new_session(r: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `22721 + r * (116 ±0) + c * (97 ±0)` - // Estimated: `56697 + c * (2520 ±0) + r * (2602 ±0)` - // Minimum execution time: 17_043_000 picoseconds. - Weight::from_parts(17_352_000, 0) - .saturating_add(Weight::from_parts(0, 56697)) - // Standard Error: 798_735 - .saturating_add(Weight::from_parts(28_961_284, 0).saturating_mul(c.into())) + // Measured: `22721 + c * (97 ±0) + r * (116 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2602 ±0)` + // Minimum execution time: 17_397_000 picoseconds. + Weight::from_parts(17_600_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 897_810 + .saturating_add(Weight::from_parts(31_873_549, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 2602).saturating_mul(r.into())) } } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_multisig.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_multisig.rs index 2e5f4b322f0..2753cea0a8f 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_multisig.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_multisig.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); @@ -52,11 +53,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_992_000 picoseconds. - Weight::from_parts(12_412_280, 0) + // Minimum execution time: 12_303_000 picoseconds. + Weight::from_parts(12_695_362, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(503, 0).saturating_mul(z.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(557, 0).saturating_mul(z.into())) } /// Storage: Multisig Multisigs (r:1 w:1) /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3346), added: 5821, mode: MaxEncodedLen) @@ -66,13 +67,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `262 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 37_343_000 picoseconds. - Weight::from_parts(31_041_082, 0) + // Minimum execution time: 42_467_000 picoseconds. + Weight::from_parts(36_773_932, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 579 - .saturating_add(Weight::from_parts(68_564, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_253, 0).saturating_mul(z.into())) + // Standard Error: 459 + .saturating_add(Weight::from_parts(63_612, 0).saturating_mul(s.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_269, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -84,13 +85,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 27_702_000 picoseconds. - Weight::from_parts(22_324_758, 0) + // Minimum execution time: 28_843_000 picoseconds. + Weight::from_parts(23_142_157, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 382 - .saturating_add(Weight::from_parts(59_647, 0).saturating_mul(s.into())) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(z.into())) + // Standard Error: 229 + .saturating_add(Weight::from_parts(63_362, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_241, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,14 +104,14 @@ impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `385 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 42_944_000 picoseconds. - Weight::from_parts(35_467_441, 0) - .saturating_add(Weight::from_parts(0, 10404)) - // Standard Error: 600 - .saturating_add(Weight::from_parts(80_406, 0).saturating_mul(s.into())) + // Estimated: `6811` + // Minimum execution time: 48_265_000 picoseconds. + Weight::from_parts(40_503_415, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 528 + .saturating_add(Weight::from_parts(85_941, 0).saturating_mul(s.into())) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_220, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(1_281, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -121,11 +122,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 27_997_000 picoseconds. - Weight::from_parts(30_250_714, 0) + // Minimum execution time: 32_680_000 picoseconds. + Weight::from_parts(34_368_418, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 709 - .saturating_add(Weight::from_parts(67_226, 0).saturating_mul(s.into())) + // Standard Error: 558 + .saturating_add(Weight::from_parts(72_172, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -136,11 +137,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 19_821_000 picoseconds. - Weight::from_parts(20_670_152, 0) + // Minimum execution time: 19_571_000 picoseconds. + Weight::from_parts(20_887_762, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 470 - .saturating_add(Weight::from_parts(65_289, 0).saturating_mul(s.into())) + // Standard Error: 858 + .saturating_add(Weight::from_parts(64_869, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -151,11 +152,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 28_820_000 picoseconds. - Weight::from_parts(31_182_331, 0) + // Minimum execution time: 32_681_000 picoseconds. + Weight::from_parts(34_919_059, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 874 - .saturating_add(Weight::from_parts(68_617, 0).saturating_mul(s.into())) + // Standard Error: 613 + .saturating_add(Weight::from_parts(72_149, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_nfts.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_nfts.rs index 8c4425114b1..3655836b0a0 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_nfts.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_nfts.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_nfts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_nfts`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `145` - // Estimated: `5038` - // Minimum execution time: 34_100_000 picoseconds. - Weight::from_parts(34_649_000, 0) - .saturating_add(Weight::from_parts(0, 5038)) + // Estimated: `3549` + // Minimum execution time: 39_589_000 picoseconds. + Weight::from_parts(40_305_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -80,10 +81,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `5038` - // Minimum execution time: 22_415_000 picoseconds. - Weight::from_parts(22_808_000, 0) - .saturating_add(Weight::from_parts(0, 5038)) + // Estimated: `3549` + // Minimum execution time: 23_945_000 picoseconds. + Weight::from_parts(24_351_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -106,17 +107,15 @@ impl pallet_nfts::WeightInfo for WeightInfo { /// The range of component `m` is `[0, 1000]`. /// The range of component `c` is `[0, 1000]`. /// The range of component `a` is `[0, 1000]`. - fn destroy(m: u32, _c: u32, a: u32, ) -> Weight { + fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32170 + a * (366 ±0)` - // Estimated: `2538829 + a * (2954 ±0)` - // Minimum execution time: 978_514_000 picoseconds. - Weight::from_parts(915_478_956, 0) - .saturating_add(Weight::from_parts(0, 2538829)) - // Standard Error: 4_368 - .saturating_add(Weight::from_parts(3_621, 0).saturating_mul(m.into())) - // Standard Error: 4_368 - .saturating_add(Weight::from_parts(5_742_436, 0).saturating_mul(a.into())) + // Estimated: `2523990 + a * (2954 ±0)` + // Minimum execution time: 992_533_000 picoseconds. + Weight::from_parts(941_813_359, 0) + .saturating_add(Weight::from_parts(0, 2523990)) + // Standard Error: 3_954 + .saturating_add(Weight::from_parts(5_784_754, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(1004)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1005)) @@ -138,10 +137,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 44_509_000 picoseconds. - Weight::from_parts(45_090_000, 0) - .saturating_add(Weight::from_parts(0, 18460)) + // Estimated: `4326` + // Minimum execution time: 49_305_000 picoseconds. + Weight::from_parts(50_143_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -160,10 +159,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn force_mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 43_761_000 picoseconds. - Weight::from_parts(44_304_000, 0) - .saturating_add(Weight::from_parts(0, 18460)) + // Estimated: `4326` + // Minimum execution time: 48_627_000 picoseconds. + Weight::from_parts(48_954_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -186,10 +185,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `15200` - // Minimum execution time: 45_215_000 picoseconds. - Weight::from_parts(46_367_000, 0) - .saturating_add(Weight::from_parts(0, 15200)) + // Estimated: `4326` + // Minimum execution time: 49_958_000 picoseconds. + Weight::from_parts(50_387_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(7)) } @@ -210,10 +209,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `14926` - // Minimum execution time: 35_381_000 picoseconds. - Weight::from_parts(35_896_000, 0) - .saturating_add(Weight::from_parts(0, 14926)) + // Estimated: `4326` + // Minimum execution time: 36_267_000 picoseconds. + Weight::from_parts(36_712_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -227,12 +226,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `729 + i * (108 ±0)` - // Estimated: `8077 + i * (3336 ±0)` - // Minimum execution time: 16_621_000 picoseconds. - Weight::from_parts(16_839_000, 0) - .saturating_add(Weight::from_parts(0, 8077)) - // Standard Error: 13_184 - .saturating_add(Weight::from_parts(13_274_447, 0).saturating_mul(i.into())) + // Estimated: `3549 + i * (3336 ±0)` + // Minimum execution time: 17_738_000 picoseconds. + Weight::from_parts(17_801_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + // Standard Error: 13_596 + .saturating_add(Weight::from_parts(15_695_790, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -245,10 +244,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn lock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 20_314_000 picoseconds. - Weight::from_parts(20_726_000, 0) - .saturating_add(Weight::from_parts(0, 7047)) + // Estimated: `3534` + // Minimum execution time: 20_845_000 picoseconds. + Weight::from_parts(21_133_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -259,10 +258,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn unlock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 20_178_000 picoseconds. - Weight::from_parts(20_565_000, 0) - .saturating_add(Weight::from_parts(0, 7047)) + // Estimated: `3534` + // Minimum execution time: 20_862_000 picoseconds. + Weight::from_parts(21_105_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -273,10 +272,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn lock_collection() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 17_142_000 picoseconds. - Weight::from_parts(18_191_000, 0) - .saturating_add(Weight::from_parts(0, 7087)) + // Estimated: `3549` + // Minimum execution time: 18_196_000 picoseconds. + Weight::from_parts(18_333_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -289,10 +288,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `354` - // Estimated: `7066` - // Minimum execution time: 22_902_000 picoseconds. - Weight::from_parts(23_495_000, 0) - .saturating_add(Weight::from_parts(0, 7066)) + // Estimated: `3549` + // Minimum execution time: 24_025_000 picoseconds. + Weight::from_parts(24_277_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -303,10 +302,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_team() -> Weight { // Proof Size summary in bytes: // Measured: `335` - // Estimated: `9627` - // Minimum execution time: 41_436_000 picoseconds. - Weight::from_parts(41_922_000, 0) - .saturating_add(Weight::from_parts(0, 9627)) + // Estimated: `6078` + // Minimum execution time: 40_974_000 picoseconds. + Weight::from_parts(41_706_000, 0) + .saturating_add(Weight::from_parts(0, 6078)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -318,8 +317,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `277` // Estimated: `3549` - // Minimum execution time: 19_015_000 picoseconds. - Weight::from_parts(19_490_000, 0) + // Minimum execution time: 19_044_000 picoseconds. + Weight::from_parts(19_465_000, 0) .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(3)) @@ -332,8 +331,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `3549` - // Minimum execution time: 15_532_000 picoseconds. - Weight::from_parts(15_827_000, 0) + // Minimum execution time: 15_591_000 picoseconds. + Weight::from_parts(15_858_000, 0) .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -345,10 +344,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn lock_item_properties() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 21_022_000 picoseconds. - Weight::from_parts(21_289_000, 0) - .saturating_add(Weight::from_parts(0, 7047)) + // Estimated: `3534` + // Minimum execution time: 20_831_000 picoseconds. + Weight::from_parts(21_121_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -365,10 +364,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `18078` - // Minimum execution time: 47_283_000 picoseconds. - Weight::from_parts(47_793_000, 0) - .saturating_add(Weight::from_parts(0, 18078)) + // Estimated: `3944` + // Minimum execution time: 50_650_000 picoseconds. + Weight::from_parts(51_315_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -379,10 +378,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn force_set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `310` - // Estimated: `7493` - // Minimum execution time: 27_462_000 picoseconds. - Weight::from_parts(27_798_000, 0) - .saturating_add(Weight::from_parts(0, 7493)) + // Estimated: `3944` + // Minimum execution time: 28_244_000 picoseconds. + Weight::from_parts(28_627_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -397,10 +396,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `949` - // Estimated: `14540` - // Minimum execution time: 44_392_000 picoseconds. - Weight::from_parts(44_956_000, 0) - .saturating_add(Weight::from_parts(0, 14540)) + // Estimated: `3944` + // Minimum execution time: 47_299_000 picoseconds. + Weight::from_parts(47_921_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -411,10 +410,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn approve_item_attributes() -> Weight { // Proof Size summary in bytes: // Measured: `347` - // Estimated: `8792` - // Minimum execution time: 18_619_000 picoseconds. - Weight::from_parts(18_970_000, 0) - .saturating_add(Weight::from_parts(0, 8792)) + // Estimated: `4466` + // Minimum execution time: 19_400_000 picoseconds. + Weight::from_parts(19_601_000, 0) + .saturating_add(Weight::from_parts(0, 4466)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -430,12 +429,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn cancel_item_attributes_approval(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `726 + n * (398 ±0)` - // Estimated: `16329 + n * (2954 ±0)` - // Minimum execution time: 28_293_000 picoseconds. - Weight::from_parts(28_502_000, 0) - .saturating_add(Weight::from_parts(0, 16329)) - // Standard Error: 4_215 - .saturating_add(Weight::from_parts(5_601_603, 0).saturating_mul(n.into())) + // Estimated: `4466 + n * (2954 ±0)` + // Minimum execution time: 28_552_000 picoseconds. + Weight::from_parts(28_822_000, 0) + .saturating_add(Weight::from_parts(0, 4466)) + // Standard Error: 3_265 + .saturating_add(Weight::from_parts(5_570_824, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -455,10 +454,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `17946` - // Minimum execution time: 39_371_000 picoseconds. - Weight::from_parts(39_852_000, 0) - .saturating_add(Weight::from_parts(0, 17946)) + // Estimated: `3812` + // Minimum execution time: 42_425_000 picoseconds. + Weight::from_parts(42_883_000, 0) + .saturating_add(Weight::from_parts(0, 3812)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -473,10 +472,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `815` - // Estimated: `14408` - // Minimum execution time: 37_535_000 picoseconds. - Weight::from_parts(38_894_000, 0) - .saturating_add(Weight::from_parts(0, 14408)) + // Estimated: `3812` + // Minimum execution time: 40_219_000 picoseconds. + Weight::from_parts(41_709_000, 0) + .saturating_add(Weight::from_parts(0, 3812)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -491,10 +490,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `364` - // Estimated: `14380` - // Minimum execution time: 35_608_000 picoseconds. - Weight::from_parts(35_741_000, 0) - .saturating_add(Weight::from_parts(0, 14380)) + // Estimated: `3759` + // Minimum execution time: 39_376_000 picoseconds. + Weight::from_parts(39_895_000, 0) + .saturating_add(Weight::from_parts(0, 3759)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -509,10 +508,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `682` - // Estimated: `14380` - // Minimum execution time: 33_234_000 picoseconds. - Weight::from_parts(33_617_000, 0) - .saturating_add(Weight::from_parts(0, 14380)) + // Estimated: `3759` + // Minimum execution time: 38_414_000 picoseconds. + Weight::from_parts(38_627_000, 0) + .saturating_add(Weight::from_parts(0, 3759)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -523,10 +522,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `376` - // Estimated: `7864` - // Minimum execution time: 22_900_000 picoseconds. - Weight::from_parts(23_351_000, 0) - .saturating_add(Weight::from_parts(0, 7864)) + // Estimated: `4326` + // Minimum execution time: 22_896_000 picoseconds. + Weight::from_parts(23_137_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -536,8 +535,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 20_413_000 picoseconds. - Weight::from_parts(20_622_000, 0) + // Minimum execution time: 20_602_000 picoseconds. + Weight::from_parts(20_869_000, 0) .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -548,8 +547,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 19_132_000 picoseconds. - Weight::from_parts(19_443_000, 0) + // Minimum execution time: 19_415_000 picoseconds. + Weight::from_parts(19_594_000, 0) .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -560,8 +559,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3517` - // Minimum execution time: 16_661_000 picoseconds. - Weight::from_parts(16_925_000, 0) + // Minimum execution time: 16_784_000 picoseconds. + Weight::from_parts(17_133_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -573,10 +572,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 19_575_000 picoseconds. - Weight::from_parts(19_826_000, 0) - .saturating_add(Weight::from_parts(0, 7087)) + // Estimated: `3549` + // Minimum execution time: 20_391_000 picoseconds. + Weight::from_parts(20_710_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -587,10 +586,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn update_mint_settings() -> Weight { // Proof Size summary in bytes: // Measured: `289` - // Estimated: `7072` - // Minimum execution time: 19_749_000 picoseconds. - Weight::from_parts(19_902_000, 0) - .saturating_add(Weight::from_parts(0, 7072)) + // Estimated: `3538` + // Minimum execution time: 19_989_000 picoseconds. + Weight::from_parts(20_179_000, 0) + .saturating_add(Weight::from_parts(0, 3538)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -605,10 +604,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_price() -> Weight { // Proof Size summary in bytes: // Measured: `484` - // Estimated: `11377` - // Minimum execution time: 23_970_000 picoseconds. - Weight::from_parts(24_589_000, 0) - .saturating_add(Weight::from_parts(0, 11377)) + // Estimated: `4326` + // Minimum execution time: 24_308_000 picoseconds. + Weight::from_parts(24_721_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -629,10 +628,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `671` - // Estimated: `18480` - // Minimum execution time: 43_929_000 picoseconds. - Weight::from_parts(44_364_000, 0) - .saturating_add(Weight::from_parts(0, 18480)) + // Estimated: `4326` + // Minimum execution time: 45_626_000 picoseconds. + Weight::from_parts(46_030_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -641,11 +640,11 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_611_000 picoseconds. - Weight::from_parts(4_292_527, 0) + // Minimum execution time: 2_654_000 picoseconds. + Weight::from_parts(4_301_940, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 9_304 - .saturating_add(Weight::from_parts(3_636_886, 0).saturating_mul(n.into())) + // Standard Error: 9_223 + .saturating_add(Weight::from_parts(3_945_966, 0).saturating_mul(n.into())) } /// Storage: Nfts Item (r:2 w:0) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) @@ -655,8 +654,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `460` // Estimated: `7662` - // Minimum execution time: 22_643_000 picoseconds. - Weight::from_parts(22_957_000, 0) + // Minimum execution time: 23_071_000 picoseconds. + Weight::from_parts(23_535_000, 0) .saturating_add(Weight::from_parts(0, 7662)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -668,10 +667,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn cancel_swap() -> Weight { // Proof Size summary in bytes: // Measured: `479` - // Estimated: `7862` - // Minimum execution time: 21_037_000 picoseconds. - Weight::from_parts(21_359_000, 0) - .saturating_add(Weight::from_parts(0, 7862)) + // Estimated: `4326` + // Minimum execution time: 21_554_000 picoseconds. + Weight::from_parts(21_941_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -692,10 +691,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn claim_swap() -> Weight { // Proof Size summary in bytes: // Measured: `800` - // Estimated: `24321` - // Minimum execution time: 72_434_000 picoseconds. - Weight::from_parts(73_184_000, 0) - .saturating_add(Weight::from_parts(0, 24321)) + // Estimated: `7662` + // Minimum execution time: 74_272_000 picoseconds. + Weight::from_parts(75_374_000, 0) + .saturating_add(Weight::from_parts(0, 7662)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(10)) } @@ -721,12 +720,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn mint_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `29399 + n * (2954 ±0)` - // Minimum execution time: 125_554_000 picoseconds. - Weight::from_parts(129_631_978, 0) - .saturating_add(Weight::from_parts(0, 29399)) - // Standard Error: 20_858 - .saturating_add(Weight::from_parts(26_871_088, 0).saturating_mul(n.into())) + // Estimated: `6078 + n * (2954 ±0)` + // Minimum execution time: 133_545_000 picoseconds. + Weight::from_parts(137_797_962, 0) + .saturating_add(Weight::from_parts(0, 6078)) + // Standard Error: 33_124 + .saturating_add(Weight::from_parts(29_785_862, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(6)) @@ -749,12 +748,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_attributes_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `554` - // Estimated: `20462 + n * (2954 ±0)` - // Minimum execution time: 76_170_000 picoseconds. - Weight::from_parts(85_697_599, 0) - .saturating_add(Weight::from_parts(0, 20462)) - // Standard Error: 51_480 - .saturating_add(Weight::from_parts(26_398_485, 0).saturating_mul(n.into())) + // Estimated: `4466 + n * (2954 ±0)` + // Minimum execution time: 77_475_000 picoseconds. + Weight::from_parts(88_353_947, 0) + .saturating_add(Weight::from_parts(0, 4466)) + // Standard Error: 60_491 + .saturating_add(Weight::from_parts(29_507_037, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_proxy.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_proxy.rs index 9e97e9e982d..042af1203f5 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_proxy.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_proxy.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_proxy`. pub struct WeightInfo(PhantomData); @@ -54,11 +55,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 16_846_000 picoseconds. - Weight::from_parts(17_545_125, 0) + // Minimum execution time: 17_994_000 picoseconds. + Weight::from_parts(18_404_764, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_168 - .saturating_add(Weight::from_parts(38_590, 0).saturating_mul(p.into())) + // Standard Error: 931 + .saturating_add(Weight::from_parts(29_489, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: Proxy Proxies (r:1 w:0) @@ -72,14 +73,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn proxy_announced(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `454 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 35_646_000 picoseconds. - Weight::from_parts(35_944_816, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 1_868 - .saturating_add(Weight::from_parts(137_815, 0).saturating_mul(a.into())) - // Standard Error: 1_930 - .saturating_add(Weight::from_parts(38_331, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 39_788_000 picoseconds. + Weight::from_parts(39_231_218, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_373 + .saturating_add(Weight::from_parts(144_577, 0).saturating_mul(a.into())) + // Standard Error: 1_418 + .saturating_add(Weight::from_parts(39_464, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -92,14 +93,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn remove_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_142_000 picoseconds. - Weight::from_parts(23_269_000, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 1_365 - .saturating_add(Weight::from_parts(140_747, 0).saturating_mul(a.into())) - // Standard Error: 1_411 - .saturating_add(Weight::from_parts(14_983, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_778_000 picoseconds. + Weight::from_parts(26_117_943, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_161 + .saturating_add(Weight::from_parts(143_478, 0).saturating_mul(a.into())) + // Standard Error: 1_200 + .saturating_add(Weight::from_parts(8_492, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -112,14 +113,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_465_000 picoseconds. - Weight::from_parts(23_366_335, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 4_348 - .saturating_add(Weight::from_parts(149_266, 0).saturating_mul(a.into())) - // Standard Error: 4_492 - .saturating_add(Weight::from_parts(10_411, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_448_000 picoseconds. + Weight::from_parts(26_025_080, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_079 + .saturating_add(Weight::from_parts(146_383, 0).saturating_mul(a.into())) + // Standard Error: 1_115 + .saturating_add(Weight::from_parts(7_614, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -134,14 +135,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn announce(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `386 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 31_086_000 picoseconds. - Weight::from_parts(32_252_234, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 2_039 - .saturating_add(Weight::from_parts(131_541, 0).saturating_mul(a.into())) - // Standard Error: 2_107 - .saturating_add(Weight::from_parts(41_085, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 35_200_000 picoseconds. + Weight::from_parts(34_858_670, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_692 + .saturating_add(Weight::from_parts(148_578, 0).saturating_mul(a.into())) + // Standard Error: 1_748 + .saturating_add(Weight::from_parts(38_530, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -152,11 +153,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 24_040_000 picoseconds. - Weight::from_parts(24_914_869, 0) + // Minimum execution time: 26_373_000 picoseconds. + Weight::from_parts(27_005_379, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 2_025 - .saturating_add(Weight::from_parts(47_844, 0).saturating_mul(p.into())) + // Standard Error: 844 + .saturating_add(Weight::from_parts(58_125, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -167,11 +168,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_495_000 picoseconds. - Weight::from_parts(24_788_899, 0) + // Minimum execution time: 26_455_000 picoseconds. + Weight::from_parts(27_435_800, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_911 - .saturating_add(Weight::from_parts(68_917, 0).saturating_mul(p.into())) + // Standard Error: 1_489 + .saturating_add(Weight::from_parts(57_697, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -182,24 +183,26 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 19_269_000 picoseconds. - Weight::from_parts(20_040_655, 0) + // Minimum execution time: 23_169_000 picoseconds. + Weight::from_parts(23_866_116, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_327 - .saturating_add(Weight::from_parts(24_180, 0).saturating_mul(p.into())) + // Standard Error: 788 + .saturating_add(Weight::from_parts(25_795, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: Proxy Proxies (r:1 w:1) /// Proof: Proxy Proxies (max_values: None, max_size: Some(1241), added: 3716, mode: MaxEncodedLen) /// The range of component `p` is `[1, 31]`. - fn create_pure(_p: u32, ) -> Weight { + fn create_pure(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `139` // Estimated: `4706` - // Minimum execution time: 25_926_000 picoseconds. - Weight::from_parts(26_963_808, 0) + // Minimum execution time: 28_172_000 picoseconds. + Weight::from_parts(28_972_303, 0) .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 934 + .saturating_add(Weight::from_parts(10_208, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -210,11 +213,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `164 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 19_961_000 picoseconds. - Weight::from_parts(20_928_300, 0) + // Minimum execution time: 24_193_000 picoseconds. + Weight::from_parts(25_184_514, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_576 - .saturating_add(Weight::from_parts(28_604, 0).saturating_mul(p.into())) + // Standard Error: 3_667 + .saturating_add(Weight::from_parts(17_503, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_session.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_session.rs index 06d41c6383a..f0f02ace1eb 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_session.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_session.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `270` - // Estimated: `7470` - // Minimum execution time: 17_273_000 picoseconds. - Weight::from_parts(17_562_000, 0) - .saturating_add(Weight::from_parts(0, 7470)) + // Estimated: `3735` + // Minimum execution time: 17_623_000 picoseconds. + Weight::from_parts(17_946_000, 0) + .saturating_add(Weight::from_parts(0, 3735)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -68,10 +69,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `242` - // Estimated: `3949` - // Minimum execution time: 13_268_000 picoseconds. - Weight::from_parts(13_646_000, 0) - .saturating_add(Weight::from_parts(0, 3949)) + // Estimated: `3707` + // Minimum execution time: 13_059_000 picoseconds. + Weight::from_parts(13_341_000, 0) + .saturating_add(Weight::from_parts(0, 3707)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_timestamp.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_timestamp.rs index af27f018b00..8ddde440fdf 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_timestamp.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_timestamp.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_timestamp`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `86` - // Estimated: `2986` - // Minimum execution time: 9_234_000 picoseconds. - Weight::from_parts(9_578_000, 0) - .saturating_add(Weight::from_parts(0, 2986)) + // Estimated: `1493` + // Minimum execution time: 9_168_000 picoseconds. + Weight::from_parts(9_563_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +66,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `57` // Estimated: `0` - // Minimum execution time: 3_193_000 picoseconds. - Weight::from_parts(3_306_000, 0) + // Minimum execution time: 3_146_000 picoseconds. + Weight::from_parts(3_238_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_uniques.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_uniques.rs index 44846163ff0..80c1adfe5e6 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_uniques.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_uniques.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_uniques` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_uniques`. pub struct WeightInfo(PhantomData); @@ -55,8 +56,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `145` // Estimated: `3643` - // Minimum execution time: 25_977_000 picoseconds. - Weight::from_parts(27_109_000, 0) + // Minimum execution time: 31_630_000 picoseconds. + Weight::from_parts(32_135_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -69,8 +70,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3643` - // Minimum execution time: 14_712_000 picoseconds. - Weight::from_parts(15_150_000, 0) + // Minimum execution time: 15_573_000 picoseconds. + Weight::from_parts(15_971_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -96,17 +97,17 @@ impl pallet_uniques::WeightInfo for WeightInfo { /// The range of component `a` is `[0, 1000]`. fn destroy(n: u32, m: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `257 + n * (76 ±0) + m * (56 ±0) + a * (107 ±0)` - // Estimated: `9210 + n * (2597 ±0) + a * (2647 ±0) + m * (2662 ±0)` - // Minimum execution time: 2_367_187_000 picoseconds. - Weight::from_parts(2_382_789_000, 0) - .saturating_add(Weight::from_parts(0, 9210)) - // Standard Error: 24_652 - .saturating_add(Weight::from_parts(6_204_090, 0).saturating_mul(n.into())) - // Standard Error: 24_652 - .saturating_add(Weight::from_parts(246_468, 0).saturating_mul(m.into())) - // Standard Error: 24_652 - .saturating_add(Weight::from_parts(346_915, 0).saturating_mul(a.into())) + // Measured: `257 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)` + // Estimated: `3643 + a * (2647 ±0) + m * (2662 ±0) + n * (2597 ±0)` + // Minimum execution time: 2_397_568_000 picoseconds. + Weight::from_parts(2_408_280_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) + // Standard Error: 24_497 + .saturating_add(Weight::from_parts(6_425_310, 0).saturating_mul(n.into())) + // Standard Error: 24_497 + .saturating_add(Weight::from_parts(252_611, 0).saturating_mul(m.into())) + // Standard Error: 24_497 + .saturating_add(Weight::from_parts(313_131, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) @@ -115,9 +116,9 @@ impl pallet_uniques::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) - .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 2647).saturating_mul(a.into())) .saturating_add(Weight::from_parts(0, 2662).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) } /// Storage: Uniques Asset (r:1 w:1) /// Proof: Uniques Asset (max_values: None, max_size: Some(122), added: 2597, mode: MaxEncodedLen) @@ -130,10 +131,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `10719` - // Minimum execution time: 31_948_000 picoseconds. - Weight::from_parts(32_314_000, 0) - .saturating_add(Weight::from_parts(0, 10719)) + // Estimated: `3643` + // Minimum execution time: 37_233_000 picoseconds. + Weight::from_parts(37_731_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -148,10 +149,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 33_711_000 picoseconds. - Weight::from_parts(34_742_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 38_493_000 picoseconds. + Weight::from_parts(38_939_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -166,10 +167,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 26_609_000 picoseconds. - Weight::from_parts(27_130_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 28_125_000 picoseconds. + Weight::from_parts(28_354_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -181,12 +182,12 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `738 + i * (76 ±0)` - // Estimated: `4633 + i * (2597 ±0)` - // Minimum execution time: 15_463_000 picoseconds. - Weight::from_parts(15_625_000, 0) - .saturating_add(Weight::from_parts(0, 4633)) - // Standard Error: 12_996 - .saturating_add(Weight::from_parts(13_104_503, 0).saturating_mul(i.into())) + // Estimated: `3643 + i * (2597 ±0)` + // Minimum execution time: 16_016_000 picoseconds. + Weight::from_parts(16_298_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) + // Standard Error: 12_979 + .saturating_add(Weight::from_parts(15_665_767, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -200,10 +201,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 18_897_000 picoseconds. - Weight::from_parts(19_276_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 19_730_000 picoseconds. + Weight::from_parts(20_008_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -214,10 +215,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 18_883_000 picoseconds. - Weight::from_parts(19_526_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 19_683_000 picoseconds. + Weight::from_parts(20_096_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -227,8 +228,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 14_519_000 picoseconds. - Weight::from_parts(14_887_000, 0) + // Minimum execution time: 14_854_000 picoseconds. + Weight::from_parts(15_217_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -239,8 +240,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 14_172_000 picoseconds. - Weight::from_parts(14_395_000, 0) + // Minimum execution time: 14_659_000 picoseconds. + Weight::from_parts(15_072_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -254,10 +255,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `356` - // Estimated: `7160` - // Minimum execution time: 22_131_000 picoseconds. - Weight::from_parts(22_540_000, 0) - .saturating_add(Weight::from_parts(0, 7160)) + // Estimated: `3643` + // Minimum execution time: 23_412_000 picoseconds. + Weight::from_parts(23_634_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -267,8 +268,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 15_582_000 picoseconds. - Weight::from_parts(15_907_000, 0) + // Minimum execution time: 15_816_000 picoseconds. + Weight::from_parts(16_303_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -281,8 +282,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 17_915_000 picoseconds. - Weight::from_parts(18_190_000, 0) + // Minimum execution time: 18_056_000 picoseconds. + Weight::from_parts(18_315_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -296,10 +297,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `10932` - // Minimum execution time: 37_851_000 picoseconds. - Weight::from_parts(38_554_000, 0) - .saturating_add(Weight::from_parts(0, 10932)) + // Estimated: `3652` + // Minimum execution time: 41_560_000 picoseconds. + Weight::from_parts(41_962_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -312,10 +313,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `756` - // Estimated: `10932` - // Minimum execution time: 37_289_000 picoseconds. - Weight::from_parts(37_807_000, 0) - .saturating_add(Weight::from_parts(0, 10932)) + // Estimated: `3652` + // Minimum execution time: 40_334_000 picoseconds. + Weight::from_parts(40_590_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -326,10 +327,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `348` - // Estimated: `7295` - // Minimum execution time: 28_825_000 picoseconds. - Weight::from_parts(29_277_000, 0) - .saturating_add(Weight::from_parts(0, 7295)) + // Estimated: `3652` + // Minimum execution time: 33_142_000 picoseconds. + Weight::from_parts(33_683_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -340,10 +341,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `7295` - // Minimum execution time: 29_274_000 picoseconds. - Weight::from_parts(29_941_000, 0) - .saturating_add(Weight::from_parts(0, 7295)) + // Estimated: `3652` + // Minimum execution time: 32_918_000 picoseconds. + Weight::from_parts(33_270_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -354,10 +355,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `7275` - // Minimum execution time: 28_196_000 picoseconds. - Weight::from_parts(28_563_000, 0) - .saturating_add(Weight::from_parts(0, 7275)) + // Estimated: `3643` + // Minimum execution time: 33_736_000 picoseconds. + Weight::from_parts(34_148_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -368,10 +369,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `7275` - // Minimum execution time: 26_657_000 picoseconds. - Weight::from_parts(27_189_000, 0) - .saturating_add(Weight::from_parts(0, 7275)) + // Estimated: `3643` + // Minimum execution time: 31_648_000 picoseconds. + Weight::from_parts(32_074_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -382,10 +383,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 21_135_000 picoseconds. - Weight::from_parts(21_445_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 21_429_000 picoseconds. + Weight::from_parts(21_830_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -396,10 +397,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `461` - // Estimated: `7230` - // Minimum execution time: 20_803_000 picoseconds. - Weight::from_parts(21_249_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 21_317_000 picoseconds. + Weight::from_parts(21_565_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -409,8 +410,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3517` - // Minimum execution time: 16_421_000 picoseconds. - Weight::from_parts(16_940_000, 0) + // Minimum execution time: 17_070_000 picoseconds. + Weight::from_parts(17_433_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -422,10 +423,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `7132` - // Minimum execution time: 17_792_000 picoseconds. - Weight::from_parts(18_087_000, 0) - .saturating_add(Weight::from_parts(0, 7132)) + // Estimated: `3643` + // Minimum execution time: 17_943_000 picoseconds. + Weight::from_parts(18_307_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -437,8 +438,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `259` // Estimated: `3587` - // Minimum execution time: 17_036_000 picoseconds. - Weight::from_parts(17_365_000, 0) + // Minimum execution time: 17_872_000 picoseconds. + Weight::from_parts(18_029_000, 0) .saturating_add(Weight::from_parts(0, 3587)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -454,10 +455,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `540` - // Estimated: `10784` - // Minimum execution time: 37_920_000 picoseconds. - Weight::from_parts(38_587_000, 0) - .saturating_add(Weight::from_parts(0, 10784)) + // Estimated: `3643` + // Minimum execution time: 39_380_000 picoseconds. + Weight::from_parts(40_347_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_utility.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_utility.rs index 25a8f1375d0..be360bb42b8 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_utility.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_utility.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_utility`. pub struct WeightInfo(PhantomData); @@ -52,18 +53,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_113_000 picoseconds. - Weight::from_parts(38_041_346, 0) + // Minimum execution time: 7_460_000 picoseconds. + Weight::from_parts(8_335_963, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 4_785 - .saturating_add(Weight::from_parts(4_680_352, 0).saturating_mul(c.into())) + // Standard Error: 3_566 + .saturating_add(Weight::from_parts(6_080_076, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_441_000 picoseconds. - Weight::from_parts(5_594_000, 0) + // Minimum execution time: 6_272_000 picoseconds. + Weight::from_parts(6_403_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -71,18 +72,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_203_000 picoseconds. - Weight::from_parts(18_311_542, 0) + // Minimum execution time: 7_570_000 picoseconds. + Weight::from_parts(18_080_572, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_281 - .saturating_add(Weight::from_parts(4_950_166, 0).saturating_mul(c.into())) + // Standard Error: 5_851 + .saturating_add(Weight::from_parts(6_351_469, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_631_000 picoseconds. - Weight::from_parts(9_881_000, 0) + // Minimum execution time: 10_413_000 picoseconds. + Weight::from_parts(10_584_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -90,10 +91,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_146_000 picoseconds. - Weight::from_parts(22_172_240, 0) + // Minimum execution time: 7_470_000 picoseconds. + Weight::from_parts(4_574_861, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_023 - .saturating_add(Weight::from_parts(4_688_391, 0).saturating_mul(c.into())) + // Standard Error: 3_330 + .saturating_add(Weight::from_parts(6_093_390, 0).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs index e2ff9a974b5..36672a02cd7 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn send() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `9780` - // Minimum execution time: 28_004_000 picoseconds. - Weight::from_parts(28_341_000, 0) - .saturating_add(Weight::from_parts(0, 9780)) + // Estimated: `3540` + // Minimum execution time: 29_342_000 picoseconds. + Weight::from_parts(29_952_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +74,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1489` - // Minimum execution time: 23_734_000 picoseconds. - Weight::from_parts(24_091_000, 0) + // Minimum execution time: 28_744_000 picoseconds. + Weight::from_parts(29_193_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -84,8 +85,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1489` - // Minimum execution time: 19_172_000 picoseconds. - Weight::from_parts(19_439_000, 0) + // Minimum execution time: 21_757_000 picoseconds. + Weight::from_parts(22_088_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -105,8 +106,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_181_000 picoseconds. - Weight::from_parts(10_441_000, 0) + // Minimum execution time: 10_671_000 picoseconds. + Weight::from_parts(10_948_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -116,8 +117,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_092_000 picoseconds. - Weight::from_parts(3_217_000, 0) + // Minimum execution time: 3_132_000 picoseconds. + Weight::from_parts(3_374_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -140,10 +141,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `14955` - // Minimum execution time: 36_167_000 picoseconds. - Weight::from_parts(37_036_000, 0) - .saturating_add(Weight::from_parts(0, 14955)) + // Estimated: `3540` + // Minimum execution time: 33_780_000 picoseconds. + Weight::from_parts(34_531_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -164,19 +165,21 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `257` - // Estimated: `14669` - // Minimum execution time: 39_341_000 picoseconds. - Weight::from_parts(40_254_000, 0) - .saturating_add(Weight::from_parts(0, 14669)) + // Estimated: `3722` + // Minimum execution time: 35_215_000 picoseconds. + Weight::from_parts(35_685_000, 0) + .saturating_add(Weight::from_parts(0, 3722)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) fn force_suspension() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_092_000 picoseconds. - Weight::from_parts(3_217_000, 0) + // Minimum execution time: 3_252_000 picoseconds. + Weight::from_parts(3_392_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -186,8 +189,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `129` // Estimated: `11019` - // Minimum execution time: 20_159_000 picoseconds. - Weight::from_parts(20_621_000, 0) + // Minimum execution time: 17_330_000 picoseconds. + Weight::from_parts(17_730_000, 0) .saturating_add(Weight::from_parts(0, 11019)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -198,8 +201,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `133` // Estimated: `11023` - // Minimum execution time: 20_095_000 picoseconds. - Weight::from_parts(20_335_000, 0) + // Minimum execution time: 17_129_000 picoseconds. + Weight::from_parts(17_665_000, 0) .saturating_add(Weight::from_parts(0, 11023)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -210,8 +213,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `140` // Estimated: `13505` - // Minimum execution time: 20_826_000 picoseconds. - Weight::from_parts(21_160_000, 0) + // Minimum execution time: 18_220_000 picoseconds. + Weight::from_parts(18_764_000, 0) .saturating_add(Weight::from_parts(0, 13505)) .saturating_add(T::DbWeight::get().reads(5)) } @@ -230,10 +233,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_current_targets() -> Weight { // Proof Size summary in bytes: // Measured: `142` - // Estimated: `16197` - // Minimum execution time: 38_595_000 picoseconds. - Weight::from_parts(39_178_000, 0) - .saturating_add(Weight::from_parts(0, 16197)) + // Estimated: `6082` + // Minimum execution time: 31_356_000 picoseconds. + Weight::from_parts(31_850_000, 0) + .saturating_add(Weight::from_parts(0, 6082)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -243,8 +246,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `172` // Estimated: `8587` - // Minimum execution time: 11_391_000 picoseconds. - Weight::from_parts(11_704_000, 0) + // Minimum execution time: 9_299_000 picoseconds. + Weight::from_parts(9_515_000, 0) .saturating_add(Weight::from_parts(0, 8587)) .saturating_add(T::DbWeight::get().reads(3)) } @@ -254,8 +257,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `140` // Estimated: `11030` - // Minimum execution time: 22_506_000 picoseconds. - Weight::from_parts(23_076_000, 0) + // Minimum execution time: 17_472_000 picoseconds. + Weight::from_parts(18_170_000, 0) .saturating_add(Weight::from_parts(0, 11030)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -275,10 +278,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: // Measured: `146` - // Estimated: `21171` - // Minimum execution time: 47_662_000 picoseconds. - Weight::from_parts(48_167_000, 0) - .saturating_add(Weight::from_parts(0, 21171)) + // Estimated: `11036` + // Minimum execution time: 39_134_000 picoseconds. + Weight::from_parts(39_847_000, 0) + .saturating_add(Weight::from_parts(0, 11036)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index 877a54ba848..c35e421cc24 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for StatemineXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for StatemineXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } @@ -215,7 +214,7 @@ impl XcmWeightInfo for StatemineXcmWeight { XcmGeneric::::clear_transact_status() } fn universal_origin(_: &Junction) -> Weight { - Weight::MAX + XcmGeneric::::universal_origin() } fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { Weight::MAX diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index d93dd65746b..8f802fb4211 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 @@ -54,8 +54,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 23_021_000 picoseconds. - Weight::from_parts(23_385_000, 3593) + // Minimum execution time: 27_006_000 picoseconds. + Weight::from_parts(27_426_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +65,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 33_451_000 picoseconds. - Weight::from_parts(33_779_000, 6196) + // Minimum execution time: 51_640_000 picoseconds. + Weight::from_parts(52_045_000, 6196) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -87,9 +87,9 @@ impl WeightInfo { pub fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `176` - // Estimated: `17970` - // Minimum execution time: 56_145_000 picoseconds. - Weight::from_parts(56_830_000, 17970) + // Estimated: `6196` + // Minimum execution time: 75_401_000 picoseconds. + Weight::from_parts(75_956_000, 6196) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -97,8 +97,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_315_000 picoseconds. - Weight::from_parts(4_448_000, 0) + // Minimum execution time: 4_767_000 picoseconds. + Weight::from_parts(4_848_000, 0) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -106,8 +106,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 25_505_000 picoseconds. - Weight::from_parts(25_697_000, 3593) + // Minimum execution time: 29_115_000 picoseconds. + Weight::from_parts(29_369_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -128,9 +128,9 @@ impl WeightInfo { pub fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `14862` - // Minimum execution time: 50_620_000 picoseconds. - Weight::from_parts(50_926_000, 14862) + // Estimated: `3593` + // Minimum execution time: 54_197_000 picoseconds. + Weight::from_parts(54_906_000, 3593) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -149,9 +149,9 @@ impl WeightInfo { pub fn initiate_teleport() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 31_700_000 picoseconds. - Weight::from_parts(32_178_000, 11269) + // Estimated: `3540` + // Minimum execution time: 33_366_000 picoseconds. + Weight::from_parts(33_874_000, 3540) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 058f23631dd..04adea50076 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -17,26 +17,27 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=statemine-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::generic -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=statemine-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -50,6 +51,8 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -63,18 +66,18 @@ impl WeightInfo { pub fn report_holding() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 367_337_000 picoseconds. - Weight::from_parts(368_530_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Estimated: `3540` + // Minimum execution time: 344_397_000 picoseconds. + Weight::from_parts(349_695_000, 3540) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn buy_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_121_000 picoseconds. - Weight::from_parts(4_318_000, 0) + // Minimum execution time: 3_726_000 picoseconds. + Weight::from_parts(3_944_000, 0) } // Storage: PolkadotXcm Queries (r:1 w:0) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) @@ -82,61 +85,63 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `69` // Estimated: `3534` - // Minimum execution time: 11_951_000 picoseconds. - Weight::from_parts(12_171_000, 3534) + // Minimum execution time: 10_846_000 picoseconds. + Weight::from_parts(11_114_000, 3534) .saturating_add(T::DbWeight::get().reads(1)) } pub fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_626_000 picoseconds. - Weight::from_parts(13_891_000, 0) + // Minimum execution time: 13_351_000 picoseconds. + Weight::from_parts(13_739_000, 0) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_276_000 picoseconds. - Weight::from_parts(4_444_000, 0) + // Minimum execution time: 3_954_000 picoseconds. + Weight::from_parts(4_148_000, 0) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_969_000 picoseconds. - Weight::from_parts(3_090_000, 0) + // Minimum execution time: 2_621_000 picoseconds. + Weight::from_parts(2_727_000, 0) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_148_000 picoseconds. - Weight::from_parts(3_252_000, 0) + // Minimum execution time: 2_570_000 picoseconds. + Weight::from_parts(2_661_000, 0) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_027_000 picoseconds. - Weight::from_parts(3_081_000, 0) + // Minimum execution time: 2_608_000 picoseconds. + Weight::from_parts(2_667_000, 0) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_863_000 picoseconds. - Weight::from_parts(3_934_000, 0) + // Minimum execution time: 3_508_000 picoseconds. + Weight::from_parts(3_596_000, 0) } pub fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_013_000 picoseconds. - Weight::from_parts(3_115_000, 0) + // Minimum execution time: 2_575_000 picoseconds. + Weight::from_parts(2_657_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -150,11 +155,11 @@ impl WeightInfo { pub fn report_error() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 25_963_000 picoseconds. - Weight::from_parts(26_428_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Estimated: `3540` + // Minimum execution time: 27_743_000 picoseconds. + Weight::from_parts(28_461_000, 3540) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } // Storage: PolkadotXcm AssetTraps (r:1 w:1) // Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured) @@ -162,8 +167,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `126` // Estimated: `3591` - // Minimum execution time: 16_492_000 picoseconds. - Weight::from_parts(16_930_000, 3591) + // Minimum execution time: 16_053_000 picoseconds. + Weight::from_parts(16_264_000, 3591) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -171,11 +176,13 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_004_000 picoseconds. - Weight::from_parts(3_070_000, 0) + // Minimum execution time: 2_572_000 picoseconds. + Weight::from_parts(2_633_000, 0) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -189,11 +196,11 @@ impl WeightInfo { pub fn subscribe_version() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `13320` - // Minimum execution time: 28_804_000 picoseconds. - Weight::from_parts(29_543_000, 13320) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) + // Estimated: `3540` + // Minimum execution time: 30_340_000 picoseconds. + Weight::from_parts(31_234_000, 3540) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) } // Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -201,12 +208,14 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_140_000 picoseconds. - Weight::from_parts(5_343_000, 0) + // Minimum execution time: 4_829_000 picoseconds. + Weight::from_parts(5_059_000, 0) .saturating_add(T::DbWeight::get().writes(1)) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -220,49 +229,51 @@ impl WeightInfo { pub fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 410_533_000 picoseconds. - Weight::from_parts(412_507_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Estimated: `3540` + // Minimum execution time: 387_501_000 picoseconds. + Weight::from_parts(390_773_000, 3540) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn burn_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 126_970_000 picoseconds. - Weight::from_parts(129_854_000, 0) + // Minimum execution time: 118_955_000 picoseconds. + Weight::from_parts(120_471_000, 0) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_585_000 picoseconds. - Weight::from_parts(13_852_000, 0) + // Minimum execution time: 11_763_000 picoseconds. + Weight::from_parts(11_902_000, 0) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_091_000 picoseconds. - Weight::from_parts(3_180_000, 0) + // Minimum execution time: 2_700_000 picoseconds. + Weight::from_parts(2_779_000, 0) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_982_000 picoseconds. - Weight::from_parts(3_060_000, 0) + // Minimum execution time: 2_609_000 picoseconds. + Weight::from_parts(2_664_000, 0) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_246_000 picoseconds. - Weight::from_parts(3_332_000, 0) + // Minimum execution time: 2_784_000 picoseconds. + Weight::from_parts(2_898_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -276,21 +287,23 @@ impl WeightInfo { pub fn query_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 29_939_000 picoseconds. - Weight::from_parts(30_426_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Estimated: `3540` + // Minimum execution time: 31_631_000 picoseconds. + Weight::from_parts(32_254_000, 3540) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn expect_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_477_000 picoseconds. - Weight::from_parts(5_585_000, 0) + // Minimum execution time: 5_333_000 picoseconds. + Weight::from_parts(10_284_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -304,45 +317,57 @@ impl WeightInfo { pub fn report_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 26_349_000 picoseconds. - Weight::from_parts(26_957_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Estimated: `3540` + // Minimum execution time: 28_696_000 picoseconds. + Weight::from_parts(42_937_000, 3540) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn clear_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_087_000 picoseconds. - Weight::from_parts(3_137_000, 0) + // Minimum execution time: 2_715_000 picoseconds. + Weight::from_parts(2_807_000, 0) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_047_000 picoseconds. - Weight::from_parts(3_111_000, 0) + // Minimum execution time: 2_661_000 picoseconds. + Weight::from_parts(2_723_000, 0) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_018_000 picoseconds. - Weight::from_parts(3_082_000, 0) + // Minimum execution time: 2_642_000 picoseconds. + Weight::from_parts(2_733_000, 0) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: BridgeTransfer AllowedUniversalAliases (r:1 w:0) + // Proof: BridgeTransfer AllowedUniversalAliases (max_values: None, max_size: Some(2419), added: 4894, mode: MaxEncodedLen) + pub fn universal_origin() -> Weight { + // Proof Size summary in bytes: + // Measured: `158` + // Estimated: `5884` + // Minimum execution time: 9_621_000 picoseconds. + Weight::from_parts(9_838_000, 5884) + .saturating_add(T::DbWeight::get().reads(2)) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_051_000 picoseconds. - Weight::from_parts(3_090_000, 0) + // Minimum execution time: 2_705_000 picoseconds. + Weight::from_parts(2_755_000, 0) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_140_000 picoseconds. - Weight::from_parts(3_274_000, 0) + // Minimum execution time: 2_842_000 picoseconds. + Weight::from_parts(2_920_000, 0) } } diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index 81a8347d79b..27597514657 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -19,30 +19,29 @@ use super::{ RuntimeOrigin, TrustBackedAssetsInstance, WeightToFee, XcmpQueue, }; use assets_common::matching::{ - FromSiblingParachain, IsForeignConcreteAsset, StartsWith, StartsWithExplicitGlobalConsensus, + FromSiblingParachain, IsDifferentGlobalConsensusConcreteAsset, IsForeignConcreteAsset, + StartsWith, StartsWithExplicitGlobalConsensus, }; use frame_support::{ match_types, parameter_types, traits::{ConstU32, Contains, Everything, Nothing, PalletInfoAccess}, }; use frame_system::EnsureRoot; +use pallet_bridge_transfer::impls::{AllowedUniversalAliasesOf, IsAllowedReserveOf}; use pallet_xcm::XcmPassthrough; -use parachains_common::{ - impls::ToStakingPot, - xcm_config::{ - AssetFeeAsExistentialDepositMultiplier, DenyReserveTransferToRelayChain, DenyThenTry, - }, -}; +use parachains_common::{impls::ToStakingPot, xcm_config::AssetFeeAsExistentialDepositMultiplier}; use polkadot_parachain::primitives::Sibling; use sp_runtime::traits::ConvertInto; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FungiblesAdapter, IsConcrete, LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, - ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UnpaidRemoteExporter, UsingComponents, WeightInfoBounds, WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, + DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FungiblesAdapter, + GlobalConsensusParachainConvertsFor, IsConcrete, LocalMint, NativeAsset, NoChecking, + ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UnpaidRemoteExporter, + UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -70,6 +69,9 @@ pub type LocationToAccountId = ( SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, + // Different global consensus parachain sovereign account. + // (Used for over-bridge transfers and reserve processing) + GlobalConsensusParachainConvertsFor, ); /// Means for transacting the native currency on this chain. @@ -112,9 +114,9 @@ pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConverte ( // Ignore `TrustBackedAssets` explicitly StartsWith, - // Ignore asset which starts explicitly with our `GlobalConsensus(NetworkId)`, means: - // - foreign assets from our consensus should be: `MultiLocation {parent: 1, X*(Parachain(xyz))} - // - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` wont be accepted here + // Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means: + // - foreign assets from our consensus should be: `MultiLocation {parents: 1, X*(Parachain(xyz), ..)}` + // - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't be accepted here StartsWithExplicitGlobalConsensus, ), Balance, @@ -197,175 +199,174 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::BridgeTransfer(..) | - RuntimeCall::Assets( - pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::ForeignAssets( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Assets( + pallet_assets::Call::create { .. } | + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::ForeignAssets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::set_metadata { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Nfts( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Nfts( pallet_nfts::Call::create { .. } | - pallet_nfts::Call::force_create { .. } | - pallet_nfts::Call::destroy { .. } | - pallet_nfts::Call::mint { .. } | - pallet_nfts::Call::force_mint { .. } | - pallet_nfts::Call::burn { .. } | - pallet_nfts::Call::transfer { .. } | - pallet_nfts::Call::lock_item_transfer { .. } | - pallet_nfts::Call::unlock_item_transfer { .. } | - pallet_nfts::Call::lock_collection { .. } | - pallet_nfts::Call::transfer_ownership { .. } | - pallet_nfts::Call::set_team { .. } | - pallet_nfts::Call::force_collection_owner { .. } | - pallet_nfts::Call::force_collection_config { .. } | - pallet_nfts::Call::approve_transfer { .. } | - pallet_nfts::Call::cancel_approval { .. } | - pallet_nfts::Call::clear_all_transfer_approvals { .. } | - pallet_nfts::Call::lock_item_properties { .. } | - pallet_nfts::Call::set_attribute { .. } | - pallet_nfts::Call::force_set_attribute { .. } | - pallet_nfts::Call::clear_attribute { .. } | - pallet_nfts::Call::approve_item_attributes { .. } | - pallet_nfts::Call::cancel_item_attributes_approval { .. } | - pallet_nfts::Call::set_metadata { .. } | - pallet_nfts::Call::clear_metadata { .. } | - pallet_nfts::Call::set_collection_metadata { .. } | - pallet_nfts::Call::clear_collection_metadata { .. } | - pallet_nfts::Call::set_accept_ownership { .. } | - pallet_nfts::Call::set_collection_max_supply { .. } | - pallet_nfts::Call::update_mint_settings { .. } | - pallet_nfts::Call::set_price { .. } | - pallet_nfts::Call::buy_item { .. } | - pallet_nfts::Call::pay_tips { .. } | - pallet_nfts::Call::create_swap { .. } | - pallet_nfts::Call::cancel_swap { .. } | - pallet_nfts::Call::claim_swap { .. }, - ) | - RuntimeCall::Uniques( + pallet_nfts::Call::force_create { .. } | + pallet_nfts::Call::destroy { .. } | + pallet_nfts::Call::mint { .. } | + pallet_nfts::Call::force_mint { .. } | + pallet_nfts::Call::burn { .. } | + pallet_nfts::Call::transfer { .. } | + pallet_nfts::Call::lock_item_transfer { .. } | + pallet_nfts::Call::unlock_item_transfer { .. } | + pallet_nfts::Call::lock_collection { .. } | + pallet_nfts::Call::transfer_ownership { .. } | + pallet_nfts::Call::set_team { .. } | + pallet_nfts::Call::force_collection_owner { .. } | + pallet_nfts::Call::force_collection_config { .. } | + pallet_nfts::Call::approve_transfer { .. } | + pallet_nfts::Call::cancel_approval { .. } | + pallet_nfts::Call::clear_all_transfer_approvals { .. } | + pallet_nfts::Call::lock_item_properties { .. } | + pallet_nfts::Call::set_attribute { .. } | + pallet_nfts::Call::force_set_attribute { .. } | + pallet_nfts::Call::clear_attribute { .. } | + pallet_nfts::Call::approve_item_attributes { .. } | + pallet_nfts::Call::cancel_item_attributes_approval { .. } | + pallet_nfts::Call::set_metadata { .. } | + pallet_nfts::Call::clear_metadata { .. } | + pallet_nfts::Call::set_collection_metadata { .. } | + pallet_nfts::Call::clear_collection_metadata { .. } | + pallet_nfts::Call::set_accept_ownership { .. } | + pallet_nfts::Call::set_collection_max_supply { .. } | + pallet_nfts::Call::update_mint_settings { .. } | + pallet_nfts::Call::set_price { .. } | + pallet_nfts::Call::buy_item { .. } | + pallet_nfts::Call::pay_tips { .. } | + pallet_nfts::Call::create_swap { .. } | + pallet_nfts::Call::cancel_swap { .. } | + pallet_nfts::Call::claim_swap { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. } + ) | RuntimeCall::BridgeTransfer(..) + ) } } -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - // Allow XCMs with some computed origins to pass through. - WithComputedOrigin< - ( - // If the message is one that immediately attemps to pay for execution, then allow it. - AllowTopLevelPaidExecutionFrom, - // Parent and its pluralities (i.e. governance bodies) get free execution. - AllowExplicitUnpaidExecutionFrom, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - ), - UniversalLocation, - ConstU32<8>, - >, - ), +pub type Barrier = TrailingSetTopicAsId< + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its pluralities (i.e. governance bodies) get free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, + ), + >, >; pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier< @@ -381,10 +382,12 @@ impl xcm_executor::Config for XcmConfig { type XcmSender = XcmRouter; type AssetTransactor = AssetTransactors; type OriginConverter = XcmOriginToTransactDispatchOrigin; - // Statemine does not recognize a reserve location for any asset. This does not prevent // Statemine acting _as_ a reserve location for KSM and assets created under `pallet-assets`. // For KSM, users must use teleport where allowed (e.g. with the Relay Chain). - type IsReserve = (); + type IsReserve = IsAllowedReserveOf< + Runtime, + IsDifferentGlobalConsensusConcreteAsset, + >; // We allow: // - teleportation of KSM // - teleportation of sibling parachain's assets (as ForeignCreators) @@ -423,7 +426,7 @@ impl xcm_executor::Config for XcmConfig { type AssetExchanger = (); type FeeManager = (); type MessageExporter = (); - type UniversalAliases = Nothing; + type UniversalAliases = AllowedUniversalAliasesOf; type CallDispatcher = WithOriginFilter; type SafeCallFilter = SafeCallFilter; } @@ -434,12 +437,12 @@ pub type LocalOriginToLocation = SignedToAccountId32, // ..and XCMP to communicate with the sibling chains. XcmpQueue, -); +)>; #[cfg(feature = "runtime-benchmarks")] parameter_types! { @@ -478,6 +481,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -494,9 +499,7 @@ pub type ForeignCreatorsSovereignAccountOf = ( /// Simple conversion of `u32` into an `AssetId` for use in benchmarking. pub struct XcmBenchmarkHelper; #[cfg(feature = "runtime-benchmarks")] -use pallet_assets::BenchmarkHelper; -#[cfg(feature = "runtime-benchmarks")] -impl BenchmarkHelper for XcmBenchmarkHelper { +impl pallet_assets::BenchmarkHelper for XcmBenchmarkHelper { fn create_asset_id_parameter(id: u32) -> MultiLocation { MultiLocation { parents: 1, interior: X1(Parachain(id)) } } @@ -516,6 +519,11 @@ impl BridgeTransferBenchmarksHelper { MultiLocation::new(2, X2(GlobalConsensus(Polkadot), Parachain(1000))) } + /// Max fee we are willing to pay on the bridged side + fn allowed_target_location_max_fee() -> Option { + Some((MultiLocation::parent(), 50_000_000_000_u128).into()) + } + /// Identifier of the sibling bridge-hub parachain. fn bridge_hub_para_id() -> u32 { 1002 @@ -534,11 +542,28 @@ impl pallet_bridge_transfer::BenchmarkHelper for BridgeTransferBe // this `None` with `Some(Self::make_asset(crate::ExistentialDeposit::get()))` bridge_location_fee: None, allowed_target_location: Self::allowed_target_location(), - max_target_location_fee: None, + max_target_location_fee: Self::allowed_target_location_max_fee(), }, )) } + fn universal_alias() -> Option<(xcm::VersionedMultiLocation, Junction)> { + Some(( + xcm::VersionedMultiLocation::V3(MultiLocation { + parents: 1, + interior: X1(Parachain(Self::bridge_hub_para_id())), + }), + GlobalConsensus(Polkadot), + )) + } + + fn reserve_location() -> Option { + Some(xcm::VersionedMultiLocation::V3(MultiLocation { + parents: 2, + interior: X2(GlobalConsensus(Polkadot), Parachain(1000)), + })) + } + fn prepare_asset_transfer( ) -> Option<(RuntimeOrigin, xcm::VersionedMultiAssets, xcm::VersionedMultiLocation)> { use frame_support::traits::Currency; diff --git a/parachains/runtimes/assets/statemine/tests/tests.rs b/parachains/runtimes/assets/statemine/tests/tests.rs index 079356a8658..cea7157b6c8 100644 --- a/parachains/runtimes/assets/statemine/tests/tests.rs +++ b/parachains/runtimes/assets/statemine/tests/tests.rs @@ -1,4 +1,4 @@ -use asset_test_utils::{ExtBuilder, RuntimeHelper}; +use asset_test_utils::{CollatorSessionKeys, ExtBuilder, RuntimeHelper}; use codec::{Decode, Encode}; use cumulus_primitives_utility::ChargeWeightInFungibles; use frame_support::{ @@ -24,11 +24,20 @@ use xcm::latest::prelude::*; use xcm_executor::traits::{Convert, Identity, JustTry, WeightTrader}; const ALICE: [u8; 32] = [1u8; 32]; +const BOB: [u8; 32] = [0u8; 32]; const SOME_ASSET_ADMIN: [u8; 32] = [5u8; 32]; type AssetIdForTrustBackedAssetsConvert = assets_common::AssetIdForTrustBackedAssetsConvert; +fn collator_session_keys() -> CollatorSessionKeys { + CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, + ) +} + #[test] fn test_asset_xcm_trader() { ExtBuilder::::default() @@ -80,19 +89,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -153,7 +159,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -227,7 +233,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -280,11 +286,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); @@ -419,7 +425,7 @@ fn test_assets_balances_api_works() { let foreign_asset_minimum_asset_balance = 3333333_u128; assert_ok!(ForeignAssets::force_create( RuntimeHelper::::root_origin(), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(SOME_ASSET_ADMIN).into(), false, foreign_asset_minimum_asset_balance @@ -428,7 +434,7 @@ fn test_assets_balances_api_works() { // We first mint enough asset for the account to exist for assets assert_ok!(ForeignAssets::mint( RuntimeHelper::::origin_of(AccountId::from(SOME_ASSET_ADMIN)), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(ALICE).into(), 6 * foreign_asset_minimum_asset_balance )); @@ -478,11 +484,7 @@ asset_test_utils::include_teleports_for_native_asset_works!( CheckingAccount, WeightToFee, ParachainSystem, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|runtime_event_encoded: Vec| { match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { @@ -507,11 +509,7 @@ asset_test_utils::include_teleports_for_foreign_assets_works!( ParachainSystem, ForeignCreatorsSovereignAccountOf, ForeignAssetsInstance, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|runtime_event_encoded: Vec| { match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { @@ -530,11 +528,7 @@ asset_test_utils::include_teleports_for_foreign_assets_works!( asset_test_utils::include_asset_transactor_transfer_with_local_consensus_currency_works!( Runtime, XcmConfig, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|| { assert!(Assets::asset_ids().collect::>().is_empty()); @@ -553,11 +547,7 @@ asset_test_utils::include_asset_transactor_transfer_with_pallet_assets_instance_ TrustBackedAssetsInstance, AssetIdForTrustBackedAssets, AssetIdForTrustBackedAssetsConvert, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), 12345, Box::new(|| { @@ -575,11 +565,7 @@ asset_test_utils::include_asset_transactor_transfer_with_pallet_assets_instance_ ForeignAssetsInstance, MultiLocation, JustTry, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), MultiLocation { parents: 1, interior: X2(Parachain(1313), GeneralIndex(12345)) }, Box::new(|| { @@ -598,11 +584,7 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p ForeignAssetsInstance, MultiLocation, JustTry, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), AssetDeposit::get(), MetadataDepositBase::get(), @@ -624,45 +606,83 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p }) ); -asset_test_utils::include_can_governance_change_bridge_transfer_out_configuration!( - Runtime, - XcmConfig, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - Box::new(|call| RuntimeCall::BridgeTransfer(call).encode()), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), - _ => None, - } - }) -); +#[test] +fn can_governance_change_bridge_transfer_out_configuration() { + asset_test_utils::test_cases::can_governance_change_bridge_transfer_out_configuration::< + Runtime, + XcmConfig, + >( + collator_session_keys(), + Box::new(|call| RuntimeCall::BridgeTransfer(call).encode()), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), + _ => None, + } + }), + ) +} -asset_test_utils::include_initiate_transfer_asset_via_bridge_for_native_asset_works!( - Runtime, - XcmConfig, - ParachainSystem, - XcmpQueue, - LocationToAccountId, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), +#[test] +fn initiate_transfer_asset_via_bridge_for_native_asset_works() { + asset_test_utils::test_cases::initiate_transfer_asset_via_bridge_for_native_asset_works::< + Runtime, + XcmConfig, + ParachainSystem, + XcmpQueue, + LocationToAccountId, + >( + collator_session_keys(), + ExistentialDeposit::get(), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - ExistentialDeposit::get(), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), - _ => None, - } - }), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), - _ => None, - } - }) -); + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + ) +} + +#[test] +fn can_governance_change_bridge_transfer_in_configuration() { + asset_test_utils::test_cases::can_governance_change_bridge_transfer_in_configuration::< + Runtime, + XcmConfig, + >( + collator_session_keys(), + Box::new(|call| RuntimeCall::BridgeTransfer(call).encode()), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), + _ => None, + } + }), + ) +} + +#[test] +fn receive_reserve_asset_deposited_from_different_consensus_works() { + asset_test_utils::test_cases::receive_reserve_asset_deposited_from_different_consensus_works::< + Runtime, + XcmConfig, + LocationToAccountId, + ForeignAssetsInstance, + >( + collator_session_keys(), + ExistentialDeposit::get(), + AccountId::from(BOB), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), + _ => None, + } + }), + ) +} diff --git a/parachains/runtimes/assets/statemint/Cargo.toml b/parachains/runtimes/assets/statemint/Cargo.toml index 837be9a2738..d5dd4fdf974 100644 --- a/parachains/runtimes/assets/statemint/Cargo.toml +++ b/parachains/runtimes/assets/statemint/Cargo.toml @@ -9,7 +9,7 @@ description = "Statemint parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate @@ -26,6 +26,8 @@ pallet-aura = { git = "https://github.com/paritytech/substrate", default-feature pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-nfts = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-nfts-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -90,6 +92,7 @@ runtime-benchmarks = [ "pallet-assets/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", + "pallet-nfts/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-uniques/runtime-benchmarks", @@ -119,6 +122,7 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-collator-selection/try-runtime", "pallet-multisig/try-runtime", + "pallet-nfts/try-runtime", "pallet-proxy/try-runtime", "pallet-session/try-runtime", "pallet-timestamp/try-runtime", @@ -142,6 +146,8 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-multisig/std", + "pallet-nfts/std", + "pallet-nfts-runtime-api/std", "pallet-proxy/std", "pallet-session/std", "pallet-timestamp/std", diff --git a/parachains/runtimes/assets/statemint/src/lib.rs b/parachains/runtimes/assets/statemint/src/lib.rs index aa90ca7a157..518fb3c4cab 100644 --- a/parachains/runtimes/assets/statemint/src/lib.rs +++ b/parachains/runtimes/assets/statemint/src/lib.rs @@ -57,12 +57,15 @@ pub mod constants; mod weights; pub mod xcm_config; +use assets_common::{ + foreign_creators::ForeignCreators, matching::FromSiblingParachain, MultiLocationForAssetId, +}; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto}, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; @@ -86,16 +89,17 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, EnsureSigned, }; +use pallet_nfts::PalletFeatures; pub use parachains_common as common; use parachains_common::{ impls::{AssetsToBlockAuthor, DealWithFees}, opaque, AccountId, AssetIdForTrustBackedAssets, Balance, BlockNumber, Hash, Header, Index, - Signature, StatemintAuraId as AuraId, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, - NORMAL_DISPATCH_RATIO, SLOT_DURATION, + Signature, StatemintAuraId as AuraId, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, + MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use xcm_config::{ - DotLocation, FellowshipLocation, GovernanceLocation, TrustBackedAssetsConvertedConcreteId, - XcmConfig, XcmOriginToTransactDispatchOrigin, + DotLocation, FellowshipLocation, ForeignAssetsConvertedConcreteId, GovernanceLocation, + TrustBackedAssetsConvertedConcreteId, XcmConfig, XcmOriginToTransactDispatchOrigin, }; #[cfg(any(feature = "std", test))] @@ -107,6 +111,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use xcm::latest::BodyId; use xcm_executor::XcmExecutor; +use crate::xcm_config::ForeignCreatorsSovereignAccountOf; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; impl_opaque_keys! { @@ -120,7 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("statemint"), impl_name: create_runtime_str!("statemint"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 13, @@ -215,7 +220,7 @@ impl pallet_balances::Config for Runtime { type WeightInfo = weights::pallet_balances::WeightInfo; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -223,7 +228,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -278,6 +283,48 @@ impl pallet_assets::Config for Runtime { type BenchmarkHelper = (); } +parameter_types! { + // we just reuse the same deposits + pub const ForeignAssetsAssetDeposit: Balance = AssetDeposit::get(); + pub const ForeignAssetsAssetAccountDeposit: Balance = AssetAccountDeposit::get(); + pub const ForeignAssetsApprovalDeposit: Balance = ApprovalDeposit::get(); + pub const ForeignAssetsAssetsStringLimit: u32 = AssetsStringLimit::get(); + pub const ForeignAssetsMetadataDepositBase: Balance = MetadataDepositBase::get(); + pub const ForeignAssetsMetadataDepositPerByte: Balance = MetadataDepositPerByte::get(); +} + +/// Assets managed by some foreign location. Note: we do not declare a `ForeignAssetsCall` type, as +/// this type is used in proxy definitions. We assume that a foreign location would not want to set +/// an individual, local account as a proxy for the issuance of their assets. This issuance should +/// be managed by the foreign location's governance. +pub type ForeignAssetsInstance = pallet_assets::Instance2; +impl pallet_assets::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type AssetId = MultiLocationForAssetId; + type AssetIdParameter = MultiLocationForAssetId; + type Currency = Balances; + type CreateOrigin = ForeignCreators< + (FromSiblingParachain>,), + ForeignCreatorsSovereignAccountOf, + AccountId, + >; + type ForceOrigin = AssetsForceOrigin; + type AssetDeposit = ForeignAssetsAssetDeposit; + type MetadataDepositBase = ForeignAssetsMetadataDepositBase; + type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte; + type ApprovalDeposit = ForeignAssetsApprovalDeposit; + type StringLimit = ForeignAssetsAssetsStringLimit; + type Freezer = (); + type Extra = (); + type WeightInfo = weights::pallet_assets::WeightInfo; + type CallbackHandle = (); + type AssetAccountDeposit = ForeignAssetsAssetAccountDeposit; + type RemoveItemsLimit = frame_support::traits::ConstU32<1000>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = xcm_config::XcmBenchmarkHelper; +} + parameter_types! { // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. pub const DepositBase: Balance = deposit(1, 88); @@ -358,6 +405,7 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::Balances { .. } | RuntimeCall::Assets { .. } | + RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } ), ProxyType::CancelProxy => matches!( @@ -372,7 +420,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets { .. } | RuntimeCall::Utility { .. } | RuntimeCall::Multisig { .. } | - RuntimeCall::Uniques { .. } + RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } ) }, ProxyType::AssetOwner => matches!( @@ -386,6 +434,13 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::transfer_ownership { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_team { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_collection_max_supply { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_collection { .. }) | RuntimeCall::Uniques(pallet_uniques::Call::create { .. }) | RuntimeCall::Uniques(pallet_uniques::Call::destroy { .. }) | RuntimeCall::Uniques(pallet_uniques::Call::transfer_ownership { .. }) | @@ -408,6 +463,17 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_attributes_pre_signed { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_item_transfer { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::unlock_item_transfer { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_item_properties { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::clear_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_collection_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::clear_collection_metadata { .. }) | RuntimeCall::Uniques(pallet_uniques::Call::mint { .. }) | RuntimeCall::Uniques(pallet_uniques::Call::burn { .. }) | RuntimeCall::Uniques(pallet_uniques::Call::freeze { .. }) | @@ -573,14 +639,11 @@ impl pallet_asset_tx_payment::Config for Runtime { } parameter_types! { - pub const CollectionDeposit: Balance = 10 * UNITS; // 10 UNIT deposit to create uniques class - pub const ItemDeposit: Balance = UNITS / 100; // 1 / 100 UNIT deposit to create uniques instance - pub const KeyLimit: u32 = 32; // Max 32 bytes per key - pub const ValueLimit: u32 = 64; // Max 64 bytes per value + pub const UniquesCollectionDeposit: Balance = 10 * UNITS; // 10 UNIT deposit to create uniques class + pub const UniquesItemDeposit: Balance = UNITS / 100; // 1 / 100 UNIT deposit to create uniques instance pub const UniquesMetadataDepositBase: Balance = deposit(1, 129); - pub const AttributeDepositBase: Balance = deposit(1, 0); - pub const DepositPerByte: Balance = deposit(0, 1); - pub const UniquesStringLimit: u32 = 128; + pub const UniquesAttributeDepositBase: Balance = deposit(1, 0); + pub const UniquesDepositPerByte: Balance = deposit(0, 1); } impl pallet_uniques::Config for Runtime { @@ -589,14 +652,14 @@ impl pallet_uniques::Config for Runtime { type ItemId = u32; type Currency = Balances; type ForceOrigin = AssetsForceOrigin; - type CollectionDeposit = CollectionDeposit; - type ItemDeposit = ItemDeposit; + type CollectionDeposit = UniquesCollectionDeposit; + type ItemDeposit = UniquesItemDeposit; type MetadataDepositBase = UniquesMetadataDepositBase; - type AttributeDepositBase = AttributeDepositBase; - type DepositPerByte = DepositPerByte; - type StringLimit = UniquesStringLimit; - type KeyLimit = KeyLimit; - type ValueLimit = ValueLimit; + type AttributeDepositBase = UniquesAttributeDepositBase; + type DepositPerByte = UniquesDepositPerByte; + type StringLimit = ConstU32<128>; + type KeyLimit = ConstU32<32>; // Max 32 bytes per key + type ValueLimit = ConstU32<64>; // Max 64 bytes per value type WeightInfo = weights::pallet_uniques::WeightInfo; #[cfg(feature = "runtime-benchmarks")] type Helper = (); @@ -604,6 +667,46 @@ impl pallet_uniques::Config for Runtime { type Locker = (); } +parameter_types! { + pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); + pub const NftsMaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS; + // re-use the Uniques deposits + pub const NftsCollectionDeposit: Balance = UniquesCollectionDeposit::get(); + pub const NftsItemDeposit: Balance = UniquesItemDeposit::get(); + pub const NftsMetadataDepositBase: Balance = UniquesMetadataDepositBase::get(); + pub const NftsAttributeDepositBase: Balance = UniquesAttributeDepositBase::get(); + pub const NftsDepositPerByte: Balance = UniquesDepositPerByte::get(); +} + +impl pallet_nfts::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type CollectionId = u32; + type ItemId = u32; + type Currency = Balances; + type CreateOrigin = AsEnsureOriginWithArg>; + type ForceOrigin = AssetsForceOrigin; + type Locker = (); + type CollectionDeposit = NftsCollectionDeposit; + type ItemDeposit = NftsItemDeposit; + type MetadataDepositBase = NftsMetadataDepositBase; + type AttributeDepositBase = NftsAttributeDepositBase; + type DepositPerByte = NftsDepositPerByte; + type StringLimit = ConstU32<256>; + type KeyLimit = ConstU32<64>; + type ValueLimit = ConstU32<256>; + type ApprovalsLimit = ConstU32<20>; + type ItemAttributesApprovalsLimit = ConstU32<30>; + type MaxTips = ConstU32<10>; + type MaxDeadlineDuration = NftsMaxDeadlineDuration; + type MaxAttributesPerCall = ConstU32<10>; + type Features = NftsPalletFeatures; + type OffchainSignature = Signature; + type OffchainPublic = ::Signer; + type WeightInfo = weights::pallet_nfts::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -646,6 +749,8 @@ construct_runtime!( // The main stage. Assets: pallet_assets::::{Pallet, Call, Storage, Event} = 50, Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 51, + Nfts: pallet_nfts::{Pallet, Call, Storage, Event} = 52, + ForeignAssets: pallet_assets::::{Pallet, Call, Storage, Event} = 53, } ); @@ -674,7 +779,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Migrations to apply on runtime upgrade. -pub type Migrations = (); +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -695,8 +800,10 @@ mod benches { define_benchmarks!( [frame_system, SystemBench::] [pallet_assets, Assets] + [pallet_assets, ForeignAssets] [pallet_balances, Balances] [pallet_multisig, Multisig] + [pallet_nfts, Nfts] [pallet_proxy, Proxy] [pallet_session, SessionBench::] [pallet_uniques, Uniques] @@ -869,11 +976,17 @@ impl_runtime_apis! { }, // collect pallet_assets (TrustBackedAssets) convert::<_, _, _, _, TrustBackedAssetsConvertedConcreteId>( - Assets::account_balances(account) + Assets::account_balances(account.clone()) + .iter() + .filter(|(_, balance)| balance > &0) + )?, + // collect pallet_assets (ForeignAssets) + convert::<_, _, _, _, ForeignAssetsConvertedConcreteId>( + ForeignAssets::account_balances(account) .iter() .filter(|(_, balance)| balance > &0) )?, - // collect ... e.g. pallet_assets ForeignAssets + // collect ... e.g. other tokens ].concat().into()) } } @@ -925,7 +1038,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -960,7 +1073,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -980,7 +1092,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( DotLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(DotLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -994,7 +1106,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(DotLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/assets/statemint/src/weights/cumulus_pallet_xcmp_queue.rs b/parachains/runtimes/assets/statemint/src/weights/cumulus_pallet_xcmp_queue.rs index 02bedfa2d6a..6b492b2c1e5 100644 --- a/parachains/runtimes/assets/statemint/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/parachains/runtimes/assets/statemint/src/weights/cumulus_pallet_xcmp_queue.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_634_000 picoseconds. - Weight::from_parts(5_845_000, 0) + // Minimum execution time: 5_499_000 picoseconds. + Weight::from_parts(5_677_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_684_000 picoseconds. - Weight::from_parts(5_823_000, 0) + // Minimum execution time: 5_747_000 picoseconds. + Weight::from_parts(5_911_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/assets/statemint/src/weights/frame_system.rs b/parachains/runtimes/assets/statemint/src/weights/frame_system.rs index 23a5e25cddb..9884d6d9c3d 100644 --- a/parachains/runtimes/assets/statemint/src/weights/frame_system.rs +++ b/parachains/runtimes/assets/statemint/src/weights/frame_system.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `frame_system`. pub struct WeightInfo(PhantomData); @@ -52,22 +53,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_346_000 picoseconds. - Weight::from_parts(2_416_000, 0) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_297_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(412, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(365, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_010_000 picoseconds. - Weight::from_parts(8_171_000, 0) + // Minimum execution time: 7_839_000 picoseconds. + Weight::from_parts(7_977_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_448, 0).saturating_mul(b.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_406, 0).saturating_mul(b.into())) + } + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -77,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_684_000 picoseconds. - Weight::from_parts(4_872_000, 0) + // Minimum execution time: 4_494_000 picoseconds. + Weight::from_parts(4_824_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -90,11 +94,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_361_000 picoseconds. - Weight::from_parts(2_402_000, 0) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_396_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_747 - .saturating_add(Weight::from_parts(682_536, 0).saturating_mul(i.into())) + // Standard Error: 2_074 + .saturating_add(Weight::from_parts(676_456, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -104,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_515_000 picoseconds. - Weight::from_parts(2_565_000, 0) + // Minimum execution time: 2_345_000 picoseconds. + Weight::from_parts(2_374_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 859 - .saturating_add(Weight::from_parts(501_791, 0).saturating_mul(i.into())) + // Standard Error: 758 + .saturating_add(Weight::from_parts(491_397, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -118,11 +122,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `81 + p * (69 ±0)` // Estimated: `72 + p * (70 ±0)` - // Minimum execution time: 4_524_000 picoseconds. - Weight::from_parts(4_626_000, 0) + // Minimum execution time: 4_203_000 picoseconds. + Weight::from_parts(4_292_000, 0) .saturating_add(Weight::from_parts(0, 72)) - // Standard Error: 1_004 - .saturating_add(Weight::from_parts(1_011_603, 0).saturating_mul(p.into())) + // Standard Error: 1_026 + .saturating_add(Weight::from_parts(1_011_943, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/parachains/runtimes/assets/statemint/src/weights/mod.rs b/parachains/runtimes/assets/statemint/src/weights/mod.rs index 5dd6ffd662e..92af360ced1 100644 --- a/parachains/runtimes/assets/statemint/src/weights/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/mod.rs @@ -6,6 +6,7 @@ pub mod pallet_assets; pub mod pallet_balances; pub mod pallet_collator_selection; pub mod pallet_multisig; +pub mod pallet_nfts; pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_timestamp; diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs index 933dcb4d3af..cf9dae9dee3 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_assets`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `7268` - // Minimum execution time: 24_714_000 picoseconds. - Weight::from_parts(25_310_000, 0) - .saturating_add(Weight::from_parts(0, 7268)) + // Estimated: `3675` + // Minimum execution time: 28_211_000 picoseconds. + Weight::from_parts(28_668_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -67,8 +68,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `6` // Estimated: `3675` - // Minimum execution time: 12_820_000 picoseconds. - Weight::from_parts(13_118_000, 0) + // Minimum execution time: 11_781_000 picoseconds. + Weight::from_parts(12_065_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -79,8 +80,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `277` // Estimated: `3675` - // Minimum execution time: 15_292_000 picoseconds. - Weight::from_parts(15_715_000, 0) + // Minimum execution time: 14_330_000 picoseconds. + Weight::from_parts(14_502_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -95,17 +96,17 @@ impl pallet_assets::WeightInfo for WeightInfo { fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + c * (208 ±0)` - // Estimated: `8232 + c * (5180 ±0)` - // Minimum execution time: 17_955_000 picoseconds. - Weight::from_parts(18_157_000, 0) - .saturating_add(Weight::from_parts(0, 8232)) - // Standard Error: 7_214 - .saturating_add(Weight::from_parts(12_316_605, 0).saturating_mul(c.into())) + // Estimated: `3675 + c * (2603 ±0)` + // Minimum execution time: 17_319_000 picoseconds. + Weight::from_parts(17_663_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + // Standard Error: 7_032 + .saturating_add(Weight::from_parts(11_982_921, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5180).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(c.into())) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) @@ -115,12 +116,12 @@ impl pallet_assets::WeightInfo for WeightInfo { fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `414 + a * (86 ±0)` - // Estimated: `7288 + a * (2623 ±0)` - // Minimum execution time: 18_626_000 picoseconds. - Weight::from_parts(18_760_000, 0) - .saturating_add(Weight::from_parts(0, 7288)) - // Standard Error: 4_382 - .saturating_add(Weight::from_parts(12_278_198, 0).saturating_mul(a.into())) + // Estimated: `3675 + a * (2623 ±0)` + // Minimum execution time: 18_296_000 picoseconds. + Weight::from_parts(18_465_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) + // Standard Error: 4_256 + .saturating_add(Weight::from_parts(14_090_852, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -134,10 +135,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn finish_destroy() -> Weight { // Proof Size summary in bytes: // Measured: `243` - // Estimated: `7280` - // Minimum execution time: 14_576_000 picoseconds. - Weight::from_parts(14_816_000, 0) - .saturating_add(Weight::from_parts(0, 7280)) + // Estimated: `3675` + // Minimum execution time: 14_265_000 picoseconds. + Weight::from_parts(14_527_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -148,10 +149,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `243` - // Estimated: `7242` - // Minimum execution time: 26_215_000 picoseconds. - Weight::from_parts(26_571_000, 0) - .saturating_add(Weight::from_parts(0, 7242)) + // Estimated: `3675` + // Minimum execution time: 25_227_000 picoseconds. + Weight::from_parts(25_846_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -162,10 +163,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7242` - // Minimum execution time: 31_944_000 picoseconds. - Weight::from_parts(32_675_000, 0) - .saturating_add(Weight::from_parts(0, 7242)) + // Estimated: `3675` + // Minimum execution time: 31_131_000 picoseconds. + Weight::from_parts(31_792_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -178,10 +179,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `13412` - // Minimum execution time: 44_126_000 picoseconds. - Weight::from_parts(44_567_000, 0) - .saturating_add(Weight::from_parts(0, 13412)) + // Estimated: `6144` + // Minimum execution time: 43_177_000 picoseconds. + Weight::from_parts(43_498_000, 0) + .saturating_add(Weight::from_parts(0, 6144)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -194,10 +195,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `13412` - // Minimum execution time: 39_414_000 picoseconds. - Weight::from_parts(39_891_000, 0) - .saturating_add(Weight::from_parts(0, 13412)) + // Estimated: `6144` + // Minimum execution time: 37_702_000 picoseconds. + Weight::from_parts(38_413_000, 0) + .saturating_add(Weight::from_parts(0, 6144)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -210,10 +211,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `13412` - // Minimum execution time: 44_875_000 picoseconds. - Weight::from_parts(45_961_000, 0) - .saturating_add(Weight::from_parts(0, 13412)) + // Estimated: `6144` + // Minimum execution time: 43_061_000 picoseconds. + Weight::from_parts(43_657_000, 0) + .saturating_add(Weight::from_parts(0, 6144)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -224,10 +225,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7242` - // Minimum execution time: 18_388_000 picoseconds. - Weight::from_parts(18_718_000, 0) - .saturating_add(Weight::from_parts(0, 7242)) + // Estimated: `3675` + // Minimum execution time: 17_386_000 picoseconds. + Weight::from_parts(17_618_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -238,10 +239,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `351` - // Estimated: `7242` - // Minimum execution time: 18_292_000 picoseconds. - Weight::from_parts(18_633_000, 0) - .saturating_add(Weight::from_parts(0, 7242)) + // Estimated: `3675` + // Minimum execution time: 17_180_000 picoseconds. + Weight::from_parts(17_458_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -251,8 +252,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `277` // Estimated: `3675` - // Minimum execution time: 14_604_000 picoseconds. - Weight::from_parts(14_980_000, 0) + // Minimum execution time: 13_802_000 picoseconds. + Weight::from_parts(14_110_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -263,8 +264,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `277` // Estimated: `3675` - // Minimum execution time: 14_008_000 picoseconds. - Weight::from_parts(14_428_000, 0) + // Minimum execution time: 13_903_000 picoseconds. + Weight::from_parts(14_158_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -276,10 +277,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `243` - // Estimated: `7280` - // Minimum execution time: 15_453_000 picoseconds. - Weight::from_parts(15_963_000, 0) - .saturating_add(Weight::from_parts(0, 7280)) + // Estimated: `3675` + // Minimum execution time: 15_371_000 picoseconds. + Weight::from_parts(15_651_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -289,8 +290,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `243` // Estimated: `3675` - // Minimum execution time: 14_515_000 picoseconds. - Weight::from_parts(14_835_000, 0) + // Minimum execution time: 14_229_000 picoseconds. + Weight::from_parts(14_440_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -301,17 +302,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `243` - // Estimated: `7280` - // Minimum execution time: 25_865_000 picoseconds. - Weight::from_parts(26_845_899, 0) - .saturating_add(Weight::from_parts(0, 7280)) - // Standard Error: 1_061 - .saturating_add(Weight::from_parts(4_438, 0).saturating_mul(n.into())) - // Standard Error: 1_061 - .saturating_add(Weight::from_parts(5_130, 0).saturating_mul(s.into())) + // Estimated: `3675` + // Minimum execution time: 29_075_000 picoseconds. + Weight::from_parts(29_848_037, 0) + .saturating_add(Weight::from_parts(0, 3675)) + // Standard Error: 404 + .saturating_add(Weight::from_parts(2_259, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -322,10 +321,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `407` - // Estimated: `7280` - // Minimum execution time: 25_970_000 picoseconds. - Weight::from_parts(26_439_000, 0) - .saturating_add(Weight::from_parts(0, 7280)) + // Estimated: `3675` + // Minimum execution time: 29_204_000 picoseconds. + Weight::from_parts(29_542_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -335,17 +334,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(n: u32, s: u32, ) -> Weight { + fn force_set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `82` - // Estimated: `7280` - // Minimum execution time: 14_101_000 picoseconds. - Weight::from_parts(14_786_155, 0) - .saturating_add(Weight::from_parts(0, 7280)) - // Standard Error: 383 - .saturating_add(Weight::from_parts(581, 0).saturating_mul(n.into())) - // Standard Error: 383 - .saturating_add(Weight::from_parts(4_514, 0).saturating_mul(s.into())) + // Estimated: `3675` + // Minimum execution time: 13_144_000 picoseconds. + Weight::from_parts(13_741_573, 0) + .saturating_add(Weight::from_parts(0, 3675)) + // Standard Error: 314 + .saturating_add(Weight::from_parts(2_146, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -356,10 +353,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `407` - // Estimated: `7280` - // Minimum execution time: 26_563_000 picoseconds. - Weight::from_parts(26_733_000, 0) - .saturating_add(Weight::from_parts(0, 7280)) + // Estimated: `3675` + // Minimum execution time: 28_718_000 picoseconds. + Weight::from_parts(29_090_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -369,8 +366,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `243` // Estimated: `3675` - // Minimum execution time: 13_948_000 picoseconds. - Weight::from_parts(14_330_000, 0) + // Minimum execution time: 13_183_000 picoseconds. + Weight::from_parts(13_442_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -382,10 +379,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `277` - // Estimated: `7288` - // Minimum execution time: 30_307_000 picoseconds. - Weight::from_parts(30_677_000, 0) - .saturating_add(Weight::from_parts(0, 7288)) + // Estimated: `3675` + // Minimum execution time: 32_260_000 picoseconds. + Weight::from_parts(32_739_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -400,10 +397,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn transfer_approved() -> Weight { // Proof Size summary in bytes: // Measured: `521` - // Estimated: `17025` - // Minimum execution time: 59_228_000 picoseconds. - Weight::from_parts(59_702_000, 0) - .saturating_add(Weight::from_parts(0, 17025)) + // Estimated: `6144` + // Minimum execution time: 61_085_000 picoseconds. + Weight::from_parts(61_779_000, 0) + .saturating_add(Weight::from_parts(0, 6144)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -414,10 +411,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `447` - // Estimated: `7288` - // Minimum execution time: 31_228_000 picoseconds. - Weight::from_parts(31_564_000, 0) - .saturating_add(Weight::from_parts(0, 7288)) + // Estimated: `3675` + // Minimum execution time: 34_236_000 picoseconds. + Weight::from_parts(34_692_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -428,10 +425,10 @@ impl pallet_assets::WeightInfo for WeightInfo { fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `447` - // Estimated: `7288` - // Minimum execution time: 32_931_000 picoseconds. - Weight::from_parts(33_406_000, 0) - .saturating_add(Weight::from_parts(0, 7288)) + // Estimated: `3675` + // Minimum execution time: 34_765_000 picoseconds. + Weight::from_parts(35_364_000, 0) + .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -441,10 +438,79 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `243` // Estimated: `3675` - // Minimum execution time: 15_084_000 picoseconds. - Weight::from_parts(15_358_000, 0) + // Minimum execution time: 14_550_000 picoseconds. + Weight::from_parts(14_799_000, 0) .saturating_add(Weight::from_parts(0, 3675)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_balances.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_balances.rs index e81c1925649..631d8b00c34 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_balances.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_balances.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 35_757_000 picoseconds. - Weight::from_parts(36_417_000, 0) + // Minimum execution time: 52_756_000 picoseconds. + Weight::from_parts(53_298_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 27_074_000 picoseconds. - Weight::from_parts(27_335_000, 0) + // Minimum execution time: 40_071_000 picoseconds. + Weight::from_parts(40_563_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,8 +78,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 16_753_000 picoseconds. - Weight::from_parts(17_141_000, 0) + // Minimum execution time: 15_936_000 picoseconds. + Weight::from_parts(16_317_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -89,8 +90,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 20_459_000 picoseconds. - Weight::from_parts(20_848_000, 0) + // Minimum execution time: 22_750_000 picoseconds. + Weight::from_parts(23_053_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +102,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 41_036_000 picoseconds. - Weight::from_parts(41_265_000, 0) + // Minimum execution time: 54_270_000 picoseconds. + Weight::from_parts(54_857_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -113,25 +114,38 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 35_925_000 picoseconds. - Weight::from_parts(36_511_000, 0) + // Minimum execution time: 49_155_000 picoseconds. + Weight::from_parts(49_567_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn upgrade_accounts(_: u32) -> Weight { - Weight::from_parts(0, 0) - } fn force_unreserve() -> Weight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 16_377_000 picoseconds. - Weight::from_parts(16_722_000, 0) + // Minimum execution time: 18_651_000 picoseconds. + Weight::from_parts(19_007_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// 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]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (136 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 18_523_000 picoseconds. + Weight::from_parts(18_943_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 11_771 + .saturating_add(Weight::from_parts(14_176_687, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_collator_selection.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_collator_selection.rs index e86fa5544d0..37c59255469 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_collator_selection.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_collator_selection` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collator_selection`. pub struct WeightInfo(PhantomData); @@ -56,11 +57,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `178 + b * (78 ±0)` // Estimated: `1168 + b * (2554 ±0)` - // Minimum execution time: 15_372_000 picoseconds. - Weight::from_parts(16_916_596, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(14_942_281, 0) .saturating_add(Weight::from_parts(0, 1168)) - // Standard Error: 3_537 - .saturating_add(Weight::from_parts(2_583_561, 0).saturating_mul(b.into())) + // Standard Error: 3_013 + .saturating_add(Weight::from_parts(2_673_944, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) @@ -71,8 +72,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_637_000 picoseconds. - Weight::from_parts(7_821_000, 0) + // Minimum execution time: 7_341_000 picoseconds. + Weight::from_parts(7_608_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,8 +83,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_838_000 picoseconds. - Weight::from_parts(8_092_000, 0) + // Minimum execution time: 7_710_000 picoseconds. + Weight::from_parts(7_973_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,12 +104,12 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn register_as_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1108 + c * (48 ±0)` - // Estimated: `61671 + c * (49 ±0)` - // Minimum execution time: 37_630_000 picoseconds. - Weight::from_parts(30_551_625, 0) - .saturating_add(Weight::from_parts(0, 61671)) - // Standard Error: 1_282 - .saturating_add(Weight::from_parts(112_510, 0).saturating_mul(c.into())) + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 42_547_000 picoseconds. + Weight::from_parts(35_070_051, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_231 + .saturating_add(Weight::from_parts(105_769, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) @@ -122,11 +123,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `452 + c * (48 ±0)` // Estimated: `49487` - // Minimum execution time: 29_525_000 picoseconds. - Weight::from_parts(19_433_082, 0) + // Minimum execution time: 33_828_000 picoseconds. + Weight::from_parts(23_360_256, 0) .saturating_add(Weight::from_parts(0, 49487)) - // Standard Error: 1_290 - .saturating_add(Weight::from_parts(108_444, 0).saturating_mul(c.into())) + // Standard Error: 1_294 + .saturating_add(Weight::from_parts(106_027, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,13 +140,46 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn note_author() -> Weight { // Proof Size summary in bytes: // Measured: `103` - // Estimated: `7729` - // Minimum execution time: 29_428_000 picoseconds. - Weight::from_parts(29_752_000, 0) - .saturating_add(Weight::from_parts(0, 7729)) + // Estimated: `6196` + // Minimum execution time: 43_367_000 picoseconds. + Weight::from_parts(44_039_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: CollatorSelection Candidates (r:1 w:0) /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(48002), added: 48497, mode: MaxEncodedLen) /// Storage: CollatorSelection LastAuthoredBlock (r:999 w:0) @@ -160,18 +194,18 @@ impl pallet_collator_selection::WeightInfo for WeightIn /// The range of component `c` is `[1, 1000]`. fn new_session(r: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `22721 + r * (116 ±0) + c * (97 ±0)` - // Estimated: `56697 + r * (2602 ±0) + c * (2520 ±0)` - // Minimum execution time: 17_105_000 picoseconds. - Weight::from_parts(17_304_000, 0) - .saturating_add(Weight::from_parts(0, 56697)) - // Standard Error: 839_957 - .saturating_add(Weight::from_parts(30_183_103, 0).saturating_mul(c.into())) + // Measured: `22721 + c * (97 ±0) + r * (116 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2602 ±0)` + // Minimum execution time: 17_277_000 picoseconds. + Weight::from_parts(17_657_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 855_404 + .saturating_add(Weight::from_parts(30_433_186, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 2602).saturating_mul(r.into())) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_multisig.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_multisig.rs index 2a93d9e41c2..3f708111d83 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_multisig.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_multisig.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); @@ -52,11 +53,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_445_000 picoseconds. - Weight::from_parts(12_887_726, 0) + // Minimum execution time: 11_556_000 picoseconds. + Weight::from_parts(11_977_075, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 1 - .saturating_add(Weight::from_parts(608, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(493, 0).saturating_mul(z.into())) } /// Storage: Multisig Multisigs (r:1 w:1) /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3346), added: 5821, mode: MaxEncodedLen) @@ -66,13 +67,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `262 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 38_178_000 picoseconds. - Weight::from_parts(31_903_342, 0) + // Minimum execution time: 41_285_000 picoseconds. + Weight::from_parts(35_323_592, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 743 - .saturating_add(Weight::from_parts(67_484, 0).saturating_mul(s.into())) - // Standard Error: 7 - .saturating_add(Weight::from_parts(1_353, 0).saturating_mul(z.into())) + // Standard Error: 454 + .saturating_add(Weight::from_parts(64_841, 0).saturating_mul(s.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_195, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -84,13 +85,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 28_095_000 picoseconds. - Weight::from_parts(22_610_540, 0) + // Minimum execution time: 27_217_000 picoseconds. + Weight::from_parts(21_829_864, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 571 - .saturating_add(Weight::from_parts(59_325, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_310, 0).saturating_mul(z.into())) + // Standard Error: 473 + .saturating_add(Weight::from_parts(59_818, 0).saturating_mul(s.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_179, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,14 +104,14 @@ impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `385 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 43_571_000 picoseconds. - Weight::from_parts(35_747_616, 0) - .saturating_add(Weight::from_parts(0, 10404)) - // Standard Error: 555 - .saturating_add(Weight::from_parts(86_297, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_333, 0).saturating_mul(z.into())) + // Estimated: `6811` + // Minimum execution time: 46_235_000 picoseconds. + Weight::from_parts(38_643_321, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 484 + .saturating_add(Weight::from_parts(82_619, 0).saturating_mul(s.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_223, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -121,11 +122,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 29_122_000 picoseconds. - Weight::from_parts(30_681_183, 0) + // Minimum execution time: 31_827_000 picoseconds. + Weight::from_parts(33_743_065, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 787 - .saturating_add(Weight::from_parts(69_464, 0).saturating_mul(s.into())) + // Standard Error: 669 + .saturating_add(Weight::from_parts(68_793, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -136,11 +137,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 19_219_000 picoseconds. - Weight::from_parts(20_598_069, 0) + // Minimum execution time: 19_148_000 picoseconds. + Weight::from_parts(20_211_716, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 572 - .saturating_add(Weight::from_parts(66_940, 0).saturating_mul(s.into())) + // Standard Error: 376 + .saturating_add(Weight::from_parts(62_199, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -151,11 +152,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 29_859_000 picoseconds. - Weight::from_parts(31_610_947, 0) + // Minimum execution time: 32_770_000 picoseconds. + Weight::from_parts(34_731_111, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 739 - .saturating_add(Weight::from_parts(70_349, 0).saturating_mul(s.into())) + // Standard Error: 761 + .saturating_add(Weight::from_parts(70_575, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_nfts.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_nfts.rs new file mode 100644 index 00000000000..1f1f718c9c5 --- /dev/null +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_nfts.rs @@ -0,0 +1,763 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `pallet_nfts` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 + +// Executed Command: +// ./artifacts/polkadot-parachain +// benchmark +// pallet +// --chain=statemint-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet=pallet_nfts +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/statemint/src/weights/pallet_nfts.rs + +#![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_nfts`. +pub struct WeightInfo(PhantomData); +impl pallet_nfts::WeightInfo for WeightInfo { + /// Storage: Nfts NextCollectionId (r:1 w:1) + /// Proof: Nfts NextCollectionId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:0 w:1) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:0 w:1) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts CollectionAccount (r:0 w:1) + /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `145` + // Estimated: `3549` + // Minimum execution time: 39_589_000 picoseconds. + Weight::from_parts(40_305_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: Nfts NextCollectionId (r:1 w:1) + /// Proof: Nfts NextCollectionId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:0 w:1) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:0 w:1) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts CollectionAccount (r:0 w:1) + /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn force_create() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `3549` + // Minimum execution time: 23_945_000 picoseconds. + Weight::from_parts(24_351_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts ItemMetadataOf (r:1 w:0) + /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(347), added: 2822, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:1) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:1001 w:1000) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1000 w:1000) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts CollectionMetadataOf (r:0 w:1) + /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(294), added: 2769, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:0 w:1) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts CollectionAccount (r:0 w:1) + /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + /// The range of component `m` is `[0, 1000]`. + /// The range of component `c` is `[0, 1000]`. + /// The range of component `a` is `[0, 1000]`. + fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32170 + a * (366 ±0)` + // Estimated: `2523990 + a * (2954 ±0)` + // Minimum execution time: 992_533_000 picoseconds. + Weight::from_parts(941_813_359, 0) + .saturating_add(Weight::from_parts(0, 2523990)) + // Standard Error: 3_954 + .saturating_add(Weight::from_parts(5_784_754, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1004)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(1005)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_parts(0, 2954).saturating_mul(a.into())) + } + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:1) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:1) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + fn mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `421` + // Estimated: `4326` + // Minimum execution time: 49_305_000 picoseconds. + Weight::from_parts(50_143_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:1) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:1) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + fn force_mint() -> Weight { + // Proof Size summary in bytes: + // Measured: `421` + // Estimated: `4326` + // Minimum execution time: 48_627_000 picoseconds. + Weight::from_parts(48_954_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Nfts ItemConfigOf (r:1 w:1) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts ItemMetadataOf (r:1 w:0) + /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(347), added: 2822, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:1) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + /// Storage: Nfts ItemPriceOf (r:0 w:1) + /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) + /// Storage: Nfts ItemAttributesApprovalsOf (r:0 w:1) + /// Proof: Nfts ItemAttributesApprovalsOf (max_values: None, max_size: Some(1001), added: 3476, mode: MaxEncodedLen) + /// Storage: Nfts PendingSwapOf (r:0 w:1) + /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) + fn burn() -> Weight { + // Proof Size summary in bytes: + // Measured: `530` + // Estimated: `4326` + // Minimum execution time: 49_958_000 picoseconds. + Weight::from_parts(50_387_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:2) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + /// Storage: Nfts ItemPriceOf (r:0 w:1) + /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) + /// Storage: Nfts PendingSwapOf (r:0 w:1) + /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) + fn transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `559` + // Estimated: `4326` + // Minimum execution time: 36_267_000 picoseconds. + Weight::from_parts(36_712_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:5000 w:5000) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// The range of component `i` is `[0, 5000]`. + fn redeposit(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `729 + i * (108 ±0)` + // Estimated: `3549 + i * (3336 ±0)` + // Minimum execution time: 17_738_000 picoseconds. + Weight::from_parts(17_801_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + // Standard Error: 13_596 + .saturating_add(Weight::from_parts(15_695_790, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + .saturating_add(Weight::from_parts(0, 3336).saturating_mul(i.into())) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:1) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + fn lock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `401` + // Estimated: `3534` + // Minimum execution time: 20_845_000 picoseconds. + Weight::from_parts(21_133_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:1) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + fn unlock_item_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `401` + // Estimated: `3534` + // Minimum execution time: 20_862_000 picoseconds. + Weight::from_parts(21_105_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:1) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn lock_collection() -> Weight { + // Proof Size summary in bytes: + // Measured: `306` + // Estimated: `3549` + // Minimum execution time: 18_196_000 picoseconds. + Weight::from_parts(18_333_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts OwnershipAcceptance (r:1 w:1) + /// Proof: Nfts OwnershipAcceptance (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionAccount (r:0 w:2) + /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn transfer_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `354` + // Estimated: `3549` + // Minimum execution time: 24_025_000 picoseconds. + Weight::from_parts(24_277_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:2 w:4) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + fn set_team() -> Weight { + // Proof Size summary in bytes: + // Measured: `335` + // Estimated: `6078` + // Minimum execution time: 40_974_000 picoseconds. + Weight::from_parts(41_706_000, 0) + .saturating_add(Weight::from_parts(0, 6078)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionAccount (r:0 w:2) + /// Proof: Nfts CollectionAccount (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + fn force_collection_owner() -> Weight { + // Proof Size summary in bytes: + // Measured: `277` + // Estimated: `3549` + // Minimum execution time: 19_044_000 picoseconds. + Weight::from_parts(19_465_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:0 w:1) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn force_collection_config() -> Weight { + // Proof Size summary in bytes: + // Measured: `242` + // Estimated: `3549` + // Minimum execution time: 15_591_000 picoseconds. + Weight::from_parts(15_858_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:1) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + fn lock_item_properties() -> Weight { + // Proof Size summary in bytes: + // Measured: `401` + // Estimated: `3534` + // Minimum execution time: 20_831_000 picoseconds. + Weight::from_parts(21_121_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:1 w:1) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + fn set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `505` + // Estimated: `3944` + // Minimum execution time: 50_650_000 picoseconds. + Weight::from_parts(51_315_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:1 w:1) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + fn force_set_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `310` + // Estimated: `3944` + // Minimum execution time: 28_244_000 picoseconds. + Weight::from_parts(28_627_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Nfts Attribute (r:1 w:1) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + fn clear_attribute() -> Weight { + // Proof Size summary in bytes: + // Measured: `949` + // Estimated: `3944` + // Minimum execution time: 47_299_000 picoseconds. + Weight::from_parts(47_921_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Nfts Item (r:1 w:0) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts ItemAttributesApprovalsOf (r:1 w:1) + /// Proof: Nfts ItemAttributesApprovalsOf (max_values: None, max_size: Some(1001), added: 3476, mode: MaxEncodedLen) + fn approve_item_attributes() -> Weight { + // Proof Size summary in bytes: + // Measured: `347` + // Estimated: `4466` + // Minimum execution time: 19_400_000 picoseconds. + Weight::from_parts(19_601_000, 0) + .saturating_add(Weight::from_parts(0, 4466)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Item (r:1 w:0) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts ItemAttributesApprovalsOf (r:1 w:1) + /// Proof: Nfts ItemAttributesApprovalsOf (max_values: None, max_size: Some(1001), added: 3476, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:1001 w:1000) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `n` is `[0, 1000]`. + fn cancel_item_attributes_approval(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `726 + n * (398 ±0)` + // Estimated: `4466 + n * (2954 ±0)` + // Minimum execution time: 28_552_000 picoseconds. + Weight::from_parts(28_822_000, 0) + .saturating_add(Weight::from_parts(0, 4466)) + // Standard Error: 3_265 + .saturating_add(Weight::from_parts(5_570_824, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2954).saturating_mul(n.into())) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemMetadataOf (r:1 w:1) + /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(347), added: 2822, mode: MaxEncodedLen) + fn set_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `505` + // Estimated: `3812` + // Minimum execution time: 42_425_000 picoseconds. + Weight::from_parts(42_883_000, 0) + .saturating_add(Weight::from_parts(0, 3812)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts ItemMetadataOf (r:1 w:1) + /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(347), added: 2822, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + fn clear_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `815` + // Estimated: `3812` + // Minimum execution time: 40_219_000 picoseconds. + Weight::from_parts(41_709_000, 0) + .saturating_add(Weight::from_parts(0, 3812)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionMetadataOf (r:1 w:1) + /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(294), added: 2769, mode: MaxEncodedLen) + fn set_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `364` + // Estimated: `3759` + // Minimum execution time: 39_376_000 picoseconds. + Weight::from_parts(39_895_000, 0) + .saturating_add(Weight::from_parts(0, 3759)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts CollectionMetadataOf (r:1 w:1) + /// Proof: Nfts CollectionMetadataOf (max_values: None, max_size: Some(294), added: 2769, mode: MaxEncodedLen) + fn clear_collection_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `682` + // Estimated: `3759` + // Minimum execution time: 38_414_000 picoseconds. + Weight::from_parts(38_627_000, 0) + .saturating_add(Weight::from_parts(0, 3759)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn approve_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `376` + // Estimated: `4326` + // Minimum execution time: 22_896_000 picoseconds. + Weight::from_parts(23_137_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + fn cancel_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `384` + // Estimated: `4326` + // Minimum execution time: 20_602_000 picoseconds. + Weight::from_parts(20_869_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + fn clear_all_transfer_approvals() -> Weight { + // Proof Size summary in bytes: + // Measured: `384` + // Estimated: `4326` + // Minimum execution time: 19_415_000 picoseconds. + Weight::from_parts(19_594_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts OwnershipAcceptance (r:1 w:1) + /// Proof: Nfts OwnershipAcceptance (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + fn set_accept_ownership() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `3517` + // Minimum execution time: 16_784_000 picoseconds. + Weight::from_parts(17_133_000, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts CollectionConfigOf (r:1 w:1) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + fn set_collection_max_supply() -> Weight { + // Proof Size summary in bytes: + // Measured: `306` + // Estimated: `3549` + // Minimum execution time: 20_391_000 picoseconds. + Weight::from_parts(20_710_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts CollectionRoleOf (r:1 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:1) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn update_mint_settings() -> Weight { + // Proof Size summary in bytes: + // Measured: `289` + // Estimated: `3538` + // Minimum execution time: 19_989_000 picoseconds. + Weight::from_parts(20_179_000, 0) + .saturating_add(Weight::from_parts(0, 3538)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Item (r:1 w:0) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts ItemPriceOf (r:0 w:1) + /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) + fn set_price() -> Weight { + // Proof Size summary in bytes: + // Measured: `484` + // Estimated: `4326` + // Minimum execution time: 24_308_000 picoseconds. + Weight::from_parts(24_721_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts ItemPriceOf (r:1 w:1) + /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:2) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + /// Storage: Nfts PendingSwapOf (r:0 w:1) + /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) + fn buy_item() -> Weight { + // Proof Size summary in bytes: + // Measured: `671` + // Estimated: `4326` + // Minimum execution time: 45_626_000 picoseconds. + Weight::from_parts(46_030_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// The range of component `n` is `[0, 10]`. + fn pay_tips(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_654_000 picoseconds. + Weight::from_parts(4_301_940, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 9_223 + .saturating_add(Weight::from_parts(3_945_966, 0).saturating_mul(n.into())) + } + /// Storage: Nfts Item (r:2 w:0) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts PendingSwapOf (r:0 w:1) + /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) + fn create_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `460` + // Estimated: `7662` + // Minimum execution time: 23_071_000 picoseconds. + Weight::from_parts(23_535_000, 0) + .saturating_add(Weight::from_parts(0, 7662)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts PendingSwapOf (r:1 w:1) + /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:1 w:0) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + fn cancel_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `479` + // Estimated: `4326` + // Minimum execution time: 21_554_000 picoseconds. + Weight::from_parts(21_941_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Nfts Item (r:2 w:2) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts PendingSwapOf (r:1 w:2) + /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:0) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:2 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:4) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + /// Storage: Nfts ItemPriceOf (r:0 w:2) + /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) + fn claim_swap() -> Weight { + // Proof Size summary in bytes: + // Measured: `800` + // Estimated: `7662` + // Minimum execution time: 74_272_000 picoseconds. + Weight::from_parts(75_374_000, 0) + .saturating_add(Weight::from_parts(0, 7662)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(10)) + } + /// Storage: Nfts CollectionRoleOf (r:2 w:0) + /// Proof: Nfts CollectionRoleOf (max_values: None, max_size: Some(69), added: 2544, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:1) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:10 w:10) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + /// Storage: Nfts ItemMetadataOf (r:1 w:1) + /// Proof: Nfts ItemMetadataOf (max_values: None, max_size: Some(347), added: 2822, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:1) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + /// The range of component `n` is `[0, 10]`. + fn mint_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `524` + // Estimated: `6078 + n * (2954 ±0)` + // Minimum execution time: 133_545_000 picoseconds. + Weight::from_parts(137_797_962, 0) + .saturating_add(Weight::from_parts(0, 6078)) + // Standard Error: 33_124 + .saturating_add(Weight::from_parts(29_785_862, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2954).saturating_mul(n.into())) + } + /// Storage: Nfts Item (r:1 w:0) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Nfts ItemAttributesApprovalsOf (r:1 w:1) + /// Proof: Nfts ItemAttributesApprovalsOf (max_values: None, max_size: Some(1001), added: 3476, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:10 w:10) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `n` is `[0, 10]`. + fn set_attributes_pre_signed(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `554` + // Estimated: `4466 + n * (2954 ±0)` + // Minimum execution time: 77_475_000 picoseconds. + Weight::from_parts(88_353_947, 0) + .saturating_add(Weight::from_parts(0, 4466)) + // Standard Error: 60_491 + .saturating_add(Weight::from_parts(29_507_037, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2954).saturating_mul(n.into())) + } +} diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_proxy.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_proxy.rs index 1471920ba2f..d6b2795b062 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_proxy.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_proxy.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_proxy`. pub struct WeightInfo(PhantomData); @@ -54,11 +55,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 17_484_000 picoseconds. - Weight::from_parts(17_998_669, 0) + // Minimum execution time: 16_736_000 picoseconds. + Weight::from_parts(17_180_115, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_091 - .saturating_add(Weight::from_parts(33_441, 0).saturating_mul(p.into())) + // Standard Error: 616 + .saturating_add(Weight::from_parts(29_847, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: Proxy Proxies (r:1 w:0) @@ -72,14 +73,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn proxy_announced(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `454 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 35_828_000 picoseconds. - Weight::from_parts(36_241_110, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 2_219 - .saturating_add(Weight::from_parts(156_309, 0).saturating_mul(a.into())) - // Standard Error: 2_292 - .saturating_add(Weight::from_parts(32_167, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 38_677_000 picoseconds. + Weight::from_parts(38_332_966, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_354 + .saturating_add(Weight::from_parts(134_195, 0).saturating_mul(a.into())) + // Standard Error: 1_399 + .saturating_add(Weight::from_parts(37_946, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -92,14 +93,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn remove_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_512_000 picoseconds. - Weight::from_parts(23_254_777, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 1_318 - .saturating_add(Weight::from_parts(148_302, 0).saturating_mul(a.into())) - // Standard Error: 1_362 - .saturating_add(Weight::from_parts(13_945, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_593_000 picoseconds. + Weight::from_parts(26_236_639, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_160 + .saturating_add(Weight::from_parts(129_362, 0).saturating_mul(a.into())) + // Standard Error: 1_199 + .saturating_add(Weight::from_parts(8_687, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -112,14 +113,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_528_000 picoseconds. - Weight::from_parts(23_510_728, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 1_393 - .saturating_add(Weight::from_parts(143_817, 0).saturating_mul(a.into())) - // Standard Error: 1_439 - .saturating_add(Weight::from_parts(9_334, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_596_000 picoseconds. + Weight::from_parts(25_854_867, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_372 + .saturating_add(Weight::from_parts(137_697, 0).saturating_mul(a.into())) + // Standard Error: 1_417 + .saturating_add(Weight::from_parts(14_082, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -134,14 +135,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn announce(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `386 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 31_233_000 picoseconds. - Weight::from_parts(32_142_917, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 1_888 - .saturating_add(Weight::from_parts(142_949, 0).saturating_mul(a.into())) - // Standard Error: 1_951 - .saturating_add(Weight::from_parts(46_737, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 35_255_000 picoseconds. + Weight::from_parts(34_659_291, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(126_577, 0).saturating_mul(a.into())) + // Standard Error: 1_107 + .saturating_add(Weight::from_parts(41_124, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -152,11 +153,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 24_085_000 picoseconds. - Weight::from_parts(25_032_056, 0) + // Minimum execution time: 26_245_000 picoseconds. + Weight::from_parts(26_910_616, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_758 - .saturating_add(Weight::from_parts(52_203, 0).saturating_mul(p.into())) + // Standard Error: 1_107 + .saturating_add(Weight::from_parts(54_705, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -167,11 +168,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_678_000 picoseconds. - Weight::from_parts(24_981_101, 0) + // Minimum execution time: 26_080_000 picoseconds. + Weight::from_parts(27_081_618, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_874 - .saturating_add(Weight::from_parts(73_774, 0).saturating_mul(p.into())) + // Standard Error: 1_644 + .saturating_add(Weight::from_parts(53_919, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -182,11 +183,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 19_119_000 picoseconds. - Weight::from_parts(19_982_142, 0) + // Minimum execution time: 23_191_000 picoseconds. + Weight::from_parts(23_827_934, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_174 - .saturating_add(Weight::from_parts(26_182, 0).saturating_mul(p.into())) + // Standard Error: 1_078 + .saturating_add(Weight::from_parts(28_417, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -197,11 +198,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `139` // Estimated: `4706` - // Minimum execution time: 26_077_000 picoseconds. - Weight::from_parts(27_130_205, 0) + // Minimum execution time: 27_895_000 picoseconds. + Weight::from_parts(28_599_042, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_539 - .saturating_add(Weight::from_parts(1_625, 0).saturating_mul(p.into())) + // Standard Error: 953 + .saturating_add(Weight::from_parts(12_641, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -212,11 +213,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `164 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 20_178_000 picoseconds. - Weight::from_parts(21_090_914, 0) + // Minimum execution time: 24_395_000 picoseconds. + Weight::from_parts(24_924_060, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_488 - .saturating_add(Weight::from_parts(36_285, 0).saturating_mul(p.into())) + // Standard Error: 720 + .saturating_add(Weight::from_parts(27_470, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_session.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_session.rs index 87458dcd84b..5a44e8e80bf 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_session.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_session.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `270` - // Estimated: `7470` - // Minimum execution time: 17_008_000 picoseconds. - Weight::from_parts(17_288_000, 0) - .saturating_add(Weight::from_parts(0, 7470)) + // Estimated: `3735` + // Minimum execution time: 17_271_000 picoseconds. + Weight::from_parts(17_533_000, 0) + .saturating_add(Weight::from_parts(0, 3735)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -68,10 +69,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `242` - // Estimated: `3949` - // Minimum execution time: 13_427_000 picoseconds. - Weight::from_parts(13_609_000, 0) - .saturating_add(Weight::from_parts(0, 3949)) + // Estimated: `3707` + // Minimum execution time: 13_077_000 picoseconds. + Weight::from_parts(13_283_000, 0) + .saturating_add(Weight::from_parts(0, 3707)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_timestamp.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_timestamp.rs index 75d47ae1fd6..361bb6245fc 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_timestamp.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_timestamp.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_timestamp`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `86` - // Estimated: `2986` - // Minimum execution time: 9_174_000 picoseconds. - Weight::from_parts(9_644_000, 0) - .saturating_add(Weight::from_parts(0, 2986)) + // Estimated: `1493` + // Minimum execution time: 9_418_000 picoseconds. + Weight::from_parts(9_665_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +66,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `57` // Estimated: `0` - // Minimum execution time: 3_121_000 picoseconds. - Weight::from_parts(3_205_000, 0) + // Minimum execution time: 3_266_000 picoseconds. + Weight::from_parts(3_386_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_uniques.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_uniques.rs index 1c33a12ab3d..fe9d2d1399e 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_uniques.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_uniques.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_uniques` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_uniques`. pub struct WeightInfo(PhantomData); @@ -55,8 +56,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `145` // Estimated: `3643` - // Minimum execution time: 26_653_000 picoseconds. - Weight::from_parts(27_024_000, 0) + // Minimum execution time: 30_269_000 picoseconds. + Weight::from_parts(30_661_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -69,8 +70,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3643` - // Minimum execution time: 15_168_000 picoseconds. - Weight::from_parts(15_535_000, 0) + // Minimum execution time: 14_801_000 picoseconds. + Weight::from_parts(15_041_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -96,17 +97,17 @@ impl pallet_uniques::WeightInfo for WeightInfo { /// The range of component `a` is `[0, 1000]`. fn destroy(n: u32, m: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `257 + n * (76 ±0) + m * (56 ±0) + a * (107 ±0)` - // Estimated: `9210 + n * (2597 ±0) + m * (2662 ±0) + a * (2647 ±0)` - // Minimum execution time: 2_365_108_000 picoseconds. - Weight::from_parts(2_380_000_000, 0) - .saturating_add(Weight::from_parts(0, 9210)) - // Standard Error: 24_588 - .saturating_add(Weight::from_parts(6_339_196, 0).saturating_mul(n.into())) - // Standard Error: 24_588 - .saturating_add(Weight::from_parts(265_876, 0).saturating_mul(m.into())) - // Standard Error: 24_588 - .saturating_add(Weight::from_parts(316_327, 0).saturating_mul(a.into())) + // Measured: `257 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)` + // Estimated: `3643 + a * (2647 ±0) + m * (2662 ±0) + n * (2597 ±0)` + // Minimum execution time: 2_439_268_000 picoseconds. + Weight::from_parts(2_450_670_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) + // Standard Error: 24_972 + .saturating_add(Weight::from_parts(6_281_799, 0).saturating_mul(n.into())) + // Standard Error: 24_972 + .saturating_add(Weight::from_parts(245_622, 0).saturating_mul(m.into())) + // Standard Error: 24_972 + .saturating_add(Weight::from_parts(345_135, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) @@ -115,9 +116,9 @@ impl pallet_uniques::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) - .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) - .saturating_add(Weight::from_parts(0, 2662).saturating_mul(m.into())) .saturating_add(Weight::from_parts(0, 2647).saturating_mul(a.into())) + .saturating_add(Weight::from_parts(0, 2662).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) } /// Storage: Uniques Asset (r:1 w:1) /// Proof: Uniques Asset (max_values: None, max_size: Some(122), added: 2597, mode: MaxEncodedLen) @@ -130,10 +131,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `10719` - // Minimum execution time: 32_891_000 picoseconds. - Weight::from_parts(33_169_000, 0) - .saturating_add(Weight::from_parts(0, 10719)) + // Estimated: `3643` + // Minimum execution time: 36_449_000 picoseconds. + Weight::from_parts(36_816_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -148,10 +149,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 33_895_000 picoseconds. - Weight::from_parts(34_205_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 37_704_000 picoseconds. + Weight::from_parts(38_102_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -166,10 +167,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 27_841_000 picoseconds. - Weight::from_parts(28_213_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 26_986_000 picoseconds. + Weight::from_parts(27_427_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -181,12 +182,12 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `738 + i * (76 ±0)` - // Estimated: `4633 + i * (2597 ±0)` - // Minimum execution time: 16_054_000 picoseconds. - Weight::from_parts(16_331_000, 0) - .saturating_add(Weight::from_parts(0, 4633)) - // Standard Error: 12_166 - .saturating_add(Weight::from_parts(13_413_428, 0).saturating_mul(i.into())) + // Estimated: `3643 + i * (2597 ±0)` + // Minimum execution time: 15_664_000 picoseconds. + Weight::from_parts(15_788_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) + // Standard Error: 12_408 + .saturating_add(Weight::from_parts(15_388_354, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -200,10 +201,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 19_419_000 picoseconds. - Weight::from_parts(19_724_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 19_399_000 picoseconds. + Weight::from_parts(19_658_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -214,10 +215,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 20_053_000 picoseconds. - Weight::from_parts(23_080_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 19_300_000 picoseconds. + Weight::from_parts(19_511_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -227,8 +228,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 15_569_000 picoseconds. - Weight::from_parts(16_658_000, 0) + // Minimum execution time: 14_407_000 picoseconds. + Weight::from_parts(14_748_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -239,8 +240,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 15_350_000 picoseconds. - Weight::from_parts(15_771_000, 0) + // Minimum execution time: 14_376_000 picoseconds. + Weight::from_parts(14_785_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -254,10 +255,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `356` - // Estimated: `7160` - // Minimum execution time: 23_564_000 picoseconds. - Weight::from_parts(24_005_000, 0) - .saturating_add(Weight::from_parts(0, 7160)) + // Estimated: `3643` + // Minimum execution time: 22_832_000 picoseconds. + Weight::from_parts(23_065_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -267,8 +268,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 16_165_000 picoseconds. - Weight::from_parts(16_482_000, 0) + // Minimum execution time: 15_379_000 picoseconds. + Weight::from_parts(15_798_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -281,8 +282,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 18_377_000 picoseconds. - Weight::from_parts(19_060_000, 0) + // Minimum execution time: 17_345_000 picoseconds. + Weight::from_parts(17_747_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -296,10 +297,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `10932` - // Minimum execution time: 39_403_000 picoseconds. - Weight::from_parts(39_925_000, 0) - .saturating_add(Weight::from_parts(0, 10932)) + // Estimated: `3652` + // Minimum execution time: 40_047_000 picoseconds. + Weight::from_parts(40_494_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -312,10 +313,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `756` - // Estimated: `10932` - // Minimum execution time: 36_786_000 picoseconds. - Weight::from_parts(37_558_000, 0) - .saturating_add(Weight::from_parts(0, 10932)) + // Estimated: `3652` + // Minimum execution time: 39_254_000 picoseconds. + Weight::from_parts(39_689_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -326,10 +327,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `348` - // Estimated: `7295` - // Minimum execution time: 30_327_000 picoseconds. - Weight::from_parts(30_769_000, 0) - .saturating_add(Weight::from_parts(0, 7295)) + // Estimated: `3652` + // Minimum execution time: 31_189_000 picoseconds. + Weight::from_parts(31_431_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -340,10 +341,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `7295` - // Minimum execution time: 29_756_000 picoseconds. - Weight::from_parts(31_077_000, 0) - .saturating_add(Weight::from_parts(0, 7295)) + // Estimated: `3652` + // Minimum execution time: 31_868_000 picoseconds. + Weight::from_parts(32_476_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -354,10 +355,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `7275` - // Minimum execution time: 29_811_000 picoseconds. - Weight::from_parts(30_220_000, 0) - .saturating_add(Weight::from_parts(0, 7275)) + // Estimated: `3643` + // Minimum execution time: 32_587_000 picoseconds. + Weight::from_parts(32_913_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -368,10 +369,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `7275` - // Minimum execution time: 27_708_000 picoseconds. - Weight::from_parts(28_309_000, 0) - .saturating_add(Weight::from_parts(0, 7275)) + // Estimated: `3643` + // Minimum execution time: 30_951_000 picoseconds. + Weight::from_parts(31_269_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -382,10 +383,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 21_525_000 picoseconds. - Weight::from_parts(21_784_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 20_550_000 picoseconds. + Weight::from_parts(20_880_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -396,10 +397,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `461` - // Estimated: `7230` - // Minimum execution time: 21_605_000 picoseconds. - Weight::from_parts(21_805_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 20_593_000 picoseconds. + Weight::from_parts(20_816_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -409,8 +410,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3517` - // Minimum execution time: 17_046_000 picoseconds. - Weight::from_parts(17_387_000, 0) + // Minimum execution time: 16_290_000 picoseconds. + Weight::from_parts(16_841_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -422,10 +423,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `7132` - // Minimum execution time: 18_453_000 picoseconds. - Weight::from_parts(18_716_000, 0) - .saturating_add(Weight::from_parts(0, 7132)) + // Estimated: `3643` + // Minimum execution time: 17_538_000 picoseconds. + Weight::from_parts(17_775_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -437,8 +438,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `259` // Estimated: `3587` - // Minimum execution time: 17_965_000 picoseconds. - Weight::from_parts(18_347_000, 0) + // Minimum execution time: 17_311_000 picoseconds. + Weight::from_parts(17_495_000, 0) .saturating_add(Weight::from_parts(0, 3587)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -454,10 +455,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `540` - // Estimated: `10784` - // Minimum execution time: 38_974_000 picoseconds. - Weight::from_parts(39_420_000, 0) - .saturating_add(Weight::from_parts(0, 10784)) + // Estimated: `3643` + // Minimum execution time: 37_556_000 picoseconds. + Weight::from_parts(38_050_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_utility.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_utility.rs index d14fdba6fad..585bb7d7807 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_utility.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_utility.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_utility`. pub struct WeightInfo(PhantomData); @@ -52,18 +53,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_357_000 picoseconds. - Weight::from_parts(16_071_177, 0) + // Minimum execution time: 7_223_000 picoseconds. + Weight::from_parts(9_533_894, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_492 - .saturating_add(Weight::from_parts(5_041_311, 0).saturating_mul(c.into())) + // Standard Error: 1_912 + .saturating_add(Weight::from_parts(4_539_292, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_903_000 picoseconds. - Weight::from_parts(6_075_000, 0) + // Minimum execution time: 5_345_000 picoseconds. + Weight::from_parts(5_436_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -71,18 +72,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_616_000 picoseconds. - Weight::from_parts(17_676_240, 0) + // Minimum execution time: 7_096_000 picoseconds. + Weight::from_parts(10_872_600, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_274 - .saturating_add(Weight::from_parts(5_358_895, 0).saturating_mul(c.into())) + // Standard Error: 2_654 + .saturating_add(Weight::from_parts(4_834_319, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_072_000 picoseconds. - Weight::from_parts(10_405_000, 0) + // Minimum execution time: 9_519_000 picoseconds. + Weight::from_parts(9_776_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -90,10 +91,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_207_000 picoseconds. - Weight::from_parts(18_974_639, 0) + // Minimum execution time: 7_149_000 picoseconds. + Weight::from_parts(17_125_597, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_301 - .saturating_add(Weight::from_parts(5_025_161, 0).saturating_mul(c.into())) + // Standard Error: 3_120 + .saturating_add(Weight::from_parts(4_553_744, 0).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs index 32f1d1cd687..a8e6dfaa951 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn send() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `9595` - // Minimum execution time: 27_505_000 picoseconds. - Weight::from_parts(27_841_000, 0) - .saturating_add(Weight::from_parts(0, 9595)) + // Estimated: `3503` + // Minimum execution time: 26_503_000 picoseconds. + Weight::from_parts(26_786_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +74,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1489` - // Minimum execution time: 27_156_000 picoseconds. - Weight::from_parts(27_641_000, 0) + // Minimum execution time: 25_005_000 picoseconds. + Weight::from_parts(25_355_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -84,8 +85,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1489` - // Minimum execution time: 20_954_000 picoseconds. - Weight::from_parts(21_381_000, 0) + // Minimum execution time: 19_585_000 picoseconds. + Weight::from_parts(19_921_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -105,8 +106,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_560_000 picoseconds. - Weight::from_parts(10_752_000, 0) + // Minimum execution time: 9_923_000 picoseconds. + Weight::from_parts(10_123_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -116,8 +117,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_451_000 picoseconds. - Weight::from_parts(3_580_000, 0) + // Minimum execution time: 3_048_000 picoseconds. + Weight::from_parts(3_226_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -140,10 +141,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `14659` - // Minimum execution time: 33_607_000 picoseconds. - Weight::from_parts(33_917_000, 0) - .saturating_add(Weight::from_parts(0, 14659)) + // Estimated: `3503` + // Minimum execution time: 30_761_000 picoseconds. + Weight::from_parts(31_177_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -164,19 +165,21 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `220` - // Estimated: `14410` - // Minimum execution time: 35_300_000 picoseconds. - Weight::from_parts(35_783_000, 0) - .saturating_add(Weight::from_parts(0, 14410)) + // Estimated: `3685` + // Minimum execution time: 33_124_000 picoseconds. + Weight::from_parts(33_531_000, 0) + .saturating_add(Weight::from_parts(0, 3685)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) fn force_suspension() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_451_000 picoseconds. - Weight::from_parts(3_580_000, 0) + // Minimum execution time: 3_119_000 picoseconds. + Weight::from_parts(3_353_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -186,8 +189,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `95` // Estimated: `10985` - // Minimum execution time: 15_664_000 picoseconds. - Weight::from_parts(15_908_000, 0) + // Minimum execution time: 14_497_000 picoseconds. + Weight::from_parts(14_785_000, 0) .saturating_add(Weight::from_parts(0, 10985)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -198,8 +201,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `99` // Estimated: `10989` - // Minimum execution time: 15_376_000 picoseconds. - Weight::from_parts(15_780_000, 0) + // Minimum execution time: 14_846_000 picoseconds. + Weight::from_parts(15_064_000, 0) .saturating_add(Weight::from_parts(0, 10989)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -210,8 +213,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `13471` - // Minimum execution time: 15_898_000 picoseconds. - Weight::from_parts(16_159_000, 0) + // Minimum execution time: 15_346_000 picoseconds. + Weight::from_parts(15_580_000, 0) .saturating_add(Weight::from_parts(0, 13471)) .saturating_add(T::DbWeight::get().reads(5)) } @@ -230,10 +233,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_current_targets() -> Weight { // Proof Size summary in bytes: // Measured: `106` - // Estimated: `15981` - // Minimum execution time: 31_267_000 picoseconds. - Weight::from_parts(31_635_000, 0) - .saturating_add(Weight::from_parts(0, 15981)) + // Estimated: `6046` + // Minimum execution time: 29_631_000 picoseconds. + Weight::from_parts(30_224_000, 0) + .saturating_add(Weight::from_parts(0, 6046)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -243,8 +246,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `136` // Estimated: `8551` - // Minimum execution time: 8_659_000 picoseconds. - Weight::from_parts(8_983_000, 0) + // Minimum execution time: 8_203_000 picoseconds. + Weight::from_parts(8_380_000, 0) .saturating_add(Weight::from_parts(0, 8551)) .saturating_add(T::DbWeight::get().reads(3)) } @@ -254,8 +257,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `10996` - // Minimum execution time: 16_025_000 picoseconds. - Weight::from_parts(16_296_000, 0) + // Minimum execution time: 15_138_000 picoseconds. + Weight::from_parts(15_396_000, 0) .saturating_add(Weight::from_parts(0, 10996)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -275,10 +278,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: // Measured: `112` - // Estimated: `20967` - // Minimum execution time: 37_654_000 picoseconds. - Weight::from_parts(38_144_000, 0) - .saturating_add(Weight::from_parts(0, 20967)) + // Estimated: `11002` + // Minimum execution time: 34_941_000 picoseconds. + Weight::from_parts(35_810_000, 0) + .saturating_add(Weight::from_parts(0, 11002)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index 1b4a2bcfdd7..768f2b152cd 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for StatemintXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for StatemintXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 147a348b19d..d80e9ec335c 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -54,8 +54,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 23_489_000 picoseconds. - Weight::from_parts(23_993_000, 3593) + // Minimum execution time: 25_798_000 picoseconds. + Weight::from_parts(26_063_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +65,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 32_933_000 picoseconds. - Weight::from_parts(33_445_000, 6196) + // Minimum execution time: 48_637_000 picoseconds. + Weight::from_parts(49_176_000, 6196) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -87,9 +87,9 @@ impl WeightInfo { pub fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `139` - // Estimated: `17785` - // Minimum execution time: 56_285_000 picoseconds. - Weight::from_parts(56_858_000, 17785) + // Estimated: `6196` + // Minimum execution time: 69_969_000 picoseconds. + Weight::from_parts(70_663_000, 6196) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -97,8 +97,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_900_000 picoseconds. - Weight::from_parts(4_996_000, 0) + // Minimum execution time: 3_909_000 picoseconds. + Weight::from_parts(4_060_000, 0) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -106,8 +106,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 26_047_000 picoseconds. - Weight::from_parts(26_408_000, 3593) + // Minimum execution time: 26_306_000 picoseconds. + Weight::from_parts(26_822_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -128,9 +128,9 @@ impl WeightInfo { pub fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `14677` - // Minimum execution time: 48_997_000 picoseconds. - Weight::from_parts(49_605_000, 14677) + // Estimated: `3593` + // Minimum execution time: 48_829_000 picoseconds. + Weight::from_parts(49_277_000, 3593) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -149,9 +149,9 @@ impl WeightInfo { pub fn initiate_teleport() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `11084` - // Minimum execution time: 31_114_000 picoseconds. - Weight::from_parts(31_825_000, 11084) + // Estimated: `3503` + // Minimum execution time: 28_753_000 picoseconds. + Weight::from_parts(29_256_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index ca264e8fa17..f38bec29144 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 @@ -63,9 +63,9 @@ impl WeightInfo { pub fn report_holding() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `11084` - // Minimum execution time: 452_120_000 picoseconds. - Weight::from_parts(453_246_000, 11084) + // Estimated: `3503` + // Minimum execution time: 360_004_000 picoseconds. + Weight::from_parts(361_533_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +73,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_323_000 picoseconds. - Weight::from_parts(4_409_000, 0) + // Minimum execution time: 4_029_000 picoseconds. + Weight::from_parts(4_132_000, 0) } // Storage: PolkadotXcm Queries (r:1 w:0) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) @@ -82,58 +82,58 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `3497` - // Minimum execution time: 12_046_000 picoseconds. - Weight::from_parts(12_316_000, 3497) + // Minimum execution time: 10_802_000 picoseconds. + Weight::from_parts(10_932_000, 3497) .saturating_add(T::DbWeight::get().reads(1)) } pub fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_603_000 picoseconds. - Weight::from_parts(14_929_000, 0) + // Minimum execution time: 13_281_000 picoseconds. + Weight::from_parts(13_574_000, 0) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_461_000 picoseconds. - Weight::from_parts(4_655_000, 0) + // Minimum execution time: 4_257_000 picoseconds. + Weight::from_parts(4_394_000, 0) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_400_000 picoseconds. - Weight::from_parts(3_487_000, 0) + // Minimum execution time: 2_829_000 picoseconds. + Weight::from_parts(2_911_000, 0) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_337_000 picoseconds. - Weight::from_parts(3_403_000, 0) + // Minimum execution time: 2_881_000 picoseconds. + Weight::from_parts(2_964_000, 0) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_259_000 picoseconds. - Weight::from_parts(3_350_000, 0) + // Minimum execution time: 2_850_000 picoseconds. + Weight::from_parts(2_915_000, 0) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_292_000 picoseconds. - Weight::from_parts(4_471_000, 0) + // Minimum execution time: 3_663_000 picoseconds. + Weight::from_parts(3_745_000, 0) } pub fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_281_000 picoseconds. - Weight::from_parts(3_329_000, 0) + // Minimum execution time: 2_804_000 picoseconds. + Weight::from_parts(2_895_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -150,9 +150,9 @@ impl WeightInfo { pub fn report_error() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `11084` - // Minimum execution time: 26_054_000 picoseconds. - Weight::from_parts(26_386_000, 11084) + // Estimated: `3503` + // Minimum execution time: 24_558_000 picoseconds. + Weight::from_parts(24_983_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -162,8 +162,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `90` // Estimated: `3555` - // Minimum execution time: 16_413_000 picoseconds. - Weight::from_parts(16_590_000, 3555) + // Minimum execution time: 15_020_000 picoseconds. + Weight::from_parts(15_368_000, 3555) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -171,8 +171,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_314_000 picoseconds. - Weight::from_parts(3_410_000, 0) + // Minimum execution time: 2_954_000 picoseconds. + Weight::from_parts(3_028_000, 0) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -189,9 +189,9 @@ impl WeightInfo { pub fn subscribe_version() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `13098` - // Minimum execution time: 28_232_000 picoseconds. - Weight::from_parts(28_661_000, 13098) + // Estimated: `3503` + // Minimum execution time: 26_773_000 picoseconds. + Weight::from_parts(27_256_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -201,8 +201,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_517_000 picoseconds. - Weight::from_parts(5_596_000, 0) + // Minimum execution time: 4_896_000 picoseconds. + Weight::from_parts(5_044_000, 0) .saturating_add(T::DbWeight::get().writes(1)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -220,9 +220,9 @@ impl WeightInfo { pub fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `11084` - // Minimum execution time: 502_759_000 picoseconds. - Weight::from_parts(504_262_000, 11084) + // Estimated: `3503` + // Minimum execution time: 399_114_000 picoseconds. + Weight::from_parts(400_268_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -230,36 +230,36 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 157_990_000 picoseconds. - Weight::from_parts(158_216_000, 0) + // Minimum execution time: 122_318_000 picoseconds. + Weight::from_parts(122_649_000, 0) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 15_005_000 picoseconds. - Weight::from_parts(15_203_000, 0) + // Minimum execution time: 12_851_000 picoseconds. + Weight::from_parts(13_267_000, 0) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_475_000 picoseconds. - Weight::from_parts(3_522_000, 0) + // Minimum execution time: 2_886_000 picoseconds. + Weight::from_parts(2_954_000, 0) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_343_000 picoseconds. - Weight::from_parts(3_417_000, 0) + // Minimum execution time: 2_920_000 picoseconds. + Weight::from_parts(3_021_000, 0) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_519_000 picoseconds. - Weight::from_parts(3_625_000, 0) + // Minimum execution time: 3_184_000 picoseconds. + Weight::from_parts(3_236_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -276,9 +276,9 @@ impl WeightInfo { pub fn query_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `11084` - // Minimum execution time: 29_760_000 picoseconds. - Weight::from_parts(30_340_000, 11084) + // Estimated: `3503` + // Minimum execution time: 27_230_000 picoseconds. + Weight::from_parts(27_825_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -286,8 +286,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_732_000 picoseconds. - Weight::from_parts(5_858_000, 0) + // Minimum execution time: 5_273_000 picoseconds. + Weight::from_parts(5_359_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -304,9 +304,9 @@ impl WeightInfo { pub fn report_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `11084` - // Minimum execution time: 26_440_000 picoseconds. - Weight::from_parts(26_870_000, 11084) + // Estimated: `3503` + // Minimum execution time: 24_714_000 picoseconds. + Weight::from_parts(25_082_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -314,35 +314,35 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_334_000 picoseconds. - Weight::from_parts(3_408_000, 0) + // Minimum execution time: 2_817_000 picoseconds. + Weight::from_parts(2_880_000, 0) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_263_000 picoseconds. - Weight::from_parts(3_380_000, 0) + // Minimum execution time: 2_775_000 picoseconds. + Weight::from_parts(2_847_000, 0) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_338_000 picoseconds. - Weight::from_parts(3_388_000, 0) + // Minimum execution time: 2_806_000 picoseconds. + Weight::from_parts(2_869_000, 0) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_286_000 picoseconds. - Weight::from_parts(3_384_000, 0) + // Minimum execution time: 2_881_000 picoseconds. + Weight::from_parts(2_964_000, 0) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_494_000 picoseconds. - Weight::from_parts(3_563_000, 0) + // Minimum execution time: 2_985_000 picoseconds. + Weight::from_parts(3_087_000, 0) } } diff --git a/parachains/runtimes/assets/statemint/src/xcm_config.rs b/parachains/runtimes/assets/statemint/src/xcm_config.rs index 9d31bc0da60..82414a20a4b 100644 --- a/parachains/runtimes/assets/statemint/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemint/src/xcm_config.rs @@ -14,32 +14,31 @@ // limitations under the License. use super::{ - AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, ParachainInfo, - ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, + AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, ForeignAssets, + ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, TrustBackedAssetsInstance, WeightToFee, XcmpQueue, }; +use assets_common::matching::{ + FromSiblingParachain, IsForeignConcreteAsset, StartsWith, StartsWithExplicitGlobalConsensus, +}; use frame_support::{ match_types, parameter_types, traits::{ConstU32, Contains, Everything, Nothing, PalletInfoAccess}, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::{ - impls::ToStakingPot, - xcm_config::{ - AssetFeeAsExistentialDepositMultiplier, DenyReserveTransferToRelayChain, DenyThenTry, - }, -}; +use parachains_common::{impls::ToStakingPot, xcm_config::AssetFeeAsExistentialDepositMultiplier}; use polkadot_parachain::primitives::Sibling; use sp_runtime::traits::ConvertInto; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FungiblesAdapter, IsConcrete, LocalMint, NativeAsset, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, WeightInfoBounds, WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, + DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, + LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, + WeightInfoBounds, WithComputedOrigin, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -49,6 +48,7 @@ parameter_types! { pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); + pub UniversalLocationNetworkId: NetworkId = UniversalLocation::get().global_consensus().unwrap(); pub TrustBackedAssetsPalletLocation: MultiLocation = PalletInstance(::index() as u8).into(); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); @@ -102,8 +102,38 @@ pub type FungiblesTransactor = FungiblesAdapter< // The account to use for tracking teleports. CheckingAccount, >; + +/// `AssetId/Balance` converter for `TrustBackedAssets` +pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConvertedConcreteId< + ( + // Ignore `TrustBackedAssets` explicitly + StartsWith, + // Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means: + // - foreign assets from our consensus should be: `MultiLocation {parents: 1, X*(Parachain(xyz), ..)}` + // - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't be accepted here + StartsWithExplicitGlobalConsensus, + ), + Balance, +>; + +/// Means for transacting foreign assets from different global consensus. +pub type ForeignFungiblesTransactor = FungiblesAdapter< + // Use this fungibles implementation: + ForeignAssets, + // Use this currency when it is a fungible asset matching the given location or name: + ForeignAssetsConvertedConcreteId, + // Convert an XCM MultiLocation into a local account id: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, + // We dont need to check teleports here. + NoChecking, + // The account to use for tracking teleports. + CheckingAccount, +>; + /// Means for transacting assets on this chain. -pub type AssetTransactors = (CurrencyTransactor, FungiblesTransactor); +pub type AssetTransactors = (CurrencyTransactor, FungiblesTransactor, ForeignFungiblesTransactor); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can @@ -166,85 +196,150 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. } | - pallet_collator_selection::Call::set_invulnerables { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Assets( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Assets( + pallet_assets::Call::create { .. } | + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::ForeignAssets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Uniques( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Nfts( + pallet_nfts::Call::create { .. } | + pallet_nfts::Call::force_create { .. } | + pallet_nfts::Call::destroy { .. } | + pallet_nfts::Call::mint { .. } | + pallet_nfts::Call::force_mint { .. } | + pallet_nfts::Call::burn { .. } | + pallet_nfts::Call::transfer { .. } | + pallet_nfts::Call::lock_item_transfer { .. } | + pallet_nfts::Call::unlock_item_transfer { .. } | + pallet_nfts::Call::lock_collection { .. } | + pallet_nfts::Call::transfer_ownership { .. } | + pallet_nfts::Call::set_team { .. } | + pallet_nfts::Call::force_collection_owner { .. } | + pallet_nfts::Call::force_collection_config { .. } | + pallet_nfts::Call::approve_transfer { .. } | + pallet_nfts::Call::cancel_approval { .. } | + pallet_nfts::Call::clear_all_transfer_approvals { .. } | + pallet_nfts::Call::lock_item_properties { .. } | + pallet_nfts::Call::set_attribute { .. } | + pallet_nfts::Call::force_set_attribute { .. } | + pallet_nfts::Call::clear_attribute { .. } | + pallet_nfts::Call::approve_item_attributes { .. } | + pallet_nfts::Call::cancel_item_attributes_approval { .. } | + pallet_nfts::Call::set_metadata { .. } | + pallet_nfts::Call::clear_metadata { .. } | + pallet_nfts::Call::set_collection_metadata { .. } | + pallet_nfts::Call::clear_collection_metadata { .. } | + pallet_nfts::Call::set_accept_ownership { .. } | + pallet_nfts::Call::set_collection_max_supply { .. } | + pallet_nfts::Call::update_mint_settings { .. } | + pallet_nfts::Call::set_price { .. } | + pallet_nfts::Call::buy_item { .. } | + pallet_nfts::Call::pay_tips { .. } | + pallet_nfts::Call::create_swap { .. } | + pallet_nfts::Call::cancel_swap { .. } | + pallet_nfts::Call::claim_swap { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. }, + ) + ) } } @@ -287,7 +382,13 @@ impl xcm_executor::Config for XcmConfig { // Statemint acting _as_ a reserve location for DOT and assets created under `pallet-assets`. // For DOT, users must use teleport where allowed (e.g. with the Relay Chain). type IsReserve = (); - type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of DOT + // We allow: + // - teleportation of DOT + // - teleportation of sibling parachain's assets (as ForeignCreators) + type IsTeleporter = ( + NativeAsset, + IsForeignConcreteAsset>>, + ); type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< @@ -373,9 +474,26 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } + +pub type ForeignCreatorsSovereignAccountOf = ( + SiblingParachainConvertsVia, + AccountId32Aliases, + ParentIsPreset, +); + +/// Simple conversion of `u32` into an `AssetId` for use in benchmarking. +pub struct XcmBenchmarkHelper; +#[cfg(feature = "runtime-benchmarks")] +impl pallet_assets::BenchmarkHelper for XcmBenchmarkHelper { + fn create_asset_id_parameter(id: u32) -> MultiLocation { + MultiLocation { parents: 1, interior: X1(Parachain(id)) } + } +} diff --git a/parachains/runtimes/assets/statemint/tests/tests.rs b/parachains/runtimes/assets/statemint/tests/tests.rs index 7bbed6bb54a..bb4d52a1452 100644 --- a/parachains/runtimes/assets/statemint/tests/tests.rs +++ b/parachains/runtimes/assets/statemint/tests/tests.rs @@ -1,5 +1,5 @@ -use asset_test_utils::{ExtBuilder, RuntimeHelper}; -use codec::Decode; +use asset_test_utils::{CollatorSessionKeys, ExtBuilder, RuntimeHelper}; +use codec::{Decode, Encode}; use cumulus_primitives_utility::ChargeWeightInFungibles; use frame_support::{ assert_noop, assert_ok, @@ -11,21 +11,30 @@ use parachains_common::{ }; use statemint_runtime::xcm_config::{ AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount, DotLocation, - TrustBackedAssetsPalletLocation, + ForeignCreatorsSovereignAccountOf, TrustBackedAssetsPalletLocation, XcmConfig, }; pub use statemint_runtime::{ - constants::fee::WeightToFee, xcm_config::XcmConfig, AssetDeposit, Assets, Balances, - ExistentialDeposit, ParachainSystem, Runtime, RuntimeEvent, SessionKeys, System, - TrustBackedAssetsInstance, + constants::fee::WeightToFee, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets, + ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, Runtime, + RuntimeCall, RuntimeEvent, SessionKeys, System, TrustBackedAssetsInstance, }; use xcm::latest::prelude::*; -use xcm_executor::traits::{Convert, WeightTrader}; +use xcm_executor::traits::{Convert, Identity, JustTry, WeightTrader}; const ALICE: [u8; 32] = [1u8; 32]; +const SOME_ASSET_ADMIN: [u8; 32] = [5u8; 32]; type AssetIdForTrustBackedAssetsConvert = assets_common::AssetIdForTrustBackedAssetsConvert; +fn collator_session_keys() -> CollatorSessionKeys { + CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) }, + ) +} + #[test] fn test_asset_xcm_trader() { ExtBuilder::::default() @@ -80,19 +89,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -156,7 +162,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -233,7 +239,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -286,11 +292,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); @@ -385,9 +391,15 @@ fn test_assets_balances_api_works() { .build() .execute_with(|| { let local_asset_id = 1; + let foreign_asset_id_multilocation = + MultiLocation { parents: 1, interior: X2(Parachain(1234), GeneralIndex(12345)) }; // check before assert_eq!(Assets::balance(local_asset_id, AccountId::from(ALICE)), 0); + assert_eq!( + ForeignAssets::balance(foreign_asset_id_multilocation, AccountId::from(ALICE)), + 0 + ); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), 0); assert!(Runtime::query_account_balances(AccountId::from(ALICE)) .unwrap() @@ -418,18 +430,40 @@ fn test_assets_balances_api_works() { minimum_asset_balance )); + // create foreign asset + let foreign_asset_minimum_asset_balance = 3333333_u128; + assert_ok!(ForeignAssets::force_create( + RuntimeHelper::::root_origin(), + foreign_asset_id_multilocation, + AccountId::from(SOME_ASSET_ADMIN).into(), + false, + foreign_asset_minimum_asset_balance + )); + + // We first mint enough asset for the account to exist for assets + assert_ok!(ForeignAssets::mint( + RuntimeHelper::::origin_of(AccountId::from(SOME_ASSET_ADMIN)), + foreign_asset_id_multilocation, + AccountId::from(ALICE).into(), + 6 * foreign_asset_minimum_asset_balance + )); + // check after assert_eq!( Assets::balance(local_asset_id, AccountId::from(ALICE)), minimum_asset_balance ); + assert_eq!( + ForeignAssets::balance(foreign_asset_id_multilocation, AccountId::from(ALICE)), + 6 * minimum_asset_balance + ); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), some_currency); let result: MultiAssets = Runtime::query_account_balances(AccountId::from(ALICE)) .unwrap() .try_into() .unwrap(); - assert_eq!(result.len(), 2); + assert_eq!(result.len(), 3); // check currency assert!(result.inner().iter().any(|asset| asset.eq( @@ -444,6 +478,12 @@ fn test_assets_balances_api_works() { minimum_asset_balance ) .into()))); + // check foreign asset + assert!(result.inner().iter().any(|asset| asset.eq(&( + Identity::reverse_ref(foreign_asset_id_multilocation).unwrap(), + 6 * foreign_asset_minimum_asset_balance + ) + .into()))); }); } @@ -453,11 +493,7 @@ asset_test_utils::include_teleports_for_native_asset_works!( CheckingAccount, WeightToFee, ParachainSystem, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|runtime_event_encoded: Vec| { match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { @@ -474,37 +510,119 @@ asset_test_utils::include_teleports_for_native_asset_works!( 1000 ); -asset_test_utils::include_asset_transactor_transfer_with_local_consensus_currency_works!( +asset_test_utils::include_teleports_for_foreign_assets_works!( Runtime, XcmConfig, + CheckingAccount, + WeightToFee, + ParachainSystem, + ForeignCreatorsSovereignAccountOf, + ForeignAssetsInstance, asset_test_utils::CollatorSessionKeys::new( AccountId::from(ALICE), AccountId::from(ALICE), SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) } ), ExistentialDeposit::get(), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }) +); + +asset_test_utils::include_asset_transactor_transfer_with_local_consensus_currency_works!( + Runtime, + XcmConfig, + collator_session_keys(), + ExistentialDeposit::get(), Box::new(|| { assert!(Assets::asset_ids().collect::>().is_empty()); + assert!(ForeignAssets::asset_ids().collect::>().is_empty()); }), Box::new(|| { assert!(Assets::asset_ids().collect::>().is_empty()); + assert!(ForeignAssets::asset_ids().collect::>().is_empty()); }) ); asset_test_utils::include_asset_transactor_transfer_with_pallet_assets_instance_works!( - asset_transactor_transfer_with_pallet_assets_instance_works, + asset_transactor_transfer_with_trust_backed_assets_works, Runtime, XcmConfig, TrustBackedAssetsInstance, AssetIdForTrustBackedAssets, AssetIdForTrustBackedAssetsConvert, + collator_session_keys(), + ExistentialDeposit::get(), + 12345, + Box::new(|| { + assert!(ForeignAssets::asset_ids().collect::>().is_empty()); + }), + Box::new(|| { + assert!(ForeignAssets::asset_ids().collect::>().is_empty()); + }) +); + +asset_test_utils::include_asset_transactor_transfer_with_pallet_assets_instance_works!( + asset_transactor_transfer_with_foreign_assets_works, + Runtime, + XcmConfig, + ForeignAssetsInstance, + MultiLocation, + JustTry, asset_test_utils::CollatorSessionKeys::new( AccountId::from(ALICE), AccountId::from(ALICE), SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) } ), ExistentialDeposit::get(), - 12345, - Box::new(|| {}), - Box::new(|| {}) + MultiLocation { parents: 1, interior: X2(Parachain(1313), GeneralIndex(12345)) }, + Box::new(|| { + assert!(Assets::asset_ids().collect::>().is_empty()); + }), + Box::new(|| { + assert!(Assets::asset_ids().collect::>().is_empty()); + }) +); + +asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_parachain_assets_works!( + Runtime, + XcmConfig, + WeightToFee, + ForeignCreatorsSovereignAccountOf, + ForeignAssetsInstance, + MultiLocation, + JustTry, + asset_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) } + ), + ExistentialDeposit::get(), + AssetDeposit::get(), + MetadataDepositBase::get(), + MetadataDepositPerByte::get(), + Box::new(|pallet_asset_call| RuntimeCall::ForeignAssets(pallet_asset_call).encode()), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::ForeignAssets(pallet_asset_event)) => Some(pallet_asset_event), + _ => None, + } + }), + Box::new(|| { + assert!(Assets::asset_ids().collect::>().is_empty()); + assert!(ForeignAssets::asset_ids().collect::>().is_empty()); + }), + Box::new(|| { + assert!(Assets::asset_ids().collect::>().is_empty()); + assert_eq!(ForeignAssets::asset_ids().collect::>().len(), 1); + }) ); diff --git a/parachains/runtimes/assets/test-utils/Cargo.toml b/parachains/runtimes/assets/test-utils/Cargo.toml index b6406cbb5c9..9f951b06c96 100644 --- a/parachains/runtimes/assets/test-utils/Cargo.toml +++ b/parachains/runtimes/assets/test-utils/Cargo.toml @@ -32,9 +32,11 @@ cumulus-primitives-parachain-inherent = { path = "../../../../primitives/paracha cumulus-test-relay-sproof-builder = { path = "../../../../test/relay-sproof-builder", default-features = false } parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } pallet-bridge-transfer = { path = "../../../pallets/bridge-transfer", default-features = false } +parachains-runtimes-test-utils = { path = "../../test-utils", default-features = false } # Polkadot xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } @@ -63,12 +65,14 @@ std = [ "assets-common/std", "parachains-common/std", "parachain-info/std", + "parachains-runtimes-test-utils/std", "polkadot-parachain/std", "sp-consensus-aura/std", "sp-io/std", "sp-runtime/std", "sp-std/std", "xcm/std", + "xcm-builder/std", "xcm-executor/std", "pallet-bridge-transfer/std", "cumulus-pallet-xcmp-queue/std", diff --git a/parachains/runtimes/assets/test-utils/src/lib.rs b/parachains/runtimes/assets/test-utils/src/lib.rs index db5e28fc255..9a24867592e 100644 --- a/parachains/runtimes/assets/test-utils/src/lib.rs +++ b/parachains/runtimes/assets/test-utils/src/lib.rs @@ -1,439 +1,20 @@ -use codec::DecodeLimit; -use cumulus_primitives_core::{AbridgedHrmpChannel, ParaId, PersistedValidationData}; -use cumulus_primitives_parachain_inherent::ParachainInherentData; -use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; -use frame_support::{ - dispatch::{RawOrigin, UnfilteredDispatchable}, - inherent::{InherentData, ProvideInherent}, - traits::GenesisBuild, -}; -use sp_std::marker::PhantomData; +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. -use frame_support::{traits::OriginTrait, weights::Weight}; -use parachains_common::AccountId; -use polkadot_parachain::primitives::{HrmpChannelId, RelayChainBlockNumber, XcmpMessageFormat}; +// Cumulus 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. -use frame_support::dispatch::DispatchResult; -use sp_consensus_aura::AURA_ENGINE_ID; -use sp_core::Encode; -use sp_runtime::{Digest, DigestItem}; -use xcm::{ - latest::{MultiAsset, MultiLocation, XcmContext, XcmHash}, - prelude::*, - VersionedXcm, MAX_XCM_DECODE_DEPTH, -}; -use xcm_executor::{traits::TransactAsset, Assets}; +// Cumulus 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. -pub mod test_cases; -pub use test_cases::CollatorSessionKeys; - -pub type BalanceOf = ::Balance; -pub type AccountIdOf = ::AccountId; -pub type ValidatorIdOf = ::ValidatorId; -pub type SessionKeysOf = ::Keys; - -// Basic builder based on balances, collators and pallet_sessopm -pub struct ExtBuilder< - Runtime: frame_system::Config - + pallet_balances::Config - + pallet_session::Config - + pallet_xcm::Config - + parachain_info::Config, -> { - // endowed accounts with balances - balances: Vec<(AccountIdOf, BalanceOf)>, - // collators to test block prod - collators: Vec>, - // keys added to pallet session - keys: Vec<(AccountIdOf, ValidatorIdOf, SessionKeysOf)>, - // safe xcm version for pallet_xcm - safe_xcm_version: Option, - // para id - para_id: Option, - _runtime: PhantomData, -} - -impl< - Runtime: frame_system::Config - + pallet_balances::Config - + pallet_session::Config - + pallet_xcm::Config - + parachain_info::Config, - > Default for ExtBuilder -{ - fn default() -> ExtBuilder { - ExtBuilder { - balances: vec![], - collators: vec![], - keys: vec![], - safe_xcm_version: None, - para_id: None, - _runtime: PhantomData, - } - } -} - -impl< - Runtime: frame_system::Config - + pallet_balances::Config - + pallet_session::Config - + pallet_xcm::Config - + parachain_info::Config, - > ExtBuilder -{ - pub fn with_balances( - mut self, - balances: Vec<(AccountIdOf, BalanceOf)>, - ) -> Self { - self.balances = balances; - self - } - pub fn with_collators(mut self, collators: Vec>) -> Self { - self.collators = collators; - self - } - - pub fn with_session_keys( - mut self, - keys: Vec<(AccountIdOf, ValidatorIdOf, SessionKeysOf)>, - ) -> Self { - self.keys = keys; - self - } - - pub fn with_tracing(self) -> Self { - frame_support::sp_tracing::try_init_simple(); - self - } - - pub fn with_safe_xcm_version(mut self, safe_xcm_version: XcmVersion) -> Self { - self.safe_xcm_version = Some(safe_xcm_version); - self - } - - pub fn with_para_id(mut self, para_id: ParaId) -> Self { - self.para_id = Some(para_id); - self - } - - pub fn build(self) -> sp_io::TestExternalities - where - Runtime: - pallet_collator_selection::Config + pallet_balances::Config + pallet_session::Config, - ValidatorIdOf: From>, - { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: self.safe_xcm_version }, - &mut t, - ) - .unwrap(); - - if let Some(para_id) = self.para_id { - >::assimilate_storage( - ¶chain_info::GenesisConfig { parachain_id: para_id }, - &mut t, - ) - .unwrap(); - } - - pallet_balances::GenesisConfig:: { balances: self.balances.into() } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_collator_selection::GenesisConfig:: { - invulnerables: self.collators.clone().into(), - candidacy_bond: Default::default(), - desired_candidates: Default::default(), - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_session::GenesisConfig:: { keys: self.keys } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - - ext.execute_with(|| { - frame_system::Pallet::::set_block_number(1u32.into()); - }); - - ext - } -} +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . -pub struct RuntimeHelper(PhantomData); -/// Utility function that advances the chain to the desired block number. -/// If an author is provided, that author information is injected to all the blocks in the meantime. -impl RuntimeHelper -where - AccountIdOf: - Into<<::RuntimeOrigin as OriginTrait>::AccountId>, -{ - pub fn run_to_block(n: u32, author: Option) { - while frame_system::Pallet::::block_number() < n.into() { - // Set the new block number and author - match author { - Some(ref author) => { - let pre_digest = Digest { - logs: vec![DigestItem::PreRuntime(AURA_ENGINE_ID, author.encode())], - }; - frame_system::Pallet::::reset_events(); - frame_system::Pallet::::initialize( - &(frame_system::Pallet::::block_number() + 1u32.into()), - &frame_system::Pallet::::parent_hash(), - &pre_digest, - ); - }, - None => { - frame_system::Pallet::::set_block_number( - frame_system::Pallet::::block_number() + 1u32.into(), - ); - }, - } - } - } +//! Module contains predefined test-case scenarios for `Runtime` with various assets. - pub fn root_origin() -> ::RuntimeOrigin { - ::RuntimeOrigin::root() - } - - pub fn origin_of( - account_id: AccountIdOf, - ) -> ::RuntimeOrigin { - ::RuntimeOrigin::signed(account_id.into()) - } -} - -impl RuntimeHelper { - pub fn do_transfer( - from: MultiLocation, - to: MultiLocation, - (asset, amount): (MultiLocation, u128), - ) -> Result { - ::transfer_asset( - &MultiAsset { id: Concrete(asset), fun: Fungible(amount) }, - &from, - &to, - // We aren't able to track the XCM that initiated the fee deposit, so we create a - // fake message hash here - &XcmContext::with_message_hash([0; 32]), - ) - } -} - -impl RuntimeHelper { - pub fn do_teleport_assets( - origin: ::RuntimeOrigin, - dest: MultiLocation, - beneficiary: MultiLocation, - (asset, amount): (MultiLocation, u128), - open_hrmp_channel: Option<(u32, u32)>, - ) -> DispatchResult - where - HrmpChannelOpener: frame_support::inherent::ProvideInherent< - Call = cumulus_pallet_parachain_system::Call, - >, - { - // open hrmp (if needed) - if let Some((source_para_id, target_para_id)) = open_hrmp_channel { - mock_open_hrmp_channel::( - source_para_id.into(), - target_para_id.into(), - ); - } - - // do teleport - >::teleport_assets( - origin, - Box::new(dest.into()), - Box::new(beneficiary.into()), - Box::new((Concrete(asset), amount).into()), - 0, - ) - } -} - -impl - RuntimeHelper -{ - pub fn execute_as_governance(call: Vec, require_weight_at_most: Weight) -> Outcome { - // prepare xcm as governance will do - let xcm = Xcm(vec![ - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - Transact { - origin_kind: OriginKind::Superuser, - require_weight_at_most, - call: call.into(), - }, - ]); - - // execute xcm as parent origin - let hash = xcm.using_encoded(sp_io::hashing::blake2_256); - <::XcmExecutor>::execute_xcm( - MultiLocation::parent(), - xcm, - hash, - Self::xcm_max_weight(XcmReceivedFrom::Parent), - ) - } -} - -pub enum XcmReceivedFrom { - Parent, - Sibling, -} - -impl RuntimeHelper { - pub fn xcm_max_weight(from: XcmReceivedFrom) -> Weight { - use frame_support::traits::Get; - match from { - XcmReceivedFrom::Parent => ParachainSystem::ReservedDmpWeight::get(), - XcmReceivedFrom::Sibling => ParachainSystem::ReservedXcmpWeight::get(), - } - } -} - -impl RuntimeHelper { - pub fn assert_pallet_xcm_event_outcome( - unwrap_pallet_xcm_event: &Box) -> Option>>, - assert_outcome: fn(Outcome), - ) { - let outcome = >::events() - .into_iter() - .filter_map(|e| unwrap_pallet_xcm_event(e.event.encode())) - .find_map(|e| match e { - pallet_xcm::Event::Attempted(outcome) => Some(outcome), - _ => None, - }); - match outcome { - Some(outcome) => assert_outcome(outcome), - None => assert!(false, "No `pallet_xcm::Event::Attempted(outcome)` event found!"), - } - } -} - -impl RuntimeHelper { - pub fn xcmp_queue_message_sent( - unwrap_xcmp_queue_event: Box< - dyn Fn(Vec) -> Option>, - >, - ) -> Option { - >::events() - .into_iter() - .filter_map(|e| unwrap_xcmp_queue_event(e.event.encode())) - .find_map(|e| match e { - cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { message_hash } => message_hash, - _ => None, - }) - } -} - -pub fn assert_metadata( - asset_id: impl Into + Copy, - expected_name: &str, - expected_symbol: &str, - expected_decimals: u8, -) where - Fungibles: frame_support::traits::tokens::fungibles::metadata::Inspect - + frame_support::traits::tokens::fungibles::Inspect, -{ - assert_eq!(Fungibles::name(asset_id.into()), Vec::from(expected_name),); - assert_eq!(Fungibles::symbol(asset_id.into()), Vec::from(expected_symbol),); - assert_eq!(Fungibles::decimals(asset_id.into()), expected_decimals); -} - -pub fn assert_total( - asset_id: impl Into + Copy, - expected_total_issuance: impl Into, - expected_active_issuance: impl Into, -) where - Fungibles: frame_support::traits::tokens::fungibles::metadata::Inspect - + frame_support::traits::tokens::fungibles::Inspect, -{ - assert_eq!(Fungibles::total_issuance(asset_id.into()), expected_total_issuance.into()); - assert_eq!(Fungibles::active_issuance(asset_id.into()), expected_active_issuance.into()); -} - -/// Helper function which emulates opening HRMP channel which is needed for `XcmpQueue` to pass -pub fn mock_open_hrmp_channel< - C: cumulus_pallet_parachain_system::Config, - T: ProvideInherent>, ->( - sender: ParaId, - recipient: ParaId, -) { - let n = 1_u32; - let mut sproof_builder = RelayStateSproofBuilder::default(); - sproof_builder.para_id = sender; - sproof_builder.hrmp_channels.insert( - HrmpChannelId { sender, recipient }, - AbridgedHrmpChannel { - max_capacity: 10, - max_total_size: 10_000_000_u32, - max_message_size: 10_000_000_u32, - msg_count: 0, - total_size: 0_u32, - mqc_head: None, - }, - ); - sproof_builder.hrmp_egress_channel_index = Some(vec![recipient]); - - let (relay_parent_storage_root, relay_chain_state) = sproof_builder.into_state_root_and_proof(); - let vfp = PersistedValidationData { - relay_parent_number: n as RelayChainBlockNumber, - relay_parent_storage_root, - ..Default::default() - }; - // It is insufficient to push the validation function params - // to storage; they must also be included in the inherent data. - let inherent_data = { - let mut inherent_data = InherentData::default(); - let system_inherent_data = ParachainInherentData { - validation_data: vfp.clone(), - relay_chain_state, - downward_messages: Default::default(), - horizontal_messages: Default::default(), - }; - inherent_data - .put_data( - cumulus_primitives_parachain_inherent::INHERENT_IDENTIFIER, - &system_inherent_data, - ) - .expect("failed to put VFP inherent"); - inherent_data - }; - - // execute the block - T::create_inherent(&inherent_data) - .expect("got an inherent") - .dispatch_bypass_filter(RawOrigin::None.into()) - .expect("dispatch succeeded"); -} - -impl - RuntimeHelper -{ - pub fn take_xcm(sent_to_para_id: ParaId) -> Option> { - match HrmpChannelSource::take_outbound_messages(10)[..] { - [(para_id, ref mut xcm_message_data)] if para_id.eq(&sent_to_para_id.into()) => { - let mut xcm_message_data = &xcm_message_data[..]; - // decode - let _ = XcmpMessageFormat::decode_with_depth_limit( - MAX_XCM_DECODE_DEPTH, - &mut xcm_message_data, - ) - .expect("valid format"); - VersionedXcm::<()>::decode_with_depth_limit( - MAX_XCM_DECODE_DEPTH, - &mut xcm_message_data, - ) - .map(|x| Some(x)) - .expect("result with xcm") - }, - _ => return None, - } - } -} +pub mod test_cases; +pub use parachains_runtimes_test_utils::*; diff --git a/parachains/runtimes/assets/test-utils/src/test_cases.rs b/parachains/runtimes/assets/test-utils/src/test_cases.rs index fcb1bdbbbfa..8d58da85b74 100644 --- a/parachains/runtimes/assets/test-utils/src/test_cases.rs +++ b/parachains/runtimes/assets/test-utils/src/test_cases.rs @@ -15,57 +15,28 @@ //! Module contains predefined test-case scenarios for `Runtime` with various assets. -use crate::{ - assert_metadata, assert_total, mock_open_hrmp_channel, AccountIdOf, BalanceOf, ExtBuilder, - RuntimeHelper, SessionKeysOf, ValidatorIdOf, XcmReceivedFrom, -}; use codec::Encode; use cumulus_primitives_core::XcmpMessageSource; use frame_support::{ assert_noop, assert_ok, - traits::{fungibles::InspectEnumerable, Contains, Currency, Get, OriginTrait}, + traits::{ + fungibles::InspectEnumerable, Contains, Currency, Get, OriginTrait, ProcessMessageError, + }, weights::Weight, }; use parachains_common::Balance; +use parachains_runtimes_test_utils::{ + assert_metadata, assert_total, mock_open_hrmp_channel, AccountIdOf, BalanceOf, + CollatorSessionKeys, ExtBuilder, RuntimeHelper, ValidatorIdOf, XcmReceivedFrom, +}; use sp_runtime::{ traits::{StaticLookup, Zero}, DispatchError, Saturating, }; -use xcm::{ - latest::prelude::*, CreateMatcher, MatchXcm, VersionedMultiAsset, VersionedMultiAssets, - VersionedMultiLocation, -}; +use xcm::{latest::prelude::*, VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation}; +use xcm_builder::{CreateMatcher, MatchXcm}; use xcm_executor::{traits::Convert, XcmExecutor}; -pub struct CollatorSessionKeys< - Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config, -> { - collator: AccountIdOf, - validator: ValidatorIdOf, - key: SessionKeysOf, -} - -impl - CollatorSessionKeys -{ - pub fn new( - collator: AccountIdOf, - validator: ValidatorIdOf, - key: SessionKeysOf, - ) -> Self { - Self { collator, validator, key } - } - pub fn collators(&self) -> Vec> { - vec![self.collator.clone()] - } - - pub fn session_keys( - &self, - ) -> Vec<(AccountIdOf, ValidatorIdOf, SessionKeysOf)> { - vec![(self.collator.clone(), self.validator.clone(), self.key.clone())] - } -} - /// Test-case makes sure that `Runtime` can receive native asset from relay chain /// and can teleport it back and to the other parachains pub fn teleports_for_native_asset_works< @@ -138,7 +109,7 @@ pub fn teleports_for_native_asset_works< BuyExecution { fees: MultiAsset { id: Concrete(native_asset_id), - fun: Fungible(buy_execution_fee_amount_eta.into()), + fun: Fungible(buy_execution_fee_amount_eta), }, weight_limit: Limited(Weight::from_parts(303531000, 65536)), }, @@ -194,7 +165,7 @@ pub fn teleports_for_native_asset_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (native_asset_id, native_asset_to_teleport_away.clone().into()), + (native_asset_id, native_asset_to_teleport_away.into()), None, )); // check balances @@ -239,7 +210,7 @@ pub fn teleports_for_native_asset_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (native_asset_id, native_asset_to_teleport_away.clone().into()), + (native_asset_id, native_asset_to_teleport_away.into()), Some((runtime_para_id, other_para_id)), )); @@ -370,7 +341,7 @@ pub fn teleports_for_foreign_assets_works< WeightToFee::weight_to_fee(&Weight::from_parts(90_000_000_000, 0)); let buy_execution_fee = MultiAsset { id: Concrete(MultiLocation::parent()), - fun: Fungible(buy_execution_fee_amount.into()), + fun: Fungible(buy_execution_fee_amount), }; let teleported_foreign_asset_amount = 10000000000000; @@ -380,7 +351,7 @@ pub fn teleports_for_foreign_assets_works< .with_session_keys(collator_session_keys.session_keys()) .with_balances(vec![ ( - foreign_creator_as_account_id.clone(), + foreign_creator_as_account_id, existential_deposit + (buy_execution_fee_amount * 2).into(), ), (target_account.clone(), existential_deposit), @@ -445,7 +416,7 @@ pub fn teleports_for_foreign_assets_works< BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation::parent()), - fun: Fungible(buy_execution_fee_amount.into()), + fun: Fungible(buy_execution_fee_amount), }, weight_limit: Limited(Weight::from_parts(403531000, 65536)), }, @@ -540,7 +511,7 @@ pub fn teleports_for_foreign_assets_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (foreign_asset_id_multilocation, asset_to_teleport_away.clone().into()), + (foreign_asset_id_multilocation, asset_to_teleport_away), Some((runtime_para_id, foreign_para_id)), )); @@ -792,7 +763,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< .execute_with(|| { // create some asset class let asset_minimum_asset_balance = 3333333_u128; - let asset_id_as_multilocation = AssetIdConverter::reverse_ref(&asset_id).unwrap(); + let asset_id_as_multilocation = AssetIdConverter::reverse_ref(asset_id).unwrap(); assert_ok!(>::force_create( RuntimeHelper::::root_origin(), asset_id.into(), @@ -873,7 +844,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< id: charlie_account.clone().into() }), }, - (asset_id_as_multilocation, 1 * asset_minimum_asset_balance), + (asset_id_as_multilocation, asset_minimum_asset_balance), ), XcmError::FailedToTransactAsset(Into::<&str>::into( sp_runtime::TokenError::CannotCreate @@ -894,7 +865,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< parents: 0, interior: X1(AccountId32 { network: None, id: bob_account.clone().into() }), }, - (asset_id_as_multilocation, 1 * asset_minimum_asset_balance), + (asset_id_as_multilocation, asset_minimum_asset_balance), ), Ok(_) )); @@ -912,7 +883,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< asset_id.into(), &bob_account ), - (1 * asset_minimum_asset_balance).into() + asset_minimum_asset_balance.into() ); assert_eq!( >::balance( @@ -1135,7 +1106,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor // lets simulate this was triggered by relay chain from local consensus sibling parachain let xcm = Xcm(vec![ WithdrawAsset(buy_execution_fee.clone().into()), - BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited }, + BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited }, Transact { origin_kind: OriginKind::Xcm, require_weight_at_most: Weight::from_parts(40_000_000_000, 8000), @@ -1252,7 +1223,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor }); let xcm = Xcm(vec![ WithdrawAsset(buy_execution_fee.clone().into()), - BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited }, + BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited }, Transact { origin_kind: OriginKind::Xcm, require_weight_at_most: Weight::from_parts(20_000_000_000, 8000), @@ -1453,29 +1424,6 @@ pub fn can_governance_change_bridge_transfer_out_configuration { - #[test] - fn can_governance_change_bridge_transfer_out_configuration() { - $crate::test_cases::can_governance_change_bridge_transfer_out_configuration::< - $runtime, - $xcm_config, - >( - $collator_session_key, - $runtime_call_encode, - $unwrap_pallet_bridge_transfer_event, - ) - } - } -); - /// Test-case makes sure that `Runtime` can manage `bridge_transfer in` configuration by governance pub fn can_governance_change_bridge_transfer_in_configuration( collator_session_keys: CollatorSessionKeys, @@ -1540,29 +1488,6 @@ pub fn can_governance_change_bridge_transfer_in_configuration { - #[test] - fn can_governance_change_bridge_transfer_in_configuration() { - $crate::test_cases::can_governance_change_bridge_transfer_in_configuration::< - $runtime, - $xcm_config, - >( - $collator_session_key, - $runtime_call_encode, - $unwrap_pallet_bridge_transfer_event, - ) - } - } -); - /// Test-case makes sure that `Runtime` can initiate transfer of assets via bridge pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< Runtime, @@ -1618,8 +1543,6 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< let bridged_network = ByGenesis([6; 32]); let bridge_hub_para_id = 1013; let bridge_hub_location = (Parent, Parachain(bridge_hub_para_id)).into(); - let bridge_hub_account = LocationToAccountId::convert_ref(&bridge_hub_location) - .expect("BridgeHub's Sovereign account"); let target_location_from_different_consensus = MultiLocation::new(2, X2(GlobalConsensus(bridged_network), Parachain(1000))); let target_location_fee: MultiAsset = (MultiLocation::parent(), 1_000_000).into(); @@ -1629,6 +1552,9 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< allowed_target_location: target_location_from_different_consensus, max_target_location_fee: Some(target_location_fee.clone()), }; + let reserve_account = + LocationToAccountId::convert_ref(&target_location_from_different_consensus) + .expect("Sovereign account for reserves"); let balance_to_transfer = 1000_u128; let native_asset = MultiLocation::parent(); @@ -1644,9 +1570,9 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< &alice_account, alice_account_init_balance.clone(), ); - // SA needs to have at least ED, anyway making reserve fails + // SA of target location needs to have at least ED, anyway making reserve fails let _ = >::deposit_creating( - &bridge_hub_account, + &reserve_account, existential_deposit, ); @@ -1659,7 +1585,7 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< ); // SA has just ED assert_eq!( - >::free_balance(&bridge_hub_account), + >::free_balance(&reserve_account), existential_deposit ); @@ -1699,7 +1625,7 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< ); // check reserve account increased assert_eq!( - >::free_balance(&bridge_hub_account), + >::free_balance(&reserve_account), existential_deposit + balance_to_transfer.into() ); @@ -1712,35 +1638,37 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< pallet_bridge_transfer::Event::ReserveAssetsDeposited { .. } ))); let transfer_initiated_event = bridge_transfer_events.find_map(|e| match e { - pallet_bridge_transfer::Event::TransferInitiated { message_hash, sender_cost } => - Some((message_hash, sender_cost)), + pallet_bridge_transfer::Event::TransferInitiated { + message_id, + forwarded_message_id, + sender_cost, + } => Some((message_id, forwarded_message_id, sender_cost)), _ => None, }); - let xcm_hash = match transfer_initiated_event { - Some((message_hash, sender_cost)) => { - assert!(sender_cost.is_none()); - Some(message_hash) - }, - _ => { - assert!(false, "No `TransferInitiated` was fired"); - None - }, - }; + assert!(transfer_initiated_event.is_some()); + let (message_id, forwarded_message_id, sender_cost) = transfer_initiated_event.unwrap(); + // we expect UnpaidRemoteExporter + assert!(sender_cost.is_none()); - let mut xcmp_queue_events = >::events() + // check that xcm was sent + let xcm_sent_message_hash = >::events() .into_iter() - .filter_map(|e| unwrap_xcmp_queue_event(e.event.encode())); - let xcm_hash_sent = xcmp_queue_events.find_map(|e| match e { - cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { message_hash } => message_hash, - _ => None, - }); - assert_eq!(xcm_hash, xcm_hash_sent); + .filter_map(|e| unwrap_xcmp_queue_event(e.event.encode())) + .find_map(|e| match e { + cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { message_hash } => + Some(message_hash), + _ => None, + }); // read xcm - let xcm_sent = RuntimeHelper::::take_xcm(bridge_hub_para_id.into()); - assert!(xcm_sent.is_some()); - let mut xcm_sent: Xcm<()> = xcm_sent.unwrap().try_into().expect("versioned xcm"); - println!("{:?}", xcm_sent); + let xcm_sent = + RuntimeHelper::::take_xcm(bridge_hub_para_id.into()).unwrap(); + println!("xcm_sent: {:?}", xcm_sent); + assert_eq!( + xcm_sent_message_hash, + Some(xcm_sent.using_encoded(sp_io::hashing::blake2_256)) + ); + let mut xcm_sent: Xcm<()> = xcm_sent.try_into().expect("versioned xcm"); // check sent XCM ExportMessage to bridge-hub assert!(xcm_sent @@ -1751,7 +1679,7 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< UnpaidExecution { weight_limit, check_origin } if weight_limit == &Unlimited && check_origin.is_none() => Ok(()), - _ => Err(()), + _ => Err(ProcessMessageError::BadFormat), }) .expect("contains UnpaidExecution") .match_next_inst(|instr| match instr { @@ -1783,6 +1711,10 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< XcmConfig::UniversalLocation::get(), ) .expect("reanchored destination account"); + let universal_location_as_sovereign_account_on_target = + ::UniversalLocation::get() + .invert_target(&target_location_from_different_consensus) + .expect("invert_target Universal Location"); // match inner xcm assert!(inner_xcm @@ -1792,7 +1724,7 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< WithdrawAsset(fees) if fees == &MultiAssets::from(target_location_fee.clone()) => Ok(()), - _ => Err(()), + _ => Err(ProcessMessageError::BadFormat), }) .expect("contains WithdrawAsset") .match_next_inst(|next_instr| match next_instr { @@ -1800,75 +1732,67 @@ pub fn initiate_transfer_asset_via_bridge_for_native_asset_works< if fees == &target_location_fee && weight_limit == &Unlimited => Ok(()), - _ => Err(()), + _ => Err(ProcessMessageError::BadFormat), }) .expect("contains BuyExecution") .match_next_inst(|inner_xcm_instr| match inner_xcm_instr { ReserveAssetDeposited(ref deposited) if deposited.eq(&reanchored_assets) => Ok(()), - _ => Err(()), + _ => Err(ProcessMessageError::BadFormat), }) .expect("contains ReserveAssetDeposited") - .match_next_inst(|inner_xcm_instr| match inner_xcm_instr { - ClearOrigin => Ok(()), - _ => Err(()), - }) - .expect("contains ClearOrigin") .match_next_inst(|inner_xcm_instr| match inner_xcm_instr { DepositAsset { assets: filter, ref beneficiary } if filter == &MultiAssetFilter::from(reanchored_assets.clone()) && beneficiary.eq(&reanchored_destination_account) => Ok(()), - _ => Err(()), + _ => Err(ProcessMessageError::BadFormat), }) .expect("contains DepositAsset") + .match_next_inst(|inner_xcm_instr| match inner_xcm_instr { + RefundSurplus => Ok(()), + _ => Err(ProcessMessageError::BadFormat), + }) + .expect("contains RefundSurplus") + .match_next_inst(|inner_xcm_instr| { + match inner_xcm_instr { + DepositAsset { assets: filter, ref beneficiary } + if filter == + &MultiAssetFilter::from( + target_location_fee.clone(), + ) && beneficiary.eq( + &universal_location_as_sovereign_account_on_target, + ) => + Ok(()), + _ => Err(ProcessMessageError::BadFormat), + } + }) + .expect("contains DepositAsset") + .match_next_inst(|instr| match instr { + SetTopic(ref topic) if topic.eq(&message_id) => Ok(()), + _ => Err(ProcessMessageError::BadFormat), + }) + .expect("contains SetTopic") .assert_remaining_insts(0) .is_ok()); Ok(()) }, - _ => Err(()), + _ => Err(ProcessMessageError::BadFormat), }) + .expect("contains ExportMessage") + .match_next_inst(|instr| match instr { + SetTopic(ref topic) if topic.eq(&forwarded_message_id) => Ok(()), + _ => Err(ProcessMessageError::BadFormat), + }) + .expect("contains SetTopic") + .assert_remaining_insts(0) .is_ok()); }) } -#[macro_export] -macro_rules! include_initiate_transfer_asset_via_bridge_for_native_asset_works( - ( - $runtime:path, - $xcm_config:path, - $hrmp_channel_opener:path, - $hrmp_channel_source:path, - $location_to_account_id:path, - $collator_session_key:expr, - $existential_deposit:expr, - $unwrap_pallet_bridge_transfer_event:expr, - $unwrap_xcmp_queue_event:expr - ) => { - #[test] - fn initiate_transfer_asset_via_bridge_for_native_asset_works() { - const ALICE: [u8; 32] = [1u8; 32]; - let alice_account = parachains_common::AccountId::from(ALICE); - - $crate::test_cases::initiate_transfer_asset_via_bridge_for_native_asset_works::< - $runtime, - $xcm_config, - $hrmp_channel_opener, - $hrmp_channel_source, - $location_to_account_id - >( - $collator_session_key, - $existential_deposit, - alice_account, - $unwrap_pallet_bridge_transfer_event, - $unwrap_xcmp_queue_event - ) - } - } -); - +/// Test-case makes sure that `Runtime` can process `ReserveAssetDeposited`. pub fn receive_reserve_asset_deposited_from_different_consensus_works< Runtime, XcmConfig, @@ -1912,9 +1836,6 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works< parents: 2, interior: X2(GlobalConsensus(remote_network_id), Parachain(1000)), }; - let remote_parachain_sovereign_account = - LocationToAccountId::convert_ref(remote_parachain_as_origin) - .expect("Sovereign account works"); let foreign_asset_id_multilocation = MultiLocation { parents: 2, interior: X1(GlobalConsensus(remote_network_id)) }; let buy_execution_fee_amount = 50000000000; @@ -1926,18 +1847,21 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works< ExtBuilder::::default() .with_collators(collator_session_keys.collators()) .with_session_keys(collator_session_keys.session_keys()) - .with_balances(vec![ - ( - remote_parachain_sovereign_account.clone(), - existential_deposit + buy_execution_fee_amount.into(), - ), - (target_account.clone(), existential_deposit), - ]) + .with_balances(vec![(target_account.clone(), existential_deposit)]) .with_tracing() .build() .execute_with(|| { - // setup bridge transfer configuration + // drip SA for remote global parachain origin + let remote_parachain_sovereign_account = + LocationToAccountId::convert_ref(remote_parachain_as_origin) + .expect("Sovereign account works"); + assert_ok!(>::force_set_balance( + RuntimeHelper::::root_origin(), + remote_parachain_sovereign_account.clone().into(), + existential_deposit + buy_execution_fee_amount.into(), + )); + // setup bridge transfer configuration // add allowed univeral alias for remote network assert_ok!(>::add_universal_alias( RuntimeHelper::::root_origin(), @@ -1962,17 +1886,35 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works< ) ); + // we assume here that BuyExecution fee goes to staking pot + let staking_pot_account_id = >::account_id(); + let local_bridge_hub_multilocation_as_account_id = + LocationToAccountId::convert_ref(&local_bridge_hub_multilocation) + .expect("Correct AccountId"); + // check before - assert_eq!( + let remote_parachain_sovereign_account_balance_before = >::free_balance( - &remote_parachain_sovereign_account - ), + &remote_parachain_sovereign_account, + ); + assert_eq!( + remote_parachain_sovereign_account_balance_before, existential_deposit + buy_execution_fee_amount.into() ); assert_eq!( >::free_balance(&target_account), existential_deposit ); + assert_eq!( + >::free_balance( + &local_bridge_hub_multilocation_as_account_id + ), + 0.into() + ); + assert_eq!( + >::free_balance(&staking_pot_account_id), + 0.into() + ); assert_eq!( >::balance( foreign_asset_id_multilocation.into(), @@ -2005,7 +1947,6 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works< }), fun: Fungible(reserve_asset_deposisted), }])), - ClearOrigin, DepositAsset { assets: Definite(MultiAssets::from(vec![MultiAsset { id: Concrete(MultiLocation { @@ -2022,6 +1963,15 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works< }), }, }, + // return unspent weight back to SA of caller + RefundSurplus, + DepositAsset { + assets: Definite(MultiAssets::from(vec![MultiAsset { + id: Concrete(MultiLocation { parents: 1, interior: Here }), + fun: Fungible(buy_execution_fee_amount), + }])), + beneficiary: remote_parachain_as_origin, + }, ]); // origin as BridgeHub @@ -2039,15 +1989,28 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works< assert_eq!(outcome.ensure_complete(), Ok(())); // check after - assert!( + let staking_pot_balance = + >::free_balance(&staking_pot_account_id); + assert_eq!( >::free_balance( &remote_parachain_sovereign_account - ) < existential_deposit + buy_execution_fee_amount.into() + ), + remote_parachain_sovereign_account_balance_before - staking_pot_balance ); assert_eq!( >::free_balance(&target_account), existential_deposit ); + assert_eq!( + >::free_balance( + &local_bridge_hub_multilocation_as_account_id + ), + 0.into() + ); + assert_ne!( + >::free_balance(&staking_pot_account_id), + 0.into() + ); assert_eq!( >::balance( foreign_asset_id_multilocation.into(), @@ -2056,51 +2019,13 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works< reserve_asset_deposisted.into() ); - // check asset trap (because big buy fee) - let mut pallet_xcm_events = >::events() - .into_iter() - .filter_map(|e| unwrap_pallet_xcm_event(e.event.encode())); - assert!(pallet_xcm_events.any(|e| match e { - pallet_xcm::Event::AssetsTrapped(_, trapped_for, _) => { - assert_eq!( - trapped_for, origin, - "We expect trapped assets for origin: {:?}, but it is trapped for: {:?}", - origin, trapped_for - ); - true - }, - _ => false, - })); + // check NO asset trap occurred + assert_eq!( + false, + >::events() + .into_iter() + .filter_map(|e| unwrap_pallet_xcm_event(e.event.encode())) + .any(|e| matches!(e, pallet_xcm::Event::AssetsTrapped { .. })) + ); }) } - -#[macro_export] -macro_rules! include_receive_reserve_asset_deposited_from_different_consensus_works( - ( - $runtime:path, - $xcm_config:path, - $location_to_account_id:path, - $assets_pallet_instance:path, - $collator_session_key:expr, - $existential_deposit:expr, - $unwrap_pallet_xcm_event:expr - ) => { - #[test] - fn receive_reserve_asset_deposited_from_different_consensus_works() { - const BOB: [u8; 32] = [2u8; 32]; - let target_account = parachains_common::AccountId::from(BOB); - - $crate::test_cases::receive_reserve_asset_deposited_from_different_consensus_works::< - $runtime, - $xcm_config, - $location_to_account_id, - $assets_pallet_instance - >( - $collator_session_key, - $existential_deposit, - target_account, - $unwrap_pallet_xcm_event - ) - } - } -); diff --git a/parachains/runtimes/assets/westmint/Cargo.toml b/parachains/runtimes/assets/westmint/Cargo.toml index a7f9357cb64..5c9dc4a4c9f 100644 --- a/parachains/runtimes/assets/westmint/Cargo.toml +++ b/parachains/runtimes/assets/westmint/Cargo.toml @@ -9,7 +9,7 @@ description = "Westend variant of Statemint parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate @@ -26,6 +26,7 @@ pallet-aura = { git = "https://github.com/paritytech/substrate", default-feature pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-nft-fractionalization = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-nfts = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-nfts-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -92,6 +93,7 @@ runtime-benchmarks = [ "pallet-assets/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", + "pallet-nft-fractionalization/runtime-benchmarks", "pallet-nfts/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", @@ -101,6 +103,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "pallet-xcm-benchmarks/runtime-benchmarks", @@ -123,6 +126,7 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-collator-selection/try-runtime", "pallet-multisig/try-runtime", + "pallet-nft-fractionalization/try-runtime", "pallet-nfts/try-runtime", "pallet-proxy/try-runtime", "pallet-session/try-runtime", @@ -148,6 +152,7 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-multisig/std", + "pallet-nft-fractionalization/std", "pallet-nfts/std", "pallet-nfts-runtime-api/std", "pallet-proxy/std", diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index 1543c564184..09597cbbc47 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -54,7 +54,7 @@ use frame_support::{ InstanceFilter, }, weights::{ConstantMultiplier, Weight}, - PalletId, RuntimeDebug, + BoundedVec, PalletId, RuntimeDebug, }; use frame_system::{ limits::{BlockLength, BlockWeights}, @@ -80,9 +80,13 @@ use assets_common::{ foreign_creators::ForeignCreators, matching::FromSiblingParachain, MultiLocationForAssetId, }; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; +use xcm_builder::EnsureXcmOrigin; use xcm_executor::XcmExecutor; -use crate::xcm_config::{ForeignCreatorsSovereignAccountOf, UniversalLocation}; +use crate::xcm_config::{ + AssetTransactors, BridgeXcmSender, ForeignCreatorsSovereignAccountOf, LocalOriginToLocation, + UniversalLocation, +}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; impl_opaque_keys! { @@ -96,7 +100,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("westmint"), impl_name: create_runtime_str!("westmint"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 13, @@ -191,15 +195,15 @@ impl pallet_balances::Config for Runtime { type WeightInfo = weights::pallet_balances::WeightInfo; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; + type MaxHolds = ConstU32<1>; type MaxFreezes = ConstU32<0>; } parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -376,6 +380,7 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::Balances { .. } | RuntimeCall::Assets { .. } | + RuntimeCall::NftFractionalization { .. } | RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } ), @@ -391,6 +396,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets { .. } | RuntimeCall::Utility { .. } | RuntimeCall::Multisig { .. } | + RuntimeCall::NftFractionalization { .. } | RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } ) }, @@ -624,6 +630,32 @@ impl pallet_uniques::Config for Runtime { type Locker = (); } +parameter_types! { + pub const NftFractionalizationPalletId: PalletId = PalletId(*b"fraction"); + pub NewAssetSymbol: BoundedVec = (*b"FRAC").to_vec().try_into().unwrap(); + pub NewAssetName: BoundedVec = (*b"Frac").to_vec().try_into().unwrap(); +} + +impl pallet_nft_fractionalization::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Deposit = AssetDeposit; + type Currency = Balances; + type NewAssetSymbol = NewAssetSymbol; + type NewAssetName = NewAssetName; + type StringLimit = AssetsStringLimit; + type NftCollectionId = ::CollectionId; + type NftId = ::ItemId; + type AssetBalance = ::Balance; + type AssetId = >::AssetId; + type Assets = Assets; + type Nfts = Nfts; + type PalletId = NftFractionalizationPalletId; + type WeightInfo = pallet_nft_fractionalization::weights::SubstrateWeight; + type RuntimeHoldReason = RuntimeHoldReason; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + parameter_types! { pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); pub const NftsMaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS; @@ -671,20 +703,12 @@ impl pallet_bridge_transfer::Config for Runtime { type AdminOrigin = AssetsForceOrigin; type UniversalAliasesLimit = ConstU32<24>; type ReserveLocationsLimit = ConstU32<8>; - // no transfer allowed out (now) - type AssetTransactor = (); - // no transfer allowed out (now) - type BridgeXcmSender = (); - // no transfer allowed out (now) - type TransferAssetOrigin = - frame_support::traits::NeverEnsureOrigin; - // no transfer allowed out (now) - type MaxAssetsLimit = ConstU8<0>; - // no transfer allowed out (now) - type TransferPingOrigin = - frame_support::traits::NeverEnsureOrigin; - // no transfer allowed out (now) - type PingMessageBuilder = (); + type AssetTransactor = AssetTransactors; + type BridgeXcmSender = BridgeXcmSender; + type TransferAssetOrigin = EnsureXcmOrigin; + type MaxAssetsLimit = ConstU8<1>; + type TransferPingOrigin = EnsureXcmOrigin; + type PingMessageBuilder = pallet_bridge_transfer::UnpaidTrapMessageBuilder>; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = xcm_config::BridgeTransferBenchmarksHelper; } @@ -733,7 +757,8 @@ construct_runtime!( Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 51, Nfts: pallet_nfts::{Pallet, Call, Storage, Event} = 52, ForeignAssets: pallet_assets::::{Pallet, Call, Storage, Event} = 53, - BridgeTransfer: pallet_bridge_transfer::{Pallet, Call, Storage, Event} = 54, + NftFractionalization: pallet_nft_fractionalization::{Pallet, Call, Storage, Event, HoldReason} = 54, + BridgeTransfer: pallet_bridge_transfer::{Pallet, Call, Storage, Event} = 55, } ); @@ -759,10 +784,14 @@ pub type SignedExtra = ( /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; + /// Migrations to apply on runtime upgrade. -pub type Migrations = (pallet_nfts::migration::v1::MigrateToV1,); +pub type Migrations = ( + // v9420 + pallet_nfts::migration::v1::MigrateToV1, + // unreleased + pallet_collator_selection::migration::v1::MigrateToV1, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -786,6 +815,7 @@ mod benches { [pallet_assets, ForeignAssets] [pallet_balances, Balances] [pallet_multisig, Multisig] + [pallet_nft_fractionalization, NftFractionalization] [pallet_nfts, Nfts] [pallet_proxy, Proxy] [pallet_session, SessionBench::] @@ -1065,7 +1095,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -1100,7 +1130,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -1120,7 +1149,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( WestendLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(WestendLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(WestendLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; @@ -1135,7 +1164,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(WestendLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/assets/westmint/src/weights/cumulus_pallet_xcmp_queue.rs b/parachains/runtimes/assets/westmint/src/weights/cumulus_pallet_xcmp_queue.rs index b796e65485d..01d65b30b4a 100644 --- a/parachains/runtimes/assets/westmint/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/parachains/runtimes/assets/westmint/src/weights/cumulus_pallet_xcmp_queue.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_380_000 picoseconds. - Weight::from_parts(5_626_000, 0) + // Minimum execution time: 5_514_000 picoseconds. + Weight::from_parts(5_658_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_537_000 picoseconds. - Weight::from_parts(5_744_000, 0) + // Minimum execution time: 5_517_000 picoseconds. + Weight::from_parts(5_773_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/assets/westmint/src/weights/frame_system.rs b/parachains/runtimes/assets/westmint/src/weights/frame_system.rs index 9f0e1e43f56..2515235087d 100644 --- a/parachains/runtimes/assets/westmint/src/weights/frame_system.rs +++ b/parachains/runtimes/assets/westmint/src/weights/frame_system.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `frame_system`. pub struct WeightInfo(PhantomData); @@ -52,22 +53,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_150_000 picoseconds. - Weight::from_parts(2_242_000, 0) + // Minimum execution time: 2_250_000 picoseconds. + Weight::from_parts(2_324_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(368, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(367, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_810_000 picoseconds. - Weight::from_parts(7_949_000, 0) + // Minimum execution time: 7_617_000 picoseconds. + Weight::from_parts(7_744_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_408, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_399, 0).saturating_mul(b.into())) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -77,12 +78,15 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_446_000 picoseconds. - Weight::from_parts(4_769_000, 0) + // Minimum execution time: 4_491_000 picoseconds. + Weight::from_parts(4_652_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) + } /// Storage: Skipped Metadata (r:0 w:0) /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. @@ -90,11 +94,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_378_000 picoseconds. - Weight::from_parts(2_458_000, 0) + // Minimum execution time: 2_463_000 picoseconds. + Weight::from_parts(2_499_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_873 - .saturating_add(Weight::from_parts(680_971, 0).saturating_mul(i.into())) + // Standard Error: 1_952 + .saturating_add(Weight::from_parts(673_075, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -104,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_389_000 picoseconds. - Weight::from_parts(2_433_000, 0) + // Minimum execution time: 2_336_000 picoseconds. + Weight::from_parts(2_403_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 765 - .saturating_add(Weight::from_parts(502_307, 0).saturating_mul(i.into())) + // Standard Error: 792 + .saturating_add(Weight::from_parts(491_501, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -117,12 +121,12 @@ impl frame_system::WeightInfo for WeightInfo { fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `84 + p * (69 ±0)` - // Estimated: `75 + p * (70 ±0)` - // Minimum execution time: 4_077_000 picoseconds. - Weight::from_parts(4_196_000, 0) - .saturating_add(Weight::from_parts(0, 75)) - // Standard Error: 920 - .saturating_add(Weight::from_parts(1_004_901, 0).saturating_mul(p.into())) + // Estimated: `77 + p * (70 ±0)` + // Minimum execution time: 4_246_000 picoseconds. + Weight::from_parts(4_352_000, 0) + .saturating_add(Weight::from_parts(0, 77)) + // Standard Error: 1_010 + .saturating_add(Weight::from_parts(1_048_520, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/parachains/runtimes/assets/westmint/src/weights/mod.rs b/parachains/runtimes/assets/westmint/src/weights/mod.rs index 518bd88bc2e..cbebd04da2b 100644 --- a/parachains/runtimes/assets/westmint/src/weights/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/mod.rs @@ -7,6 +7,7 @@ pub mod pallet_balances; pub mod pallet_bridge_transfer; pub mod pallet_collator_selection; pub mod pallet_multisig; +pub mod pallet_nft_fractionalization; pub mod pallet_nfts; pub mod pallet_proxy; pub mod pallet_session; diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs index f08633cd2ba..75518b3ef41 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs @@ -443,4 +443,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_balances.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_balances.rs index acae356b1cb..865d674d6ce 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_balances.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_balances.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 35_470_000 picoseconds. - Weight::from_parts(36_170_000, 0) + // Minimum execution time: 52_618_000 picoseconds. + Weight::from_parts(53_260_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 26_173_000 picoseconds. - Weight::from_parts(26_636_000, 0) + // Minimum execution time: 39_969_000 picoseconds. + Weight::from_parts(40_584_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,8 +78,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_875_000 picoseconds. - Weight::from_parts(16_109_000, 0) + // Minimum execution time: 15_907_000 picoseconds. + Weight::from_parts(16_236_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -89,8 +90,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 18_726_000 picoseconds. - Weight::from_parts(19_101_000, 0) + // Minimum execution time: 22_839_000 picoseconds. + Weight::from_parts(23_138_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +102,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 37_080_000 picoseconds. - Weight::from_parts(37_562_000, 0) + // Minimum execution time: 53_986_000 picoseconds. + Weight::from_parts(54_583_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -113,25 +114,38 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 32_468_000 picoseconds. - Weight::from_parts(32_858_000, 0) + // Minimum execution time: 48_496_000 picoseconds. + Weight::from_parts(49_111_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn upgrade_accounts(_: u32) -> Weight { - Weight::from_parts(0, 0) - } fn force_unreserve() -> Weight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_725_000 picoseconds. - Weight::from_parts(14_926_000, 0) + // Minimum execution time: 18_457_000 picoseconds. + Weight::from_parts(18_719_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// 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]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (136 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 18_243_000 picoseconds. + Weight::from_parts(18_314_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 10_135 + .saturating_add(Weight::from_parts(13_980_773, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_bridge_transfer.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_bridge_transfer.rs index 23de590f2d1..e6ec448388c 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_bridge_transfer.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_bridge_transfer.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_bridge_transfer` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -41,28 +41,75 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_transfer`. pub struct WeightInfo(PhantomData); impl pallet_bridge_transfer::WeightInfo for WeightInfo { + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BridgeTransfer AllowedExporters (r:1 w:0) + /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) + /// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + /// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + /// 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:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem RelevantMessagingState (r:1 w:0) + /// Proof Skipped: ParachainSystem RelevantMessagingState (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpStatus (r:1 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpStatus (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpMessages (r:0 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured) fn transfer_asset_via_bridge() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `732` + // Estimated: `6208` + // Minimum execution time: 151_961_000 picoseconds. + Weight::from_parts(153_658_000, 0) + .saturating_add(Weight::from_parts(0, 6208)) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(8)) } + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BridgeTransfer AllowedExporters (r:1 w:0) + /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) + /// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + /// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem RelevantMessagingState (r:1 w:0) + /// Proof Skipped: ParachainSystem RelevantMessagingState (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpStatus (r:1 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpStatus (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpMessages (r:0 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured) fn ping_via_bridge() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 0_000 picoseconds. - Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `381` + // Estimated: `6002` + // Minimum execution time: 64_672_000 picoseconds. + Weight::from_parts(65_698_000, 0) + .saturating_add(Weight::from_parts(0, 6002)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: BridgeTransfer AllowedExporters (r:1 w:1) /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) @@ -71,10 +118,10 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< fn add_exporter_config() -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `7491` - // Minimum execution time: 15_704_000 picoseconds. - Weight::from_parts(16_139_000, 0) - .saturating_add(Weight::from_parts(0, 7491)) + // Estimated: `6002` + // Minimum execution time: 16_205_000 picoseconds. + Weight::from_parts(16_584_000, 0) + .saturating_add(Weight::from_parts(0, 6002)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,10 +129,10 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) fn remove_exporter_config() -> Weight { // Proof Size summary in bytes: - // Measured: `165` + // Measured: `175` // Estimated: `6002` - // Minimum execution time: 13_749_000 picoseconds. - Weight::from_parts(14_178_000, 0) + // Minimum execution time: 13_171_000 picoseconds. + Weight::from_parts(13_598_000, 0) .saturating_add(Weight::from_parts(0, 6002)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -94,10 +141,10 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< /// Proof: BridgeTransfer AllowedExporters (max_values: None, max_size: Some(2537), added: 5012, mode: MaxEncodedLen) fn update_exporter_config() -> Weight { // Proof Size summary in bytes: - // Measured: `165` + // Measured: `175` // Estimated: `6002` - // Minimum execution time: 18_664_000 picoseconds. - Weight::from_parts(18_982_000, 0) + // Minimum execution time: 16_666_000 picoseconds. + Weight::from_parts(16_847_000, 0) .saturating_add(Weight::from_parts(0, 6002)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -108,8 +155,8 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `109` // Estimated: `5884` - // Minimum execution time: 12_859_000 picoseconds. - Weight::from_parts(19_737_000, 0) + // Minimum execution time: 11_874_000 picoseconds. + Weight::from_parts(12_188_000, 0) .saturating_add(Weight::from_parts(0, 5884)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -120,8 +167,8 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `158` // Estimated: `5884` - // Minimum execution time: 15_939_000 picoseconds. - Weight::from_parts(16_245_000, 0) + // Minimum execution time: 15_103_000 picoseconds. + Weight::from_parts(15_497_000, 0) .saturating_add(Weight::from_parts(0, 5884)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -132,8 +179,8 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `109` // Estimated: `6302` - // Minimum execution time: 12_764_000 picoseconds. - Weight::from_parts(13_060_000, 0) + // Minimum execution time: 11_624_000 picoseconds. + Weight::from_parts(11_983_000, 0) .saturating_add(Weight::from_parts(0, 6302)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -144,8 +191,8 @@ impl pallet_bridge_transfer::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `141` // Estimated: `6302` - // Minimum execution time: 14_613_000 picoseconds. - Weight::from_parts(14_927_000, 0) + // Minimum execution time: 13_568_000 picoseconds. + Weight::from_parts(13_867_000, 0) .saturating_add(Weight::from_parts(0, 6302)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_collator_selection.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_collator_selection.rs index eaabe14f8b1..8b157d96d76 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_collator_selection.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_collator_selection` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collator_selection`. pub struct WeightInfo(PhantomData); @@ -56,11 +57,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `178 + b * (78 ±0)` // Estimated: `1168 + b * (2554 ±0)` - // Minimum execution time: 15_458_000 picoseconds. - Weight::from_parts(16_243_295, 0) + // Minimum execution time: 14_583_000 picoseconds. + Weight::from_parts(14_662_374, 0) .saturating_add(Weight::from_parts(0, 1168)) - // Standard Error: 3_682 - .saturating_add(Weight::from_parts(2_601_545, 0).saturating_mul(b.into())) + // Standard Error: 2_862 + .saturating_add(Weight::from_parts(2_576_034, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) @@ -71,8 +72,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_542_000 picoseconds. - Weight::from_parts(7_735_000, 0) + // Minimum execution time: 7_240_000 picoseconds. + Weight::from_parts(7_430_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,8 +83,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_344_000 picoseconds. - Weight::from_parts(7_660_000, 0) + // Minimum execution time: 7_517_000 picoseconds. + Weight::from_parts(7_704_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,12 +104,12 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn register_as_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1108 + c * (48 ±0)` - // Estimated: `61671 + c * (49 ±0)` - // Minimum execution time: 38_651_000 picoseconds. - Weight::from_parts(31_016_267, 0) - .saturating_add(Weight::from_parts(0, 61671)) - // Standard Error: 1_279 - .saturating_add(Weight::from_parts(106_148, 0).saturating_mul(c.into())) + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 42_001_000 picoseconds. + Weight::from_parts(34_741_590, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_220 + .saturating_add(Weight::from_parts(104_452, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) @@ -122,11 +123,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `469 + c * (48 ±0)` // Estimated: `49487` - // Minimum execution time: 27_474_000 picoseconds. - Weight::from_parts(18_915_300, 0) + // Minimum execution time: 31_537_000 picoseconds. + Weight::from_parts(23_342_837, 0) .saturating_add(Weight::from_parts(0, 49487)) - // Standard Error: 1_242 - .saturating_add(Weight::from_parts(107_733, 0).saturating_mul(c.into())) + // Standard Error: 1_210 + .saturating_add(Weight::from_parts(104_584, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,13 +140,46 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn note_author() -> Weight { // Proof Size summary in bytes: // Measured: `103` - // Estimated: `7729` - // Minimum execution time: 29_327_000 picoseconds. - Weight::from_parts(29_858_000, 0) - .saturating_add(Weight::from_parts(0, 7729)) + // Estimated: `6196` + // Minimum execution time: 42_787_000 picoseconds. + Weight::from_parts(43_339_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: CollatorSelection Candidates (r:1 w:0) /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(48002), added: 48497, mode: MaxEncodedLen) /// Storage: CollatorSelection LastAuthoredBlock (r:999 w:0) @@ -160,18 +194,18 @@ impl pallet_collator_selection::WeightInfo for WeightIn /// The range of component `c` is `[1, 1000]`. fn new_session(r: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `22693 + r * (116 ±0) + c * (97 ±0)` - // Estimated: `56697 + r * (2603 ±0) + c * (2520 ±0)` - // Minimum execution time: 17_185_000 picoseconds. - Weight::from_parts(17_436_000, 0) - .saturating_add(Weight::from_parts(0, 56697)) - // Standard Error: 795_522 - .saturating_add(Weight::from_parts(28_877_010, 0).saturating_mul(c.into())) + // Measured: `22693 + c * (97 ±0) + r * (116 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2603 ±0)` + // Minimum execution time: 17_395_000 picoseconds. + Weight::from_parts(17_530_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 848_373 + .saturating_add(Weight::from_parts(30_252_593, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into())) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_multisig.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_multisig.rs index b01f73c3007..a98f72512a0 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_multisig.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_multisig.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); @@ -52,11 +53,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_071_000 picoseconds. - Weight::from_parts(12_418_308, 0) + // Minimum execution time: 11_856_000 picoseconds. + Weight::from_parts(12_334_994, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(495, 0).saturating_mul(z.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(506, 0).saturating_mul(z.into())) } /// Storage: Multisig Multisigs (r:1 w:1) /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3346), added: 5821, mode: MaxEncodedLen) @@ -66,13 +67,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `262 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 37_454_000 picoseconds. - Weight::from_parts(31_908_123, 0) + // Minimum execution time: 41_975_000 picoseconds. + Weight::from_parts(35_772_064, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 637 - .saturating_add(Weight::from_parts(62_530, 0).saturating_mul(s.into())) - // Standard Error: 6 - .saturating_add(Weight::from_parts(1_217, 0).saturating_mul(z.into())) + // Standard Error: 481 + .saturating_add(Weight::from_parts(67_985, 0).saturating_mul(s.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_213, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -84,13 +85,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 27_665_000 picoseconds. - Weight::from_parts(21_985_439, 0) + // Minimum execution time: 28_065_000 picoseconds. + Weight::from_parts(22_550_479, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 509 - .saturating_add(Weight::from_parts(63_318, 0).saturating_mul(s.into())) - // Standard Error: 4 - .saturating_add(Weight::from_parts(1_187, 0).saturating_mul(z.into())) + // Standard Error: 333 + .saturating_add(Weight::from_parts(60_600, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_194, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,14 +104,14 @@ impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `385 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 42_985_000 picoseconds. - Weight::from_parts(35_504_175, 0) - .saturating_add(Weight::from_parts(0, 10404)) - // Standard Error: 530 - .saturating_add(Weight::from_parts(80_153, 0).saturating_mul(s.into())) + // Estimated: `6811` + // Minimum execution time: 47_059_000 picoseconds. + Weight::from_parts(39_787_186, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 556 + .saturating_add(Weight::from_parts(82_920, 0).saturating_mul(s.into())) // Standard Error: 5 - .saturating_add(Weight::from_parts(1_215, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(1_236, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -121,11 +122,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 28_498_000 picoseconds. - Weight::from_parts(30_376_601, 0) + // Minimum execution time: 31_979_000 picoseconds. + Weight::from_parts(33_915_067, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 785 - .saturating_add(Weight::from_parts(65_913, 0).saturating_mul(s.into())) + // Standard Error: 567 + .saturating_add(Weight::from_parts(72_232, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -136,11 +137,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 19_047_000 picoseconds. - Weight::from_parts(20_338_502, 0) + // Minimum execution time: 19_301_000 picoseconds. + Weight::from_parts(20_450_461, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 544 - .saturating_add(Weight::from_parts(66_876, 0).saturating_mul(s.into())) + // Standard Error: 407 + .saturating_add(Weight::from_parts(63_650, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -151,11 +152,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 29_085_000 picoseconds. - Weight::from_parts(31_283_618, 0) + // Minimum execution time: 32_846_000 picoseconds. + Weight::from_parts(34_842_187, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 985 - .saturating_add(Weight::from_parts(67_469, 0).saturating_mul(s.into())) + // Standard Error: 637 + .saturating_add(Weight::from_parts(71_046, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_nft_fractionalization.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_nft_fractionalization.rs new file mode 100644 index 00000000000..d8db24f50e6 --- /dev/null +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_nft_fractionalization.rs @@ -0,0 +1,63 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `pallet_nfts` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 + +// Executed Command: +// ./artifacts/polkadot-parachain +// benchmark +// pallet +// --chain=westmint-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet=pallet_nft_fractionalization +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/westmint/src/weights/pallet_nft_fractionalization.rs + +#![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_nfts`. +pub struct WeightInfo(PhantomData); +impl pallet_nft_fractionalization::WeightInfo for WeightInfo { + fn fractionalize() -> Weight { + // Minimum execution time: 44_312 nanoseconds. + Weight::from_parts(25_147_000, 3549) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + fn unify() -> Weight { + // Minimum execution time: 31_654 nanoseconds. + Weight::from_parts(25_147_000, 3549) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_nfts.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_nfts.rs index 904f7823041..437bbd74b77 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_nfts.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_nfts.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_nfts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_nfts`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn create() -> Weight { // Proof Size summary in bytes: // Measured: `145` - // Estimated: `5038` - // Minimum execution time: 34_344_000 picoseconds. - Weight::from_parts(35_251_000, 0) - .saturating_add(Weight::from_parts(0, 5038)) + // Estimated: `3549` + // Minimum execution time: 38_536_000 picoseconds. + Weight::from_parts(39_046_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -80,10 +81,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn force_create() -> Weight { // Proof Size summary in bytes: // Measured: `42` - // Estimated: `5038` - // Minimum execution time: 22_704_000 picoseconds. - Weight::from_parts(23_146_000, 0) - .saturating_add(Weight::from_parts(0, 5038)) + // Estimated: `3549` + // Minimum execution time: 22_776_000 picoseconds. + Weight::from_parts(23_177_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -109,12 +110,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32170 + a * (366 ±0)` - // Estimated: `2538829 + a * (2954 ±0)` - // Minimum execution time: 976_206_000 picoseconds. - Weight::from_parts(924_770_064, 0) - .saturating_add(Weight::from_parts(0, 2538829)) - // Standard Error: 3_946 - .saturating_add(Weight::from_parts(5_708_229, 0).saturating_mul(a.into())) + // Estimated: `2523990 + a * (2954 ±0)` + // Minimum execution time: 989_671_000 picoseconds. + Weight::from_parts(935_494_331, 0) + .saturating_add(Weight::from_parts(0, 2523990)) + // Standard Error: 3_986 + .saturating_add(Weight::from_parts(5_721_724, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(1004)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1005)) @@ -136,10 +137,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 44_592_000 picoseconds. - Weight::from_parts(45_181_000, 0) - .saturating_add(Weight::from_parts(0, 18460)) + // Estimated: `4326` + // Minimum execution time: 48_990_000 picoseconds. + Weight::from_parts(49_439_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -158,10 +159,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn force_mint() -> Weight { // Proof Size summary in bytes: // Measured: `421` - // Estimated: `18460` - // Minimum execution time: 43_304_000 picoseconds. - Weight::from_parts(43_977_000, 0) - .saturating_add(Weight::from_parts(0, 18460)) + // Estimated: `4326` + // Minimum execution time: 48_068_000 picoseconds. + Weight::from_parts(48_446_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -184,10 +185,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `530` - // Estimated: `15200` - // Minimum execution time: 45_744_000 picoseconds. - Weight::from_parts(46_056_000, 0) - .saturating_add(Weight::from_parts(0, 15200)) + // Estimated: `4326` + // Minimum execution time: 48_943_000 picoseconds. + Weight::from_parts(49_568_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(7)) } @@ -208,10 +209,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `14926` - // Minimum execution time: 35_663_000 picoseconds. - Weight::from_parts(36_865_000, 0) - .saturating_add(Weight::from_parts(0, 14926)) + // Estimated: `4326` + // Minimum execution time: 35_764_000 picoseconds. + Weight::from_parts(36_232_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -225,12 +226,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `729 + i * (108 ±0)` - // Estimated: `8077 + i * (3336 ±0)` - // Minimum execution time: 16_987_000 picoseconds. - Weight::from_parts(17_194_000, 0) - .saturating_add(Weight::from_parts(0, 8077)) - // Standard Error: 13_044 - .saturating_add(Weight::from_parts(13_324_147, 0).saturating_mul(i.into())) + // Estimated: `3549 + i * (3336 ±0)` + // Minimum execution time: 17_108_000 picoseconds. + Weight::from_parts(17_220_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) + // Standard Error: 14_557 + .saturating_add(Weight::from_parts(15_545_711, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -243,10 +244,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn lock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 20_345_000 picoseconds. - Weight::from_parts(20_739_000, 0) - .saturating_add(Weight::from_parts(0, 7047)) + // Estimated: `3534` + // Minimum execution time: 20_958_000 picoseconds. + Weight::from_parts(21_129_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -257,10 +258,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn unlock_item_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 20_167_000 picoseconds. - Weight::from_parts(20_580_000, 0) - .saturating_add(Weight::from_parts(0, 7047)) + // Estimated: `3534` + // Minimum execution time: 20_864_000 picoseconds. + Weight::from_parts(21_016_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -271,10 +272,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn lock_collection() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 17_831_000 picoseconds. - Weight::from_parts(18_174_000, 0) - .saturating_add(Weight::from_parts(0, 7087)) + // Estimated: `3549` + // Minimum execution time: 17_934_000 picoseconds. + Weight::from_parts(18_152_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -287,10 +288,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `354` - // Estimated: `7066` - // Minimum execution time: 23_763_000 picoseconds. - Weight::from_parts(24_226_000, 0) - .saturating_add(Weight::from_parts(0, 7066)) + // Estimated: `3549` + // Minimum execution time: 23_477_000 picoseconds. + Weight::from_parts(23_830_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -301,10 +302,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_team() -> Weight { // Proof Size summary in bytes: // Measured: `335` - // Estimated: `9627` - // Minimum execution time: 40_034_000 picoseconds. - Weight::from_parts(40_402_000, 0) - .saturating_add(Weight::from_parts(0, 9627)) + // Estimated: `6078` + // Minimum execution time: 40_775_000 picoseconds. + Weight::from_parts(41_159_000, 0) + .saturating_add(Weight::from_parts(0, 6078)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -316,8 +317,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `277` // Estimated: `3549` - // Minimum execution time: 18_648_000 picoseconds. - Weight::from_parts(18_968_000, 0) + // Minimum execution time: 18_569_000 picoseconds. + Weight::from_parts(18_844_000, 0) .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(3)) @@ -330,8 +331,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `242` // Estimated: `3549` - // Minimum execution time: 15_282_000 picoseconds. - Weight::from_parts(15_923_000, 0) + // Minimum execution time: 15_395_000 picoseconds. + Weight::from_parts(15_554_000, 0) .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -343,10 +344,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn lock_item_properties() -> Weight { // Proof Size summary in bytes: // Measured: `401` - // Estimated: `7047` - // Minimum execution time: 20_060_000 picoseconds. - Weight::from_parts(20_326_000, 0) - .saturating_add(Weight::from_parts(0, 7047)) + // Estimated: `3534` + // Minimum execution time: 20_497_000 picoseconds. + Weight::from_parts(20_872_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -363,10 +364,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `18078` - // Minimum execution time: 48_324_000 picoseconds. - Weight::from_parts(48_745_000, 0) - .saturating_add(Weight::from_parts(0, 18078)) + // Estimated: `3944` + // Minimum execution time: 49_930_000 picoseconds. + Weight::from_parts(50_200_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -377,10 +378,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn force_set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `310` - // Estimated: `7493` - // Minimum execution time: 27_935_000 picoseconds. - Weight::from_parts(28_241_000, 0) - .saturating_add(Weight::from_parts(0, 7493)) + // Estimated: `3944` + // Minimum execution time: 27_930_000 picoseconds. + Weight::from_parts(28_319_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -395,10 +396,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `949` - // Estimated: `14540` - // Minimum execution time: 44_972_000 picoseconds. - Weight::from_parts(45_618_000, 0) - .saturating_add(Weight::from_parts(0, 14540)) + // Estimated: `3944` + // Minimum execution time: 47_306_000 picoseconds. + Weight::from_parts(47_676_000, 0) + .saturating_add(Weight::from_parts(0, 3944)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -409,10 +410,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn approve_item_attributes() -> Weight { // Proof Size summary in bytes: // Measured: `347` - // Estimated: `8792` - // Minimum execution time: 19_246_000 picoseconds. - Weight::from_parts(19_715_000, 0) - .saturating_add(Weight::from_parts(0, 8792)) + // Estimated: `4466` + // Minimum execution time: 18_749_000 picoseconds. + Weight::from_parts(19_080_000, 0) + .saturating_add(Weight::from_parts(0, 4466)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -428,12 +429,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn cancel_item_attributes_approval(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `726 + n * (398 ±0)` - // Estimated: `16329 + n * (2954 ±0)` - // Minimum execution time: 28_372_000 picoseconds. - Weight::from_parts(28_671_000, 0) - .saturating_add(Weight::from_parts(0, 16329)) - // Standard Error: 3_479 - .saturating_add(Weight::from_parts(5_527_336, 0).saturating_mul(n.into())) + // Estimated: `4466 + n * (2954 ±0)` + // Minimum execution time: 28_200_000 picoseconds. + Weight::from_parts(28_552_000, 0) + .saturating_add(Weight::from_parts(0, 4466)) + // Standard Error: 3_352 + .saturating_add(Weight::from_parts(5_584_045, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -453,10 +454,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `505` - // Estimated: `17946` - // Minimum execution time: 39_852_000 picoseconds. - Weight::from_parts(40_280_000, 0) - .saturating_add(Weight::from_parts(0, 17946)) + // Estimated: `3812` + // Minimum execution time: 41_646_000 picoseconds. + Weight::from_parts(42_171_000, 0) + .saturating_add(Weight::from_parts(0, 3812)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -471,10 +472,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `815` - // Estimated: `14408` - // Minimum execution time: 36_829_000 picoseconds. - Weight::from_parts(37_513_000, 0) - .saturating_add(Weight::from_parts(0, 14408)) + // Estimated: `3812` + // Minimum execution time: 40_022_000 picoseconds. + Weight::from_parts(40_363_000, 0) + .saturating_add(Weight::from_parts(0, 3812)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -489,10 +490,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `364` - // Estimated: `14380` - // Minimum execution time: 35_398_000 picoseconds. - Weight::from_parts(35_809_000, 0) - .saturating_add(Weight::from_parts(0, 14380)) + // Estimated: `3759` + // Minimum execution time: 38_872_000 picoseconds. + Weight::from_parts(39_223_000, 0) + .saturating_add(Weight::from_parts(0, 3759)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -507,10 +508,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `682` - // Estimated: `14380` - // Minimum execution time: 33_699_000 picoseconds. - Weight::from_parts(34_170_000, 0) - .saturating_add(Weight::from_parts(0, 14380)) + // Estimated: `3759` + // Minimum execution time: 37_582_000 picoseconds. + Weight::from_parts(38_305_000, 0) + .saturating_add(Weight::from_parts(0, 3759)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -521,10 +522,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `376` - // Estimated: `7864` - // Minimum execution time: 21_789_000 picoseconds. - Weight::from_parts(22_454_000, 0) - .saturating_add(Weight::from_parts(0, 7864)) + // Estimated: `4326` + // Minimum execution time: 22_551_000 picoseconds. + Weight::from_parts(22_984_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -534,8 +535,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 19_532_000 picoseconds. - Weight::from_parts(19_761_000, 0) + // Minimum execution time: 19_879_000 picoseconds. + Weight::from_parts(20_310_000, 0) .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -546,8 +547,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4326` - // Minimum execution time: 18_620_000 picoseconds. - Weight::from_parts(19_014_000, 0) + // Minimum execution time: 18_958_000 picoseconds. + Weight::from_parts(19_247_000, 0) .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -558,8 +559,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3517` - // Minimum execution time: 16_491_000 picoseconds. - Weight::from_parts(16_888_000, 0) + // Minimum execution time: 16_432_000 picoseconds. + Weight::from_parts(16_762_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -571,10 +572,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `306` - // Estimated: `7087` - // Minimum execution time: 19_929_000 picoseconds. - Weight::from_parts(20_170_000, 0) - .saturating_add(Weight::from_parts(0, 7087)) + // Estimated: `3549` + // Minimum execution time: 19_950_000 picoseconds. + Weight::from_parts(20_169_000, 0) + .saturating_add(Weight::from_parts(0, 3549)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -585,10 +586,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn update_mint_settings() -> Weight { // Proof Size summary in bytes: // Measured: `289` - // Estimated: `7072` - // Minimum execution time: 19_500_000 picoseconds. - Weight::from_parts(19_839_000, 0) - .saturating_add(Weight::from_parts(0, 7072)) + // Estimated: `3538` + // Minimum execution time: 19_727_000 picoseconds. + Weight::from_parts(19_977_000, 0) + .saturating_add(Weight::from_parts(0, 3538)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -603,10 +604,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_price() -> Weight { // Proof Size summary in bytes: // Measured: `484` - // Estimated: `11377` - // Minimum execution time: 24_542_000 picoseconds. - Weight::from_parts(24_916_000, 0) - .saturating_add(Weight::from_parts(0, 11377)) + // Estimated: `4326` + // Minimum execution time: 24_200_000 picoseconds. + Weight::from_parts(24_433_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -627,10 +628,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `671` - // Estimated: `18480` - // Minimum execution time: 44_311_000 picoseconds. - Weight::from_parts(45_789_000, 0) - .saturating_add(Weight::from_parts(0, 18480)) + // Estimated: `4326` + // Minimum execution time: 44_868_000 picoseconds. + Weight::from_parts(45_386_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -639,11 +640,11 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_523_000 picoseconds. - Weight::from_parts(4_349_031, 0) + // Minimum execution time: 2_573_000 picoseconds. + Weight::from_parts(4_309_077, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 10_427 - .saturating_add(Weight::from_parts(3_718_129, 0).saturating_mul(n.into())) + // Standard Error: 9_731 + .saturating_add(Weight::from_parts(3_668_159, 0).saturating_mul(n.into())) } /// Storage: Nfts Item (r:2 w:0) /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) @@ -653,8 +654,8 @@ impl pallet_nfts::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `460` // Estimated: `7662` - // Minimum execution time: 23_007_000 picoseconds. - Weight::from_parts(23_305_000, 0) + // Minimum execution time: 22_763_000 picoseconds. + Weight::from_parts(22_911_000, 0) .saturating_add(Weight::from_parts(0, 7662)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -666,10 +667,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn cancel_swap() -> Weight { // Proof Size summary in bytes: // Measured: `479` - // Estimated: `7862` - // Minimum execution time: 21_173_000 picoseconds. - Weight::from_parts(21_451_000, 0) - .saturating_add(Weight::from_parts(0, 7862)) + // Estimated: `4326` + // Minimum execution time: 21_393_000 picoseconds. + Weight::from_parts(21_656_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -690,10 +691,10 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn claim_swap() -> Weight { // Proof Size summary in bytes: // Measured: `800` - // Estimated: `24321` - // Minimum execution time: 72_213_000 picoseconds. - Weight::from_parts(73_029_000, 0) - .saturating_add(Weight::from_parts(0, 24321)) + // Estimated: `7662` + // Minimum execution time: 73_894_000 picoseconds. + Weight::from_parts(75_692_000, 0) + .saturating_add(Weight::from_parts(0, 7662)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(10)) } @@ -719,12 +720,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn mint_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `524` - // Estimated: `29399 + n * (2954 ±0)` - // Minimum execution time: 125_518_000 picoseconds. - Weight::from_parts(129_781_908, 0) - .saturating_add(Weight::from_parts(0, 29399)) - // Standard Error: 21_840 - .saturating_add(Weight::from_parts(26_756_136, 0).saturating_mul(n.into())) + // Estimated: `6078 + n * (2954 ±0)` + // Minimum execution time: 132_196_000 picoseconds. + Weight::from_parts(136_454_873, 0) + .saturating_add(Weight::from_parts(0, 6078)) + // Standard Error: 18_901 + .saturating_add(Weight::from_parts(29_375_812, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(6)) @@ -747,12 +748,12 @@ impl pallet_nfts::WeightInfo for WeightInfo { fn set_attributes_pre_signed(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `554` - // Estimated: `20462 + n * (2954 ±0)` - // Minimum execution time: 76_133_000 picoseconds. - Weight::from_parts(85_559_988, 0) - .saturating_add(Weight::from_parts(0, 20462)) - // Standard Error: 49_851 - .saturating_add(Weight::from_parts(26_551_215, 0).saturating_mul(n.into())) + // Estimated: `4466 + n * (2954 ±0)` + // Minimum execution time: 76_734_000 picoseconds. + Weight::from_parts(87_761_745, 0) + .saturating_add(Weight::from_parts(0, 4466)) + // Standard Error: 59_520 + .saturating_add(Weight::from_parts(28_979_367, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_proxy.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_proxy.rs index fa22bf7bf68..dbee1b7b3e2 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_proxy.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_proxy.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_proxy`. pub struct WeightInfo(PhantomData); @@ -54,11 +55,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 16_562_000 picoseconds. - Weight::from_parts(17_305_360, 0) + // Minimum execution time: 16_863_000 picoseconds. + Weight::from_parts(17_287_999, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_081 - .saturating_add(Weight::from_parts(37_267, 0).saturating_mul(p.into())) + // Standard Error: 841 + .saturating_add(Weight::from_parts(25_908, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: Proxy Proxies (r:1 w:0) @@ -72,14 +73,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn proxy_announced(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `454 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 35_181_000 picoseconds. - Weight::from_parts(34_864_956, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 5_023 - .saturating_add(Weight::from_parts(158_916, 0).saturating_mul(a.into())) - // Standard Error: 5_189 - .saturating_add(Weight::from_parts(60_136, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 38_170_000 picoseconds. + Weight::from_parts(37_695_584, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_836 + .saturating_add(Weight::from_parts(146_800, 0).saturating_mul(a.into())) + // Standard Error: 1_897 + .saturating_add(Weight::from_parts(38_057, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -92,14 +93,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn remove_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 21_758_000 picoseconds. - Weight::from_parts(23_149_882, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 1_877 - .saturating_add(Weight::from_parts(145_269, 0).saturating_mul(a.into())) - // Standard Error: 1_940 - .saturating_add(Weight::from_parts(5_129, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_161_000 picoseconds. + Weight::from_parts(25_440_795, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_095 + .saturating_add(Weight::from_parts(135_319, 0).saturating_mul(a.into())) + // Standard Error: 1_131 + .saturating_add(Weight::from_parts(11_250, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -112,14 +113,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_076_000 picoseconds. - Weight::from_parts(22_959_374, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 1_377 - .saturating_add(Weight::from_parts(146_462, 0).saturating_mul(a.into())) - // Standard Error: 1_423 - .saturating_add(Weight::from_parts(11_551, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_441_000 picoseconds. + Weight::from_parts(25_850_657, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_148 + .saturating_add(Weight::from_parts(127_981, 0).saturating_mul(a.into())) + // Standard Error: 1_186 + .saturating_add(Weight::from_parts(6_961, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -134,14 +135,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn announce(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `386 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 30_751_000 picoseconds. - Weight::from_parts(31_929_484, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 2_087 - .saturating_add(Weight::from_parts(147_703, 0).saturating_mul(a.into())) - // Standard Error: 2_156 - .saturating_add(Weight::from_parts(27_798, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 34_657_000 picoseconds. + Weight::from_parts(33_913_455, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_087 + .saturating_add(Weight::from_parts(128_175, 0).saturating_mul(a.into())) + // Standard Error: 1_123 + .saturating_add(Weight::from_parts(40_321, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -152,11 +153,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_700_000 picoseconds. - Weight::from_parts(24_509_575, 0) + // Minimum execution time: 25_575_000 picoseconds. + Weight::from_parts(26_235_398, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_699 - .saturating_add(Weight::from_parts(51_275, 0).saturating_mul(p.into())) + // Standard Error: 924 + .saturating_add(Weight::from_parts(51_662, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -167,11 +168,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_289_000 picoseconds. - Weight::from_parts(24_453_360, 0) + // Minimum execution time: 25_416_000 picoseconds. + Weight::from_parts(26_557_151, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_690 - .saturating_add(Weight::from_parts(62_718, 0).saturating_mul(p.into())) + // Standard Error: 1_447 + .saturating_add(Weight::from_parts(50_558, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -182,11 +183,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 18_877_000 picoseconds. - Weight::from_parts(19_780_042, 0) + // Minimum execution time: 22_606_000 picoseconds. + Weight::from_parts(23_262_867, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_171 - .saturating_add(Weight::from_parts(20_282, 0).saturating_mul(p.into())) + // Standard Error: 1_186 + .saturating_add(Weight::from_parts(26_393, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -197,11 +198,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `139` // Estimated: `4706` - // Minimum execution time: 25_354_000 picoseconds. - Weight::from_parts(26_362_285, 0) + // Minimum execution time: 27_288_000 picoseconds. + Weight::from_parts(27_957_909, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_459 - .saturating_add(Weight::from_parts(1_330, 0).saturating_mul(p.into())) + // Standard Error: 706 + .saturating_add(Weight::from_parts(8_841, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -212,11 +213,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `164 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 20_057_000 picoseconds. - Weight::from_parts(20_844_608, 0) + // Minimum execution time: 23_640_000 picoseconds. + Weight::from_parts(24_327_982, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_336 - .saturating_add(Weight::from_parts(27_855, 0).saturating_mul(p.into())) + // Standard Error: 828 + .saturating_add(Weight::from_parts(28_240, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_session.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_session.rs index bb4705ace09..b48ff8dd064 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_session.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_session.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `270` - // Estimated: `7470` - // Minimum execution time: 17_394_000 picoseconds. - Weight::from_parts(17_828_000, 0) - .saturating_add(Weight::from_parts(0, 7470)) + // Estimated: `3735` + // Minimum execution time: 17_308_000 picoseconds. + Weight::from_parts(17_624_000, 0) + .saturating_add(Weight::from_parts(0, 3735)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -68,10 +69,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `242` - // Estimated: `3949` - // Minimum execution time: 13_334_000 picoseconds. - Weight::from_parts(13_634_000, 0) - .saturating_add(Weight::from_parts(0, 3949)) + // Estimated: `3707` + // Minimum execution time: 12_828_000 picoseconds. + Weight::from_parts(12_985_000, 0) + .saturating_add(Weight::from_parts(0, 3707)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_timestamp.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_timestamp.rs index 7475e81c9ad..c1a9be38dbd 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_timestamp.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_timestamp.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_timestamp`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `86` - // Estimated: `2986` - // Minimum execution time: 9_273_000 picoseconds. - Weight::from_parts(9_653_000, 0) - .saturating_add(Weight::from_parts(0, 2986)) + // Estimated: `1493` + // Minimum execution time: 9_150_000 picoseconds. + Weight::from_parts(9_474_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +66,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `57` // Estimated: `0` - // Minimum execution time: 3_289_000 picoseconds. - Weight::from_parts(3_379_000, 0) + // Minimum execution time: 3_210_000 picoseconds. + Weight::from_parts(3_330_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_uniques.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_uniques.rs index c32eebdc908..d04f1800399 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_uniques.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_uniques.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_uniques` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_uniques`. pub struct WeightInfo(PhantomData); @@ -55,8 +56,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `145` // Estimated: `3643` - // Minimum execution time: 26_855_000 picoseconds. - Weight::from_parts(27_393_000, 0) + // Minimum execution time: 29_873_000 picoseconds. + Weight::from_parts(30_382_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -69,8 +70,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3643` - // Minimum execution time: 15_006_000 picoseconds. - Weight::from_parts(15_389_000, 0) + // Minimum execution time: 14_338_000 picoseconds. + Weight::from_parts(14_710_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -96,17 +97,17 @@ impl pallet_uniques::WeightInfo for WeightInfo { /// The range of component `a` is `[0, 1000]`. fn destroy(n: u32, m: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `257 + n * (76 ±0) + m * (56 ±0) + a * (107 ±0)` - // Estimated: `9210 + a * (2647 ±0) + n * (2597 ±0) + m * (2662 ±0)` - // Minimum execution time: 2_360_211_000 picoseconds. - Weight::from_parts(2_383_759_000, 0) - .saturating_add(Weight::from_parts(0, 9210)) - // Standard Error: 24_849 - .saturating_add(Weight::from_parts(6_304_424, 0).saturating_mul(n.into())) - // Standard Error: 24_849 - .saturating_add(Weight::from_parts(253_862, 0).saturating_mul(m.into())) - // Standard Error: 24_849 - .saturating_add(Weight::from_parts(324_295, 0).saturating_mul(a.into())) + // Measured: `257 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)` + // Estimated: `3643 + a * (2647 ±0) + m * (2662 ±0) + n * (2597 ±0)` + // Minimum execution time: 2_398_014_000 picoseconds. + Weight::from_parts(2_410_569_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) + // Standard Error: 24_769 + .saturating_add(Weight::from_parts(6_309_077, 0).saturating_mul(n.into())) + // Standard Error: 24_769 + .saturating_add(Weight::from_parts(257_995, 0).saturating_mul(m.into())) + // Standard Error: 24_769 + .saturating_add(Weight::from_parts(317_885, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) @@ -116,8 +117,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) .saturating_add(Weight::from_parts(0, 2647).saturating_mul(a.into())) - .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) .saturating_add(Weight::from_parts(0, 2662).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into())) } /// Storage: Uniques Asset (r:1 w:1) /// Proof: Uniques Asset (max_values: None, max_size: Some(122), added: 2597, mode: MaxEncodedLen) @@ -130,10 +131,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn mint() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `10719` - // Minimum execution time: 33_245_000 picoseconds. - Weight::from_parts(33_516_000, 0) - .saturating_add(Weight::from_parts(0, 10719)) + // Estimated: `3643` + // Minimum execution time: 36_084_000 picoseconds. + Weight::from_parts(36_377_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -148,10 +149,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn burn() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 34_237_000 picoseconds. - Weight::from_parts(34_725_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 37_397_000 picoseconds. + Weight::from_parts(37_763_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -166,10 +167,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn transfer() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 27_588_000 picoseconds. - Weight::from_parts(27_994_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 27_423_000 picoseconds. + Weight::from_parts(27_666_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -181,12 +182,12 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn redeposit(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `738 + i * (76 ±0)` - // Estimated: `4633 + i * (2597 ±0)` - // Minimum execution time: 15_958_000 picoseconds. - Weight::from_parts(16_175_000, 0) - .saturating_add(Weight::from_parts(0, 4633)) - // Standard Error: 12_904 - .saturating_add(Weight::from_parts(13_261_405, 0).saturating_mul(i.into())) + // Estimated: `3643 + i * (2597 ±0)` + // Minimum execution time: 15_215_000 picoseconds. + Weight::from_parts(15_450_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) + // Standard Error: 12_841 + .saturating_add(Weight::from_parts(15_164_179, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -200,10 +201,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn freeze() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 19_124_000 picoseconds. - Weight::from_parts(19_432_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 19_169_000 picoseconds. + Weight::from_parts(19_541_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -214,10 +215,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn thaw() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 19_725_000 picoseconds. - Weight::from_parts(19_903_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 18_941_000 picoseconds. + Weight::from_parts(19_336_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -227,8 +228,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 15_091_000 picoseconds. - Weight::from_parts(15_405_000, 0) + // Minimum execution time: 14_356_000 picoseconds. + Weight::from_parts(14_650_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -239,8 +240,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 14_440_000 picoseconds. - Weight::from_parts(14_836_000, 0) + // Minimum execution time: 14_303_000 picoseconds. + Weight::from_parts(14_504_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -254,10 +255,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn transfer_ownership() -> Weight { // Proof Size summary in bytes: // Measured: `356` - // Estimated: `7160` - // Minimum execution time: 22_729_000 picoseconds. - Weight::from_parts(23_039_000, 0) - .saturating_add(Weight::from_parts(0, 7160)) + // Estimated: `3643` + // Minimum execution time: 22_663_000 picoseconds. + Weight::from_parts(23_053_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -267,8 +268,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 15_506_000 picoseconds. - Weight::from_parts(15_864_000, 0) + // Minimum execution time: 15_198_000 picoseconds. + Weight::from_parts(15_645_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -281,8 +282,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `3643` - // Minimum execution time: 18_244_000 picoseconds. - Weight::from_parts(18_591_000, 0) + // Minimum execution time: 17_381_000 picoseconds. + Weight::from_parts(17_588_000, 0) .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -296,10 +297,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `10932` - // Minimum execution time: 37_528_000 picoseconds. - Weight::from_parts(38_282_000, 0) - .saturating_add(Weight::from_parts(0, 10932)) + // Estimated: `3652` + // Minimum execution time: 39_838_000 picoseconds. + Weight::from_parts(40_387_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -312,10 +313,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_attribute() -> Weight { // Proof Size summary in bytes: // Measured: `756` - // Estimated: `10932` - // Minimum execution time: 36_654_000 picoseconds. - Weight::from_parts(36_947_000, 0) - .saturating_add(Weight::from_parts(0, 10932)) + // Estimated: `3652` + // Minimum execution time: 38_600_000 picoseconds. + Weight::from_parts(39_215_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -326,10 +327,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `348` - // Estimated: `7295` - // Minimum execution time: 29_703_000 picoseconds. - Weight::from_parts(30_032_000, 0) - .saturating_add(Weight::from_parts(0, 7295)) + // Estimated: `3652` + // Minimum execution time: 31_563_000 picoseconds. + Weight::from_parts(32_111_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -340,10 +341,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `559` - // Estimated: `7295` - // Minimum execution time: 29_941_000 picoseconds. - Weight::from_parts(30_222_000, 0) - .saturating_add(Weight::from_parts(0, 7295)) + // Estimated: `3652` + // Minimum execution time: 31_525_000 picoseconds. + Weight::from_parts(31_904_000, 0) + .saturating_add(Weight::from_parts(0, 3652)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -354,10 +355,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `7275` - // Minimum execution time: 28_466_000 picoseconds. - Weight::from_parts(29_037_000, 0) - .saturating_add(Weight::from_parts(0, 7275)) + // Estimated: `3643` + // Minimum execution time: 32_104_000 picoseconds. + Weight::from_parts(32_429_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -368,10 +369,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn clear_collection_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `473` - // Estimated: `7275` - // Minimum execution time: 27_072_000 picoseconds. - Weight::from_parts(27_514_000, 0) - .saturating_add(Weight::from_parts(0, 7275)) + // Estimated: `3643` + // Minimum execution time: 30_433_000 picoseconds. + Weight::from_parts(30_662_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -382,10 +383,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn approve_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `428` - // Estimated: `7230` - // Minimum execution time: 20_791_000 picoseconds. - Weight::from_parts(21_072_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 20_463_000 picoseconds. + Weight::from_parts(20_879_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -396,10 +397,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn cancel_approval() -> Weight { // Proof Size summary in bytes: // Measured: `461` - // Estimated: `7230` - // Minimum execution time: 20_467_000 picoseconds. - Weight::from_parts(20_842_000, 0) - .saturating_add(Weight::from_parts(0, 7230)) + // Estimated: `3643` + // Minimum execution time: 20_158_000 picoseconds. + Weight::from_parts(20_465_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -409,8 +410,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3517` - // Minimum execution time: 16_836_000 picoseconds. - Weight::from_parts(17_418_000, 0) + // Minimum execution time: 16_009_000 picoseconds. + Weight::from_parts(16_396_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -422,10 +423,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn set_collection_max_supply() -> Weight { // Proof Size summary in bytes: // Measured: `282` - // Estimated: `7132` - // Minimum execution time: 17_721_000 picoseconds. - Weight::from_parts(18_109_000, 0) - .saturating_add(Weight::from_parts(0, 7132)) + // Estimated: `3643` + // Minimum execution time: 17_034_000 picoseconds. + Weight::from_parts(17_286_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -437,8 +438,8 @@ impl pallet_uniques::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `259` // Estimated: `3587` - // Minimum execution time: 17_599_000 picoseconds. - Weight::from_parts(17_802_000, 0) + // Minimum execution time: 17_020_000 picoseconds. + Weight::from_parts(17_318_000, 0) .saturating_add(Weight::from_parts(0, 3587)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -454,10 +455,10 @@ impl pallet_uniques::WeightInfo for WeightInfo { fn buy_item() -> Weight { // Proof Size summary in bytes: // Measured: `540` - // Estimated: `10784` - // Minimum execution time: 38_642_000 picoseconds. - Weight::from_parts(39_168_000, 0) - .saturating_add(Weight::from_parts(0, 10784)) + // Estimated: `3643` + // Minimum execution time: 37_771_000 picoseconds. + Weight::from_parts(38_708_000, 0) + .saturating_add(Weight::from_parts(0, 3643)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_utility.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_utility.rs index 76db89d9078..4dce4a9b391 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_utility.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_utility.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_utility`. pub struct WeightInfo(PhantomData); @@ -52,18 +53,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_995_000 picoseconds. - Weight::from_parts(19_761_796, 0) + // Minimum execution time: 7_065_000 picoseconds. + Weight::from_parts(7_907_851, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_672 - .saturating_add(Weight::from_parts(4_682_116, 0).saturating_mul(c.into())) + // Standard Error: 2_515 + .saturating_add(Weight::from_parts(5_447_457, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_549_000 picoseconds. - Weight::from_parts(5_723_000, 0) + // Minimum execution time: 5_845_000 picoseconds. + Weight::from_parts(6_053_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -71,18 +72,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_210_000 picoseconds. - Weight::from_parts(15_002_117, 0) + // Minimum execution time: 7_094_000 picoseconds. + Weight::from_parts(1_459_029, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_199 - .saturating_add(Weight::from_parts(4_917_852, 0).saturating_mul(c.into())) + // Standard Error: 4_016 + .saturating_add(Weight::from_parts(5_680_469, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_596_000 picoseconds. - Weight::from_parts(9_875_000, 0) + // Minimum execution time: 9_972_000 picoseconds. + Weight::from_parts(10_167_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -90,10 +91,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_024_000 picoseconds. - Weight::from_parts(15_781_473, 0) + // Minimum execution time: 7_148_000 picoseconds. + Weight::from_parts(6_914_554, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_344 - .saturating_add(Weight::from_parts(4_665_530, 0).saturating_mul(c.into())) + // Standard Error: 3_605 + .saturating_add(Weight::from_parts(5_440_589, 0).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs index 0d650e50929..aa43df9de84 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn send() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `9780` - // Minimum execution time: 28_019_000 picoseconds. - Weight::from_parts(29_053_000, 0) - .saturating_add(Weight::from_parts(0, 9780)) + // Estimated: `3540` + // Minimum execution time: 30_683_000 picoseconds. + Weight::from_parts(31_228_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +74,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1489` - // Minimum execution time: 24_127_000 picoseconds. - Weight::from_parts(24_609_000, 0) + // Minimum execution time: 29_299_000 picoseconds. + Weight::from_parts(29_857_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -84,8 +85,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1489` - // Minimum execution time: 18_826_000 picoseconds. - Weight::from_parts(19_183_000, 0) + // Minimum execution time: 22_639_000 picoseconds. + Weight::from_parts(23_057_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -93,8 +94,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_865_000 picoseconds. - Weight::from_parts(10_129_000, 0) + // Minimum execution time: 11_623_000 picoseconds. + Weight::from_parts(11_996_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: PolkadotXcm SupportedVersion (r:0 w:1) @@ -103,8 +104,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_995_000 picoseconds. - Weight::from_parts(10_290_000, 0) + // Minimum execution time: 11_678_000 picoseconds. + Weight::from_parts(12_002_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -114,8 +115,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_144_000 picoseconds. - Weight::from_parts(3_225_000, 0) + // Minimum execution time: 3_702_000 picoseconds. + Weight::from_parts(3_927_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -138,10 +139,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `14955` - // Minimum execution time: 33_946_000 picoseconds. - Weight::from_parts(34_595_000, 0) - .saturating_add(Weight::from_parts(0, 14955)) + // Estimated: `3540` + // Minimum execution time: 37_617_000 picoseconds. + Weight::from_parts(38_443_000, 0) + .saturating_add(Weight::from_parts(0, 3540)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -162,19 +163,21 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `257` - // Estimated: `14669` - // Minimum execution time: 34_408_000 picoseconds. - Weight::from_parts(34_845_000, 0) - .saturating_add(Weight::from_parts(0, 14669)) + // Estimated: `3722` + // Minimum execution time: 39_333_000 picoseconds. + Weight::from_parts(40_174_000, 0) + .saturating_add(Weight::from_parts(0, 3722)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) fn force_suspension() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_144_000 picoseconds. - Weight::from_parts(3_225_000, 0) + // Minimum execution time: 3_857_000 picoseconds. + Weight::from_parts(4_158_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -184,8 +187,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `129` // Estimated: `11019` - // Minimum execution time: 17_219_000 picoseconds. - Weight::from_parts(17_552_000, 0) + // Minimum execution time: 17_929_000 picoseconds. + Weight::from_parts(18_175_000, 0) .saturating_add(Weight::from_parts(0, 11019)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -196,8 +199,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `133` // Estimated: `11023` - // Minimum execution time: 17_382_000 picoseconds. - Weight::from_parts(17_791_000, 0) + // Minimum execution time: 17_241_000 picoseconds. + Weight::from_parts(17_618_000, 0) .saturating_add(Weight::from_parts(0, 11023)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -208,8 +211,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `140` // Estimated: `13505` - // Minimum execution time: 18_051_000 picoseconds. - Weight::from_parts(18_643_000, 0) + // Minimum execution time: 18_013_000 picoseconds. + Weight::from_parts(18_485_000, 0) .saturating_add(Weight::from_parts(0, 13505)) .saturating_add(T::DbWeight::get().reads(5)) } @@ -228,10 +231,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_current_targets() -> Weight { // Proof Size summary in bytes: // Measured: `142` - // Estimated: `16197` - // Minimum execution time: 33_113_000 picoseconds. - Weight::from_parts(34_048_000, 0) - .saturating_add(Weight::from_parts(0, 16197)) + // Estimated: `6082` + // Minimum execution time: 30_736_000 picoseconds. + Weight::from_parts(31_215_000, 0) + .saturating_add(Weight::from_parts(0, 6082)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -241,8 +244,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `172` // Estimated: `8587` - // Minimum execution time: 9_569_000 picoseconds. - Weight::from_parts(9_933_000, 0) + // Minimum execution time: 9_005_000 picoseconds. + Weight::from_parts(9_289_000, 0) .saturating_add(Weight::from_parts(0, 8587)) .saturating_add(T::DbWeight::get().reads(3)) } @@ -252,8 +255,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `140` // Estimated: `11030` - // Minimum execution time: 19_098_000 picoseconds. - Weight::from_parts(19_550_000, 0) + // Minimum execution time: 17_506_000 picoseconds. + Weight::from_parts(17_811_000, 0) .saturating_add(Weight::from_parts(0, 11030)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -273,10 +276,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: // Measured: `146` - // Estimated: `21171` - // Minimum execution time: 40_365_000 picoseconds. - Weight::from_parts(41_092_000, 0) - .saturating_add(Weight::from_parts(0, 21171)) + // Estimated: `11036` + // Minimum execution time: 37_343_000 picoseconds. + Weight::from_parts(37_774_000, 0) + .saturating_add(Weight::from_parts(0, 11036)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs index 129cc453eb5..9cf8a95ccf2 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for WestmintXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for WestmintXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 66f6bd713d5..ce142a079d2 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -54,8 +54,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 22_591_000 picoseconds. - Weight::from_parts(23_052_000, 3593) + // Minimum execution time: 25_802_000 picoseconds. + Weight::from_parts(26_076_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +65,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 32_036_000 picoseconds. - Weight::from_parts(32_396_000, 6196) + // Minimum execution time: 48_092_000 picoseconds. + Weight::from_parts(48_397_000, 6196) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -87,9 +87,9 @@ impl WeightInfo { pub fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `176` - // Estimated: `17970` - // Minimum execution time: 58_331_000 picoseconds. - Weight::from_parts(59_048_000, 17970) + // Estimated: `6196` + // Minimum execution time: 70_237_000 picoseconds. + Weight::from_parts(70_692_000, 6196) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -97,8 +97,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_474_000 picoseconds. - Weight::from_parts(4_577_000, 0) + // Minimum execution time: 4_045_000 picoseconds. + Weight::from_parts(4_135_000, 0) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -106,8 +106,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_611_000 picoseconds. - Weight::from_parts(28_992_000, 3593) + // Minimum execution time: 26_201_000 picoseconds. + Weight::from_parts(26_820_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -128,9 +128,9 @@ impl WeightInfo { pub fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `14862` - // Minimum execution time: 57_179_000 picoseconds. - Weight::from_parts(58_149_000, 14862) + // Estimated: `3593` + // Minimum execution time: 50_526_000 picoseconds. + Weight::from_parts(51_121_000, 3593) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -149,9 +149,9 @@ impl WeightInfo { pub fn initiate_teleport() -> Weight { // Proof Size summary in bytes: // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 30_477_000 picoseconds. - Weight::from_parts(30_841_000, 11269) + // Estimated: `3540` + // Minimum execution time: 30_690_000 picoseconds. + Weight::from_parts(31_032_000, 3540) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 75b96b2d8e9..2d4ce9ab570 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-04-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 @@ -26,17 +26,18 @@ // target/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=westmint-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::generic -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=westmint-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/westmint/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -50,6 +51,8 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -62,81 +65,83 @@ impl WeightInfo { // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) pub fn report_holding() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 368_187_000 picoseconds. - Weight::from_parts(369_271_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `109` + // Estimated: `3574` + // Minimum execution time: 346_394_000 picoseconds. + Weight::from_parts(350_270_000, 3574) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn buy_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_064_000 picoseconds. - Weight::from_parts(4_163_000, 0) + // Minimum execution time: 3_961_000 picoseconds. + Weight::from_parts(4_107_000, 0) } // Storage: PolkadotXcm Queries (r:1 w:0) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) pub fn query_response() -> Weight { // Proof Size summary in bytes: - // Measured: `69` - // Estimated: `3534` - // Minimum execution time: 11_590_000 picoseconds. - Weight::from_parts(11_834_000, 3534) + // Measured: `103` + // Estimated: `3568` + // Minimum execution time: 10_701_000 picoseconds. + Weight::from_parts(11_032_000, 3568) .saturating_add(T::DbWeight::get().reads(1)) } pub fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 14_425_000 picoseconds. - Weight::from_parts(14_713_000, 0) + // Minimum execution time: 12_944_000 picoseconds. + Weight::from_parts(13_289_000, 0) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_539_000 picoseconds. - Weight::from_parts(4_709_000, 0) + // Minimum execution time: 4_222_000 picoseconds. + Weight::from_parts(4_366_000, 0) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_933_000 picoseconds. - Weight::from_parts(2_983_000, 0) + // Minimum execution time: 2_625_000 picoseconds. + Weight::from_parts(2_734_000, 0) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_867_000 picoseconds. - Weight::from_parts(2_957_000, 0) + // Minimum execution time: 2_704_000 picoseconds. + Weight::from_parts(2_759_000, 0) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_891_000 picoseconds. - Weight::from_parts(2_945_000, 0) + // Minimum execution time: 2_608_000 picoseconds. + Weight::from_parts(2_668_000, 0) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_783_000 picoseconds. - Weight::from_parts(3_882_000, 0) + // Minimum execution time: 3_518_000 picoseconds. + Weight::from_parts(3_612_000, 0) } pub fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_843_000 picoseconds. - Weight::from_parts(2_959_000, 0) + // Minimum execution time: 2_607_000 picoseconds. + Weight::from_parts(2_661_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -149,21 +154,21 @@ impl WeightInfo { // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) pub fn report_error() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 25_284_000 picoseconds. - Weight::from_parts(25_778_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `109` + // Estimated: `3574` + // Minimum execution time: 27_012_000 picoseconds. + Weight::from_parts(27_677_000, 3574) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } // Storage: PolkadotXcm AssetTraps (r:1 w:1) // Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured) pub fn claim_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `126` - // Estimated: `3591` - // Minimum execution time: 16_533_000 picoseconds. - Weight::from_parts(16_974_000, 3591) + // Measured: `160` + // Estimated: `3625` + // Minimum execution time: 15_768_000 picoseconds. + Weight::from_parts(16_080_000, 3625) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -171,11 +176,13 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_867_000 picoseconds. - Weight::from_parts(3_018_000, 0) + // Minimum execution time: 2_575_000 picoseconds. + Weight::from_parts(2_675_000, 0) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -188,12 +195,12 @@ impl WeightInfo { // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) pub fn subscribe_version() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `13320` - // Minimum execution time: 28_098_000 picoseconds. - Weight::from_parts(28_424_000, 13320) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `109` + // Estimated: `3574` + // Minimum execution time: 30_215_000 picoseconds. + Weight::from_parts(30_714_000, 3574) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) } // Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -201,12 +208,14 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_062_000 picoseconds. - Weight::from_parts(5_184_000, 0) + // Minimum execution time: 4_803_000 picoseconds. + Weight::from_parts(4_927_000, 0) .saturating_add(T::DbWeight::get().writes(1)) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -219,50 +228,52 @@ impl WeightInfo { // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) pub fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 413_217_000 picoseconds. - Weight::from_parts(415_362_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `109` + // Estimated: `3574` + // Minimum execution time: 387_266_000 picoseconds. + Weight::from_parts(391_770_000, 3574) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn burn_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 130_094_000 picoseconds. - Weight::from_parts(132_683_000, 0) + // Minimum execution time: 118_603_000 picoseconds. + Weight::from_parts(120_201_000, 0) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_633_000 picoseconds. - Weight::from_parts(12_833_000, 0) + // Minimum execution time: 11_815_000 picoseconds. + Weight::from_parts(12_240_000, 0) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_012_000 picoseconds. - Weight::from_parts(3_105_000, 0) + // Minimum execution time: 2_671_000 picoseconds. + Weight::from_parts(2_776_000, 0) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_926_000 picoseconds. - Weight::from_parts(3_030_000, 0) + // Minimum execution time: 2_624_000 picoseconds. + Weight::from_parts(2_709_000, 0) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_172_000 picoseconds. - Weight::from_parts(3_250_000, 0) + // Minimum execution time: 2_816_000 picoseconds. + Weight::from_parts(2_898_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -275,22 +286,24 @@ impl WeightInfo { // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) pub fn query_pallet() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 29_409_000 picoseconds. - Weight::from_parts(29_799_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `109` + // Estimated: `3574` + // Minimum execution time: 31_286_000 picoseconds. + Weight::from_parts(31_716_000, 3574) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn expect_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_448_000 picoseconds. - Weight::from_parts(5_613_000, 0) + // Minimum execution time: 5_208_000 picoseconds. + Weight::from_parts(5_321_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) + // Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) @@ -303,33 +316,33 @@ impl WeightInfo { // Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) pub fn report_transact_status() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `11269` - // Minimum execution time: 25_875_000 picoseconds. - Weight::from_parts(26_241_000, 11269) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `109` + // Estimated: `3574` + // Minimum execution time: 27_724_000 picoseconds. + Weight::from_parts(28_739_000, 3574) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub fn clear_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_880_000 picoseconds. - Weight::from_parts(2_959_000, 0) + // Minimum execution time: 2_711_000 picoseconds. + Weight::from_parts(2_788_000, 0) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_900_000 picoseconds. - Weight::from_parts(2_972_000, 0) + // Minimum execution time: 2_660_000 picoseconds. + Weight::from_parts(2_757_000, 0) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_875_000 picoseconds. - Weight::from_parts(2_940_000, 0) + // Minimum execution time: 2_698_000 picoseconds. + Weight::from_parts(2_804_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -338,23 +351,23 @@ impl WeightInfo { pub fn universal_origin() -> Weight { // Proof Size summary in bytes: // Measured: `158` - // Estimated: `7373` - // Minimum execution time: 10_161_000 picoseconds. - Weight::from_parts(10_414_000, 7373) + // Estimated: `5884` + // Minimum execution time: 9_692_000 picoseconds. + Weight::from_parts(9_998_000, 5884) .saturating_add(T::DbWeight::get().reads(2)) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_877_000 picoseconds. - Weight::from_parts(2_974_000, 0) + // Minimum execution time: 2_566_000 picoseconds. + Weight::from_parts(2_668_000, 0) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_055_000 picoseconds. - Weight::from_parts(3_135_000, 0) + // Minimum execution time: 2_754_000 picoseconds. + Weight::from_parts(2_847_000, 0) } } diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index 06bf25b6f64..ad195251f67 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -14,16 +14,13 @@ // limitations under the License. use super::{ - AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, ForeignAssets, - ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, - TrustBackedAssetsInstance, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, BridgeTransfer, + ForeignAssets, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, + RuntimeOrigin, TrustBackedAssetsInstance, WeightToFee, XcmpQueue, }; -use assets_common::{ - location_conversion::GlobalConsensusParachainConvert, - matching::{ - FromSiblingParachain, IsDifferentGlobalConsensusConcreteAsset, IsForeignConcreteAsset, - StartsWith, StartsWithExplicitGlobalConsensus, - }, +use assets_common::matching::{ + FromSiblingParachain, IsDifferentGlobalConsensusConcreteAsset, IsForeignConcreteAsset, + StartsWith, StartsWithExplicitGlobalConsensus, }; use frame_support::{ match_types, parameter_types, @@ -32,22 +29,19 @@ use frame_support::{ use frame_system::EnsureRoot; use pallet_bridge_transfer::impls::{AllowedUniversalAliasesOf, IsAllowedReserveOf}; use pallet_xcm::XcmPassthrough; -use parachains_common::{ - impls::ToStakingPot, - xcm_config::{ - AssetFeeAsExistentialDepositMultiplier, DenyReserveTransferToRelayChain, DenyThenTry, - }, -}; +use parachains_common::{impls::ToStakingPot, xcm_config::AssetFeeAsExistentialDepositMultiplier}; use polkadot_parachain::primitives::Sibling; use sp_runtime::traits::ConvertInto; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FungiblesAdapter, IsConcrete, LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, - ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, WeightInfoBounds, WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, + DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FungiblesAdapter, + GlobalConsensusParachainConvertsFor, IsConcrete, LocalMint, NativeAsset, NoChecking, + ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UnpaidRemoteExporter, + UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -73,8 +67,9 @@ pub type LocationToAccountId = ( SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, - // Different global consensus parachain sovereign account - GlobalConsensusParachainConvert, + // Different global consensus parachain sovereign account. + // (Used for over-bridge transfers and reserve processing) + GlobalConsensusParachainConvertsFor, ); /// Means for transacting the native currency on this chain. @@ -118,7 +113,7 @@ pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConverte // Ignore `TrustBackedAssets` explicitly StartsWith, // Ignore asset which starts explicitly with our `GlobalConsensus(NetworkId)`, means: - // - foreign assets from our consensus should be: `MultiLocation {parent: 1, X*(Parachain(xyz))} + // - foreign assets from our consensus should be: `MultiLocation {parents: 1, X*(Parachain(xyz), ..)} // - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` wont be accepted here StartsWithExplicitGlobalConsensus, ), @@ -180,6 +175,7 @@ match_types! { MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; } + /// A call filter for the XCM Transact instruction. This is a temporary measure until we properly /// account for proof size weights. /// @@ -197,179 +193,180 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility( - pallet_utility::Call::as_derivative { .. } | - pallet_utility::Call::batch { .. } | - pallet_utility::Call::batch_all { .. }, - ) | - RuntimeCall::BridgeTransfer(..) | - RuntimeCall::Assets( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility( + pallet_utility::Call::as_derivative { .. } | + pallet_utility::Call::batch { .. } | + pallet_utility::Call::batch_all { .. }, + ) | RuntimeCall::Assets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::ForeignAssets( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::ForeignAssets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::set_metadata { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Nfts( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::NftFractionalization( + pallet_nft_fractionalization::Call::fractionalize { .. } | + pallet_nft_fractionalization::Call::unify { .. }, + ) | RuntimeCall::Nfts( pallet_nfts::Call::create { .. } | - pallet_nfts::Call::force_create { .. } | - pallet_nfts::Call::destroy { .. } | - pallet_nfts::Call::mint { .. } | - pallet_nfts::Call::force_mint { .. } | - pallet_nfts::Call::burn { .. } | - pallet_nfts::Call::transfer { .. } | - pallet_nfts::Call::lock_item_transfer { .. } | - pallet_nfts::Call::unlock_item_transfer { .. } | - pallet_nfts::Call::lock_collection { .. } | - pallet_nfts::Call::transfer_ownership { .. } | - pallet_nfts::Call::set_team { .. } | - pallet_nfts::Call::force_collection_owner { .. } | - pallet_nfts::Call::force_collection_config { .. } | - pallet_nfts::Call::approve_transfer { .. } | - pallet_nfts::Call::cancel_approval { .. } | - pallet_nfts::Call::clear_all_transfer_approvals { .. } | - pallet_nfts::Call::lock_item_properties { .. } | - pallet_nfts::Call::set_attribute { .. } | - pallet_nfts::Call::force_set_attribute { .. } | - pallet_nfts::Call::clear_attribute { .. } | - pallet_nfts::Call::approve_item_attributes { .. } | - pallet_nfts::Call::cancel_item_attributes_approval { .. } | - pallet_nfts::Call::set_metadata { .. } | - pallet_nfts::Call::clear_metadata { .. } | - pallet_nfts::Call::set_collection_metadata { .. } | - pallet_nfts::Call::clear_collection_metadata { .. } | - pallet_nfts::Call::set_accept_ownership { .. } | - pallet_nfts::Call::set_collection_max_supply { .. } | - pallet_nfts::Call::update_mint_settings { .. } | - pallet_nfts::Call::set_price { .. } | - pallet_nfts::Call::buy_item { .. } | - pallet_nfts::Call::pay_tips { .. } | - pallet_nfts::Call::create_swap { .. } | - pallet_nfts::Call::cancel_swap { .. } | - pallet_nfts::Call::claim_swap { .. }, - ) | - RuntimeCall::Uniques( + pallet_nfts::Call::force_create { .. } | + pallet_nfts::Call::destroy { .. } | + pallet_nfts::Call::mint { .. } | + pallet_nfts::Call::force_mint { .. } | + pallet_nfts::Call::burn { .. } | + pallet_nfts::Call::transfer { .. } | + pallet_nfts::Call::lock_item_transfer { .. } | + pallet_nfts::Call::unlock_item_transfer { .. } | + pallet_nfts::Call::lock_collection { .. } | + pallet_nfts::Call::transfer_ownership { .. } | + pallet_nfts::Call::set_team { .. } | + pallet_nfts::Call::force_collection_owner { .. } | + pallet_nfts::Call::force_collection_config { .. } | + pallet_nfts::Call::approve_transfer { .. } | + pallet_nfts::Call::cancel_approval { .. } | + pallet_nfts::Call::clear_all_transfer_approvals { .. } | + pallet_nfts::Call::lock_item_properties { .. } | + pallet_nfts::Call::set_attribute { .. } | + pallet_nfts::Call::force_set_attribute { .. } | + pallet_nfts::Call::clear_attribute { .. } | + pallet_nfts::Call::approve_item_attributes { .. } | + pallet_nfts::Call::cancel_item_attributes_approval { .. } | + pallet_nfts::Call::set_metadata { .. } | + pallet_nfts::Call::clear_metadata { .. } | + pallet_nfts::Call::set_collection_metadata { .. } | + pallet_nfts::Call::clear_collection_metadata { .. } | + pallet_nfts::Call::set_accept_ownership { .. } | + pallet_nfts::Call::set_collection_max_supply { .. } | + pallet_nfts::Call::update_mint_settings { .. } | + pallet_nfts::Call::set_price { .. } | + pallet_nfts::Call::buy_item { .. } | + pallet_nfts::Call::pay_tips { .. } | + pallet_nfts::Call::create_swap { .. } | + pallet_nfts::Call::cancel_swap { .. } | + pallet_nfts::Call::claim_swap { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. }, + ) | RuntimeCall::BridgeTransfer(..) + ) } } -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - // Allow XCMs with some computed origins to pass through. - WithComputedOrigin< - ( - // If the message is one that immediately attemps to pay for execution, then allow it. - AllowTopLevelPaidExecutionFrom, - // Parent and its pluralities (i.e. governance bodies) get free execution. - AllowExplicitUnpaidExecutionFrom, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - ), - UniversalLocation, - ConstU32<8>, - >, - ), +pub type Barrier = TrailingSetTopicAsId< + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its pluralities (i.e. governance bodies) get free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, + ), + >, >; pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier< @@ -439,12 +436,12 @@ pub type LocalOriginToLocation = SignedToAccountId32, // ..and XCMP to communicate with the sibling chains. XcmpQueue, -); +)>; #[cfg(feature = "runtime-benchmarks")] parameter_types! { @@ -479,6 +476,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -495,14 +494,15 @@ pub type ForeignCreatorsSovereignAccountOf = ( /// Simple conversion of `u32` into an `AssetId` for use in benchmarking. pub struct XcmBenchmarkHelper; #[cfg(feature = "runtime-benchmarks")] -use pallet_assets::BenchmarkHelper; -#[cfg(feature = "runtime-benchmarks")] -impl BenchmarkHelper for XcmBenchmarkHelper { +impl pallet_assets::BenchmarkHelper for XcmBenchmarkHelper { fn create_asset_id_parameter(id: u32) -> MultiLocation { MultiLocation { parents: 1, interior: X1(Parachain(id)) } } } +/// Bridge router, which wraps and sends xcm to BridgeHub to be delivered to the different GlobalConsensus +pub type BridgeXcmSender = UnpaidRemoteExporter; + /// Benchmarks helper for over-bridge transfer pallet. #[cfg(feature = "runtime-benchmarks")] pub struct BridgeTransferBenchmarksHelper; @@ -514,6 +514,11 @@ impl BridgeTransferBenchmarksHelper { MultiLocation::new(2, X2(GlobalConsensus(Kusama), Parachain(1000))) } + /// Max fee we are willing to pay on the bridged side + fn allowed_target_location_max_fee() -> Option { + Some((MultiLocation::parent(), 50_000_000_000_u128).into()) + } + /// Identifier of the sibling bridge-hub parachain. fn bridge_hub_para_id() -> u32 { 1002 @@ -527,12 +532,12 @@ impl pallet_bridge_transfer::BenchmarkHelper for BridgeTransferBe Kusama, pallet_bridge_transfer::BridgeConfig { bridge_location: (Parent, Parachain(Self::bridge_hub_para_id())).into(), - // TODO: right now `UnpaidRemoteExporter` is used to send XCM messages and it requires + // Right now `UnpaidRemoteExporter` is used to send XCM messages and it requires // fee to be `None`. If we're going to change that (are we?), then we should replace // this `None` with `Some(Self::make_asset(crate::ExistentialDeposit::get()))` bridge_location_fee: None, allowed_target_location: Self::allowed_target_location(), - max_target_location_fee: None, + max_target_location_fee: Self::allowed_target_location_max_fee(), }, )) } @@ -553,4 +558,70 @@ impl pallet_bridge_transfer::BenchmarkHelper for BridgeTransferBe interior: X2(GlobalConsensus(Kusama), Parachain(1000)), })) } + + fn prepare_asset_transfer( + ) -> Option<(RuntimeOrigin, xcm::VersionedMultiAssets, xcm::VersionedMultiLocation)> { + use frame_support::traits::Currency; + + // our `BridgeXcmSender` assumes that the HRMP channel is opened between this + // parachain and the sibling bridge-hub parachain + cumulus_pallet_parachain_system::Pallet::::open_outbound_hrmp_channel_for_benchmarks( + Self::bridge_hub_para_id().into(), + ); + + // sender account + let sender_account = AccountId::from([42u8; 32]); + + // We need root origin to create asset + let minimum_asset_balance = 3333333_u128; + let local_asset_id = 1; + frame_support::assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + local_asset_id.into(), + sender_account.clone().into(), + true, + minimum_asset_balance + )); + + // We mint enough asset for the account to exist for assets + frame_support::assert_ok!(Assets::mint( + RuntimeOrigin::signed(sender_account.clone()), + local_asset_id.into(), + sender_account.clone().into(), + minimum_asset_balance * 4 + )); + + // deposit enough funds to the sender account + let existential_deposit = crate::ExistentialDeposit::get(); + let _ = Balances::deposit_creating(&sender_account, existential_deposit * 10); + + // finally - prepare assets and destination (pallet_assets is worse than pallet_balances) + use xcm_executor::traits::Convert; + let asset_id_location = assets_common::AssetIdForTrustBackedAssetsConvert::< + TrustBackedAssetsPalletLocation, + >::reverse_ref(local_asset_id) + .unwrap(); + let asset: MultiAsset = (Concrete(asset_id_location), minimum_asset_balance * 2).into(); + + let assets = xcm::VersionedMultiAssets::V3(asset.into()); + let destination = xcm::VersionedMultiLocation::V3(Self::allowed_target_location()); + + Some((RuntimeOrigin::signed(sender_account), assets, destination)) + } + + fn prepare_ping_transfer() -> Option<(RuntimeOrigin, xcm::VersionedMultiLocation)> { + // our `BridgeXcmSender` assumes that the HRMP channel is opened between this + // parachain and the sibling bridge-hub parachain + cumulus_pallet_parachain_system::Pallet::::open_outbound_hrmp_channel_for_benchmarks( + Self::bridge_hub_para_id().into(), + ); + + // sender account + let sender_account = AccountId::from([42u8; 32]); + + // finally - prepare destination + let destination = xcm::VersionedMultiLocation::V3(Self::allowed_target_location()); + + Some((RuntimeOrigin::signed(sender_account), destination)) + } } diff --git a/parachains/runtimes/assets/westmint/tests/tests.rs b/parachains/runtimes/assets/westmint/tests/tests.rs index 2fc700c4b1e..da4636be0a6 100644 --- a/parachains/runtimes/assets/westmint/tests/tests.rs +++ b/parachains/runtimes/assets/westmint/tests/tests.rs @@ -1,4 +1,4 @@ -use asset_test_utils::{ExtBuilder, RuntimeHelper, XcmReceivedFrom}; +use asset_test_utils::{CollatorSessionKeys, ExtBuilder, RuntimeHelper, XcmReceivedFrom}; use codec::{Decode, DecodeLimit, Encode}; use cumulus_primitives_utility::ChargeWeightInFungibles; use frame_support::{ @@ -14,7 +14,7 @@ pub use westmint_runtime::{ CheckingAccount, LocationToAccountId, TrustBackedAssetsPalletLocation, XcmConfig, }, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, - ParachainSystem, Runtime, SessionKeys, System, TrustBackedAssetsInstance, + ParachainSystem, Runtime, SessionKeys, System, TrustBackedAssetsInstance, XcmpQueue, }; use westmint_runtime::{ xcm_config::{ @@ -30,11 +30,20 @@ use xcm_executor::{ }; const ALICE: [u8; 32] = [1u8; 32]; +const BOB: [u8; 32] = [0u8; 32]; const SOME_ASSET_ADMIN: [u8; 32] = [5u8; 32]; type AssetIdForTrustBackedAssetsConvert = assets_common::AssetIdForTrustBackedAssetsConvert; +fn collator_session_keys() -> CollatorSessionKeys { + CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, + ) +} + #[test] fn test_asset_xcm_trader() { ExtBuilder::::default() @@ -86,19 +95,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -158,7 +164,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -232,7 +238,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -284,11 +290,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); @@ -423,7 +429,7 @@ fn test_assets_balances_api_works() { let foreign_asset_minimum_asset_balance = 3333333_u128; assert_ok!(ForeignAssets::force_create( RuntimeHelper::::root_origin(), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(SOME_ASSET_ADMIN).into(), false, foreign_asset_minimum_asset_balance @@ -432,7 +438,7 @@ fn test_assets_balances_api_works() { // We first mint enough asset for the account to exist for assets assert_ok!(ForeignAssets::mint( RuntimeHelper::::origin_of(AccountId::from(SOME_ASSET_ADMIN)), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(ALICE).into(), 6 * foreign_asset_minimum_asset_balance )); @@ -482,11 +488,7 @@ asset_test_utils::include_teleports_for_native_asset_works!( CheckingAccount, WeightToFee, ParachainSystem, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|runtime_event_encoded: Vec| { match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { @@ -511,11 +513,7 @@ asset_test_utils::include_teleports_for_foreign_assets_works!( ParachainSystem, ForeignCreatorsSovereignAccountOf, ForeignAssetsInstance, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|runtime_event_encoded: Vec| { match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { @@ -534,11 +532,7 @@ asset_test_utils::include_teleports_for_foreign_assets_works!( asset_test_utils::include_asset_transactor_transfer_with_local_consensus_currency_works!( Runtime, XcmConfig, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|| { assert!(Assets::asset_ids().collect::>().is_empty()); @@ -557,11 +551,7 @@ asset_test_utils::include_asset_transactor_transfer_with_pallet_assets_instance_ TrustBackedAssetsInstance, AssetIdForTrustBackedAssets, AssetIdForTrustBackedAssetsConvert, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), 12345, Box::new(|| { @@ -579,11 +569,7 @@ asset_test_utils::include_asset_transactor_transfer_with_pallet_assets_instance_ ForeignAssetsInstance, MultiLocation, JustTry, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), MultiLocation { parents: 1, interior: X2(Parachain(1313), GeneralIndex(12345)) }, Box::new(|| { @@ -602,11 +588,7 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p ForeignAssetsInstance, MultiLocation, JustTry, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), AssetDeposit::get(), MetadataDepositBase::get(), @@ -628,41 +610,86 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p }) ); -asset_test_utils::include_can_governance_change_bridge_transfer_in_configuration!( - Runtime, - XcmConfig, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - Box::new(|call| RuntimeCall::BridgeTransfer(call).encode()), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), - _ => None, - } - }) -); +#[test] +fn can_governance_change_bridge_transfer_out_configuration() { + asset_test_utils::test_cases::can_governance_change_bridge_transfer_out_configuration::< + Runtime, + XcmConfig, + >( + collator_session_keys(), + Box::new(|call| RuntimeCall::BridgeTransfer(call).encode()), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), + _ => None, + } + }), + ) +} -asset_test_utils::include_receive_reserve_asset_deposited_from_different_consensus_works!( - Runtime, - XcmConfig, - LocationToAccountId, - ForeignAssetsInstance, - asset_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), +#[test] +fn initiate_transfer_asset_via_bridge_for_native_asset_works() { + asset_test_utils::test_cases::initiate_transfer_asset_via_bridge_for_native_asset_works::< + Runtime, + XcmConfig, + ParachainSystem, + XcmpQueue, + LocationToAccountId, + >( + collator_session_keys(), + ExistentialDeposit::get(), AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - ExistentialDeposit::get(), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), - _ => None, - } - }) -); + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + ) +} + +#[test] +fn can_governance_change_bridge_transfer_in_configuration() { + asset_test_utils::test_cases::can_governance_change_bridge_transfer_in_configuration::< + Runtime, + XcmConfig, + >( + collator_session_keys(), + Box::new(|call| RuntimeCall::BridgeTransfer(call).encode()), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeTransfer(event)) => Some(event), + _ => None, + } + }), + ) +} + +#[test] +fn receive_reserve_asset_deposited_from_different_consensus_works() { + asset_test_utils::test_cases::receive_reserve_asset_deposited_from_different_consensus_works::< + Runtime, + XcmConfig, + LocationToAccountId, + ForeignAssetsInstance, + >( + collator_session_keys(), + ExistentialDeposit::get(), + AccountId::from(BOB), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), + _ => None, + } + }), + ) +} #[test] fn plain_receive_teleported_asset_works() { diff --git a/parachains/runtimes/bridge-hubs/README.md b/parachains/runtimes/bridge-hubs/README.md index 9b024769195..d457bc770ea 100644 --- a/parachains/runtimes/bridge-hubs/README.md +++ b/parachains/runtimes/bridge-hubs/README.md @@ -1,8 +1,8 @@ - [Bridge-hub Parachains](#bridge-hub-parachains) - * [How to test locally Rococo <-> Wococo](#how-to-test-locally-rococo-----wococo) - + [Prepare/Build/Deploy](#prepare-build-deploy) + * [Requirements for local run/testing](#requirements-for-local-run-testing) + * [How to test locally Rococo <-> Wococo bridge](#how-to-test-locally-rococo-----wococo-bridge) + [Run chains (Rococo + BridgeHub, Wococo + BridgeHub) with zombienet](#run-chains--rococo---bridgehub--wococo---bridgehub--with-zombienet) - + [Run relayers (Rococo, Wococo)](#run-relayers--rococo--wococo-) + + [Run relayer (BridgeHubRococo, BridgeHubWococo)](#run-relayer--bridgehubrococo--bridgehubwococo-) - [Run with script (alternative 1)](#run-with-script--alternative-1-) - [Run with binary (alternative 2)](#run-with-binary--alternative-2-) + [Send messages](#send-messages) @@ -29,46 +29,65 @@ The current trustless bridges planned for the BridgeHub(s) are: ![](./docs/bridge-hub-parachain-design.jpg "Basic deployment setup") -## How to test locally Rococo <-> Wococo +## Requirements for local run/testing -### Prepare/Build/Deploy ``` # Prepare empty directory for testing mkdir -p ~/local_bridge_testing/bin mkdir -p ~/local_bridge_testing/logs +--- # 1. Install zombienet Go to: https://github.com/paritytech/zombienet/releases Copy the apropriate binary (zombienet-linux) from the latest release to ~/local_bridge_testing/bin +--- # 2. Build polkadot binary git clone https://github.com/paritytech/polkadot.git cd polkadot -cargo build --release + +# if you want to test Kusama/Polkadot bridge, we need "sudo pallet + fast-runtime", +# so please, find the latest polkadot's repository branch `it/release-vX.Y.Z-fast-sudo` +# e.g: +# git checkout -b it/release-v0.9.42-fast-sudo --track origin/it/release-v0.9.42-fast-sudo + +cargo build --release --features fast-runtime cp target/release/polkadot ~/local_bridge_testing/bin/polkadot +--- # 3. Build cumulus polkadot-parachain binary cd + # checkout desired branch or use master: -# git checkout -b bridge-hub-rococo-wococo --track origin/bridge-hub-rococo-wococo -git checkout -b master --track origin/master +# git checkout -b master --track origin/master + cargo build --release --locked -p polkadot-parachain-bin cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-mint +--- # 4. Build substrate-relay binary git clone https://github.com/paritytech/parity-bridges-common.git cd parity-bridges-common + +# checkout desired branch or use master: +# git checkout -b master --track origin/master +git checkout -b polkadot-staging --track origin/polkadot-staging + cargo build --release -p substrate-relay cp target/release/substrate-relay ~/local_bridge_testing/bin/substrate-relay -# (Optional) 5. Build polkadot-parachain-mint binary with statemine/westmint for moving assets +--- +# 5. Build polkadot-parachain-mint binary with statemine/westmint for moving assets cd +# TODO:check-parameter - change this when merged to master git checkout -b bko-transfer-asset-via-bridge --track origin/bko-transfer-asset-via-bridge cargo build --release --locked -p polkadot-parachain-bin cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-mint ``` +## How to test locally Rococo <-> Wococo bridge + ### Run chains (Rococo + BridgeHub, Wococo + BridgeHub) with zombienet ``` @@ -87,7 +106,7 @@ POLKADOT_PARACHAIN_BINARY_PATH_FOR_WOCKMINT=~/local_bridge_testing/bin/polkadot- ~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml ``` -### Run relayers (Rococo, Wococo) +### Run relayer (BridgeHubRococo, BridgeHubWococo) **Accounts of BridgeHub parachains:** - `Bob` is pallet owner of all bridge pallets diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml index 4f7338a8e81..4853ad2eb60 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -12,8 +12,8 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.163", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index 952c3147306..86964af6ced 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -108,6 +108,9 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -115,6 +118,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + Migrations, >; impl_opaque_keys! { @@ -128,7 +132,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("bridge-hub-kusama"), impl_name: create_runtime_str!("bridge-hub-kusama"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 3, @@ -246,7 +250,7 @@ impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -254,7 +258,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -615,7 +619,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -653,7 +657,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( KsmRelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmRelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmRelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -667,7 +671,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(KsmRelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/cumulus_pallet_xcmp_queue.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/cumulus_pallet_xcmp_queue.rs index 4fa7848e6ff..caf5ce9f44e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/cumulus_pallet_xcmp_queue.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_373_000 picoseconds. - Weight::from_parts(5_599_000, 0) + // Minimum execution time: 5_497_000 picoseconds. + Weight::from_parts(5_680_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_534_000 picoseconds. - Weight::from_parts(5_769_000, 0) + // Minimum execution time: 5_600_000 picoseconds. + Weight::from_parts(5_855_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/frame_system.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/frame_system.rs index 65925307177..854a7b9ba5f 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/frame_system.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/frame_system.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `frame_system`. pub struct WeightInfo(PhantomData); @@ -52,22 +53,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_314_000 picoseconds. - Weight::from_parts(2_371_000, 0) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_100_689, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(369, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(412, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_667_000 picoseconds. - Weight::from_parts(7_755_000, 0) + // Minimum execution time: 7_879_000 picoseconds. + Weight::from_parts(8_041_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_451, 0).saturating_mul(b.into())) + } + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -77,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_135_000 picoseconds. - Weight::from_parts(4_368_000, 0) + // Minimum execution time: 4_358_000 picoseconds. + Weight::from_parts(4_537_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -90,11 +94,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_351_000 picoseconds. - Weight::from_parts(2_396_000, 0) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_395_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_912 - .saturating_add(Weight::from_parts(729_478, 0).saturating_mul(i.into())) + // Standard Error: 1_727 + .saturating_add(Weight::from_parts(690_266, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -104,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_417_000 picoseconds. - Weight::from_parts(2_546_000, 0) + // Minimum execution time: 2_513_000 picoseconds. + Weight::from_parts(2_540_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 842 - .saturating_add(Weight::from_parts(542_458, 0).saturating_mul(i.into())) + // Standard Error: 815 + .saturating_add(Weight::from_parts(505_090, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -118,11 +122,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `68 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 4_324_000 picoseconds. - Weight::from_parts(4_432_000, 0) + // Minimum execution time: 4_242_000 picoseconds. + Weight::from_parts(4_308_000, 0) .saturating_add(Weight::from_parts(0, 66)) - // Standard Error: 1_165 - .saturating_add(Weight::from_parts(1_070_662, 0).saturating_mul(p.into())) + // Standard Error: 1_130 + .saturating_add(Weight::from_parts(1_032_054, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_balances.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_balances.rs index 7ea0437075a..94ac23e26eb 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_balances.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_balances.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 34_147_000 picoseconds. - Weight::from_parts(34_681_000, 0) + // Minimum execution time: 53_880_000 picoseconds. + Weight::from_parts(54_466_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 25_961_000 picoseconds. - Weight::from_parts(26_543_000, 0) + // Minimum execution time: 41_306_000 picoseconds. + Weight::from_parts(41_665_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,8 +78,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 15_954_000 picoseconds. - Weight::from_parts(16_276_000, 0) + // Minimum execution time: 16_599_000 picoseconds. + Weight::from_parts(16_864_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -89,8 +90,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 19_074_000 picoseconds. - Weight::from_parts(19_635_000, 0) + // Minimum execution time: 23_502_000 picoseconds. + Weight::from_parts(24_050_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +102,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 36_772_000 picoseconds. - Weight::from_parts(37_193_000, 0) + // Minimum execution time: 55_856_000 picoseconds. + Weight::from_parts(56_352_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -113,25 +114,38 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 32_430_000 picoseconds. - Weight::from_parts(32_766_000, 0) + // Minimum execution time: 49_975_000 picoseconds. + Weight::from_parts(50_428_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn upgrade_accounts(_: u32) -> Weight { - Weight::from_parts(0, 0) - } fn force_unreserve() -> Weight { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 15_239_000 picoseconds. - Weight::from_parts(15_620_000, 0) + // Minimum execution time: 19_123_000 picoseconds. + Weight::from_parts(19_504_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// 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]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (136 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 18_190_000 picoseconds. + Weight::from_parts(18_547_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 10_152 + .saturating_add(Weight::from_parts(14_418_366, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs index 37d874e0b75..1d48699a2e8 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_collator_selection` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collator_selection`. pub struct WeightInfo(PhantomData); @@ -56,11 +57,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `214 + b * (78 ±0)` // Estimated: `1203 + b * (2554 ±0)` - // Minimum execution time: 14_680_000 picoseconds. - Weight::from_parts(15_646_800, 0) + // Minimum execution time: 15_037_000 picoseconds. + Weight::from_parts(15_261_610, 0) .saturating_add(Weight::from_parts(0, 1203)) - // Standard Error: 4_021 - .saturating_add(Weight::from_parts(2_556_895, 0).saturating_mul(b.into())) + // Standard Error: 3_033 + .saturating_add(Weight::from_parts(2_590_070, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) @@ -71,8 +72,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_979_000 picoseconds. - Weight::from_parts(7_322_000, 0) + // Minimum execution time: 7_317_000 picoseconds. + Weight::from_parts(7_493_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,8 +83,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_328_000 picoseconds. - Weight::from_parts(7_524_000, 0) + // Minimum execution time: 7_580_000 picoseconds. + Weight::from_parts(7_821_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,12 +104,12 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn register_as_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1104 + c * (48 ±0)` - // Estimated: `61672 + c * (49 ±0)` - // Minimum execution time: 37_388_000 picoseconds. - Weight::from_parts(30_491_072, 0) - .saturating_add(Weight::from_parts(0, 61672)) - // Standard Error: 1_155 - .saturating_add(Weight::from_parts(100_794, 0).saturating_mul(c.into())) + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 42_783_000 picoseconds. + Weight::from_parts(35_128_208, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_291 + .saturating_add(Weight::from_parts(109_890, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) @@ -122,11 +123,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `428 + c * (48 ±0)` // Estimated: `49487` - // Minimum execution time: 29_110_000 picoseconds. - Weight::from_parts(19_158_409, 0) + // Minimum execution time: 34_135_000 picoseconds. + Weight::from_parts(23_714_718, 0) .saturating_add(Weight::from_parts(0, 49487)) - // Standard Error: 1_269 - .saturating_add(Weight::from_parts(104_083, 0).saturating_mul(c.into())) + // Standard Error: 1_293 + .saturating_add(Weight::from_parts(108_542, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,13 +140,46 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn note_author() -> Weight { // Proof Size summary in bytes: // Measured: `155` - // Estimated: `7729` - // Minimum execution time: 29_086_000 picoseconds. - Weight::from_parts(29_931_000, 0) - .saturating_add(Weight::from_parts(0, 7729)) + // Estimated: `6196` + // Minimum execution time: 44_345_000 picoseconds. + Weight::from_parts(44_853_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: CollatorSelection Candidates (r:1 w:0) /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(48002), added: 48497, mode: MaxEncodedLen) /// Storage: CollatorSelection LastAuthoredBlock (r:999 w:0) @@ -160,18 +194,18 @@ impl pallet_collator_selection::WeightInfo for WeightIn /// The range of component `c` is `[1, 1000]`. fn new_session(r: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `22815 + r * (116 ±0) + c * (97 ±0)` - // Estimated: `56697 + r * (2602 ±0) + c * (2520 ±0)` - // Minimum execution time: 16_710_000 picoseconds. - Weight::from_parts(16_907_000, 0) - .saturating_add(Weight::from_parts(0, 56697)) - // Standard Error: 800_677 - .saturating_add(Weight::from_parts(29_001_374, 0).saturating_mul(c.into())) + // Measured: `22815 + c * (97 ±0) + r * (116 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2602 ±0)` + // Minimum execution time: 16_932_000 picoseconds. + Weight::from_parts(17_022_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 901_942 + .saturating_add(Weight::from_parts(31_973_621, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 2602).saturating_mul(r.into())) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_multisig.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_multisig.rs index 56d954f12a0..f6a3b504a67 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_multisig.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_multisig.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); @@ -52,11 +53,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_068_000 picoseconds. - Weight::from_parts(12_319_883, 0) + // Minimum execution time: 11_985_000 picoseconds. + Weight::from_parts(12_506_234, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(493, 0).saturating_mul(z.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(601, 0).saturating_mul(z.into())) } /// Storage: Multisig Multisigs (r:1 w:1) /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3346), added: 5821, mode: MaxEncodedLen) @@ -66,13 +67,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 36_523_000 picoseconds. - Weight::from_parts(31_295_135, 0) + // Minimum execution time: 41_586_000 picoseconds. + Weight::from_parts(35_547_263, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 542 - .saturating_add(Weight::from_parts(60_423, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_200, 0).saturating_mul(z.into())) + // Standard Error: 376 + .saturating_add(Weight::from_parts(69_533, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_289, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -84,13 +85,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 27_342_000 picoseconds. - Weight::from_parts(21_614_247, 0) + // Minimum execution time: 27_819_000 picoseconds. + Weight::from_parts(21_900_751, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 546 - .saturating_add(Weight::from_parts(57_563, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_202, 0).saturating_mul(z.into())) + // Standard Error: 292 + .saturating_add(Weight::from_parts(65_723, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_301, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,14 +104,14 @@ impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `388 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 41_465_000 picoseconds. - Weight::from_parts(34_511_085, 0) - .saturating_add(Weight::from_parts(0, 10404)) - // Standard Error: 467 - .saturating_add(Weight::from_parts(78_918, 0).saturating_mul(s.into())) + // Estimated: `6811` + // Minimum execution time: 46_840_000 picoseconds. + Weight::from_parts(39_004_058, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 490 + .saturating_add(Weight::from_parts(86_465, 0).saturating_mul(s.into())) // Standard Error: 4 - .saturating_add(Weight::from_parts(1_201, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(1_317, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -121,11 +122,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 27_868_000 picoseconds. - Weight::from_parts(29_407_652, 0) + // Minimum execution time: 32_549_000 picoseconds. + Weight::from_parts(33_945_862, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 632 - .saturating_add(Weight::from_parts(69_333, 0).saturating_mul(s.into())) + // Standard Error: 599 + .saturating_add(Weight::from_parts(74_298, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -136,11 +137,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 18_599_000 picoseconds. - Weight::from_parts(19_776_275, 0) + // Minimum execution time: 19_264_000 picoseconds. + Weight::from_parts(20_336_652, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 522 - .saturating_add(Weight::from_parts(64_680, 0).saturating_mul(s.into())) + // Standard Error: 420 + .saturating_add(Weight::from_parts(67_305, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -151,11 +152,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 28_857_000 picoseconds. - Weight::from_parts(30_337_509, 0) + // Minimum execution time: 33_469_000 picoseconds. + Weight::from_parts(35_060_138, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 652 - .saturating_add(Weight::from_parts(67_443, 0).saturating_mul(s.into())) + // Standard Error: 575 + .saturating_add(Weight::from_parts(72_357, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_session.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_session.rs index bef2a83bc7c..653161034d9 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_session.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_session.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `297` - // Estimated: `7524` - // Minimum execution time: 17_925_000 picoseconds. - Weight::from_parts(18_292_000, 0) - .saturating_add(Weight::from_parts(0, 7524)) + // Estimated: `3762` + // Minimum execution time: 17_971_000 picoseconds. + Weight::from_parts(18_440_000, 0) + .saturating_add(Weight::from_parts(0, 3762)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -68,10 +69,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `279` - // Estimated: `4023` - // Minimum execution time: 13_384_000 picoseconds. - Weight::from_parts(13_788_000, 0) - .saturating_add(Weight::from_parts(0, 4023)) + // Estimated: `3744` + // Minimum execution time: 13_516_000 picoseconds. + Weight::from_parts(13_855_000, 0) + .saturating_add(Weight::from_parts(0, 3744)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_timestamp.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_timestamp.rs index c6b5b01504f..a7e0a69ca71 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_timestamp.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_timestamp.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_timestamp`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `49` - // Estimated: `2986` - // Minimum execution time: 7_946_000 picoseconds. - Weight::from_parts(8_181_000, 0) - .saturating_add(Weight::from_parts(0, 2986)) + // Estimated: `1493` + // Minimum execution time: 7_754_000 picoseconds. + Weight::from_parts(7_961_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +66,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `57` // Estimated: `0` - // Minimum execution time: 3_219_000 picoseconds. - Weight::from_parts(3_298_000, 0) + // Minimum execution time: 3_099_000 picoseconds. + Weight::from_parts(3_194_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_utility.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_utility.rs index 93eaff447ae..b9ab2ec61e5 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_utility.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_utility.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_utility`. pub struct WeightInfo(PhantomData); @@ -52,18 +53,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_837_000 picoseconds. - Weight::from_parts(16_686_299, 0) + // Minimum execution time: 7_486_000 picoseconds. + Weight::from_parts(4_952_171, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_233 - .saturating_add(Weight::from_parts(4_587_331, 0).saturating_mul(c.into())) + // Standard Error: 2_744 + .saturating_add(Weight::from_parts(4_878_827, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_582_000 picoseconds. - Weight::from_parts(5_700_000, 0) + // Minimum execution time: 5_441_000 picoseconds. + Weight::from_parts(5_550_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -71,18 +72,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_907_000 picoseconds. - Weight::from_parts(4_826_975, 0) + // Minimum execution time: 7_417_000 picoseconds. + Weight::from_parts(3_647_457, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_801 - .saturating_add(Weight::from_parts(4_836_457, 0).saturating_mul(c.into())) + // Standard Error: 3_303 + .saturating_add(Weight::from_parts(5_198_660, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_998_000 picoseconds. - Weight::from_parts(9_220_000, 0) + // Minimum execution time: 9_828_000 picoseconds. + Weight::from_parts(10_044_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -90,10 +91,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_961_000 picoseconds. - Weight::from_parts(7_518_503, 0) + // Minimum execution time: 7_599_000 picoseconds. + Weight::from_parts(7_657_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_307 - .saturating_add(Weight::from_parts(4_649_665, 0).saturating_mul(c.into())) + // Standard Error: 1_773 + .saturating_add(Weight::from_parts(4_893_962, 0).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs index df103d9266b..ec1fd4a40d3 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn send() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `9595` - // Minimum execution time: 26_368_000 picoseconds. - Weight::from_parts(27_314_000, 0) - .saturating_add(Weight::from_parts(0, 9595)) + // Estimated: `3503` + // Minimum execution time: 27_316_000 picoseconds. + Weight::from_parts(27_658_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +74,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `1489` - // Minimum execution time: 24_998_000 picoseconds. - Weight::from_parts(25_321_000, 0) + // Minimum execution time: 29_202_000 picoseconds. + Weight::from_parts(29_681_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -104,8 +105,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_733_000 picoseconds. - Weight::from_parts(10_002_000, 0) + // Minimum execution time: 10_266_000 picoseconds. + Weight::from_parts(10_449_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -115,8 +116,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_073_000 picoseconds. - Weight::from_parts(3_178_000, 0) + // Minimum execution time: 3_095_000 picoseconds. + Weight::from_parts(3_171_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,10 +140,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `14659` - // Minimum execution time: 31_313_000 picoseconds. - Weight::from_parts(31_916_000, 0) - .saturating_add(Weight::from_parts(0, 14659)) + // Estimated: `3503` + // Minimum execution time: 31_614_000 picoseconds. + Weight::from_parts(32_390_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -163,19 +164,21 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `220` - // Estimated: `14410` - // Minimum execution time: 32_721_000 picoseconds. - Weight::from_parts(33_013_000, 0) - .saturating_add(Weight::from_parts(0, 14410)) + // Estimated: `3685` + // Minimum execution time: 33_334_000 picoseconds. + Weight::from_parts(33_789_000, 0) + .saturating_add(Weight::from_parts(0, 3685)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) fn force_suspension() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_073_000 picoseconds. - Weight::from_parts(3_178_000, 0) + // Minimum execution time: 3_178_000 picoseconds. + Weight::from_parts(3_261_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -185,8 +188,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `95` // Estimated: `10985` - // Minimum execution time: 15_020_000 picoseconds. - Weight::from_parts(15_358_000, 0) + // Minimum execution time: 14_687_000 picoseconds. + Weight::from_parts(15_004_000, 0) .saturating_add(Weight::from_parts(0, 10985)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -197,8 +200,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `99` // Estimated: `10989` - // Minimum execution time: 15_095_000 picoseconds. - Weight::from_parts(15_309_000, 0) + // Minimum execution time: 14_595_000 picoseconds. + Weight::from_parts(14_813_000, 0) .saturating_add(Weight::from_parts(0, 10989)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -209,8 +212,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `13471` - // Minimum execution time: 15_809_000 picoseconds. - Weight::from_parts(16_139_000, 0) + // Minimum execution time: 14_926_000 picoseconds. + Weight::from_parts(15_337_000, 0) .saturating_add(Weight::from_parts(0, 13471)) .saturating_add(T::DbWeight::get().reads(5)) } @@ -229,10 +232,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_current_targets() -> Weight { // Proof Size summary in bytes: // Measured: `106` - // Estimated: `15981` - // Minimum execution time: 28_167_000 picoseconds. - Weight::from_parts(28_747_000, 0) - .saturating_add(Weight::from_parts(0, 15981)) + // Estimated: `6046` + // Minimum execution time: 28_680_000 picoseconds. + Weight::from_parts(29_159_000, 0) + .saturating_add(Weight::from_parts(0, 6046)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -242,8 +245,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `136` // Estimated: `8551` - // Minimum execution time: 8_484_000 picoseconds. - Weight::from_parts(8_776_000, 0) + // Minimum execution time: 8_124_000 picoseconds. + Weight::from_parts(8_299_000, 0) .saturating_add(Weight::from_parts(0, 8551)) .saturating_add(T::DbWeight::get().reads(3)) } @@ -253,8 +256,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `10996` - // Minimum execution time: 15_814_000 picoseconds. - Weight::from_parts(16_131_000, 0) + // Minimum execution time: 14_755_000 picoseconds. + Weight::from_parts(15_136_000, 0) .saturating_add(Weight::from_parts(0, 10996)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -274,10 +277,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: // Measured: `112` - // Estimated: `20967` - // Minimum execution time: 34_500_000 picoseconds. - Weight::from_parts(34_978_000, 0) - .saturating_add(Weight::from_parts(0, 20967)) + // Estimated: `11002` + // Minimum execution time: 34_250_000 picoseconds. + Weight::from_parts(34_888_000, 0) + .saturating_add(Weight::from_parts(0, 11002)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index 7cf23e0610b..9d11b07e54e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for BridgeHubKusamaXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for BridgeHubKusamaXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 648e0c7368a..c15e866ce9f 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -54,8 +54,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 19_924_000 picoseconds. - Weight::from_parts(20_322_000, 3593) + // Minimum execution time: 25_169_000 picoseconds. + Weight::from_parts(25_584_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +65,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `153` // Estimated: `6196` - // Minimum execution time: 32_669_000 picoseconds. - Weight::from_parts(33_313_000, 6196) + // Minimum execution time: 50_714_000 picoseconds. + Weight::from_parts(51_324_000, 6196) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -87,9 +87,9 @@ impl WeightInfo { pub fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `223` - // Estimated: `18205` - // Minimum execution time: 55_574_000 picoseconds. - Weight::from_parts(56_148_000, 18205) + // Estimated: `6196` + // Minimum execution time: 74_593_000 picoseconds. + Weight::from_parts(75_347_000, 6196) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -97,8 +97,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_271_000 picoseconds. - Weight::from_parts(4_338_000, 0) + // Minimum execution time: 4_485_000 picoseconds. + Weight::from_parts(4_562_000, 0) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -106,8 +106,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 23_972_000 picoseconds. - Weight::from_parts(24_305_000, 3593) + // Minimum execution time: 27_136_000 picoseconds. + Weight::from_parts(27_387_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -128,9 +128,9 @@ impl WeightInfo { pub fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `122` - // Estimated: `15097` - // Minimum execution time: 53_095_000 picoseconds. - Weight::from_parts(53_586_000, 15097) + // Estimated: `3593` + // Minimum execution time: 53_591_000 picoseconds. + Weight::from_parts(54_268_000, 3593) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -149,9 +149,9 @@ impl WeightInfo { pub fn initiate_teleport() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 30_394_000 picoseconds. - Weight::from_parts(31_238_000, 11244) + // Estimated: `3535` + // Minimum execution time: 30_062_000 picoseconds. + Weight::from_parts(30_771_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 738940ca868..0b4b1174160 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -63,9 +63,9 @@ impl WeightInfo { pub fn report_holding() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 30_841_000 picoseconds. - Weight::from_parts(31_223_000, 11244) + // Estimated: `3535` + // Minimum execution time: 34_626_000 picoseconds. + Weight::from_parts(35_122_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +73,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_749_000 picoseconds. - Weight::from_parts(2_894_000, 0) + // Minimum execution time: 3_405_000 picoseconds. + Weight::from_parts(3_503_000, 0) } // Storage: PolkadotXcm Queries (r:1 w:0) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) @@ -82,58 +82,58 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `3497` - // Minimum execution time: 10_637_000 picoseconds. - Weight::from_parts(10_904_000, 3497) + // Minimum execution time: 11_296_000 picoseconds. + Weight::from_parts(11_550_000, 3497) .saturating_add(T::DbWeight::get().reads(1)) } pub fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_587_000 picoseconds. - Weight::from_parts(12_882_000, 0) + // Minimum execution time: 13_932_000 picoseconds. + Weight::from_parts(14_220_000, 0) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_088_000 picoseconds. - Weight::from_parts(3_165_000, 0) + // Minimum execution time: 3_640_000 picoseconds. + Weight::from_parts(3_732_000, 0) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_748_000 picoseconds. - Weight::from_parts(2_868_000, 0) + // Minimum execution time: 3_195_000 picoseconds. + Weight::from_parts(3_298_000, 0) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_897_000 picoseconds. - Weight::from_parts(2_970_000, 0) + // Minimum execution time: 3_217_000 picoseconds. + Weight::from_parts(3_304_000, 0) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_793_000 picoseconds. - Weight::from_parts(2_883_000, 0) + // Minimum execution time: 3_237_000 picoseconds. + Weight::from_parts(3_273_000, 0) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_690_000 picoseconds. - Weight::from_parts(3_745_000, 0) + // Minimum execution time: 4_292_000 picoseconds. + Weight::from_parts(4_373_000, 0) } pub fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_760_000 picoseconds. - Weight::from_parts(2_807_000, 0) + // Minimum execution time: 3_198_000 picoseconds. + Weight::from_parts(3_271_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -150,9 +150,9 @@ impl WeightInfo { pub fn report_error() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 24_591_000 picoseconds. - Weight::from_parts(25_237_000, 11244) + // Estimated: `3535` + // Minimum execution time: 27_178_000 picoseconds. + Weight::from_parts(28_171_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -162,8 +162,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `90` // Estimated: `3555` - // Minimum execution time: 14_596_000 picoseconds. - Weight::from_parts(15_010_000, 3555) + // Minimum execution time: 16_146_000 picoseconds. + Weight::from_parts(16_496_000, 3555) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -171,8 +171,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_770_000 picoseconds. - Weight::from_parts(2_860_000, 0) + // Minimum execution time: 3_189_000 picoseconds. + Weight::from_parts(3_298_000, 0) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -189,9 +189,9 @@ impl WeightInfo { pub fn subscribe_version() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `13098` - // Minimum execution time: 25_644_000 picoseconds. - Weight::from_parts(26_269_000, 13098) + // Estimated: `3503` + // Minimum execution time: 27_844_000 picoseconds. + Weight::from_parts(28_113_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -201,8 +201,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_969_000 picoseconds. - Weight::from_parts(5_167_000, 0) + // Minimum execution time: 5_563_000 picoseconds. + Weight::from_parts(5_718_000, 0) .saturating_add(T::DbWeight::get().writes(1)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -220,9 +220,9 @@ impl WeightInfo { pub fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 27_894_000 picoseconds. - Weight::from_parts(28_294_000, 11244) + // Estimated: `3535` + // Minimum execution time: 30_296_000 picoseconds. + Weight::from_parts(30_843_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -230,36 +230,36 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_595_000 picoseconds. - Weight::from_parts(4_709_000, 0) + // Minimum execution time: 5_340_000 picoseconds. + Weight::from_parts(5_390_000, 0) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_957_000 picoseconds. - Weight::from_parts(3_035_000, 0) + // Minimum execution time: 3_312_000 picoseconds. + Weight::from_parts(3_411_000, 0) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_091_000 picoseconds. - Weight::from_parts(3_197_000, 0) + // Minimum execution time: 3_294_000 picoseconds. + Weight::from_parts(3_374_000, 0) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_953_000 picoseconds. - Weight::from_parts(3_036_000, 0) + // Minimum execution time: 3_197_000 picoseconds. + Weight::from_parts(3_261_000, 0) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_275_000 picoseconds. - Weight::from_parts(3_382_000, 0) + // Minimum execution time: 3_465_000 picoseconds. + Weight::from_parts(3_541_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -276,9 +276,9 @@ impl WeightInfo { pub fn query_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 30_240_000 picoseconds. - Weight::from_parts(30_533_000, 11244) + // Estimated: `3535` + // Minimum execution time: 29_942_000 picoseconds. + Weight::from_parts(30_426_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -286,8 +286,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_276_000 picoseconds. - Weight::from_parts(5_363_000, 0) + // Minimum execution time: 5_454_000 picoseconds. + Weight::from_parts(5_906_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -304,9 +304,9 @@ impl WeightInfo { pub fn report_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 27_019_000 picoseconds. - Weight::from_parts(27_675_000, 11244) + // Estimated: `3535` + // Minimum execution time: 27_744_000 picoseconds. + Weight::from_parts(28_116_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -314,35 +314,35 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_136_000 picoseconds. - Weight::from_parts(3_210_000, 0) + // Minimum execution time: 3_204_000 picoseconds. + Weight::from_parts(3_352_000, 0) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_989_000 picoseconds. - Weight::from_parts(3_067_000, 0) + // Minimum execution time: 3_180_000 picoseconds. + Weight::from_parts(3_245_000, 0) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_004_000 picoseconds. - Weight::from_parts(3_101_000, 0) + // Minimum execution time: 3_195_000 picoseconds. + Weight::from_parts(3_299_000, 0) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_996_000 picoseconds. - Weight::from_parts(3_068_000, 0) + // Minimum execution time: 3_185_000 picoseconds. + Weight::from_parts(3_279_000, 0) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_102_000 picoseconds. - Weight::from_parts(3_210_000, 0) + // Minimum execution time: 3_308_000 picoseconds. + Weight::from_parts(3_463_000, 0) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index 7b395a4d4e3..ed72909f0cb 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -24,19 +24,16 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::{ - impls::ToStakingPot, - xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, -}; +use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom}; use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, - WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, + DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, IsConcrete, ParentAsSuperuser, + ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -129,52 +126,55 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) + ) } } -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - // Allow local users to buy weight credit. - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - WithComputedOrigin< - ( - // If the message is one that immediately attemps to pay for execution, then allow it. - AllowTopLevelPaidExecutionFrom, - // Parent and its pluralities (i.e. governance bodies) get free execution. - AllowExplicitUnpaidExecutionFrom, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - ), - UniversalLocation, - ConstU32<8>, - >, - ), +pub type Barrier = TrailingSetTopicAsId< + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + // Allow local users to buy weight credit. + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its pluralities (i.e. governance bodies) get free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, + ), + >, >; pub struct XcmConfig; @@ -218,12 +218,12 @@ pub type LocalOriginToLocation = SignedToAccountId32, // ..and XCMP to communicate with the sibling chains. XcmpQueue, -); +)>; #[cfg(feature = "runtime-benchmarks")] parameter_types! { @@ -261,6 +261,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml index 3b42507b1da..4e14a964363 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -12,8 +12,8 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.163", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs index dfc08b4c184..fd284576da0 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -108,6 +108,9 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -115,6 +118,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + Migrations, >; impl_opaque_keys! { @@ -128,7 +132,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("bridge-hub-polkadot"), impl_name: create_runtime_str!("bridge-hub-polkadot"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 2, @@ -246,7 +250,7 @@ impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -254,7 +258,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -615,7 +619,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -653,7 +657,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( DotRelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotRelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(DotRelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -667,7 +671,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(DotRelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs index 77de70742ca..6a04ee76325 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_593_000 picoseconds. - Weight::from_parts(5_728_000, 0) + // Minimum execution time: 5_425_000 picoseconds. + Weight::from_parts(5_556_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_432_000 picoseconds. - Weight::from_parts(5_592_000, 0) + // Minimum execution time: 5_504_000 picoseconds. + Weight::from_parts(5_706_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/frame_system.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/frame_system.rs index 6560a1546a5..7ca54d2e135 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/frame_system.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/frame_system.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `frame_system`. pub struct WeightInfo(PhantomData); @@ -52,22 +53,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_129_000 picoseconds. - Weight::from_parts(2_213_000, 0) + // Minimum execution time: 2_432_000 picoseconds. + Weight::from_parts(2_458_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(370, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(367, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_415_000 picoseconds. - Weight::from_parts(7_510_000, 0) + // Minimum execution time: 7_911_000 picoseconds. + Weight::from_parts(8_031_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_412, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_405, 0).saturating_mul(b.into())) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -77,12 +78,15 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_227_000 picoseconds. - Weight::from_parts(4_495_000, 0) + // Minimum execution time: 4_304_000 picoseconds. + Weight::from_parts(4_553_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) + } /// Storage: Skipped Metadata (r:0 w:0) /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. @@ -90,11 +94,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_349_000 picoseconds. - Weight::from_parts(2_381_000, 0) + // Minimum execution time: 2_493_000 picoseconds. + Weight::from_parts(2_523_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_813 - .saturating_add(Weight::from_parts(685_377, 0).saturating_mul(i.into())) + // Standard Error: 1_594 + .saturating_add(Weight::from_parts(663_439, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -104,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_317_000, 0) + // Minimum execution time: 2_492_000 picoseconds. + Weight::from_parts(2_526_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 911 - .saturating_add(Weight::from_parts(494_503, 0).saturating_mul(i.into())) + // Standard Error: 784 + .saturating_add(Weight::from_parts(493_844, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -118,11 +122,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `68 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 4_239_000 picoseconds. - Weight::from_parts(4_380_000, 0) + // Minimum execution time: 4_200_000 picoseconds. + Weight::from_parts(4_288_000, 0) .saturating_add(Weight::from_parts(0, 66)) - // Standard Error: 1_255 - .saturating_add(Weight::from_parts(1_012_115, 0).saturating_mul(p.into())) + // Standard Error: 1_195 + .saturating_add(Weight::from_parts(1_021_563, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_balances.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_balances.rs index a6547ab46fb..bcfe953f358 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_balances.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_balances.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 35_006_000 picoseconds. - Weight::from_parts(35_375_000, 0) + // Minimum execution time: 52_090_000 picoseconds. + Weight::from_parts(52_437_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 25_755_000 picoseconds. - Weight::from_parts(26_176_000, 0) + // Minimum execution time: 39_798_000 picoseconds. + Weight::from_parts(40_230_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,8 +78,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 15_651_000 picoseconds. - Weight::from_parts(16_056_000, 0) + // Minimum execution time: 16_110_000 picoseconds. + Weight::from_parts(16_386_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -89,8 +90,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 18_932_000 picoseconds. - Weight::from_parts(19_186_000, 0) + // Minimum execution time: 22_460_000 picoseconds. + Weight::from_parts(23_030_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +102,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 36_593_000 picoseconds. - Weight::from_parts(36_971_000, 0) + // Minimum execution time: 53_769_000 picoseconds. + Weight::from_parts(54_256_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -113,25 +114,38 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_795_000 picoseconds. - Weight::from_parts(32_237_000, 0) + // Minimum execution time: 48_582_000 picoseconds. + Weight::from_parts(49_294_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn upgrade_accounts(_: u32) -> Weight { - Weight::from_parts(0, 0) - } fn force_unreserve() -> Weight { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 15_120_000 picoseconds. - Weight::from_parts(15_360_000, 0) + // Minimum execution time: 19_364_000 picoseconds. + Weight::from_parts(19_571_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// 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]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (136 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 17_815_000 picoseconds. + Weight::from_parts(17_974_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 10_230 + .saturating_add(Weight::from_parts(14_059_882, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs index 5c35eff5f53..bae3a058100 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_collator_selection` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collator_selection`. pub struct WeightInfo(PhantomData); @@ -56,11 +57,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `214 + b * (78 ±0)` // Estimated: `1203 + b * (2554 ±0)` - // Minimum execution time: 14_444_000 picoseconds. - Weight::from_parts(15_006_377, 0) + // Minimum execution time: 14_646_000 picoseconds. + Weight::from_parts(15_408_953, 0) .saturating_add(Weight::from_parts(0, 1203)) - // Standard Error: 2_965 - .saturating_add(Weight::from_parts(2_598_095, 0).saturating_mul(b.into())) + // Standard Error: 3_120 + .saturating_add(Weight::from_parts(2_562_646, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) @@ -71,8 +72,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_886_000 picoseconds. - Weight::from_parts(7_053_000, 0) + // Minimum execution time: 7_277_000 picoseconds. + Weight::from_parts(7_557_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,8 +83,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_233_000 picoseconds. - Weight::from_parts(7_420_000, 0) + // Minimum execution time: 7_684_000 picoseconds. + Weight::from_parts(7_883_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,12 +104,12 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn register_as_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1104 + c * (48 ±0)` - // Estimated: `61672 + c * (49 ±0)` - // Minimum execution time: 37_455_000 picoseconds. - Weight::from_parts(29_651_534, 0) - .saturating_add(Weight::from_parts(0, 61672)) - // Standard Error: 1_287 - .saturating_add(Weight::from_parts(103_531, 0).saturating_mul(c.into())) + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 42_488_000 picoseconds. + Weight::from_parts(34_515_606, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_249 + .saturating_add(Weight::from_parts(103_597, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) @@ -122,11 +123,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `428 + c * (48 ±0)` // Estimated: `49487` - // Minimum execution time: 29_548_000 picoseconds. - Weight::from_parts(18_882_873, 0) + // Minimum execution time: 33_698_000 picoseconds. + Weight::from_parts(22_802_769, 0) .saturating_add(Weight::from_parts(0, 49487)) - // Standard Error: 1_273 - .saturating_add(Weight::from_parts(105_000, 0).saturating_mul(c.into())) + // Standard Error: 1_317 + .saturating_add(Weight::from_parts(107_072, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,13 +140,46 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn note_author() -> Weight { // Proof Size summary in bytes: // Measured: `155` - // Estimated: `7729` - // Minimum execution time: 28_960_000 picoseconds. - Weight::from_parts(29_435_000, 0) - .saturating_add(Weight::from_parts(0, 7729)) + // Estimated: `6196` + // Minimum execution time: 43_472_000 picoseconds. + Weight::from_parts(44_218_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: CollatorSelection Candidates (r:1 w:0) /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(48002), added: 48497, mode: MaxEncodedLen) /// Storage: CollatorSelection LastAuthoredBlock (r:999 w:0) @@ -160,18 +194,18 @@ impl pallet_collator_selection::WeightInfo for WeightIn /// The range of component `c` is `[1, 1000]`. fn new_session(r: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `22815 + r * (116 ±0) + c * (97 ±0)` - // Estimated: `56697 + c * (2520 ±0) + r * (2602 ±0)` - // Minimum execution time: 16_727_000 picoseconds. - Weight::from_parts(16_932_000, 0) - .saturating_add(Weight::from_parts(0, 56697)) - // Standard Error: 798_306 - .saturating_add(Weight::from_parts(28_951_019, 0).saturating_mul(c.into())) + // Measured: `22815 + c * (97 ±0) + r * (116 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2602 ±0)` + // Minimum execution time: 17_280_000 picoseconds. + Weight::from_parts(17_471_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 866_180 + .saturating_add(Weight::from_parts(30_755_948, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 2602).saturating_mul(r.into())) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_multisig.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_multisig.rs index 9ab2d5a58a6..7e5c5efcf3f 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_multisig.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_multisig.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); @@ -52,11 +53,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_761_000 picoseconds. - Weight::from_parts(12_373_119, 0) + // Minimum execution time: 11_575_000 picoseconds. + Weight::from_parts(12_064_176, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 3 - .saturating_add(Weight::from_parts(482, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(500, 0).saturating_mul(z.into())) } /// Storage: Multisig Multisigs (r:1 w:1) /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3346), added: 5821, mode: MaxEncodedLen) @@ -66,13 +67,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 36_964_000 picoseconds. - Weight::from_parts(31_553_347, 0) + // Minimum execution time: 40_911_000 picoseconds. + Weight::from_parts(34_976_854, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 571 - .saturating_add(Weight::from_parts(62_042, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_178, 0).saturating_mul(z.into())) + // Standard Error: 418 + .saturating_add(Weight::from_parts(65_759, 0).saturating_mul(s.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_190, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -84,13 +85,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 27_113_000 picoseconds. - Weight::from_parts(21_794_796, 0) + // Minimum execution time: 26_906_000 picoseconds. + Weight::from_parts(21_462_377, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 423 - .saturating_add(Weight::from_parts(59_156, 0).saturating_mul(s.into())) - // Standard Error: 4 - .saturating_add(Weight::from_parts(1_193, 0).saturating_mul(z.into())) + // Standard Error: 351 + .saturating_add(Weight::from_parts(59_241, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_204, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,14 +104,14 @@ impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `388 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 41_979_000 picoseconds. - Weight::from_parts(34_970_639, 0) - .saturating_add(Weight::from_parts(0, 10404)) - // Standard Error: 481 - .saturating_add(Weight::from_parts(76_814, 0).saturating_mul(s.into())) - // Standard Error: 4 - .saturating_add(Weight::from_parts(1_191, 0).saturating_mul(z.into())) + // Estimated: `6811` + // Minimum execution time: 45_289_000 picoseconds. + Weight::from_parts(37_925_050, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 675 + .saturating_add(Weight::from_parts(81_154, 0).saturating_mul(s.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_237, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -121,11 +122,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 28_113_000 picoseconds. - Weight::from_parts(29_657_007, 0) + // Minimum execution time: 31_995_000 picoseconds. + Weight::from_parts(33_377_255, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 746 - .saturating_add(Weight::from_parts(67_176, 0).saturating_mul(s.into())) + // Standard Error: 571 + .saturating_add(Weight::from_parts(69_665, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -136,11 +137,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 19_227_000 picoseconds. - Weight::from_parts(20_043_765, 0) + // Minimum execution time: 18_656_000 picoseconds. + Weight::from_parts(19_906_362, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_458 - .saturating_add(Weight::from_parts(70_065, 0).saturating_mul(s.into())) + // Standard Error: 431 + .saturating_add(Weight::from_parts(62_284, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -151,11 +152,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 29_358_000 picoseconds. - Weight::from_parts(30_953_779, 0) + // Minimum execution time: 32_875_000 picoseconds. + Weight::from_parts(34_341_729, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 662 - .saturating_add(Weight::from_parts(62_100, 0).saturating_mul(s.into())) + // Standard Error: 924 + .saturating_add(Weight::from_parts(72_829, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_session.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_session.rs index cd7f40253b5..c97705a6794 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_session.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_session.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `297` - // Estimated: `7524` - // Minimum execution time: 17_305_000 picoseconds. - Weight::from_parts(17_673_000, 0) - .saturating_add(Weight::from_parts(0, 7524)) + // Estimated: `3762` + // Minimum execution time: 17_610_000 picoseconds. + Weight::from_parts(18_124_000, 0) + .saturating_add(Weight::from_parts(0, 3762)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -68,10 +69,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `279` - // Estimated: `4023` - // Minimum execution time: 13_593_000 picoseconds. - Weight::from_parts(13_826_000, 0) - .saturating_add(Weight::from_parts(0, 4023)) + // Estimated: `3744` + // Minimum execution time: 13_143_000 picoseconds. + Weight::from_parts(13_552_000, 0) + .saturating_add(Weight::from_parts(0, 3744)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_timestamp.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_timestamp.rs index b22fe963f12..4b5d0156670 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_timestamp.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_timestamp.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_timestamp`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `49` - // Estimated: `2986` - // Minimum execution time: 7_665_000 picoseconds. - Weight::from_parts(7_892_000, 0) - .saturating_add(Weight::from_parts(0, 2986)) + // Estimated: `1493` + // Minimum execution time: 7_574_000 picoseconds. + Weight::from_parts(7_792_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +66,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `57` // Estimated: `0` - // Minimum execution time: 3_226_000 picoseconds. - Weight::from_parts(3_339_000, 0) + // Minimum execution time: 3_081_000 picoseconds. + Weight::from_parts(3_148_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_utility.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_utility.rs index 34c36b874a1..816c705a772 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_utility.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_utility.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_utility`. pub struct WeightInfo(PhantomData); @@ -52,18 +53,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_083_000 picoseconds. - Weight::from_parts(13_037_767, 0) + // Minimum execution time: 7_261_000 picoseconds. + Weight::from_parts(8_284_145, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_155 - .saturating_add(Weight::from_parts(4_503_244, 0).saturating_mul(c.into())) + // Standard Error: 3_294 + .saturating_add(Weight::from_parts(4_497_661, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_705_000 picoseconds. - Weight::from_parts(5_799_000, 0) + // Minimum execution time: 5_294_000 picoseconds. + Weight::from_parts(5_475_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -71,18 +72,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_248_000 picoseconds. - Weight::from_parts(14_495_670, 0) + // Minimum execution time: 7_042_000 picoseconds. + Weight::from_parts(5_814_168, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_240 - .saturating_add(Weight::from_parts(4_790_508, 0).saturating_mul(c.into())) + // Standard Error: 2_914 + .saturating_add(Weight::from_parts(4_802_976, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_355_000 picoseconds. - Weight::from_parts(9_596_000, 0) + // Minimum execution time: 9_260_000 picoseconds. + Weight::from_parts(9_406_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -90,10 +91,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_985_000 picoseconds. - Weight::from_parts(17_435_570, 0) + // Minimum execution time: 7_109_000 picoseconds. + Weight::from_parts(3_793_543, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_165 - .saturating_add(Weight::from_parts(4_492_577, 0).saturating_mul(c.into())) + // Standard Error: 2_940 + .saturating_add(Weight::from_parts(4_479_763, 0).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs index 05bfdc8339e..fdbde818da9 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn send() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `9595` - // Minimum execution time: 25_890_000 picoseconds. - Weight::from_parts(26_601_000, 0) - .saturating_add(Weight::from_parts(0, 9595)) + // Estimated: `3503` + // Minimum execution time: 25_921_000 picoseconds. + Weight::from_parts(26_233_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +74,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `1489` - // Minimum execution time: 24_961_000 picoseconds. - Weight::from_parts(25_332_000, 0) + // Minimum execution time: 26_254_000 picoseconds. + Weight::from_parts(26_615_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -104,8 +105,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_662_000 picoseconds. - Weight::from_parts(9_844_000, 0) + // Minimum execution time: 9_756_000 picoseconds. + Weight::from_parts(9_989_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -115,8 +116,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_994_000 picoseconds. - Weight::from_parts(3_160_000, 0) + // Minimum execution time: 3_147_000 picoseconds. + Weight::from_parts(3_248_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,10 +140,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `14659` - // Minimum execution time: 31_632_000 picoseconds. - Weight::from_parts(31_919_000, 0) - .saturating_add(Weight::from_parts(0, 14659)) + // Estimated: `3503` + // Minimum execution time: 31_089_000 picoseconds. + Weight::from_parts(31_503_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -163,19 +164,21 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `220` - // Estimated: `14410` - // Minimum execution time: 32_570_000 picoseconds. - Weight::from_parts(33_292_000, 0) - .saturating_add(Weight::from_parts(0, 14410)) + // Estimated: `3685` + // Minimum execution time: 33_219_000 picoseconds. + Weight::from_parts(33_708_000, 0) + .saturating_add(Weight::from_parts(0, 3685)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) fn force_suspension() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_994_000 picoseconds. - Weight::from_parts(3_160_000, 0) + // Minimum execution time: 3_042_000 picoseconds. + Weight::from_parts(3_175_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -185,8 +188,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `95` // Estimated: `10985` - // Minimum execution time: 14_829_000 picoseconds. - Weight::from_parts(15_171_000, 0) + // Minimum execution time: 15_040_000 picoseconds. + Weight::from_parts(15_455_000, 0) .saturating_add(Weight::from_parts(0, 10985)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -197,8 +200,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `99` // Estimated: `10989` - // Minimum execution time: 14_774_000 picoseconds. - Weight::from_parts(15_232_000, 0) + // Minimum execution time: 14_999_000 picoseconds. + Weight::from_parts(15_417_000, 0) .saturating_add(Weight::from_parts(0, 10989)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -209,8 +212,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `13471` - // Minimum execution time: 15_289_000 picoseconds. - Weight::from_parts(15_543_000, 0) + // Minimum execution time: 15_694_000 picoseconds. + Weight::from_parts(15_916_000, 0) .saturating_add(Weight::from_parts(0, 13471)) .saturating_add(T::DbWeight::get().reads(5)) } @@ -229,10 +232,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_current_targets() -> Weight { // Proof Size summary in bytes: // Measured: `106` - // Estimated: `15981` - // Minimum execution time: 27_849_000 picoseconds. - Weight::from_parts(28_243_000, 0) - .saturating_add(Weight::from_parts(0, 15981)) + // Estimated: `6046` + // Minimum execution time: 28_164_000 picoseconds. + Weight::from_parts(28_489_000, 0) + .saturating_add(Weight::from_parts(0, 6046)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -242,8 +245,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `136` // Estimated: `8551` - // Minimum execution time: 8_260_000 picoseconds. - Weight::from_parts(8_477_000, 0) + // Minimum execution time: 8_273_000 picoseconds. + Weight::from_parts(8_471_000, 0) .saturating_add(Weight::from_parts(0, 8551)) .saturating_add(T::DbWeight::get().reads(3)) } @@ -253,8 +256,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `10996` - // Minimum execution time: 15_132_000 picoseconds. - Weight::from_parts(15_581_000, 0) + // Minimum execution time: 15_009_000 picoseconds. + Weight::from_parts(15_459_000, 0) .saturating_add(Weight::from_parts(0, 10996)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -274,10 +277,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: // Measured: `112` - // Estimated: `20967` - // Minimum execution time: 34_016_000 picoseconds. - Weight::from_parts(34_627_000, 0) - .saturating_add(Weight::from_parts(0, 20967)) + // Estimated: `11002` + // Minimum execution time: 33_647_000 picoseconds. + Weight::from_parts(34_065_000, 0) + .saturating_add(Weight::from_parts(0, 11002)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs index e9b1c70bf6a..27bdb510ba0 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } @@ -150,7 +149,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { _xcm: &Xcm<()>, ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(200_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(200_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 16110f554b2..e91a3d7f59f 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -54,8 +54,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 20_647_000 picoseconds. - Weight::from_parts(20_978_000, 3593) + // Minimum execution time: 23_577_000 picoseconds. + Weight::from_parts(24_152_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +65,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `153` // Estimated: `6196` - // Minimum execution time: 32_995_000 picoseconds. - Weight::from_parts(33_365_000, 6196) + // Minimum execution time: 49_336_000 picoseconds. + Weight::from_parts(49_673_000, 6196) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -87,9 +87,9 @@ impl WeightInfo { pub fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `223` - // Estimated: `18205` - // Minimum execution time: 56_568_000 picoseconds. - Weight::from_parts(57_462_000, 18205) + // Estimated: `6196` + // Minimum execution time: 72_360_000 picoseconds. + Weight::from_parts(72_916_000, 6196) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -97,8 +97,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_070_000 picoseconds. - Weight::from_parts(4_200_000, 0) + // Minimum execution time: 3_838_000 picoseconds. + Weight::from_parts(3_928_000, 0) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -106,8 +106,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 24_036_000 picoseconds. - Weight::from_parts(24_587_000, 3593) + // Minimum execution time: 26_214_000 picoseconds. + Weight::from_parts(26_718_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -128,9 +128,9 @@ impl WeightInfo { pub fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `122` - // Estimated: `15097` - // Minimum execution time: 49_836_000 picoseconds. - Weight::from_parts(50_507_000, 15097) + // Estimated: `3593` + // Minimum execution time: 52_341_000 picoseconds. + Weight::from_parts(52_801_000, 3593) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -149,9 +149,9 @@ impl WeightInfo { pub fn initiate_teleport() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 28_353_000 picoseconds. - Weight::from_parts(29_151_000, 11244) + // Estimated: `3535` + // Minimum execution time: 28_785_000 picoseconds. + Weight::from_parts(29_133_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index f8320dad59b..3cf25c1e8f8 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -63,9 +63,9 @@ impl WeightInfo { pub fn report_holding() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 30_983_000 picoseconds. - Weight::from_parts(31_396_000, 11244) + // Estimated: `3535` + // Minimum execution time: 31_194_000 picoseconds. + Weight::from_parts(31_563_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +73,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_966_000 picoseconds. - Weight::from_parts(3_066_000, 0) + // Minimum execution time: 2_905_000 picoseconds. + Weight::from_parts(3_006_000, 0) } // Storage: PolkadotXcm Queries (r:1 w:0) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) @@ -82,58 +82,58 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `3497` - // Minimum execution time: 11_159_000 picoseconds. - Weight::from_parts(11_390_000, 3497) + // Minimum execution time: 10_292_000 picoseconds. + Weight::from_parts(10_503_000, 3497) .saturating_add(T::DbWeight::get().reads(1)) } pub fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_987_000 picoseconds. - Weight::from_parts(13_337_000, 0) + // Minimum execution time: 12_198_000 picoseconds. + Weight::from_parts(12_445_000, 0) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_107_000 picoseconds. - Weight::from_parts(3_182_000, 0) + // Minimum execution time: 3_199_000 picoseconds. + Weight::from_parts(3_286_000, 0) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_957_000 picoseconds. - Weight::from_parts(3_022_000, 0) + // Minimum execution time: 2_780_000 picoseconds. + Weight::from_parts(2_847_000, 0) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_979_000 picoseconds. - Weight::from_parts(3_088_000, 0) + // Minimum execution time: 2_787_000 picoseconds. + Weight::from_parts(2_835_000, 0) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_934_000 picoseconds. - Weight::from_parts(2_989_000, 0) + // Minimum execution time: 2_822_000 picoseconds. + Weight::from_parts(2_853_000, 0) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_817_000 picoseconds. - Weight::from_parts(3_898_000, 0) + // Minimum execution time: 3_671_000 picoseconds. + Weight::from_parts(3_746_000, 0) } pub fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_021_000 picoseconds. - Weight::from_parts(3_083_000, 0) + // Minimum execution time: 2_748_000 picoseconds. + Weight::from_parts(2_818_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -150,9 +150,9 @@ impl WeightInfo { pub fn report_error() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 25_036_000 picoseconds. - Weight::from_parts(25_379_000, 11244) + // Estimated: `3535` + // Minimum execution time: 24_294_000 picoseconds. + Weight::from_parts(24_640_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -162,8 +162,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `90` // Estimated: `3555` - // Minimum execution time: 15_074_000 picoseconds. - Weight::from_parts(15_310_000, 3555) + // Minimum execution time: 14_359_000 picoseconds. + Weight::from_parts(14_550_000, 3555) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -171,8 +171,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_996_000 picoseconds. - Weight::from_parts(3_040_000, 0) + // Minimum execution time: 2_792_000 picoseconds. + Weight::from_parts(2_884_000, 0) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -189,9 +189,9 @@ impl WeightInfo { pub fn subscribe_version() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `13098` - // Minimum execution time: 26_142_000 picoseconds. - Weight::from_parts(26_578_000, 13098) + // Estimated: `3503` + // Minimum execution time: 25_925_000 picoseconds. + Weight::from_parts(26_130_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -201,8 +201,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_216_000 picoseconds. - Weight::from_parts(5_304_000, 0) + // Minimum execution time: 5_004_000 picoseconds. + Weight::from_parts(5_141_000, 0) .saturating_add(T::DbWeight::get().writes(1)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -220,9 +220,9 @@ impl WeightInfo { pub fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 28_236_000 picoseconds. - Weight::from_parts(28_614_000, 11244) + // Estimated: `3535` + // Minimum execution time: 27_163_000 picoseconds. + Weight::from_parts(27_722_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -230,36 +230,36 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_701_000 picoseconds. - Weight::from_parts(4_783_000, 0) + // Minimum execution time: 4_430_000 picoseconds. + Weight::from_parts(4_492_000, 0) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_121_000 picoseconds. - Weight::from_parts(3_177_000, 0) + // Minimum execution time: 2_870_000 picoseconds. + Weight::from_parts(2_998_000, 0) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_106_000 picoseconds. - Weight::from_parts(3_343_000, 0) + // Minimum execution time: 2_845_000 picoseconds. + Weight::from_parts(2_893_000, 0) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_151_000 picoseconds. - Weight::from_parts(3_226_000, 0) + // Minimum execution time: 2_753_000 picoseconds. + Weight::from_parts(2_816_000, 0) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_362_000 picoseconds. - Weight::from_parts(3_453_000, 0) + // Minimum execution time: 2_992_000 picoseconds. + Weight::from_parts(3_068_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -276,9 +276,9 @@ impl WeightInfo { pub fn query_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 30_472_000 picoseconds. - Weight::from_parts(30_906_000, 11244) + // Estimated: `3535` + // Minimum execution time: 27_324_000 picoseconds. + Weight::from_parts(27_656_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -286,8 +286,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_383_000 picoseconds. - Weight::from_parts(5_496_000, 0) + // Minimum execution time: 4_830_000 picoseconds. + Weight::from_parts(4_903_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -304,9 +304,9 @@ impl WeightInfo { pub fn report_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 26_946_000 picoseconds. - Weight::from_parts(27_774_000, 11244) + // Estimated: `3535` + // Minimum execution time: 24_428_000 picoseconds. + Weight::from_parts(24_732_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -314,35 +314,35 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_192_000 picoseconds. - Weight::from_parts(3_262_000, 0) + // Minimum execution time: 2_779_000 picoseconds. + Weight::from_parts(2_822_000, 0) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_129_000 picoseconds. - Weight::from_parts(3_199_000, 0) + // Minimum execution time: 2_789_000 picoseconds. + Weight::from_parts(2_873_000, 0) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_156_000 picoseconds. - Weight::from_parts(3_202_000, 0) + // Minimum execution time: 2_819_000 picoseconds. + Weight::from_parts(2_904_000, 0) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_114_000 picoseconds. - Weight::from_parts(3_208_000, 0) + // Minimum execution time: 2_788_000 picoseconds. + Weight::from_parts(2_887_000, 0) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_315_000 picoseconds. - Weight::from_parts(3_374_000, 0) + // Minimum execution time: 3_006_000 picoseconds. + Weight::from_parts(3_078_000, 0) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index d063fda2c13..804c7455b5a 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -24,19 +24,16 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::{ - impls::ToStakingPot, - xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, -}; +use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom}; use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, - WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, + DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, IsConcrete, ParentAsSuperuser, + ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + UsingComponents, WeightInfoBounds, WithComputedOrigin, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -132,29 +129,30 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) + ) } } @@ -264,6 +262,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 86383d30d99..cce740cd617 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -12,8 +12,8 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.163", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate @@ -99,6 +99,7 @@ snowbridge-ethereum-beacon-client = { path = "../../../../../parachain/pallets/e static_assertions = "1.1" bridge-hub-test-utils = { path = "../test-utils"} bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", features = ["integrity-test"] } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } [features] default = [ @@ -127,6 +128,7 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", + "frame-benchmarking/std", "frame-executive/std", "frame-support/std", "frame-system-rpc-runtime-api/std", diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs index bfa6f98ebae..8a85076e33e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs @@ -134,7 +134,7 @@ impl ThisChainWithMessages for BridgeHubRococo { /// Signed extension that refunds relayers that are delivering messages from the Wococo parachain. pub type BridgeRefundBridgeHubWococoMessages = RefundBridgedParachainMessages< Runtime, - RefundableParachain, + RefundableParachain, RefundableMessagesLane, ActualFeeRefund, PriorityBoostPerMessage, @@ -144,10 +144,6 @@ bp_runtime::generate_static_str_provider!(BridgeRefundBridgeHubWococoMessages); parameter_types! { pub const BridgeHubWococoMessagesLane: bp_messages::LaneId = DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO; - pub const BridgeHubWococoParachainId: u32 = { - use bp_runtime::Parachain; - BridgeHubWococo::PARACHAIN_ID - }; } #[cfg(test)] diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs index 2c9ec3c82bc..025486d43ca 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs @@ -134,7 +134,7 @@ impl ThisChainWithMessages for BridgeHubWococo { /// Signed extension that refunds relayers that are delivering messages from the Rococo parachain. pub type BridgeRefundBridgeHubRococoMessages = RefundBridgedParachainMessages< Runtime, - RefundableParachain, + RefundableParachain, RefundableMessagesLane, ActualFeeRefund, PriorityBoostPerMessage, @@ -144,10 +144,6 @@ bp_runtime::generate_static_str_provider!(BridgeRefundBridgeHubRococoMessages); parameter_types! { pub const BridgeHubRococoMessagesLane: bp_messages::LaneId = DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO; - pub const BridgeHubRococoParachainId: u32 = { - use bp_runtime::Parachain; - BridgeHubRococo::PARACHAIN_ID - }; } #[cfg(test)] diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index f741d17aecd..976a09d47fc 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -95,8 +95,6 @@ use parachains_common::{ }; use xcm_executor::XcmExecutor; -pub const LOG_TARGET: &str = "runtime::bridge-hub"; - /// The address format for describing accounts. pub type Address = MultiAddress; @@ -127,8 +125,8 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Migrations to apply on runtime upgrade. +pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1,); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -137,6 +135,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + Migrations, >; impl_opaque_keys! { @@ -150,7 +149,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("bridge-hub-rococo"), impl_name: create_runtime_str!("bridge-hub-rococo"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 3, @@ -269,7 +268,7 @@ impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -277,7 +276,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -990,7 +989,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -1028,7 +1027,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( RelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(RelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -1042,7 +1041,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(RelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs index 638e1354d91..41db3176f35 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_xcmp_queue.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_434_000 picoseconds. - Weight::from_parts(5_663_000, 0) + // Minimum execution time: 5_293_000 picoseconds. + Weight::from_parts(5_572_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `76` // Estimated: `1561` - // Minimum execution time: 5_301_000 picoseconds. - Weight::from_parts(5_415_000, 0) + // Minimum execution time: 5_449_000 picoseconds. + Weight::from_parts(5_627_000, 0) .saturating_add(Weight::from_parts(0, 1561)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs index ed5e6270415..a7d6083d2a6 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/frame_system.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `frame_system`. pub struct WeightInfo(PhantomData); @@ -52,22 +53,25 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_311_000 picoseconds. - Weight::from_parts(2_347_000, 0) + // Minimum execution time: 2_299_000 picoseconds. + Weight::from_parts(2_329_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(370, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(369, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_875_000 picoseconds. - Weight::from_parts(7_972_000, 0) + // Minimum execution time: 7_960_000 picoseconds. + Weight::from_parts(8_041_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_410, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_404, 0).saturating_mul(b.into())) + } + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -77,8 +81,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_309_000 picoseconds. - Weight::from_parts(4_457_000, 0) + // Minimum execution time: 4_340_000 picoseconds. + Weight::from_parts(4_506_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -90,11 +94,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_526_000 picoseconds. - Weight::from_parts(2_564_000, 0) + // Minimum execution time: 2_455_000 picoseconds. + Weight::from_parts(2_517_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_869 - .saturating_add(Weight::from_parts(678_765, 0).saturating_mul(i.into())) + // Standard Error: 1_927 + .saturating_add(Weight::from_parts(673_981, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -104,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_526_000 picoseconds. - Weight::from_parts(2_603_000, 0) + // Minimum execution time: 2_502_000 picoseconds. + Weight::from_parts(2_546_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 899 - .saturating_add(Weight::from_parts(497_948, 0).saturating_mul(i.into())) + // Standard Error: 839 + .saturating_add(Weight::from_parts(492_306, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -118,11 +122,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `68 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 4_280_000 picoseconds. - Weight::from_parts(4_398_000, 0) + // Minimum execution time: 4_106_000 picoseconds. + Weight::from_parts(4_196_000, 0) .saturating_add(Weight::from_parts(0, 66)) - // Standard Error: 1_108 - .saturating_add(Weight::from_parts(1_011_188, 0).saturating_mul(p.into())) + // Standard Error: 1_231 + .saturating_add(Weight::from_parts(1_030_791, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs index d2bc8df00b2..9b3bfc238bf 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs @@ -81,12 +81,12 @@ impl pallet_bridge_messages::WeightInfoExt for pallet_bridge_messages_bridge_mes impl pallet_bridge_parachains::WeightInfoExt for pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance::WeightInfo { fn expected_extra_storage_proof_size() -> u32 { - bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE + bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE } } impl pallet_bridge_parachains::WeightInfoExt for pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance::WeightInfo { fn expected_extra_storage_proof_size() -> u32 { - bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE + bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_balances.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_balances.rs index 5b57a5b7b4d..bba8bf0318e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_balances.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_balances.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 35_746_000 picoseconds. - Weight::from_parts(36_167_000, 0) + // Minimum execution time: 54_781_000 picoseconds. + Weight::from_parts(55_287_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 26_301_000 picoseconds. - Weight::from_parts(26_847_000, 0) + // Minimum execution time: 41_473_000 picoseconds. + Weight::from_parts(41_749_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,8 +78,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 16_073_000 picoseconds. - Weight::from_parts(16_292_000, 0) + // Minimum execution time: 16_997_000 picoseconds. + Weight::from_parts(17_207_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -89,8 +90,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 19_589_000 picoseconds. - Weight::from_parts(20_034_000, 0) + // Minimum execution time: 23_998_000 picoseconds. + Weight::from_parts(24_245_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +102,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 37_416_000 picoseconds. - Weight::from_parts(37_894_000, 0) + // Minimum execution time: 56_390_000 picoseconds. + Weight::from_parts(56_963_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -113,25 +114,38 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 32_565_000 picoseconds. - Weight::from_parts(33_087_000, 0) + // Minimum execution time: 50_769_000 picoseconds. + Weight::from_parts(51_077_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn upgrade_accounts(_: u32) -> Weight { - Weight::from_parts(0, 0) - } fn force_unreserve() -> Weight { // Proof Size summary in bytes: // Measured: `174` // Estimated: `3593` - // Minimum execution time: 15_291_000 picoseconds. - Weight::from_parts(15_614_000, 0) + // Minimum execution time: 19_617_000 picoseconds. + Weight::from_parts(19_827_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// 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]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (136 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 18_453_000 picoseconds. + Weight::from_parts(18_528_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 10_749 + .saturating_add(Weight::from_parts(14_321_237, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs index cf4ee2028f7..b66a8635e40 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_collator_selection` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collator_selection`. pub struct WeightInfo(PhantomData); @@ -56,11 +57,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `214 + b * (78 ±0)` // Estimated: `1203 + b * (2554 ±0)` - // Minimum execution time: 14_833_000 picoseconds. - Weight::from_parts(15_349_415, 0) + // Minimum execution time: 15_056_000 picoseconds. + Weight::from_parts(15_300_844, 0) .saturating_add(Weight::from_parts(0, 1203)) - // Standard Error: 3_477 - .saturating_add(Weight::from_parts(2_639_530, 0).saturating_mul(b.into())) + // Standard Error: 2_903 + .saturating_add(Weight::from_parts(2_591_470, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) @@ -71,8 +72,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_190_000 picoseconds. - Weight::from_parts(7_558_000, 0) + // Minimum execution time: 7_296_000 picoseconds. + Weight::from_parts(7_526_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,8 +83,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_435_000 picoseconds. - Weight::from_parts(7_790_000, 0) + // Minimum execution time: 7_483_000 picoseconds. + Weight::from_parts(7_694_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,12 +104,12 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn register_as_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1104 + c * (48 ±0)` - // Estimated: `61672 + c * (49 ±0)` - // Minimum execution time: 38_999_000 picoseconds. - Weight::from_parts(31_254_595, 0) - .saturating_add(Weight::from_parts(0, 61672)) - // Standard Error: 1_266 - .saturating_add(Weight::from_parts(108_612, 0).saturating_mul(c.into())) + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 42_882_000 picoseconds. + Weight::from_parts(34_865_364, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_292 + .saturating_add(Weight::from_parts(107_420, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) @@ -122,11 +123,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `428 + c * (48 ±0)` // Estimated: `49487` - // Minimum execution time: 29_894_000 picoseconds. - Weight::from_parts(19_491_329, 0) + // Minimum execution time: 34_025_000 picoseconds. + Weight::from_parts(23_170_113, 0) .saturating_add(Weight::from_parts(0, 49487)) - // Standard Error: 1_328 - .saturating_add(Weight::from_parts(109_217, 0).saturating_mul(c.into())) + // Standard Error: 1_333 + .saturating_add(Weight::from_parts(108_636, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,13 +140,46 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn note_author() -> Weight { // Proof Size summary in bytes: // Measured: `155` - // Estimated: `7729` - // Minimum execution time: 29_666_000 picoseconds. - Weight::from_parts(30_017_000, 0) - .saturating_add(Weight::from_parts(0, 7729)) + // Estimated: `6196` + // Minimum execution time: 45_689_000 picoseconds. + Weight::from_parts(46_236_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: CollatorSelection Candidates (r:1 w:0) /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(48002), added: 48497, mode: MaxEncodedLen) /// Storage: CollatorSelection LastAuthoredBlock (r:999 w:0) @@ -160,18 +194,18 @@ impl pallet_collator_selection::WeightInfo for WeightIn /// The range of component `c` is `[1, 1000]`. fn new_session(r: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `22815 + r * (116 ±0) + c * (97 ±0)` - // Estimated: `56697 + r * (2602 ±0) + c * (2520 ±0)` - // Minimum execution time: 17_009_000 picoseconds. - Weight::from_parts(17_119_000, 0) - .saturating_add(Weight::from_parts(0, 56697)) - // Standard Error: 839_085 - .saturating_add(Weight::from_parts(30_312_617, 0).saturating_mul(c.into())) + // Measured: `22815 + c * (97 ±0) + r * (116 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2602 ±0)` + // Minimum execution time: 16_853_000 picoseconds. + Weight::from_parts(16_995_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 900_191 + .saturating_add(Weight::from_parts(31_884_166, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 2602).saturating_mul(r.into())) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs index df58cf7952a..deda8024527 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_multisig.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); @@ -52,11 +53,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_203_000 picoseconds. - Weight::from_parts(12_687_394, 0) + // Minimum execution time: 11_833_000 picoseconds. + Weight::from_parts(12_347_180, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(556, 0).saturating_mul(z.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(554, 0).saturating_mul(z.into())) } /// Storage: Multisig Multisigs (r:1 w:1) /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3346), added: 5821, mode: MaxEncodedLen) @@ -66,13 +67,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 37_793_000 picoseconds. - Weight::from_parts(32_841_866, 0) + // Minimum execution time: 41_899_000 picoseconds. + Weight::from_parts(35_770_287, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 973 - .saturating_add(Weight::from_parts(64_271, 0).saturating_mul(s.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(1_189, 0).saturating_mul(z.into())) + // Standard Error: 542 + .saturating_add(Weight::from_parts(67_778, 0).saturating_mul(s.into())) + // Standard Error: 5 + .saturating_add(Weight::from_parts(1_239, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -84,13 +85,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 27_835_000 picoseconds. - Weight::from_parts(22_419_199, 0) + // Minimum execution time: 27_916_000 picoseconds. + Weight::from_parts(22_006_035, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 535 - .saturating_add(Weight::from_parts(59_729, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_259, 0).saturating_mul(z.into())) + // Standard Error: 311 + .saturating_add(Weight::from_parts(63_189, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_244, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,14 +104,14 @@ impl pallet_multisig::WeightInfo for WeightInfo { fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `388 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 43_060_000 picoseconds. - Weight::from_parts(36_326_276, 0) - .saturating_add(Weight::from_parts(0, 10404)) - // Standard Error: 497 - .saturating_add(Weight::from_parts(76_443, 0).saturating_mul(s.into())) + // Estimated: `6811` + // Minimum execution time: 46_594_000 picoseconds. + Weight::from_parts(38_993_543, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 498 + .saturating_add(Weight::from_parts(84_584, 0).saturating_mul(s.into())) // Standard Error: 4 - .saturating_add(Weight::from_parts(1_257, 0).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(1_271, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -121,11 +122,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `263 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 29_242_000 picoseconds. - Weight::from_parts(30_673_516, 0) + // Minimum execution time: 32_894_000 picoseconds. + Weight::from_parts(33_904_403, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 651 - .saturating_add(Weight::from_parts(67_820, 0).saturating_mul(s.into())) + // Standard Error: 801 + .saturating_add(Weight::from_parts(76_776, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -136,11 +137,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `282` // Estimated: `6811` - // Minimum execution time: 19_344_000 picoseconds. - Weight::from_parts(20_956_909, 0) + // Minimum execution time: 19_290_000 picoseconds. + Weight::from_parts(20_348_418, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 781 - .saturating_add(Weight::from_parts(65_374, 0).saturating_mul(s.into())) + // Standard Error: 465 + .saturating_add(Weight::from_parts(66_913, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -151,11 +152,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `454 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 30_222_000 picoseconds. - Weight::from_parts(31_457_558, 0) + // Minimum execution time: 33_275_000 picoseconds. + Weight::from_parts(34_932_596, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 648 - .saturating_add(Weight::from_parts(67_068, 0).saturating_mul(s.into())) + // Standard Error: 564 + .saturating_add(Weight::from_parts(71_231, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_session.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_session.rs index 67883fab331..fd1e6b2034b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_session.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_session.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `297` - // Estimated: `7524` - // Minimum execution time: 17_590_000 picoseconds. - Weight::from_parts(18_134_000, 0) - .saturating_add(Weight::from_parts(0, 7524)) + // Estimated: `3762` + // Minimum execution time: 17_753_000 picoseconds. + Weight::from_parts(18_269_000, 0) + .saturating_add(Weight::from_parts(0, 3762)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -68,10 +69,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `279` - // Estimated: `4023` - // Minimum execution time: 13_479_000 picoseconds. - Weight::from_parts(13_956_000, 0) - .saturating_add(Weight::from_parts(0, 4023)) + // Estimated: `3744` + // Minimum execution time: 13_403_000 picoseconds. + Weight::from_parts(13_821_000, 0) + .saturating_add(Weight::from_parts(0, 3744)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_timestamp.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_timestamp.rs index 7be7f6691f0..4a40dc1c75d 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_timestamp.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_timestamp.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_timestamp`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `49` - // Estimated: `2986` - // Minimum execution time: 7_610_000 picoseconds. - Weight::from_parts(7_887_000, 0) - .saturating_add(Weight::from_parts(0, 2986)) + // Estimated: `1493` + // Minimum execution time: 7_595_000 picoseconds. + Weight::from_parts(7_831_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +66,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `57` // Estimated: `0` - // Minimum execution time: 3_100_000 picoseconds. - Weight::from_parts(3_180_000, 0) + // Minimum execution time: 3_169_000 picoseconds. + Weight::from_parts(3_316_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_utility.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_utility.rs index 2420a70d1fb..ec43ac02ac1 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_utility.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_utility.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_utility`. pub struct WeightInfo(PhantomData); @@ -52,18 +53,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_051_000 picoseconds. - Weight::from_parts(10_722_806, 0) + // Minimum execution time: 7_483_000 picoseconds. + Weight::from_parts(10_302_924, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 4_213 - .saturating_add(Weight::from_parts(4_992_366, 0).saturating_mul(c.into())) + // Standard Error: 2_285 + .saturating_add(Weight::from_parts(4_760_910, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_831_000 picoseconds. - Weight::from_parts(6_014_000, 0) + // Minimum execution time: 5_768_000 picoseconds. + Weight::from_parts(5_879_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -71,18 +72,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_394_000 picoseconds. - Weight::from_parts(15_396_332, 0) + // Minimum execution time: 7_566_000 picoseconds. + Weight::from_parts(653_292, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_533 - .saturating_add(Weight::from_parts(5_302_383, 0).saturating_mul(c.into())) + // Standard Error: 2_989 + .saturating_add(Weight::from_parts(5_103_611, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_730_000 picoseconds. - Weight::from_parts(9_988_000, 0) + // Minimum execution time: 9_656_000 picoseconds. + Weight::from_parts(9_902_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -90,10 +91,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_395_000 picoseconds. - Weight::from_parts(14_933_943, 0) + // Minimum execution time: 7_524_000 picoseconds. + Weight::from_parts(1_487_243, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_208 - .saturating_add(Weight::from_parts(4_963_051, 0).saturating_mul(c.into())) + // Standard Error: 3_565 + .saturating_add(Weight::from_parts(4_841_130, 0).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs index 23f4f1cb27b..efaf8232a35 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); @@ -60,10 +61,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn send() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `9595` - // Minimum execution time: 27_429_000 picoseconds. - Weight::from_parts(28_626_000, 0) - .saturating_add(Weight::from_parts(0, 9595)) + // Estimated: `3503` + // Minimum execution time: 27_565_000 picoseconds. + Weight::from_parts(28_064_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +74,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `1489` - // Minimum execution time: 27_626_000 picoseconds. - Weight::from_parts(28_561_000, 0) + // Minimum execution time: 29_361_000 picoseconds. + Weight::from_parts(29_771_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -104,8 +105,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_264_000 picoseconds. - Weight::from_parts(10_601_000, 0) + // Minimum execution time: 10_098_000 picoseconds. + Weight::from_parts(10_440_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -115,8 +116,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_218_000 picoseconds. - Weight::from_parts(3_311_000, 0) + // Minimum execution time: 3_142_000 picoseconds. + Weight::from_parts(3_262_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -139,10 +140,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `14659` - // Minimum execution time: 33_037_000 picoseconds. - Weight::from_parts(33_559_000, 0) - .saturating_add(Weight::from_parts(0, 14659)) + // Estimated: `3503` + // Minimum execution time: 32_356_000 picoseconds. + Weight::from_parts(32_859_000, 0) + .saturating_add(Weight::from_parts(0, 3503)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -163,19 +164,21 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: // Measured: `220` - // Estimated: `14410` - // Minimum execution time: 34_280_000 picoseconds. - Weight::from_parts(34_943_000, 0) - .saturating_add(Weight::from_parts(0, 14410)) + // Estimated: `3685` + // Minimum execution time: 33_773_000 picoseconds. + Weight::from_parts(34_410_000, 0) + .saturating_add(Weight::from_parts(0, 3685)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) fn force_suspension() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_218_000 picoseconds. - Weight::from_parts(3_311_000, 0) + // Minimum execution time: 3_127_000 picoseconds. + Weight::from_parts(3_240_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -185,8 +188,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `95` // Estimated: `10985` - // Minimum execution time: 15_106_000 picoseconds. - Weight::from_parts(15_383_000, 0) + // Minimum execution time: 14_941_000 picoseconds. + Weight::from_parts(15_378_000, 0) .saturating_add(Weight::from_parts(0, 10985)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -197,8 +200,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `99` // Estimated: `10989` - // Minimum execution time: 15_129_000 picoseconds. - Weight::from_parts(15_489_000, 0) + // Minimum execution time: 14_750_000 picoseconds. + Weight::from_parts(14_903_000, 0) .saturating_add(Weight::from_parts(0, 10989)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -209,8 +212,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `13471` - // Minimum execution time: 15_526_000 picoseconds. - Weight::from_parts(15_778_000, 0) + // Minimum execution time: 15_360_000 picoseconds. + Weight::from_parts(15_593_000, 0) .saturating_add(Weight::from_parts(0, 13471)) .saturating_add(T::DbWeight::get().reads(5)) } @@ -229,10 +232,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn notify_current_targets() -> Weight { // Proof Size summary in bytes: // Measured: `106` - // Estimated: `15981` - // Minimum execution time: 29_457_000 picoseconds. - Weight::from_parts(29_970_000, 0) - .saturating_add(Weight::from_parts(0, 15981)) + // Estimated: `6046` + // Minimum execution time: 28_886_000 picoseconds. + Weight::from_parts(29_140_000, 0) + .saturating_add(Weight::from_parts(0, 6046)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -242,8 +245,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `136` // Estimated: `8551` - // Minimum execution time: 8_264_000 picoseconds. - Weight::from_parts(8_518_000, 0) + // Minimum execution time: 8_045_000 picoseconds. + Weight::from_parts(8_301_000, 0) .saturating_add(Weight::from_parts(0, 8551)) .saturating_add(T::DbWeight::get().reads(3)) } @@ -253,8 +256,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `10996` - // Minimum execution time: 15_633_000 picoseconds. - Weight::from_parts(16_006_000, 0) + // Minimum execution time: 14_763_000 picoseconds. + Weight::from_parts(15_186_000, 0) .saturating_add(Weight::from_parts(0, 10996)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -274,10 +277,10 @@ impl pallet_xcm::WeightInfo for WeightInfo { fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: // Measured: `112` - // Estimated: `20967` - // Minimum execution time: 35_849_000 picoseconds. - Weight::from_parts(36_545_000, 0) - .saturating_add(Weight::from_parts(0, 20967)) + // Estimated: `11002` + // Minimum execution time: 34_652_000 picoseconds. + Weight::from_parts(34_888_000, 0) + .saturating_add(Weight::from_parts(0, 11002)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs index a0aaac56f5a..9efbef18363 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs @@ -34,8 +34,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -54,7 +53,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -66,7 +65,7 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -124,7 +123,7 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 731111e358e..ad69bf08427 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -54,8 +54,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `101` // Estimated: `3593` - // Minimum execution time: 21_045_000 picoseconds. - Weight::from_parts(21_781_000, 3593) + // Minimum execution time: 24_766_000 picoseconds. + Weight::from_parts(25_113_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +65,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `153` // Estimated: `6196` - // Minimum execution time: 33_123_000 picoseconds. - Weight::from_parts(33_378_000, 6196) + // Minimum execution time: 51_440_000 picoseconds. + Weight::from_parts(51_960_000, 6196) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -87,9 +87,9 @@ impl WeightInfo { pub fn transfer_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `223` - // Estimated: `18205` - // Minimum execution time: 57_689_000 picoseconds. - Weight::from_parts(58_320_000, 18205) + // Estimated: `6196` + // Minimum execution time: 76_002_000 picoseconds. + Weight::from_parts(76_826_000, 6196) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -97,8 +97,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_838_000 picoseconds. - Weight::from_parts(4_906_000, 0) + // Minimum execution time: 4_644_000 picoseconds. + Weight::from_parts(4_754_000, 0) } // Storage: System Account (r:1 w:1) // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) @@ -106,8 +106,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 25_197_000 picoseconds. - Weight::from_parts(25_562_000, 3593) + // Minimum execution time: 27_398_000 picoseconds. + Weight::from_parts(27_947_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -128,9 +128,9 @@ impl WeightInfo { pub fn deposit_reserve_asset() -> Weight { // Proof Size summary in bytes: // Measured: `122` - // Estimated: `15097` - // Minimum execution time: 52_159_000 picoseconds. - Weight::from_parts(52_637_000, 15097) + // Estimated: `3593` + // Minimum execution time: 54_445_000 picoseconds. + Weight::from_parts(55_026_000, 3593) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -149,9 +149,9 @@ impl WeightInfo { pub fn initiate_teleport() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 30_471_000 picoseconds. - Weight::from_parts(31_112_000, 11244) + // Estimated: `3535` + // Minimum execution time: 30_770_000 picoseconds. + Weight::from_parts(31_269_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 0773dca274e..0b06968e441 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -63,9 +63,9 @@ impl WeightInfo { pub fn report_holding() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 34_238_000 picoseconds. - Weight::from_parts(34_851_000, 11244) + // Estimated: `3535` + // Minimum execution time: 34_120_000 picoseconds. + Weight::from_parts(34_618_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +73,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_358_000 picoseconds. - Weight::from_parts(3_437_000, 0) + // Minimum execution time: 3_285_000 picoseconds. + Weight::from_parts(3_426_000, 0) } // Storage: PolkadotXcm Queries (r:1 w:0) // Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) @@ -82,58 +82,58 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `3497` - // Minimum execution time: 11_623_000 picoseconds. - Weight::from_parts(11_814_000, 3497) + // Minimum execution time: 11_025_000 picoseconds. + Weight::from_parts(11_293_000, 3497) .saturating_add(T::DbWeight::get().reads(1)) } pub fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_934_000 picoseconds. - Weight::from_parts(14_111_000, 0) + // Minimum execution time: 13_451_000 picoseconds. + Weight::from_parts(13_625_000, 0) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_562_000 picoseconds. - Weight::from_parts(3_689_000, 0) + // Minimum execution time: 3_578_000 picoseconds. + Weight::from_parts(3_639_000, 0) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_280_000 picoseconds. - Weight::from_parts(3_345_000, 0) + // Minimum execution time: 3_123_000 picoseconds. + Weight::from_parts(3_190_000, 0) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_243_000 picoseconds. - Weight::from_parts(3_335_000, 0) + // Minimum execution time: 3_176_000 picoseconds. + Weight::from_parts(3_223_000, 0) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_280_000 picoseconds. - Weight::from_parts(3_347_000, 0) + // Minimum execution time: 3_142_000 picoseconds. + Weight::from_parts(3_200_000, 0) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_270_000 picoseconds. - Weight::from_parts(4_358_000, 0) + // Minimum execution time: 4_308_000 picoseconds. + Weight::from_parts(4_392_000, 0) } pub fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_245_000 picoseconds. - Weight::from_parts(3_320_000, 0) + // Minimum execution time: 3_114_000 picoseconds. + Weight::from_parts(3_189_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -150,9 +150,9 @@ impl WeightInfo { pub fn report_error() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 26_653_000 picoseconds. - Weight::from_parts(27_139_000, 11244) + // Estimated: `3535` + // Minimum execution time: 26_422_000 picoseconds. + Weight::from_parts(26_959_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -162,8 +162,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `90` // Estimated: `3555` - // Minimum execution time: 15_478_000 picoseconds. - Weight::from_parts(15_763_000, 3555) + // Minimum execution time: 15_625_000 picoseconds. + Weight::from_parts(15_828_000, 3555) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -171,8 +171,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_237_000 picoseconds. - Weight::from_parts(3_314_000, 0) + // Minimum execution time: 3_187_000 picoseconds. + Weight::from_parts(3_238_000, 0) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) @@ -189,9 +189,9 @@ impl WeightInfo { pub fn subscribe_version() -> Weight { // Proof Size summary in bytes: // Measured: `38` - // Estimated: `13098` - // Minimum execution time: 29_098_000 picoseconds. - Weight::from_parts(29_368_000, 13098) + // Estimated: `3503` + // Minimum execution time: 27_154_000 picoseconds. + Weight::from_parts(27_761_000, 3503) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -201,8 +201,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_253_000 picoseconds. - Weight::from_parts(6_467_000, 0) + // Minimum execution time: 5_268_000 picoseconds. + Weight::from_parts(5_412_000, 0) .saturating_add(T::DbWeight::get().writes(1)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -220,9 +220,9 @@ impl WeightInfo { pub fn initiate_reserve_withdraw() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 35_061_000 picoseconds. - Weight::from_parts(35_510_000, 11244) + // Estimated: `3535` + // Minimum execution time: 30_515_000 picoseconds. + Weight::from_parts(31_095_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -230,36 +230,36 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_154_000 picoseconds. - Weight::from_parts(6_266_000, 0) + // Minimum execution time: 5_148_000 picoseconds. + Weight::from_parts(5_224_000, 0) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_009_000 picoseconds. - Weight::from_parts(4_088_000, 0) + // Minimum execution time: 3_220_000 picoseconds. + Weight::from_parts(3_312_000, 0) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_873_000 picoseconds. - Weight::from_parts(3_996_000, 0) + // Minimum execution time: 3_226_000 picoseconds. + Weight::from_parts(3_309_000, 0) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_759_000 picoseconds. - Weight::from_parts(3_820_000, 0) + // Minimum execution time: 3_095_000 picoseconds. + Weight::from_parts(3_177_000, 0) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_985_000 picoseconds. - Weight::from_parts(4_132_000, 0) + // Minimum execution time: 3_349_000 picoseconds. + Weight::from_parts(3_447_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -276,9 +276,9 @@ impl WeightInfo { pub fn query_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 34_686_000 picoseconds. - Weight::from_parts(35_233_000, 11244) + // Estimated: `3535` + // Minimum execution time: 29_644_000 picoseconds. + Weight::from_parts(30_110_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -286,8 +286,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_129_000 picoseconds. - Weight::from_parts(6_244_000, 0) + // Minimum execution time: 5_304_000 picoseconds. + Weight::from_parts(5_369_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -304,9 +304,9 @@ impl WeightInfo { pub fn report_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `70` - // Estimated: `11244` - // Minimum execution time: 31_502_000 picoseconds. - Weight::from_parts(32_131_000, 11244) + // Estimated: `3535` + // Minimum execution time: 26_617_000 picoseconds. + Weight::from_parts(27_011_000, 3535) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -314,29 +314,29 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_747_000 picoseconds. - Weight::from_parts(3_832_000, 0) + // Minimum execution time: 3_133_000 picoseconds. + Weight::from_parts(3_229_000, 0) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_825_000 picoseconds. - Weight::from_parts(3_857_000, 0) + // Minimum execution time: 3_110_000 picoseconds. + Weight::from_parts(3_203_000, 0) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_777_000 picoseconds. - Weight::from_parts(3_868_000, 0) + // Minimum execution time: 3_138_000 picoseconds. + Weight::from_parts(3_201_000, 0) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_710_000 picoseconds. - Weight::from_parts(3_820_000, 0) + // Minimum execution time: 3_116_000 picoseconds. + Weight::from_parts(3_187_000, 0) } // Storage: ParachainInfo ParachainId (r:1 w:0) // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -347,17 +347,17 @@ impl WeightInfo { // Storage: BridgeWococoMessages OutboundMessages (r:0 w:1) // Proof: BridgeWococoMessages OutboundMessages (max_values: None, max_size: Some(2621472), added: 2623947, mode: MaxEncodedLen) pub(crate) fn export_message(x: u32, ) -> Weight { - Weight::from_parts(31_677_716 as u64, 0) + Weight::from_parts(31_677_716_u64, 0) // Standard Error: 4_158 .saturating_add(Weight::from_parts(123_901, 0).saturating_mul(x as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_876_000 picoseconds. - Weight::from_parts(4_012_000, 0) + // Minimum execution time: 3_364_000 picoseconds. + Weight::from_parts(3_429_000, 0) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index a05bd39fdd1..c01c34a3b38 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -16,12 +16,14 @@ use super::{ AccountId, AllPalletsWithSystem, Balances, BridgeGrandpaRococoInstance, - BridgeGrandpaWococoInstance, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + BridgeGrandpaWococoInstance, DeliveryRewardInBalance, ParachainInfo, ParachainSystem, + PolkadotXcm, RequiredStakeForStakeAndSlash, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, + WeightToFee, XcmpQueue, }; use crate::{ bridge_hub_rococo_config::ToBridgeHubWococoHaulBlobExporter, - bridge_hub_wococo_config::ToBridgeHubRococoHaulBlobExporter, EthereumNetwork, + bridge_hub_wococo_config::ToBridgeHubRococoHaulBlobExporter, + EthereumNetwork, }; use frame_support::{ match_types, parameter_types, @@ -29,10 +31,7 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::{ - impls::ToStakingPot, - xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, -}; +use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom}; use polkadot_parachain::primitives::Sibling; use snowbridge_outbound_queue; use snowbridge_router_primitives::export::EthereumBlobExporter; @@ -41,10 +40,11 @@ use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, - CurrencyAdapter, EnsureXcmOrigin, IsConcrete, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, WeightInfoBounds, WithComputedOrigin, + CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, IsConcrete, + ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, + WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::{ traits::{ExportXcm, WithOriginFilter}, @@ -154,70 +154,80 @@ impl Contains for SafeCallFilter { } } + // Allow to change dedicated storage items (called by governance-like) match call { + RuntimeCall::System(frame_system::Call::set_storage { items }) + if items.iter().any(|(k, _)| { + k.eq(&DeliveryRewardInBalance::key()) | + k.eq(&RequiredStakeForStakeAndSlash::key()) + }) => + return true, + _ => (), + }; + + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< - Runtime, - BridgeGrandpaRococoInstance, - >::initialize { - .. - }) | - RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< - Runtime, - BridgeGrandpaWococoInstance, - >::initialize { - .. - }) | - RuntimeCall::EthereumBeaconClient( - snowbridge_ethereum_beacon_client::Call::force_checkpoint { .. }, - ) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< + Runtime, + BridgeGrandpaRococoInstance, + >::initialize { .. }) | + RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< + Runtime, + BridgeGrandpaWococoInstance, + >::initialize { .. }) | + RuntimeCall::EthereumBeaconClient( + snowbridge_ethereum_beacon_client::Call::force_checkpoint { .. }, + ) + ) } } -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - // Allow local users to buy weight credit. - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - WithComputedOrigin< - ( - // If the message is one that immediately attemps to pay for execution, then allow it. - AllowTopLevelPaidExecutionFrom, - // Parent and its pluralities (i.e. governance bodies) get free execution. - AllowExplicitUnpaidExecutionFrom, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - ), - UniversalLocation, - ConstU32<8>, - >, - // TODO:check-parameter - (https://github.com/paritytech/parity-bridges-common/issues/2084) - // remove this and extend `AllowExplicitUnpaidExecutionFrom` with "or SystemParachains" once merged https://github.com/paritytech/polkadot/pull/7005 - AllowUnpaidExecutionFrom, - ), +pub type Barrier = TrailingSetTopicAsId< + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + // Allow local users to buy weight credit. + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its pluralities (i.e. governance bodies) get free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, + // TODO:check-parameter - (https://github.com/paritytech/parity-bridges-common/issues/2084) + // remove this and extend `AllowExplicitUnpaidExecutionFrom` with "or SystemParachains" once merged https://github.com/paritytech/polkadot/pull/7005 + AllowUnpaidExecutionFrom, + ), + >, >; pub struct XcmConfig; @@ -242,12 +252,12 @@ impl xcm_executor::Config for XcmConfig { UsingComponents>; type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; + type AssetLocker = (); + type AssetExchanger = (); type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; type PalletInstancesInfo = AllPalletsWithSystem; type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); type FeeManager = (); type MessageExporter = BridgeHubRococoOrBridgeHubWococoSwitchExporter; type UniversalAliases = Nothing; @@ -261,12 +271,12 @@ pub type LocalOriginToLocation = SignedToAccountId32, // ..and XCMP to communicate with the sibling chains. XcmpQueue, -); +)>; #[cfg(feature = "runtime-benchmarks")] parameter_types! { @@ -303,6 +313,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs index 48efe425efd..6a1ec2793f2 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs @@ -14,32 +14,94 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -pub use bridge_hub_rococo_runtime::{ - constants::fee::WeightToFee, - xcm_config::{RelayNetwork, XcmConfig, XcmRouter}, - Balances, BridgeGrandpaRococoInstance, BridgeGrandpaWococoInstance, BridgeWococoMessages, - ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, - SessionKeys, -}; -use codec::{Decode, Encode}; -use xcm::latest::prelude::*; +#![cfg(test)] +use bp_polkadot_core::Signature; use bridge_hub_rococo_runtime::{ - bridge_hub_rococo_config, bridge_hub_wococo_config, WithBridgeHubRococoMessagesInstance, - WithBridgeHubWococoMessagesInstance, + bridge_hub_rococo_config, bridge_hub_wococo_config, + constants::fee::WeightToFee, + xcm_config::{RelayNetwork, XcmConfig}, + BridgeRejectObsoleteHeadersAndMessages, DeliveryRewardInBalance, Executive, ExistentialDeposit, + ParachainSystem, PolkadotXcm, RequiredStakeForStakeAndSlash, Runtime, RuntimeCall, + RuntimeEvent, SessionKeys, SignedExtra, UncheckedExtrinsic, }; - +use codec::{Decode, Encode}; use frame_support::parameter_types; -use parachains_common::{AccountId, AuraId}; +use parachains_common::{AccountId, AuraId, Balance}; +use sp_keyring::AccountKeyring::Alice; +use sp_runtime::{ + generic::{Era, SignedPayload}, + AccountId32, +}; +use xcm::latest::prelude::*; -const ALICE: [u8; 32] = [1u8; 32]; +// Para id of sibling chain (Rockmine/Wockmint) used in tests. +pub const SIBLING_PARACHAIN_ID: u32 = 1000; parameter_types! { pub CheckingAccount: AccountId = PolkadotXcm::check_account(); } +fn construct_extrinsic( + sender: sp_keyring::AccountKeyring, + call: RuntimeCall, +) -> UncheckedExtrinsic { + let extra: SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(Era::immortal()), + frame_system::CheckNonce::::from(0), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + BridgeRejectObsoleteHeadersAndMessages {}, + ( + bridge_hub_wococo_config::BridgeRefundBridgeHubRococoMessages::default(), + bridge_hub_rococo_config::BridgeRefundBridgeHubWococoMessages::default(), + ), + ); + let payload = SignedPayload::new(call.clone(), extra.clone()).unwrap(); + let signature = payload.using_encoded(|e| sender.sign(e)); + UncheckedExtrinsic::new_signed( + call, + AccountId32::from(sender.public()).into(), + Signature::Sr25519(signature.clone()), + extra, + ) +} + +fn construct_and_apply_extrinsic( + relayer_at_target: sp_keyring::AccountKeyring, + batch: pallet_utility::Call, +) -> sp_runtime::DispatchOutcome { + let batch_call = RuntimeCall::Utility(batch); + let xt = construct_extrinsic(relayer_at_target, batch_call); + let r = Executive::apply_extrinsic(xt); + r.unwrap() +} + +fn executive_init_block(header: &::Header) { + Executive::initialize_block(header) +} + +fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys { + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(Alice), + AccountId::from(Alice), + SessionKeys { aura: AuraId::from(Alice.public()) }, + ) +} + mod bridge_hub_rococo_tests { use super::*; + use bridge_hub_rococo_config::{ + WithBridgeHubWococoMessageBridge, DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO, + }; + use bridge_hub_rococo_runtime::{ + BridgeGrandpaWococoInstance, BridgeParachainWococoInstance, + WithBridgeHubWococoMessagesInstance, + }; bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!( Runtime, @@ -47,11 +109,7 @@ mod bridge_hub_rococo_tests { CheckingAccount, WeightToFee, ParachainSystem, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|runtime_event_encoded: Vec| { match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { @@ -68,71 +126,157 @@ mod bridge_hub_rococo_tests { bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID ); - bridge_hub_test_utils::include_initialize_bridge_by_governance_works!( - Runtime, - BridgeGrandpaWococoInstance, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, - Box::new(|call| RuntimeCall::BridgeWococoGrandpa(call).encode()) - ); + #[test] + fn initialize_bridge_by_governance_works() { + bridge_hub_test_utils::test_cases::initialize_bridge_by_governance_works::< + Runtime, + BridgeGrandpaWococoInstance, + >( + collator_session_keys(), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::BridgeWococoGrandpa(call).encode()), + ) + } - bridge_hub_test_utils::include_handle_export_message_from_system_parachain_to_outbound_queue_works!( - Runtime, - XcmConfig, - WithBridgeHubWococoMessagesInstance, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, - 1000, - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::BridgeWococoMessages(event)) => Some(event), - _ => None, - } - }), - || ExportMessage { network: Wococo, destination: X1(Parachain(1234)), xcm: Xcm(vec![]) }, - bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO - ); + #[test] + fn change_delivery_reward_by_governance_works() { + bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::< + Runtime, + DeliveryRewardInBalance, + u64, + >( + collator_session_keys(), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::System(call).encode()), + || (DeliveryRewardInBalance::key().to_vec(), DeliveryRewardInBalance::get()), + |old_value| old_value.checked_mul(2).unwrap(), + ) + } - bridge_hub_test_utils::include_message_dispatch_routing_works!( - Runtime, - XcmConfig, - ParachainSystem, - WithBridgeHubWococoMessagesInstance, - RelayNetwork, - bridge_hub_rococo_config::WococoGlobalConsensusNetwork, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, - 1000, - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::ParachainSystem(event)) => Some(event), - _ => None, - } - }), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), - _ => None, - } - }), - bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO - ); + #[test] + fn change_required_stake_by_governance_works() { + bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::< + Runtime, + RequiredStakeForStakeAndSlash, + Balance, + >( + collator_session_keys(), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::System(call).encode()), + || { + ( + RequiredStakeForStakeAndSlash::key().to_vec(), + RequiredStakeForStakeAndSlash::get(), + ) + }, + |old_value| old_value.checked_mul(2).unwrap(), + ) + } + + #[test] + fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() { + bridge_hub_test_utils::test_cases::handle_export_message_from_system_parachain_to_outbound_queue_works::< + Runtime, + XcmConfig, + WithBridgeHubWococoMessagesInstance, + >( + collator_session_keys(), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeWococoMessages(event)) => Some(event), + _ => None, + } + }), + || ExportMessage { network: Wococo, destination: X1(Parachain(1234)), xcm: Xcm(vec![]) }, + bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO + ) + } + + #[test] + fn message_dispatch_routing_works() { + bridge_hub_test_utils::test_cases::message_dispatch_routing_works::< + Runtime, + XcmConfig, + ParachainSystem, + WithBridgeHubWococoMessagesInstance, + RelayNetwork, + bridge_hub_rococo_config::WococoGlobalConsensusNetwork, + >( + collator_session_keys(), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::ParachainSystem(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO, + ) + } + + #[test] + fn relayed_incoming_message_works() { + bridge_hub_test_utils::test_cases::relayed_incoming_message_works::< + Runtime, + XcmConfig, + ParachainSystem, + BridgeGrandpaWococoInstance, + BridgeParachainWococoInstance, + WithBridgeHubWococoMessagesInstance, + WithBridgeHubWococoMessageBridge, + >( + collator_session_keys(), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + Rococo, + DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO, + ) + } + + #[test] + pub fn complex_relay_extrinsic_works() { + bridge_hub_test_utils::test_cases::complex_relay_extrinsic_works::< + Runtime, + XcmConfig, + ParachainSystem, + BridgeGrandpaWococoInstance, + BridgeParachainWococoInstance, + WithBridgeHubWococoMessagesInstance, + WithBridgeHubWococoMessageBridge, + >( + collator_session_keys(), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + bridge_hub_rococo_config::BridgeHubWococoChainId::get(), + Rococo, + DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO, + ExistentialDeposit::get(), + executive_init_block, + construct_and_apply_extrinsic, + ); + } } mod bridge_hub_wococo_tests { use super::*; + use bridge_hub_rococo_runtime::{ + BridgeGrandpaRococoInstance, BridgeParachainRococoInstance, + WithBridgeHubRococoMessagesInstance, + }; + use bridge_hub_wococo_config::{ + WithBridgeHubRococoMessageBridge, DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO, + }; bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!( Runtime, @@ -140,11 +284,7 @@ mod bridge_hub_wococo_tests { CheckingAccount, WeightToFee, ParachainSystem, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), + collator_session_keys(), ExistentialDeposit::get(), Box::new(|runtime_event_encoded: Vec| { match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { @@ -161,91 +301,144 @@ mod bridge_hub_wococo_tests { bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID ); - bridge_hub_test_utils::include_initialize_bridge_by_governance_works!( - Runtime, - BridgeGrandpaRococoInstance, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, - Box::new(|call| RuntimeCall::BridgeRococoGrandpa(call).encode()) - ); + #[test] + fn initialize_bridge_by_governance_works() { + bridge_hub_test_utils::test_cases::initialize_bridge_by_governance_works::< + Runtime, + BridgeGrandpaRococoInstance, + >( + collator_session_keys(), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::BridgeRococoGrandpa(call).encode()), + ) + } - bridge_hub_test_utils::include_handle_export_message_from_system_parachain_to_outbound_queue_works!( - Runtime, - XcmConfig, - WithBridgeHubRococoMessagesInstance, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, - 1000, - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::BridgeRococoMessages(event)) => Some(event), - _ => None, - } - }), - || ExportMessage { network: Rococo, destination: X1(Parachain(4321)), xcm: Xcm(vec![]) }, - bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO - ); + #[test] + fn change_delivery_reward_by_governance_works() { + bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::< + Runtime, + DeliveryRewardInBalance, + u64, + >( + collator_session_keys(), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::System(call).encode()), + || (DeliveryRewardInBalance::key().to_vec(), DeliveryRewardInBalance::get()), + |old_value| old_value.checked_mul(2).unwrap(), + ) + } - bridge_hub_test_utils::include_message_dispatch_routing_works!( - Runtime, - XcmConfig, - ParachainSystem, - WithBridgeHubRococoMessagesInstance, - RelayNetwork, - bridge_hub_wococo_config::RococoGlobalConsensusNetwork, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, - 1000, - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::ParachainSystem(event)) => Some(event), - _ => None, - } - }), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), - _ => None, - } - }), - bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO - ); + #[test] + fn change_required_stake_by_governance_works() { + bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::< + Runtime, + RequiredStakeForStakeAndSlash, + Balance, + >( + collator_session_keys(), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::System(call).encode()), + || { + ( + RequiredStakeForStakeAndSlash::key().to_vec(), + RequiredStakeForStakeAndSlash::get(), + ) + }, + |old_value| old_value.checked_mul(2).unwrap(), + ) + } + + #[test] + fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() { + bridge_hub_test_utils::test_cases::handle_export_message_from_system_parachain_to_outbound_queue_works::< + Runtime, + XcmConfig, + WithBridgeHubRococoMessagesInstance, + >( + collator_session_keys(), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeRococoMessages(event)) => Some(event), + _ => None, + } + }), + || ExportMessage { network: Rococo, destination: X1(Parachain(4321)), xcm: Xcm(vec![]) }, + bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO + ) + } + + #[test] + fn message_dispatch_routing_works() { + bridge_hub_test_utils::test_cases::message_dispatch_routing_works::< + Runtime, + XcmConfig, + ParachainSystem, + WithBridgeHubRococoMessagesInstance, + RelayNetwork, + bridge_hub_wococo_config::RococoGlobalConsensusNetwork, + >( + collator_session_keys(), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::ParachainSystem(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO, + ) + } + + #[test] + fn relayed_incoming_message_works() { + bridge_hub_test_utils::test_cases::relayed_incoming_message_works::< + Runtime, + XcmConfig, + ParachainSystem, + BridgeGrandpaRococoInstance, + BridgeParachainRococoInstance, + WithBridgeHubRococoMessagesInstance, + WithBridgeHubRococoMessageBridge, + >( + collator_session_keys(), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + Wococo, + DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO, + ) + } + + #[test] + pub fn complex_relay_extrinsic_works() { + bridge_hub_test_utils::test_cases::complex_relay_extrinsic_works::< + Runtime, + XcmConfig, + ParachainSystem, + BridgeGrandpaRococoInstance, + BridgeParachainRococoInstance, + WithBridgeHubRococoMessagesInstance, + WithBridgeHubRococoMessageBridge, + >( + collator_session_keys(), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + SIBLING_PARACHAIN_ID, + bridge_hub_wococo_config::BridgeHubRococoChainId::get(), + Wococo, + DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO, + ExistentialDeposit::get(), + executive_init_block, + construct_and_apply_extrinsic, + ); + } } -bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!( - Runtime, - XcmConfig, - CheckingAccount, - WeightToFee, - ParachainSystem, - bridge_hub_test_utils::CollatorSessionKeys::new( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } - ), - ExistentialDeposit::get(), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), - _ => None, - } - }), - Box::new(|runtime_event_encoded: Vec| { - match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { - Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), - _ => None, - } - }), - 1013 -); diff --git a/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml b/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml index 096c777901a..ade734b6ce2 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml @@ -8,22 +8,29 @@ description = "Utils for BridgeHub testing" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } log = { version = "0.4.17", default-features = false } +assert_matches = "1.4.0" # Substrate +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } # Cumulus +asset-test-utils = { path = "../../assets/test-utils"} cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false } -pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false } cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false } cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false } +pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false } parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } -asset-test-utils = { path = "../../assets/test-utils"} +parachains-runtimes-test-utils = { path = "../../test-utils", default-features = false } # Polkadot pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } @@ -33,13 +40,19 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } # Bridges +bp-bridge-hub-rococo = { path = "../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false } +bp-bridge-hub-wococo = { path = "../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false } bp-header-chain = { path = "../../../../bridges/primitives/header-chain", default-features = false } bp-messages = { path = "../../../../bridges/primitives/messages", default-features = false } +bp-parachains = { path = "../../../../bridges/primitives/parachains", default-features = false } bp-polkadot-core = { path = "../../../../bridges/primitives/polkadot-core", default-features = false } +bp-relayers = { path = "../../../../bridges/primitives/relayers", default-features = false } bp-runtime = { path = "../../../../bridges/primitives/runtime", default-features = false } bp-test-utils = { path = "../../../../bridges/primitives/test-utils", default-features = false } pallet-bridge-grandpa = { path = "../../../../bridges/modules/grandpa", default-features = false } +pallet-bridge-parachains = { path = "../../../../bridges/modules/parachains", default-features = false } pallet-bridge-messages = { path = "../../../../bridges/modules/messages", default-features = false } +pallet-bridge-relayers = { path = "../../../../bridges/modules/relayers", default-features = false } bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", default-features = false } [features] @@ -47,20 +60,28 @@ default = [ "std" ] std = [ "codec/std", "log/std", + "frame-benchmarking/std", + "frame-executive/std", "frame-support/std", "frame-system/std", "bp-messages/std", + "bp-parachains/std", "bp-polkadot-core/std", "bp-header-chain/std", + "bp-relayers/std", "bp-runtime/std", "bp-test-utils/std", "bridge-runtime-common/std", "pallet-bridge-grandpa/std", + "pallet-bridge-parachains/std", "pallet-bridge-messages/std", + "pallet-bridge-relayers/std", "parachain-info/std", + "parachains-runtimes-test-utils/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-xcmp-queue/std", "pallet-xcm/std", + "sp-core/std", "sp-io/std", "sp-runtime/std", "xcm/std", @@ -70,4 +91,5 @@ std = [ "cumulus-pallet-dmp-queue/std", "pallet-session/std", "pallet-balances/std", + "pallet-utility/std", ] diff --git a/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs b/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs index b65b25c525d..289d3f5b4d3 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2023 Parity Technologies (UK) Ltd. +// Copyright Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -pub use bp_test_utils::test_header; +//! Module contains predefined test-case scenarios for "BridgeHub" `Runtime`s. + pub mod test_cases; -pub use test_cases::CollatorSessionKeys; +pub use bp_test_utils::test_header; +pub use parachains_runtimes_test_utils::*; diff --git a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs index 3d6aac7b62d..14792067e43 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs @@ -16,28 +16,42 @@ //! Module contains predefined test-case scenarios for `Runtime` with bridging capabilities. +use assert_matches::assert_matches; +use bp_messages::{ + target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch, SourceHeaderChain}, + LaneId, MessageKey, OutboundLaneData, Weight, +}; +use bp_parachains::{BestParaHeadHash, ParaInfo}; +use bp_polkadot_core::parachains::{ParaHash, ParaId}; +use bp_relayers::{RewardsAccountOwner, RewardsAccountParams}; +use bp_runtime::{HeaderOf, Parachain, StorageProofSize, UnderlyingChainOf}; +use bp_test_utils::{make_default_justification, prepare_parachain_heads_proof}; +use bridge_runtime_common::{ + messages::{ + target::FromBridgedChainMessagesProof, BridgedChain as MessageBridgedChain, MessageBridge, + }, + messages_generation::{encode_all_messages, encode_lane_data, prepare_messages_storage_proof}, + messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatchResult}, +}; use codec::Encode; -use frame_support::{assert_ok, traits::Get}; +use frame_support::{ + assert_ok, + traits::{Get, OriginTrait}, +}; +use pallet_bridge_grandpa::BridgedHeader; +use parachains_runtimes_test_utils::{ + mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeHelper, + ValidatorIdOf, XcmReceivedFrom, +}; +use sp_core::H256; +use sp_keyring::AccountKeyring::*; +use sp_runtime::{traits::Header as HeaderT, AccountId32}; use xcm::latest::prelude::*; use xcm_builder::DispatchBlobError; use xcm_executor::XcmExecutor; -// Lets re-use this stuff from assets (later we plan to move it outside of assets as `runtimes/test-utils`) -use asset_test_utils::{ - mock_open_hrmp_channel, AccountIdOf, ExtBuilder, RuntimeHelper, ValidatorIdOf, -}; - -// Re-export test_cases from assets -pub use asset_test_utils::{ - include_teleports_for_native_asset_works, CollatorSessionKeys, XcmReceivedFrom, -}; -use bp_messages::{ - target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch}, - LaneId, MessageKey, OutboundLaneData, -}; -use bridge_runtime_common::messages_xcm_extension::{ - XcmAsPlainPayload, XcmBlobMessageDispatchResult, -}; +// Re-export test_case from assets +pub use asset_test_utils::include_teleports_for_native_asset_works; /// Test-case makes sure that `Runtime` can process bridging initialize via governance-like call pub fn initialize_bridge_by_governance_works( @@ -84,8 +98,7 @@ pub fn initialize_bridge_by_governance_works( let require_weight_at_most = ::DbWeight::get().reads_writes(7, 7); - // execute XCM with Transacts to initialize bridge as governance does - // prepare data for xcm::Transact(create) + // execute XCM with Transacts to `initialize bridge` as governance does assert_ok!(RuntimeHelper::::execute_as_governance( initialize_call, require_weight_at_most @@ -100,28 +113,75 @@ pub fn initialize_bridge_by_governance_works( }) } -#[macro_export] -macro_rules! include_initialize_bridge_by_governance_works( - ( - $runtime:path, - $pallet_bridge_grandpa_instance:path, - $collator_session_key:expr, - $runtime_para_id:expr, - $runtime_call_encode:expr - ) => { - #[test] - fn initialize_bridge_by_governance_works() { - $crate::test_cases::initialize_bridge_by_governance_works::< - $runtime, - $pallet_bridge_grandpa_instance, - >( - $collator_session_key, - $runtime_para_id, - $runtime_call_encode +/// Test-case makes sure that `Runtime` can change storage constant via governance-like call +pub fn change_storage_constant_by_governance_works( + collator_session_key: CollatorSessionKeys, + runtime_para_id: u32, + runtime_call_encode: Box) -> Vec>, + storage_constant_key_value: fn() -> (Vec, StorageConstantType), + new_storage_constant_value: fn(&StorageConstantType) -> StorageConstantType, +) where + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config + + pallet_collator_selection::Config + + cumulus_pallet_dmp_queue::Config + + cumulus_pallet_parachain_system::Config, + ValidatorIdOf: From>, + StorageConstant: Get, + StorageConstantType: Encode + PartialEq + std::fmt::Debug, +{ + ExtBuilder::::default() + .with_collators(collator_session_key.collators()) + .with_session_keys(collator_session_key.session_keys()) + .with_para_id(runtime_para_id.into()) + .with_tracing() + .build() + .execute_with(|| { + let (storage_constant_key, storage_constant_init_value): ( + Vec, + StorageConstantType, + ) = storage_constant_key_value(); + + // check delivery reward constant before (not stored yet, just as default value is used) + assert_eq!(StorageConstant::get(), storage_constant_init_value); + assert_eq!(sp_io::storage::get(&storage_constant_key), None); + + let new_storage_constant_value = + new_storage_constant_value(&storage_constant_init_value); + assert_ne!(new_storage_constant_value, storage_constant_init_value); + + // encode `set_storage` call + let set_storage_call = + runtime_call_encode(frame_system::Call::::set_storage { + items: vec![( + storage_constant_key.clone(), + new_storage_constant_value.encode(), + )], + }); + + // estimate - storing just 1 value + use frame_system::WeightInfo; + let require_weight_at_most = + ::SystemWeightInfo::set_storage(1); + + // execute XCM with Transact to `set_storage` as governance does + assert_ok!(RuntimeHelper::::execute_as_governance( + set_storage_call, + require_weight_at_most ) - } - } -); + .ensure_complete()); + + // check delivery reward constant after (stored) + assert_eq!(StorageConstant::get(), new_storage_constant_value); + assert_eq!( + sp_io::storage::get(&storage_constant_key), + Some(new_storage_constant_value.encode().into()) + ); + }) +} /// Test-case makes sure that `Runtime` can handle xcm `ExportMessage`: /// Checks if received XCM messages is correctly added to the message outbound queue for delivery. @@ -166,7 +226,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< // check queue before assert_eq!( pallet_bridge_messages::OutboundLanes::::try_get( - &expected_lane_id + expected_lane_id ), Err(()) ); @@ -190,7 +250,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< // check queue after assert_eq!( pallet_bridge_messages::OutboundLanes::::try_get( - &expected_lane_id + expected_lane_id ), Ok(OutboundLaneData { oldest_unpruned_nonce: 1, @@ -209,42 +269,11 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< }) } -#[macro_export] -macro_rules! include_handle_export_message_from_system_parachain_to_outbound_queue_works( - ( - $runtime:path, - $xcm_config:path, - $pallet_bridge_messages_instance:path, - $collator_session_key:expr, - $runtime_para_id:expr, - $sibling_parachain_id:expr, - $unwrap_pallet_bridge_messages_event:expr, - $export_message_instruction:expr, - $expected_lane_id:expr - ) => { - #[test] - fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() { - $crate::test_cases::handle_export_message_from_system_parachain_to_outbound_queue_works::< - $runtime, - $xcm_config, - $pallet_bridge_messages_instance - >( - $collator_session_key, - $runtime_para_id, - $sibling_parachain_id, - $unwrap_pallet_bridge_messages_event, - $export_message_instruction, - $expected_lane_id - ) - } - } -); - /// Test-case makes sure that Runtime can route XCM messages received in inbound queue, /// We just test here `MessageDispatch` configuration. /// We expect that runtime can route messages: -/// 1. to Parent (relay chain) -/// 2. to Sibling parachain +/// 1. to Parent (relay chain) +/// 2. to Sibling parachain pub fn message_dispatch_routing_works< Runtime, XcmConfig, @@ -294,123 +323,579 @@ pub fn message_dispatch_routing_works< .with_tracing() .build() .execute_with(|| { - // 1. this message is sent from other global consensus with destination of this Runtime relay chain (UMP) - let bridging_message = - test_data::simulate_message_exporter_on_bridged_chain::( - (RuntimeNetwork::get(), Here) - ); - let result = <>::MessageDispatch>::dispatch( - test_data::dispatch_message(expected_lane_id, 1, bridging_message) + // 1. this message is sent from other global consensus with destination of this Runtime relay chain (UMP) + let bridging_message = + test_data::simulate_message_exporter_on_bridged_chain::( + (RuntimeNetwork::get(), Here) ); - assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)); - - // check events - UpwardMessageSent - let mut events = >::events() - .into_iter() - .filter_map(|e| unwrap_cumulus_pallet_parachain_system_event(e.event.encode())); - assert!( - events.any(|e| matches!(e, cumulus_pallet_parachain_system::Event::UpwardMessageSent { .. })) - ); - - // 2. this message is sent from other global consensus with destination of this Runtime sibling parachain (HRMP) - let bridging_message = - test_data::simulate_message_exporter_on_bridged_chain::( - (RuntimeNetwork::get(), X1(Parachain(sibling_parachain_id))), - ); + let result = <>::MessageDispatch>::dispatch( + test_data::dispatch_message(expected_lane_id, 1, bridging_message) + ); + assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)); - // 2.1. WITHOUT opened hrmp channel -> RoutingError - let result = - <>::MessageDispatch>::dispatch( - DispatchMessage { - key: MessageKey { lane_id: expected_lane_id, nonce: 1 }, - data: DispatchMessageData { payload: Ok(bridging_message.clone()) }, - } - ); - assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::NotDispatched(Some(DispatchBlobError::RoutingError)))); + // check events - UpwardMessageSent + let mut events = >::events() + .into_iter() + .filter_map(|e| unwrap_cumulus_pallet_parachain_system_event(e.event.encode())); + assert!( + events.any(|e| matches!(e, cumulus_pallet_parachain_system::Event::UpwardMessageSent { .. })) + ); - // check events - no XcmpMessageSent - assert_eq!(>::events() - .into_iter() - .filter_map(|e| unwrap_cumulus_pallet_xcmp_queue_event(e.event.encode())) - .count(), 0); + // 2. this message is sent from other global consensus with destination of this Runtime sibling parachain (HRMP) + let bridging_message = + test_data::simulate_message_exporter_on_bridged_chain::( + (RuntimeNetwork::get(), X1(Parachain(sibling_parachain_id))), + ); - // 2.1. WITH hrmp channel -> Ok - mock_open_hrmp_channel::(runtime_para_id.into(), sibling_parachain_id.into()); - let result = <>::MessageDispatch>::dispatch( + // 2.1. WITHOUT opened hrmp channel -> RoutingError + let result = + <>::MessageDispatch>::dispatch( DispatchMessage { key: MessageKey { lane_id: expected_lane_id, nonce: 1 }, - data: DispatchMessageData { payload: Ok(bridging_message) }, + data: DispatchMessageData { payload: Ok(bridging_message.clone()) }, } ); - assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)); - - // check events - XcmpMessageSent - let mut events = >::events() - .into_iter() - .filter_map(|e| unwrap_cumulus_pallet_xcmp_queue_event(e.event.encode())); - assert!( - events.any(|e| matches!(e, cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. })) + assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::NotDispatched(Some(DispatchBlobError::RoutingError)))); + + // check events - no XcmpMessageSent + assert_eq!(>::events() + .into_iter() + .filter_map(|e| unwrap_cumulus_pallet_xcmp_queue_event(e.event.encode())) + .count(), 0); + + // 2.1. WITH hrmp channel -> Ok + mock_open_hrmp_channel::(runtime_para_id.into(), sibling_parachain_id.into()); + let result = <>::MessageDispatch>::dispatch( + DispatchMessage { + key: MessageKey { lane_id: expected_lane_id, nonce: 1 }, + data: DispatchMessageData { payload: Ok(bridging_message) }, + } + ); + assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)); + + // check events - XcmpMessageSent + let mut events = >::events() + .into_iter() + .filter_map(|e| unwrap_cumulus_pallet_xcmp_queue_event(e.event.encode())); + assert!( + events.any(|e| matches!(e, cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. })) + ); + }) +} + +/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer, +/// with proofs (finality, para heads, message) independently submitted. +pub fn relayed_incoming_message_works( + collator_session_key: CollatorSessionKeys, + runtime_para_id: u32, + bridged_para_id: u32, + sibling_parachain_id: u32, + local_relay_chain_id: NetworkId, + lane_id: LaneId, +) where + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config + + pallet_collator_selection::Config + + cumulus_pallet_dmp_queue::Config + + cumulus_pallet_parachain_system::Config + + cumulus_pallet_xcmp_queue::Config + + pallet_bridge_grandpa::Config + + pallet_bridge_parachains::Config + + pallet_bridge_messages::Config, + GPI: 'static, + PPI: 'static, + MPI: 'static, + MB: MessageBridge, + ::BridgedChain: Send + Sync + 'static, + UnderlyingChainOf>: bp_runtime::Chain + Parachain, + XcmConfig: xcm_executor::Config, + HrmpChannelOpener: frame_support::inherent::ProvideInherent< + Call = cumulus_pallet_parachain_system::Call, + >, + ValidatorIdOf: From>, + <>::SourceHeaderChain as SourceHeaderChain>::MessagesProof: From>, + <>::BridgedChain as bp_runtime::Chain>::Hash: From, + ParaHash: From<<>::BridgedChain as bp_runtime::Chain>::Hash>, + ::AccountId: + Into<<::RuntimeOrigin as OriginTrait>::AccountId>, + AccountIdOf: From, + >::InboundRelayer: From, +{ + assert_ne!(runtime_para_id, sibling_parachain_id); + assert_ne!(runtime_para_id, bridged_para_id); + + ExtBuilder::::default() + .with_collators(collator_session_key.collators()) + .with_session_keys(collator_session_key.session_keys()) + .with_safe_xcm_version(XCM_VERSION) + .with_para_id(runtime_para_id.into()) + .with_tracing() + .build() + .execute_with(|| { + mock_open_hrmp_channel::( + runtime_para_id.into(), + sibling_parachain_id.into(), + ); + + // start with bridged chain block#0 + let init_data = test_data::initialization_data::(0); + pallet_bridge_grandpa::Pallet::::initialize( + RuntimeHelper::::root_origin(), + init_data, + ) + .unwrap(); + + // set up relayer details and proofs + + let message_destination = + X2(GlobalConsensus(local_relay_chain_id), Parachain(sibling_parachain_id)); + // some random numbers (checked by test) + let message_nonce = 1; + let para_header_number = 5; + let relay_header_number = 1; + + let relayer_at_target = Bob; + let relayer_id_on_target: AccountIdOf = relayer_at_target.public().into(); + let relayer_at_source = Dave; + let relayer_id_on_source: AccountId32 = relayer_at_source.public().into(); + + let xcm = vec![xcm::v3::Instruction::<()>::ClearOrigin; 42]; + let expected_dispatch = xcm::latest::Xcm::<()>(xcm.clone()); + // generate bridged relay chain finality, parachain heads and message proofs, + // to be submitted by relayer to this chain. + let ( + relay_chain_header, + grandpa_justification, + bridged_para_head, + parachain_heads, + para_heads_proof, + message_proof, + ) = test_data::make_complex_relayer_proofs::, MB, ()>( + lane_id, + xcm.into(), + message_nonce, + message_destination, + para_header_number, + relay_header_number, + bridged_para_id, + ); + + // submit bridged relay chain finality proof + { + let result = pallet_bridge_grandpa::Pallet::::submit_finality_proof( + RuntimeHelper::::origin_of(relayer_id_on_target.clone()), + Box::new(relay_chain_header.clone()), + grandpa_justification, ); + assert_ok!(result); + assert_eq!(result.unwrap().pays_fee, frame_support::dispatch::Pays::Yes); + } + + // verify finality proof correctly imported + assert_eq!( + pallet_bridge_grandpa::BestFinalized::::get().unwrap().1, + relay_chain_header.hash() + ); + assert!(pallet_bridge_grandpa::ImportedHeaders::::contains_key( + relay_chain_header.hash() + )); + + // submit parachain heads proof + { + let result = + pallet_bridge_parachains::Pallet::::submit_parachain_heads( + RuntimeHelper::::origin_of(relayer_id_on_target.clone()), + (relay_header_number, relay_chain_header.hash().into()), + parachain_heads, + para_heads_proof, + ); + assert_ok!(result); + assert_eq!(result.unwrap().pays_fee, frame_support::dispatch::Pays::Yes); + } + // verify parachain head proof correctly imported + assert_eq!( + pallet_bridge_parachains::ParasInfo::::get(ParaId(bridged_para_id)), + Some(ParaInfo { + best_head_hash: BestParaHeadHash { + at_relay_block_number: relay_header_number, + head_hash: bridged_para_head.hash() + }, + next_imported_hash_position: 1, + }) + ); + + // import message + assert!(RuntimeHelper::>::take_xcm( + sibling_parachain_id.into() + ) + .is_none()); + assert_eq!( + pallet_bridge_messages::InboundLanes::::get(lane_id) + .last_delivered_nonce(), + 0, + ); + // submit message proof + { + let result = pallet_bridge_messages::Pallet::::receive_messages_proof( + RuntimeHelper::::origin_of(relayer_id_on_target), + relayer_id_on_source.into(), + message_proof.into(), + 1, + Weight::MAX / 1000, + ); + assert_ok!(result); + assert_eq!(result.unwrap().pays_fee, frame_support::dispatch::Pays::Yes); + } + // verify message correctly imported and dispatched + assert_eq!( + pallet_bridge_messages::InboundLanes::::get(lane_id) + .last_delivered_nonce(), + 1, + ); + // verify relayed bridged XCM message is dispatched to destination sibling para + let dispatched = RuntimeHelper::>::take_xcm( + sibling_parachain_id.into(), + ) + .unwrap(); + let mut dispatched = xcm::latest::Xcm::<()>::try_from(dispatched).unwrap(); + // We use `WithUniqueTopic`, so expect a trailing `SetTopic`. + assert_matches!(dispatched.0.pop(), Some(SetTopic(..))); + assert_eq!(dispatched, expected_dispatch); }) } -#[macro_export] -macro_rules! include_message_dispatch_routing_works( - ( - $runtime:path, - $xcm_config:path, - $hrmp_channel_opener:path, - $pallet_bridge_messages_instance:path, - $runtime_network:path, - $bridged_network:path, - $collator_session_key:expr, - $runtime_para_id:expr, - $sibling_parachain_id:expr, - $unwrap_cumulus_pallet_parachain_system_event:expr, - $unwrap_cumulus_pallet_xcmp_queue_event:expr, - $expected_lane_id:expr - ) => { - #[test] - fn message_dispatch_routing_works() { - $crate::test_cases::message_dispatch_routing_works::< - $runtime, - $xcm_config, - $hrmp_channel_opener, - $pallet_bridge_messages_instance, - $runtime_network, - $bridged_network - >( - $collator_session_key, - $runtime_para_id, - $sibling_parachain_id, - $unwrap_cumulus_pallet_parachain_system_event, - $unwrap_cumulus_pallet_xcmp_queue_event, - $expected_lane_id, +/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer, +/// with proofs (finality, para heads, message) batched together in signed extrinsic. +/// Also verifies relayer transaction signed extensions work as intended. +pub fn complex_relay_extrinsic_works( + collator_session_key: CollatorSessionKeys, + runtime_para_id: u32, + bridged_para_id: u32, + sibling_parachain_id: u32, + bridged_chain_id: bp_runtime::ChainId, + local_relay_chain_id: NetworkId, + lane_id: LaneId, + existential_deposit: BalanceOf, + executive_init_block: fn(&::Header), + construct_and_apply_extrinsic: fn( + sp_keyring::AccountKeyring, + pallet_utility::Call:: + ) -> sp_runtime::DispatchOutcome, +) where + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_utility::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config + + pallet_collator_selection::Config + + cumulus_pallet_dmp_queue::Config + + cumulus_pallet_parachain_system::Config + + cumulus_pallet_xcmp_queue::Config + + pallet_bridge_grandpa::Config + + pallet_bridge_parachains::Config + + pallet_bridge_messages::Config + + pallet_bridge_relayers::Config, + GPI: 'static, + PPI: 'static, + MPI: 'static, + MB: MessageBridge, + ::BridgedChain: Send + Sync + 'static, + UnderlyingChainOf>: bp_runtime::Chain + Parachain, + XcmConfig: xcm_executor::Config, + HrmpChannelOpener: frame_support::inherent::ProvideInherent< + Call = cumulus_pallet_parachain_system::Call, + >, + ValidatorIdOf: From>, + <>::SourceHeaderChain as SourceHeaderChain>::MessagesProof: From>, + <>::BridgedChain as bp_runtime::Chain>::Hash: From, + ParaHash: From<<>::BridgedChain as bp_runtime::Chain>::Hash>, + ::AccountId: + Into<<::RuntimeOrigin as OriginTrait>::AccountId>, + AccountIdOf: From, + >::InboundRelayer: From, + ::RuntimeCall: + From> + + From> + + From> +{ + assert_ne!(runtime_para_id, sibling_parachain_id); + assert_ne!(runtime_para_id, bridged_para_id); + + // Relayer account at local/this BH. + let relayer_at_target = Bob; + let relayer_id_on_target: AccountIdOf = relayer_at_target.public().into(); + let relayer_initial_balance = existential_deposit * 100000u32.into(); + // Relayer account at remote/bridged BH. + let relayer_at_source = Dave; + let relayer_id_on_source: AccountId32 = relayer_at_source.public().into(); + + ExtBuilder::::default() + .with_collators(collator_session_key.collators()) + .with_session_keys(collator_session_key.session_keys()) + .with_safe_xcm_version(XCM_VERSION) + .with_para_id(runtime_para_id.into()) + .with_balances(vec![(relayer_id_on_target.clone(), relayer_initial_balance)]) + .with_tracing() + .build() + .execute_with(|| { + let zero: ::BlockNumber = 0u32.into(); + let genesis_hash = frame_system::Pallet::::block_hash(zero); + let mut header: ::Header = + bp_test_utils::test_header(1u32.into()); + header.set_parent_hash(genesis_hash); + executive_init_block(&header); + + mock_open_hrmp_channel::( + runtime_para_id.into(), + sibling_parachain_id.into(), + ); + + // start with bridged chain block#0 + let init_data = test_data::initialization_data::(0); + pallet_bridge_grandpa::Pallet::::initialize( + RuntimeHelper::::root_origin(), + init_data, ) - } - } -); + .unwrap(); + + // set up relayer details and proofs + + let message_destination = + X2(GlobalConsensus(local_relay_chain_id), Parachain(sibling_parachain_id)); + // some random numbers (checked by test) + let message_nonce = 1; + let para_header_number = 5; + let relay_header_number = 1; + + let xcm = vec![xcm::latest::Instruction::<()>::ClearOrigin; 42]; + let expected_dispatch = xcm::latest::Xcm::<()>(xcm.clone()); + // generate bridged relay chain finality, parachain heads and message proofs, + // to be submitted by relayer to this chain. + let ( + relay_chain_header, + grandpa_justification, + bridged_para_head, + parachain_heads, + para_heads_proof, + message_proof, + ) = test_data::make_complex_relayer_proofs::, MB, ()>( + lane_id, + xcm.into(), + message_nonce, + message_destination, + para_header_number, + relay_header_number, + bridged_para_id, + ); -mod test_data { + let submit_grandpa = + pallet_bridge_grandpa::Call::::submit_finality_proof { + finality_target: Box::new(relay_chain_header.clone()), + justification: grandpa_justification, + }; + let submit_para_head = + pallet_bridge_parachains::Call::::submit_parachain_heads { + at_relay_block: (relay_header_number, relay_chain_header.hash().into()), + parachains: parachain_heads, + parachain_heads_proof: para_heads_proof, + }; + let submit_message = + pallet_bridge_messages::Call::::receive_messages_proof { + relayer_id_at_bridged_chain: relayer_id_on_source.into(), + proof: message_proof.into(), + messages_count: 1, + dispatch_weight: Weight::from_parts(1000000000, 0), + }; + let batch = pallet_utility::Call::::batch_all { + calls: vec![submit_grandpa.into(), submit_para_head.into(), submit_message.into()], + }; + + // sanity checks - before relayer extrinsic + assert!(RuntimeHelper::>::take_xcm( + sibling_parachain_id.into() + ) + .is_none()); + assert_eq!( + pallet_bridge_messages::InboundLanes::::get(lane_id) + .last_delivered_nonce(), + 0, + ); + let msg_proofs_rewards_account = RewardsAccountParams::new( + lane_id, + bridged_chain_id, + RewardsAccountOwner::ThisChain, + ); + assert_eq!( + pallet_bridge_relayers::RelayerRewards::::get( + relayer_id_on_target.clone(), + msg_proofs_rewards_account + ), + None, + ); + + // construct and apply extrinsic containing batch calls: + // bridged relay chain finality proof + // + parachain heads proof + // + submit message proof + let dispatch_outcome = construct_and_apply_extrinsic(relayer_at_target, batch); + + // verify finality proof correctly imported + assert_ok!(dispatch_outcome); + assert_eq!( + >::get().unwrap().1, + relay_chain_header.hash() + ); + assert!(>::contains_key( + relay_chain_header.hash() + )); + // verify parachain head proof correctly imported + assert_eq!( + pallet_bridge_parachains::ParasInfo::::get(ParaId(bridged_para_id)), + Some(ParaInfo { + best_head_hash: BestParaHeadHash { + at_relay_block_number: relay_header_number, + head_hash: bridged_para_head.hash() + }, + next_imported_hash_position: 1, + }) + ); + // verify message correctly imported and dispatched + assert_eq!( + pallet_bridge_messages::InboundLanes::::get(lane_id) + .last_delivered_nonce(), + 1, + ); + // verify relayer is refunded + assert!(pallet_bridge_relayers::RelayerRewards::::get( + relayer_id_on_target, + msg_proofs_rewards_account + ) + .is_some()); + // verify relayed bridged XCM message is dispatched to destination sibling para + let dispatched = RuntimeHelper::>::take_xcm( + sibling_parachain_id.into(), + ) + .unwrap(); + let mut dispatched = xcm::latest::Xcm::<()>::try_from(dispatched).unwrap(); + // We use `WithUniqueTopic`, so expect a trailing `SetTopic`. + assert_matches!(dispatched.0.pop(), Some(SetTopic(..))); + assert_eq!(dispatched, expected_dispatch); + }) +} + +pub mod test_data { use super::*; + use bp_header_chain::justification::GrandpaJustification; use bp_messages::MessageNonce; + use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId}; + use bp_runtime::BasicOperatingMode; + use bp_test_utils::authority_list; use xcm_builder::{HaulBlob, HaulBlobError, HaulBlobExporter}; use xcm_executor::traits::{validate_export, ExportXcm}; + pub fn prepare_inbound_xcm( + xcm_message: Xcm, + destination: InteriorMultiLocation, + ) -> Vec { + let location = xcm::VersionedInteriorMultiLocation::V3(destination); + let xcm = xcm::VersionedXcm::::V3(xcm_message); + // this is the `BridgeMessage` from polkadot xcm builder, but it has no constructor + // or public fields, so just tuple + // (double encoding, because `.encode()` is called on original Xcm BLOB when it is pushed + // to the storage) + (location, xcm).encode().encode() + } + + pub fn make_complex_relayer_proofs( + lane_id: LaneId, + xcm_message: Xcm, + message_nonce: MessageNonce, + message_destination: Junctions, + para_header_number: u32, + relay_header_number: u32, + bridged_para_id: u32, + ) -> ( + BridgedRelayHeader, + GrandpaJustification, + ParaHead, + Vec<(ParaId, ParaHash)>, + ParaHeadsProof, + FromBridgedChainMessagesProof, + ) + where + BridgedRelayHeader: HeaderT, + ::Hash: From, + MB: MessageBridge, + ::BridgedChain: Send + Sync + 'static, + UnderlyingChainOf>: bp_runtime::Chain + Parachain, + { + let message_payload = prepare_inbound_xcm(xcm_message, message_destination); + let message_size = StorageProofSize::Minimal(message_payload.len() as u32); + // prepare para storage proof containing message + let (para_state_root, para_storage_proof) = prepare_messages_storage_proof::( + lane_id, + message_nonce..=message_nonce, + None, + message_size, + message_payload, + encode_all_messages, + encode_lane_data, + ); + + let bridged_para_head = ParaHead( + bp_test_utils::test_header_with_root::>( + para_header_number.into(), + para_state_root.into(), + ) + .encode(), + ); + let (relay_state_root, para_heads_proof, parachain_heads) = + prepare_parachain_heads_proof::>(vec![( + bridged_para_id, + bridged_para_head.clone(), + )]); + assert_eq!(bridged_para_head.hash(), parachain_heads[0].1); + + let message_proof = FromBridgedChainMessagesProof { + bridged_header_hash: bridged_para_head.hash(), + storage_proof: para_storage_proof, + lane: lane_id, + nonces_start: message_nonce, + nonces_end: message_nonce, + }; + + // import bridged relay chain block#1 with state root containing head#5 of bridged parachain + let relay_chain_header: BridgedRelayHeader = bp_test_utils::test_header_with_root( + relay_header_number.into(), + relay_state_root.into(), + ); + let justification = make_default_justification(&relay_chain_header); + ( + relay_chain_header, + justification, + bridged_para_head, + parachain_heads, + para_heads_proof, + message_proof, + ) + } + /// Helper that creates InitializationData mock data, that can be used to initialize bridge GRANDPA pallet - pub(crate) fn initialization_data< + pub fn initialization_data< Runtime: pallet_bridge_grandpa::Config, GrandpaPalletInstance: 'static, >( block_number: u32, - ) -> bp_header_chain::InitializationData< - pallet_bridge_grandpa::BridgedHeader, - > { + ) -> bp_header_chain::InitializationData> { bp_header_chain::InitializationData { header: Box::new(bp_test_utils::test_header(block_number.into())), - authority_list: Default::default(), - set_id: 6, - operating_mode: bp_runtime::BasicOperatingMode::Normal, + authority_list: authority_list(), + set_id: 1, + operating_mode: BasicOperatingMode::Normal, } } @@ -489,5 +974,3 @@ mod test_data { GRABBED_HAUL_BLOB_PAYLOAD.with(|r| r.take().expect("Encoded message should be here")) } } -// Re-export test_cases from assets -pub use asset_test_utils::{include_teleports_for_native_asset_works, CollatorSessionKeys}; diff --git a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml index 13fe985a63b..9ab4be51048 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml +++ b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml @@ -9,7 +9,7 @@ description = "Polkadot Collectives Parachain Runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs index 5056abb2e22..8ceb1c403b0 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs @@ -27,7 +27,7 @@ pub(crate) mod import_kusama_fellowship { #[cfg(feature = "try-runtime")] use sp_std::vec::Vec; - const TARGET: &'static str = "runtime::migration::import_fellowship"; + const TARGET: &str = "runtime::migration::import_fellowship"; parameter_types! { // The Fellowship addresses from Kusama state. @@ -90,11 +90,11 @@ pub(crate) mod import_kusama_fellowship { ::AccountId: From<[u8; 32]>, { #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { let onchain_version = RankedCollective::::on_chain_storage_version(); - assert_eq!(onchain_version, 0, "the storage version must be 0."); + ensure!(onchain_version == 0, "the storage version must be 0."); let member_count = MemberCount::::get(0); - assert_eq!(member_count, 0, "the collective must be uninitialized."); + ensure!(member_count == 0, "the collective must be uninitialized."); Ok(Vec::new()) } @@ -143,15 +143,15 @@ pub(crate) mod import_kusama_fellowship { } #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: Vec) -> Result<(), &'static str> { - assert_eq!(MemberCount::::get(0), 47, "invalid members count at rank 0."); - assert_eq!(MemberCount::::get(1), 47, "invalid members count at rank 1."); - assert_eq!(MemberCount::::get(2), 24, "invalid members count at rank 2."); - assert_eq!(MemberCount::::get(3), 17, "invalid members count at rank 3."); - assert_eq!(MemberCount::::get(4), 10, "invalid members count at rank 4."); - assert_eq!(MemberCount::::get(5), 7, "invalid members count at rank 5."); - assert_eq!(MemberCount::::get(6), 3, "invalid members count at rank 6."); - assert_eq!(MemberCount::::get(7), 0, "invalid members count at rank 7."); + fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::TryRuntimeError> { + ensure!(MemberCount::::get(0) == 47, "invalid members count at rank 0."); + ensure!(MemberCount::::get(1) == 47, "invalid members count at rank 1."); + ensure!(MemberCount::::get(2) == 24, "invalid members count at rank 2."); + ensure!(MemberCount::::get(3) == 17, "invalid members count at rank 3."); + ensure!(MemberCount::::get(4) == 10, "invalid members count at rank 4."); + ensure!(MemberCount::::get(5) == 7, "invalid members count at rank 5."); + ensure!(MemberCount::::get(6) == 3, "invalid members count at rank 6."); + ensure!(MemberCount::::get(7) == 0, "invalid members count at rank 7."); Ok(()) } } @@ -250,7 +250,7 @@ pub mod tests { assert!(IdToIndex::::get(0, &who).is_some()); assert!(IdToIndex::::get(rank + 1, &who).is_none()); let index = IdToIndex::::get(rank, &who).unwrap(); - assert_eq!(IndexToId::::get(rank, &index).unwrap(), who); + assert_eq!(IndexToId::::get(rank, index).unwrap(), who); assert_eq!( Members::::get(&who).unwrap(), MemberRecord::new(rank) diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs index 5d75bde9e18..1f728279485 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -54,7 +54,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -76,7 +76,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -98,7 +98,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -120,7 +120,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -142,7 +142,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -160,11 +160,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -182,11 +182,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -204,11 +204,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -226,11 +226,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -248,11 +248,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs index f70fb30bff7..3b45d2824d9 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs @@ -59,7 +59,7 @@ where let pallet_acc: AccountIdOf = PalletAccount::get(); let treasury_acc: AccountIdOf = TreasuryAccount::get(); - >::resolve_creating(&pallet_acc.clone(), amount); + >::resolve_creating(&pallet_acc, amount); let result = >::teleport_assets( <::RuntimeOrigin>::signed(pallet_acc.into()), @@ -73,10 +73,9 @@ where 0, ); - match result { - Err(err) => log::warn!("Failed to teleport slashed assets: {:?}", err), - _ => (), - }; + if let Err(err) = result { + log::warn!("Failed to teleport slashed assets: {:?}", err); + } } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index e0f95cb052b..3aed385e404 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -108,10 +108,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("collectives"), impl_name: create_runtime_str!("collectives"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 4, + transaction_version: 5, state_version: 0, }; @@ -208,7 +208,7 @@ impl pallet_balances::Config for Runtime { type WeightInfo = weights::pallet_balances::WeightInfo; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -216,7 +216,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -627,7 +627,12 @@ pub type UncheckedExtrinsic = pub type CheckedExtrinsic = generic::CheckedExtrinsic; // All migrations executed on runtime upgrade as a nested tuple of types implementing // `OnRuntimeUpgrade`. Included migrations must be idempotent. -type Migrations = import_kusama_fellowship::Migration; +type Migrations = ( + // v9420 + import_kusama_fellowship::Migration, + // unreleased + pallet_collator_selection::migration::v1::MigrateToV1, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -843,7 +848,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -899,7 +904,7 @@ impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { .create_inherent_data() .expect("Could not create the timestamp inherent data"); - inherent_data.check_extrinsics(&block) + inherent_data.check_extrinsics(block) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs index 0e7cf604304..6bbe4229967 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); @@ -51,11 +52,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_u32() -> Weight { // Proof Size summary in bytes: - // Measured: `76` - // Estimated: `1561` - // Minimum execution time: 5_477_000 picoseconds. - Weight::from_parts(5_623_000, 0) - .saturating_add(Weight::from_parts(0, 1561)) + // Measured: `109` + // Estimated: `1594` + // Minimum execution time: 5_475_000 picoseconds. + Weight::from_parts(5_752_000, 0) + .saturating_add(Weight::from_parts(0, 1594)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -63,11 +64,11 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn /// Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_weight() -> Weight { // Proof Size summary in bytes: - // Measured: `76` - // Estimated: `1561` - // Minimum execution time: 5_510_000 picoseconds. - Weight::from_parts(5_676_000, 0) - .saturating_add(Weight::from_parts(0, 1561)) + // Measured: `109` + // Estimated: `1594` + // Minimum execution time: 5_467_000 picoseconds. + Weight::from_parts(5_652_000, 0) + .saturating_add(Weight::from_parts(0, 1594)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/frame_system.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/frame_system.rs index 7bd018bd341..634757aa60b 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/frame_system.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/frame_system.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `frame_system`. pub struct WeightInfo(PhantomData); @@ -52,22 +53,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_300_000 picoseconds. - Weight::from_parts(2_345_000, 0) + // Minimum execution time: 2_326_000 picoseconds. + Weight::from_parts(2_387_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(370, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(413, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_053_000 picoseconds. - Weight::from_parts(8_155_000, 0) + // Minimum execution time: 7_797_000 picoseconds. + Weight::from_parts(7_933_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_414, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_455, 0).saturating_mul(b.into())) } /// Storage: System Digest (r:1 w:1) /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) @@ -77,12 +78,15 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 4_456_000 picoseconds. - Weight::from_parts(4_609_000, 0) + // Minimum execution time: 4_428_000 picoseconds. + Weight::from_parts(4_614_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } + fn set_code() -> Weight { + Weight::from_parts(1_000_000, 0) + } /// Storage: Skipped Metadata (r:0 w:0) /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. @@ -90,11 +94,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_370_000 picoseconds. - Weight::from_parts(2_403_000, 0) + // Minimum execution time: 2_429_000 picoseconds. + Weight::from_parts(2_469_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_643 - .saturating_add(Weight::from_parts(676_881, 0).saturating_mul(i.into())) + // Standard Error: 1_872 + .saturating_add(Weight::from_parts(671_478, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -104,11 +108,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_342_000 picoseconds. - Weight::from_parts(2_394_000, 0) + // Minimum execution time: 2_415_000 picoseconds. + Weight::from_parts(2_487_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 917 - .saturating_add(Weight::from_parts(502_661, 0).saturating_mul(i.into())) + // Standard Error: 923 + .saturating_add(Weight::from_parts(493_312, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: Skipped Metadata (r:0 w:0) @@ -116,13 +120,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `68 + p * (69 ±0)` - // Estimated: `69 + p * (70 ±0)` - // Minimum execution time: 4_461_000 picoseconds. - Weight::from_parts(4_561_000, 0) - .saturating_add(Weight::from_parts(0, 69)) - // Standard Error: 1_428 - .saturating_add(Weight::from_parts(1_016_381, 0).saturating_mul(p.into())) + // Measured: `82 + p * (69 ±0)` + // Estimated: `77 + p * (70 ±0)` + // Minimum execution time: 4_228_000 picoseconds. + Weight::from_parts(4_297_000, 0) + .saturating_add(Weight::from_parts(0, 77)) + // Standard Error: 1_145 + .saturating_add(Weight::from_parts(1_022_122, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_alliance.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_alliance.rs index f8bf9ca73dd..4ee8738d5af 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_alliance.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_alliance.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_alliance` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_alliance`. pub struct WeightInfo(PhantomData); @@ -63,20 +64,20 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `439 + m * (32 ±0) + p * (36 ±0)` - // Estimated: `14703 + m * (128 ±0) + p * (144 ±0)` - // Minimum execution time: 29_793_000 picoseconds. - Weight::from_parts(31_622_009, 0) - .saturating_add(Weight::from_parts(0, 14703)) - // Standard Error: 59 - .saturating_add(Weight::from_parts(194, 0).saturating_mul(b.into())) - // Standard Error: 626 - .saturating_add(Weight::from_parts(16_277, 0).saturating_mul(m.into())) - // Standard Error: 618 - .saturating_add(Weight::from_parts(115_342, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (32 ±0) + p * (36 ±0)` + // Minimum execution time: 30_492_000 picoseconds. + Weight::from_parts(33_119_713, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 60 + .saturating_add(Weight::from_parts(285, 0).saturating_mul(b.into())) + // Standard Error: 632 + .saturating_add(Weight::from_parts(10_988, 0).saturating_mul(m.into())) + // Standard Error: 624 + .saturating_add(Weight::from_parts(140_169, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(Weight::from_parts(0, 128).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 144).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -86,12 +87,12 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn vote(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `868 + m * (64 ±0)` - // Estimated: `11008 + m * (64 ±0)` - // Minimum execution time: 24_860_000 picoseconds. - Weight::from_parts(25_540_583, 0) - .saturating_add(Weight::from_parts(0, 11008)) - // Standard Error: 1_049 - .saturating_add(Weight::from_parts(44_450, 0).saturating_mul(m.into())) + // Estimated: `6676 + m * (64 ±0)` + // Minimum execution time: 25_442_000 picoseconds. + Weight::from_parts(26_215_947, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 410 + .saturating_add(Weight::from_parts(43_449, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) @@ -111,18 +112,18 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn close_early_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `312 + m * (96 ±0) + p * (36 ±0)` - // Estimated: `14519 + m * (388 ±0) + p * (144 ±0)` - // Minimum execution time: 35_120_000 picoseconds. - Weight::from_parts(33_274_472, 0) - .saturating_add(Weight::from_parts(0, 14519)) - // Standard Error: 1_030 - .saturating_add(Weight::from_parts(41_853, 0).saturating_mul(m.into())) - // Standard Error: 1_004 - .saturating_add(Weight::from_parts(111_626, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (97 ±0) + p * (36 ±0)` + // Minimum execution time: 35_991_000 picoseconds. + Weight::from_parts(34_605_748, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 598 + .saturating_add(Weight::from_parts(38_227, 0).saturating_mul(m.into())) + // Standard Error: 583 + .saturating_add(Weight::from_parts(119_512, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 388).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 144).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -140,18 +141,18 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn close_early_approved(_b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `762 + m * (96 ±0) + p * (41 ±0)` - // Estimated: `19732 + m * (388 ±0) + p * (160 ±0)` - // Minimum execution time: 47_135_000 picoseconds. - Weight::from_parts(42_191_348, 0) - .saturating_add(Weight::from_parts(0, 19732)) - // Standard Error: 4_449 - .saturating_add(Weight::from_parts(76_548, 0).saturating_mul(m.into())) - // Standard Error: 4_337 - .saturating_add(Weight::from_parts(143_406, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (97 ±0) + p * (40 ±0)` + // Minimum execution time: 48_168_000 picoseconds. + Weight::from_parts(48_554_161, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 1_770 + .saturating_add(Weight::from_parts(47_441, 0).saturating_mul(m.into())) + // Standard Error: 1_725 + .saturating_add(Weight::from_parts(119_704, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 388).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 160).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -172,18 +173,18 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn close_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `518 + m * (96 ±0) + p * (41 ±0)` - // Estimated: `19135 + m * (509 ±0) + p * (203 ±0)` - // Minimum execution time: 45_329_000 picoseconds. - Weight::from_parts(46_859_108, 0) - .saturating_add(Weight::from_parts(0, 19135)) - // Standard Error: 3_831 - .saturating_add(Weight::from_parts(100_587, 0).saturating_mul(m.into())) - // Standard Error: 3_785 - .saturating_add(Weight::from_parts(134_469, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (109 ±0) + p * (43 ±0)` + // Minimum execution time: 47_356_000 picoseconds. + Weight::from_parts(48_308_769, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 3_712 + .saturating_add(Weight::from_parts(99_809, 0).saturating_mul(m.into())) + // Standard Error: 3_667 + .saturating_add(Weight::from_parts(136_999, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(Weight::from_parts(0, 509).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 203).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 109).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 43).saturating_mul(p.into())) } /// Storage: Alliance Members (r:1 w:0) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -203,18 +204,18 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn close_approved(_b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `417 + m * (96 ±0) + p * (36 ±0)` - // Estimated: `16746 + m * (480 ±0) + p * (180 ±0)` - // Minimum execution time: 36_795_000 picoseconds. - Weight::from_parts(35_568_715, 0) - .saturating_add(Weight::from_parts(0, 16746)) - // Standard Error: 630 - .saturating_add(Weight::from_parts(42_253, 0).saturating_mul(m.into())) - // Standard Error: 607 - .saturating_add(Weight::from_parts(107_080, 0).saturating_mul(p.into())) + // Estimated: `6676 + m * (96 ±0) + p * (36 ±0)` + // Minimum execution time: 37_575_000 picoseconds. + Weight::from_parts(36_322_752, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 530 + .saturating_add(Weight::from_parts(38_879, 0).saturating_mul(m.into())) + // Standard Error: 511 + .saturating_add(Weight::from_parts(119_293, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 480).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 96).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: Alliance Members (r:2 w:2) /// Proof: Alliance Members (max_values: None, max_size: Some(3211), added: 5686, mode: MaxEncodedLen) @@ -225,14 +226,14 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn init_members(m: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `12` - // Estimated: `13859` - // Minimum execution time: 30_057_000 picoseconds. - Weight::from_parts(19_584_887, 0) - .saturating_add(Weight::from_parts(0, 13859)) - // Standard Error: 657 - .saturating_add(Weight::from_parts(127_220, 0).saturating_mul(m.into())) - // Standard Error: 649 - .saturating_add(Weight::from_parts(111_719, 0).saturating_mul(z.into())) + // Estimated: `12362` + // Minimum execution time: 31_194_000 picoseconds. + Weight::from_parts(19_730_185, 0) + .saturating_add(Weight::from_parts(0, 12362)) + // Standard Error: 589 + .saturating_add(Weight::from_parts(141_552, 0).saturating_mul(m.into())) + // Standard Error: 582 + .saturating_add(Weight::from_parts(118_056, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -254,25 +255,25 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn disband(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + x * (52 ±0) + y * (53 ±0) + z * (250 ±0)` - // Estimated: `35354 + x * (2590 ±0) + y * (2590 ±0) + z * (3104 ±1)` - // Minimum execution time: 257_465_000 picoseconds. - Weight::from_parts(258_993_000, 0) - .saturating_add(Weight::from_parts(0, 35354)) - // Standard Error: 22_094 - .saturating_add(Weight::from_parts(469_539, 0).saturating_mul(x.into())) - // Standard Error: 21_987 - .saturating_add(Weight::from_parts(478_507, 0).saturating_mul(y.into())) - // Standard Error: 43_935 - .saturating_add(Weight::from_parts(10_541_803, 0).saturating_mul(z.into())) + // Estimated: `12362 + x * (2539 ±0) + y * (2539 ±0) + z * (2603 ±1)` + // Minimum execution time: 262_149_000 picoseconds. + Weight::from_parts(263_057_000, 0) + .saturating_add(Weight::from_parts(0, 12362)) + // Standard Error: 21_165 + .saturating_add(Weight::from_parts(497_129, 0).saturating_mul(x.into())) + // Standard Error: 21_063 + .saturating_add(Weight::from_parts(478_945, 0).saturating_mul(y.into())) + // Standard Error: 42_088 + .saturating_add(Weight::from_parts(14_786_304, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(z.into()))) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(z.into()))) - .saturating_add(Weight::from_parts(0, 2590).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 2590).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 3104).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(z.into())) } /// Storage: Alliance Rule (r:0 w:1) /// Proof: Alliance Rule (max_values: Some(1), max_size: Some(87), added: 582, mode: MaxEncodedLen) @@ -280,8 +281,8 @@ impl pallet_alliance::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_973_000 picoseconds. - Weight::from_parts(10_247_000, 0) + // Minimum execution time: 10_181_000 picoseconds. + Weight::from_parts(10_320_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -291,8 +292,8 @@ impl pallet_alliance::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `76` // Estimated: `10187` - // Minimum execution time: 12_510_000 picoseconds. - Weight::from_parts(12_659_000, 0) + // Minimum execution time: 12_958_000 picoseconds. + Weight::from_parts(13_130_000, 0) .saturating_add(Weight::from_parts(0, 10187)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -303,8 +304,8 @@ impl pallet_alliance::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `149` // Estimated: `10187` - // Minimum execution time: 13_365_000 picoseconds. - Weight::from_parts(13_575_000, 0) + // Minimum execution time: 13_987_000 picoseconds. + Weight::from_parts(14_205_000, 0) .saturating_add(Weight::from_parts(0, 10187)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -320,10 +321,10 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn join_alliance() -> Weight { // Proof Size summary in bytes: // Measured: `294` - // Estimated: `26328` - // Minimum execution time: 40_044_000 picoseconds. - Weight::from_parts(41_623_000, 0) - .saturating_add(Weight::from_parts(0, 26328)) + // Estimated: `18048` + // Minimum execution time: 44_585_000 picoseconds. + Weight::from_parts(45_153_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -334,10 +335,10 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn nominate_ally() -> Weight { // Proof Size summary in bytes: // Measured: `193` - // Estimated: `22735` - // Minimum execution time: 28_166_000 picoseconds. - Weight::from_parts(28_756_000, 0) - .saturating_add(Weight::from_parts(0, 22735)) + // Estimated: `18048` + // Minimum execution time: 28_059_000 picoseconds. + Weight::from_parts(28_305_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -352,10 +353,10 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn elevate_ally() -> Weight { // Proof Size summary in bytes: // Measured: `236` - // Estimated: `14555` - // Minimum execution time: 25_759_000 picoseconds. - Weight::from_parts(26_083_000, 0) - .saturating_add(Weight::from_parts(0, 14555)) + // Estimated: `12362` + // Minimum execution time: 26_197_000 picoseconds. + Weight::from_parts(26_655_000, 0) + .saturating_add(Weight::from_parts(0, 12362)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -372,10 +373,10 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn give_retirement_notice() -> Weight { // Proof Size summary in bytes: // Measured: `236` - // Estimated: `25927` - // Minimum execution time: 32_603_000 picoseconds. - Weight::from_parts(33_091_000, 0) - .saturating_add(Weight::from_parts(0, 25927)) + // Estimated: `23734` + // Minimum execution time: 33_606_000 picoseconds. + Weight::from_parts(33_898_000, 0) + .saturating_add(Weight::from_parts(0, 23734)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -390,10 +391,10 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn retire() -> Weight { // Proof Size summary in bytes: // Measured: `517` - // Estimated: `17315` - // Minimum execution time: 36_169_000 picoseconds. - Weight::from_parts(36_746_000, 0) - .saturating_add(Weight::from_parts(0, 17315)) + // Estimated: `6676` + // Minimum execution time: 39_968_000 picoseconds. + Weight::from_parts(40_586_000, 0) + .saturating_add(Weight::from_parts(0, 6676)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -423,11 +424,11 @@ impl pallet_alliance::WeightInfo for WeightInfo { /// Proof Skipped: AllianceMotion Prime (max_values: Some(1), max_size: None, mode: Measured) fn kick_member() -> Weight { // Proof Size summary in bytes: - // Measured: `622` - // Estimated: `45128` - // Minimum execution time: 127_845_000 picoseconds. - Weight::from_parts(129_248_000, 0) - .saturating_add(Weight::from_parts(0, 45128)) + // Measured: `643` + // Estimated: `18048` + // Minimum execution time: 145_826_000 picoseconds. + Weight::from_parts(149_620_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) .saturating_add(T::DbWeight::get().reads(13)) .saturating_add(T::DbWeight::get().writes(8)) } @@ -440,14 +441,14 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `76` - // Estimated: `31874` - // Minimum execution time: 8_183_000 picoseconds. - Weight::from_parts(8_256_000, 0) - .saturating_add(Weight::from_parts(0, 31874)) - // Standard Error: 2_929 - .saturating_add(Weight::from_parts(1_444_558, 0).saturating_mul(n.into())) - // Standard Error: 1_147 - .saturating_add(Weight::from_parts(68_146, 0).saturating_mul(l.into())) + // Estimated: `27187` + // Minimum execution time: 8_490_000 picoseconds. + Weight::from_parts(8_557_000, 0) + .saturating_add(Weight::from_parts(0, 27187)) + // Standard Error: 3_473 + .saturating_add(Weight::from_parts(1_473_071, 0).saturating_mul(n.into())) + // Standard Error: 1_360 + .saturating_add(Weight::from_parts(75_402, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -459,15 +460,15 @@ impl pallet_alliance::WeightInfo for WeightInfo { /// The range of component `l` is `[0, 255]`. fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + n * (289 ±0) + l * (100 ±0)` - // Estimated: `31874` - // Minimum execution time: 7_982_000 picoseconds. - Weight::from_parts(8_084_000, 0) - .saturating_add(Weight::from_parts(0, 31874)) - // Standard Error: 185_716 - .saturating_add(Weight::from_parts(16_937_748, 0).saturating_mul(n.into())) - // Standard Error: 72_734 - .saturating_add(Weight::from_parts(291_993, 0).saturating_mul(l.into())) + // Measured: `0 + l * (100 ±0) + n * (289 ±0)` + // Estimated: `27187` + // Minimum execution time: 8_394_000 picoseconds. + Weight::from_parts(8_467_000, 0) + .saturating_add(Weight::from_parts(0, 27187)) + // Standard Error: 199_845 + .saturating_add(Weight::from_parts(17_213_927, 0).saturating_mul(n.into())) + // Standard Error: 78_268 + .saturating_add(Weight::from_parts(427_473, 0).saturating_mul(l.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -482,10 +483,10 @@ impl pallet_alliance::WeightInfo for WeightInfo { fn abdicate_fellow_status() -> Weight { // Proof Size summary in bytes: // Measured: `236` - // Estimated: `20241` - // Minimum execution time: 31_916_000 picoseconds. - Weight::from_parts(32_301_000, 0) - .saturating_add(Weight::from_parts(0, 20241)) + // Estimated: `18048` + // Minimum execution time: 32_255_000 picoseconds. + Weight::from_parts(32_787_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_balances.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_balances.rs index d36ba31bdb7..10b566b3f41 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_balances.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_balances.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); @@ -53,8 +54,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 35_300_000 picoseconds. - Weight::from_parts(35_618_000, 0) + // Minimum execution time: 53_490_000 picoseconds. + Weight::from_parts(54_270_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -65,8 +66,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 26_091_000 picoseconds. - Weight::from_parts(26_666_000, 0) + // Minimum execution time: 40_895_000 picoseconds. + Weight::from_parts(41_541_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -77,8 +78,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_271_000 picoseconds. - Weight::from_parts(15_835_000, 0) + // Minimum execution time: 16_009_000 picoseconds. + Weight::from_parts(16_345_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -89,8 +90,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 18_684_000 picoseconds. - Weight::from_parts(19_146_000, 0) + // Minimum execution time: 22_757_000 picoseconds. + Weight::from_parts(23_225_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +102,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 36_588_000 picoseconds. - Weight::from_parts(37_315_000, 0) + // Minimum execution time: 55_122_000 picoseconds. + Weight::from_parts(55_729_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -113,25 +114,38 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 32_278_000 picoseconds. - Weight::from_parts(32_546_000, 0) + // Minimum execution time: 49_979_000 picoseconds. + Weight::from_parts(50_677_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn upgrade_accounts(_: u32) -> Weight { - Weight::from_parts(0, 0) - } fn force_unreserve() -> Weight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_817_000 picoseconds. - Weight::from_parts(15_115_000, 0) + // Minimum execution time: 18_803_000 picoseconds. + Weight::from_parts(19_157_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// 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]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (136 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 18_508_000 picoseconds. + Weight::from_parts(18_773_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 9_864 + .saturating_add(Weight::from_parts(14_451_484, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs index fb14fb9f956..73961b722fa 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_collator_selection` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collator_selection`. pub struct WeightInfo(PhantomData); @@ -56,11 +57,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `178 + b * (78 ±0)` // Estimated: `1168 + b * (2554 ±0)` - // Minimum execution time: 14_884_000 picoseconds. - Weight::from_parts(14_947_157, 0) + // Minimum execution time: 15_467_000 picoseconds. + Weight::from_parts(15_103_183, 0) .saturating_add(Weight::from_parts(0, 1168)) - // Standard Error: 4_169 - .saturating_add(Weight::from_parts(2_615_559, 0).saturating_mul(b.into())) + // Standard Error: 2_853 + .saturating_add(Weight::from_parts(2_584_332, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) @@ -71,8 +72,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_057_000 picoseconds. - Weight::from_parts(7_226_000, 0) + // Minimum execution time: 7_562_000 picoseconds. + Weight::from_parts(7_765_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,8 +83,8 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_216_000 picoseconds. - Weight::from_parts(7_502_000, 0) + // Minimum execution time: 7_769_000 picoseconds. + Weight::from_parts(7_972_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -103,12 +104,12 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn register_as_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1108 + c * (48 ±0)` - // Estimated: `61671 + c * (49 ±0)` - // Minimum execution time: 38_806_000 picoseconds. - Weight::from_parts(31_477_823, 0) - .saturating_add(Weight::from_parts(0, 61671)) - // Standard Error: 1_220 - .saturating_add(Weight::from_parts(108_369, 0).saturating_mul(c.into())) + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 42_430_000 picoseconds. + Weight::from_parts(35_423_103, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_209 + .saturating_add(Weight::from_parts(114_362, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) @@ -122,11 +123,11 @@ impl pallet_collator_selection::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `452 + c * (48 ±0)` // Estimated: `49487` - // Minimum execution time: 29_463_000 picoseconds. - Weight::from_parts(19_105_316, 0) + // Minimum execution time: 33_827_000 picoseconds. + Weight::from_parts(24_290_370, 0) .saturating_add(Weight::from_parts(0, 49487)) - // Standard Error: 1_307 - .saturating_add(Weight::from_parts(106_299, 0).saturating_mul(c.into())) + // Standard Error: 1_249 + .saturating_add(Weight::from_parts(109_487, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,13 +140,46 @@ impl pallet_collator_selection::WeightInfo for WeightIn fn note_author() -> Weight { // Proof Size summary in bytes: // Measured: `103` - // Estimated: `7729` - // Minimum execution time: 28_319_000 picoseconds. - Weight::from_parts(28_880_000, 0) - .saturating_add(Weight::from_parts(0, 7729)) + // Estimated: `6196` + // Minimum execution time: 43_086_000 picoseconds. + Weight::from_parts(43_643_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// The range of component `b` is `[1, 99]`. + fn add_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `581 + b * (37 ±0)` + // Estimated: `4687 + b * (37 ±0)` + // Minimum execution time: 269_126_000 picoseconds. + Weight::from_parts(286_711_880, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 22_887 + .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + } + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `4687` + // Minimum execution time: 183_054_000 picoseconds. + Weight::from_parts(197_205_427, 0) + .saturating_add(Weight::from_parts(0, 4687)) + // Standard Error: 13_533 + .saturating_add(Weight::from_parts(376_231, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: CollatorSelection Candidates (r:1 w:0) /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(48002), added: 48497, mode: MaxEncodedLen) /// Storage: CollatorSelection LastAuthoredBlock (r:999 w:0) @@ -160,18 +194,18 @@ impl pallet_collator_selection::WeightInfo for WeightIn /// The range of component `c` is `[1, 1000]`. fn new_session(r: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `22721 + r * (116 ±0) + c * (97 ±0)` - // Estimated: `56697 + r * (2602 ±0) + c * (2520 ±0)` - // Minimum execution time: 17_111_000 picoseconds. - Weight::from_parts(17_332_000, 0) - .saturating_add(Weight::from_parts(0, 56697)) - // Standard Error: 800_597 - .saturating_add(Weight::from_parts(29_089_719, 0).saturating_mul(c.into())) + // Measured: `22721 + c * (97 ±0) + r * (116 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2602 ±0)` + // Minimum execution time: 17_338_000 picoseconds. + Weight::from_parts(17_589_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 906_988 + .saturating_add(Weight::from_parts(32_054_748, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 2602).saturating_mul(r.into())) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collective.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collective.rs index 5e7f67bea35..c4a71ec894a 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collective.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collective.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_collective` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_collective`. pub struct WeightInfo(PhantomData); @@ -61,20 +62,20 @@ impl pallet_collective::WeightInfo for WeightInfo { fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + m * (3232 ±0) + p * (3190 ±0)` - // Estimated: `18748 + m * (7799 ±23) + p * (10110 ±23)` - // Minimum execution time: 16_280_000 picoseconds. - Weight::from_parts(16_431_000, 0) - .saturating_add(Weight::from_parts(0, 18748)) - // Standard Error: 67_432 - .saturating_add(Weight::from_parts(5_382_109, 0).saturating_mul(m.into())) - // Standard Error: 67_432 - .saturating_add(Weight::from_parts(8_022_628, 0).saturating_mul(p.into())) + // Estimated: `15691 + m * (1967 ±23) + p * (4332 ±23)` + // Minimum execution time: 16_795_000 picoseconds. + Weight::from_parts(16_942_000, 0) + .saturating_add(Weight::from_parts(0, 15691)) + // Standard Error: 70_459 + .saturating_add(Weight::from_parts(5_607_397, 0).saturating_mul(m.into())) + // Standard Error: 70_459 + .saturating_add(Weight::from_parts(8_290_115, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 7799).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 10110).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1967).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 4332).saturating_mul(p.into())) } /// Storage: AllianceMotion Members (r:1 w:0) /// Proof Skipped: AllianceMotion Members (max_values: Some(1), max_size: None, mode: Measured) @@ -84,13 +85,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `32 + m * (32 ±0)` // Estimated: `1518 + m * (32 ±0)` - // Minimum execution time: 15_340_000 picoseconds. - Weight::from_parts(14_971_140, 0) + // Minimum execution time: 15_803_000 picoseconds. + Weight::from_parts(15_071_031, 0) .saturating_add(Weight::from_parts(0, 1518)) - // Standard Error: 24 - .saturating_add(Weight::from_parts(1_237, 0).saturating_mul(b.into())) - // Standard Error: 252 - .saturating_add(Weight::from_parts(13_257, 0).saturating_mul(m.into())) + // Standard Error: 21 + .saturating_add(Weight::from_parts(1_253, 0).saturating_mul(b.into())) + // Standard Error: 219 + .saturating_add(Weight::from_parts(13_241, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } @@ -103,16 +104,16 @@ impl pallet_collective::WeightInfo for WeightInfo { fn propose_execute(b: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `32 + m * (32 ±0)` - // Estimated: `5016 + m * (64 ±0)` - // Minimum execution time: 18_083_000 picoseconds. - Weight::from_parts(17_322_823, 0) - .saturating_add(Weight::from_parts(0, 5016)) - // Standard Error: 26 - .saturating_add(Weight::from_parts(1_248, 0).saturating_mul(b.into())) - // Standard Error: 272 - .saturating_add(Weight::from_parts(22_423, 0).saturating_mul(m.into())) + // Estimated: `3498 + m * (32 ±0)` + // Minimum execution time: 18_645_000 picoseconds. + Weight::from_parts(17_717_343, 0) + .saturating_add(Weight::from_parts(0, 3498)) + // Standard Error: 21 + .saturating_add(Weight::from_parts(1_471, 0).saturating_mul(b.into())) + // Standard Error: 218 + .saturating_add(Weight::from_parts(22_238, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } /// Storage: AllianceMotion Members (r:1 w:0) /// Proof Skipped: AllianceMotion Members (max_values: Some(1), max_size: None, mode: Measured) @@ -130,20 +131,20 @@ impl pallet_collective::WeightInfo for WeightInfo { fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `322 + m * (32 ±0) + p * (36 ±0)` - // Estimated: `9165 + m * (165 ±0) + p * (180 ±0)` - // Minimum execution time: 24_019_000 picoseconds. - Weight::from_parts(26_316_662, 0) - .saturating_add(Weight::from_parts(0, 9165)) - // Standard Error: 77 - .saturating_add(Weight::from_parts(2_166, 0).saturating_mul(b.into())) - // Standard Error: 810 - .saturating_add(Weight::from_parts(20_438, 0).saturating_mul(m.into())) - // Standard Error: 799 - .saturating_add(Weight::from_parts(122_504, 0).saturating_mul(p.into())) + // Estimated: `3714 + m * (33 ±0) + p * (36 ±0)` + // Minimum execution time: 24_537_000 picoseconds. + Weight::from_parts(26_471_602, 0) + .saturating_add(Weight::from_parts(0, 3714)) + // Standard Error: 79 + .saturating_add(Weight::from_parts(2_604, 0).saturating_mul(b.into())) + // Standard Error: 829 + .saturating_add(Weight::from_parts(20_480, 0).saturating_mul(m.into())) + // Standard Error: 818 + .saturating_add(Weight::from_parts(133_262, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(Weight::from_parts(0, 165).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 33).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: AllianceMotion Members (r:1 w:0) /// Proof Skipped: AllianceMotion Members (max_values: Some(1), max_size: None, mode: Measured) @@ -153,15 +154,15 @@ impl pallet_collective::WeightInfo for WeightInfo { fn vote(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `771 + m * (64 ±0)` - // Estimated: `6490 + m * (128 ±0)` - // Minimum execution time: 22_516_000 picoseconds. - Weight::from_parts(23_803_657, 0) - .saturating_add(Weight::from_parts(0, 6490)) - // Standard Error: 1_968 - .saturating_add(Weight::from_parts(38_988, 0).saturating_mul(m.into())) + // Estimated: `4235 + m * (64 ±0)` + // Minimum execution time: 23_195_000 picoseconds. + Weight::from_parts(23_635_543, 0) + .saturating_add(Weight::from_parts(0, 4235)) + // Standard Error: 399 + .saturating_add(Weight::from_parts(45_089, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 128).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) } /// Storage: AllianceMotion Voting (r:1 w:1) /// Proof Skipped: AllianceMotion Voting (max_values: None, max_size: None, mode: Measured) @@ -176,18 +177,18 @@ impl pallet_collective::WeightInfo for WeightInfo { fn close_early_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `360 + m * (64 ±0) + p * (36 ±0)` - // Estimated: `7795 + m * (260 ±0) + p * (144 ±0)` - // Minimum execution time: 26_841_000 picoseconds. - Weight::from_parts(28_166_692, 0) - .saturating_add(Weight::from_parts(0, 7795)) - // Standard Error: 657 - .saturating_add(Weight::from_parts(20_102, 0).saturating_mul(m.into())) - // Standard Error: 641 - .saturating_add(Weight::from_parts(113_841, 0).saturating_mul(p.into())) + // Estimated: `3805 + m * (65 ±0) + p * (36 ±0)` + // Minimum execution time: 27_925_000 picoseconds. + Weight::from_parts(29_021_838, 0) + .saturating_add(Weight::from_parts(0, 3805)) + // Standard Error: 582 + .saturating_add(Weight::from_parts(19_351, 0).saturating_mul(m.into())) + // Standard Error: 567 + .saturating_add(Weight::from_parts(120_374, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 260).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 144).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 65).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: AllianceMotion Voting (r:1 w:1) /// Proof Skipped: AllianceMotion Voting (max_values: None, max_size: None, mode: Measured) @@ -203,21 +204,21 @@ impl pallet_collective::WeightInfo for WeightInfo { fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `662 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` - // Estimated: `11956 + b * (4 ±0) + m * (264 ±0) + p * (160 ±0)` - // Minimum execution time: 38_310_000 picoseconds. - Weight::from_parts(40_050_347, 0) - .saturating_add(Weight::from_parts(0, 11956)) - // Standard Error: 84 - .saturating_add(Weight::from_parts(1_379, 0).saturating_mul(b.into())) - // Standard Error: 892 - .saturating_add(Weight::from_parts(13_153, 0).saturating_mul(m.into())) - // Standard Error: 870 - .saturating_add(Weight::from_parts(132_394, 0).saturating_mul(p.into())) + // Estimated: `3979 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 39_972_000 picoseconds. + Weight::from_parts(40_831_166, 0) + .saturating_add(Weight::from_parts(0, 3979)) + // Standard Error: 78 + .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(b.into())) + // Standard Error: 825 + .saturating_add(Weight::from_parts(16_454, 0).saturating_mul(m.into())) + // Standard Error: 804 + .saturating_add(Weight::from_parts(132_248, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 4).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 264).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 160).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: AllianceMotion Voting (r:1 w:1) /// Proof Skipped: AllianceMotion Voting (max_values: None, max_size: None, mode: Measured) @@ -234,18 +235,18 @@ impl pallet_collective::WeightInfo for WeightInfo { fn close_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `458 + m * (48 ±0) + p * (36 ±0)` - // Estimated: `10085 + m * (245 ±0) + p * (180 ±0)` - // Minimum execution time: 29_071_000 picoseconds. - Weight::from_parts(30_524_865, 0) - .saturating_add(Weight::from_parts(0, 10085)) - // Standard Error: 658 - .saturating_add(Weight::from_parts(18_125, 0).saturating_mul(m.into())) - // Standard Error: 641 - .saturating_add(Weight::from_parts(115_123, 0).saturating_mul(p.into())) + // Estimated: `3898 + m * (49 ±0) + p * (36 ±0)` + // Minimum execution time: 29_766_000 picoseconds. + Weight::from_parts(31_292_444, 0) + .saturating_add(Weight::from_parts(0, 3898)) + // Standard Error: 691 + .saturating_add(Weight::from_parts(19_285, 0).saturating_mul(m.into())) + // Standard Error: 674 + .saturating_add(Weight::from_parts(123_923, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 245).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 180).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) } /// Storage: AllianceMotion Voting (r:1 w:1) /// Proof Skipped: AllianceMotion Voting (max_values: None, max_size: None, mode: Measured) @@ -263,21 +264,21 @@ impl pallet_collective::WeightInfo for WeightInfo { fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `682 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` - // Estimated: `14055 + b * (5 ±0) + m * (330 ±0) + p * (200 ±0)` - // Minimum execution time: 40_932_000 picoseconds. - Weight::from_parts(42_564_375, 0) - .saturating_add(Weight::from_parts(0, 14055)) - // Standard Error: 91 - .saturating_add(Weight::from_parts(1_354, 0).saturating_mul(b.into())) - // Standard Error: 962 - .saturating_add(Weight::from_parts(14_498, 0).saturating_mul(m.into())) - // Standard Error: 937 - .saturating_add(Weight::from_parts(133_672, 0).saturating_mul(p.into())) + // Estimated: `3999 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 42_588_000 picoseconds. + Weight::from_parts(43_162_079, 0) + .saturating_add(Weight::from_parts(0, 3999)) + // Standard Error: 86 + .saturating_add(Weight::from_parts(1_451, 0).saturating_mul(b.into())) + // Standard Error: 914 + .saturating_add(Weight::from_parts(18_855, 0).saturating_mul(m.into())) + // Standard Error: 891 + .saturating_add(Weight::from_parts(136_799, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 5).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 330).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 200).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) } /// Storage: AllianceMotion Proposals (r:1 w:1) /// Proof Skipped: AllianceMotion Proposals (max_values: Some(1), max_size: None, mode: Measured) @@ -289,14 +290,14 @@ impl pallet_collective::WeightInfo for WeightInfo { fn disapprove_proposal(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `189 + p * (32 ±0)` - // Estimated: `2052 + p * (96 ±0)` - // Minimum execution time: 14_577_000 picoseconds. - Weight::from_parts(17_078_204, 0) - .saturating_add(Weight::from_parts(0, 2052)) - // Standard Error: 1_851 - .saturating_add(Weight::from_parts(96_610, 0).saturating_mul(p.into())) + // Estimated: `1674 + p * (32 ±0)` + // Minimum execution time: 14_465_000 picoseconds. + Weight::from_parts(16_635_197, 0) + .saturating_add(Weight::from_parts(0, 1674)) + // Standard Error: 1_082 + .saturating_add(Weight::from_parts(117_250, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(Weight::from_parts(0, 96).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_multisig.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_multisig.rs index 46e8b35ad17..92715ad62a9 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_multisig.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_multisig.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_multisig` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_multisig`. pub struct WeightInfo(PhantomData); @@ -52,11 +53,11 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_874_000 picoseconds. - Weight::from_parts(12_338_482, 0) + // Minimum execution time: 12_207_000 picoseconds. + Weight::from_parts(12_624_117, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(501, 0).saturating_mul(z.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(596, 0).saturating_mul(z.into())) } /// Storage: Multisig Multisigs (r:1 w:1) /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3346), added: 5821, mode: MaxEncodedLen) @@ -64,15 +65,15 @@ impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `z` is `[0, 10000]`. fn as_multi_create(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `262 + s * (2 ±0)` + // Measured: `295 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 37_113_000 picoseconds. - Weight::from_parts(31_650_752, 0) + // Minimum execution time: 41_674_000 picoseconds. + Weight::from_parts(35_138_837, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 685 - .saturating_add(Weight::from_parts(60_611, 0).saturating_mul(s.into())) - // Standard Error: 6 - .saturating_add(Weight::from_parts(1_223, 0).saturating_mul(z.into())) + // Standard Error: 426 + .saturating_add(Weight::from_parts(70_175, 0).saturating_mul(s.into())) + // Standard Error: 4 + .saturating_add(Weight::from_parts(1_321, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -82,15 +83,15 @@ impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `z` is `[0, 10000]`. fn as_multi_approve(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `282` + // Measured: `315` // Estimated: `6811` - // Minimum execution time: 27_063_000 picoseconds. - Weight::from_parts(21_745_286, 0) + // Minimum execution time: 28_196_000 picoseconds. + Weight::from_parts(22_060_677, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 540 - .saturating_add(Weight::from_parts(59_750, 0).saturating_mul(s.into())) - // Standard Error: 5 - .saturating_add(Weight::from_parts(1_199, 0).saturating_mul(z.into())) + // Standard Error: 378 + .saturating_add(Weight::from_parts(71_806, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_256, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -102,15 +103,15 @@ impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `z` is `[0, 10000]`. fn as_multi_complete(s: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `385 + s * (33 ±0)` - // Estimated: `10404` - // Minimum execution time: 41_635_000 picoseconds. - Weight::from_parts(35_205_750, 0) - .saturating_add(Weight::from_parts(0, 10404)) - // Standard Error: 614 - .saturating_add(Weight::from_parts(77_394, 0).saturating_mul(s.into())) - // Standard Error: 6 - .saturating_add(Weight::from_parts(1_194, 0).saturating_mul(z.into())) + // Measured: `418 + s * (33 ±0)` + // Estimated: `6811` + // Minimum execution time: 47_099_000 picoseconds. + Weight::from_parts(38_806_484, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 540 + .saturating_add(Weight::from_parts(88_311, 0).saturating_mul(s.into())) + // Standard Error: 5 + .saturating_add(Weight::from_parts(1_354, 0).saturating_mul(z.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -119,13 +120,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `s` is `[2, 100]`. fn approve_as_multi_create(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `263 + s * (2 ±0)` + // Measured: `296 + s * (2 ±0)` // Estimated: `6811` - // Minimum execution time: 28_179_000 picoseconds. - Weight::from_parts(29_964_208, 0) + // Minimum execution time: 31_899_000 picoseconds. + Weight::from_parts(33_492_356, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 692 - .saturating_add(Weight::from_parts(67_380, 0).saturating_mul(s.into())) + // Standard Error: 684 + .saturating_add(Weight::from_parts(79_819, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -134,13 +135,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `s` is `[2, 100]`. fn approve_as_multi_approve(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `282` + // Measured: `315` // Estimated: `6811` - // Minimum execution time: 18_604_000 picoseconds. - Weight::from_parts(20_059_859, 0) + // Minimum execution time: 19_002_000 picoseconds. + Weight::from_parts(20_275_891, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 1_469 - .saturating_add(Weight::from_parts(65_134, 0).saturating_mul(s.into())) + // Standard Error: 482 + .saturating_add(Weight::from_parts(68_692, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -149,13 +150,13 @@ impl pallet_multisig::WeightInfo for WeightInfo { /// The range of component `s` is `[2, 100]`. fn cancel_as_multi(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `454 + s * (1 ±0)` + // Measured: `487 + s * (1 ±0)` // Estimated: `6811` - // Minimum execution time: 28_438_000 picoseconds. - Weight::from_parts(30_815_747, 0) + // Minimum execution time: 32_841_000 picoseconds. + Weight::from_parts(34_782_386, 0) .saturating_add(Weight::from_parts(0, 6811)) - // Standard Error: 774 - .saturating_add(Weight::from_parts(67_365, 0).saturating_mul(s.into())) + // Standard Error: 656 + .saturating_add(Weight::from_parts(73_853, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_preimage.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_preimage.rs index 706568a5ff6..7c8fab57ede 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_preimage.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_preimage.rs @@ -1,32 +1,49 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `pallet_preimage` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-06, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `cob`, CPU: `` -//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/debug/polkadot-parachain +// ./artifacts/polkadot-parachain // benchmark // pallet // --chain=collectives-polkadot-dev -// --steps=2 -// --repeat=1 +// --execution=wasm +// --wasm-execution=compiled // --pallet=pallet_preimage // --extrinsic=* -// --execution=native -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_preimage.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_preimage`. pub struct WeightInfo(PhantomData); @@ -36,13 +53,15 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// 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 { + fn note_preimage(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `175` + // Measured: `143` // Estimated: `3556` - // Minimum execution time: 316_000_000 picoseconds. - Weight::from_parts(152_722_000_000, 0) + // Minimum execution time: 31_179_000 picoseconds. + Weight::from_parts(31_555_000, 0) .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 4 + .saturating_add(Weight::from_parts(2_116, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -51,13 +70,15 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// 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 { + fn note_requested_preimage(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 147_000_000 picoseconds. - Weight::from_parts(152_365_000_000, 0) + // Minimum execution time: 16_210_000 picoseconds. + Weight::from_parts(16_377_000, 0) .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 3 + .saturating_add(Weight::from_parts(2_089, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -66,13 +87,15 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// 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 { + fn note_no_deposit_preimage(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 145_000_000 picoseconds. - Weight::from_parts(152_298_000_000, 0) + // Minimum execution time: 15_441_000 picoseconds. + Weight::from_parts(15_607_000, 0) .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_072, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -82,10 +105,10 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn unnote_preimage() -> Weight { // Proof Size summary in bytes: - // Measured: `353` + // Measured: `289` // Estimated: `3556` - // Minimum execution time: 333_000_000 picoseconds. - Weight::from_parts(333_000_000, 0) + // Minimum execution time: 38_302_000 picoseconds. + Weight::from_parts(39_611_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -98,8 +121,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 202_000_000 picoseconds. - Weight::from_parts(202_000_000, 0) + // Minimum execution time: 21_163_000 picoseconds. + Weight::from_parts(22_013_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -108,10 +131,10 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_preimage() -> Weight { // Proof Size summary in bytes: - // Measured: `220` + // Measured: `188` // Estimated: `3556` - // Minimum execution time: 189_000_000 picoseconds. - Weight::from_parts(189_000_000, 0) + // Minimum execution time: 20_543_000 picoseconds. + Weight::from_parts(21_576_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -122,8 +145,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 137_000_000 picoseconds. - Weight::from_parts(137_000_000, 0) + // Minimum execution time: 11_317_000 picoseconds. + Weight::from_parts(11_834_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -134,8 +157,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3556` - // Minimum execution time: 140_000_000 picoseconds. - Weight::from_parts(140_000_000, 0) + // Minimum execution time: 13_495_000 picoseconds. + Weight::from_parts(13_897_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -146,8 +169,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 109_000_000 picoseconds. - Weight::from_parts(109_000_000, 0) + // Minimum execution time: 8_208_000 picoseconds. + Weight::from_parts(8_472_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -160,8 +183,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3556` - // Minimum execution time: 208_000_000 picoseconds. - Weight::from_parts(208_000_000, 0) + // Minimum execution time: 19_788_000 picoseconds. + Weight::from_parts(20_692_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -172,8 +195,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 117_000_000 picoseconds. - Weight::from_parts(117_000_000, 0) + // Minimum execution time: 7_792_000 picoseconds. + Weight::from_parts(8_113_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -184,8 +207,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3556` - // Minimum execution time: 107_000_000 picoseconds. - Weight::from_parts(107_000_000, 0) + // Minimum execution time: 7_869_000 picoseconds. + Weight::from_parts(8_164_000, 0) .saturating_add(Weight::from_parts(0, 3556)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_proxy.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_proxy.rs index 5c168e89d47..c5cb4f2e713 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_proxy.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_proxy.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_proxy`. pub struct WeightInfo(PhantomData); @@ -54,11 +55,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 16_370_000 picoseconds. - Weight::from_parts(17_099_234, 0) + // Minimum execution time: 16_925_000 picoseconds. + Weight::from_parts(17_434_407, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_021 - .saturating_add(Weight::from_parts(27_747, 0).saturating_mul(p.into())) + // Standard Error: 725 + .saturating_add(Weight::from_parts(35_067, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: Proxy Proxies (r:1 w:0) @@ -72,14 +73,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn proxy_announced(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `454 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 34_655_000 picoseconds. - Weight::from_parts(35_088_843, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 1_939 - .saturating_add(Weight::from_parts(146_356, 0).saturating_mul(a.into())) - // Standard Error: 2_004 - .saturating_add(Weight::from_parts(38_363, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 38_996_000 picoseconds. + Weight::from_parts(38_697_326, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_269 + .saturating_add(Weight::from_parts(143_716, 0).saturating_mul(a.into())) + // Standard Error: 1_312 + .saturating_add(Weight::from_parts(36_502, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -92,14 +93,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn remove_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 21_893_000 picoseconds. - Weight::from_parts(22_495_271, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 1_612 - .saturating_add(Weight::from_parts(149_480, 0).saturating_mul(a.into())) - // Standard Error: 1_665 - .saturating_add(Weight::from_parts(20_216, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_647_000 picoseconds. + Weight::from_parts(26_204_494, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_128 + .saturating_add(Weight::from_parts(137_913, 0).saturating_mul(a.into())) + // Standard Error: 1_166 + .saturating_add(Weight::from_parts(7_581, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -112,14 +113,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + a * (68 ±0)` - // Estimated: `9291` - // Minimum execution time: 22_129_000 picoseconds. - Weight::from_parts(22_971_862, 0) - .saturating_add(Weight::from_parts(0, 9291)) - // Standard Error: 1_324 - .saturating_add(Weight::from_parts(139_140, 0).saturating_mul(a.into())) - // Standard Error: 1_368 - .saturating_add(Weight::from_parts(9_720, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 25_508_000 picoseconds. + Weight::from_parts(26_110_626, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_155 + .saturating_add(Weight::from_parts(139_682, 0).saturating_mul(a.into())) + // Standard Error: 1_193 + .saturating_add(Weight::from_parts(8_390, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -134,14 +135,14 @@ impl pallet_proxy::WeightInfo for WeightInfo { fn announce(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `386 + a * (68 ±0) + p * (37 ±0)` - // Estimated: `13997` - // Minimum execution time: 30_496_000 picoseconds. - Weight::from_parts(31_777_493, 0) - .saturating_add(Weight::from_parts(0, 13997)) - // Standard Error: 2_153 - .saturating_add(Weight::from_parts(139_635, 0).saturating_mul(a.into())) - // Standard Error: 2_224 - .saturating_add(Weight::from_parts(36_392, 0).saturating_mul(p.into())) + // Estimated: `5698` + // Minimum execution time: 35_316_000 picoseconds. + Weight::from_parts(34_940_391, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_038 + .saturating_add(Weight::from_parts(143_848, 0).saturating_mul(a.into())) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(37_947, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -152,11 +153,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_465_000 picoseconds. - Weight::from_parts(24_342_756, 0) + // Minimum execution time: 26_890_000 picoseconds. + Weight::from_parts(27_454_486, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_559 - .saturating_add(Weight::from_parts(50_636, 0).saturating_mul(p.into())) + // Standard Error: 1_069 + .saturating_add(Weight::from_parts(50_270, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -167,11 +168,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 23_620_000 picoseconds. - Weight::from_parts(24_514_511, 0) + // Minimum execution time: 26_634_000 picoseconds. + Weight::from_parts(27_382_449, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_749 - .saturating_add(Weight::from_parts(47_870, 0).saturating_mul(p.into())) + // Standard Error: 1_573 + .saturating_add(Weight::from_parts(65_622, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -182,24 +183,26 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 18_506_000 picoseconds. - Weight::from_parts(19_463_396, 0) + // Minimum execution time: 23_582_000 picoseconds. + Weight::from_parts(23_977_985, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_241 - .saturating_add(Weight::from_parts(25_525, 0).saturating_mul(p.into())) + // Standard Error: 2_713 + .saturating_add(Weight::from_parts(44_551, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: Proxy Proxies (r:1 w:1) /// Proof: Proxy Proxies (max_values: None, max_size: Some(1241), added: 3716, mode: MaxEncodedLen) /// The range of component `p` is `[1, 31]`. - fn create_pure(_p: u32, ) -> Weight { + fn create_pure(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `139` // Estimated: `4706` - // Minimum execution time: 25_291_000 picoseconds. - Weight::from_parts(26_456_465, 0) + // Minimum execution time: 28_564_000 picoseconds. + Weight::from_parts(29_496_680, 0) .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 5_045 + .saturating_add(Weight::from_parts(29_343, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -210,11 +213,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `164 + p * (37 ±0)` // Estimated: `4706` - // Minimum execution time: 19_931_000 picoseconds. - Weight::from_parts(20_842_319, 0) + // Minimum execution time: 24_932_000 picoseconds. + Weight::from_parts(25_952_091, 0) .saturating_add(Weight::from_parts(0, 4706)) - // Standard Error: 1_467 - .saturating_add(Weight::from_parts(26_062, 0).saturating_mul(p.into())) + // Standard Error: 5_615 + .saturating_add(Weight::from_parts(22_027, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs index 4be551d4bd5..aed4994c49b 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs @@ -1,32 +1,49 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `pallet_ranked_collective` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-06, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `cob`, CPU: `` -//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/debug/polkadot-parachain +// ./artifacts/polkadot-parachain // benchmark // pallet // --chain=collectives-polkadot-dev -// --steps=2 -// --repeat=1 +// --execution=wasm +// --wasm-execution=compiled // --pallet=pallet_ranked_collective // --extrinsic=* -// --execution=native -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_ranked_collective`. pub struct WeightInfo(PhantomData); @@ -42,10 +59,10 @@ impl pallet_ranked_collective::WeightInfo for WeightInf fn add_member() -> Weight { // Proof Size summary in bytes: // Measured: `109` - // Estimated: `6986` - // Minimum execution time: 129_000_000 picoseconds. - Weight::from_parts(129_000_000, 0) - .saturating_add(Weight::from_parts(0, 6986)) + // Estimated: `3507` + // Minimum execution time: 16_966_000 picoseconds. + Weight::from_parts(17_355_000, 0) + .saturating_add(Weight::from_parts(0, 3507)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -58,15 +75,20 @@ impl pallet_ranked_collective::WeightInfo for WeightInf /// Storage: FellowshipCollective IndexToId (r:11 w:11) /// Proof: FellowshipCollective IndexToId (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) /// The range of component `r` is `[0, 10]`. - fn remove_member(_r: u32, ) -> Weight { + fn remove_member(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `575 + r * (281 ±0)` - // Estimated: `89494` - // Minimum execution time: 325_000_000 picoseconds. - Weight::from_parts(1_695_000_000, 0) - .saturating_add(Weight::from_parts(0, 89494)) - .saturating_add(T::DbWeight::get().reads(34)) - .saturating_add(T::DbWeight::get().writes(34)) + // Measured: `584 + r * (281 ±0)` + // Estimated: `3519 + r * (2529 ±0)` + // Minimum execution time: 28_160_000 picoseconds. + Weight::from_parts(30_609_588, 0) + .saturating_add(Weight::from_parts(0, 3519)) + // Standard Error: 25_389 + .saturating_add(Weight::from_parts(11_728_844, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2529).saturating_mul(r.into())) } /// Storage: FellowshipCollective Members (r:1 w:1) /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) @@ -77,13 +99,15 @@ impl pallet_ranked_collective::WeightInfo for WeightInf /// Storage: FellowshipCollective IdToIndex (r:0 w:1) /// Proof: FellowshipCollective IdToIndex (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) /// The range of component `r` is `[0, 10]`. - fn promote_member(_r: u32, ) -> Weight { + fn promote_member(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `277 + r * (17 ±0)` - // Estimated: `6986` - // Minimum execution time: 206_000_000 picoseconds. - Weight::from_parts(450_000_000, 0) - .saturating_add(Weight::from_parts(0, 6986)) + // Measured: `281 + r * (17 ±0)` + // Estimated: `3507` + // Minimum execution time: 20_058_000 picoseconds. + Weight::from_parts(20_751_832, 0) + .saturating_add(Weight::from_parts(0, 3507)) + // Standard Error: 3_745 + .saturating_add(Weight::from_parts(359_667, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -96,13 +120,15 @@ impl pallet_ranked_collective::WeightInfo for WeightInf /// Storage: FellowshipCollective IndexToId (r:1 w:1) /// Proof: FellowshipCollective IndexToId (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) /// The range of component `r` is `[0, 10]`. - fn demote_member(_r: u32, ) -> Weight { + fn demote_member(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `575 + r * (71 ±0)` - // Estimated: `14024` - // Minimum execution time: 309_000_000 picoseconds. - Weight::from_parts(449_000_000, 0) - .saturating_add(Weight::from_parts(0, 14024)) + // Measured: `599 + r * (72 ±0)` + // Estimated: `3519` + // Minimum execution time: 27_806_000 picoseconds. + Weight::from_parts(30_225_170, 0) + .saturating_add(Weight::from_parts(0, 3519)) + // Standard Error: 16_870 + .saturating_add(Weight::from_parts(608_652, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -116,11 +142,11 @@ impl pallet_ranked_collective::WeightInfo for WeightInf /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn vote() -> Weight { // Proof Size summary in bytes: - // Measured: `665` - // Estimated: `328970` - // Minimum execution time: 536_000_000 picoseconds. - Weight::from_parts(536_000_000, 0) - .saturating_add(Weight::from_parts(0, 328970)) + // Measured: `633` + // Estimated: `317568` + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(48_520_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -131,14 +157,18 @@ impl pallet_ranked_collective::WeightInfo for WeightInf /// Storage: FellowshipCollective Voting (r:100 w:100) /// Proof: FellowshipCollective Voting (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen) /// The range of component `n` is `[0, 100]`. - fn cleanup_poll(_n: u32, ) -> Weight { + fn cleanup_poll(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `308 + n * (52 ±0)` - // Estimated: `262934` - // Minimum execution time: 246_000_000 picoseconds. - Weight::from_parts(1_572_000_000, 0) - .saturating_add(Weight::from_parts(0, 262934)) - .saturating_add(T::DbWeight::get().reads(102)) - .saturating_add(T::DbWeight::get().writes(100)) + // Measured: `467 + n * (50 ±0)` + // Estimated: `4365 + n * (2540 ±0)` + // Minimum execution time: 15_426_000 picoseconds. + Weight::from_parts(19_278_701, 0) + .saturating_add(Weight::from_parts(0, 4365)) + // Standard Error: 1_274 + .saturating_add(Weight::from_parts(916_410, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .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, 2540).saturating_mul(n.into())) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs index 471aa55a767..b70c3017a38 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs @@ -1,32 +1,49 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `pallet_referenda` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-06, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `cob`, CPU: `` -//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/debug/polkadot-parachain +// ./artifacts/polkadot-parachain // benchmark // pallet // --chain=collectives-polkadot-dev -// --steps=2 -// --repeat=1 +// --execution=wasm +// --wasm-execution=compiled // --pallet=pallet_referenda // --extrinsic=* -// --execution=native -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_referenda`. pub struct WeightInfo(PhantomData); @@ -42,10 +59,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn submit() -> Weight { // Proof Size summary in bytes: // Measured: `322` - // Estimated: `164275` - // Minimum execution time: 283_000_000 picoseconds. - Weight::from_parts(283_000_000, 0) - .saturating_add(Weight::from_parts(0, 164275)) + // Estimated: `159279` + // Minimum execution time: 29_980_000 picoseconds. + Weight::from_parts(30_415_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -55,11 +72,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn place_decision_deposit_preparing() -> Weight { // Proof Size summary in bytes: - // Measured: `430` - // Estimated: `321933` - // Minimum execution time: 472_000_000 picoseconds. - Weight::from_parts(472_000_000, 0) - .saturating_add(Weight::from_parts(0, 321933)) + // Measured: `366` + // Estimated: `317568` + // Minimum execution time: 54_782_000 picoseconds. + Weight::from_parts(55_250_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -71,11 +88,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen) fn place_decision_deposit_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `1941` - // Estimated: `12121` - // Minimum execution time: 547_000_000 picoseconds. - Weight::from_parts(547_000_000, 0) - .saturating_add(Weight::from_parts(0, 12121)) + // Measured: `1845` + // Estimated: `4365` + // Minimum execution time: 68_580_000 picoseconds. + Weight::from_parts(69_745_000, 0) + .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -87,11 +104,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen) fn place_decision_deposit_not_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `1982` - // Estimated: `12121` - // Minimum execution time: 555_000_000 picoseconds. - Weight::from_parts(555_000_000, 0) - .saturating_add(Weight::from_parts(0, 12121)) + // Measured: `1886` + // Estimated: `4365` + // Minimum execution time: 66_900_000 picoseconds. + Weight::from_parts(69_144_000, 0) + .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -105,11 +122,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn place_decision_deposit_passing() -> Weight { // Proof Size summary in bytes: - // Measured: `833` - // Estimated: `328891` - // Minimum execution time: 871_000_000 picoseconds. - Weight::from_parts(871_000_000, 0) - .saturating_add(Weight::from_parts(0, 328891)) + // Measured: `769` + // Estimated: `317568` + // Minimum execution time: 125_600_000 picoseconds. + Weight::from_parts(129_568_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -121,11 +138,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) fn place_decision_deposit_failing() -> Weight { // Proof Size summary in bytes: - // Measured: `643` - // Estimated: `11323` - // Minimum execution time: 460_000_000 picoseconds. - Weight::from_parts(460_000_000, 0) - .saturating_add(Weight::from_parts(0, 11323)) + // Measured: `579` + // Estimated: `4365` + // Minimum execution time: 47_058_000 picoseconds. + Weight::from_parts(47_629_000, 0) + .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -133,10 +150,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen) fn refund_decision_deposit() -> Weight { // Proof Size summary in bytes: - // Measured: `381` + // Measured: `317` // Estimated: `4365` - // Minimum execution time: 281_000_000 picoseconds. - Weight::from_parts(281_000_000, 0) + // Minimum execution time: 32_565_000 picoseconds. + Weight::from_parts(32_857_000, 0) .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -145,10 +162,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen) fn refund_submission_deposit() -> Weight { // Proof Size summary in bytes: - // Measured: `199` + // Measured: `167` // Estimated: `4365` - // Minimum execution time: 172_000_000 picoseconds. - Weight::from_parts(172_000_000, 0) + // Minimum execution time: 16_655_000 picoseconds. + Weight::from_parts(16_980_000, 0) .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -159,11 +176,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn cancel() -> Weight { // Proof Size summary in bytes: - // Measured: `343` - // Estimated: `321933` - // Minimum execution time: 334_000_000 picoseconds. - Weight::from_parts(334_000_000, 0) - .saturating_add(Weight::from_parts(0, 321933)) + // Measured: `311` + // Estimated: `317568` + // Minimum execution time: 39_979_000 picoseconds. + Weight::from_parts(40_199_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -189,11 +206,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn kill() -> Weight { // Proof Size summary in bytes: - // Measured: `581` - // Estimated: `342842` - // Minimum execution time: 1_580_000_000 picoseconds. - Weight::from_parts(1_580_000_000, 0) - .saturating_add(Weight::from_parts(0, 342842)) + // Measured: `517` + // Estimated: `317568` + // Minimum execution time: 158_717_000 picoseconds. + Weight::from_parts(159_336_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(11)) .saturating_add(T::DbWeight::get().writes(6)) } @@ -204,10 +221,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn one_fewer_deciding_queue_empty() -> Weight { // Proof Size summary in bytes: // Measured: `140` - // Estimated: `7756` - // Minimum execution time: 203_000_000 picoseconds. - Weight::from_parts(203_000_000, 0) - .saturating_add(Weight::from_parts(0, 7756)) + // Estimated: `4277` + // Minimum execution time: 11_107_000 picoseconds. + Weight::from_parts(11_302_000, 0) + .saturating_add(Weight::from_parts(0, 4277)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -221,11 +238,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn one_fewer_deciding_failing() -> Weight { // Proof Size summary in bytes: - // Measured: `3991` - // Estimated: `329689` - // Minimum execution time: 1_025_000_000 picoseconds. - Weight::from_parts(1_025_000_000, 0) - .saturating_add(Weight::from_parts(0, 329689)) + // Measured: `3896` + // Estimated: `317568` + // Minimum execution time: 237_949_000 picoseconds. + Weight::from_parts(240_956_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -239,11 +256,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn one_fewer_deciding_passing() -> Weight { // Proof Size summary in bytes: - // Measured: `3991` - // Estimated: `329689` - // Minimum execution time: 1_076_000_000 picoseconds. - Weight::from_parts(1_076_000_000, 0) - .saturating_add(Weight::from_parts(0, 329689)) + // Measured: `3896` + // Estimated: `317568` + // Minimum execution time: 240_708_000 picoseconds. + Weight::from_parts(242_646_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -255,11 +272,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_requeued_insertion() -> Weight { // Proof Size summary in bytes: - // Measured: `3589` - // Estimated: `167921` - // Minimum execution time: 621_000_000 picoseconds. - Weight::from_parts(621_000_000, 0) - .saturating_add(Weight::from_parts(0, 167921)) + // Measured: `3494` + // Estimated: `159279` + // Minimum execution time: 136_435_000 picoseconds. + Weight::from_parts(138_673_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -271,11 +288,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_requeued_slide() -> Weight { // Proof Size summary in bytes: - // Measured: `3542` - // Estimated: `167921` - // Minimum execution time: 643_000_000 picoseconds. - Weight::from_parts(643_000_000, 0) - .saturating_add(Weight::from_parts(0, 167921)) + // Measured: `3447` + // Estimated: `159279` + // Minimum execution time: 136_686_000 picoseconds. + Weight::from_parts(137_969_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -289,11 +306,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `3528` - // Estimated: `171400` - // Minimum execution time: 704_000_000 picoseconds. - Weight::from_parts(704_000_000, 0) - .saturating_add(Weight::from_parts(0, 171400)) + // Measured: `3433` + // Estimated: `159279` + // Minimum execution time: 139_598_000 picoseconds. + Weight::from_parts(140_713_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -307,11 +324,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_not_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `3583` - // Estimated: `171400` - // Minimum execution time: 695_000_000 picoseconds. - Weight::from_parts(695_000_000, 0) - .saturating_add(Weight::from_parts(0, 171400)) + // Measured: `3488` + // Estimated: `159279` + // Minimum execution time: 139_149_000 picoseconds. + Weight::from_parts(140_033_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -321,11 +338,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_no_deposit() -> Weight { // Proof Size summary in bytes: - // Measured: `295` - // Estimated: `163644` - // Minimum execution time: 259_000_000 picoseconds. - Weight::from_parts(259_000_000, 0) - .saturating_add(Weight::from_parts(0, 163644)) + // Measured: `263` + // Estimated: `159279` + // Minimum execution time: 27_153_000 picoseconds. + Weight::from_parts(27_344_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -335,11 +352,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_preparing() -> Weight { // Proof Size summary in bytes: - // Measured: `343` - // Estimated: `163644` - // Minimum execution time: 260_000_000 picoseconds. - Weight::from_parts(260_000_000, 0) - .saturating_add(Weight::from_parts(0, 163644)) + // Measured: `311` + // Estimated: `159279` + // Minimum execution time: 27_327_000 picoseconds. + Weight::from_parts(27_886_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -347,10 +364,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen) fn nudge_referendum_timed_out() -> Weight { // Proof Size summary in bytes: - // Measured: `240` + // Measured: `208` // Estimated: `4365` - // Minimum execution time: 184_000_000 picoseconds. - Weight::from_parts(184_000_000, 0) + // Minimum execution time: 19_314_000 picoseconds. + Weight::from_parts(19_667_000, 0) .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -365,11 +382,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_begin_deciding_failing() -> Weight { // Proof Size summary in bytes: - // Measured: `611` - // Estimated: `170602` - // Minimum execution time: 445_000_000 picoseconds. - Weight::from_parts(445_000_000, 0) - .saturating_add(Weight::from_parts(0, 170602)) + // Measured: `579` + // Estimated: `159279` + // Minimum execution time: 39_377_000 picoseconds. + Weight::from_parts(39_742_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -383,11 +400,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_begin_deciding_passing() -> Weight { // Proof Size summary in bytes: - // Measured: `746` - // Estimated: `170602` - // Minimum execution time: 625_000_000 picoseconds. - Weight::from_parts(625_000_000, 0) - .saturating_add(Weight::from_parts(0, 170602)) + // Measured: `714` + // Estimated: `159279` + // Minimum execution time: 66_532_000 picoseconds. + Weight::from_parts(68_794_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -399,11 +416,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_begin_confirming() -> Weight { // Proof Size summary in bytes: - // Measured: `799` - // Estimated: `167123` - // Minimum execution time: 623_000_000 picoseconds. - Weight::from_parts(623_000_000, 0) - .saturating_add(Weight::from_parts(0, 167123)) + // Measured: `767` + // Estimated: `159279` + // Minimum execution time: 87_398_000 picoseconds. + Weight::from_parts(90_998_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -415,11 +432,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_end_confirming() -> Weight { // Proof Size summary in bytes: - // Measured: `782` - // Estimated: `167123` - // Minimum execution time: 580_000_000 picoseconds. - Weight::from_parts(580_000_000, 0) - .saturating_add(Weight::from_parts(0, 167123)) + // Measured: `750` + // Estimated: `159279` + // Minimum execution time: 87_401_000 picoseconds. + Weight::from_parts(90_985_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -431,11 +448,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_continue_not_confirming() -> Weight { // Proof Size summary in bytes: - // Measured: `799` - // Estimated: `167123` - // Minimum execution time: 595_000_000 picoseconds. - Weight::from_parts(595_000_000, 0) - .saturating_add(Weight::from_parts(0, 167123)) + // Measured: `767` + // Estimated: `159279` + // Minimum execution time: 82_591_000 picoseconds. + Weight::from_parts(86_670_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -447,11 +464,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_continue_confirming() -> Weight { // Proof Size summary in bytes: - // Measured: `803` - // Estimated: `167123` - // Minimum execution time: 556_000_000 picoseconds. - Weight::from_parts(556_000_000, 0) - .saturating_add(Weight::from_parts(0, 167123)) + // Measured: `771` + // Estimated: `159279` + // Minimum execution time: 55_759_000 picoseconds. + Weight::from_parts(58_177_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -465,11 +482,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// 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: `803` - // Estimated: `328925` - // Minimum execution time: 704_000_000 picoseconds. - Weight::from_parts(704_000_000, 0) - .saturating_add(Weight::from_parts(0, 328925)) + // Measured: `771` + // Estimated: `317568` + // Minimum execution time: 99_521_000 picoseconds. + Weight::from_parts(106_553_000, 0) + .saturating_add(Weight::from_parts(0, 317568)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -481,11 +498,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen) fn nudge_referendum_rejected() -> Weight { // Proof Size summary in bytes: - // Measured: `799` - // Estimated: `167123` - // Minimum execution time: 615_000_000 picoseconds. - Weight::from_parts(615_000_000, 0) - .saturating_add(Weight::from_parts(0, 167123)) + // Measured: `767` + // Estimated: `159279` + // Minimum execution time: 87_381_000 picoseconds. + Weight::from_parts(91_501_000, 0) + .saturating_add(Weight::from_parts(0, 159279)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -497,11 +514,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn set_some_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `384` - // Estimated: `7921` - // Minimum execution time: 262_000_000 picoseconds. - Weight::from_parts(262_000_000, 0) - .saturating_add(Weight::from_parts(0, 7921)) + // Measured: `352` + // Estimated: `4365` + // Minimum execution time: 22_378_000 picoseconds. + Weight::from_parts(22_631_000, 0) + .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -511,11 +528,11 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: FellowshipReferenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `317` - // Estimated: `7882` - // Minimum execution time: 223_000_000 picoseconds. - Weight::from_parts(223_000_000, 0) - .saturating_add(Weight::from_parts(0, 7882)) + // Measured: `285` + // Estimated: `4365` + // Minimum execution time: 20_116_000 picoseconds. + Weight::from_parts(20_255_000, 0) + .saturating_add(Weight::from_parts(0, 4365)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_scheduler.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_scheduler.rs index 3c0a5f5f2f2..f6f6954aca3 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_scheduler.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_scheduler.rs @@ -1,32 +1,49 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . //! Autogenerated weights for `pallet_scheduler` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `cob`, CPU: `` -//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot-parachain +// ./artifacts/polkadot-parachain // benchmark // pallet // --chain=collectives-polkadot-dev -// --steps=50 -// --repeat=20 +// --execution=wasm +// --wasm-execution=compiled // --pallet=pallet_scheduler // --extrinsic=* -// --execution=native -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_scheduler.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_scheduler`. pub struct WeightInfo(PhantomData); @@ -37,8 +54,8 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `31` // Estimated: `1489` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 3_399_000 picoseconds. + Weight::from_parts(3_512_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -48,13 +65,13 @@ impl pallet_scheduler::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 200]`. fn service_agenda_base(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `109 + s * (177 ±0)` + // Measured: `77 + s * (177 ±0)` // Estimated: `159279` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(6_554_632, 0) + // Minimum execution time: 2_846_000 picoseconds. + Weight::from_parts(4_715_748, 0) .saturating_add(Weight::from_parts(0, 159279)) - // Standard Error: 3_795 - .saturating_add(Weight::from_parts(293_040, 0).saturating_mul(s.into())) + // Standard Error: 2_743 + .saturating_add(Weight::from_parts(971_622, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -62,8 +79,8 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(2_000_000, 0) + // Minimum execution time: 5_940_000 picoseconds. + Weight::from_parts(6_087_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: Preimage PreimageFor (r:1 w:1) @@ -73,13 +90,13 @@ impl pallet_scheduler::WeightInfo for WeightInfo { /// The range of component `s` is `[128, 4194304]`. fn service_task_fetched(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `211 + s * (1 ±0)` - // Estimated: `7232 + s * (1 ±0)` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) - .saturating_add(Weight::from_parts(0, 7232)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(506, 0).saturating_mul(s.into())) + // Measured: `179 + s * (1 ±0)` + // Estimated: `3644 + s * (1 ±0)` + // Minimum execution time: 20_238_000 picoseconds. + Weight::from_parts(20_509_000, 0) + .saturating_add(Weight::from_parts(0, 3644)) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_271, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) @@ -90,8 +107,8 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 7_274_000 picoseconds. + Weight::from_parts(7_466_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -99,24 +116,24 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(2_000_000, 0) + // Minimum execution time: 5_886_000 picoseconds. + Weight::from_parts(6_035_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn execute_dispatch_signed() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_994_000 picoseconds. + Weight::from_parts(3_101_000, 0) .saturating_add(Weight::from_parts(0, 0)) } fn execute_dispatch_unsigned() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_983_000 picoseconds. + Weight::from_parts(3_095_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: Scheduler Agenda (r:1 w:1) @@ -124,13 +141,13 @@ impl pallet_scheduler::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 199]`. fn schedule(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `109 + s * (177 ±0)` + // Measured: `77 + s * (177 ±0)` // Estimated: `159279` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(10_397_360, 0) + // Minimum execution time: 12_851_000 picoseconds. + Weight::from_parts(14_995_788, 0) .saturating_add(Weight::from_parts(0, 159279)) - // Standard Error: 12_609 - .saturating_add(Weight::from_parts(342_422, 0).saturating_mul(s.into())) + // Standard Error: 3_056 + .saturating_add(Weight::from_parts(980_018, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -141,13 +158,13 @@ impl pallet_scheduler::WeightInfo for WeightInfo { /// The range of component `s` is `[1, 200]`. fn cancel(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `109 + s * (177 ±0)` + // Measured: `77 + s * (177 ±0)` // Estimated: `159279` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(24_399_340, 0) + // Minimum execution time: 17_805_000 picoseconds. + Weight::from_parts(16_078_257, 0) .saturating_add(Weight::from_parts(0, 159279)) - // Standard Error: 17_555 - .saturating_add(Weight::from_parts(480_590, 0).saturating_mul(s.into())) + // Standard Error: 3_216 + .saturating_add(Weight::from_parts(1_767_117, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -158,13 +175,13 @@ impl pallet_scheduler::WeightInfo for WeightInfo { /// The range of component `s` is `[0, 199]`. fn schedule_named(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `500 + s * (179 ±0)` - // Estimated: `162792` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(9_819_325, 0) - .saturating_add(Weight::from_parts(0, 162792)) - // Standard Error: 9_309 - .saturating_add(Weight::from_parts(365_629, 0).saturating_mul(s.into())) + // Measured: `468 + s * (179 ±0)` + // Estimated: `159279` + // Minimum execution time: 16_210_000 picoseconds. + Weight::from_parts(20_557_445, 0) + .saturating_add(Weight::from_parts(0, 159279)) + // Standard Error: 3_292 + .saturating_add(Weight::from_parts(992_281, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -175,13 +192,13 @@ impl pallet_scheduler::WeightInfo for WeightInfo { /// The range of component `s` is `[1, 200]`. fn cancel_named(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `541 + s * (179 ±0)` - // Estimated: `162792` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(19_693_473, 0) - .saturating_add(Weight::from_parts(0, 162792)) - // Standard Error: 17_961 - .saturating_add(Weight::from_parts(559_993, 0).saturating_mul(s.into())) + // Measured: `509 + s * (179 ±0)` + // Estimated: `159279` + // Minimum execution time: 19_976_000 picoseconds. + Weight::from_parts(19_613_223, 0) + .saturating_add(Weight::from_parts(0, 159279)) + // Standard Error: 2_988 + .saturating_add(Weight::from_parts(1_765_202, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_session.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_session.rs index 5c5f61d40b2..cb307d61e54 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_session.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_session.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn set_keys() -> Weight { // Proof Size summary in bytes: // Measured: `270` - // Estimated: `7470` - // Minimum execution time: 17_635_000 picoseconds. - Weight::from_parts(17_997_000, 0) - .saturating_add(Weight::from_parts(0, 7470)) + // Estimated: `3735` + // Minimum execution time: 17_505_000 picoseconds. + Weight::from_parts(17_789_000, 0) + .saturating_add(Weight::from_parts(0, 3735)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -68,10 +69,10 @@ impl pallet_session::WeightInfo for WeightInfo { fn purge_keys() -> Weight { // Proof Size summary in bytes: // Measured: `242` - // Estimated: `3949` - // Minimum execution time: 12_878_000 picoseconds. - Weight::from_parts(13_245_000, 0) - .saturating_add(Weight::from_parts(0, 3949)) + // Estimated: `3707` + // Minimum execution time: 12_686_000 picoseconds. + Weight::from_parts(12_960_000, 0) + .saturating_add(Weight::from_parts(0, 3707)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_timestamp.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_timestamp.rs index 5d0636e87d1..5b3bd10d3f1 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_timestamp.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_timestamp.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_timestamp`. pub struct WeightInfo(PhantomData); @@ -54,10 +55,10 @@ impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { // Proof Size summary in bytes: // Measured: `49` - // Estimated: `2986` - // Minimum execution time: 7_660_000 picoseconds. - Weight::from_parts(7_967_000, 0) - .saturating_add(Weight::from_parts(0, 2986)) + // Estimated: `1493` + // Minimum execution time: 8_048_000 picoseconds. + Weight::from_parts(8_313_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -65,8 +66,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `57` // Estimated: `0` - // Minimum execution time: 3_258_000 picoseconds. - Weight::from_parts(3_348_000, 0) + // Minimum execution time: 3_226_000 picoseconds. + Weight::from_parts(3_341_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_utility.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_utility.rs index 5ff7d46c142..6bec697194f 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_utility.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_utility.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_utility`. pub struct WeightInfo(PhantomData); @@ -52,18 +53,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_002_000 picoseconds. - Weight::from_parts(17_384_645, 0) + // Minimum execution time: 7_356_000 picoseconds. + Weight::from_parts(3_086_549, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_488 - .saturating_add(Weight::from_parts(4_736_077, 0).saturating_mul(c.into())) + // Standard Error: 3_625 + .saturating_add(Weight::from_parts(4_935_275, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_352_000 picoseconds. - Weight::from_parts(5_532_000, 0) + // Minimum execution time: 5_633_000 picoseconds. + Weight::from_parts(5_693_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -71,18 +72,18 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_030_000 picoseconds. - Weight::from_parts(18_968_785, 0) + // Minimum execution time: 7_312_000 picoseconds. + Weight::from_parts(3_780_731, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_112 - .saturating_add(Weight::from_parts(4_960_336, 0).saturating_mul(c.into())) + // Standard Error: 6_353 + .saturating_add(Weight::from_parts(5_289_295, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_703_000 picoseconds. - Weight::from_parts(10_012_000, 0) + // Minimum execution time: 9_811_000 picoseconds. + Weight::from_parts(10_039_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -90,10 +91,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_029_000 picoseconds. - Weight::from_parts(13_505_714, 0) + // Minimum execution time: 7_419_000 picoseconds. + Weight::from_parts(4_232_933, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_032 - .saturating_add(Weight::from_parts(4_709_262, 0).saturating_mul(c.into())) + // Standard Error: 3_419 + .saturating_add(Weight::from_parts(4_950_293, 0).saturating_mul(c.into())) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs index 43823d56560..ce00a1db94a 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 // Executed Command: @@ -40,9 +40,10 @@ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_xcm`. pub struct WeightInfo(PhantomData); @@ -59,11 +60,11 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn send() -> Weight { // Proof Size summary in bytes: - // Measured: `38` - // Estimated: `9595` - // Minimum execution time: 25_963_000 picoseconds. - Weight::from_parts(26_569_000, 0) - .saturating_add(Weight::from_parts(0, 9595)) + // Measured: `111` + // Estimated: `3576` + // Minimum execution time: 30_061_000 picoseconds. + Weight::from_parts(30_674_000, 0) + .saturating_add(Weight::from_parts(0, 3576)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -73,8 +74,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `32` // Estimated: `1489` - // Minimum execution time: 26_187_000 picoseconds. - Weight::from_parts(26_643_000, 0) + // Minimum execution time: 30_473_000 picoseconds. + Weight::from_parts(30_869_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -104,8 +105,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_755_000 picoseconds. - Weight::from_parts(10_010_000, 0) + // Minimum execution time: 10_720_000 picoseconds. + Weight::from_parts(10_836_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -115,8 +116,8 @@ impl pallet_xcm::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_994_000 picoseconds. - Weight::from_parts(3_125_000, 0) + // Minimum execution time: 3_284_000 picoseconds. + Weight::from_parts(3_349_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -138,11 +139,11 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn force_subscribe_version_notify() -> Weight { // Proof Size summary in bytes: - // Measured: `38` - // Estimated: `14659` - // Minimum execution time: 31_393_000 picoseconds. - Weight::from_parts(31_976_000, 0) - .saturating_add(Weight::from_parts(0, 14659)) + // Measured: `111` + // Estimated: `3576` + // Minimum execution time: 35_075_000 picoseconds. + Weight::from_parts(35_592_000, 0) + .saturating_add(Weight::from_parts(0, 3576)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -162,20 +163,22 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured) fn force_unsubscribe_version_notify() -> Weight { // Proof Size summary in bytes: - // Measured: `220` - // Estimated: `14410` - // Minimum execution time: 34_048_000 picoseconds. - Weight::from_parts(35_696_000, 0) - .saturating_add(Weight::from_parts(0, 14410)) + // Measured: `294` + // Estimated: `3759` + // Minimum execution time: 35_814_000 picoseconds. + Weight::from_parts(36_242_000, 0) + .saturating_add(Weight::from_parts(0, 3759)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: PolkadotXcm XcmExecutionSuspended (r:0 w:1) + /// Proof Skipped: PolkadotXcm XcmExecutionSuspended (max_values: Some(1), max_size: None, mode: Measured) fn force_suspension() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_994_000 picoseconds. - Weight::from_parts(3_125_000, 0) + // Minimum execution time: 3_199_000 picoseconds. + Weight::from_parts(3_444_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -183,11 +186,11 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { // Proof Size summary in bytes: - // Measured: `95` - // Estimated: `10985` - // Minimum execution time: 16_432_000 picoseconds. - Weight::from_parts(16_898_000, 0) - .saturating_add(Weight::from_parts(0, 10985)) + // Measured: `129` + // Estimated: `11019` + // Minimum execution time: 16_207_000 picoseconds. + Weight::from_parts(16_419_000, 0) + .saturating_add(Weight::from_parts(0, 11019)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -195,11 +198,11 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: PolkadotXcm VersionNotifiers (max_values: None, max_size: None, mode: Measured) fn migrate_version_notifiers() -> Weight { // Proof Size summary in bytes: - // Measured: `99` - // Estimated: `10989` - // Minimum execution time: 15_950_000 picoseconds. - Weight::from_parts(16_441_000, 0) - .saturating_add(Weight::from_parts(0, 10989)) + // Measured: `133` + // Estimated: `11023` + // Minimum execution time: 16_204_000 picoseconds. + Weight::from_parts(16_554_000, 0) + .saturating_add(Weight::from_parts(0, 11023)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -207,11 +210,11 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn already_notified_target() -> Weight { // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `13471` - // Minimum execution time: 16_585_000 picoseconds. - Weight::from_parts(16_939_000, 0) - .saturating_add(Weight::from_parts(0, 13471)) + // Measured: `140` + // Estimated: `13505` + // Minimum execution time: 16_935_000 picoseconds. + Weight::from_parts(17_263_000, 0) + .saturating_add(Weight::from_parts(0, 13505)) .saturating_add(T::DbWeight::get().reads(5)) } /// Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) @@ -228,11 +231,11 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn notify_current_targets() -> Weight { // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `15981` - // Minimum execution time: 30_278_000 picoseconds. - Weight::from_parts(30_676_000, 0) - .saturating_add(Weight::from_parts(0, 15981)) + // Measured: `178` + // Estimated: `6118` + // Minimum execution time: 31_462_000 picoseconds. + Weight::from_parts(32_095_000, 0) + .saturating_add(Weight::from_parts(0, 6118)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -240,22 +243,22 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn notify_target_migration_fail() -> Weight { // Proof Size summary in bytes: - // Measured: `136` - // Estimated: `8551` - // Minimum execution time: 8_923_000 picoseconds. - Weight::from_parts(9_257_000, 0) - .saturating_add(Weight::from_parts(0, 8551)) + // Measured: `172` + // Estimated: `8587` + // Minimum execution time: 8_664_000 picoseconds. + Weight::from_parts(8_835_000, 0) + .saturating_add(Weight::from_parts(0, 8587)) .saturating_add(T::DbWeight::get().reads(3)) } /// Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured) fn migrate_version_notify_targets() -> Weight { // Proof Size summary in bytes: - // Measured: `106` - // Estimated: `10996` - // Minimum execution time: 16_897_000 picoseconds. - Weight::from_parts(17_998_000, 0) - .saturating_add(Weight::from_parts(0, 10996)) + // Measured: `140` + // Estimated: `11030` + // Minimum execution time: 15_999_000 picoseconds. + Weight::from_parts(16_305_000, 0) + .saturating_add(Weight::from_parts(0, 11030)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -273,11 +276,11 @@ impl pallet_xcm::WeightInfo for WeightInfo { /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured) fn migrate_and_notify_old_targets() -> Weight { // Proof Size summary in bytes: - // Measured: `112` - // Estimated: `20967` - // Minimum execution time: 40_145_000 picoseconds. - Weight::from_parts(41_423_000, 0) - .saturating_add(Weight::from_parts(0, 20967)) + // Measured: `182` + // Estimated: `11072` + // Minimum execution time: 37_949_000 picoseconds. + Weight::from_parts(38_524_000, 0) + .saturating_add(Weight::from_parts(0, 11072)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs index b2b93d88ffe..406209a4a4c 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs @@ -24,19 +24,17 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::{ - impls::ToStakingPot, - xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, -}; +use parachains_common::{impls::ToStakingPot, xcm_config::ConcreteNativeAssetFrom}; use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FixedWeightBounds, IsConcrete, OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, + DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, + OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, + WithComputedOrigin, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -101,8 +99,11 @@ pub type XcmOriginToTransactDispatchOrigin = ( ); parameter_types! { - // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); + /// The amount of weight an XCM operation takes. This is a safe overestimate. + pub const BaseXcmWeight: Weight = Weight::from_parts(1_000_000_000, 1024); + /// A temporary weight value for each XCM instruction. + /// NOTE: This should be removed after we account for PoV weights. + pub const TempFixedXcmWeight: Weight = Weight::from_parts(1_000_000_000, 0); pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; // Fellows pluralistic body. @@ -137,58 +138,57 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::System( frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Alliance( - // `init_members` accepts unbounded vecs as arguments, - // but the call can be initiated only by root origin. - pallet_alliance::Call::init_members { .. } | - pallet_alliance::Call::vote { .. } | - pallet_alliance::Call::disband { .. } | - pallet_alliance::Call::set_rule { .. } | - pallet_alliance::Call::announce { .. } | - pallet_alliance::Call::remove_announcement { .. } | - pallet_alliance::Call::join_alliance { .. } | - pallet_alliance::Call::nominate_ally { .. } | - pallet_alliance::Call::elevate_ally { .. } | - pallet_alliance::Call::give_retirement_notice { .. } | - pallet_alliance::Call::retire { .. } | - pallet_alliance::Call::kick_member { .. } | - pallet_alliance::Call::close { .. } | - pallet_alliance::Call::abdicate_fellow_status { .. }, - ) | - RuntimeCall::AllianceMotion( + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. } | + pallet_collator_selection::Call::add_invulnerable { .. } | + pallet_collator_selection::Call::remove_invulnerable { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Alliance( + // `init_members` accepts unbounded vecs as arguments, + // but the call can be initiated only by root origin. + pallet_alliance::Call::init_members { .. } | + pallet_alliance::Call::vote { .. } | + pallet_alliance::Call::disband { .. } | + pallet_alliance::Call::set_rule { .. } | + pallet_alliance::Call::announce { .. } | + pallet_alliance::Call::remove_announcement { .. } | + pallet_alliance::Call::join_alliance { .. } | + pallet_alliance::Call::nominate_ally { .. } | + pallet_alliance::Call::elevate_ally { .. } | + pallet_alliance::Call::give_retirement_notice { .. } | + pallet_alliance::Call::retire { .. } | + pallet_alliance::Call::kick_member { .. } | + pallet_alliance::Call::close { .. } | + pallet_alliance::Call::abdicate_fellow_status { .. }, + ) | RuntimeCall::AllianceMotion( pallet_collective::Call::vote { .. } | - pallet_collective::Call::disapprove_proposal { .. } | - pallet_collective::Call::close { .. }, - ) | - RuntimeCall::FellowshipCollective( + pallet_collective::Call::disapprove_proposal { .. } | + pallet_collective::Call::close { .. }, + ) | RuntimeCall::FellowshipCollective( pallet_ranked_collective::Call::add_member { .. } | - pallet_ranked_collective::Call::promote_member { .. } | - pallet_ranked_collective::Call::demote_member { .. } | - pallet_ranked_collective::Call::remove_member { .. }, - ) => true, - _ => false, - } + pallet_ranked_collective::Call::promote_member { .. } | + pallet_ranked_collective::Call::demote_member { .. } | + pallet_ranked_collective::Call::remove_member { .. }, + ) + ) } } @@ -228,7 +228,7 @@ impl xcm_executor::Config for XcmConfig { type IsTeleporter = ConcreteNativeAssetFrom; type UniversalLocation = UniversalLocation; type Barrier = Barrier; - type Weigher = FixedWeightBounds; + type Weigher = FixedWeightBounds; type Trader = UsingComponents>; type ResponseHandler = PolkadotXcm; @@ -279,7 +279,7 @@ impl pallet_xcm::Config for Runtime { type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Nothing; // This parachain is not meant as a reserve location. - type Weigher = FixedWeightBounds; + type Weigher = FixedWeightBounds; type UniversalLocation = UniversalLocation; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; @@ -294,6 +294,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index 74186c0e53c..37996e29586 100644 --- a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -14,7 +14,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate @@ -142,6 +142,7 @@ runtime-benchmarks = [ "pallet-collator-selection/runtime-benchmarks", "pallet-contracts/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", diff --git a/parachains/runtimes/contracts/contracts-rococo/README.md b/parachains/runtimes/contracts/contracts-rococo/README.md index 973d84a14b8..e4f15ccf92d 100644 --- a/parachains/runtimes/contracts/contracts-rococo/README.md +++ b/parachains/runtimes/contracts/contracts-rococo/README.md @@ -45,7 +45,7 @@ To run a Contracts node that connects to Rococo you will need to compile the `polkadot-parachain` binary: ```bash -cargo build --release --locked -p polkadot-parachain +cargo build --release --locked --bin polkadot-parachain ``` Once the executable is built, launch the parachain node via: @@ -54,7 +54,7 @@ Once the executable is built, launch the parachain node via: ./target/release/polkadot-parachain --chain contracts-rococo ``` -Refer to the [setup instructions below](#local-setup) to run a local network for development. +Refer to the [setup instructions](https://github.com/paritytech/cumulus#manual-setup) to run a local network for development. ### Rococo Deployment @@ -70,8 +70,8 @@ Due to this you'll need `ROC` in order to deploy contracts on this parachain. As a first step, you should create an account. See [here](https://wiki.polkadot.network/docs/learn-account-generation) for a detailed guide. -As a second step, you have to get `ROC` testnet tokens through the [Rococo Faucet](https://wiki.polkadot.network/docs/learn-DOT#getting-rococo-tokens). -This is a chat room in which you need to write: +As a second step, you have to get `ROC` testnet tokens through the [Rococo Faucet](https://wiki.polkadot.network/docs/learn-DOT#obtaining-testnet-tokens). +This is a chat room in which you'd need to post the following message: ```bash !drip YOUR_SS_58_ADDRESS:1002 @@ -84,5 +84,5 @@ If everything worked out, the teleported `ROC` tokens will show up under [the "Accounts" tab](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-contracts-rpc.polkadot.io#/accounts). Once you have `ROC` you can deploy a contract as you would normally. -If you're unsure about this, our [guided tutorial](https://docs.substrate.io/tutorials/v3/ink-workshop/pt1/) +If you're unsure about this, our [guided tutorial](https://use.ink/getting-started/deploy-your-contract) will clarify that for you in no time. diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index adeee2b5229..d90c60990c4 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -94,10 +94,11 @@ pub type SignedExtra = ( /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; -pub type Migrations = (pallet_contracts::Migration,); +pub type Migrations = ( + pallet_contracts::Migration, + pallet_collator_selection::migration::v1::MigrateToV1, +); type EventRecord = frame_system::EventRecord< ::RuntimeEvent, @@ -125,7 +126,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("contracts-rococo"), impl_name: create_runtime_str!("contracts-rococo"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 6, @@ -215,7 +216,7 @@ impl pallet_balances::Config for Runtime { type WeightInfo = pallet_balances::weights::SubstrateWeight; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -327,6 +328,7 @@ impl pallet_collator_selection::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_sudo::weights::SubstrateWeight; } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -386,6 +388,7 @@ mod benches { [pallet_multisig, Multisig] [pallet_session, SessionBench::] [pallet_utility, Utility] + [pallet_sudo, Sudo] [pallet_timestamp, Timestamp] [pallet_collator_selection, CollatorSelection] [pallet_contracts, Contracts] @@ -639,7 +642,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( diff --git a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs index 1b42819b423..2f39cc6536d 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs @@ -24,16 +24,16 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough}; -use parachains_common::xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry}; use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FixedWeightBounds, IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, + DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, + NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, + WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::XcmExecutor; @@ -118,26 +118,28 @@ match_types! { }; } -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - // Allow XCMs with some computed origins to pass through. - WithComputedOrigin< - ( - // If the message is one that immediately attemps to pay for execution, then allow it. - AllowTopLevelPaidExecutionFrom, - // Parent and its pluralities (i.e. governance bodies) get free execution. - AllowExplicitUnpaidExecutionFrom, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - ), - UniversalLocation, - ConstU32<8>, - >, - ), +pub type Barrier = TrailingSetTopicAsId< + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its pluralities (i.e. governance bodies) get free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, + ), + >, >; pub struct XcmConfig; @@ -173,12 +175,12 @@ pub type LocalOriginToLocation = SignedToAccountId32, // ..and XCMP to communicate with the sibling chains. XcmpQueue, -); +)>; #[cfg(feature = "runtime-benchmarks")] parameter_types! { @@ -213,6 +215,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/glutton/glutton-kusama/Cargo.toml b/parachains/runtimes/glutton/glutton-kusama/Cargo.toml new file mode 100644 index 00000000000..bc502c116f3 --- /dev/null +++ b/parachains/runtimes/glutton/glutton-kusama/Cargo.toml @@ -0,0 +1,88 @@ +[package] +name = "glutton-runtime" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } + +# Substrate +frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } +frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } +frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } +pallet-glutton = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } +pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +# Polkadot +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +# Cumulus +cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false } +cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false } +cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false } +parachain-info = { path = "../../../pallets/parachain-info", default-features = false } +parachains-common = { path = "../../../common", default-features = false } + +[build-dependencies] +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } + +[features] +default = [ "std" ] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-glutton/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", +] +std = [ + "codec/std", + "scale-info/std", + "frame-executive/std", + "frame-support/std", + "frame-system/std", + "pallet-glutton/std", + "pallet-sudo/std", + "sp-api/std", + "sp-block-builder/std", + "sp-core/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-primitives-core/std", + "parachain-info/std", + "parachains-common/std", +] +try-runtime = [ + "frame-executive/try-runtime", + "frame-try-runtime/try-runtime", + "pallet-glutton/try-runtime", + "pallet-sudo/try-runtime", +] diff --git a/parachains/runtimes/glutton/glutton-kusama/build.rs b/parachains/runtimes/glutton/glutton-kusama/build.rs new file mode 100644 index 00000000000..9b53d2457df --- /dev/null +++ b/parachains/runtimes/glutton/glutton-kusama/build.rs @@ -0,0 +1,9 @@ +use substrate_wasm_builder::WasmBuilder; + +fn main() { + WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build() +} diff --git a/parachains/runtimes/glutton/glutton-kusama/src/lib.rs b/parachains/runtimes/glutton/glutton-kusama/src/lib.rs new file mode 100644 index 00000000000..073bd6c5751 --- /dev/null +++ b/parachains/runtimes/glutton/glutton-kusama/src/lib.rs @@ -0,0 +1,436 @@ +// Copyright (C) 2023 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. + +//! # Glutton Runtime +//! +//! The purpose of the Glutton parachain is to do stress testing on the Kusama +//! network. +//! +//! There may be multiple instances of the Glutton parachain deployed and +//! connected to Kusama. +//! +//! These parachains are not holding any real value. Their purpose is to stress +//! test the network. +//! +//! ### Governance +//! +//! Glutton defers its governance (namely, its `Root` origin), to its Relay +//! Chain parent, Kusama. +//! +//! ### XCM +//! +//! Since the main goal of Glutton is solely stress testing, the parachain will +//! only be able receive XCM messages from Kusama via DMP. This way the Glutton +//! parachains will be able to listen for upgrades that are coming from the +//! Relay chain. + +#![cfg_attr(not(feature = "std"), no_std)] +#![recursion_limit = "256"] + +// Make the WASM binary available. +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +pub mod weights; +pub mod xcm_config; + +use codec::{Decode, Encode}; +use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; +use frame_support::unsigned::TransactionValidityError; +use scale_info::TypeInfo; +use sp_api::impl_runtime_apis; +use sp_core::OpaqueMetadata; +use sp_runtime::{ + create_runtime_str, generic, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, DispatchInfoOf}, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, +}; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +pub use frame_support::{ + construct_runtime, + dispatch::DispatchClass, + parameter_types, + traits::{Everything, IsInVec, Randomness}, + weights::{ + constants::{ + BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND, + }, + IdentityFee, Weight, + }, + StorageValue, +}; +use frame_system::{ + limits::{BlockLength, BlockWeights}, + EnsureRoot, +}; +use parachains_common::{AccountId, Signature}; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +pub use sp_runtime::{Perbill, Permill}; + +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: create_runtime_str!("glutton"), + impl_name: create_runtime_str!("glutton"), + authoring_version: 1, + spec_version: 9430, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 1, + state_version: 1, +}; + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +} + +/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers. +/// This is used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used +/// by Operational extrinsics. +const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); +/// We allow for .5 seconds of compute with a 12 second average block time. +const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, +); + +parameter_types! { + pub const BlockHashCount: BlockNumber = 4096; + pub const Version: RuntimeVersion = VERSION; + pub RuntimeBlockLength: BlockLength = + BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder() + .base_block(BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have some extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); + pub const SS58Prefix: u8 = 2; +} + +impl frame_system::Config for Runtime { + type AccountId = AccountId; + type RuntimeCall = RuntimeCall; + type Lookup = AccountIdLookup; + type Index = Index; + type BlockNumber = BlockNumber; + type Hash = Hash; + type Hashing = BlakeTwo256; + type Header = generic::Header; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type BlockHashCount = BlockHashCount; + type Version = Version; + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type DbWeight = (); + type BaseCallFilter = frame_support::traits::Everything; + type SystemWeightInfo = (); + type BlockWeights = RuntimeBlockWeights; + type BlockLength = RuntimeBlockLength; + type SS58Prefix = SS58Prefix; + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +parameter_types! { + // We do anything the parent chain tells us in this runtime. + pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(2); +} + +impl cumulus_pallet_parachain_system::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OnSystemEvent = (); + type SelfParaId = parachain_info::Pallet; + type OutboundXcmpMessageSource = (); + type DmpMessageHandler = cumulus_pallet_xcm::UnlimitedDmpExecution; + type ReservedDmpWeight = ReservedDmpWeight; + type XcmpMessageHandler = (); + type ReservedXcmpWeight = (); + type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; +} + +impl parachain_info::Config for Runtime {} + +impl pallet_glutton::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_glutton::WeightInfo; + type AdminOrigin = EnsureRoot; +} + +impl pallet_sudo::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type WeightInfo = (); +} + +construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = generic::Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, + ParachainSystem: cumulus_pallet_parachain_system::{ + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + } = 1, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 2, + + // DMP handler. + CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event, Origin} = 10, + + // The main stage. + Glutton: pallet_glutton::{Pallet, Call, Storage, Event, Config} = 20, + + // Sudo. + Sudo: pallet_sudo::{Pallet, Call, Storage, Event, Config} = 255, + } +} + +/// Simple implementation which fails any transaction which is signed. +#[derive(Eq, PartialEq, Clone, Default, sp_core::RuntimeDebug, Encode, Decode, TypeInfo)] +pub struct DisallowSigned; +impl sp_runtime::traits::SignedExtension for DisallowSigned { + const IDENTIFIER: &'static str = "DisallowSigned"; + type AccountId = AccountId; + type Call = RuntimeCall; + type AdditionalSigned = (); + type Pre = (); + fn additional_signed( + &self, + ) -> sp_std::result::Result<(), sp_runtime::transaction_validity::TransactionValidityError> { + Ok(()) + } + fn pre_dispatch( + self, + who: &Self::AccountId, + call: &Self::Call, + info: &DispatchInfoOf, + len: usize, + ) -> Result { + self.validate(who, call, info, len).map(|_| ()) + } + fn validate( + &self, + _who: &Self::AccountId, + _call: &Self::Call, + _info: &sp_runtime::traits::DispatchInfoOf, + _len: usize, + ) -> TransactionValidity { + let i = sp_runtime::transaction_validity::InvalidTransaction::BadProof; + Err(sp_runtime::transaction_validity::TransactionValidityError::Invalid(i)) + } +} + +/// Index of a transaction in the chain. +pub type Index = u32; +/// A hash of some data used by the chain. +pub type Hash = sp_core::H256; +/// An index to a block. +pub type BlockNumber = u32; +/// The address format for describing accounts. +pub type Address = sp_runtime::MultiAddress; +/// Block header type as expected by this runtime. +pub type Header = generic::Header; +/// Block type as expected by this runtime. +pub type Block = generic::Block; +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; +/// BlockId type as expected by this runtime. +pub type BlockId = generic::BlockId; +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = DisallowSigned; +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; +/// Extrinsic type that has already been checked. +pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, +>; + +#[cfg(feature = "runtime-benchmarks")] +#[macro_use] +extern crate frame_benchmarking; + +#[cfg(feature = "runtime-benchmarks")] +mod benches { + define_benchmarks!( + [frame_system, SystemBench::] + [pallet_glutton, Glutton] + ); +} + +impl_runtime_apis! { + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> sp_std::vec::Vec { + Runtime::metadata_versions() + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic( + extrinsic: ::Extrinsic, + ) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents(block: Block, data: sp_inherents::InherentData) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn decode_session_keys(_: Vec) -> Option, sp_core::crypto::KeyTypeId)>> { + Some(Vec::new()) + } + + fn generate_session_keys(_: Option>) -> Vec { + Vec::new() + } + } + + impl cumulus_primitives_core::CollectCollationInfo for Runtime { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + ParachainSystem::collect_collation_info(header) + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + use frame_benchmarking::{Benchmarking, BenchmarkList}; + use frame_support::traits::StorageInfoTrait; + use frame_system_benchmarking::Pallet as SystemBench; + + let mut list = Vec::::new(); + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + + (list, storage_info) + } + + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, sp_runtime::RuntimeString> { + use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_system_benchmarking::Pallet as SystemBench; + impl frame_system_benchmarking::Config for Runtime {} + + use frame_support::traits::WhitelistedStorageKeys; + let whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + add_benchmarks!(params, batches); + Ok(batches) + } + } +} + +struct CheckInherents; + +impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { + fn check_inherents( + _: &Block, + _: &cumulus_pallet_parachain_system::RelayChainStateProof, + ) -> sp_inherents::CheckInherentsResult { + sp_inherents::CheckInherentsResult::new() + } +} + +cumulus_pallet_parachain_system::register_validate_block! { + Runtime = Runtime, + BlockExecutor = Executive, + CheckInherents = CheckInherents, +} diff --git a/parachains/runtimes/glutton/glutton-kusama/src/weights/mod.rs b/parachains/runtimes/glutton/glutton-kusama/src/weights/mod.rs new file mode 100644 index 00000000000..234ce34bf42 --- /dev/null +++ b/parachains/runtimes/glutton/glutton-kusama/src/weights/mod.rs @@ -0,0 +1 @@ +pub mod pallet_glutton; diff --git a/parachains/runtimes/glutton/glutton-kusama/src/weights/pallet_glutton.rs b/parachains/runtimes/glutton/glutton-kusama/src/weights/pallet_glutton.rs new file mode 100644 index 00000000000..991ec6f5336 --- /dev/null +++ b/parachains/runtimes/glutton/glutton-kusama/src/weights/pallet_glutton.rs @@ -0,0 +1,175 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `pallet_glutton` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("glutton-kusama-dev-1300"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_glutton +// --chain=glutton-kusama-dev-1300 +// --header=./file_header.txt +// --output=./parachains/runtimes/glutton/glutton-kusama/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_glutton`. +pub struct WeightInfo(PhantomData); +impl pallet_glutton::WeightInfo for WeightInfo { + /// Storage: Glutton TrashDataCount (r:1 w:1) + /// Proof: Glutton TrashDataCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Glutton TrashData (r:0 w:1000) + /// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen) + /// The range of component `n` is `[0, 1000]`. + fn initialize_pallet_grow(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6` + // Estimated: `1489` + // Minimum execution time: 7_874_000 picoseconds. + Weight::from_parts(7_943_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 1_822 + .saturating_add(Weight::from_parts(1_461_713, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// Storage: Glutton TrashDataCount (r:1 w:1) + /// Proof: Glutton TrashDataCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Glutton TrashData (r:0 w:1000) + /// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen) + /// The range of component `n` is `[0, 1000]`. + fn initialize_pallet_shrink(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `66` + // Estimated: `1489` + // Minimum execution time: 8_562_000 picoseconds. + Weight::from_parts(8_684_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + // Standard Error: 1_058 + .saturating_add(Weight::from_parts(951_263, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } + /// The range of component `i` is `[0, 100000]`. + fn waste_ref_time_iter(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 632_000 picoseconds. + Weight::from_parts(648_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 20 + .saturating_add(Weight::from_parts(95_703, 0).saturating_mul(i.into())) + } + /// Storage: Glutton TrashData (r:5000 w:0) + /// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen) + /// The range of component `i` is `[0, 5000]`. + fn waste_proof_size_some(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119037 + i * (1022 ±0)` + // Estimated: `990 + i * (3016 ±0)` + // Minimum execution time: 508_000 picoseconds. + Weight::from_parts(20_794_033, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 2_740 + .saturating_add(Weight::from_parts(5_120_718, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into())) + } + /// Storage: Glutton Storage (r:1 w:0) + /// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Glutton Compute (r:1 w:0) + /// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn on_idle_high_proof_waste() -> Weight { + // Proof Size summary in bytes: + // Measured: `89` + // Estimated: `1489` + // Minimum execution time: 92_266_435_000 picoseconds. + Weight::from_parts(92_887_511_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(2)) + } + /// Storage: Glutton Storage (r:1 w:0) + /// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Glutton Compute (r:1 w:0) + /// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn on_idle_low_proof_waste() -> Weight { + // Proof Size summary in bytes: + // Measured: `89` + // Estimated: `1489` + // Minimum execution time: 92_086_821_000 picoseconds. + Weight::from_parts(92_651_037_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(2)) + } + /// Storage: Glutton Storage (r:1 w:0) + /// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Glutton Compute (r:1 w:0) + /// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn empty_on_idle() -> Weight { + // Proof Size summary in bytes: + // Measured: `6` + // Estimated: `1489` + // Minimum execution time: 3_161_000 picoseconds. + Weight::from_parts(3_222_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(2)) + } + /// Storage: Glutton Compute (r:0 w:1) + /// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn set_compute() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_464_000 picoseconds. + Weight::from_parts(6_617_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Glutton Storage (r:0 w:1) + /// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn set_storage() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_510_000 picoseconds. + Weight::from_parts(6_641_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/parachains/runtimes/glutton/glutton-kusama/src/xcm_config.rs b/parachains/runtimes/glutton/glutton-kusama/src/xcm_config.rs new file mode 100644 index 00000000000..083ca592491 --- /dev/null +++ b/parachains/runtimes/glutton/glutton-kusama/src/xcm_config.rs @@ -0,0 +1,91 @@ +// Copyright (C) 2023 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 super::{ + AccountId, AllPalletsWithSystem, ParachainInfo, Runtime, RuntimeCall, RuntimeEvent, + RuntimeOrigin, +}; +use frame_support::{ + match_types, parameter_types, + traits::{Everything, Nothing}, + weights::Weight, +}; +use xcm::latest::prelude::*; +use xcm_builder::{ + AllowExplicitUnpaidExecutionFrom, FixedWeightBounds, ParentAsSuperuser, ParentIsPreset, + SovereignSignedViaLocation, +}; + +parameter_types! { + pub const KusamaLocation: MultiLocation = MultiLocation::parent(); + pub const KusamaNetwork: Option = Some(NetworkId::Kusama); + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into())); +} + +/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, +/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can +/// bias the kind of local `Origin` it will become. +pub type XcmOriginToTransactDispatchOrigin = ( + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, RuntimeOrigin>, + // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a + // transaction from the Root origin. + ParentAsSuperuser, +); + +match_types! { + pub type JustTheParent: impl Contains = { MultiLocation { parents:1, interior: Here } }; +} + +parameter_types! { + // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); + pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; +} + +pub struct XcmConfig; +impl xcm_executor::Config for XcmConfig { + type RuntimeCall = RuntimeCall; + type XcmSender = (); // sending XCM not supported + type AssetTransactor = (); // balances not supported + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type IsReserve = (); // balances not supported + type IsTeleporter = (); // balances not supported + type UniversalLocation = UniversalLocation; + type Barrier = AllowExplicitUnpaidExecutionFrom; + type Weigher = FixedWeightBounds; // balances not supported + type Trader = (); // balances not supported + type ResponseHandler = (); // Don't handle responses for now. + type AssetTrap = (); // don't trap for now + type AssetClaims = (); // don't claim for now + type SubscriptionService = (); // don't handle subscriptions for now + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; +} + +impl cumulus_pallet_xcm::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = xcm_executor::XcmExecutor; +} diff --git a/parachains/runtimes/starters/seedling/Cargo.toml b/parachains/runtimes/starters/seedling/Cargo.toml index 0a9e05d4bb4..ac81003f36f 100644 --- a/parachains/runtimes/starters/seedling/Cargo.toml +++ b/parachains/runtimes/starters/seedling/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/starters/seedling/src/lib.rs b/parachains/runtimes/starters/seedling/src/lib.rs index 2861cac1fe4..53179bad0e5 100644 --- a/parachains/runtimes/starters/seedling/src/lib.rs +++ b/parachains/runtimes/starters/seedling/src/lib.rs @@ -67,7 +67,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("seedling"), impl_name: create_runtime_str!("seedling"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 2, @@ -160,6 +160,7 @@ impl frame_system::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_sudo::weights::SubstrateWeight; } impl cumulus_pallet_solo_to_para::Config for Runtime { @@ -225,8 +226,6 @@ pub type SignedExtra = ( /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< diff --git a/parachains/runtimes/starters/shell/Cargo.toml b/parachains/runtimes/starters/shell/Cargo.toml index 7332ff8d012..670578b506a 100644 --- a/parachains/runtimes/starters/shell/Cargo.toml +++ b/parachains/runtimes/starters/shell/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/starters/shell/src/lib.rs b/parachains/runtimes/starters/shell/src/lib.rs index a05a78863c4..cbd9185b3bc 100644 --- a/parachains/runtimes/starters/shell/src/lib.rs +++ b/parachains/runtimes/starters/shell/src/lib.rs @@ -222,7 +222,7 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned { info: &DispatchInfoOf, len: usize, ) -> Result { - Ok(self.validate(who, call, info, len).map(|_| ())?) + self.validate(who, call, info, len).map(|_| ()) } fn validate( &self, @@ -257,8 +257,6 @@ pub type SignedExtra = DisallowSigned; /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, diff --git a/parachains/runtimes/test-utils/Cargo.toml b/parachains/runtimes/test-utils/Cargo.toml new file mode 100644 index 00000000000..2b8ee2fb322 --- /dev/null +++ b/parachains/runtimes/test-utils/Cargo.toml @@ -0,0 +1,74 @@ +[package] +name = "parachains-runtimes-test-utils" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Utils for Runtimes testing" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } + +# Substrate +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +# Cumulus +cumulus-pallet-parachain-system = { path = "../../../pallets/parachain-system", default-features = false } +cumulus-pallet-xcmp-queue = { path = "../../../pallets/xcmp-queue", default-features = false } +cumulus-pallet-dmp-queue = { path = "../../../pallets/dmp-queue", default-features = false } +pallet-collator-selection = { path = "../../../pallets/collator-selection", default-features = false } +parachains-common = { path = "../../common", default-features = false } +assets-common = { path = "../assets/common", default-features = false } +cumulus-primitives-core = { path = "../../../primitives/core", default-features = false } +cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent", default-features = false } +cumulus-test-relay-sproof-builder = { path = "../../../test/relay-sproof-builder", default-features = false } +parachain-info = { path = "../../../parachains/pallets/parachain-info", default-features = false } + +# Polkadot +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +[dev-dependencies] +hex-literal = "0.3.4" + +[build-dependencies] +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } + +[features] +default = [ "std" ] +std = [ + "cumulus-pallet-parachain-system/std", + "cumulus-primitives-core/std", + "cumulus-test-relay-sproof-builder/std", + "cumulus-primitives-parachain-inherent/std", + "frame-support/std", + "frame-system/std", + "pallet-assets/std", + "pallet-balances/std", + "cumulus-pallet-parachain-system/std", + "pallet-collator-selection/std", + "pallet-session/std", + "assets-common/std", + "parachains-common/std", + "parachain-info/std", + "polkadot-parachain/std", + "sp-consensus-aura/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", + "xcm/std", + "xcm-executor/std", + "pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-pallet-dmp-queue/std", +] diff --git a/parachains/runtimes/test-utils/src/lib.rs b/parachains/runtimes/test-utils/src/lib.rs new file mode 100644 index 00000000000..8ff85438b3f --- /dev/null +++ b/parachains/runtimes/test-utils/src/lib.rs @@ -0,0 +1,480 @@ +// 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 sp_std::marker::PhantomData; + +use codec::DecodeLimit; +use cumulus_primitives_core::{AbridgedHrmpChannel, ParaId, PersistedValidationData}; +use cumulus_primitives_parachain_inherent::ParachainInherentData; +use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; +use frame_support::{ + dispatch::{DispatchResult, RawOrigin, UnfilteredDispatchable}, + inherent::{InherentData, ProvideInherent}, + traits::{GenesisBuild, OriginTrait}, + weights::Weight, +}; +use parachains_common::AccountId; +use polkadot_parachain::primitives::{HrmpChannelId, RelayChainBlockNumber, XcmpMessageFormat}; +use sp_consensus_aura::AURA_ENGINE_ID; +use sp_core::Encode; +use sp_runtime::{Digest, DigestItem}; +use xcm::{ + latest::{MultiAsset, MultiLocation, XcmContext, XcmHash}, + prelude::*, + VersionedXcm, MAX_XCM_DECODE_DEPTH, +}; +use xcm_executor::{traits::TransactAsset, Assets}; + +pub type BalanceOf = ::Balance; +pub type AccountIdOf = ::AccountId; +pub type ValidatorIdOf = ::ValidatorId; +pub type SessionKeysOf = ::Keys; + +pub struct CollatorSessionKeys< + Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config, +> { + collator: AccountIdOf, + validator: ValidatorIdOf, + key: SessionKeysOf, +} + +impl + CollatorSessionKeys +{ + pub fn new( + collator: AccountIdOf, + validator: ValidatorIdOf, + key: SessionKeysOf, + ) -> Self { + Self { collator, validator, key } + } + pub fn collators(&self) -> Vec> { + vec![self.collator.clone()] + } + + pub fn session_keys( + &self, + ) -> Vec<(AccountIdOf, ValidatorIdOf, SessionKeysOf)> { + vec![(self.collator.clone(), self.validator.clone(), self.key.clone())] + } +} + +// Basic builder based on balances, collators and pallet_sessopm +pub struct ExtBuilder< + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config, +> { + // endowed accounts with balances + balances: Vec<(AccountIdOf, BalanceOf)>, + // collators to test block prod + collators: Vec>, + // keys added to pallet session + keys: Vec<(AccountIdOf, ValidatorIdOf, SessionKeysOf)>, + // safe xcm version for pallet_xcm + safe_xcm_version: Option, + // para id + para_id: Option, + _runtime: PhantomData, +} + +impl< + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config, + > Default for ExtBuilder +{ + fn default() -> ExtBuilder { + ExtBuilder { + balances: vec![], + collators: vec![], + keys: vec![], + safe_xcm_version: None, + para_id: None, + _runtime: PhantomData, + } + } +} + +impl< + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config, + > ExtBuilder +{ + pub fn with_balances( + mut self, + balances: Vec<(AccountIdOf, BalanceOf)>, + ) -> Self { + self.balances = balances; + self + } + pub fn with_collators(mut self, collators: Vec>) -> Self { + self.collators = collators; + self + } + + pub fn with_session_keys( + mut self, + keys: Vec<(AccountIdOf, ValidatorIdOf, SessionKeysOf)>, + ) -> Self { + self.keys = keys; + self + } + + pub fn with_tracing(self) -> Self { + frame_support::sp_tracing::try_init_simple(); + self + } + + pub fn with_safe_xcm_version(mut self, safe_xcm_version: XcmVersion) -> Self { + self.safe_xcm_version = Some(safe_xcm_version); + self + } + + pub fn with_para_id(mut self, para_id: ParaId) -> Self { + self.para_id = Some(para_id); + self + } + + pub fn build(self) -> sp_io::TestExternalities + where + Runtime: + pallet_collator_selection::Config + pallet_balances::Config + pallet_session::Config, + ValidatorIdOf: From>, + { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + >::assimilate_storage( + &pallet_xcm::GenesisConfig { safe_xcm_version: self.safe_xcm_version }, + &mut t, + ) + .unwrap(); + + if let Some(para_id) = self.para_id { + >::assimilate_storage( + ¶chain_info::GenesisConfig { parachain_id: para_id }, + &mut t, + ) + .unwrap(); + } + + pallet_balances::GenesisConfig:: { balances: self.balances } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_collator_selection::GenesisConfig:: { + invulnerables: self.collators.clone(), + candidacy_bond: Default::default(), + desired_candidates: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_session::GenesisConfig:: { keys: self.keys } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + + ext.execute_with(|| { + frame_system::Pallet::::set_block_number(1u32.into()); + }); + + ext + } +} + +pub struct RuntimeHelper(PhantomData); +/// Utility function that advances the chain to the desired block number. +/// If an author is provided, that author information is injected to all the blocks in the meantime. +impl RuntimeHelper +where + AccountIdOf: + Into<<::RuntimeOrigin as OriginTrait>::AccountId>, +{ + pub fn run_to_block(n: u32, author: Option) { + while frame_system::Pallet::::block_number() < n.into() { + // Set the new block number and author + match author { + Some(ref author) => { + let pre_digest = Digest { + logs: vec![DigestItem::PreRuntime(AURA_ENGINE_ID, author.encode())], + }; + frame_system::Pallet::::reset_events(); + frame_system::Pallet::::initialize( + &(frame_system::Pallet::::block_number() + 1u32.into()), + &frame_system::Pallet::::parent_hash(), + &pre_digest, + ); + }, + None => { + frame_system::Pallet::::set_block_number( + frame_system::Pallet::::block_number() + 1u32.into(), + ); + }, + } + } + } + + pub fn root_origin() -> ::RuntimeOrigin { + ::RuntimeOrigin::root() + } + + pub fn origin_of( + account_id: AccountIdOf, + ) -> ::RuntimeOrigin { + ::RuntimeOrigin::signed(account_id.into()) + } +} + +impl RuntimeHelper { + pub fn do_transfer( + from: MultiLocation, + to: MultiLocation, + (asset, amount): (MultiLocation, u128), + ) -> Result { + ::transfer_asset( + &MultiAsset { id: Concrete(asset), fun: Fungible(amount) }, + &from, + &to, + // We aren't able to track the XCM that initiated the fee deposit, so we create a + // fake message hash here + &XcmContext::with_message_id([0; 32]), + ) + } +} + +impl RuntimeHelper { + pub fn do_teleport_assets( + origin: ::RuntimeOrigin, + dest: MultiLocation, + beneficiary: MultiLocation, + (asset, amount): (MultiLocation, u128), + open_hrmp_channel: Option<(u32, u32)>, + ) -> DispatchResult + where + HrmpChannelOpener: frame_support::inherent::ProvideInherent< + Call = cumulus_pallet_parachain_system::Call, + >, + { + // open hrmp (if needed) + if let Some((source_para_id, target_para_id)) = open_hrmp_channel { + mock_open_hrmp_channel::( + source_para_id.into(), + target_para_id.into(), + ); + } + + // do teleport + >::teleport_assets( + origin, + Box::new(dest.into()), + Box::new(beneficiary.into()), + Box::new((Concrete(asset), amount).into()), + 0, + ) + } +} + +impl + RuntimeHelper +{ + pub fn execute_as_governance(call: Vec, require_weight_at_most: Weight) -> Outcome { + // prepare xcm as governance will do + let xcm = Xcm(vec![ + UnpaidExecution { weight_limit: Unlimited, check_origin: None }, + Transact { + origin_kind: OriginKind::Superuser, + require_weight_at_most, + call: call.into(), + }, + ]); + + // execute xcm as parent origin + let hash = xcm.using_encoded(sp_io::hashing::blake2_256); + <::XcmExecutor>::execute_xcm( + MultiLocation::parent(), + xcm, + hash, + Self::xcm_max_weight(XcmReceivedFrom::Parent), + ) + } +} + +pub enum XcmReceivedFrom { + Parent, + Sibling, +} + +impl RuntimeHelper { + pub fn xcm_max_weight(from: XcmReceivedFrom) -> Weight { + use frame_support::traits::Get; + match from { + XcmReceivedFrom::Parent => ParachainSystem::ReservedDmpWeight::get(), + XcmReceivedFrom::Sibling => ParachainSystem::ReservedXcmpWeight::get(), + } + } +} + +impl RuntimeHelper { + pub fn assert_pallet_xcm_event_outcome( + unwrap_pallet_xcm_event: &Box) -> Option>>, + assert_outcome: fn(Outcome), + ) { + let outcome = >::events() + .into_iter() + .filter_map(|e| unwrap_pallet_xcm_event(e.event.encode())) + .find_map(|e| match e { + pallet_xcm::Event::Attempted { outcome } => Some(outcome), + _ => None, + }) + .expect("No `pallet_xcm::Event::Attempted(outcome)` event found!"); + + assert_outcome(outcome); + } +} + +impl RuntimeHelper { + pub fn xcmp_queue_message_sent( + unwrap_xcmp_queue_event: Box< + dyn Fn(Vec) -> Option>, + >, + ) -> Option { + >::events() + .into_iter() + .filter_map(|e| unwrap_xcmp_queue_event(e.event.encode())) + .find_map(|e| match e { + cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { message_hash } => + Some(message_hash), + _ => None, + }) + } +} + +pub fn assert_metadata( + asset_id: impl Into + Copy, + expected_name: &str, + expected_symbol: &str, + expected_decimals: u8, +) where + Fungibles: frame_support::traits::tokens::fungibles::metadata::Inspect + + frame_support::traits::tokens::fungibles::Inspect, +{ + assert_eq!(Fungibles::name(asset_id.into()), Vec::from(expected_name),); + assert_eq!(Fungibles::symbol(asset_id.into()), Vec::from(expected_symbol),); + assert_eq!(Fungibles::decimals(asset_id.into()), expected_decimals); +} + +pub fn assert_total( + asset_id: impl Into + Copy, + expected_total_issuance: impl Into, + expected_active_issuance: impl Into, +) where + Fungibles: frame_support::traits::tokens::fungibles::metadata::Inspect + + frame_support::traits::tokens::fungibles::Inspect, +{ + assert_eq!(Fungibles::total_issuance(asset_id.into()), expected_total_issuance.into()); + assert_eq!(Fungibles::active_issuance(asset_id.into()), expected_active_issuance.into()); +} + +/// Helper function which emulates opening HRMP channel which is needed for `XcmpQueue` to pass +pub fn mock_open_hrmp_channel< + C: cumulus_pallet_parachain_system::Config, + T: ProvideInherent>, +>( + sender: ParaId, + recipient: ParaId, +) { + let n = 1_u32; + let mut sproof_builder = RelayStateSproofBuilder { + para_id: sender, + hrmp_egress_channel_index: Some(vec![recipient]), + ..Default::default() + }; + sproof_builder.hrmp_channels.insert( + HrmpChannelId { sender, recipient }, + AbridgedHrmpChannel { + max_capacity: 10, + max_total_size: 10_000_000_u32, + max_message_size: 10_000_000_u32, + msg_count: 0, + total_size: 0_u32, + mqc_head: None, + }, + ); + + let (relay_parent_storage_root, relay_chain_state) = sproof_builder.into_state_root_and_proof(); + let vfp = PersistedValidationData { + relay_parent_number: n as RelayChainBlockNumber, + relay_parent_storage_root, + ..Default::default() + }; + // It is insufficient to push the validation function params + // to storage; they must also be included in the inherent data. + let inherent_data = { + let mut inherent_data = InherentData::default(); + let system_inherent_data = ParachainInherentData { + validation_data: vfp, + relay_chain_state, + downward_messages: Default::default(), + horizontal_messages: Default::default(), + }; + inherent_data + .put_data( + cumulus_primitives_parachain_inherent::INHERENT_IDENTIFIER, + &system_inherent_data, + ) + .expect("failed to put VFP inherent"); + inherent_data + }; + + // execute the block + T::create_inherent(&inherent_data) + .expect("got an inherent") + .dispatch_bypass_filter(RawOrigin::None.into()) + .expect("dispatch succeeded"); +} + +impl + RuntimeHelper +{ + pub fn take_xcm(sent_to_para_id: ParaId) -> Option> { + match HrmpChannelSource::take_outbound_messages(10)[..] { + [(para_id, ref mut xcm_message_data)] if para_id.eq(&sent_to_para_id.into()) => { + let mut xcm_message_data = &xcm_message_data[..]; + // decode + let _ = XcmpMessageFormat::decode_with_depth_limit( + MAX_XCM_DECODE_DEPTH, + &mut xcm_message_data, + ) + .expect("valid format"); + VersionedXcm::<()>::decode_with_depth_limit( + MAX_XCM_DECODE_DEPTH, + &mut xcm_message_data, + ) + .map(|x| Some(x)) + .expect("result with xcm") + }, + _ => return None, + } + } +} diff --git a/parachains/runtimes/testing/penpal/Cargo.toml b/parachains/runtimes/testing/penpal/Cargo.toml index 2886d799a4c..679a252c362 100644 --- a/parachains/runtimes/testing/penpal/Cargo.toml +++ b/parachains/runtimes/testing/penpal/Cargo.toml @@ -18,7 +18,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.16", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate @@ -136,6 +136,7 @@ runtime-benchmarks = [ "pallet-assets/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index 7ade3bd2f63..8ba89c803ce 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -123,11 +123,10 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; - -pub type Migrations = - (pallet_balances::migration::MigrateToTrackInactive,); +pub type Migrations = ( + pallet_balances::migration::MigrateToTrackInactive, + pallet_collator_selection::migration::v1::MigrateToV1, +); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -224,7 +223,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("penpal-parachain"), impl_name: create_runtime_str!("penpal-parachain"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -387,7 +386,7 @@ impl pallet_balances::Config for Runtime { type WeightInfo = pallet_balances::weights::SubstrateWeight; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -547,6 +546,7 @@ impl pallet_asset_tx_payment::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; + type WeightInfo = pallet_sudo::weights::SubstrateWeight; } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -599,6 +599,7 @@ mod benches { [frame_system, SystemBench::] [pallet_balances, Balances] [pallet_session, SessionBench::] + [pallet_sudo, Sudo] [pallet_timestamp, Timestamp] [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] @@ -783,7 +784,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( diff --git a/parachains/runtimes/testing/penpal/src/xcm_config.rs b/parachains/runtimes/testing/penpal/src/xcm_config.rs index 89cfc2ced65..d005cc664a3 100644 --- a/parachains/runtimes/testing/penpal/src/xcm_config.rs +++ b/parachains/runtimes/testing/penpal/src/xcm_config.rs @@ -38,7 +38,6 @@ use frame_support::{ use frame_system::EnsureRoot; use pallet_asset_tx_payment::HandleCredit; use pallet_xcm::XcmPassthrough; -use parachains_common::xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry}; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; use sp_runtime::traits::Zero; @@ -46,11 +45,11 @@ use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex, - ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, - IsConcrete, LocalMint, NativeAsset, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WithComputedOrigin, + ConvertedConcreteId, CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, + EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, IsConcrete, LocalMint, NativeAsset, + ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::{traits::JustTry, XcmExecutor}; @@ -120,7 +119,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // foreign chains who want to have a local sovereign account on this chain which they control. SovereignSignedViaLocation, - // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when // recognized. RelayChainAsNative, // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when @@ -150,29 +149,31 @@ match_types! { }; } -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - // Allow XCMs with some computed origins to pass through. - WithComputedOrigin< - ( - // If the message is one that immediately attemps to pay for execution, then allow it. - AllowTopLevelPaidExecutionFrom, - // Common Good Assets parachain, parent and its exec plurality get free execution - AllowExplicitUnpaidExecutionFrom<( - CommonGoodAssetsParachain, - ParentOrParentsExecutivePlurality, - )>, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - ), - UniversalLocation, - ConstU32<8>, - >, - ), +pub type Barrier = TrailingSetTopicAsId< + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Common Good Assets parachain, parent and its exec plurality get free execution + AllowExplicitUnpaidExecutionFrom<( + CommonGoodAssetsParachain, + ParentOrParentsExecutivePlurality, + )>, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, + ), + >, >; /// Type alias to conveniently refer to `frame_system`'s `Config::AccountId`. @@ -197,7 +198,7 @@ where Assets: fungibles::Inspect, { fn contains(id: &>::AssetId) -> bool { - !Assets::total_issuance(*id).is_zero() + !Assets::total_issuance(id.clone()).is_zero() } } @@ -225,12 +226,12 @@ pub trait Reserve { // Takes the chain part of a MultiAsset impl Reserve for MultiAsset { fn reserve(&self) -> Option { - if let AssetId::Concrete(location) = self.id.clone() { + if let AssetId::Concrete(location) = self.id { let first_interior = location.first_interior(); let parents = location.parent_count(); - match (parents, first_interior.clone()) { - (0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(id.clone())))), - (1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(id.clone())))), + match (parents, first_interior) { + (0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(*id)))), + (1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(*id)))), (1, _) => Some(MultiLocation::parent()), _ => None, } @@ -299,12 +300,12 @@ pub type LocalOriginToLocation = SignedToAccountId32, // ..and XCMP to communicate with the sibling chains. XcmpQueue, -); +)>; #[cfg(feature = "runtime-benchmarks")] parameter_types! { @@ -339,6 +340,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/parachains/runtimes/testing/rococo-parachain/Cargo.toml index 9b3f993bb77..e5f567cbbf4 100644 --- a/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -7,7 +7,7 @@ description = "Simple runtime used by the rococo parachain(s)" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 1a26290f2a3..3060093b532 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -101,7 +101,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("test-parachain"), impl_name: create_runtime_str!("test-parachain"), authoring_version: 1, - spec_version: 9400, + spec_version: 9420, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 6, @@ -219,10 +219,10 @@ impl pallet_timestamp::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: u128 = 1 * MILLIROC; - pub const TransferFee: u128 = 1 * MILLIROC; - pub const CreationFee: u128 = 1 * MILLIROC; - pub const TransactionByteFee: u128 = 1 * MICROROC; + pub const ExistentialDeposit: u128 = MILLIROC; + pub const TransferFee: u128 = MILLIROC; + pub const CreationFee: u128 = MILLIROC; + pub const TransactionByteFee: u128 = MICROROC; } impl pallet_balances::Config for Runtime { @@ -237,7 +237,7 @@ impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -255,6 +255,7 @@ impl pallet_transaction_payment::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_sudo::weights::SubstrateWeight; } parameter_types! { @@ -344,7 +345,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // foreign chains who want to have a local sovereign account on this chain which they control. SovereignSignedViaLocation, - // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when // recognised. RelayChainAsNative, // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when @@ -470,6 +471,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -503,11 +506,11 @@ impl cumulus_ping::Config for Runtime { } parameter_types! { - pub const AssetDeposit: Balance = 1 * ROC; - pub const AssetAccountDeposit: Balance = 1 * ROC; + pub const AssetDeposit: Balance = ROC; + pub const AssetAccountDeposit: Balance = ROC; pub const ApprovalDeposit: Balance = 100 * MILLIROC; pub const AssetsStringLimit: u32 = 50; - pub const MetadataDepositBase: Balance = 1 * ROC; + pub const MetadataDepositBase: Balance = ROC; pub const MetadataDepositPerByte: Balance = 10 * MILLIROC; pub const UnitBody: BodyId = BodyId::Unit; } @@ -609,8 +612,6 @@ pub type SignedExtra = ( /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, diff --git a/polkadot-parachain/Cargo.toml b/polkadot-parachain/Cargo.toml index d8df7982425..d596cb6cdd8 100644 --- a/polkadot-parachain/Cargo.toml +++ b/polkadot-parachain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-parachain-bin" -version = "0.9.400" +version = "0.9.420" authors = ["Parity Technologies "] build = "build.rs" edition = "2021" @@ -12,16 +12,18 @@ path = "src/main.rs" [dependencies] async-trait = "0.1.68" -clap = { version = "4.2.7", features = ["derive"] } +clap = { version = "4.3.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } futures = "0.3.28" hex-literal = "0.4.1" log = "0.4.17" -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.163", features = ["derive"] } +serde_json = "1.0.96" # Local rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parachain" } shell-runtime = { path = "../parachains/runtimes/starters/shell" } +glutton-runtime = { path = "../parachains/runtimes/glutton/glutton-kusama" } seedling-runtime = { path = "../parachains/runtimes/starters/seedling" } statemint-runtime = { path = "../parachains/runtimes/assets/statemint" } statemine-runtime = { path = "../parachains/runtimes/assets/statemine" } @@ -64,7 +66,6 @@ sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "maste sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-serializer = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -99,7 +100,7 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate" assert_cmd = "2.0" nix = { version = "0.26.1", features = ["signal"] } tempfile = "3.5.0" -tokio = { version = "1.28.0", features = ["macros", "time", "parking_lot"] } +tokio = { version = "1.28.1", features = ["macros", "time", "parking_lot"] } wait-timeout = "0.2" # purge_chain_works works with rococo-local and needs to allow this polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", features = ["rococo-native"] } diff --git a/polkadot-parachain/src/chain_spec/bridge_hubs.rs b/polkadot-parachain/src/chain_spec/bridge_hubs.rs index 9e107fb2252..febb21b6647 100644 --- a/polkadot-parachain/src/chain_spec/bridge_hubs.rs +++ b/polkadot-parachain/src/chain_spec/bridge_hubs.rs @@ -275,7 +275,7 @@ pub mod rococo { para_id, bridges_pallet_owner_seed .as_ref() - .map(|seed| get_account_id_from_seed::(&seed)), + .map(|seed| get_account_id_from_seed::(seed)), ) }, Vec::new(), diff --git a/polkadot-parachain/src/chain_spec/glutton.rs b/polkadot-parachain/src/chain_spec/glutton.rs new file mode 100644 index 00000000000..d975a0d7d87 --- /dev/null +++ b/polkadot-parachain/src/chain_spec/glutton.rs @@ -0,0 +1,99 @@ +// Copyright Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +use crate::chain_spec::{get_account_id_from_seed, Extensions}; +use cumulus_primitives_core::ParaId; +use sc_service::ChainType; +use sp_core::sr25519; + +/// Specialized `ChainSpec` for the Glutton parachain runtime. +pub type GluttonChainSpec = + sc_service::GenericChainSpec; + +pub fn glutton_development_config(para_id: ParaId) -> GluttonChainSpec { + GluttonChainSpec::from_genesis( + // Name + "Glutton Development", + // ID + "glutton_dev", + ChainType::Local, + move || glutton_genesis(para_id), + Vec::new(), + None, + None, + None, + None, + Extensions { relay_chain: "kusama-dev".into(), para_id: para_id.into() }, + ) +} + +pub fn glutton_local_config(para_id: ParaId) -> GluttonChainSpec { + GluttonChainSpec::from_genesis( + // Name + "Glutton Local", + // ID + "glutton_local", + ChainType::Local, + move || glutton_genesis(para_id), + Vec::new(), + None, + None, + None, + None, + Extensions { relay_chain: "kusama-local".into(), para_id: para_id.into() }, + ) +} + +pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec { + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + + GluttonChainSpec::from_genesis( + // Name + format!("Glutton {}", para_id).as_str(), + // ID + format!("glutton-kusama-{}", para_id).as_str(), + ChainType::Live, + move || glutton_genesis(para_id), + Vec::new(), + None, + // Protocol ID + Some(format!("glutton-kusama-{}", para_id).as_str()), + None, + Some(properties), + Extensions { relay_chain: "kusama".into(), para_id: para_id.into() }, + ) +} + +fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::GenesisConfig { + glutton_runtime::GenesisConfig { + system: glutton_runtime::SystemConfig { + code: glutton_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + parachain_info: glutton_runtime::ParachainInfoConfig { parachain_id }, + parachain_system: Default::default(), + glutton: glutton_runtime::GluttonConfig { + compute: Default::default(), + storage: Default::default(), + trash_data_count: Default::default(), + }, + sudo: glutton_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + } +} diff --git a/polkadot-parachain/src/chain_spec/mod.rs b/polkadot-parachain/src/chain_spec/mod.rs index 3637e915406..f53552768f3 100644 --- a/polkadot-parachain/src/chain_spec/mod.rs +++ b/polkadot-parachain/src/chain_spec/mod.rs @@ -23,6 +23,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify}; pub mod bridge_hubs; pub mod collectives; pub mod contracts; +pub mod glutton; pub mod penpal; pub mod rococo_parachain; pub mod seedling; diff --git a/polkadot-parachain/src/cli.rs b/polkadot-parachain/src/cli.rs index 682911abf75..790951fb3b1 100644 --- a/polkadot-parachain/src/cli.rs +++ b/polkadot-parachain/src/cli.rs @@ -122,7 +122,11 @@ impl RelayChainCli { ) -> Self { let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec); let chain_id = extension.map(|e| e.relay_chain.clone()); - let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot")); - Self { base_path, chain_id, base: clap::Parser::parse_from(relay_chain_args) } + let base_path = para_config.base_path.path().join("polkadot"); + Self { + base_path: Some(base_path), + chain_id, + base: clap::Parser::parse_from(relay_chain_args), + } } } diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index 4270677e0bf..ab13c00099b 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -19,7 +19,7 @@ use crate::{ cli::{Cli, RelayChainCli, Subcommand}, service::{ new_partial, Block, BridgeHubKusamaRuntimeExecutor, BridgeHubPolkadotRuntimeExecutor, - BridgeHubRococoRuntimeExecutor, CollectivesPolkadotRuntimeExecutor, + BridgeHubRococoRuntimeExecutor, CollectivesPolkadotRuntimeExecutor, GluttonRuntimeExecutor, StatemineRuntimeExecutor, StatemintRuntimeExecutor, WestmintRuntimeExecutor, }, }; @@ -54,6 +54,7 @@ enum Runtime { ContractsRococo, CollectivesPolkadot, CollectivesWestend, + Glutton, BridgeHub(chain_spec::bridge_hubs::BridgeHubRuntimeType), } @@ -77,7 +78,7 @@ impl RuntimeResolver for PathBuf { let file = std::fs::File::open(self).expect("Failed to open file"); let reader = std::io::BufReader::new(file); - let chain_spec: EmptyChainSpecWithId = sp_serializer::from_reader(reader) + let chain_spec: EmptyChainSpecWithId = serde_json::from_reader(reader) .expect("Failed to read 'json' file with ChainSpec configuration"); runtime(&chain_spec.id) @@ -85,7 +86,7 @@ impl RuntimeResolver for PathBuf { } fn runtime(id: &str) -> Runtime { - let id = id.replace("_", "-"); + let id = id.replace('_', "-"); let (_, id, para_id) = extract_parachain_id(&id); if id.starts_with("shell") { @@ -111,6 +112,8 @@ fn runtime(id: &str) -> Runtime { id.parse::() .expect("Invalid value"), ) + } else if id.starts_with("glutton") { + Runtime::Glutton } else { log::warn!("No specific runtime was recognized for ChainSpec's id: '{}', so Runtime::default() will be used", id); Runtime::default() @@ -214,6 +217,18 @@ fn load_spec(id: &str) -> std::result::Result, String> { "polkadot-local", )), + // -- Glutton + "glutton-kusama-dev" => Box::new(chain_spec::glutton::glutton_development_config( + para_id.expect("Must specify parachain id"), + )), + "glutton-kusama-local" => Box::new(chain_spec::glutton::glutton_local_config( + para_id.expect("Must specify parachain id"), + )), + // the chain spec as used for generating the upgrade genesis values + "glutton-kusama-genesis" => Box::new(chain_spec::glutton::glutton_config( + para_id.expect("Must specify parachain id"), + )), + // -- Fallback (generic chainspec) "" => { log::warn!("No ChainSpec.id specified, so using default one, based on rococo-parachain runtime"); @@ -240,9 +255,11 @@ fn load_spec(id: &str) -> std::result::Result, String> { Runtime::ContractsRococo => Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?), Runtime::BridgeHub(bridge_hub_runtime_type) => - bridge_hub_runtime_type.chain_spec_from_json_file(path.into())?, + bridge_hub_runtime_type.chain_spec_from_json_file(path)?, Runtime::Penpal(_para_id) => Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?), + Runtime::Glutton => + Box::new(chain_spec::glutton::GluttonChainSpec::from_json_file(path)?), Runtime::Default => Box::new( chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_file(path)?, ), @@ -258,14 +275,25 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option) { const KUSAMA_TEST_PARA_PREFIX: &str = "penpal-kusama-"; const POLKADOT_TEST_PARA_PREFIX: &str = "penpal-polkadot-"; - let (norm_id, orig_id, para) = if id.starts_with(KUSAMA_TEST_PARA_PREFIX) { - let suffix = &id[KUSAMA_TEST_PARA_PREFIX.len()..]; + const GLUTTON_PARA_DEV_PREFIX: &str = "glutton-kusama-dev-"; + const GLUTTON_PARA_LOCAL_PREFIX: &str = "glutton-kusama-local-"; + const GLUTTON_PARA_GENESIS_PREFIX: &str = "glutton-kusama-genesis-"; + + let (norm_id, orig_id, para) = if let Some(suffix) = id.strip_prefix(KUSAMA_TEST_PARA_PREFIX) { let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); (&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id)) - } else if id.starts_with(POLKADOT_TEST_PARA_PREFIX) { - let suffix = &id[POLKADOT_TEST_PARA_PREFIX.len()..]; + } else if let Some(suffix) = id.strip_prefix(POLKADOT_TEST_PARA_PREFIX) { let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); (&id[..POLKADOT_TEST_PARA_PREFIX.len() - 1], id, Some(para_id)) + } else if let Some(suffix) = id.strip_prefix(GLUTTON_PARA_DEV_PREFIX) { + let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); + (&id[..GLUTTON_PARA_DEV_PREFIX.len() - 1], id, Some(para_id)) + } else if let Some(suffix) = id.strip_prefix(GLUTTON_PARA_LOCAL_PREFIX) { + let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); + (&id[..GLUTTON_PARA_LOCAL_PREFIX.len() - 1], id, Some(para_id)) + } else if let Some(suffix) = id.strip_prefix(GLUTTON_PARA_GENESIS_PREFIX) { + let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); + (&id[..GLUTTON_PARA_GENESIS_PREFIX.len() - 1], id, Some(para_id)) } else { (id, id, None) }; @@ -321,6 +349,7 @@ impl SubstrateCli for Cli { Runtime::BridgeHub(bridge_hub_runtime_type) => bridge_hub_runtime_type.runtime_version(), Runtime::Penpal(_) => &penpal_runtime::VERSION, + Runtime::Glutton => &glutton_runtime::VERSION, Runtime::Default => &rococo_parachain_runtime::VERSION, } } @@ -555,6 +584,16 @@ macro_rules! construct_async_run { let task_manager = $components.task_manager; { $( $code )* }.map(|v| (v, task_manager)) }) + }, + Runtime::Glutton => { + runner.async_run(|$config| { + let $components = new_partial::( + &$config, + crate::service::shell_build_import_queue, + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) } } }} @@ -661,7 +700,9 @@ pub fn run() -> Result<()> { bridge_hub_runtime_type ) .into()), - } + }, + Runtime::Glutton => + cmd.run::(config), _ => Err(format!( "Chain '{:?}' doesn't support benchmarking", config.chain_spec.runtime() @@ -798,6 +839,12 @@ pub fn run() -> Result<()> { task_manager, )) }), + Runtime::Glutton => runner.async_run(|_| { + Ok(( + cmd.run::, _>(Some(info_provider)), + task_manager, + )) + }), _ => Err("Chain doesn't support try-runtime".into()), } }, @@ -813,13 +860,13 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let hwbench = (!cli.no_hardware_benchmarks).then_some( config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) })).flatten(); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) - .ok_or_else(|| "Could not find parachain extension in chain-spec.")?; + .ok_or("Could not find parachain extension in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, @@ -848,7 +895,7 @@ pub fn run() -> Result<()> { info!("Parachain genesis state: {}", genesis_state); info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); - if !collator_options.relay_chain_rpc_urls.is_empty() && cli.relaychain_args.len() > 0 { + if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relaychain_args.is_empty() { warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); } @@ -965,6 +1012,17 @@ pub fn run() -> Result<()> { .await .map(|r| r.0) .map_err(Into::into), + Runtime::Glutton => + crate::service::start_shell_node::( + config, + polkadot_config, + collator_options, + id, + hwbench, + ) + .await + .map(|r| r.0) + .map_err(Into::into), } }) }, @@ -976,14 +1034,10 @@ impl DefaultConfigurationValues for RelayChainCli { 30334 } - fn rpc_ws_listen_port() -> u16 { + fn rpc_listen_port() -> u16 { 9945 } - fn rpc_http_listen_port() -> u16 { - 9934 - } - fn prometheus_listen_port() -> u16 { 9616 } @@ -1013,16 +1067,8 @@ impl CliConfiguration for RelayChainCli { .or_else(|| self.base_path.clone().map(Into::into))) } - fn rpc_http(&self, default_listen_port: u16) -> Result> { - self.base.base.rpc_http(default_listen_port) - } - - fn rpc_ipc(&self) -> Result> { - self.base.base.rpc_ipc() - } - - fn rpc_ws(&self, default_listen_port: u16) -> Result> { - self.base.base.rpc_ws(default_listen_port) + fn rpc_addr(&self, default_listen_port: u16) -> Result> { + self.base.base.rpc_addr(default_listen_port) } fn prometheus_config( @@ -1068,8 +1114,8 @@ impl CliConfiguration for RelayChainCli { self.base.base.rpc_methods() } - fn rpc_ws_max_connections(&self) -> Result> { - self.base.base.rpc_ws_max_connections() + fn rpc_max_connections(&self) -> Result { + self.base.base.rpc_max_connections() } fn rpc_cors(&self, is_dev: bool) -> Result>> { diff --git a/polkadot-parachain/src/rpc.rs b/polkadot-parachain/src/rpc.rs index 0904037762e..c0cc5cfc2cf 100644 --- a/polkadot-parachain/src/rpc.rs +++ b/polkadot-parachain/src/rpc.rs @@ -71,7 +71,7 @@ where module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; - module.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?; + module.merge(StateMigration::new(client, backend.clone(), deny_unsafe).into_rpc())?; if let Some(outbound_queue_rpc) = backend .offchain_storage() diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 803d0987844..b4cc4ce4981 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -43,7 +43,7 @@ use sc_consensus::{ BlockImportParams, ImportQueue, }; use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; -use sc_network::NetworkBlock; +use sc_network::{config::FullNetworkConfiguration, NetworkBlock}; use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; @@ -206,6 +206,21 @@ impl sc_executor::NativeExecutionDispatch for ContractsRococoRuntimeExecutor { } } +/// Native Glutton executor instance. +pub struct GluttonRuntimeExecutor; + +impl sc_executor::NativeExecutionDispatch for GluttonRuntimeExecutor { + type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; + + fn dispatch(method: &str, data: &[u8]) -> Option> { + shell_runtime::api::dispatch(method, data) + } + + fn native_version() -> sc_executor::NativeVersion { + shell_runtime::native_version() + } +} + /// Starts a `ServiceBuilder` for a full service. /// /// Use this macro if you don't actually need the full service, but just the builder in order to @@ -393,10 +408,12 @@ where let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); let import_queue_service = params.import_queue.service(); + let net_config = FullNetworkConfiguration::new(¶chain_config.network); let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = build_network(BuildNetworkParams { parachain_config: ¶chain_config, + net_config, client: client.clone(), transaction_pool: transaction_pool.clone(), para_id, @@ -582,10 +599,12 @@ where let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); let import_queue_service = params.import_queue.service(); + let net_config = FullNetworkConfiguration::new(¶chain_config.network); let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = build_network(BuildNetworkParams { parachain_config: ¶chain_config, + net_config, client: client.clone(), transaction_pool: transaction_pool.clone(), para_id, @@ -858,7 +877,7 @@ where sc_client_api::StateBackendFor: sp_api::StateBackend, { cumulus_client_consensus_relay_chain::import_queue( - client.clone(), + client, block_import, |_, _| async { Ok(()) }, &task_manager.spawn_essential_handle(), @@ -1103,7 +1122,7 @@ where Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) })) as Box<_>; let verifier = Verifier { - client: client.clone(), + client, relay_chain_verifier, aura_verifier: BuildOnAccess::Uninitialized(Some(Box::new(aura_verifier))), _phantom: PhantomData, @@ -1355,10 +1374,12 @@ where let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); let import_queue_service = params.import_queue.service(); + let net_config = FullNetworkConfiguration::new(¶chain_config.network); let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = build_network(BuildNetworkParams { parachain_config: ¶chain_config, + net_config, client: client.clone(), transaction_pool: transaction_pool.clone(), para_id, diff --git a/polkadot-parachain/tests/benchmark_storage_works.rs b/polkadot-parachain/tests/benchmark_storage_works.rs index 916d65c0a1b..b1c05609217 100644 --- a/polkadot-parachain/tests/benchmark_storage_works.rs +++ b/polkadot-parachain/tests/benchmark_storage_works.rs @@ -8,7 +8,7 @@ use std::{ use tempfile::tempdir; /// The runtimes that this command supports. -static RUNTIMES: [&'static str; 3] = ["westmint", "statemine", "statemint"]; +static RUNTIMES: [&str; 3] = ["westmint", "statemine", "statemint"]; /// The `benchmark storage` command works for the dev runtimes. #[test] @@ -31,7 +31,7 @@ fn benchmark_storage_works() { /// Invoke the `benchmark storage` sub-command for the given database and runtime. fn benchmark_storage(db: &str, runtime: &str, base_path: &Path) -> ExitStatus { Command::new(cargo_bin("polkadot-parachain")) - .args(&["benchmark", "storage", "--chain", runtime]) + .args(["benchmark", "storage", "--chain", runtime]) .arg("--db") .arg(db) .arg("--weight-path") diff --git a/polkadot-parachain/tests/common.rs b/polkadot-parachain/tests/common.rs index 1d3d710c83d..d8ecfe9bcbe 100644 --- a/polkadot-parachain/tests/common.rs +++ b/polkadot-parachain/tests/common.rs @@ -103,7 +103,7 @@ impl DerefMut for KillChildOnDrop { } } -/// Read the WS address from the output. +/// Read the RPC server address from the output. /// /// This is hack to get the actual bound sockaddr because /// substrate assigns a random port if the specified port was already bound. @@ -117,19 +117,19 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) { line.expect("failed to obtain next line from stdout for WS address discovery"); data.push_str(&line); - data.push_str("\n"); + data.push('\n'); // does the line contain our port (we expect this specific output from substrate). - let sock_addr = match line.split_once("Running JSON-RPC WS server: addr=") { + let sock_addr = match line.split_once("Running JSON-RPC server: addr=") { None => return None, - Some((_, after)) => after.split_once(",").unwrap().0, + Some((_, after)) => after.split_once(',').unwrap().0, }; Some(format!("ws://{}", sock_addr)) }) .unwrap_or_else(|| { eprintln!("Output:\n{}", data); - panic!("We should get a WebSocket address") + panic!("We should get an address") }); (ws_url, data) diff --git a/polkadot-parachain/tests/purge_chain_works.rs b/polkadot-parachain/tests/purge_chain_works.rs index 34a51dcff84..2f4609273da 100644 --- a/polkadot-parachain/tests/purge_chain_works.rs +++ b/polkadot-parachain/tests/purge_chain_works.rs @@ -38,7 +38,7 @@ async fn purge_chain_works() { assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists()); let status = Command::new(cargo_bin("polkadot-parachain")) - .args(&["purge-chain", "-d"]) + .args(["purge-chain", "-d"]) .arg(base_dir.path()) .arg("-y") .status() diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index b2adf290db1..990a76d2d8a 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 52770cdf716..752e1aee474 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -21,7 +21,7 @@ use codec::{Decode, Encode}; use polkadot_parachain::primitives::HeadData; use scale_info::TypeInfo; -use sp_runtime::{traits::Block as BlockT, RuntimeDebug}; +use sp_runtime::RuntimeDebug; use sp_std::prelude::*; pub use polkadot_core_primitives::InboundDownwardMessage; @@ -33,6 +33,12 @@ pub use polkadot_primitives::{ AbridgedHostConfiguration, AbridgedHrmpChannel, PersistedValidationData, }; +pub use sp_runtime::{ + generic::{Digest, DigestItem}, + traits::Block as BlockT, + ConsensusEngineId, +}; + pub use xcm::latest::prelude::*; /// A module that re-exports relevant relay chain definitions. @@ -198,6 +204,88 @@ impl ParachainBlockData { } } +/// A consensus engine ID indicating that this is a Cumulus Parachain. +pub const CUMULUS_CONSENSUS_ID: ConsensusEngineId = *b"CMLS"; + +/// Consensus header digests for Cumulus parachains. +#[derive(Clone, RuntimeDebug, Decode, Encode, PartialEq)] +pub enum CumulusDigestItem { + /// A digest item indicating the relay-parent a parachain block was built against. + #[codec(index = 0)] + RelayParent(relay_chain::Hash), +} + +impl CumulusDigestItem { + /// Encode this as a Substrate [`DigestItem`]. + pub fn to_digest_item(&self) -> DigestItem { + DigestItem::Consensus(CUMULUS_CONSENSUS_ID, self.encode()) + } +} + +/// Extract the relay-parent from the provided header digest. Returns `None` if none were found. +/// +/// If there are multiple valid digests, this returns the value of the first one, although +/// well-behaving runtimes should not produce headers with more than one. +pub fn extract_relay_parent(digest: &Digest) -> Option { + digest.convert_first(|d| match d { + DigestItem::Consensus(id, val) if id == &CUMULUS_CONSENSUS_ID => + match CumulusDigestItem::decode(&mut &val[..]) { + Ok(CumulusDigestItem::RelayParent(hash)) => Some(hash), + _ => None, + }, + _ => None, + }) +} + +/// Utilities for handling the relay-parent storage root as a digest item. +/// +/// This is not intended to be part of the public API, as it is a workaround for +/// via +/// . +/// +/// Runtimes using the parachain-system pallet are expected to produce this digest item, +/// but will stop as soon as they are able to provide the relay-parent hash directly. +/// +/// The relay-chain storage root is, in practice, a unique identifier of a block +/// in the absence of equivocations (which are slashable). This assumes that the relay chain +/// uses BABE or SASSAFRAS, because the slot and the author's VRF randomness are both included +/// in the relay-chain storage root in both cases. +/// +/// Therefore, the relay-parent storage root is a suitable identifier of unique relay chain +/// blocks in low-value scenarios such as performance optimizations. +#[doc(hidden)] +pub mod rpsr_digest { + use super::{relay_chain, ConsensusEngineId, Decode, Digest, DigestItem, Encode}; + use codec::Compact; + + /// A consensus engine ID for relay-parent storage root digests. + pub const RPSR_CONSENSUS_ID: ConsensusEngineId = *b"RPSR"; + + /// Construct a digest item for relay-parent storage roots. + pub fn relay_parent_storage_root_item( + storage_root: relay_chain::Hash, + number: impl Into>, + ) -> DigestItem { + DigestItem::Consensus(RPSR_CONSENSUS_ID, (storage_root, number.into()).encode()) + } + + /// Extract the relay-parent storage root and number from the provided header digest. Returns `None` + /// if none were found. + pub fn extract_relay_parent_storage_root( + digest: &Digest, + ) -> Option<(relay_chain::Hash, relay_chain::BlockNumber)> { + digest.convert_first(|d| match d { + DigestItem::Consensus(id, val) if id == &RPSR_CONSENSUS_ID => { + let (h, n): (relay_chain::Hash, Compact) = + Decode::decode(&mut &val[..]).ok()?; + + Some((h, n.0)) + }, + _ => None, + }) + } +} + /// Information about a collation. /// /// This was used in version 1 of the [`CollectCollationInfo`] runtime api. diff --git a/primitives/parachain-inherent/Cargo.toml b/primitives/parachain-inherent/Cargo.toml index ff7bfa8ae44..5c1730e35e0 100644 --- a/primitives/parachain-inherent/Cargo.toml +++ b/primitives/parachain-inherent/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-trait = { version = "0.1.68", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } tracing = { version = "0.1.37", optional = true } # Substrate diff --git a/primitives/parachain-inherent/src/client_side.rs b/primitives/parachain-inherent/src/client_side.rs index 6f2cd5eb504..03ca3203dc0 100644 --- a/primitives/parachain-inherent/src/client_side.rs +++ b/primitives/parachain-inherent/src/client_side.rs @@ -92,18 +92,23 @@ async fn collect_relay_storage_proof( .ok()? .unwrap_or_default(); - let mut relevant_keys = Vec::new(); - relevant_keys.push(relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::CURRENT_SLOT.to_vec()); - relevant_keys.push(relay_well_known_keys::ACTIVE_CONFIG.to_vec()); - relevant_keys.push(relay_well_known_keys::dmq_mqc_head(para_id)); - relevant_keys.push(relay_well_known_keys::relay_dispatch_queue_size(para_id)); - relevant_keys.push(relay_well_known_keys::hrmp_ingress_channel_index(para_id)); - relevant_keys.push(relay_well_known_keys::hrmp_egress_channel_index(para_id)); - relevant_keys.push(relay_well_known_keys::upgrade_go_ahead_signal(para_id)); - relevant_keys.push(relay_well_known_keys::upgrade_restriction_signal(para_id)); + let mut relevant_keys = vec![ + relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec(), + relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec(), + relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec(), + relay_well_known_keys::CURRENT_SLOT.to_vec(), + relay_well_known_keys::ACTIVE_CONFIG.to_vec(), + relay_well_known_keys::dmq_mqc_head(para_id), + // TODO paritytech/polkadot#6283: Remove all usages of `relay_dispatch_queue_size` + // We need to keep this here until all parachains have migrated to `relay_dispatch_queue_remaining_capacity`. + #[allow(deprecated)] + relay_well_known_keys::relay_dispatch_queue_size(para_id), + relay_well_known_keys::relay_dispatch_queue_remaining_capacity(para_id).key, + relay_well_known_keys::hrmp_ingress_channel_index(para_id), + relay_well_known_keys::hrmp_egress_channel_index(para_id), + relay_well_known_keys::upgrade_go_ahead_signal(para_id), + relay_well_known_keys::upgrade_restriction_signal(para_id), + ]; relevant_keys.extend(ingress_channels.into_iter().map(|sender| { relay_well_known_keys::hrmp_channels(HrmpChannelId { sender, recipient: para_id }) })); diff --git a/primitives/parachain-inherent/src/mock.rs b/primitives/parachain-inherent/src/mock.rs index a26ee114ef7..00dff40800f 100644 --- a/primitives/parachain-inherent/src/mock.rs +++ b/primitives/parachain-inherent/src/mock.rs @@ -160,8 +160,8 @@ impl> InherentDataProvider self.relay_offset + self.relay_blocks_per_para_block * self.current_para_block; // Use the "sproof" (spoof proof) builder to build valid mock state root and proof. - let mut sproof_builder = RelayStateSproofBuilder::default(); - sproof_builder.para_id = self.xcm_config.para_id; + let mut sproof_builder = + RelayStateSproofBuilder { para_id: self.xcm_config.para_id, ..Default::default() }; // Process the downward messages and set up the correct head let mut downward_messages = Vec::new(); diff --git a/primitives/timestamp/src/lib.rs b/primitives/timestamp/src/lib.rs index ddc2fe340dd..932656d9b0f 100644 --- a/primitives/timestamp/src/lib.rs +++ b/primitives/timestamp/src/lib.rs @@ -99,7 +99,7 @@ mod tests { relay_parent_number: 1, relay_parent_storage_root, }, - &WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), + WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), ) .map(|v| Header::decode(&mut &v.head_data.0[..]).expect("Decodes `Header`.")) } @@ -175,7 +175,7 @@ mod tests { (slot_timestamp * 10, false), ] { let output = Command::new(env::current_exe().unwrap()) - .args(&["check_timestamp_inherent_works", "--", "--nocapture"]) + .args(["check_timestamp_inherent_works", "--", "--nocapture"]) .env("RUN_TEST", "1") .env("TIMESTAMP", timestamp.to_string()) .output() diff --git a/primitives/utility/src/lib.rs b/primitives/utility/src/lib.rs index d3a7c77aed2..f2488b83a51 100644 --- a/primitives/utility/src/lib.rs +++ b/primitives/utility/src/lib.rs @@ -163,25 +163,26 @@ impl< // Get the local asset id in which we can pay for fees let (local_asset_id, _) = - Matcher::matches_fungibles(&first).map_err(|_| XcmError::AssetNotFound)?; + Matcher::matches_fungibles(first).map_err(|_| XcmError::AssetNotFound)?; // Calculate how much we should charge in the asset_id for such amount of weight // Require at least a payment of minimum_balance // Necessary for fully collateral-backed assets - let asset_balance: u128 = FeeCharger::charge_weight_in_fungibles(local_asset_id, weight) - .map(|amount| { - let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id); - if amount < minimum_balance { - minimum_balance - } else { - amount - } - })? - .try_into() - .map_err(|_| XcmError::Overflow)?; + let asset_balance: u128 = + FeeCharger::charge_weight_in_fungibles(local_asset_id.clone(), weight) + .map(|amount| { + let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id); + if amount < minimum_balance { + minimum_balance + } else { + amount + } + })? + .try_into() + .map_err(|_| XcmError::Overflow)?; // Convert to the same kind of multiasset, with the required fungible balance - let required = first.id.clone().into_multiasset(asset_balance.into()); + let required = first.id.into_multiasset(asset_balance.into()); // Substract payment let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?; @@ -204,9 +205,9 @@ impl< { // Get the local asset id in which we can refund fees let (local_asset_id, outstanding_balance) = - Matcher::matches_fungibles(&(id.clone(), fun).into()).ok()?; + Matcher::matches_fungibles(&(id, fun).into()).ok()?; - let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id); + let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id.clone()); // Calculate asset_balance // This read should have already be cached in buy_weight @@ -233,8 +234,7 @@ impl< let asset_balance: u128 = asset_balance.saturated_into(); // Construct outstanding_concrete_asset with the same location id and substracted balance - let outstanding_concrete_asset: MultiAsset = - (id.clone(), outstanding_minus_substracted).into(); + let outstanding_concrete_asset: MultiAsset = (id, outstanding_minus_substracted).into(); // Substract from existing weight and balance weight_outstanding = weight_outstanding.saturating_sub(weight); @@ -288,7 +288,7 @@ impl< &(X1(AccountId32 { network: None, id: receiver.into() }).into()), // We aren't able to track the XCM that initiated the fee deposit, so we create a // fake message hash here - &XcmContext::with_message_hash([0; 32]), + &XcmContext::with_message_id([0; 32]), ) .is_ok(); @@ -365,7 +365,7 @@ mod tests { // ParentAsUmp - check dest is really not applicable let dest = (Parent, Parent, Parent); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert_eq!( Err(SendError::NotApplicable), @@ -373,7 +373,7 @@ mod tests { ); // check wrapper were not consumed - assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(dest.into()), dest_wrapper.take()); assert_eq!(Some(message.clone()), msg_wrapper.take()); // another try with router chain with asserting sender @@ -393,7 +393,7 @@ mod tests { // ParentAsUmp - check dest/msg is valid let dest = (Parent, Here); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert!( as SendXcm>::validate( &mut dest_wrapper, @@ -529,16 +529,13 @@ mod tests { // prepare test data let asset: MultiAsset = (Here, AMOUNT).into(); - let payment = Assets::from(asset.clone()); + let payment = Assets::from(asset); let weight_to_buy = Weight::from_parts(1_000, 1_000); // lets do first call (success) assert_ok!(trader.buy_weight(weight_to_buy, payment.clone())); // lets do second call (error) - assert_eq!( - trader.buy_weight(weight_to_buy, payment.clone()), - Err(XcmError::NotWithdrawable) - ); + assert_eq!(trader.buy_weight(weight_to_buy, payment), Err(XcmError::NotWithdrawable)); } } diff --git a/scripts/benchmarks-ci.sh b/scripts/benchmarks-ci.sh index 4b465400198..fcf0cc61984 100755 --- a/scripts/benchmarks-ci.sh +++ b/scripts/benchmarks-ci.sh @@ -9,6 +9,10 @@ repeat=${5:-20} benchmarkOutput=./parachains/runtimes/$category/$runtimeName/src/weights benchmarkRuntimeName="$runtimeName-dev" +if [ $category = "glutton" ]; then + benchmarkRuntimeName="$runtimeName-dev-1300" +fi + # Load all pallet names in an array. pallets=($( ${artifactsDir}/polkadot-parachain benchmark pallet --list --chain="${benchmarkRuntimeName}" |\ diff --git a/scripts/benchmarks.sh b/scripts/benchmarks.sh index 0db74102f24..be9aa9b8348 100755 --- a/scripts/benchmarks.sh +++ b/scripts/benchmarks.sh @@ -15,3 +15,5 @@ ${__dir}/benchmarks-ci.sh assets westmint target/$target $steps $repeat ${__dir}/benchmarks-ci.sh bridge-hubs bridge-hub-polkadot target/$target $steps $repeat ${__dir}/benchmarks-ci.sh bridge-hubs bridge-hub-kusama target/$target $steps $repeat ${__dir}/benchmarks-ci.sh bridge-hubs bridge-hub-rococo target/$target $steps $repeat + +${__dir}/benchmarks-ci.sh glutton glutton-kusama target/$target $steps $repeat diff --git a/scripts/bridges_rococo_wococo.sh b/scripts/bridges_rococo_wococo.sh index fa79ab884ab..2d918e244a9 100755 --- a/scripts/bridges_rococo_wococo.sh +++ b/scripts/bridges_rococo_wococo.sh @@ -7,6 +7,17 @@ STATEMINE_ACCOUNT_SEED_FOR_LOCAL="//Alice" # AccountId: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" +# SovereignAccount for `MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }` => 5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ +# +# use sp_core::crypto::Ss58Codec; +# println!("{}", +# frame_support::sp_runtime::AccountId32::new( +# GlobalConsensusParachainConvertsFor::::convert_ref( +# MultiLocation { parents: 2, interior: X2(GlobalConsensus(Kusama), Parachain(1000)) }).unwrap() +# ).to_ss58check_with_version(42_u16.into()) +# ); +ROCOCO_STATEMINE_1000_SOVEREIGN_ACCOUNT="5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ" + # Address: GegTpZJMyzkntLN7NJhRfHDk4GWukLbGSsag6PHrLSrCK4h ROCKMINE2_ACCOUNT_SEED_FOR_ROCOCO="scatter feed race company oxygen trip extra elbow slot bundle auto canoe" @@ -377,10 +388,12 @@ function transfer_asset_via_bridge() { local url=$1 local seed=$2 local target_account=$3 + local target_global_consensus=$4 echo " calling transfer_asset_via_bridge:" echo " url: ${url}" echo " seed: ${seed}" echo " target_account: ${target_account}" + echo " target_global_consensus: ${target_global_consensus}" echo " params:" local assets=$(jq --null-input \ @@ -408,6 +421,7 @@ function transfer_asset_via_bridge() { local hex_encoded_data=$(cat $tmp_output_file) local destination=$(jq --null-input \ + --arg target_global_consensus "$target_global_consensus" \ --argjson hex_encoded_data "$hex_encoded_data" \ ' { @@ -416,7 +430,7 @@ function transfer_asset_via_bridge() { "interior": { "X3": [ { - "GlobalConsensus": "Wococo" + "GlobalConsensus": $target_global_consensus }, { "Parachain": 1000 @@ -454,10 +468,12 @@ function ping_via_bridge() { local url=$1 local seed=$2 local target_account=$3 + local target_global_consensus=$4 echo " calling ping_via_bridge:" echo " url: ${url}" echo " seed: ${seed}" echo " target_account: ${target_account}" + echo " target_global_consensus: ${target_global_consensus}" echo " params:" local tmp_output_file=$(mktemp) @@ -465,6 +481,7 @@ function ping_via_bridge() { local hex_encoded_data=$(cat $tmp_output_file) local destination=$(jq --null-input \ + --arg target_global_consensus "$target_global_consensus" \ --argjson hex_encoded_data "$hex_encoded_data" \ ' { @@ -473,7 +490,7 @@ function ping_via_bridge() { "interior": { "X3": [ { - "GlobalConsensus": "Wococo" + "GlobalConsensus": $target_global_consensus }, { "Parachain": 1000 @@ -591,12 +608,10 @@ case "$1" in 1014 \ "Rococo" \ 1000 - # drip SovereignAccount for `MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }` => 5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG - # drip SovereignAccount for `MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1015)) }` => 5FS75NFUdEYhWHuV3y3ncjSG4PFdHfC5X7V6SEzc3rnCciwb transfer_balance \ "ws://127.0.0.1:9010" \ "//Alice" \ - "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" \ + "$ROCOCO_STATEMINE_1000_SOVEREIGN_ACCOUNT" \ $((1000000000 + 50000000000 * 20)) # ExistentialDeposit + maxTargetLocationFee * 20 # create foreign assets for native Statemine token (yes, Kusama, because we are using Statemine runtime on rococo) force_create_foreign_asset \ @@ -605,7 +620,7 @@ case "$1" in 1000 \ "ws://127.0.0.1:9010" \ "Kusama" \ - "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" + "$ROCOCO_STATEMINE_1000_SOVEREIGN_ACCOUNT" ;; remove-assets-transfer-from-statemine-local) ensure_polkadot_js_api @@ -621,40 +636,47 @@ case "$1" in transfer_asset_via_bridge \ "ws://127.0.0.1:9910" \ "$STATEMINE_ACCOUNT_SEED_FOR_LOCAL" \ - "$WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL" - ;; - transfer-asset-from-statemine-rococo) - ensure_polkadot_js_api - transfer_asset_via_bridge \ - "wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \ - "$ROCKMINE2_ACCOUNT_SEED_FOR_ROCOCO" \ - "$WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO" + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL" \ + "Wococo" ;; ping-via-bridge-from-statemine-local) ensure_polkadot_js_api ping_via_bridge \ "ws://127.0.0.1:9910" \ "$STATEMINE_ACCOUNT_SEED_FOR_LOCAL" \ - "$WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL" + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL" \ + "Wococo" + ;; + transfer-asset-from-statemine-rococo) + ensure_polkadot_js_api + transfer_asset_via_bridge \ + "wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \ + "$ROCKMINE2_ACCOUNT_SEED_FOR_ROCOCO" \ + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO" \ + "Wococo" ;; ping-via-bridge-from-statemine-rococo) ensure_polkadot_js_api ping_via_bridge \ "wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \ "${ROCKMINE2_ACCOUNT_SEED_FOR_ROCOCO}" \ - "$WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO" + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO" \ + "Wococo" ;; drip) transfer_balance \ "ws://127.0.0.1:9010" \ "//Alice" \ - "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" \ + "$ROCOCO_STATEMINE_1000_SOVEREIGN_ACCOUNT" \ $((1000000000 + 50000000000 * 20)) ;; stop) pkill -f polkadot pkill -f parachain ;; + import) + # to avoid trigger anything here + ;; *) echo "A command is require. Supported commands for: Local (zombienet) run: diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index 0ef51ae2e6d..a67c15eec6b 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -97,3 +97,11 @@ cargo-check-benches: artifacts: false script: - time cargo check --all --benches + +cargo-clippy: + stage: test + extends: + - .docker-env + - .common-refs + script: + - SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --locked --all-targets diff --git a/scripts/ci/gitlab/pipeline/zombienet.yml b/scripts/ci/gitlab/pipeline/zombienet.yml index d76531b19e7..d5ab3e13d42 100644 --- a/scripts/ci/gitlab/pipeline/zombienet.yml +++ b/scripts/ci/gitlab/pipeline/zombienet.yml @@ -35,7 +35,7 @@ expire_in: 2 days paths: - ./zombienet-logs - allow_failure: true + allow_failure: false retry: 2 tags: - zombienet-polkadot-integration-test diff --git a/scripts/create_glutton_spec.sh b/scripts/create_glutton_spec.sh new file mode 100755 index 00000000000..571a84b57a0 --- /dev/null +++ b/scripts/create_glutton_spec.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# Example usage to: +# +# - Use the `polkadot-parachain` binary; +# - Use `rococo` as the parent Relay Chain; +# - Generate `ParaId`s from 1,300 to 1,370, inclusive; +# - Set the Sudo key to `G7Z5mTmTQsjEGBVqVGDZyR9m7RoHNZJk6JeykyfKQ3vmBiR`; +# - Set `compute`, `storage`, and `trash_data_count` set to 50%, 50%, and 5,120, respectively; +# - And save the results in `output-dir`. +# +# ./scripts/create_glutton_spec.sh ./target/release/polkadot-parachain rococo 1300 1370 G7Z5mTmTQsjEGBVqVGDZyR9m7RoHNZJk6JeykyfKQ3vmBiR 500000000 500000000 5120 output-dir + +usage() { + echo Usage: + echo "$0 " + exit 1 +} + +set -e + +if ! command -v jq >/dev/null 2>&1; then + echo "'jq' is not installed, please install. Exiting..." + exit 1 +fi + +binary_path=$1 +relay_chain=$2 +from_para_id=$3 +to_para_id=$4 +sudo=$5 +compute=$6 +storage=$7 +trash_data_count=$8 +output_dir=$9 + +[ -z "$binary_path" ] && usage +[ -z "$relay_chain" ] && usage +[ -z "$from_para_id" ] && usage +[ -z "$to_para_id" ] && usage +[ -z "$sudo" ] && usage +[ -z "$compute" ] && usage +[ -z "$storage" ] && usage +[ -z "$trash_data_count" ] && usage +[ -z "$output_dir" ] && usage + + +for (( para_id=$from_para_id; para_id<=$to_para_id; para_id++ )); do + echo "Building chain specs for parachain $para_id" + + # create dir to store parachain generated files + output_para_dir="$output_dir/glutton-$relay_chain-$para_id" + if [ ! -d "$output_para_dir" ]; then + mkdir $output_para_dir + fi + + # build the chain spec we'll manipulate + $binary_path build-spec --disable-default-bootnode --chain "glutton-kusama-genesis-$para_id" > "$output_para_dir/plain-glutton-$relay_chain-$para_id-spec.json" + + id="glutton-$relay_chain-$para_id" + protocol_id="glutton-$relay_chain-$para_id" + + # replace the runtime in the spec with the given runtime and set some values to production + cat "$output_para_dir/plain-glutton-$relay_chain-$para_id-spec.json" \ + | jq --arg id $id '.id = $id' \ + | jq --arg protocol_id $protocol_id '.protocolId = $protocol_id' \ + | jq --arg relay_chain $relay_chain '.relay_chain = $relay_chain' \ + | jq --argjson para_id $para_id '.para_id = $para_id' \ + | jq --arg sudo $sudo '.genesis.runtime.sudo.key = $sudo' \ + | jq --argjson para_id $para_id '.genesis.runtime.parachainInfo.parachainId = $para_id' \ + | jq --argjson compute $compute '.genesis.runtime.glutton.compute = $compute' \ + | jq --argjson storage $storage '.genesis.runtime.glutton.storage = $storage' \ + | jq --argjson trash_data_count $trash_data_count '.genesis.runtime.glutton.trashDataCount = $trash_data_count' \ + > $output_para_dir/glutton-$relay_chain-$para_id-spec.json + + # build a raw spec + $binary_path build-spec --disable-default-bootnode --chain "$output_para_dir/glutton-$relay_chain-$para_id-spec.json" --raw > "$output_para_dir/glutton-$relay_chain-$para_id-raw-spec.json" + + # build genesis data + $binary_path export-genesis-state --chain "$output_para_dir/glutton-$relay_chain-$para_id-raw-spec.json" > "$output_para_dir/glutton-$relay_chain-$para_id-head-data" + + # build genesis wasm + $binary_path export-genesis-wasm --chain "$output_para_dir/glutton-$relay_chain-$para_id-raw-spec.json" > "$output_para_dir/glutton-$relay_chain-$para_id-validation-code" + + rm "$output_para_dir/plain-glutton-$relay_chain-$para_id-spec.json" +done diff --git a/scripts/generate_hex_encoded_call/index.js b/scripts/generate_hex_encoded_call/index.js index 60cf6451bd4..25e094df905 100644 --- a/scripts/generate_hex_encoded_call/index.js +++ b/scripts/generate_hex_encoded_call/index.js @@ -17,6 +17,7 @@ async function connect(endpoint, types = {}) { function writeHexEncodedBytesToOutput(method, outputFile) { console.log("Payload (hex): ", method.toHex()); console.log("Payload (bytes): ", Array.from(method.toU8a())); + console.log("Payload (plain): ", JSON.stringify(method)); fs.writeFileSync(outputFile, JSON.stringify(Array.from(method.toU8a()))); } @@ -91,6 +92,7 @@ function removeExporterConfig(endpoint, outputFile, bridgedNetwork) { } function forceCreateAsset(endpoint, outputFile, assetId, assetOwnerAccountId, isSufficient, minBalance) { + var isSufficient = isSufficient == "true" ? true : false; console.log(`Generating forceCreateAsset from RPC endpoint: ${endpoint} to outputFile: ${outputFile} based on assetId: ${assetId}, assetOwnerAccountId: ${assetOwnerAccountId}, isSufficient: ${isSufficient}, minBalance: ${minBalance}`); connect(endpoint) .then((api) => { @@ -110,33 +112,33 @@ if (!process.argv[2] || !process.argv[3]) { } const type = process.argv[2]; -const rpcEndpoint = process.argv[3]; +const rpcEnpoint = process.argv[3]; const output = process.argv[4]; const inputArgs = process.argv.slice(5, process.argv.length); console.log(`Generating hex-encoded call data for:`); console.log(` type: ${type}`); -console.log(` rpcEndpoint: ${rpcEndpoint}`); +console.log(` rpcEnpoint: ${rpcEnpoint}`); console.log(` output: ${output}`); console.log(` inputArgs: ${inputArgs}`); switch (type) { case 'remark-with-event': - remarkWithEvent(rpcEndpoint, output); + remarkWithEvent(rpcEnpoint, output); break; case 'add-exporter-config': - addExporterConfig(rpcEndpoint, output, inputArgs[0], inputArgs[1]); + addExporterConfig(rpcEnpoint, output, inputArgs[0], inputArgs[1]); break; case 'remove-exporter-config': - removeExporterConfig(rpcEndpoint, output, inputArgs[0], inputArgs[1]); + removeExporterConfig(rpcEnpoint, output, inputArgs[0], inputArgs[1]); break; case 'add-universal-alias': - addUniversalAlias(rpcEndpoint, output, inputArgs[0], inputArgs[1]); + addUniversalAlias(rpcEnpoint, output, inputArgs[0], inputArgs[1]); break; case 'add-reserve-location': - addReserveLocation(rpcEndpoint, output, inputArgs[0]); + addReserveLocation(rpcEnpoint, output, inputArgs[0]); break; case 'force-create-asset': - forceCreateAsset(rpcEndpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]); + forceCreateAsset(rpcEnpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]); break; case 'check': console.log(`Checking nodejs installation, if you see this everything is ready!`); diff --git a/scripts/scale_encode_genesis/index.js b/scripts/scale_encode_genesis/index.js index e11289e7844..f612e6da79d 100644 --- a/scripts/scale_encode_genesis/index.js +++ b/scripts/scale_encode_genesis/index.js @@ -26,7 +26,7 @@ if (!process.argv[2] || !process.argv[3]) { const input = process.argv[2]; const output = process.argv[3]; // default to localhost and the default Substrate port -const rpcEndpoint = process.argv[4] || "ws://localhost:9944"; +const rpcEnpoint = process.argv[4] || "ws://localhost:9944"; console.log("Processing", input, output); fs.readFile(input, "utf8", (err, data) => { @@ -38,8 +38,8 @@ fs.readFile(input, "utf8", (err, data) => { const genesis = JSON.parse(data); console.log("loaded genesis, length = ", genesis.length); - console.log(`Connecting to RPC endpoint: ${rpcEndpoint}`); - connect(rpcEndpoint) + console.log(`Connecting to RPC endpoint: ${rpcEnpoint}`); + connect(rpcEnpoint) .then((api) => { console.log('Connected'); const setStorage = api.tx.system.setStorage(genesis); diff --git a/test/client/src/block_builder.rs b/test/client/src/block_builder.rs index 13b20df6be6..0c0c5c4e9c7 100644 --- a/test/client/src/block_builder.rs +++ b/test/client/src/block_builder.rs @@ -64,13 +64,13 @@ pub trait InitBlockBuilder { ) -> sc_block_builder::BlockBuilder; } -fn init_block_builder<'a>( - client: &'a Client, +fn init_block_builder( + client: &Client, at: Hash, validation_data: Option>, relay_sproof_builder: RelayStateSproofBuilder, timestamp: u64, -) -> BlockBuilder<'a, Block, Client, Backend> { +) -> BlockBuilder<'_, Block, Client, Backend> { let mut block_builder = client .new_block_at(at, Default::default(), true) .expect("Creates new block builder for test runtime"); diff --git a/test/client/src/lib.rs b/test/client/src/lib.rs index 4008dca350d..cbf0459b816 100644 --- a/test/client/src/lib.rs +++ b/test/client/src/lib.rs @@ -183,7 +183,7 @@ pub fn validate_block( let heap_pages = HeapAllocStrategy::Static { extra_pages: 1024 }; let executor = WasmExecutor::::builder() - .with_execution_method(WasmExecutionMethod::Interpreted) + .with_execution_method(WasmExecutionMethod::default()) .with_max_runtime_instances(1) .with_runtime_cache_size(2) .with_onchain_heap_alloc_strategy(heap_pages) @@ -199,5 +199,4 @@ pub fn validate_block( &validation_params.encode(), ) .map(|v| ValidationResult::decode(&mut &v[..]).expect("Decode `ValidationResult`.")) - .map_err(|err| err.into()) } diff --git a/test/relay-sproof-builder/src/lib.rs b/test/relay-sproof-builder/src/lib.rs index decc6ee3aa0..fd98899ed3b 100644 --- a/test/relay-sproof-builder/src/lib.rs +++ b/test/relay-sproof-builder/src/lib.rs @@ -38,7 +38,7 @@ pub struct RelayStateSproofBuilder { pub host_config: AbridgedHostConfiguration, pub dmq_mqc_head: Option, pub upgrade_go_ahead: Option, - pub relay_dispatch_queue_size: Option<(u32, u32)>, + pub relay_dispatch_queue_remaining_capacity: Option<(u32, u32)>, pub hrmp_ingress_channel_index: Option>, pub hrmp_egress_channel_index: Option>, pub hrmp_channels: BTreeMap, @@ -65,7 +65,7 @@ impl Default for RelayStateSproofBuilder { }, dmq_mqc_head: None, upgrade_go_ahead: None, - relay_dispatch_queue_size: None, + relay_dispatch_queue_remaining_capacity: None, hrmp_ingress_channel_index: None, hrmp_egress_channel_index: None, hrmp_channels: BTreeMap::new(), @@ -124,9 +124,12 @@ impl RelayStateSproofBuilder { dmq_mqc_head.encode(), ); } - if let Some(relay_dispatch_queue_size) = self.relay_dispatch_queue_size { + if let Some(relay_dispatch_queue_size) = self.relay_dispatch_queue_remaining_capacity { insert( - relay_chain::well_known_keys::relay_dispatch_queue_size(self.para_id), + relay_chain::well_known_keys::relay_dispatch_queue_remaining_capacity( + self.para_id, + ) + .key, relay_dispatch_queue_size.encode(), ); } @@ -171,7 +174,7 @@ impl RelayStateSproofBuilder { } } - let root = backend.root().clone(); + let root = *backend.root(); let proof = sp_state_machine::prove_read(backend, relevant_keys).expect("prove read"); (root, proof) } diff --git a/test/relay-validation-worker-provider/Cargo.toml b/test/relay-validation-worker-provider/Cargo.toml index e8cc1f16b9f..ea4587b2c7c 100644 --- a/test/relay-validation-worker-provider/Cargo.toml +++ b/test/relay-validation-worker-provider/Cargo.toml @@ -8,7 +8,7 @@ build = "build.rs" [dependencies] # Polkadot -polkadot-node-core-pvf-worker = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" } [build-dependencies] -toml = "0.7.3" +toml = "0.7.4" diff --git a/test/relay-validation-worker-provider/build.rs b/test/relay-validation-worker-provider/build.rs index d2c894ac89d..9b5247bcbe5 100644 --- a/test/relay-validation-worker-provider/build.rs +++ b/test/relay-validation-worker-provider/build.rs @@ -97,7 +97,7 @@ fn create_project(out_dir: &Path) -> PathBuf { fs::write( project_dir.join("src").join("main.rs"), r#" - cumulus_test_relay_validation_worker_provider::polkadot_node_core_pvf_worker::decl_puppet_worker_main!(); + cumulus_test_relay_validation_worker_provider::polkadot_node_core_pvf::decl_puppet_worker_main!(); "#, ) .expect("Writes `main.rs`"); diff --git a/test/relay-validation-worker-provider/src/lib.rs b/test/relay-validation-worker-provider/src/lib.rs index ccb896a276e..840214eb3c0 100644 --- a/test/relay-validation-worker-provider/src/lib.rs +++ b/test/relay-validation-worker-provider/src/lib.rs @@ -21,7 +21,7 @@ //! //! !!This should only be used for tests!! -pub use polkadot_node_core_pvf_worker; +pub use polkadot_node_core_pvf; /// The path to the validation worker. pub const VALIDATION_WORKER: &str = concat!(env!("OUT_DIR"), "/validation-worker"); diff --git a/test/runtime/Cargo.toml b/test/runtime/Cargo.toml index cbba13e1a93..6f829c27492 100644 --- a/test/runtime/Cargo.toml +++ b/test/runtime/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.7.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/test/runtime/src/lib.rs b/test/runtime/src/lib.rs index 9d7e9f078da..7633da1ea54 100644 --- a/test/runtime/src/lib.rs +++ b/test/runtime/src/lib.rs @@ -244,7 +244,7 @@ impl pallet_balances::Config for Runtime { type MaxLocks = (); type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); + type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; @@ -262,6 +262,7 @@ impl pallet_transaction_payment::Config for Runtime { impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_sudo::weights::SubstrateWeight; } impl cumulus_pallet_parachain_system::Config for Runtime { diff --git a/test/service/Cargo.toml b/test/service/Cargo.toml index d36ae55688d..1ad45f57fa1 100644 --- a/test/service/Cargo.toml +++ b/test/service/Cargo.toml @@ -10,13 +10,13 @@ path = "src/main.rs" [dependencies] async-trait = "0.1.68" -clap = { version = "4.2.7", features = ["derive"] } +clap = { version = "4.3.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } -criterion = { version = "0.4.0", features = [ "async_tokio" ] } +criterion = { version = "0.5.1", features = [ "async_tokio" ] } jsonrpsee = { version = "0.16.2", features = ["server"] } rand = "0.8.5" -serde = { version = "1.0.160", features = ["derive"] } -tokio = { version = "1.28.0", features = ["macros"] } +serde = { version = "1.0.163", features = ["derive"] } +tokio = { version = "1.28.1", features = ["macros"] } tracing = "0.1.37" url = "2.3.1" diff --git a/test/service/benches/transaction_throughput.rs b/test/service/benches/transaction_throughput.rs index 1c3f841fe23..48bf49487e6 100644 --- a/test/service/benches/transaction_throughput.rs +++ b/test/service/benches/transaction_throughput.rs @@ -46,7 +46,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec accounts .iter() .enumerate() - .map(|(i, a)| { + .flat_map(|(i, a)| { vec![ // Reset the nonce by removing any funds construct_extrinsic( @@ -54,7 +54,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec SudoCall::sudo { call: Box::new( BalancesCall::force_set_balance { - who: AccountId::from(a.public()).into(), + who: AccountId::from(a.public()), new_free: 0, } .into(), @@ -69,7 +69,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec SudoCall::sudo { call: Box::new( BalancesCall::force_set_balance { - who: AccountId::from(a.public()).into(), + who: AccountId::from(a.public()), new_free: 1_000_000_000_000 * ExistentialDeposit::get(), } .into(), @@ -80,7 +80,6 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec ), ] }) - .flatten() .map(OpaqueExtrinsic::from) .collect() } @@ -92,20 +91,19 @@ fn create_benchmark_extrinsics( ) -> Vec { accounts .iter() - .map(|account| { + .flat_map(|account| { (0..extrinsics_per_account).map(move |nonce| { construct_extrinsic( client, BalancesCall::transfer_allow_death { - dest: Bob.to_account_id().into(), - value: 1 * ExistentialDeposit::get(), + dest: Bob.to_account_id(), + value: ExistentialDeposit::get(), }, account.clone(), Some(nonce as u32), ) }) }) - .flatten() .map(OpaqueExtrinsic::from) .collect() } @@ -208,27 +206,27 @@ fn transaction_throughput_benchmarks(c: &mut Criterion) { |b| { b.iter_batched( || { - let prepare_extrinsics = create_account_extrinsics(&*dave.client, &accounts); + let prepare_extrinsics = create_account_extrinsics(&dave.client, &accounts); benchmark_handle.block_on(future::join_all( prepare_extrinsics.into_iter().map(|tx| { submit_tx_and_wait_for_inclusion( &dave.transaction_pool, tx, - &*dave.client, + &dave.client, true, ) }), )); - create_benchmark_extrinsics(&*dave.client, &accounts, extrinsics_per_account) + create_benchmark_extrinsics(&dave.client, &accounts, extrinsics_per_account) }, |extrinsics| { benchmark_handle.block_on(future::join_all(extrinsics.into_iter().map(|tx| { submit_tx_and_wait_for_inclusion( &dave.transaction_pool, tx, - &*dave.client, + &dave.client, false, ) }))); diff --git a/test/service/src/chain_spec.rs b/test/service/src/chain_spec.rs index e1399e97a36..5ae77084b6c 100644 --- a/test/service/src/chain_spec.rs +++ b/test/service/src/chain_spec.rs @@ -39,7 +39,7 @@ pub struct GenesisExt { impl sp_runtime::BuildStorage for GenesisExt { fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> { sp_state_machine::BasicExternalities::execute_with_storage(storage, || { - sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &vec![1, 2, 3, 4]); + sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &[1, 2, 3, 4]); cumulus_test_runtime::ParachainId::set(&self.para_id); }); @@ -125,7 +125,6 @@ fn testnet_genesis( code: cumulus_test_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), - ..Default::default() }, parachain_system: Default::default(), balances: cumulus_test_runtime::BalancesConfig { diff --git a/test/service/src/cli.rs b/test/service/src/cli.rs index 3cf99496576..0b7084e1abd 100644 --- a/test/service/src/cli.rs +++ b/test/service/src/cli.rs @@ -117,8 +117,12 @@ impl RelayChainCli { para_config: &sc_service::Configuration, relay_chain_args: impl Iterator, ) -> Self { - let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot")); - Self { base_path, chain_id: None, base: clap::Parser::parse_from(relay_chain_args) } + let base_path = para_config.base_path.path().join("polkadot"); + Self { + base_path: Some(base_path), + chain_id: None, + base: clap::Parser::parse_from(relay_chain_args), + } } } @@ -146,16 +150,8 @@ impl CliConfiguration for RelayChainCli { .or_else(|| self.base_path.clone().map(Into::into))) } - fn rpc_http(&self, default_listen_port: u16) -> CliResult> { - self.base.base.rpc_http(default_listen_port) - } - - fn rpc_ipc(&self) -> CliResult> { - self.base.base.rpc_ipc() - } - - fn rpc_ws(&self, default_listen_port: u16) -> CliResult> { - self.base.base.rpc_ws(default_listen_port) + fn rpc_addr(&self, default_listen_port: u16) -> CliResult> { + self.base.base.rpc_addr(default_listen_port) } fn prometheus_config( @@ -204,8 +200,8 @@ impl CliConfiguration for RelayChainCli { self.base.base.rpc_methods() } - fn rpc_ws_max_connections(&self) -> CliResult> { - self.base.base.rpc_ws_max_connections() + fn rpc_max_connections(&self) -> CliResult { + self.base.base.rpc_max_connections() } fn rpc_cors(&self, is_dev: bool) -> CliResult>> { @@ -249,14 +245,10 @@ impl DefaultConfigurationValues for RelayChainCli { 30334 } - fn rpc_ws_listen_port() -> u16 { + fn rpc_listen_port() -> u16 { 9945 } - fn rpc_http_listen_port() -> u16 { - 9934 - } - fn prometheus_listen_port() -> u16 { 9616 } diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index 84d5636f9b1..c97339f7fe9 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -54,7 +54,8 @@ use polkadot_service::ProvideRuntimeApi; use sc_client_api::execution_extensions::ExecutionStrategies; use sc_consensus::ImportQueue; use sc_network::{ - config::TransportConfig, multiaddr, NetworkBlock, NetworkService, NetworkStateInfo, + config::{FullNetworkConfiguration, TransportConfig}, + multiaddr, NetworkBlock, NetworkService, NetworkStateInfo, }; use sc_service::{ config::{ @@ -323,9 +324,12 @@ where .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; let import_queue_service = params.import_queue.service(); + let net_config = FullNetworkConfiguration::new(¶chain_config.network); + let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = build_network(BuildNetworkParams { parachain_config: ¶chain_config, + net_config, client: client.clone(), transaction_pool: transaction_pool.clone(), para_id, @@ -630,7 +634,7 @@ impl TestNodeBuilder { let parachain_config = node_config( self.storage_update_func_parachain.unwrap_or_else(|| Box::new(|| ())), self.tokio_handle.clone(), - self.key.clone(), + self.key, self.parachain_nodes, self.parachain_nodes_exclusive, self.para_id, @@ -667,7 +671,7 @@ impl TestNodeBuilder { .await .expect("could not create Cumulus test service"); - let peer_id = network.local_peer_id().clone(); + let peer_id = network.local_peer_id(); let addr = MultiaddrWithPeerId { multiaddr, peer_id }; TestNode { task_manager, client, network, addr, rpc_handlers, transaction_pool } @@ -690,7 +694,7 @@ pub fn node_config( is_collator: bool, ) -> Result { let base_path = BasePath::new_temp_dir()?; - let root = base_path.path().join(format!("cumulus_test_service_{}", key.to_string())); + let root = base_path.path().join(format!("cumulus_test_service_{}", key)); let role = if is_collator { Role::Authority } else { Role::Full }; let key_seed = key.to_seed(); let mut spec = Box::new(chain_spec::get_chain_spec(para_id)); @@ -736,7 +740,7 @@ pub fn node_config( state_pruning: Some(PruningMode::ArchiveAll), blocks_pruning: BlocksPruning::KeepAll, chain_spec: spec, - wasm_method: WasmExecutionMethod::Interpreted, + wasm_method: WasmExecutionMethod::default(), // NOTE: we enforce the use of the native runtime to make the errors more debuggable execution_strategies: ExecutionStrategies { syncing: sc_client_api::ExecutionStrategy::NativeWhenPossible, @@ -745,18 +749,15 @@ pub fn node_config( offchain_worker: sc_client_api::ExecutionStrategy::NativeWhenPossible, other: sc_client_api::ExecutionStrategy::NativeWhenPossible, }, - rpc_http: None, - rpc_ws: None, - rpc_ipc: None, - rpc_ws_max_connections: None, + rpc_addr: None, + rpc_max_connections: Default::default(), rpc_cors: None, rpc_methods: Default::default(), - rpc_max_payload: None, - rpc_max_request_size: None, - rpc_max_response_size: None, + rpc_max_request_size: Default::default(), + rpc_max_response_size: Default::default(), rpc_id_provider: None, - rpc_max_subs_per_conn: None, - ws_max_out_buffer_capacity: None, + rpc_max_subs_per_conn: Default::default(), + rpc_port: 9945, prometheus_config: None, telemetry_endpoints: None, default_heap_pages: None, @@ -768,7 +769,8 @@ pub fn node_config( tracing_receiver: Default::default(), max_runtime_instances: 8, announce_block: true, - base_path: Some(base_path), + data_path: root, + base_path, informant_output_format: Default::default(), wasm_runtime_overrides: None, runtime_cache_size: 2, @@ -789,7 +791,7 @@ impl TestNode { function: impl Into, caller: Sr25519Keyring, ) -> Result { - let extrinsic = construct_extrinsic(&*self.client, function, caller.pair(), Some(0)); + let extrinsic = construct_extrinsic(&self.client, function, caller.pair(), Some(0)); self.rpc_handlers.send_transaction(extrinsic.into()).await } @@ -871,7 +873,7 @@ pub fn run_relay_chain_validator_node( key: Sr25519Keyring, storage_update_func: impl Fn(), boot_nodes: Vec, - websocket_port: Option, + port: Option, ) -> polkadot_test_service::PolkadotTestNode { let mut config = polkadot_test_service::node_config( storage_update_func, @@ -881,8 +883,8 @@ pub fn run_relay_chain_validator_node( true, ); - if let Some(port) = websocket_port { - config.rpc_ws = Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port)); + if let Some(port) = port { + config.rpc_addr = Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port)); } polkadot_test_service::run_validator_node( diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml new file mode 100644 index 00000000000..dbbf07be098 --- /dev/null +++ b/xcm/xcm-emulator/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "xcm-emulator" +description = "Test kit to emulate XCM program execution." +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2021" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0" } +paste = "1.0.5" +quote = "1.0.28" +casey = "0.4.0" +log = { version = "0.4.17", default-features = false } + +frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-message-queue = { git = "https://github.com/paritytech/substrate", branch = "master" } + +cumulus-primitives-core = { path = "../../primitives/core"} +cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue" } +cumulus-pallet-dmp-queue = { path = "../../pallets/dmp-queue" } +cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system" } +cumulus-test-service = { path = "../../test/service" } +parachain-info = { path = "../../parachains/pallets/parachain-info" } +cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" } +cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder" } +parachains-common = { path = "../../parachains/common" } + +xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/xcm/xcm-emulator/README.md b/xcm/xcm-emulator/README.md new file mode 100644 index 00000000000..aa1bd3d5406 --- /dev/null +++ b/xcm/xcm-emulator/README.md @@ -0,0 +1,23 @@ +# xcm-emulator + +XCM-Emulator is a tool to emulate XCM program execution using +pre-configured runtimes, including those used to run on live +networks, such as Kusama, Polkadot, Statemine et cetera. +This allows for testing cross-chain message passing and verifying +outcomes, weights, and side-effects. It is faster than spinning up +a zombienet and as all the chains are in one process debugging using Clion is easy. + +## Limitations + +As the messages do not physically go through the same messaging infrastructure +there is some code that is not being tested compared to using slower E2E tests. +In future it may be possible to run these XCM emulated tests as E2E tests (without changes). + +As well as the XCM message transport being mocked out, so too are areas around consensus, +in particular things like disputes, staking and iamonline events can't be tested. + +## Alternatives + +If you just wish to test execution of various XCM instructions +against the XCM VM then the `xcm-simulator` (in the polkadot +repo) is the perfect tool for this. diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs new file mode 100644 index 00000000000..a31d7c5b7e5 --- /dev/null +++ b/xcm/xcm-emulator/src/lib.rs @@ -0,0 +1,957 @@ +// Copyright 2023 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 . + +pub use casey::pascal; +pub use codec::Encode; +pub use frame_support::{ + sp_runtime::BuildStorage, + traits::{EnqueueMessage, Get, Hooks, ProcessMessage, ProcessMessageError, ServiceQueues}, + weights::{Weight, WeightMeter}, +}; +pub use frame_system::AccountInfo; +pub use log; +pub use pallet_balances::AccountData; +pub use paste; +pub use sp_arithmetic::traits::Bounded; +pub use sp_core::storage::Storage; +pub use sp_io; +pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData}; +pub use sp_trie::StorageProof; + +pub use cumulus_pallet_dmp_queue; +pub use cumulus_pallet_parachain_system; +pub use cumulus_pallet_xcmp_queue; +pub use cumulus_primitives_core::{ + self, relay_chain::BlockNumber as RelayBlockNumber, DmpMessageHandler, ParaId, + PersistedValidationData, XcmpMessageHandler, +}; +pub use cumulus_primitives_parachain_inherent::ParachainInherentData; +pub use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; +pub use cumulus_test_service::get_account_id_from_seed; +pub use pallet_message_queue; +pub use parachain_info; +pub use parachains_common::{AccountId, BlockNumber}; + +pub use polkadot_primitives; +pub use polkadot_runtime_parachains::{ + dmp, + inclusion::{AggregateMessageOrigin, UmpQueueId}, +}; +pub use std::{collections::HashMap, thread::LocalKey}; +pub use xcm::{v3::prelude::*, VersionedXcm}; +pub use xcm_executor::XcmExecutor; + +thread_local! { + /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` + #[allow(clippy::type_complexity)] + pub static DOWNWARD_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); + /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` + #[allow(clippy::type_complexity)] + pub static DMP_DONE: RefCell)>>> + = RefCell::new(HashMap::new()); + /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` + #[allow(clippy::type_complexity)] + pub static HORIZONTAL_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); + /// Upward messages, each message is: `(from_para_id, msg) + pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); + /// Global incremental relay chain block number + pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); + /// Parachains Ids a the Network + pub static PARA_IDS: RefCell>> = RefCell::new(HashMap::new()); + /// Flag indicating if global variables have been initialized for a certain Network + pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); +} + +pub trait TestExt { + fn build_new_ext(storage: Storage) -> sp_io::TestExternalities; + fn new_ext() -> sp_io::TestExternalities; + fn reset_ext(); + fn execute_with(execute: impl FnOnce() -> R) -> R; + fn ext_wrapper(func: impl FnOnce() -> R) -> R; +} + +pub trait Network { + fn _init(); + fn _para_ids() -> Vec; + fn _relay_block_number() -> u32; + fn _set_relay_block_number(block_number: u32); + fn _process_messages(); + fn _has_unprocessed_messages() -> bool; + fn _process_downward_messages(); + fn _process_horizontal_messages(); + fn _process_upward_messages(); + fn _hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData; +} + +pub trait NetworkComponent { + fn network_name() -> &'static str; + + fn init() { + N::_init(); + } + + fn relay_block_number() -> u32 { + N::_relay_block_number() + } + + fn set_relay_block_number(block_number: u32) { + N::_set_relay_block_number(block_number); + } + + fn para_ids() -> Vec { + N::_para_ids() + } + + fn send_horizontal_messages)>>( + to_para_id: u32, + iter: I, + ) { + HORIZONTAL_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((to_para_id, iter.collect())) + }); + } + + fn send_upward_message(from_para_id: u32, msg: Vec) { + UPWARD_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((from_para_id, msg)) + }); + } + + fn send_downward_messages( + to_para_id: u32, + iter: impl Iterator)>, + ) { + DOWNWARD_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((to_para_id, iter.collect())) + }); + } + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData { + N::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) + } + + fn process_messages() { + N::_process_messages(); + } +} + +pub trait RelayChain: ProcessMessage { + type Runtime; + type RuntimeOrigin; + type RuntimeCall; + type RuntimeEvent; + type XcmConfig; + type SovereignAccountOf; + type System; + type Balances; +} + +pub trait Parachain: XcmpMessageHandler + DmpMessageHandler { + type Runtime; + type RuntimeOrigin; + type RuntimeCall; + type RuntimeEvent; + type XcmpMessageHandler; + type DmpMessageHandler; + type LocationToAccountId; + type System; + type Balances; + type ParachainSystem; + type ParachainInfo; +} + +// Relay Chain Implementation +#[macro_export] +macro_rules! decl_test_relay_chains { + ( + $( + pub struct $name:ident { + genesis = $genesis:expr, + on_init = $on_init:expr, + runtime = { + Runtime: $runtime:path, + RuntimeOrigin: $runtime_origin:path, + RuntimeCall: $runtime_call:path, + RuntimeEvent: $runtime_event:path, + MessageQueue: $mq:path, + XcmConfig: $xcm_config:path, + SovereignAccountOf: $sovereign_acc_of:path, + System: $system:path, + Balances: $balances:path, + }, + pallets_extra = { + $($pallet_name:ident: $pallet_path:path,)* + } + } + ), + + + ) => { + $( + pub struct $name; + + impl RelayChain for $name { + type Runtime = $runtime; + type RuntimeOrigin = $runtime_origin; + type RuntimeCall = $runtime_call; + type RuntimeEvent = $runtime_event; + type XcmConfig = $xcm_config; + type SovereignAccountOf = $sovereign_acc_of; + type System = $system; + type Balances = $balances; + } + + $crate::paste::paste! { + pub trait [<$name Pallet>] { + $( + type $pallet_name; + )? + } + + impl [<$name Pallet>] for $name { + $( + type $pallet_name = $pallet_path; + )? + } + } + + impl $crate::ProcessMessage for $name { + type Origin = $crate::ParaId; + + fn process_message( + msg: &[u8], + para: Self::Origin, + meter: &mut $crate::WeightMeter, + _id: &mut XcmHash + ) -> Result { + use $crate::{Weight, AggregateMessageOrigin, UmpQueueId, ServiceQueues, EnqueueMessage}; + use $mq as message_queue; + use $runtime_event as runtime_event; + + Self::execute_with(|| { + <$mq as EnqueueMessage>::enqueue_message( + msg.try_into().expect("Message too long"), + AggregateMessageOrigin::Ump(UmpQueueId::Para(para.clone())) + ); + + <$system>::reset_events(); + <$mq as ServiceQueues>::service_queues(Weight::MAX); + let events = <$system>::events(); + let event = events.last().expect("There must be at least one event"); + + match &event.event { + runtime_event::MessageQueue( + $crate::pallet_message_queue::Event::Processed {origin, ..}) => { + assert_eq!(origin, &AggregateMessageOrigin::Ump(UmpQueueId::Para(para))); + }, + event => panic!("Unexpected event: {:#?}", event), + } + Ok(true) + }) + } + } + + $crate::__impl_test_ext_for_relay_chain!($name, $genesis, $on_init); + )+ + }; +} + +#[macro_export] +macro_rules! __impl_test_ext_for_relay_chain { + // entry point: generate ext name + ($name:ident, $genesis:expr, $on_init:expr) => { + $crate::paste::paste! { + $crate::__impl_test_ext_for_relay_chain!(@impl $name, $genesis, $on_init, []); + } + }; + // impl + (@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => { + thread_local! { + pub static $ext_name: $crate::RefCell<$crate::sp_io::TestExternalities> + = $crate::RefCell::new(<$name>::build_new_ext($genesis)); + } + + impl TestExt for $name { + fn build_new_ext(storage: $crate::Storage) -> $crate::sp_io::TestExternalities { + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| { + #[allow(clippy::no_effect)] + $on_init; + sp_tracing::try_init_simple(); + ::System::set_block_number(1); + }); + ext + } + + fn new_ext() -> $crate::sp_io::TestExternalities { + <$name>::build_new_ext($genesis) + } + + fn reset_ext() { + $ext_name.with(|v| *v.borrow_mut() = <$name>::build_new_ext($genesis)); + } + + fn execute_with(execute: impl FnOnce() -> R) -> R { + use $crate::{NetworkComponent}; + // Make sure the Network is initialized + <$name>::init(); + + let r = $ext_name.with(|v| v.borrow_mut().execute_with(execute)); + + // send messages if needed + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + use $crate::polkadot_primitives::runtime_api::runtime_decl_for_parachain_host::ParachainHostV4; + + //TODO: mark sent count & filter out sent msg + for para_id in <$name>::para_ids() { + // downward messages + let downward_messages = ::Runtime::dmq_contents(para_id.into()) + .into_iter() + .map(|inbound| (inbound.sent_at, inbound.msg)); + if downward_messages.len() == 0 { + continue; + } + <$name>::send_downward_messages(para_id, downward_messages.into_iter()); + + // Note: no need to handle horizontal messages, as the + // simulator directly sends them to dest (not relayed). + } + }) + }); + + <$name>::process_messages(); + + r + } + + fn ext_wrapper(func: impl FnOnce() -> R) -> R { + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + func() + }) + }) + } + } + }; +} + +#[macro_export] +macro_rules! __impl_relay { + ($network_name:ident, $relay_chain:ty) => { + impl $crate::NetworkComponent<$network_name> for $relay_chain { + fn network_name() -> &'static str { + stringify!($network_name) + } + } + + impl $relay_chain { + pub fn child_location_of(id: $crate::ParaId) -> MultiLocation { + (Ancestor(0), Parachain(id.into())).into() + } + + pub fn account_id_of(seed: &str) -> $crate::AccountId { + $crate::get_account_id_from_seed::(seed) + } + + pub fn account_data_of(account: AccountId) -> $crate::AccountData { + Self::ext_wrapper(|| ::System::account(account).data) + } + + pub fn sovereign_account_id_of(location: $crate::MultiLocation) -> $crate::AccountId { + ::SovereignAccountOf::convert(location.into()).unwrap() + } + + pub fn fund_accounts(accounts: Vec<(AccountId, Balance)>) { + Self::ext_wrapper(|| { + for account in accounts { + let _ = ::Balances::force_set_balance( + ::RuntimeOrigin::root(), + account.0.into(), + account.1.into(), + ); + } + }); + } + + pub fn events() -> Vec<::RuntimeEvent> { + ::System::events() + .iter() + .map(|record| record.event.clone()) + .collect() + } + } + }; +} + +// Parachain Implementation +#[macro_export] +macro_rules! decl_test_parachains { + ( + $( + pub struct $name:ident { + genesis = $genesis:expr, + on_init = $on_init:expr, + runtime = { + Runtime: $runtime:path, + RuntimeOrigin: $runtime_origin:path, + RuntimeCall: $runtime_call:path, + RuntimeEvent: $runtime_event:path, + XcmpMessageHandler: $xcmp_message_handler:path, + DmpMessageHandler: $dmp_message_handler:path, + LocationToAccountId: $location_to_account:path, + System: $system:path, + Balances: $balances_pallet:path, + ParachainSystem: $parachain_system:path, + ParachainInfo: $parachain_info:path, + }, + pallets_extra = { + $($pallet_name:ident: $pallet_path:path,)* + } + } + ), + + + ) => { + $( + pub struct $name; + + impl Parachain for $name { + type Runtime = $runtime; + type RuntimeOrigin = $runtime_origin; + type RuntimeCall = $runtime_call; + type RuntimeEvent = $runtime_event; + type XcmpMessageHandler = $xcmp_message_handler; + type DmpMessageHandler = $dmp_message_handler; + type LocationToAccountId = $location_to_account; + type System = $system; + type Balances = $balances_pallet; + type ParachainSystem = $parachain_system; + type ParachainInfo = $parachain_info; + } + + $crate::paste::paste! { + pub trait [<$name Pallet>] { + $( + type $pallet_name; + )* + } + + impl [<$name Pallet>] for $name { + $( + type $pallet_name = $pallet_path; + )* + } + } + + $crate::__impl_xcm_handlers_for_parachain!($name); + $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init); + )+ + }; +} + +#[macro_export] +macro_rules! __impl_xcm_handlers_for_parachain { + ($name:ident) => { + impl $crate::XcmpMessageHandler for $name { + fn handle_xcmp_messages< + 'a, + I: Iterator, + >( + iter: I, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{TestExt, XcmpMessageHandler}; + + $name::execute_with(|| { + ::XcmpMessageHandler::handle_xcmp_messages(iter, max_weight) + }) + } + } + + impl $crate::DmpMessageHandler for $name { + fn handle_dmp_messages( + iter: impl Iterator)>, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{DmpMessageHandler, TestExt}; + + $name::execute_with(|| { + ::DmpMessageHandler::handle_dmp_messages(iter, max_weight) + }) + } + } + }; +} + +#[macro_export] +macro_rules! __impl_test_ext_for_parachain { + // entry point: generate ext name + ($name:ident, $genesis:expr, $on_init:expr) => { + $crate::paste::paste! { + $crate::__impl_test_ext_for_parachain!(@impl $name, $genesis, $on_init, []); + } + }; + // impl + (@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => { + thread_local! { + pub static $ext_name: $crate::RefCell<$crate::sp_io::TestExternalities> + = $crate::RefCell::new(<$name>::build_new_ext($genesis)); + } + + impl TestExt for $name { + fn build_new_ext(storage: $crate::Storage) -> $crate::sp_io::TestExternalities { + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| { + #[allow(clippy::no_effect)] + $on_init; + sp_tracing::try_init_simple(); + ::System::set_block_number(1); + }); + ext + } + + fn new_ext() -> $crate::sp_io::TestExternalities { + <$name>::build_new_ext($genesis) + } + + fn reset_ext() { + $ext_name.with(|v| *v.borrow_mut() = <$name>::build_new_ext($genesis)); + } + + fn execute_with(execute: impl FnOnce() -> R) -> R { + use $crate::{Get, Hooks, NetworkComponent}; + + // Make sure the Network is initialized + <$name>::init(); + + let mut relay_block_number = <$name>::relay_block_number(); + relay_block_number += 1; + <$name>::set_relay_block_number(relay_block_number); + + let para_id = <$name>::para_id().into(); + + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + // Make sure it has been recorded properly + let relay_block_number = <$name>::relay_block_number(); + let _ = ::ParachainSystem::set_validation_data( + ::RuntimeOrigin::none(), + <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), + ); + }) + }); + + + let r = $ext_name.with(|v| v.borrow_mut().execute_with(execute)); + + // send messages if needed + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + use sp_runtime::traits::Header as HeaderT; + + let block_number = ::System::block_number(); + let mock_header = HeaderT::new( + 0, + Default::default(), + Default::default(), + Default::default(), + Default::default(), + ); + + // get messages + ::ParachainSystem::on_finalize(block_number); + let collation_info = ::ParachainSystem::collect_collation_info(&mock_header); + + // send upward messages + let relay_block_number = <$name>::relay_block_number(); + for msg in collation_info.upward_messages.clone() { + <$name>::send_upward_message(para_id, msg); + } + + // send horizontal messages + for msg in collation_info.horizontal_messages { + <$name>::send_horizontal_messages( + msg.recipient.into(), + vec![(para_id.into(), relay_block_number, msg.data)].into_iter(), + ); + } + + // clean messages + ::ParachainSystem::on_initialize(block_number); + }) + }); + + <$name>::process_messages(); + + r + } + + fn ext_wrapper(func: impl FnOnce() -> R) -> R { + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + func() + }) + }) + } + } + }; +} + +#[macro_export] +macro_rules! __impl_parachain { + ($network_name:ident, $parachain:ty) => { + impl $crate::NetworkComponent<$network_name> for $parachain { + fn network_name() -> &'static str { + stringify!($network_name) + } + } + + impl $parachain { + pub fn para_id() -> $crate::ParaId { + Self::ext_wrapper(|| ::ParachainInfo::get()) + } + + pub fn parent_location() -> $crate::MultiLocation { + (Parent).into() + } + + pub fn account_id_of(seed: &str) -> $crate::AccountId { + $crate::get_account_id_from_seed::(seed) + } + + pub fn account_data_of(account: AccountId) -> $crate::AccountData { + Self::ext_wrapper(|| ::System::account(account).data) + } + + pub fn sovereign_account_id_of(location: $crate::MultiLocation) -> $crate::AccountId { + ::LocationToAccountId::convert(location.into()).unwrap() + } + + pub fn fund_accounts(accounts: Vec<(AccountId, Balance)>) { + Self::ext_wrapper(|| { + for account in accounts { + let _ = ::Balances::force_set_balance( + ::RuntimeOrigin::root(), + account.0.into(), + account.1.into(), + ); + } + }); + } + + pub fn events() -> Vec<::RuntimeEvent> { + ::System::events() + .iter() + .map(|record| record.event.clone()) + .collect() + } + + fn prepare_for_xcmp() { + use $crate::NetworkComponent; + let para_id = Self::para_id(); + + ::ext_wrapper(|| { + use $crate::{Get, Hooks}; + + let block_number = ::System::block_number(); + + let _ = ::ParachainSystem::set_validation_data( + ::RuntimeOrigin::none(), + Self::hrmp_channel_parachain_inherent_data(para_id.into(), 1), + ); + // set `AnnouncedHrmpMessagesPerCandidate` + ::ParachainSystem::on_initialize(block_number); + }); + } + } + }; +} + +// Network Implementation +#[macro_export] +macro_rules! decl_test_networks { + ( + $( + pub struct $name:ident { + relay_chain = $relay_chain:ty, + parachains = vec![ $( $parachain:ty, )* ], + } + ), + + + ) => { + $( + pub struct $name; + + impl $name { + pub fn reset() { + use $crate::{TestExt, VecDeque}; + + $crate::INITIALIZED.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::DMP_DONE.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); + + <$relay_chain>::reset_ext(); + $( <$parachain>::reset_ext(); )* + $( <$parachain>::prepare_for_xcmp(); )* + } + } + + impl $crate::Network for $name { + fn _init() { + // If Network has not been itialized yet, it gets initialized + if $crate::INITIALIZED.with(|b| b.borrow_mut().get(stringify!($name)).is_none()) { + $crate::INITIALIZED.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), true)); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::DMP_DONE.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), 1)); + $crate::PARA_IDS.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), Self::_para_ids())); + } + } + + fn _para_ids() -> Vec { + vec![$( + <$parachain>::para_id().into(), + )*] + } + + fn _relay_block_number() -> u32 { + $crate::RELAY_BLOCK_NUMBER.with(|v| *v.clone().borrow().get(stringify!($name)).unwrap()) + } + + fn _set_relay_block_number(block_number: u32) { + $crate::RELAY_BLOCK_NUMBER.with(|v| v.borrow_mut().insert(stringify!($name).to_string(), block_number)); + } + + fn _process_messages() { + while Self::_has_unprocessed_messages() { + Self::_process_upward_messages(); + Self::_process_horizontal_messages(); + Self::_process_downward_messages(); + } + } + + fn _has_unprocessed_messages() -> bool { + $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) + || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) + || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) + } + + fn _process_downward_messages() { + use $crate::{DmpMessageHandler, Bounded}; + use polkadot_parachain::primitives::RelayChainBlockNumber; + + while let Some((to_para_id, messages)) + = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { + $( + if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) { + let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); + for m in &messages { + msg_dedup.push((m.0, m.1.clone())); + } + msg_dedup.dedup(); + + let msgs = msg_dedup.clone().into_iter().filter(|m| { + !$crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap_or(&mut $crate::VecDeque::new()).contains(&(to_para_id, m.0, m.1.clone()))) + }).collect::)>>(); + if msgs.len() != 0 { + <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); + for m in msgs { + $crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, m.0, m.1))); + } + } + } else { + unreachable!(); + } + )* + } + } + + fn _process_horizontal_messages() { + use $crate::{XcmpMessageHandler, Bounded}; + + while let Some((to_para_id, messages)) + = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { + let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); + $( + if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) { + <$parachain>::handle_xcmp_messages(iter.clone(), $crate::Weight::max_value()); + } + )* + } + } + + fn _process_upward_messages() { + use $crate::{Bounded, ProcessMessage, WeightMeter}; + use sp_core::Encode; + while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { + let mut weight_meter = WeightMeter::max_limit(); + let _ = <$relay_chain>::process_message( + &msg[..], + from_para_id.into(), + &mut weight_meter, + &mut msg.using_encoded(sp_core::blake2_256), + ); + } + } + + fn _hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> $crate::ParachainInherentData { + use $crate::cumulus_primitives_core::{relay_chain::HrmpChannelId, AbridgedHrmpChannel}; + + let mut sproof = $crate::RelayStateSproofBuilder::default(); + sproof.para_id = para_id.into(); + + // egress channel + let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); + for recipient_para_id in $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().clone()) { + let recipient_para_id = $crate::ParaId::from(recipient_para_id); + if let Err(idx) = e_index.binary_search(&recipient_para_id) { + e_index.insert(idx, recipient_para_id); + } + + sproof + .hrmp_channels + .entry(HrmpChannelId { + sender: sproof.para_id, + recipient: recipient_para_id, + }) + .or_insert_with(|| AbridgedHrmpChannel { + max_capacity: 1024, + max_total_size: 1024 * 1024, + max_message_size: 1024 * 1024, + msg_count: 0, + total_size: 0, + mqc_head: Option::None, + }); + } + + let (relay_storage_root, proof) = sproof.into_state_root_and_proof(); + + $crate::ParachainInherentData { + validation_data: $crate::PersistedValidationData { + parent_head: Default::default(), + relay_parent_number, + relay_parent_storage_root: relay_storage_root, + max_pov_size: Default::default(), + }, + relay_chain_state: proof, + downward_messages: Default::default(), + horizontal_messages: Default::default(), + } + } + } + + $crate::__impl_relay!($name, $relay_chain); + + $( + $crate::__impl_parachain!($name, $parachain); + )* + )+ + }; +} + +#[macro_export] +macro_rules! assert_expected_events { + ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { + let mut message: Vec = Vec::new(); + $( + let mut meet_conditions = true; + let mut event_message: Vec = Vec::new(); + + let event_received = <$chain>::events().iter().any(|event| { + $crate::log::debug!(target: format!("events::{}", stringify!($chain)).to_lowercase().as_str(), "{:?}", event); + + match event { + $event_pat => { + $( + if !$condition { + event_message.push(format!(" - The attribute {:?} = {:?} did not met the condition {:?}\n", stringify!($attr), $attr, stringify!($condition))); + meet_conditions &= $condition + } + )* + true + }, + _ => false + } + }); + + if event_received && !meet_conditions { + message.push(format!("\n\nEvent \x1b[31m{}\x1b[0m was received but some of its attributes did not meet the conditions:\n{}", stringify!($event_pat), event_message.concat())); + } else if !event_received { + message.push(format!("\n\nEvent \x1b[31m{}\x1b[0m was never received", stringify!($event_pat))); + } + )* + if !message.is_empty() { + panic!("{}", message.concat()) + } + } + +} + +#[macro_export] +macro_rules! bx { + ($e:expr) => { + Box::new($e) + }; +} + +pub mod helpers { + use super::Weight; + + pub fn within_threshold(threshold: u64, expected_value: u64, current_value: u64) -> bool { + let margin = (current_value * threshold) / 100; + let lower_limit = expected_value - margin; + let upper_limit = expected_value + margin; + + current_value >= lower_limit && current_value <= upper_limit + } + + pub fn weight_within_threshold( + (threshold_time, threshold_size): (u64, u64), + expected_weight: Weight, + weight: Weight, + ) -> bool { + let ref_time_within = + within_threshold(threshold_time, expected_weight.ref_time(), weight.ref_time()); + let proof_size_within = + within_threshold(threshold_size, expected_weight.proof_size(), weight.proof_size()); + + ref_time_within && proof_size_within + } +} diff --git a/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml b/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml index e5a8459a76a..7badbe51d63 100644 --- a/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml +++ b/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml @@ -73,7 +73,7 @@ cumulus_based = true ws_port = 9910 command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ROCKMINE}}" args = [ - "-lparachain=debug,xcm=trace", + "-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace", ] extra_args = [ "--no-mdns", "--bootnodes {{'rockmine-collator2'|zombie('multiAddress')}}", @@ -84,7 +84,7 @@ cumulus_based = true name = "rockmine-collator2" command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ROCKMINE}}" args = [ - "-lparachain=debug,xcm=trace", + "-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace", ] extra_args = [ "--no-mdns", "--bootnodes {{'rockmine-collator1'|zombie('multiAddress')}}", diff --git a/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml b/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml index 55a95eb85f7..53247b6fdc8 100644 --- a/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml +++ b/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml @@ -73,7 +73,7 @@ cumulus_based = true ws_port = 9010 command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_WOCKMINT}}" args = [ - "-lparachain=debug,xcm=trace", + "-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace", ] extra_args = [ "--no-mdns", "--bootnodes {{'wockmint-collator2'|zombie('multiAddress')}}", @@ -84,7 +84,7 @@ cumulus_based = true name = "wockmint-collator2" command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_WOCKMINT}}" args = [ - "-lparachain=debug,xcm=trace", + "-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace", ] extra_args = [ "--no-mdns", "--bootnodes {{'wockmint-collator1'|zombie('multiAddress')}}", diff --git a/zombienet/tests/register-para.js b/zombienet/tests/register-para.js index c080904aefe..a8fbab94673 100644 --- a/zombienet/tests/register-para.js +++ b/zombienet/tests/register-para.js @@ -3,7 +3,18 @@ async function run(nodeName, networkInfo, args) { const para = networkInfo.paras[paraIdStr]; const relayNode = networkInfo.relay[0]; - await zombie.registerParachain(parseInt(paraIdStr,10),para.wasmPath, para.statePath, relayNode.wsUri, "//Alice", true); + const registerParachainOptions = { + id: parseInt(paraIdStr,10), + wasmPath: para.wasmPath, + statePath: para.statePath, + apiUrl: relayNode.wsUri, + onboardAsParachain: true, + seed: "//Alice", + finalization: true + }; + + + await zombie.registerParachain(registerParachainOptions); } module.exports = { run }