From 20ac6ff4dc4c488ad08f507c14b899adc6cb4394 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 16 Jan 2025 11:32:20 +0100 Subject: [PATCH] Bridges patch applied for stable2409 (#519) Relates to: https://github.com/paritytech/polkadot-sdk/pull/6781 Relates to: https://github.com/paritytech/polkadot-sdk/pull/6536 Closes: https://github.com/paritytech/parity-bridges-common/issues/3017 Basically, this PR reverts back the congestion mechanism for Bridges, which was removed by https://github.com/polkadot-fellows/runtimes/pull/490 and later reverted by https://github.com/paritytech/polkadot-sdk/pull/6781. - [X] Does not require a CHANGELOG entry ## TODO/Follow-ups - [x] run bridges zombienet tests - [x] fresh weights for relevant pallets --------- Co-authored-by: GitHub Action --- Cargo.lock | 69 +++--- Cargo.toml | 16 +- .../bridges_polkadot_kusama.sh | 120 +++++++++-- .../environments/polkadot-kusama/spawn.sh | 60 ++++-- .../polkadot-kusama/start_relayer.sh | 26 ++- .../dot-reaches-kusama.zndsl | 6 +- .../ksm-reaches-polkadot.zndsl | 6 +- .../run.sh | 2 +- .../asset-hub-kusama/primitives/Cargo.toml | 4 +- .../asset-hub-kusama/primitives/src/lib.rs | 26 ++- .../asset-hubs/asset-hub-kusama/src/lib.rs | 8 +- .../weights/pallet_xcm_bridge_hub_router.rs | 28 ++- .../asset-hub-kusama/tests/tests.rs | 54 ++++- .../asset-hub-polkadot/primitives/Cargo.toml | 4 +- .../asset-hub-polkadot/primitives/src/lib.rs | 26 ++- .../asset-hubs/asset-hub-polkadot/src/lib.rs | 5 +- .../weights/pallet_xcm_bridge_hub_router.rs | 28 ++- .../asset-hub-polkadot/tests/tests.rs | 52 ++++- .../bridge-hub-kusama/primitives/src/lib.rs | 9 +- .../src/bridge_to_polkadot_config.rs | 163 +++----------- .../src/genesis_config_presets.rs | 24 ++- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 15 +- .../src/weights/pallet_bridge_messages.rs | 196 +++++++++-------- .../src/weights/pallet_bridge_relayers.rs | 22 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 198 ++++++++--------- .../bridge-hub-kusama/tests/tests.rs | 15 +- .../bridge-hub-polkadot/primitives/src/lib.rs | 9 +- .../src/bridge_to_kusama_config.rs | 165 +++----------- .../src/genesis_config_presets.rs | 24 ++- .../bridge-hub-polkadot/src/lib.rs | 15 +- .../src/weights/pallet_bridge_messages.rs | 182 +++++++++------- .../src/weights/pallet_bridge_relayers.rs | 32 +-- .../xcm/pallet_xcm_benchmarks_generic.rs | 202 ++++++++---------- .../bridge-hub-polkadot/tests/tests.rs | 15 +- 34 files changed, 993 insertions(+), 833 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 679be7c1ed..bb752b2ce6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -841,15 +841,16 @@ dependencies = [ [[package]] name = "asset-test-utils" -version = "18.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0324df9ce91a9840632e865dd3272bd20162023856f1b189b7ae58afa5c6b61" +checksum = "9b0a99a8fa37a58ad868fca25530dde06b6582cb46b64bfae808f5b9b87e42ce" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", "frame-support", "frame-system", + "pallet-asset-conversion", "pallet-assets", "pallet-balances", "pallet-collator-selection", @@ -867,6 +868,7 @@ dependencies = [ "staging-xcm-builder", "staging-xcm-executor", "substrate-wasm-builder", + "xcm-runtime-apis", ] [[package]] @@ -1386,7 +1388,7 @@ dependencies = [ "frame-support", "parity-scale-codec", "scale-info", - "sp-std", + "sp-core 34.0.0", "staging-xcm", "system-parachains-constants", ] @@ -1399,7 +1401,7 @@ dependencies = [ "frame-support", "parity-scale-codec", "scale-info", - "sp-std", + "sp-core 34.0.0", "staging-xcm", "system-parachains-constants", ] @@ -1640,9 +1642,9 @@ dependencies = [ [[package]] name = "bp-xcm-bridge-hub" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6909117ca87cb93703742939d5f0c4c93e9646d9cda22262e9709d68c929999b" +checksum = "0873c54562b3d492541cbc8a7974c6854a5157d07880a2a71f8ba888a69e17e9" dependencies = [ "bp-messages", "bp-runtime", @@ -1993,9 +1995,9 @@ dependencies = [ [[package]] name = "bridge-hub-test-utils" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0b3aa5fd8481a06ca16e47fd3d2d9c6abe76b27d922ec8980a853f242173b3" +checksum = "329b98c9cfa8a36beb65eebe197460e06dc3b041baf84d16c2c9862b99d1e7d2" dependencies = [ "asset-test-utils", "bp-header-chain", @@ -2037,9 +2039,9 @@ dependencies = [ [[package]] name = "bridge-runtime-common" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c639aa22de6e904156a3e8b0e6b9e6af790cb27a1299688cc07997e1ffe5b648" +checksum = "86cf718057e18ce3e5f2c8e3fc318c38ad71d47ada91dc4b841c0f69c214ef04" dependencies = [ "bp-header-chain", "bp-messages", @@ -3799,9 +3801,9 @@ dependencies = [ [[package]] name = "emulated-integration-tests-common" -version = "14.1.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02f16722b84c80116230ed1eac5b49356bebeb0589786d9c651e010369f1c95" +checksum = "8a2fdb16bdf43492ecf4e8ac21efcf140bb9783dded06d33a3f330123301c25b" dependencies = [ "asset-test-utils", "bp-messages", @@ -7962,9 +7964,9 @@ dependencies = [ [[package]] name = "pallet-bridge-relayers" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2faead05455a965a0a0ec69ffa779933479b599e40bda809c0aa1efa72a39281" +checksum = "0fe3be7077b7ddee7178b1b12e9171435da73778d093788e10b1bdfad1e10962" dependencies = [ "bp-header-chain", "bp-messages", @@ -8545,9 +8547,9 @@ dependencies = [ [[package]] name = "pallet-message-queue" -version = "41.0.1" +version = "41.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0faa48b29bf5a178580c164ef00de87319a37da7547a9cd6472dfd160092811a" +checksum = "983f7d1be18e9a089a3e23670918f5085705b4403acd3fdde31878d57b76a1a8" dependencies = [ "environmental", "frame-benchmarking", @@ -9059,9 +9061,9 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" -version = "38.0.0" +version = "38.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b1aa3498107a30237f941b0f02180db3b79012c3488878ff01a4ac3e8ee04e" +checksum = "6cdb86580c72b58145f9cddba21a0c1814742ca56abc9caac3c1ac72f6bde649" dependencies = [ "frame-support", "frame-system", @@ -9168,9 +9170,9 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "17.0.0" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b1760b6589e53f4ad82216c72c0e38fcb4df149c37224ab3301dc240c85d1d4" +checksum = "989676964dbda5f5275650fbdcd3894fe7fac626d113abf89d572b4952adcc36" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -9187,6 +9189,7 @@ dependencies = [ "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", + "tracing", "xcm-runtime-apis", ] @@ -9211,9 +9214,9 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub" -version = "0.13.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f9670065b7cba92771060a4a3925b6650ff67611443ccfccd5aa356f7d5aac" +checksum = "f336403f9e9bf22a0e1fdb90aa5093c52599c9a0639591fbcc1e979b58862d1b" dependencies = [ "bp-messages", "bp-runtime", @@ -9234,9 +9237,9 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub-router" -version = "0.15.1" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3b5347c826b721098ef39afb0d750e621c77538044fc1e865af1a8747824fdf" +checksum = "fabf1fdcf451ac79995f11cb9b6a0761924c57bb79442c2d91b3bbefe4dfa081" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", @@ -9285,9 +9288,9 @@ dependencies = [ [[package]] name = "parachains-runtimes-test-utils" -version = "17.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287d2db0a2d19466caa579a69f021bfdc6fa352f382c8395dade58d1d0c6adfe" +checksum = "d37c6a0fe791b244282e445c7ae2534217b05781a7e47ef9e391860cf3412210" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -9301,6 +9304,7 @@ dependencies = [ "pallet-session", "pallet-timestamp", "pallet-xcm", + "parachains-common", "parity-scale-codec", "polkadot-parachain-primitives", "sp-consensus-aura", @@ -9312,6 +9316,7 @@ dependencies = [ "staging-xcm", "staging-xcm-executor", "substrate-wasm-builder", + "xcm-runtime-apis", ] [[package]] @@ -13154,9 +13159,9 @@ dependencies = [ [[package]] name = "snowbridge-runtime-test-common" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "893480d6cde2489051c65efb5d27fa87efe047b3b61216d8e27bb2f0509b7faf" +checksum = "242ad550a31ebd8e29a17beb89f1e5ddf4e657ebdf667fb9e4c0660428de4e9b" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -14522,9 +14527,9 @@ dependencies = [ [[package]] name = "staging-xcm-builder" -version = "17.0.1" +version = "17.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3746adbbae27b1e6763f0cca622e15482ebcb94835a9e078c212dd7be896e35" +checksum = "b6f7a92cfaec55a5ed0f9cbbb9076aa8ec0aff1ba90b9804cc5c8f2369fde59c" dependencies = [ "frame-support", "frame-system", @@ -16737,9 +16742,9 @@ dependencies = [ [[package]] name = "xcm-runtime-apis" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d4473a5d157e4d437d9ebcb1b99f9693a64983877ee57d97005f0167869935" +checksum = "2f3d96bd7362d9e6884ef6762f08737d89205a358d059a0451353f3e91985ca5" dependencies = [ "frame-support", "parity-scale-codec", diff --git a/Cargo.toml b/Cargo.toml index 1fb76ec588..f2d45cf661 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ asset-hub-kusama-emulated-chain = { path = "integration-tests/emulated/chains/pa asset-hub-kusama-runtime = { path = "system-parachains/asset-hubs/asset-hub-kusama" } asset-hub-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot" } asset-hub-polkadot-runtime = { path = "system-parachains/asset-hubs/asset-hub-polkadot" } -asset-test-utils = { version = "18.0.0" } +asset-test-utils = { version = "20.0.0" } assets-common = { version = "0.18.0", default-features = false } authority-discovery-primitives = { version = "34.0.0", default-features = false, package = "sp-authority-discovery" } babe-primitives = { version = "0.40.0", default-features = false, package = "sp-consensus-babe" } @@ -32,14 +32,14 @@ bp-polkadot-bulletin = { version = "0.15.0", default-features = false } bp-polkadot-core = { version = "0.18.0", default-features = false } bp-relayers = { version = "0.18.0", default-features = false } bp-runtime = { version = "0.18.0", default-features = false } -bp-xcm-bridge-hub = { version = "0.4.0", default-features = false } +bp-xcm-bridge-hub = { version = "0.4.2", default-features = false } bp-xcm-bridge-hub-router = { version = "0.14.1", default-features = false } bridge-hub-common = { version = "0.10.0", default-features = false } bridge-hub-kusama-emulated-chain = { path = "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama" } bridge-hub-kusama-runtime = { path = "system-parachains/bridge-hubs/bridge-hub-kusama" } bridge-hub-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot" } bridge-hub-polkadot-runtime = { path = "system-parachains/bridge-hubs/bridge-hub-polkadot" } -bridge-hub-test-utils = { version = "0.18.0" } +bridge-hub-test-utils = { version = "0.20.0" } bridge-runtime-common = { version = "0.18.0", default-features = false } clap = { version = "4.5.0" } codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false } @@ -58,7 +58,7 @@ cumulus-pallet-xcmp-queue = { version = "0.17.0", default-features = false } cumulus-primitives-aura = { version = "0.15.0", default-features = false } cumulus-primitives-core = { version = "0.16.0", default-features = false } cumulus-primitives-utility = { version = "0.17.0", default-features = false } -emulated-integration-tests-common = { version = "14.1.0" } +emulated-integration-tests-common = { version = "16.0.0" } encointer-balances-tx-payment = { version = "~14.1.0", default-features = false } encointer-balances-tx-payment-rpc-runtime-api = { version = "~14.1.0", default-features = false } encointer-kusama-runtime = { path = "system-parachains/encointer" } @@ -169,11 +169,11 @@ pallet-vesting = { version = "38.0.0", default-features = false } pallet-whitelist = { version = "37.0.0", default-features = false } pallet-xcm = { version = "17.0.0", default-features = false } pallet-xcm-benchmarks = { version = "17.0.0", default-features = false } -pallet-xcm-bridge-hub = { version = "0.13.0", default-features = false } -pallet-xcm-bridge-hub-router = { version = "0.15.1", default-features = false } +pallet-xcm-bridge-hub = { version = "0.13.2", default-features = false } +pallet-xcm-bridge-hub-router = { version = "0.15.3", default-features = false } parachain-info = { version = "0.17.0", default-features = false, package = "staging-parachain-info" } parachains-common = { version = "18.0.0", default-features = false } -parachains-runtimes-test-utils = { version = "17.0.0" } +parachains-runtimes-test-utils = { version = "19.0.0" } paste = { version = "1.0.14" } penpal-emulated-chain = { path = "integration-tests/emulated/chains/parachains/testing/penpal" } penpal-runtime = { version = "0.25.0" } @@ -211,7 +211,7 @@ snowbridge-pallet-outbound-queue = { version = "0.10.0", default-features = fals snowbridge-pallet-system = { version = "0.10.0", default-features = false } snowbridge-router-primitives = { version = "0.16.0", default-features = false } snowbridge-runtime-common = { version = "0.10.0", default-features = false } -snowbridge-runtime-test-common = { version = "0.10.0" } +snowbridge-runtime-test-common = { version = "0.12.0" } snowbridge-system-runtime-api = { version = "0.10.0", default-features = false } sp-api = { version = "34.0.0", default-features = false } sp-application-crypto = { version = "38.0.0", default-features = false } diff --git a/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh b/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh index 040db39db3..94fb354585 100755 --- a/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh +++ b/integration-tests/bridges/environments/polkadot-kusama/bridges_polkadot_kusama.sh @@ -133,7 +133,7 @@ ON_BRIDGE_HUB_KUSAMA_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhpd_ThisChain="EoQBtnw ON_BRIDGE_HUB_KUSAMA_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhpd_BridgedChain="EoQBtnwp4jMtCEpV7CPsssT6bdDHuHZmf3aGXxHJiSA4Dz3" LANE_ID="00000001" -XCM_VERSION=3 +XCM_VERSION=4 AHK_DOT_ED=10000000 DOT=10000000000 @@ -193,12 +193,99 @@ function run_relay() { --lane "${LANE_ID}" } +function run_finality_relay() { + local relayer_path=$(ensure_relayer) + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + $relayer_path relay-headers polkadot-to-bridge-hub-kusama \ + --only-free-headers \ + --source-uri ws://localhost:9942 \ + --source-version-mode Auto \ + --target-uri ws://localhost:8945 \ + --target-version-mode Auto \ + --target-signer //Charlie \ + --target-transactions-mortality 4& + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + $relayer_path relay-headers kusama-to-bridge-hub-polkadot \ + --only-free-headers \ + --source-uri ws://localhost:9945 \ + --source-version-mode Auto \ + --target-uri ws://localhost:8943 \ + --target-version-mode Auto \ + --target-signer //Charlie \ + --target-transactions-mortality 4 +} + +function run_parachains_relay() { + local relayer_path=$(ensure_relayer) + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + $relayer_path relay-parachains polkadot-to-bridge-hub-kusama \ + --only-free-headers \ + --source-uri ws://localhost:9942 \ + --source-version-mode Auto \ + --target-uri ws://localhost:8945 \ + --target-version-mode Auto \ + --target-signer //Dave \ + --target-transactions-mortality 4& + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + $relayer_path relay-parachains kusama-to-bridge-hub-polkadot \ + --only-free-headers \ + --source-uri ws://localhost:9945 \ + --source-version-mode Auto \ + --target-uri ws://localhost:8943 \ + --target-version-mode Auto \ + --target-signer //Dave \ + --target-transactions-mortality 4 +} + +function run_messages_relay() { + local relayer_path=$(ensure_relayer) + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + $relayer_path relay-messages bridge-hub-polkadot-to-bridge-hub-kusama \ + --source-uri ws://localhost:8943 \ + --source-version-mode Auto \ + --source-signer //Eve \ + --source-transactions-mortality 4 \ + --target-uri ws://localhost:8945 \ + --target-version-mode Auto \ + --target-signer //Eve \ + --target-transactions-mortality 4 \ + --lane $LANE_ID& + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + $relayer_path relay-messages bridge-hub-kusama-to-bridge-hub-polkadot \ + --source-uri ws://localhost:8945 \ + --source-version-mode Auto \ + --source-signer //Ferdie \ + --source-transactions-mortality 4 \ + --target-uri ws://localhost:8943 \ + --target-version-mode Auto \ + --target-signer //Ferdie \ + --target-transactions-mortality 4 \ + --lane $LANE_ID +} + case "$1" in run-relay) init_kusama_polkadot init_polkadot_kusama run_relay ;; + run-finality-relay) + init_kusama_polkadot + init_polkadot_kusama + run_finality_relay + ;; + run-parachains-relay) + run_parachains_relay + ;; + run-messages-relay) + run_messages_relay + ;; init-asset-hub-polkadot-local) ensure_polkadot_js_api # create foreign assets for native Kusama token (governance call on Polkadot) @@ -207,7 +294,7 @@ case "$1" in "//Alice" \ 1000 \ "ws://127.0.0.1:9910" \ - "$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Kusama" } } }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Kusama" } ] } }')" \ "$GLOBAL_CONSENSUS_KUSAMA_SOVEREIGN_ACCOUNT" \ $AHP_KSM_ED \ true @@ -266,7 +353,7 @@ case "$1" in "//Alice" \ 1000 \ "ws://127.0.0.1:9010" \ - "$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Polkadot" } } }')" \ + "$(jq --null-input '{ "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Polkadot" } ] } }')" \ "$GLOBAL_CONSENSUS_POLKADOT_SOVEREIGN_ACCOUNT" \ $AHK_DOT_ED \ true @@ -323,9 +410,9 @@ case "$1" in limited_reserve_transfer_assets \ "ws://127.0.0.1:9910" \ "//Alice" \ - "$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \ - "$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [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] } } } } }')" \ - "$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": '$amount' } } ] }')" \ + "$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \ + "$(jq --null-input '{ "V4": { "parents": 0, "interior": { "X1": [ { "AccountId32": { "id": [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] } } ] } } }')" \ + "$(jq --null-input '{ "V4": [ { "id": { "parents": 1, "interior": "Here" }, "fun": { "Fungible": '$amount' } } ] }')" \ 0 \ "Unlimited" ;; @@ -336,9 +423,9 @@ case "$1" in limited_reserve_transfer_assets \ "ws://127.0.0.1:9910" \ "//Alice" \ - "$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \ - "$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [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] } } } } }')" \ - "$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 2, "interior": { "X1": { "GlobalConsensus": "Kusama" } } } }, "fun": { "Fungible": '$amount' } } ] }')" \ + "$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \ + "$(jq --null-input '{ "V4": { "parents": 0, "interior": { "X1": [ { "AccountId32": { "id": [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] } } ] } } }')" \ + "$(jq --null-input '{ "V4": [ { "id": { "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Kusama" } ] } }, "fun": { "Fungible": '$amount' } } ] }')" \ 0 \ "Unlimited" ;; @@ -349,9 +436,9 @@ case "$1" in limited_reserve_transfer_assets \ "ws://127.0.0.1:9010" \ "//Alice" \ - "$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \ - "$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [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] } } } } }')" \ - "$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": '$amount' } } ] }')" \ + "$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \ + "$(jq --null-input '{ "V4": { "parents": 0, "interior": { "X1": [ { "AccountId32": { "id": [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] } } ] } } }')" \ + "$(jq --null-input '{ "V4": [ { "id": { "parents": 1, "interior": "Here" }, "fun": { "Fungible": '$amount' } } ] }')" \ 0 \ "Unlimited" ;; @@ -362,9 +449,9 @@ case "$1" in limited_reserve_transfer_assets \ "ws://127.0.0.1:9010" \ "//Alice" \ - "$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \ - "$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [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] } } } } }')" \ - "$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 2, "interior": { "X1": { "GlobalConsensus": "Polkadot" } } } }, "fun": { "Fungible": '$amount' } } ] }')" \ + "$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \ + "$(jq --null-input '{ "V4": { "parents": 0, "interior": { "X1": [ { "AccountId32": { "id": [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] } } ] } } }')" \ + "$(jq --null-input '{ "V4": [ { "id": { "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Polkadot" } ] } }, "fun": { "Fungible": '$amount' } } ] }')" \ 0 \ "Unlimited" ;; @@ -372,6 +459,9 @@ case "$1" in echo "A command is require. Supported commands for: Local (zombienet) run: - run-relay + - run-finality-relay + - run-parachains-relay + - run-messages-relay - init-asset-hub-polkadot-local - init-bridge-hub-polkadot-local - init-asset-hub-kusama-local diff --git a/integration-tests/bridges/environments/polkadot-kusama/spawn.sh b/integration-tests/bridges/environments/polkadot-kusama/spawn.sh index 3786ce1d4d..29b050ac2e 100755 --- a/integration-tests/bridges/environments/polkadot-kusama/spawn.sh +++ b/integration-tests/bridges/environments/polkadot-kusama/spawn.sh @@ -6,6 +6,23 @@ trap "trap - SIGTERM && kill -9 -$$" SIGINT SIGTERM EXIT source "$FRAMEWORK_PATH/utils/zombienet.sh" +# whether to init the chains (open HRMP channels, set XCM version, create reserve assets, etc) +init=0 +start_relayer=0 +while [ $# -ne 0 ] +do + arg="$1" + case "$arg" in + --init) + init=1 + ;; + --start-relayer) + start_relayer=1 + ;; + esac + shift +done + logs_dir=$TEST_DIR/logs helper_script="${BASH_SOURCE%/*}/helper.sh" @@ -17,33 +34,34 @@ kusama_def=${BASH_SOURCE%/*}/bridge_hub_kusama_local_network.toml start_zombienet $TEST_DIR $kusama_def kusama_dir kusama_pid echo -polkadot_init_log=$logs_dir/polkadot-init.log -echo -e "Setting up the polkadot side of the bridge. Logs available at: $polkadot_init_log\n" - -kusama_init_log=$logs_dir/kusama-init.log -echo -e "Setting up the kusama side of the bridge. Logs available at: $kusama_init_log\n" - -$helper_script init-asset-hub-polkadot-local >> $polkadot_init_log 2>&1 & -polkadot_init_pid=$! -$helper_script init-asset-hub-kusama-local >> $kusama_init_log 2>&1 & -kusama_init_pid=$! -wait -n $polkadot_init_pid $kusama_init_pid - +if [[ $init -eq 1 ]]; then + polkadot_init_log=$logs_dir/polkadot-init.log + echo -e "Setting up the polkadot side of the bridge. Logs available at: $polkadot_init_log\n" + kusama_init_log=$logs_dir/kusama-init.log + echo -e "Setting up the kusama side of the bridge. Logs available at: $kusama_init_log\n" + $helper_script init-asset-hub-polkadot-local >> $polkadot_init_log 2>&1 & + polkadot_init_pid=$! + $helper_script init-asset-hub-kusama-local >> $kusama_init_log 2>&1 & + kusama_init_pid=$! + wait -n $polkadot_init_pid $kusama_init_pid -$helper_script init-bridge-hub-polkadot-local >> $polkadot_init_log 2>&1 & -polkadot_init_pid=$! -$helper_script init-bridge-hub-kusama-local >> $kusama_init_log 2>&1 & -kusama_init_pid=$! -wait -n $polkadot_init_pid $kusama_init_pid + $helper_script init-bridge-hub-polkadot-local >> $polkadot_init_log 2>&1 & + polkadot_init_pid=$! + $helper_script init-bridge-hub-kusama-local >> $kusama_init_log 2>&1 & + kusama_init_pid=$! + wait -n $polkadot_init_pid $kusama_init_pid -run_zndsl ${BASH_SOURCE%/*}/polkadot-init.zndsl $polkadot_dir -run_zndsl ${BASH_SOURCE%/*}/kusama-init.zndsl $kusama_dir + run_zndsl ${BASH_SOURCE%/*}/polkadot-init.zndsl $polkadot_dir + run_zndsl ${BASH_SOURCE%/*}/kusama-init.zndsl $kusama_dir +fi -${BASH_SOURCE%/*}/start_relayer.sh $polkadot_dir $kusama_dir relayer_pid +if [[ $start_relayer -eq 1 ]]; then + ${BASH_SOURCE%/*}/start_relayer.sh $polkadot_dir $kusama_dir finality_relayer_pid parachains_relayer_pid messages_relayer_pid +fi echo $polkadot_dir > $TEST_DIR/polkadot.env echo $kusama_dir > $TEST_DIR/kusama.env echo -wait -n $polkadot_pid $kusama_pid $relayer_pid +wait -n $polkadot_pid $kusama_pid $finality_relayer_pid $parachains_relayer_pid $messages_relayer_pid kill -9 -$$ diff --git a/integration-tests/bridges/environments/polkadot-kusama/start_relayer.sh b/integration-tests/bridges/environments/polkadot-kusama/start_relayer.sh index 73e51f99a7..f2e36106ef 100755 --- a/integration-tests/bridges/environments/polkadot-kusama/start_relayer.sh +++ b/integration-tests/bridges/environments/polkadot-kusama/start_relayer.sh @@ -7,17 +7,31 @@ source "$FRAMEWORK_PATH/utils/zombienet.sh" polkadot_dir=$1 kusama_dir=$2 -__relayer_pid=$3 +__finality_relayer_pid=$3 +__parachains_relayer_pid=$4 +__messages_relayer_pid=$5 logs_dir=$TEST_DIR/logs helper_script="${BASH_SOURCE%/*}/helper.sh" -relayer_log=$logs_dir/relayer.log -echo -e "Starting polkadot-kusama relayer. Logs available at: $relayer_log\n" -start_background_process "$helper_script run-relay" $relayer_log relayer_pid +# start finality relayer +finality_relayer_log=$logs_dir/relayer_finality.log +echo -e "Starting polkadot-kusama finality relayer. Logs available at: $finality_relayer_log\n" +start_background_process "$helper_script run-finality-relay" $finality_relayer_log finality_relayer_pid + +# start parachains relayer +parachains_relayer_log=$logs_dir/relayer_parachains.log +echo -e "Starting polkadot-kusama parachains relayer. Logs available at: $parachains_relayer_log\n" +start_background_process "$helper_script run-parachains-relay" $parachains_relayer_log parachains_relayer_pid + +# start messages relayer +messages_relayer_log=$logs_dir/relayer_messages.log +echo -e "Starting polkadot-kusama messages relayer. Logs available at: $messages_relayer_log\n" +start_background_process "$helper_script run-messages-relay" $messages_relayer_log messages_relayer_pid run_zndsl ${BASH_SOURCE%/*}/polkadot-bridge.zndsl $polkadot_dir run_zndsl ${BASH_SOURCE%/*}/kusama-bridge.zndsl $kusama_dir -eval $__relayer_pid="'$relayer_pid'" - +eval $__finality_relayer_pid="'$finality_relayer_pid'" +eval $__parachains_relayer_pid="'$parachains_relayer_pid'" +eval $__messages_relayer_pid="'$messages_relayer_pid'" diff --git a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl index 13db4cca35..d29f016d12 100644 --- a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl +++ b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/dot-reaches-kusama.zndsl @@ -6,7 +6,7 @@ Creds: config asset-hub-kusama-collator-1: run {{ENV_PATH}}/helper.sh with "reserve-transfer-assets-from-asset-hub-polkadot-local 50000000000" within 120 seconds # check that //Alice received at least 4.8 DOT on Kusama AH -asset-hub-kusama-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,48000000000,Polkadot" within 300 seconds +asset-hub-kusama-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with '{ "accountAddress": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", "expectedAssetBalance": 48000000000, "expectedAssetId": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Polkadot" }] }}}' within 300 seconds -# check that the relayer //Charlie is rewarded by Kusama AH -bridge-hub-kusama-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000001,0x62687064,ThisChain,0" within 30 seconds +# check that the relayer //Eve is rewarded by Kusama AH +bridge-hub-kusama-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw,0x00000001,0x62687064,ThisChain,0" within 30 seconds \ No newline at end of file diff --git a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl index c07bfa9732..74af756f85 100644 --- a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl +++ b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/ksm-reaches-polkadot.zndsl @@ -6,7 +6,7 @@ Creds: config asset-hub-polkadot-collator-1: run {{ENV_PATH}}/helper.sh with "reserve-transfer-assets-from-asset-hub-kusama-local 5000000000000" within 120 seconds # check that //Alice received at least 4.8 KSM on Polkadot AH -asset-hub-polkadot-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,4800000000000,Kusama" within 300 seconds +asset-hub-polkadot-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with '{ "accountAddress": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", "expectedAssetBalance": 4800000000000, "expectedAssetId": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": "Kusama" }] }}}' within 300 seconds -# check that the relayer //Charlie is rewarded by Polkadot AH -bridge-hub-polkadot-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000001,0x62686b73,ThisChain,0" within 30 seconds +# check that the relayer //Ferdie is rewarded by Polkadot AH +bridge-hub-polkadot-collator-1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL,0x00000001,0x62686b73,ThisChain,0" within 30 seconds \ No newline at end of file diff --git a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/run.sh b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/run.sh index 0cfc116119..886a9e1a4f 100755 --- a/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/run.sh +++ b/integration-tests/bridges/tests/0001-polkadot-kusama-asset-transfer/run.sh @@ -10,7 +10,7 @@ source "$FRAMEWORK_PATH/utils/zombienet.sh" export ENV_PATH=`realpath ${BASH_SOURCE%/*}/../../environments/polkadot-kusama` -$ENV_PATH/spawn.sh & +$ENV_PATH/spawn.sh --init --start-relayer & env_pid=$! ensure_process_file $env_pid $TEST_DIR/polkadot.env 600 diff --git a/system-parachains/asset-hubs/asset-hub-kusama/primitives/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/primitives/Cargo.toml index 7f22310349..4784e1cc18 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/primitives/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/primitives/Cargo.toml @@ -19,7 +19,7 @@ bp-xcm-bridge-hub-router = { workspace = true } # Substrate Based Dependencies frame-support = { workspace = true } -sp-std = { workspace = true } +sp-core = { workspace = true } # Polkadot xcm = { workspace = true } @@ -31,7 +31,7 @@ std = [ "codec/std", "frame-support/std", "scale-info/std", - "sp-std/std", + "sp-core/std", "system-parachains-constants/std", "xcm/std", ] diff --git a/system-parachains/asset-hubs/asset-hub-kusama/primitives/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/primitives/src/lib.rs index f2f0b89052..782868f8db 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/primitives/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/primitives/src/lib.rs @@ -18,11 +18,13 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use codec::{Decode, Encode}; use scale_info::TypeInfo; -use xcm::prelude::*; pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall; +use xcm::latest::prelude::*; use system_parachains_constants::kusama::currency::*; @@ -50,5 +52,27 @@ frame_support::parameter_types! { pub const CreateForeignAssetDeposit: u128 = system_para_deposit(1, 190); } +/// Builds an (un)congestion XCM program with the `report_bridge_status` call for +/// `ToPolkadotXcmRouter`. +pub fn build_congestion_message( + bridge_id: sp_core::H256, + is_congested: bool, +) -> alloc::vec::Vec> { + alloc::vec![ + UnpaidExecution { weight_limit: Unlimited, check_origin: None }, + Transact { + origin_kind: OriginKind::Xcm, + require_weight_at_most: XcmBridgeHubRouterTransactCallMaxWeight::get(), + call: Call::ToPolkadotXcmRouter(XcmBridgeHubRouterCall::report_bridge_status { + bridge_id, + is_congested, + }) + .encode() + .into(), + }, + ExpectTransactStatus(MaybeErrorCode::Success), + ] +} + /// Identifier of AssetHubKusama in the Kusama relay chain. pub const ASSET_HUB_KUSAMA_PARACHAIN_ID: u32 = 1000; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 97e8a256e2..c4f7fae10c 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -62,8 +62,8 @@ use frame_support::{ ord_parameter_types, parameter_types, traits::{ fungible, fungibles, tokens::imbalance::ResolveAssetTo, AsEnsureOriginWithArg, ConstBool, - ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter, TransformOrigin, - WithdrawReasons, + ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Equals, InstanceFilter, + TransformOrigin, WithdrawReasons, }, weights::{ConstantMultiplier, Weight, WeightToFee as _}, BoundedVec, PalletId, @@ -956,8 +956,10 @@ impl pallet_xcm_bridge_hub_router::Config for Runti type DestinationVersion = PolkadotXcm; type SiblingBridgeHubLocation = xcm_config::bridging::SiblingBridgeHub; - + type BridgeHubOrigin = + EitherOfDiverse, EnsureXcm>>; type ToBridgeHubSender = XcmpQueue; + type ByteFee = xcm_config::bridging::XcmBridgeHubRouterByteFee; type FeeAsset = xcm_config::bridging::XcmBridgeHubRouterFeeAssetId; type LocalXcmChannelManager = diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_xcm_bridge_hub_router.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_xcm_bridge_hub_router.rs index d35802eac0..589d6bdcfe 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_xcm_bridge_hub_router.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/pallet_xcm_bridge_hub_router.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_bridge_hub_router` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-01-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./asset-hub-kusama-chain-spec.json")`, DB CACHE: 1024 @@ -51,14 +51,14 @@ impl pallet_xcm_bridge_hub_router::WeightInfo for Weigh /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) - /// Storage: `ToPolkadotXcmRouter::DeliveryFeeFactor` (r:1 w:1) - /// Proof: `ToPolkadotXcmRouter::DeliveryFeeFactor` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `ToPolkadotXcmRouter::Bridge` (r:1 w:1) + /// Proof: `ToPolkadotXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) fn on_initialize_when_non_congested() -> Weight { // Proof Size summary in bytes: - // Measured: `158` + // Measured: `159` // Estimated: `5487` - // Minimum execution time: 18_780_000 picoseconds. - Weight::from_parts(19_300_000, 0) + // Minimum execution time: 19_140_000 picoseconds. + Weight::from_parts(19_440_000, 0) .saturating_add(Weight::from_parts(0, 5487)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -71,9 +71,21 @@ impl pallet_xcm_bridge_hub_router::WeightInfo for Weigh // Proof Size summary in bytes: // Measured: `111` // Estimated: `5487` - // Minimum execution time: 8_730_000 picoseconds. - Weight::from_parts(8_870_000, 0) + // Minimum execution time: 8_770_000 picoseconds. + Weight::from_parts(9_110_000, 0) .saturating_add(Weight::from_parts(0, 5487)) .saturating_add(T::DbWeight::get().reads(2)) } + /// Storage: `ToPolkadotXcmRouter::Bridge` (r:1 w:1) + /// Proof: `ToPolkadotXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) + fn report_bridge_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `83` + // Estimated: `1502` + // Minimum execution time: 14_730_000 picoseconds. + Weight::from_parts(15_250_000, 0) + .saturating_add(Weight::from_parts(0, 1502)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } } diff --git a/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs b/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs index 7e44cb1944..5521f8e430 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs @@ -27,7 +27,7 @@ use asset_hub_kusama_runtime::{ AllPalletsWithoutSystem, AssetConversion, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, - TrustBackedAssetsInstance, XcmpQueue, SLOT_DURATION, + ToPolkadotXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue, SLOT_DURATION, }; use asset_test_utils::{ test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder, @@ -588,6 +588,58 @@ fn reserve_transfer_native_asset_to_non_teleport_para_works() { ); } +#[test] +fn report_bridge_status_from_xcm_bridge_router_for_polkadot_works() { + asset_test_utils::test_cases_over_bridge::report_bridge_status_from_xcm_bridge_router_works::< + Runtime, + AllPalletsWithoutSystem, + XcmConfig, + LocationToAccountId, + ToPolkadotXcmRouterInstance, + >( + collator_session_keys(), + bridging_to_asset_hub_polkadot, + || bp_asset_hub_kusama::build_congestion_message(Default::default(), true).into(), + || bp_asset_hub_kusama::build_congestion_message(Default::default(), false).into(), + ) +} + +#[test] +fn test_report_bridge_status_call_compatibility() { + // if this test fails, make sure `bp_asset_hub_polkadot` has valid encoding + assert_eq!( + RuntimeCall::ToPolkadotXcmRouter( + pallet_xcm_bridge_hub_router::Call::report_bridge_status { + bridge_id: Default::default(), + is_congested: true, + } + ) + .encode(), + bp_asset_hub_kusama::Call::ToPolkadotXcmRouter( + bp_asset_hub_kusama::XcmBridgeHubRouterCall::report_bridge_status { + bridge_id: Default::default(), + is_congested: true, + } + ) + .encode() + ) +} + +#[test] +fn check_sane_weight_report_bridge_status() { + use pallet_xcm_bridge_hub_router::WeightInfo; + let actual = >::WeightInfo::report_bridge_status(); + let max_weight = bp_asset_hub_kusama::XcmBridgeHubRouterTransactCallMaxWeight::get(); + assert!( + actual.all_lte(max_weight), + "max_weight: {:?} should be adjusted to actual {:?}", + max_weight, + actual + ); +} + #[test] fn change_xcm_bridge_hub_router_base_fee_by_governance_works() { asset_test_utils::test_cases::change_storage_constant_by_governance_works::< diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/primitives/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/primitives/Cargo.toml index 70382050d7..a5baf230ef 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/primitives/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/primitives/Cargo.toml @@ -19,7 +19,7 @@ bp-xcm-bridge-hub-router = { workspace = true } # Substrate Based Dependencies frame-support = { workspace = true } -sp-std = { workspace = true } +sp-core = { workspace = true } # Polkadot xcm = { workspace = true } @@ -31,7 +31,7 @@ std = [ "codec/std", "frame-support/std", "scale-info/std", - "sp-std/std", + "sp-core/std", "system-parachains-constants/std", "xcm/std", ] diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/primitives/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/primitives/src/lib.rs index 8a8916a86f..0150ef20a0 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/primitives/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/primitives/src/lib.rs @@ -18,11 +18,13 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use codec::{Decode, Encode}; use scale_info::TypeInfo; -use xcm::prelude::*; pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall; +use xcm::latest::prelude::*; use system_parachains_constants::polkadot::currency::*; @@ -50,5 +52,27 @@ frame_support::parameter_types! { pub const CreateForeignAssetDeposit: u128 = system_para_deposit(1, 190); } +/// Builds an (un)congestion XCM program with the `report_bridge_status` call for +/// `ToKusamaXcmRouter`. +pub fn build_congestion_message( + bridge_id: sp_core::H256, + is_congested: bool, +) -> alloc::vec::Vec> { + alloc::vec![ + UnpaidExecution { weight_limit: Unlimited, check_origin: None }, + Transact { + origin_kind: OriginKind::Xcm, + require_weight_at_most: XcmBridgeHubRouterTransactCallMaxWeight::get(), + call: Call::ToKusamaXcmRouter(XcmBridgeHubRouterCall::report_bridge_status { + bridge_id, + is_congested, + }) + .encode() + .into(), + }, + ExpectTransactStatus(MaybeErrorCode::Success), + ] +} + /// Identifier of AssetHubPolkadot in the Polkadot relay chain. pub const ASSET_HUB_POLKADOT_PARACHAIN_ID: u32 = 1000; diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index 1a14c8a6d1..32948a381d 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -100,7 +100,7 @@ use frame_support::{ parameter_types, traits::{ fungible, fungibles, tokens::imbalance::ResolveAssetTo, AsEnsureOriginWithArg, ConstBool, - ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter, NeverEnsureOrigin, + ConstU32, ConstU64, ConstU8, EitherOfDiverse, Equals, InstanceFilter, NeverEnsureOrigin, TransformOrigin, WithdrawReasons, }, weights::{ConstantMultiplier, Weight, WeightToFee as _}, @@ -855,7 +855,8 @@ impl pallet_xcm_bridge_hub_router::Config for Runtime type DestinationVersion = PolkadotXcm; type SiblingBridgeHubLocation = xcm_config::bridging::SiblingBridgeHub; - + type BridgeHubOrigin = + EitherOfDiverse, EnsureXcm>>; type ToBridgeHubSender = XcmpQueue; type ByteFee = xcm_config::bridging::XcmBridgeHubRouterByteFee; diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_xcm_bridge_hub_router.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_xcm_bridge_hub_router.rs index 7948fe86f1..30f2301afa 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_xcm_bridge_hub_router.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/pallet_xcm_bridge_hub_router.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_bridge_hub_router` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-01-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./asset-hub-polkadot-chain-spec.json")`, DB CACHE: 1024 @@ -51,14 +51,14 @@ impl pallet_xcm_bridge_hub_router::WeightInfo for Weigh /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) - /// Storage: `ToKusamaXcmRouter::DeliveryFeeFactor` (r:1 w:1) - /// Proof: `ToKusamaXcmRouter::DeliveryFeeFactor` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `ToKusamaXcmRouter::Bridge` (r:1 w:1) + /// Proof: `ToKusamaXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) fn on_initialize_when_non_congested() -> Weight { // Proof Size summary in bytes: - // Measured: `225` + // Measured: `226` // Estimated: `5487` - // Minimum execution time: 18_950_000 picoseconds. - Weight::from_parts(19_320_000, 0) + // Minimum execution time: 19_600_000 picoseconds. + Weight::from_parts(20_010_000, 0) .saturating_add(Weight::from_parts(0, 5487)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -71,9 +71,21 @@ impl pallet_xcm_bridge_hub_router::WeightInfo for Weigh // Proof Size summary in bytes: // Measured: `111` // Estimated: `5487` - // Minimum execution time: 8_620_000 picoseconds. - Weight::from_parts(8_830_000, 0) + // Minimum execution time: 8_771_000 picoseconds. + Weight::from_parts(8_930_000, 0) .saturating_add(Weight::from_parts(0, 5487)) .saturating_add(T::DbWeight::get().reads(2)) } + /// Storage: `ToKusamaXcmRouter::Bridge` (r:1 w:1) + /// Proof: `ToKusamaXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) + fn report_bridge_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `150` + // Estimated: `1502` + // Minimum execution time: 15_080_000 picoseconds. + Weight::from_parts(15_471_000, 0) + .saturating_add(Weight::from_parts(0, 1502)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } } diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs b/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs index b03bf05954..ca193927a2 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/tests/tests.rs @@ -27,7 +27,7 @@ use asset_hub_polkadot_runtime::{ AllPalletsWithoutSystem, AssetConversion, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, - TrustBackedAssetsInstance, XcmpQueue, SLOT_DURATION, + ToKusamaXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue, SLOT_DURATION, }; use asset_test_utils::{ test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder, @@ -585,6 +585,56 @@ fn reserve_transfer_native_asset_to_non_teleport_para_works() { ); } +#[test] +fn report_bridge_status_from_xcm_bridge_router_for_kusama_works() { + asset_test_utils::test_cases_over_bridge::report_bridge_status_from_xcm_bridge_router_works::< + Runtime, + AllPalletsWithoutSystem, + XcmConfig, + LocationToAccountId, + ToKusamaXcmRouterInstance, + >( + collator_session_keys(), + bridging_to_asset_hub_kusama, + || bp_asset_hub_polkadot::build_congestion_message(Default::default(), true).into(), + || bp_asset_hub_polkadot::build_congestion_message(Default::default(), false).into(), + ) +} + +#[test] +fn test_report_bridge_status_call_compatibility() { + // if this test fails, make sure `bp_asset_hub_kusama` has valid encoding + assert_eq!( + RuntimeCall::ToKusamaXcmRouter(pallet_xcm_bridge_hub_router::Call::report_bridge_status { + bridge_id: Default::default(), + is_congested: true, + }) + .encode(), + bp_asset_hub_polkadot::Call::ToKusamaXcmRouter( + bp_asset_hub_polkadot::XcmBridgeHubRouterCall::report_bridge_status { + bridge_id: Default::default(), + is_congested: true, + } + ) + .encode() + ) +} + +#[test] +fn check_sane_weight_report_bridge_status() { + use pallet_xcm_bridge_hub_router::WeightInfo; + let actual = >::WeightInfo::report_bridge_status(); + let max_weight = bp_asset_hub_polkadot::XcmBridgeHubRouterTransactCallMaxWeight::get(); + assert!( + actual.all_lte(max_weight), + "max_weight: {:?} should be adjusted to actual {:?}", + max_weight, + actual + ); +} + #[test] fn change_xcm_bridge_hub_router_base_fee_by_governance_works() { asset_test_utils::test_cases::change_storage_constant_by_governance_works::< diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs index 714c92f985..14d131f184 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs @@ -70,8 +70,11 @@ impl ChainWithMessages for BridgeHubKusama { WITH_BRIDGE_HUB_KUSAMA_MESSAGES_PALLET_NAME; const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce = MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; - const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = - MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + /// This constant limits the maximum number of messages in `receive_messages_proof`. + /// We need to adjust it from 4096 to 2024 due to the actual weights identified by + /// `check_message_lane_weights`. A higher value can be set once we switch + /// `max_extrinsic_weight` to `BlockWeightsForAsyncBacking`. + const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = 2024; } /// Public key of the chain account that may be used to verify signatures. @@ -100,7 +103,7 @@ frame_support::parameter_types! { /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Kusama /// BridgeHub. /// (initially was calculated by test `BridgeHubKusama::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubKusamaBaseXcmFeeInKsms: u128 = 590_387_000; + pub const BridgeHubKusamaBaseXcmFeeInKsms: u128 = 601_115_666; /// Transaction fee that is paid at the Kusama BridgeHub for delivering single inbound message. /// (initially was calculated by test `BridgeHubKusama::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`) diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs index 62d89747ae..6b595f523b 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs @@ -20,7 +20,7 @@ use crate::{ weights, xcm_config::{UniversalLocation, XcmRouter}, AccountId, Balance, Balances, BlockNumber, BridgePolkadotMessages, PolkadotXcm, Runtime, - RuntimeEvent, RuntimeHoldReason, XcmOverBridgeHubPolkadot, + RuntimeEvent, RuntimeHoldReason, XcmOverBridgeHubPolkadot, XcmpQueue, }; use bp_messages::{ source_chain::FromBridgedChainMessagesDeliveryProof, @@ -39,7 +39,7 @@ use pallet_bridge_messages::LaneIdOf; use pallet_bridge_relayers::extension::{ BridgeRelayersSignedExtension, WithMessagesExtensionConfig, }; -use pallet_xcm_bridge_hub::XcmAsPlainPayload; +use pallet_xcm_bridge_hub::{BridgeId, XcmAsPlainPayload}; use parachains_common::xcm_config::{AllSiblingSystemParachains, RelayOrOtherSystemParachains}; use polkadot_parachain_primitives::primitives::Sibling; use sp_runtime::traits::ConstU32; @@ -215,6 +215,7 @@ impl pallet_bridge_messages::Config for R type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter< Runtime, WithBridgeHubPolkadotMessagesInstance, + RelayersForLegacyLaneIdsMessagesInstance, DeliveryRewardInBalance, >; type MessageDispatch = XcmOverBridgeHubPolkadot; @@ -252,144 +253,43 @@ impl pallet_xcm_bridge_hub::Config for Runtime type AllowWithoutBridgeDeposit = RelayOrOtherSystemParachains; - type LocalXcmChannelManager = XcmpQueueChannelManager; + type LocalXcmChannelManager = CongestionManager; type BlobDispatcher = FromPolkadotMessageBlobDispatcher; } -/// Implementation `bp_xcm_bridge_hub::LocalXcmChannelManager`. -pub struct XcmpQueueChannelManager; -impl bp_xcm_bridge_hub::LocalXcmChannelManager for XcmpQueueChannelManager { - type Error = (); +/// Implementation of `bp_xcm_bridge_hub::LocalXcmChannelManager` for congestion management. +pub struct CongestionManager; +impl pallet_xcm_bridge_hub::LocalXcmChannelManager for CongestionManager { + type Error = SendError; fn is_congested(with: &Location) -> bool { - // This is used to check the inbound queue/messages to determine if they can be dispatched - // and sent to the sibling parachain. Therefore, checking `OutXcmp` is sufficient. + // This is used to check the inbound bridge queue/messages to determine if they can be + // dispatched and sent to the sibling parachain. Therefore, checking outbound `XcmpQueue` + // is sufficient here. use bp_xcm_bridge_hub_router::XcmChannelStatusProvider; cumulus_pallet_xcmp_queue::bridging::OutXcmpChannelStatusProvider::::is_congested( with, ) } - fn suspend_bridge( - _local_origin: &Location, - _: pallet_xcm_bridge_hub::BridgeId, - ) -> Result<(), Self::Error> { - // IMPORTANT NOTE: - // - // Unfortunately, `https://github.com/paritytech/polkadot-sdk/pull/6231` reworked congestion is not yet released. - // - // And unfortunately, we don't have access to `XcmpQueue::send_signal(para, - // ChannelSignal::Suspend)` here (which would require patch release), we can add this - // hacky workaround/tmp/implementation that should trigger `ChannelSignal::Suspend`, e.g.: - /* - use crate::{MessageQueue, XcmpQueue}; - use bridge_hub_common::message_queue::AggregateMessageOrigin; - use codec::{Decode, Encode, MaxEncodedLen}; - use frame_support::traits::EnqueueMessage; - use frame_support::pallet_prelude::OptionQuery; - use pallet_message_queue::OnQueueChanged; - use scale_info::TypeInfo; - - // get sibling para id - let local_origin_para_id: crate::ParaId = match local_origin.unpack() { - (1, [Parachain(id)]) => (*id).into(), - _ => return Err(()) - }; - - // read `suspend_threshold` from `XcmpQueue` storage - #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)] - struct QueueConfigData { - suspend_threshold: u32, - drop_threshold: u32, - resume_threshold: u32, - } - #[frame_support::storage_alias] - type QueueConfig = StorageValue; - let suspend_threshold = match QueueConfig::get() { - Some(qc) => qc.suspend_threshold, - None => return Err(()) - }; - - // Now, this should trigger `XcmpQueue::send_signal(para, ChannelSignal::Suspend)` - let mut qf = MessageQueue::footprint(AggregateMessageOrigin::Sibling(local_origin_para_id)); - qf.ready_pages = suspend_threshold; - XcmpQueue::on_queue_changed(local_origin_para_id.into(), qf); - */ - - // IMPORTANT NOTE2: - // - // In the current setup, this code is likely triggered only for the hard-coded AHK<>AHP - // lane, as we do not support any other bridge lanes on BridgeHubs. It is triggered only - // when `pallet_bridge_messages::OutboundMessages` reaches 8,192 undelivered messages. The - // potential risk of keeping `Ok(())` or `Err(())` here is that - // `pallet_bridge_messages::OutboundMessages` may continue to grow: - // - // ``` - // #[pallet::storage] - // pub type OutboundMessages, I: 'static = ()> = - // StorageMap<_, Blake2_128Concat, MessageKey, StoredMessagePayload>; - // ``` - - // TODO: decide: - // 1. wait for patch-release stable2409-3 2024-12-12 - // 2. go with `Ok(())` / `Err(())` - // 3. go with `XcmpQueue::send_signal` temporary workaround till patch release - - Ok(()) + fn suspend_bridge(local_origin: &Location, bridge: BridgeId) -> Result<(), Self::Error> { + // This bridge is intended for AH<>AH communication with a hard-coded/static lane, + // so `local_origin` is expected to represent only the local AH. + send_xcm::( + local_origin.clone(), + bp_asset_hub_kusama::build_congestion_message(bridge.inner(), true).into(), + ) + .map(|_| ()) } - fn resume_bridge( - _local_origin: &Location, - _: pallet_xcm_bridge_hub::BridgeId, - ) -> Result<(), Self::Error> { - // IMPORTANT NOTE: - // - // Unfortunately, `https://github.com/paritytech/polkadot-sdk/pull/6231` reworked congestion is not yet released. - // - // And unfortunately, we don't have access to `XcmpQueue::send_signal(para, - // ChannelSignal::Resume)` here (which would require patch release), we can add this hacky - // workaround/tmp/implementation that should trigger `ChannelSignal::Resume`, e.g.: - /* - use crate::{MessageQueue, XcmpQueue}; - use bridge_hub_common::message_queue::AggregateMessageOrigin; - use codec::{Decode, Encode, MaxEncodedLen}; - use frame_support::traits::EnqueueMessage; - use frame_support::pallet_prelude::OptionQuery; - use pallet_message_queue::OnQueueChanged; - use scale_info::TypeInfo; - - // get sibling para id - let local_origin_para_id: crate::ParaId = match local_origin.unpack() { - (1, [Parachain(id)]) => (*id).into(), - _ => return Err(()) - }; - - // read `resume_threshold` from `XcmpQueue` storage - #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)] - struct QueueConfigData { - suspend_threshold: u32, - drop_threshold: u32, - resume_threshold: u32, - } - #[frame_support::storage_alias] - type QueueConfig = StorageValue; - let resume_threshold = match QueueConfig::get() { - Some(qc) => qc.resume_threshold, - None => return Err(()) - }; - - // Now, this should trigger `XcmpQueue::send_signal(para, ChannelSignal::Resume)` - let mut qf = MessageQueue::footprint(AggregateMessageOrigin::Sibling(local_origin_para_id)); - qf.ready_pages = resume_threshold; - XcmpQueue::on_queue_changed(local_origin_para_id.into(), qf); - */ - - // TODO: decide: - // 1. wait for patch-release stable2409-3 2024-12-12 - // 2. go with `Ok(())` / `Err(())` - // 3. go with `XcmpQueue::send_signal` temporary workaround till patch release - - Ok(()) + fn resume_bridge(local_origin: &Location, bridge: BridgeId) -> Result<(), Self::Error> { + // This bridge is intended for AH<>AH communication with a hard-coded/static lane, + // so `local_origin` is expected to represent only the local AH. + send_xcm::( + local_origin.clone(), + bp_asset_hub_kusama::build_congestion_message(bridge.inner(), false).into(), + ) + .map(|_| ()) } } @@ -464,14 +364,15 @@ mod tests { #[test] fn ensure_bridge_hub_kusama_message_lane_weights_are_correct() { + use bp_messages::ChainWithMessages; check_message_lane_weights::< bp_bridge_hub_kusama::BridgeHubKusama, Runtime, WithBridgeHubPolkadotMessagesInstance, >( bp_bridge_hub_polkadot::EXTRA_STORAGE_PROOF_SIZE, - bp_bridge_hub_kusama::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, - bp_bridge_hub_kusama::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, + bp_bridge_hub_kusama::BridgeHubKusama::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, + bp_bridge_hub_kusama::BridgeHubKusama::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, true, ); } @@ -480,7 +381,6 @@ mod tests { fn ensure_bridge_integrity() { assert_complete_bridge_types!( runtime: Runtime, - with_bridged_chain_grandpa_instance: BridgeGrandpaPolkadotInstance, with_bridged_chain_messages_instance: WithBridgeHubPolkadotMessagesInstance, this_chain: bp_bridge_hub_kusama::BridgeHubKusama, bridged_chain: bp_bridge_hub_polkadot::BridgeHubPolkadot, @@ -488,9 +388,8 @@ mod tests { assert_complete_with_parachain_bridge_constants::< Runtime, - BridgeGrandpaPolkadotInstance, + BridgeParachainPolkadotInstance, WithBridgeHubPolkadotMessagesInstance, - bp_polkadot::Polkadot, >(AssertCompleteBridgeConstants { this_chain_constants: AssertChainConstants { block_length: bp_bridge_hub_kusama::BlockLength::get(), diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs index d40ff9e449..644c7baa43 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs @@ -27,6 +27,7 @@ fn bridge_hub_kusama_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, + opened_bridges: Vec<(Location, InteriorLocation, Option)>, ) -> serde_json::Value { serde_json::json!({ "balances": BalancesConfig { @@ -61,19 +62,12 @@ fn bridge_hub_kusama_genesis( "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, + "xcmOverBridgeHubPolkadot": XcmOverBridgeHubPolkadotConfig { opened_bridges, ..Default::default() }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` }) } -pub fn bridge_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_kusama_genesis(invulnerables(), testnet_accounts(), para_id) -} - -fn bridge_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_kusama_local_testnet_genesis(para_id) -} - /// Provides the names of the predefined genesis configs for this runtime. pub fn preset_names() -> Vec { vec![PresetId::from("development"), PresetId::from("local_testnet")] @@ -82,8 +76,18 @@ pub fn preset_names() -> Vec { /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { - Ok("development") => bridge_hub_kusama_development_genesis(1002.into()), - Ok("local_testnet") => bridge_hub_kusama_local_testnet_genesis(1002.into()), + Ok("development") => + bridge_hub_kusama_genesis(invulnerables(), testnet_accounts(), 1002.into(), vec![]), + Ok("local_testnet") => bridge_hub_kusama_genesis( + invulnerables(), + testnet_accounts(), + 1002.into(), + vec![( + Location::new(1, [Parachain(1000)]), + Junctions::from([GlobalConsensus(Polkadot), Parachain(1000)]), + Some(bp_messages::LegacyLaneId([0, 0, 0, 1])), + )], + ), _ => return None, }; Some( diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index f91f4dc3bc..7d4fedb7d0 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -1241,7 +1241,7 @@ impl_runtime_apis! { let bench_lane_id = >::bench_lane_id(); use bp_runtime::Chain; let bridged_chain_id =>::BridgedChain::ID; - pallet_bridge_relayers::Pallet::::relayer_reward( + pallet_bridge_relayers::Pallet::::relayer_reward( relayer, bp_relayers::RewardsAccountParams::new( bench_lane_id, @@ -1257,6 +1257,19 @@ impl_runtime_apis! { use cumulus_primitives_core::XcmpMessageSource; assert!(XcmpQueue::take_outbound_messages(usize::MAX).is_empty()); ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(42.into()); + let _ = PolkadotXcm::force_xcm_version( + RuntimeOrigin::root(), + Box::new(Location::new(1, Parachain(42))), + XCM_VERSION, + ).map_err(|e| { + log::error!( + "Failed to dispatch `force_xcm_version({:?}, {:?}, {:?})`, error: {:?}", + RuntimeOrigin::root(), + Location::new(1, Parachain(42)), + XCM_VERSION, + e + ); + }).expect("XcmVersion stored!"); let universal_source = bridge_to_polkadot_config::open_bridge_for_benchmarks::< Runtime, bridge_to_polkadot_config::XcmOverBridgeHubPolkadotInstance, diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_messages.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_messages.rs index a69730a504..0e82b19c1a 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_messages.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_messages.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_bridge_messages` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./bridge-hub-kusama-chain-spec.json")`, DB CACHE: 1024 @@ -49,92 +49,104 @@ pub struct WeightInfo(PhantomData); impl pallet_bridge_messages::WeightInfo for WeightInfo { /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) - /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn receive_single_message_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `489` + // Measured: `825` // Estimated: `52645` - // Minimum execution time: 54_361_000 picoseconds. - Weight::from_parts(55_341_000, 0) + // Minimum execution time: 82_550_000 picoseconds. + Weight::from_parts(83_341_000, 0) .saturating_add(Weight::from_parts(0, 52645)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) - /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(64), `max_size`: Some(196), added: 1186, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 4076]`. fn receive_n_messages_proof(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `701` - // Estimated: `52674` - // Minimum execution time: 62_034_000 picoseconds. - Weight::from_parts(63_355_000, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 8_231 - .saturating_add(Weight::from_parts(14_096_117, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Measured: `825` + // Estimated: `52645` + // Minimum execution time: 82_480_000 picoseconds. + Weight::from_parts(83_071_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 14_245 + .saturating_add(Weight::from_parts(14_081_140, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) - /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn receive_single_message_proof_with_outbound_lane_state() -> Weight { // Proof Size summary in bytes: - // Measured: `489` + // Measured: `825` // Estimated: `52645` - // Minimum execution time: 61_031_000 picoseconds. - Weight::from_parts(62_040_000, 0) + // Minimum execution time: 84_281_000 picoseconds. + Weight::from_parts(85_210_000, 0) .saturating_add(Weight::from_parts(0, 52645)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) - /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(64), `max_size`: Some(196), added: 1186, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 16384]`. fn receive_single_n_bytes_message_proof(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `701` - // Estimated: `52674` - // Minimum execution time: 58_688_000 picoseconds. - Weight::from_parts(61_404_716, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 7 - .saturating_add(Weight::from_parts(2_249, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Measured: `825` + // Estimated: `52645` + // Minimum execution time: 75_740_000 picoseconds. + Weight::from_parts(77_994_916, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 5 + .saturating_add(Weight::from_parts(2_071, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) @@ -142,98 +154,112 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Proof: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Storage: `BridgeRelayers::RelayerRewards` (r:1 w:1) /// Proof: `BridgeRelayers::RelayerRewards` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundMessages` (r:0 w:1) + /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) fn receive_delivery_proof_for_single_message() -> Weight { // Proof Size summary in bytes: - // Measured: `362` - // Estimated: `3827` - // Minimum execution time: 38_660_000 picoseconds. - Weight::from_parts(39_380_000, 0) - .saturating_add(Weight::from_parts(0, 3827)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `697` + // Estimated: `5354` + // Minimum execution time: 65_940_000 picoseconds. + Weight::from_parts(66_570_000, 0) + .saturating_add(Weight::from_parts(0, 5354)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Proof: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Storage: `BridgeRelayers::RelayerRewards` (r:1 w:1) /// Proof: `BridgeRelayers::RelayerRewards` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundMessages` (r:0 w:2) + /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { // Proof Size summary in bytes: - // Measured: `362` - // Estimated: `3827` - // Minimum execution time: 38_521_000 picoseconds. - Weight::from_parts(39_290_000, 0) - .saturating_add(Weight::from_parts(0, 3827)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `697` + // Estimated: `5354` + // Minimum execution time: 67_271_000 picoseconds. + Weight::from_parts(68_090_000, 0) + .saturating_add(Weight::from_parts(0, 5354)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Proof: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Storage: `BridgeRelayers::RelayerRewards` (r:2 w:2) /// Proof: `BridgeRelayers::RelayerRewards` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundMessages` (r:0 w:2) + /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { // Proof Size summary in bytes: - // Measured: `362` + // Measured: `697` // Estimated: `6086` - // Minimum execution time: 43_780_000 picoseconds. - Weight::from_parts(44_681_000, 0) + // Minimum execution time: 72_500_000 picoseconds. + Weight::from_parts(73_331_000, 0) .saturating_add(Weight::from_parts(0, 6086)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) - /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(64), `max_size`: Some(196), added: 1186, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) /// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) - /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 16384]`. fn receive_single_n_bytes_message_proof_with_dispatch(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `965` - // Estimated: `52674` - // Minimum execution time: 84_340_000 picoseconds. - Weight::from_parts(89_615_003, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 15 - .saturating_add(Weight::from_parts(7_574, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(12)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `948` + // Estimated: `52645` + // Minimum execution time: 96_271_000 picoseconds. + Weight::from_parts(100_814_545, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 8 + .saturating_add(Weight::from_parts(7_048, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(3)) } -} +} \ No newline at end of file diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_relayers.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_relayers.rs index 13951a45e8..3d1c19c754 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_relayers.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/pallet_bridge_relayers.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_bridge_relayers` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./bridge-hub-kusama-chain-spec.json")`, DB CACHE: 1024 @@ -55,8 +55,8 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `207` // Estimated: `3593` - // Minimum execution time: 53_330_000 picoseconds. - Weight::from_parts(53_911_000, 0) + // Minimum execution time: 62_111_000 picoseconds. + Weight::from_parts(62_761_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -71,8 +71,8 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `61` // Estimated: `4714` - // Minimum execution time: 28_741_000 picoseconds. - Weight::from_parts(29_300_000, 0) + // Minimum execution time: 33_541_000 picoseconds. + Weight::from_parts(34_210_000, 0) .saturating_add(Weight::from_parts(0, 4714)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -85,8 +85,8 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `160` // Estimated: `4714` - // Minimum execution time: 29_411_000 picoseconds. - Weight::from_parts(29_960_000, 0) + // Minimum execution time: 34_340_000 picoseconds. + Weight::from_parts(34_610_000, 0) .saturating_add(Weight::from_parts(0, 4714)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,8 +101,8 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `263` // Estimated: `4714` - // Minimum execution time: 32_400_000 picoseconds. - Weight::from_parts(32_750_000, 0) + // Minimum execution time: 37_930_000 picoseconds. + Weight::from_parts(38_491_000, 0) .saturating_add(Weight::from_parts(0, 4714)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -113,8 +113,8 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< // Proof Size summary in bytes: // Measured: `6` // Estimated: `3538` - // Minimum execution time: 5_970_000 picoseconds. - Weight::from_parts(6_110_000, 0) + // Minimum execution time: 10_190_000 picoseconds. + Weight::from_parts(10_460_000, 0) .saturating_add(Weight::from_parts(0, 3538)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 084eb91ecf..1e370cc36f 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/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 32.0.0 -//! DATE: 2024-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./bridge-hub-kusama-chain-spec.json")`, DB CACHE: 1024 @@ -53,10 +53,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -65,87 +61,87 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn report_holding() -> Weight { // Proof Size summary in bytes: - // Measured: `260` + // Measured: `191` // Estimated: `6196` - // Minimum execution time: 75_981_000 picoseconds. - Weight::from_parts(76_811_000, 0) + // Minimum execution time: 86_330_000 picoseconds. + Weight::from_parts(87_251_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub(crate) fn buy_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 780_000 picoseconds. - Weight::from_parts(820_000, 0) + // Minimum execution time: 810_000 picoseconds. + Weight::from_parts(900_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `PolkadotXcm::Queries` (r:1 w:0) /// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) pub(crate) fn query_response() -> Weight { // Proof Size summary in bytes: - // Measured: `69` - // Estimated: `3534` - // Minimum execution time: 8_030_000 picoseconds. - Weight::from_parts(8_330_000, 0) - .saturating_add(Weight::from_parts(0, 3534)) + // Measured: `0` + // Estimated: `3465` + // Minimum execution time: 7_710_000 picoseconds. + Weight::from_parts(8_020_000, 0) + .saturating_add(Weight::from_parts(0, 3465)) .saturating_add(T::DbWeight::get().reads(1)) } pub(crate) fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_420_000 picoseconds. - Weight::from_parts(7_580_000, 0) + // Minimum execution time: 8_980_000 picoseconds. + Weight::from_parts(9_270_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_480_000 picoseconds. - Weight::from_parts(1_600_000, 0) + // Minimum execution time: 1_740_000 picoseconds. + Weight::from_parts(1_860_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 800_000 picoseconds. - Weight::from_parts(850_000, 0) + // Minimum execution time: 820_000 picoseconds. + Weight::from_parts(920_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 770_000 picoseconds. - Weight::from_parts(820_000, 0) + // Minimum execution time: 870_000 picoseconds. + Weight::from_parts(920_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 740_000 picoseconds. - Weight::from_parts(810_000, 0) + // Minimum execution time: 760_000 picoseconds. + Weight::from_parts(860_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 780_000 picoseconds. - Weight::from_parts(850_000, 0) + // Minimum execution time: 880_000 picoseconds. + Weight::from_parts(930_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 760_000 picoseconds. - Weight::from_parts(820_000, 0) + // Minimum execution time: 840_000 picoseconds. + Weight::from_parts(890_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) @@ -154,10 +150,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -166,23 +158,23 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn report_error() -> Weight { // Proof Size summary in bytes: - // Measured: `260` + // Measured: `191` // Estimated: `6196` - // Minimum execution time: 71_730_000 picoseconds. - Weight::from_parts(72_841_000, 0) + // Minimum execution time: 81_941_000 picoseconds. + Weight::from_parts(82_471_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } /// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1) /// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) pub(crate) fn claim_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `126` - // Estimated: `3591` - // Minimum execution time: 11_550_000 picoseconds. - Weight::from_parts(11_880_000, 0) - .saturating_add(Weight::from_parts(0, 3591)) + // Measured: `23` + // Estimated: `3488` + // Minimum execution time: 13_891_000 picoseconds. + Weight::from_parts(14_270_000, 0) + .saturating_add(Weight::from_parts(0, 3488)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -191,7 +183,7 @@ impl WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 750_000 picoseconds. - Weight::from_parts(810_000, 0) + Weight::from_parts(840_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1) @@ -200,23 +192,19 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn subscribe_version() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `3540` - // Minimum execution time: 25_420_000 picoseconds. - Weight::from_parts(26_091_000, 0) - .saturating_add(Weight::from_parts(0, 3540)) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `6` + // Estimated: `3471` + // Minimum execution time: 29_500_000 picoseconds. + Weight::from_parts(29_861_000, 0) + .saturating_add(Weight::from_parts(0, 3471)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `PolkadotXcm::VersionNotifyTargets` (r:0 w:1) /// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -224,8 +212,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_030_000 picoseconds. - Weight::from_parts(3_180_000, 0) + // Minimum execution time: 3_760_000 picoseconds. + Weight::from_parts(3_850_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -233,24 +221,24 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_310_000 picoseconds. - Weight::from_parts(1_430_000, 0) + // Minimum execution time: 1_400_000 picoseconds. + Weight::from_parts(1_520_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 840_000 picoseconds. - Weight::from_parts(960_000, 0) + // Minimum execution time: 960_000 picoseconds. + Weight::from_parts(1_040_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 800_000 picoseconds. - Weight::from_parts(830_000, 0) + // Minimum execution time: 810_000 picoseconds. + Weight::from_parts(860_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_error() -> Weight { @@ -258,15 +246,15 @@ impl WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 780_000 picoseconds. - Weight::from_parts(820_000, 0) + Weight::from_parts(850_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 980_000 picoseconds. - Weight::from_parts(1_080_000, 0) + // Minimum execution time: 960_000 picoseconds. + Weight::from_parts(1_060_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) @@ -275,10 +263,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -287,20 +271,20 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn query_pallet() -> Weight { // Proof Size summary in bytes: - // Measured: `260` + // Measured: `191` // Estimated: `6196` - // Minimum execution time: 76_500_000 picoseconds. - Weight::from_parts(77_481_000, 0) + // Minimum execution time: 87_931_000 picoseconds. + Weight::from_parts(88_701_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub(crate) fn expect_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_160_000 picoseconds. - Weight::from_parts(4_230_000, 0) + // Minimum execution time: 4_740_000 picoseconds. + Weight::from_parts(4_941_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) @@ -309,10 +293,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -321,60 +301,60 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn report_transact_status() -> Weight { // Proof Size summary in bytes: - // Measured: `260` + // Measured: `191` // Estimated: `6196` - // Minimum execution time: 72_011_000 picoseconds. - Weight::from_parts(72_640_000, 0) + // Minimum execution time: 82_001_000 picoseconds. + Weight::from_parts(82_920_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } pub(crate) fn clear_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 810_000 picoseconds. - Weight::from_parts(870_000, 0) + // Minimum execution time: 860_000 picoseconds. + Weight::from_parts(960_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 740_000 picoseconds. - Weight::from_parts(800_000, 0) + // Minimum execution time: 770_000 picoseconds. + Weight::from_parts(841_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 730_000 picoseconds. - Weight::from_parts(790_000, 0) + // Minimum execution time: 780_000 picoseconds. + Weight::from_parts(830_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubPolkadot::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubPolkadot::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:2 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotMessages::OutboundLanesCongestedSignals` (r:1 w:0) - /// Proof: `BridgePolkadotMessages::OutboundLanesCongestedSignals` (`max_values`: Some(1), `max_size`: Some(21), added: 516, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotMessages::OutboundMessages` (r:0 w:1) - /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(2621472), added: 2623947, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 1000]`. pub(crate) fn export_message(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `190` - // Estimated: `6130` - // Minimum execution time: 45_121_000 picoseconds. - Weight::from_parts(45_976_501, 0) - .saturating_add(Weight::from_parts(0, 6130)) - // Standard Error: 41 - .saturating_add(Weight::from_parts(54_514, 0).saturating_mul(x.into())) + // Measured: `433` + // Estimated: `6373` + // Minimum execution time: 66_121_000 picoseconds. + Weight::from_parts(66_848_907, 0) + .saturating_add(Weight::from_parts(0, 6373)) + // Standard Error: 40 + .saturating_add(Weight::from_parts(55_280, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -382,16 +362,16 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 720_000 picoseconds. - Weight::from_parts(800_000, 0) + // Minimum execution time: 740_000 picoseconds. + Weight::from_parts(850_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 780_000 picoseconds. - Weight::from_parts(820_000, 0) + // Minimum execution time: 850_000 picoseconds. + Weight::from_parts(920_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs index 20b87d9756..db591cee00 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs @@ -255,11 +255,12 @@ fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() { >( SiblingParachainLocation::get(), BridgedUniversalLocation::get(), - |locations, fee| { + false, + |locations, _fee| { bridge_hub_test_utils::open_bridge_with_storage::< Runtime, XcmOverBridgeHubPolkadotInstance - >(locations, fee, LegacyLaneId([0, 0, 0, 1])) + >(locations, LegacyLaneId([0, 0, 0, 1])) } ).1 }, @@ -317,11 +318,12 @@ fn relayed_incoming_message_works() { >( SiblingParachainLocation::get(), BridgedUniversalLocation::get(), - |locations, fee| { + false, + |locations, _fee| { bridge_hub_test_utils::open_bridge_with_storage::< Runtime, XcmOverBridgeHubPolkadotInstance, - >(locations, fee, LegacyLaneId([0, 0, 0, 1])) + >(locations, LegacyLaneId([0, 0, 0, 1])) }, ) .1 @@ -351,11 +353,12 @@ fn free_relay_extrinsic_works() { >( SiblingParachainLocation::get(), BridgedUniversalLocation::get(), - |locations, fee| { + false, + |locations, _fee| { bridge_hub_test_utils::open_bridge_with_storage::< Runtime, XcmOverBridgeHubPolkadotInstance, - >(locations, fee, LegacyLaneId([0, 0, 0, 1])) + >(locations, LegacyLaneId([0, 0, 0, 1])) }, ) .1 diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs index 2d97a220d5..1fce65e2fc 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs @@ -67,8 +67,11 @@ impl ChainWithMessages for BridgeHubPolkadot { WITH_BRIDGE_HUB_POLKADOT_MESSAGES_PALLET_NAME; const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce = MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; - const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = - MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + /// This constant limits the maximum number of messages in `receive_messages_proof`. + /// We need to adjust it from 4096 to 2024 due to the actual weights identified by + /// `check_message_lane_weights`. A higher value can be set once we switch + /// `max_extrinsic_weight` to `BlockWeightsForAsyncBacking`. + const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = 2024; } /// Identifier of BridgeHubPolkadot in the Polkadot relay chain. @@ -91,7 +94,7 @@ frame_support::parameter_types! { /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Polkadot /// BridgeHub. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 88_797_450; + pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 90_433_350; /// Transaction fee that is paid at the Polkadot BridgeHub for delivering single inbound message. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_standalone_message_delivery_transaction` + `33%`) diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs index 00d71912f8..a1dd807558 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs @@ -20,7 +20,7 @@ use crate::{ weights, xcm_config::{UniversalLocation, XcmRouter}, AccountId, Balance, Balances, BlockNumber, BridgeKusamaMessages, PolkadotXcm, Runtime, - RuntimeEvent, RuntimeHoldReason, XcmOverBridgeHubKusama, + RuntimeEvent, RuntimeHoldReason, XcmOverBridgeHubKusama, XcmpQueue, }; use bp_messages::{ @@ -39,7 +39,7 @@ use pallet_bridge_messages::LaneIdOf; use pallet_bridge_relayers::extension::{ BridgeRelayersSignedExtension, WithMessagesExtensionConfig, }; -use pallet_xcm_bridge_hub::XcmAsPlainPayload; +use pallet_xcm_bridge_hub::{BridgeId, XcmAsPlainPayload}; use parachains_common::xcm_config::{AllSiblingSystemParachains, RelayOrOtherSystemParachains}; use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_constants as constants; @@ -93,7 +93,7 @@ parameter_types! { pub type RelayersForLegacyLaneIdsMessagesInstance = (); /// Allows collect and claim rewards for relayers. -impl pallet_bridge_relayers::Config for Runtime { +impl pallet_bridge_relayers::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Reward = Balance; type PaymentProcedure = bp_relayers::PayRewardFromAccount< @@ -216,6 +216,7 @@ impl pallet_bridge_messages::Config for Run type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter< Runtime, WithBridgeHubKusamaMessagesInstance, + RelayersForLegacyLaneIdsMessagesInstance, DeliveryRewardInBalance, >; @@ -252,144 +253,43 @@ impl pallet_xcm_bridge_hub::Config for Runtime { type AllowWithoutBridgeDeposit = RelayOrOtherSystemParachains; - type LocalXcmChannelManager = XcmpQueueChannelManager; + type LocalXcmChannelManager = CongestionManager; type BlobDispatcher = FromKusamaMessageBlobDispatcher; } -/// Implementation `bp_xcm_bridge_hub::LocalXcmChannelManager`. -pub struct XcmpQueueChannelManager; -impl bp_xcm_bridge_hub::LocalXcmChannelManager for XcmpQueueChannelManager { - type Error = (); +/// Implementation of `bp_xcm_bridge_hub::LocalXcmChannelManager` for congestion management. +pub struct CongestionManager; +impl pallet_xcm_bridge_hub::LocalXcmChannelManager for CongestionManager { + type Error = SendError; fn is_congested(with: &Location) -> bool { - // This is used to check the inbound queue/messages to determine if they can be dispatched - // and sent to the sibling parachain. Therefore, checking `OutXcmp` is sufficient. + // This is used to check the inbound bridge queue/messages to determine if they can be + // dispatched and sent to the sibling parachain. Therefore, checking outbound `XcmpQueue` + // is sufficient here. use bp_xcm_bridge_hub_router::XcmChannelStatusProvider; cumulus_pallet_xcmp_queue::bridging::OutXcmpChannelStatusProvider::::is_congested( with, ) } - fn suspend_bridge( - _local_origin: &Location, - _: pallet_xcm_bridge_hub::BridgeId, - ) -> Result<(), Self::Error> { - // IMPORTANT NOTE: - // - // Unfortunately, `https://github.com/paritytech/polkadot-sdk/pull/6231` reworked congestion is not yet released. - // - // And unfortunately, we don't have access to `XcmpQueue::send_signal(para, - // ChannelSignal::Suspend)` here (which would require patch release), we can add this - // hacky workaround/tmp/implementation that should trigger `ChannelSignal::Suspend`, e.g.: - /* - use crate::{MessageQueue, XcmpQueue}; - use bridge_hub_common::message_queue::AggregateMessageOrigin; - use codec::{Decode, Encode, MaxEncodedLen}; - use frame_support::traits::EnqueueMessage; - use frame_support::pallet_prelude::OptionQuery; - use pallet_message_queue::OnQueueChanged; - use scale_info::TypeInfo; - - // get sibling para id - let local_origin_para_id: crate::ParaId = match _local_origin.unpack() { - (1, [Parachain(id)]) => (*id).into(), - _ => return Err(()) - }; - - // read `suspend_threshold` from `XcmpQueue` storage - #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)] - struct QueueConfigData { - suspend_threshold: u32, - drop_threshold: u32, - resume_threshold: u32, - } - #[frame_support::storage_alias] - type QueueConfig = StorageValue; - let suspend_threshold = match QueueConfig::get() { - Some(qc) => qc.suspend_threshold, - None => return Err(()) - }; - - // Now, this should trigger `XcmpQueue::send_signal(para, ChannelSignal::Suspend)` - let mut qf = MessageQueue::footprint(AggregateMessageOrigin::Sibling(local_origin_para_id)); - qf.ready_pages = suspend_threshold; - XcmpQueue::on_queue_changed(local_origin_para_id.into(), qf); - */ - - // IMPORTANT NOTE2: - // - // In the current setup, this code is likely triggered only for the hard-coded AHK<>AHP - // lane, as we do not support any other bridge lanes on BridgeHubs. It is triggered only - // when `pallet_bridge_messages::OutboundMessages` reaches 8,192 undelivered messages. The - // potential risk of keeping `Ok(())` or `Err(())` here is that - // `pallet_bridge_messages::OutboundMessages` may continue to grow: - // - // ``` - // #[pallet::storage] - // pub type OutboundMessages, I: 'static = ()> = - // StorageMap<_, Blake2_128Concat, MessageKey, StoredMessagePayload>; - // ``` - - // TODO: decide: - // 1. wait for patch-release stable2409-3 2024-12-12 - // 2. go with `Ok(())` / `Err(())` - // 3. go with `XcmpQueue::send_signal` temporary workaround till patch release - - Ok(()) + fn suspend_bridge(local_origin: &Location, bridge: BridgeId) -> Result<(), Self::Error> { + // This bridge is intended for AH<>AH communication with a hard-coded/static lane, + // so `local_origin` is expected to represent only the local AH. + send_xcm::( + local_origin.clone(), + bp_asset_hub_kusama::build_congestion_message(bridge.inner(), true).into(), + ) + .map(|_| ()) } - fn resume_bridge( - _local_origin: &Location, - _: pallet_xcm_bridge_hub::BridgeId, - ) -> Result<(), Self::Error> { - // IMPORTANT NOTE: - // - // Unfortunately, `https://github.com/paritytech/polkadot-sdk/pull/6231` reworked congestion is not yet released. - // - // And unfortunately, we don't have access to `XcmpQueue::send_signal(para, - // ChannelSignal::Resume)` here (which would require patch release), we can add this hacky - // workaround/tmp/implementation that should trigger `ChannelSignal::Resume`, e.g.: - /* - use crate::{MessageQueue, XcmpQueue}; - use bridge_hub_common::message_queue::AggregateMessageOrigin; - use codec::{Decode, Encode, MaxEncodedLen}; - use frame_support::traits::EnqueueMessage; - use frame_support::pallet_prelude::OptionQuery; - use pallet_message_queue::OnQueueChanged; - use scale_info::TypeInfo; - - // get sibling para id - let local_origin_para_id: crate::ParaId = match _local_origin.unpack() { - (1, [Parachain(id)]) => (*id).into(), - _ => return Err(()) - }; - - // read `resume_threshold` from `XcmpQueue` storage - #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)] - struct QueueConfigData { - suspend_threshold: u32, - drop_threshold: u32, - resume_threshold: u32, - } - #[frame_support::storage_alias] - type QueueConfig = StorageValue; - let resume_threshold = match QueueConfig::get() { - Some(qc) => qc.resume_threshold, - None => return Err(()) - }; - - // Now, this should trigger `XcmpQueue::send_signal(para, ChannelSignal::Resume)` - let mut qf = MessageQueue::footprint(AggregateMessageOrigin::Sibling(local_origin_para_id)); - qf.ready_pages = resume_threshold; - XcmpQueue::on_queue_changed(local_origin_para_id.into(), qf); - */ - - // TODO: decide: - // 1. wait for patch-release stable2409-3 2024-12-12 - // 2. go with `Ok(())` / `Err(())` - // 3. go with `XcmpQueue::send_signal` temporary workaround till patch release - - Ok(()) + fn resume_bridge(local_origin: &Location, bridge: BridgeId) -> Result<(), Self::Error> { + // This bridge is intended for AH<>AH communication with a hard-coded/static lane, + // so `local_origin` is expected to represent only the local AH. + send_xcm::( + local_origin.clone(), + bp_asset_hub_kusama::build_congestion_message(bridge.inner(), false).into(), + ) + .map(|_| ()) } } @@ -464,14 +364,15 @@ mod tests { #[test] fn ensure_bridge_hub_polkadot_message_lane_weights_are_correct() { + use bp_messages::ChainWithMessages; check_message_lane_weights::< bp_bridge_hub_polkadot::BridgeHubPolkadot, Runtime, WithBridgeHubKusamaMessagesInstance, >( bp_bridge_hub_kusama::EXTRA_STORAGE_PROOF_SIZE, - bp_bridge_hub_polkadot::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, - bp_bridge_hub_polkadot::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, + bp_bridge_hub_polkadot::BridgeHubPolkadot::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, + bp_bridge_hub_polkadot::BridgeHubPolkadot::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, true, ); } @@ -480,7 +381,6 @@ mod tests { fn ensure_bridge_integrity() { assert_complete_bridge_types!( runtime: Runtime, - with_bridged_chain_grandpa_instance: BridgeGrandpaKusamaInstance, with_bridged_chain_messages_instance: WithBridgeHubKusamaMessagesInstance, this_chain: bp_bridge_hub_polkadot::BridgeHubPolkadot, bridged_chain: bp_bridge_hub_kusama::BridgeHubKusama, @@ -488,9 +388,8 @@ mod tests { assert_complete_with_parachain_bridge_constants::< Runtime, - BridgeGrandpaKusamaInstance, + BridgeParachainKusamaInstance, WithBridgeHubKusamaMessagesInstance, - bp_kusama::Kusama, >(AssertCompleteBridgeConstants { this_chain_constants: AssertChainConstants { block_length: bp_bridge_hub_polkadot::BlockLength::get(), diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs index 20b5409148..d346ef2562 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs @@ -27,6 +27,7 @@ fn bridge_hub_polkadot_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, + opened_bridges: Vec<(Location, InteriorLocation, Option)>, ) -> serde_json::Value { serde_json::json!({ "balances": BalancesConfig { @@ -61,6 +62,7 @@ fn bridge_hub_polkadot_genesis( "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, + "xcmOverBridgeHubKusama": XcmOverBridgeHubKusamaConfig { opened_bridges, ..Default::default() }, "ethereumSystem": EthereumSystemConfig { para_id: id, asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), @@ -71,14 +73,6 @@ fn bridge_hub_polkadot_genesis( }) } -pub fn bridge_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_polkadot_genesis(invulnerables(), testnet_accounts(), para_id) -} - -fn bridge_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_polkadot_local_testnet_genesis(para_id) -} - /// Provides the names of the predefined genesis configs for this runtime. pub fn preset_names() -> Vec { vec![PresetId::from("development"), PresetId::from("local_testnet")] @@ -87,8 +81,18 @@ pub fn preset_names() -> Vec { /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { - Ok("development") => bridge_hub_polkadot_development_genesis(1002.into()), - Ok("local_testnet") => bridge_hub_polkadot_local_testnet_genesis(1002.into()), + Ok("development") => + bridge_hub_polkadot_genesis(invulnerables(), testnet_accounts(), 1002.into(), vec![]), + Ok("local_testnet") => bridge_hub_polkadot_genesis( + invulnerables(), + testnet_accounts(), + 1002.into(), + vec![( + Location::new(1, [Parachain(1000)]), + Junctions::from([GlobalConsensus(Kusama), Parachain(1000)]), + Some(bp_messages::LegacyLaneId([0, 0, 0, 1])), + )], + ), _ => return None, }; Some( diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index db80a28e81..092a42c417 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -1277,7 +1277,7 @@ impl_runtime_apis! { let bench_lane_id = >::bench_lane_id(); use bp_runtime::Chain; let bridged_chain_id =>::BridgedChain::ID; - pallet_bridge_relayers::Pallet::::relayer_reward( + pallet_bridge_relayers::Pallet::::relayer_reward( relayer, bp_relayers::RewardsAccountParams::new( bench_lane_id, @@ -1293,6 +1293,19 @@ impl_runtime_apis! { use cumulus_primitives_core::XcmpMessageSource; assert!(XcmpQueue::take_outbound_messages(usize::MAX).is_empty()); ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(42.into()); + let _ = PolkadotXcm::force_xcm_version( + RuntimeOrigin::root(), + Box::new(Location::new(1, Parachain(42))), + XCM_VERSION, + ).map_err(|e| { + log::error!( + "Failed to dispatch `force_xcm_version({:?}, {:?}, {:?})`, error: {:?}", + RuntimeOrigin::root(), + Location::new(1, Parachain(42)), + XCM_VERSION, + e + ); + }).expect("XcmVersion stored!"); let universal_source = bridge_to_kusama_config::open_bridge_for_benchmarks::< Runtime, bridge_to_kusama_config::XcmOverBridgeHubKusamaInstance, diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_messages.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_messages.rs index 982657940a..45959b7b9a 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_messages.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_messages.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_bridge_messages` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./bridge-hub-polkadot-chain-spec.json")`, DB CACHE: 1024 @@ -49,92 +49,104 @@ pub struct WeightInfo(PhantomData); impl pallet_bridge_messages::WeightInfo for WeightInfo { /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) - /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::InboundLanes` (r:1 w:1) /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn receive_single_message_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `595` + // Measured: `899` // Estimated: `52645` - // Minimum execution time: 55_650_000 picoseconds. - Weight::from_parts(56_750_000, 0) + // Minimum execution time: 82_741_000 picoseconds. + Weight::from_parts(83_821_000, 0) .saturating_add(Weight::from_parts(0, 52645)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) - /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(64), `max_size`: Some(196), added: 1186, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 4076]`. fn receive_n_messages_proof(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `701` - // Estimated: `52674` - // Minimum execution time: 62_034_000 picoseconds. - Weight::from_parts(63_355_000, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 8_231 - .saturating_add(Weight::from_parts(14_096_117, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Measured: `899` + // Estimated: `52645` + // Minimum execution time: 82_100_000 picoseconds. + Weight::from_parts(82_781_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 15_462 + .saturating_add(Weight::from_parts(14_282_274, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) - /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::InboundLanes` (r:1 w:1) /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn receive_single_message_proof_with_outbound_lane_state() -> Weight { // Proof Size summary in bytes: - // Measured: `595` + // Measured: `899` // Estimated: `52645` - // Minimum execution time: 62_220_000 picoseconds. - Weight::from_parts(63_270_000, 0) + // Minimum execution time: 87_280_000 picoseconds. + Weight::from_parts(87_801_000, 0) .saturating_add(Weight::from_parts(0, 52645)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) - /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(64), `max_size`: Some(196), added: 1186, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 16384]`. fn receive_single_n_bytes_message_proof(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `701` - // Estimated: `52674` - // Minimum execution time: 58_688_000 picoseconds. - Weight::from_parts(61_404_716, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 7 - .saturating_add(Weight::from_parts(2_249, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Measured: `899` + // Estimated: `52645` + // Minimum execution time: 78_521_000 picoseconds. + Weight::from_parts(80_664_182, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 4 + .saturating_add(Weight::from_parts(2_232, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) @@ -142,98 +154,112 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Proof: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Storage: `BridgeRelayers::RelayerRewards` (r:1 w:1) /// Proof: `BridgeRelayers::RelayerRewards` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `BridgeKusamaMessages::OutboundMessages` (r:0 w:1) + /// Proof: `BridgeKusamaMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) fn receive_delivery_proof_for_single_message() -> Weight { // Proof Size summary in bytes: - // Measured: `432` - // Estimated: `3897` - // Minimum execution time: 40_001_000 picoseconds. - Weight::from_parts(40_480_000, 0) - .saturating_add(Weight::from_parts(0, 3897)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `736` + // Estimated: `5354` + // Minimum execution time: 68_070_000 picoseconds. + Weight::from_parts(68_640_000, 0) + .saturating_add(Weight::from_parts(0, 5354)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) } /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Proof: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Storage: `BridgeRelayers::RelayerRewards` (r:1 w:1) /// Proof: `BridgeRelayers::RelayerRewards` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `BridgeKusamaMessages::OutboundMessages` (r:0 w:2) + /// Proof: `BridgeKusamaMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { // Proof Size summary in bytes: - // Measured: `432` - // Estimated: `3897` - // Minimum execution time: 39_841_000 picoseconds. - Weight::from_parts(40_431_000, 0) - .saturating_add(Weight::from_parts(0, 3897)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `736` + // Estimated: `5354` + // Minimum execution time: 69_661_000 picoseconds. + Weight::from_parts(70_140_000, 0) + .saturating_add(Weight::from_parts(0, 5354)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Proof: UNKNOWN KEY `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) /// Storage: `BridgeRelayers::RelayerRewards` (r:2 w:2) /// Proof: `BridgeRelayers::RelayerRewards` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `BridgeKusamaMessages::OutboundMessages` (r:0 w:2) + /// Proof: `BridgeKusamaMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { // Proof Size summary in bytes: - // Measured: `432` + // Measured: `736` // Estimated: `6086` - // Minimum execution time: 45_101_000 picoseconds. - Weight::from_parts(45_661_000, 0) + // Minimum execution time: 74_821_000 picoseconds. + Weight::from_parts(75_841_000, 0) .saturating_add(Weight::from_parts(0, 6086)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaParachains::ImportedParaHeads` (r:1 w:0) - /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(64), `max_size`: Some(196), added: 1186, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) /// Storage: `XcmOverBridgeHubKusama::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) + /// Proof: `XcmOverBridgeHubKusama::LaneToBridge` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) - /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) /// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) - /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) /// The range of component `n` is `[1, 16384]`. fn receive_single_n_bytes_message_proof_with_dispatch(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `965` - // Estimated: `52674` - // Minimum execution time: 84_340_000 picoseconds. - Weight::from_parts(89_615_003, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 15 - .saturating_add(Weight::from_parts(7_574, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(12)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `1022` + // Estimated: `52645` + // Minimum execution time: 98_430_000 picoseconds. + Weight::from_parts(103_905_453, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 7 + .saturating_add(Weight::from_parts(7_422, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_relayers.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_relayers.rs index aa5986ee0f..fcc78658c3 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_relayers.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_bridge_relayers.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_bridge_relayers` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./bridge-hub-polkadot-chain-spec.json")`, DB CACHE: 1024 @@ -53,10 +53,10 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn claim_rewards() -> Weight { // Proof Size summary in bytes: - // Measured: `278` + // Measured: `205` // Estimated: `3593` - // Minimum execution time: 52_900_000 picoseconds. - Weight::from_parts(53_890_000, 0) + // Minimum execution time: 61_060_000 picoseconds. + Weight::from_parts(61_590_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -69,10 +69,10 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< /// Proof: `Balances::Reserves` (`max_values`: None, `max_size`: Some(1249), added: 3724, mode: `MaxEncodedLen`) fn register() -> Weight { // Proof Size summary in bytes: - // Measured: `115` + // Measured: `42` // Estimated: `4714` - // Minimum execution time: 29_010_000 picoseconds. - Weight::from_parts(29_490_000, 0) + // Minimum execution time: 33_050_000 picoseconds. + Weight::from_parts(33_500_000, 0) .saturating_add(Weight::from_parts(0, 4714)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -83,10 +83,10 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< /// Proof: `Balances::Reserves` (`max_values`: None, `max_size`: Some(1249), added: 3724, mode: `MaxEncodedLen`) fn deregister() -> Weight { // Proof Size summary in bytes: - // Measured: `231` + // Measured: `158` // Estimated: `4714` - // Minimum execution time: 29_811_000 picoseconds. - Weight::from_parts(30_400_000, 0) + // Minimum execution time: 34_041_000 picoseconds. + Weight::from_parts(34_710_000, 0) .saturating_add(Weight::from_parts(0, 4714)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -99,10 +99,10 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn slash_and_deregister() -> Weight { // Proof Size summary in bytes: - // Measured: `334` + // Measured: `261` // Estimated: `4714` - // Minimum execution time: 32_641_000 picoseconds. - Weight::from_parts(33_221_000, 0) + // Minimum execution time: 38_080_000 picoseconds. + Weight::from_parts(38_470_000, 0) .saturating_add(Weight::from_parts(0, 4714)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -111,10 +111,10 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< /// Proof: `BridgeRelayers::RelayerRewards` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) fn register_relayer_reward() -> Weight { // Proof Size summary in bytes: - // Measured: `76` + // Measured: `3` // Estimated: `3538` - // Minimum execution time: 6_700_000 picoseconds. - Weight::from_parts(6_880_000, 0) + // Minimum execution time: 8_380_000 picoseconds. + Weight::from_parts(8_640_000, 0) .saturating_add(Weight::from_parts(0, 3538)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 4205afc0a0..89bb9721fd 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/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 32.0.0 -//! DATE: 2024-08-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./bridge-hub-polkadot-chain-spec.json")`, DB CACHE: 1024 @@ -53,10 +53,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -65,87 +61,87 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn report_holding() -> Weight { // Proof Size summary in bytes: - // Measured: `208` + // Measured: `176` // Estimated: `6196` - // Minimum execution time: 58_621_000 picoseconds. - Weight::from_parts(59_751_000, 0) + // Minimum execution time: 66_301_000 picoseconds. + Weight::from_parts(67_010_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(2)) } pub(crate) fn buy_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_230_000 picoseconds. - Weight::from_parts(1_310_000, 0) + // Minimum execution time: 1_380_000 picoseconds. + Weight::from_parts(1_460_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `PolkadotXcm::Queries` (r:1 w:0) /// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) pub(crate) fn query_response() -> Weight { // Proof Size summary in bytes: - // Measured: `32` - // Estimated: `3497` - // Minimum execution time: 7_760_000 picoseconds. - Weight::from_parts(8_040_000, 0) - .saturating_add(Weight::from_parts(0, 3497)) + // Measured: `0` + // Estimated: `3465` + // Minimum execution time: 8_130_000 picoseconds. + Weight::from_parts(8_380_000, 0) + .saturating_add(Weight::from_parts(0, 3465)) .saturating_add(T::DbWeight::get().reads(1)) } pub(crate) fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_530_000 picoseconds. - Weight::from_parts(8_820_000, 0) + // Minimum execution time: 10_050_000 picoseconds. + Weight::from_parts(10_470_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_120_000 picoseconds. - Weight::from_parts(2_270_000, 0) + // Minimum execution time: 2_380_000 picoseconds. + Weight::from_parts(2_500_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_280_000 picoseconds. - Weight::from_parts(1_330_000, 0) + // Minimum execution time: 1_380_000 picoseconds. + Weight::from_parts(1_450_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_270_000 picoseconds. - Weight::from_parts(1_320_000, 0) + // Minimum execution time: 1_420_000 picoseconds. + Weight::from_parts(1_470_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_220_000 picoseconds. - Weight::from_parts(1_280_000, 0) + // Minimum execution time: 1_360_000 picoseconds. + Weight::from_parts(1_420_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_290_000 picoseconds. - Weight::from_parts(1_350_000, 0) + // Minimum execution time: 1_430_000 picoseconds. + Weight::from_parts(1_500_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_240_000 picoseconds. - Weight::from_parts(1_270_000, 0) + // Minimum execution time: 1_340_000 picoseconds. + Weight::from_parts(1_430_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) @@ -154,10 +150,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -166,23 +158,23 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn report_error() -> Weight { // Proof Size summary in bytes: - // Measured: `208` + // Measured: `176` // Estimated: `6196` - // Minimum execution time: 54_700_000 picoseconds. - Weight::from_parts(55_340_000, 0) + // Minimum execution time: 62_061_000 picoseconds. + Weight::from_parts(62_621_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1) /// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`) pub(crate) fn claim_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `90` - // Estimated: `3555` - // Minimum execution time: 11_300_000 picoseconds. - Weight::from_parts(11_580_000, 0) - .saturating_add(Weight::from_parts(0, 3555)) + // Measured: `24` + // Estimated: `3489` + // Minimum execution time: 12_410_000 picoseconds. + Weight::from_parts(12_660_000, 0) + .saturating_add(Weight::from_parts(0, 3489)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -190,8 +182,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_240_000 picoseconds. - Weight::from_parts(1_270_000, 0) + // Minimum execution time: 1_340_000 picoseconds. + Weight::from_parts(1_440_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1) @@ -200,23 +192,19 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1) /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn subscribe_version() -> Weight { // Proof Size summary in bytes: - // Measured: `75` - // Estimated: `3540` - // Minimum execution time: 25_720_000 picoseconds. - Weight::from_parts(26_510_000, 0) - .saturating_add(Weight::from_parts(0, 3540)) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `43` + // Estimated: `3508` + // Minimum execution time: 29_131_000 picoseconds. + Weight::from_parts(29_740_000, 0) + .saturating_add(Weight::from_parts(0, 3508)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: `PolkadotXcm::VersionNotifyTargets` (r:0 w:1) /// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -224,8 +212,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_610_000 picoseconds. - Weight::from_parts(3_730_000, 0) + // Minimum execution time: 4_140_000 picoseconds. + Weight::from_parts(4_320_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -233,40 +221,40 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_730_000 picoseconds. - Weight::from_parts(1_820_000, 0) + // Minimum execution time: 2_030_000 picoseconds. + Weight::from_parts(2_150_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_300_000 picoseconds. - Weight::from_parts(1_410_000, 0) + // Minimum execution time: 1_540_000 picoseconds. + Weight::from_parts(1_600_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_240_000 picoseconds. - Weight::from_parts(1_320_000, 0) + // Minimum execution time: 1_350_000 picoseconds. + Weight::from_parts(1_450_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_240_000 picoseconds. - Weight::from_parts(1_300_000, 0) + // Minimum execution time: 1_370_000 picoseconds. + Weight::from_parts(1_410_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_470_000 picoseconds. - Weight::from_parts(1_540_000, 0) + // Minimum execution time: 1_600_000 picoseconds. + Weight::from_parts(1_680_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) @@ -275,10 +263,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -287,20 +271,20 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn query_pallet() -> Weight { // Proof Size summary in bytes: - // Measured: `208` + // Measured: `176` // Estimated: `6196` - // Minimum execution time: 59_871_000 picoseconds. - Weight::from_parts(61_230_000, 0) + // Minimum execution time: 67_980_000 picoseconds. + Weight::from_parts(68_651_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(2)) } pub(crate) fn expect_pallet() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_030_000 picoseconds. - Weight::from_parts(5_110_000, 0) + // Minimum execution time: 5_800_000 picoseconds. + Weight::from_parts(5_940_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) @@ -309,10 +293,6 @@ impl WeightInfo { /// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) @@ -321,60 +301,60 @@ impl WeightInfo { /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) pub(crate) fn report_transact_status() -> Weight { // Proof Size summary in bytes: - // Measured: `208` + // Measured: `176` // Estimated: `6196` - // Minimum execution time: 54_591_000 picoseconds. - Weight::from_parts(55_350_000, 0) + // Minimum execution time: 62_230_000 picoseconds. + Weight::from_parts(62_791_000, 0) .saturating_add(Weight::from_parts(0, 6196)) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(2)) } pub(crate) fn clear_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_260_000 picoseconds. - Weight::from_parts(1_350_000, 0) + // Minimum execution time: 1_420_000 picoseconds. + Weight::from_parts(1_510_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_220_000 picoseconds. - Weight::from_parts(1_260_000, 0) + // Minimum execution time: 1_290_000 picoseconds. + Weight::from_parts(1_390_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_210_000 picoseconds. - Weight::from_parts(1_270_000, 0) + // Minimum execution time: 1_360_000 picoseconds. + Weight::from_parts(1_420_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `XcmOverBridgeHubKusama::Bridges` (r:1 w:0) + /// Proof: `XcmOverBridgeHubKusama::Bridges` (`max_values`: None, `max_size`: Some(1889), added: 4364, mode: `MaxEncodedLen`) /// Storage: `PolkadotXcm::SupportedVersion` (r:2 w:0) /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BridgeKusamaMessages::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgeKusamaMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`) - /// Storage: `BridgeKusamaMessages::OutboundLanesCongestedSignals` (r:1 w:0) - /// Proof: `BridgeKusamaMessages::OutboundLanesCongestedSignals` (`max_values`: Some(1), `max_size`: Some(21), added: 516, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) /// Storage: `BridgeKusamaMessages::OutboundMessages` (r:0 w:1) - /// Proof: `BridgeKusamaMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(2621472), added: 2623947, mode: `MaxEncodedLen`) + /// Proof: `BridgeKusamaMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 1000]`. pub(crate) fn export_message(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `227` - // Estimated: `6167` - // Minimum execution time: 45_660_000 picoseconds. - Weight::from_parts(46_626_263, 0) - .saturating_add(Weight::from_parts(0, 6167)) - // Standard Error: 37 - .saturating_add(Weight::from_parts(51_861, 0).saturating_mul(x.into())) + // Measured: `473` + // Estimated: `6413` + // Minimum execution time: 66_221_000 picoseconds. + Weight::from_parts(66_556_981, 0) + .saturating_add(Weight::from_parts(0, 6413)) + // Standard Error: 334 + .saturating_add(Weight::from_parts(53_743, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -382,16 +362,16 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_200_000 picoseconds. - Weight::from_parts(1_250_000, 0) + // Minimum execution time: 1_370_000 picoseconds. + Weight::from_parts(1_440_000, 0) .saturating_add(Weight::from_parts(0, 0)) } pub(crate) fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_270_000 picoseconds. - Weight::from_parts(1_300_000, 0) + // Minimum execution time: 1_390_000 picoseconds. + Weight::from_parts(1_490_000, 0) .saturating_add(Weight::from_parts(0, 0)) } } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs index 30fc9dca59..bc7b2f50e1 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs @@ -256,11 +256,12 @@ fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() { >( SiblingParachainLocation::get(), BridgedUniversalLocation::get(), - |locations, fee| { + false, + |locations, _fee| { bridge_hub_test_utils::open_bridge_with_storage::< Runtime, XcmOverBridgeHubKusamaInstance - >(locations, fee, LegacyLaneId([0, 0, 0, 1])) + >(locations, LegacyLaneId([0, 0, 0, 1])) } ).1 }, @@ -318,11 +319,12 @@ fn relayed_incoming_message_works() { >( SiblingParachainLocation::get(), BridgedUniversalLocation::get(), - |locations, fee| { + false, + |locations, _fee| { bridge_hub_test_utils::open_bridge_with_storage::< Runtime, XcmOverBridgeHubKusamaInstance, - >(locations, fee, LegacyLaneId([0, 0, 0, 1])) + >(locations, LegacyLaneId([0, 0, 0, 1])) }, ) .1 @@ -352,11 +354,12 @@ fn free_relay_extrinsic_works() { >( SiblingParachainLocation::get(), BridgedUniversalLocation::get(), - |locations, fee| { + false, + |locations, _fee| { bridge_hub_test_utils::open_bridge_with_storage::< Runtime, XcmOverBridgeHubKusamaInstance, - >(locations, fee, LegacyLaneId([0, 0, 0, 1])) + >(locations, LegacyLaneId([0, 0, 0, 1])) }, ) .1