From 7c46b28dfc7af6681af5e088572285fa4dec0cd7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 2 Sep 2024 17:35:29 +0200
Subject: [PATCH 001/173] Bump toml from 0.8.8 to 0.8.12 (#5542)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bumps [toml](https://github.com/toml-rs/toml) from 0.8.8 to 0.8.12.
Commits
3a777b3
chore: Release
7979905
docs: Update changelog
487768d
Merge pull request #703 from
epage/overflow
6987f77
chore(ci): Run with default opt-level
21f545d
fix(parser): Don't stackoverflow on opt-level=0
af1f97d
refactor(parser): Pull recursion limit out to variable
eb86543
chore: Release
246b292
docs: Update changelog
d41c62c
Merge pull request #701 from
epage/cleanup
31457b3
refactor(error): Clean up highlight code
- Additional commits viewable in compare
view
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=toml&package-manager=cargo&previous-version=0.8.8&new-version=0.8.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bastian Köcher
---
Cargo.lock | 42 +++++++++++++++++++++++++++++++-----------
Cargo.toml | 2 +-
2 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 7550aab4a9f..ef6faa5faae 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5036,7 +5036,7 @@ dependencies = [
"regex",
"syn 2.0.65",
"termcolor",
- "toml 0.8.8",
+ "toml 0.8.12",
"walkdir",
]
@@ -10357,7 +10357,7 @@ dependencies = [
"polkavm-linker 0.9.2",
"sp-runtime",
"tempfile",
- "toml 0.8.8",
+ "toml 0.8.12",
"twox-hash",
]
@@ -11459,7 +11459,7 @@ dependencies = [
"polkavm-linker 0.10.0",
"sp-runtime",
"tempfile",
- "toml 0.8.8",
+ "toml 0.8.12",
]
[[package]]
@@ -19130,9 +19130,9 @@ dependencies = [
[[package]]
name = "serde_spanned"
-version = "0.6.4"
+version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80"
+checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d"
dependencies = [
"serde",
]
@@ -21781,7 +21781,7 @@ dependencies = [
"sp-version",
"strum 0.26.2",
"tempfile",
- "toml 0.8.8",
+ "toml 0.8.12",
"walkdir",
"wasm-opt",
]
@@ -22520,14 +22520,14 @@ dependencies = [
[[package]]
name = "toml"
-version = "0.8.8"
+version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35"
+checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
- "toml_edit 0.21.0",
+ "toml_edit 0.22.12",
]
[[package]]
@@ -22547,7 +22547,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.2.3",
"toml_datetime",
- "winnow",
+ "winnow 0.5.15",
]
[[package]]
@@ -22555,12 +22555,23 @@ name = "toml_edit"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
+dependencies = [
+ "indexmap 2.2.3",
+ "toml_datetime",
+ "winnow 0.5.15",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.22.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef"
dependencies = [
"indexmap 2.2.3",
"serde",
"serde_spanned",
"toml_datetime",
- "winnow",
+ "winnow 0.6.18",
]
[[package]]
@@ -24210,6 +24221,15 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "winnow"
+version = "0.6.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "winreg"
version = "0.50.0"
diff --git a/Cargo.toml b/Cargo.toml
index bc5b3255921..6bd401d8e15 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1321,7 +1321,7 @@ tokio-stream = { version = "0.1.14" }
tokio-test = { version = "0.4.2" }
tokio-tungstenite = { version = "0.20.1" }
tokio-util = { version = "0.7.8" }
-toml = { version = "0.8.8" }
+toml = { version = "0.8.12" }
toml_edit = { version = "0.19" }
tower = { version = "0.4.13" }
tower-http = { version = "0.5.2" }
--
GitLab
From 22100999a6edbc67ae54b4cd0e0242505226b083 Mon Sep 17 00:00:00 2001
From: Branislav Kontur
Date: Mon, 2 Sep 2024 17:53:49 +0200
Subject: [PATCH 002/173] [bridges-v2] Permissionless lanes (#4949)
Relates to:
https://github.com/paritytech/parity-bridges-common/issues/2451
Closes: https://github.com/paritytech/parity-bridges-common/issues/2500
## Summary
Now, the bridging pallet supports only static lanes, which means lanes
that are hard-coded in the runtime files. This PR fixes that and adds
support for dynamic, also known as permissionless, lanes. This means
that allowed origins (relay chain, sibling parachains) can open and
close bridges (through BridgeHubs) with another bridged (substrate-like)
consensus using just `xcm::Transact` and `OriginKind::Xcm`.
_This PR is based on the migrated code from the Bridges V2
[branch](https://github.com/paritytech/polkadot-sdk/pull/4427) from the
old `parity-bridges-common`
[repo](https://github.com/paritytech/parity-bridges-common/tree/bridges-v2)._
## Explanation
Please read
[bridges/modules/xcm-bridge-hub/src/lib.rs](https://github.com/paritytech/polkadot-sdk/blob/149b0ac2ce43fba197988f2642032fa24dd8289a/bridges/modules/xcm-bridge-hub/src/lib.rs#L17-L136)
to understand how managing bridges works. The basic concepts around
`BridgeId` and `LaneId` are also explained there.
## TODO
- [x] search and fix for comment: `// TODO:(bridges-v2) - most of that
stuff was introduced with free header execution:
https://github.com/paritytech/polkadot-sdk/pull/4102` - more info in the
comment
[bellow](https://github.com/paritytech/polkadot-sdk/pull/4427#issuecomment-2126625043)
- [x] TODO: there's only one impl of `EnsureOrigin`
## TODO - not blocking review
**benchmarking:**
- [x] regenerate all relevant weights for BH/AH runtimes
- [ ] regenerate default weights for bridging pallets e.g.
`modules/messages/src/weights.rs`
- [ ] add benchmarks for `xcm-bridge-hub` pallet
https://github.com/paritytech/polkadot-sdk/issues/5550
**testing:**
- [ ] add xcm-emulator tests for Rococo/Penpal to Westend/Penpal with
full opening channel and sending/receiving `xcm::Transact`
**migrations:**
- [x] add migrations for BridgeHubRococo/Westend
https://github.com/paritytech/parity-bridges-common/issues/2794 (to be
reusable for P/K bridge)
- [x] check also storage migration, if needed for pallets
- [ ] migration for XCM type (optional)
- [x] migration for static lanes to the dynamic (reuse for fellows)
**investigation:**
- [ ] revisit
https://github.com/paritytech/parity-bridges-common/issues/2380
- [ ] check congestion around `LocalXcmChannelManager` and
`OutboundLanesCongestedSignals` impls -
https://github.com/paritytech/polkadot-sdk/issues/5551
- to be reusable for polkadot-fellows
- return `report_bridge_status` was remove, so we need to `XcmpQueue`
alternative?
---------
Signed-off-by: Branislav Kontur
Co-authored-by: Svyatoslav Nikolsky
Co-authored-by: command-bot <>
Co-authored-by: Francisco Aguirre
---
Cargo.lock | 44 +-
bridges/bin/runtime-common/Cargo.toml | 17 +-
...ck_obsolete_extension.rs => extensions.rs} | 209 +-
.../bin/runtime-common/src/extensions/mod.rs | 21 -
bridges/bin/runtime-common/src/integrity.rs | 18 +-
bridges/bin/runtime-common/src/lib.rs | 5 -
.../src/messages_xcm_extension.rs | 502 -----
bridges/bin/runtime-common/src/mock.rs | 22 +-
.../src/parachains_benchmarking.rs | 5 +-
.../chains/chain-bridge-hub-rococo/Cargo.toml | 7 +-
.../chains/chain-bridge-hub-rococo/src/lib.rs | 15 +-
.../chain-bridge-hub-westend/Cargo.toml | 6 +-
.../chain-bridge-hub-westend/src/lib.rs | 15 +-
.../docs/polkadot-kusama-bridge-overview.md | 18 +-
bridges/modules/grandpa/src/call_ext.rs | 46 +-
bridges/modules/grandpa/src/lib.rs | 2 +-
bridges/modules/messages/Cargo.toml | 5 +-
bridges/modules/messages/README.md | 14 +-
bridges/modules/messages/src/benchmarking.rs | 67 +-
.../messages/src/call_ext.rs} | 356 ++--
bridges/modules/messages/src/inbound_lane.rs | 101 +-
bridges/modules/messages/src/lanes_manager.rs | 283 +++
bridges/modules/messages/src/lib.rs | 398 ++--
bridges/modules/messages/src/migration.rs | 146 ++
bridges/modules/messages/src/outbound_lane.rs | 58 +-
bridges/modules/messages/src/proofs.rs | 36 +-
bridges/modules/messages/src/tests/mock.rs | 77 +-
.../messages/src/tests/pallet_tests.rs | 372 +++-
bridges/modules/parachains/src/call_ext.rs | 20 +-
bridges/modules/parachains/src/lib.rs | 15 +-
bridges/modules/relayers/Cargo.toml | 35 +-
bridges/modules/relayers/src/benchmarking.rs | 6 +-
.../relayers/src/extension/grandpa_adapter.rs | 177 ++
.../src/extension/messages_adapter.rs | 94 +
.../relayers/src/extension/mod.rs} | 1517 +++++----------
.../src/extension/parachain_adapter.rs | 182 ++
.../relayers/src/extension/priority.rs} | 33 +-
bridges/modules/relayers/src/lib.rs | 45 +-
bridges/modules/relayers/src/mock.rs | 292 ++-
.../modules/relayers/src/payment_adapter.rs | 22 +-
bridges/modules/relayers/src/stake_adapter.rs | 6 +-
.../modules/xcm-bridge-hub-router/Cargo.toml | 3 -
.../xcm-bridge-hub-router/src/benchmarking.rs | 43 +-
.../modules/xcm-bridge-hub-router/src/lib.rs | 342 ++--
.../modules/xcm-bridge-hub-router/src/mock.rs | 35 +-
.../xcm-bridge-hub-router/src/weights.rs | 133 +-
bridges/modules/xcm-bridge-hub/Cargo.toml | 17 +-
.../modules/xcm-bridge-hub/src/dispatcher.rs | 267 +++
.../modules/xcm-bridge-hub/src/exporter.rs | 554 +++++-
bridges/modules/xcm-bridge-hub/src/lib.rs | 1677 ++++++++++++++++-
.../modules/xcm-bridge-hub/src/migration.rs | 146 ++
bridges/modules/xcm-bridge-hub/src/mock.rs | 244 ++-
.../primitives/header-chain/src/call_info.rs | 94 +
bridges/primitives/header-chain/src/lib.rs | 37 +-
bridges/primitives/messages/Cargo.toml | 5 +-
bridges/primitives/messages/src/call_info.rs | 172 ++
bridges/primitives/messages/src/lane.rs | 281 +++
bridges/primitives/messages/src/lib.rs | 116 +-
.../primitives/messages/src/storage_keys.rs | 38 +-
.../primitives/messages/src/target_chain.rs | 8 +-
.../primitives/parachains/src/call_info.rs | 59 +
bridges/primitives/parachains/src/lib.rs | 31 +-
bridges/primitives/polkadot-core/Cargo.toml | 4 +-
bridges/primitives/relayers/Cargo.toml | 10 +-
bridges/primitives/relayers/src/extension.rs | 191 ++
bridges/primitives/relayers/src/lib.rs | 28 +-
bridges/primitives/runtime/Cargo.toml | 1 -
.../primitives/runtime/src/storage_proof.rs | 4 +-
.../xcm-bridge-hub-router/Cargo.toml | 11 +-
.../xcm-bridge-hub-router/src/lib.rs | 5 +-
bridges/primitives/xcm-bridge-hub/Cargo.toml | 26 +-
.../xcm-bridge-hub/src/call_info.rs | 43 +
bridges/primitives/xcm-bridge-hub/src/lib.rs | 672 +++++++
bridges/relays/client-substrate/Cargo.toml | 8 +-
bridges/relays/lib-substrate-relay/Cargo.toml | 1 +
.../lib-substrate-relay/src/cli/bridge.rs | 2 +-
.../relays/lib-substrate-relay/src/cli/mod.rs | 97 +-
.../src/cli/relay_headers_and_messages/mod.rs | 8 +-
.../parachain_to_parachain.rs | 2 +-
.../relay_to_parachain.rs | 2 +-
.../src/cli/relay_messages.rs | 12 +-
.../lib-substrate-relay/src/messages/mod.rs | 7 +-
.../src/messages/source.rs | 2 +-
.../src/on_demand/parachains.rs | 2 +-
.../lib-substrate-relay/src/parachains/mod.rs | 6 +-
.../relays/messages/src/message_lane_loop.rs | 12 +-
.../relays/parachains/src/parachains_loop.rs | 2 +-
cumulus/pallets/xcmp-queue/src/bridging.rs | 50 +-
.../assets/asset-hub-rococo/Cargo.toml | 3 +
.../assets/asset-hub-rococo/src/lib.rs | 10 +-
.../assets/asset-hub-westend/Cargo.toml | 3 +
.../assets/asset-hub-westend/src/lib.rs | 10 +-
.../emulated/common/Cargo.toml | 2 +
.../emulated/common/src/impls.rs | 111 +-
.../bridges/bridge-hub-rococo/Cargo.toml | 3 +-
.../src/tests/asset_transfers.rs | 3 +
.../bridge-hub-rococo/src/tests/mod.rs | 59 +-
.../bridge-hub-rococo/src/tests/send_xcm.rs | 3 +
.../bridges/bridge-hub-westend/Cargo.toml | 3 +-
.../src/tests/asset_transfers.rs | 3 +
.../bridge-hub-westend/src/tests/mod.rs | 59 +-
.../bridge-hub-westend/src/tests/send_xcm.rs | 3 +
.../assets/asset-hub-rococo/src/lib.rs | 22 +-
.../weights/pallet_xcm_bridge_hub_router.rs | 64 +-
.../xcm/pallet_xcm_benchmarks_fungible.rs | 38 +-
.../xcm/pallet_xcm_benchmarks_generic.rs | 122 +-
.../assets/asset-hub-rococo/src/xcm_config.rs | 11 -
.../assets/asset-hub-rococo/tests/tests.rs | 90 +-
.../assets/asset-hub-westend/src/lib.rs | 24 +-
.../weights/pallet_xcm_bridge_hub_router.rs | 64 +-
.../xcm/pallet_xcm_benchmarks_fungible.rs | 38 +-
.../xcm/pallet_xcm_benchmarks_generic.rs | 147 +-
.../asset-hub-westend/src/xcm_config.rs | 11 -
.../assets/asset-hub-westend/tests/tests.rs | 88 +-
.../test-utils/src/test_cases_over_bridge.rs | 11 +-
.../bridge-hubs/bridge-hub-rococo/Cargo.toml | 7 +-
.../src/bridge_to_bulletin_config.rs | 192 +-
.../src/bridge_to_westend_config.rs | 227 ++-
.../bridge-hubs/bridge-hub-rococo/src/lib.rs | 81 +-
.../src/weights/pallet_bridge_grandpa.rs | 20 +-
...idge_messages_rococo_to_rococo_bulletin.rs | 166 +-
...allet_bridge_messages_rococo_to_westend.rs | 184 +-
.../src/weights/pallet_bridge_parachains.rs | 20 +-
.../src/weights/pallet_bridge_relayers.rs | 34 +-
.../xcm/pallet_xcm_benchmarks_generic.rs | 136 +-
.../bridge-hub-rococo/src/xcm_config.rs | 128 +-
.../bridge-hub-rococo/tests/tests.rs | 142 +-
.../bridge-hubs/bridge-hub-westend/Cargo.toml | 3 +-
.../src/bridge_to_rococo_config.rs | 228 ++-
.../bridge-hubs/bridge-hub-westend/src/lib.rs | 69 +-
.../src/weights/pallet_bridge_grandpa.rs | 20 +-
.../src/weights/pallet_bridge_messages.rs | 184 +-
.../src/weights/pallet_bridge_parachains.rs | 20 +-
.../src/weights/pallet_bridge_relayers.rs | 42 +-
.../xcm/pallet_xcm_benchmarks_generic.rs | 136 +-
.../bridge-hub-westend/src/xcm_config.rs | 8 +-
.../bridge-hub-westend/tests/snowbridge.rs | 4 +-
.../bridge-hub-westend/tests/tests.rs | 85 +-
.../runtimes/bridge-hubs/common/Cargo.toml | 2 +
.../runtimes/bridge-hubs/common/src/lib.rs | 1 +
.../bridge-hubs/common/src/xcm_version.rs | 44 +
.../bridge-hubs/test-utils/Cargo.toml | 6 +
.../bridge-hubs/test-utils/src/lib.rs | 1 +
.../src/test_cases/from_grandpa_chain.rs | 10 +-
.../src/test_cases/from_parachain.rs | 10 +-
.../test-utils/src/test_cases/helpers.rs | 145 +-
.../test-utils/src/test_cases/mod.rs | 164 +-
.../src/test_data/from_grandpa_chain.rs | 7 +-
.../src/test_data/from_parachain.rs | 7 +-
.../parachains/runtimes/test-utils/src/lib.rs | 35 +-
cumulus/xcm/xcm-emulator/src/lib.rs | 14 +-
prdoc/pr_4949.prdoc | 78 +
152 files changed, 9725 insertions(+), 4759 deletions(-)
rename bridges/bin/runtime-common/src/{extensions/check_obsolete_extension.rs => extensions.rs} (76%)
delete mode 100644 bridges/bin/runtime-common/src/extensions/mod.rs
delete mode 100644 bridges/bin/runtime-common/src/messages_xcm_extension.rs
rename bridges/{bin/runtime-common/src/messages_call_ext.rs => modules/messages/src/call_ext.rs} (57%)
create mode 100644 bridges/modules/messages/src/lanes_manager.rs
create mode 100644 bridges/modules/messages/src/migration.rs
create mode 100644 bridges/modules/relayers/src/extension/grandpa_adapter.rs
create mode 100644 bridges/modules/relayers/src/extension/messages_adapter.rs
rename bridges/{bin/runtime-common/src/extensions/refund_relayer_extension.rs => modules/relayers/src/extension/mod.rs} (60%)
create mode 100644 bridges/modules/relayers/src/extension/parachain_adapter.rs
rename bridges/{bin/runtime-common/src/extensions/priority_calculator.rs => modules/relayers/src/extension/priority.rs} (96%)
create mode 100644 bridges/modules/xcm-bridge-hub/src/dispatcher.rs
create mode 100644 bridges/modules/xcm-bridge-hub/src/migration.rs
create mode 100644 bridges/primitives/header-chain/src/call_info.rs
create mode 100644 bridges/primitives/messages/src/call_info.rs
create mode 100644 bridges/primitives/messages/src/lane.rs
create mode 100644 bridges/primitives/parachains/src/call_info.rs
create mode 100644 bridges/primitives/relayers/src/extension.rs
create mode 100644 bridges/primitives/xcm-bridge-hub/src/call_info.rs
create mode 100644 cumulus/parachains/runtimes/bridge-hubs/common/src/xcm_version.rs
create mode 100644 prdoc/pr_4949.prdoc
diff --git a/Cargo.lock b/Cargo.lock
index ef6faa5faae..7634cbc166a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -790,6 +790,7 @@ name = "asset-hub-rococo-emulated-chain"
version = "0.0.0"
dependencies = [
"asset-hub-rococo-runtime",
+ "bp-bridge-hub-rococo",
"cumulus-primitives-core",
"emulated-integration-tests-common",
"frame-support",
@@ -916,6 +917,7 @@ name = "asset-hub-westend-emulated-chain"
version = "0.0.0"
dependencies = [
"asset-hub-westend-runtime",
+ "bp-bridge-hub-westend",
"cumulus-primitives-core",
"emulated-integration-tests-common",
"frame-support",
@@ -1787,7 +1789,9 @@ dependencies = [
"bp-bridge-hub-cumulus",
"bp-messages",
"bp-runtime",
+ "bp-xcm-bridge-hub",
"frame-support",
+ "parity-scale-codec",
"sp-api",
"sp-runtime",
"sp-std 14.0.0",
@@ -1800,7 +1804,9 @@ dependencies = [
"bp-bridge-hub-cumulus",
"bp-messages",
"bp-runtime",
+ "bp-xcm-bridge-hub",
"frame-support",
+ "parity-scale-codec",
"sp-api",
"sp-runtime",
"sp-std 14.0.0",
@@ -1850,6 +1856,7 @@ dependencies = [
"scale-info",
"serde",
"sp-core",
+ "sp-io",
"sp-std 14.0.0",
]
@@ -1920,11 +1927,15 @@ dependencies = [
name = "bp-relayers"
version = "0.7.0"
dependencies = [
+ "bp-header-chain",
"bp-messages",
+ "bp-parachains",
"bp-runtime",
"frame-support",
+ "frame-system",
"hex",
"hex-literal",
+ "pallet-utility",
"parity-scale-codec",
"scale-info",
"sp-runtime",
@@ -2001,7 +2012,16 @@ dependencies = [
name = "bp-xcm-bridge-hub"
version = "0.2.0"
dependencies = [
+ "bp-messages",
+ "bp-runtime",
+ "frame-support",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-core",
+ "sp-io",
"sp-std 14.0.0",
+ "staging-xcm",
]
[[package]]
@@ -2012,6 +2032,7 @@ dependencies = [
"scale-info",
"sp-core",
"sp-runtime",
+ "staging-xcm",
]
[[package]]
@@ -2026,6 +2047,7 @@ dependencies = [
"snowbridge-core",
"sp-core",
"sp-runtime",
+ "sp-std 14.0.0",
"staging-xcm",
]
@@ -2056,6 +2078,7 @@ dependencies = [
"pallet-bridge-messages",
"pallet-message-queue",
"pallet-xcm",
+ "pallet-xcm-bridge-hub",
"parachains-common",
"parity-scale-codec",
"rococo-system-emulated-network",
@@ -2180,10 +2203,12 @@ dependencies = [
"asset-test-utils",
"bp-header-chain",
"bp-messages",
+ "bp-parachains",
"bp-polkadot-core",
"bp-relayers",
"bp-runtime",
"bp-test-utils",
+ "bp-xcm-bridge-hub",
"bridge-runtime-common",
"cumulus-pallet-parachain-system",
"cumulus-pallet-xcmp-queue",
@@ -2198,6 +2223,7 @@ dependencies = [
"pallet-bridge-relayers",
"pallet-timestamp",
"pallet-utility",
+ "pallet-xcm-bridge-hub",
"parachains-common",
"parachains-runtimes-test-utils",
"parity-scale-codec",
@@ -2241,6 +2267,7 @@ dependencies = [
"pallet-bridge-messages",
"pallet-message-queue",
"pallet-xcm",
+ "pallet-xcm-bridge-hub",
"parachains-common",
"parity-scale-codec",
"rococo-westend-system-emulated-network",
@@ -2368,7 +2395,6 @@ dependencies = [
"bp-runtime",
"bp-test-utils",
"bp-xcm-bridge-hub",
- "bp-xcm-bridge-hub-router",
"frame-support",
"frame-system",
"log",
@@ -2381,12 +2407,12 @@ dependencies = [
"pallet-utility",
"parity-scale-codec",
"scale-info",
+ "sp-core",
"sp-io",
"sp-runtime",
"sp-std 14.0.0",
"sp-trie",
"staging-xcm",
- "staging-xcm-builder",
"static_assertions",
"tuplex",
]
@@ -5178,6 +5204,7 @@ version = "3.0.0"
dependencies = [
"asset-test-utils",
"bp-messages",
+ "bp-xcm-bridge-hub",
"bridge-runtime-common",
"cumulus-pallet-parachain-system",
"cumulus-pallet-xcmp-queue",
@@ -5188,6 +5215,7 @@ dependencies = [
"pallet-bridge-messages",
"pallet-message-queue",
"pallet-xcm",
+ "pallet-xcm-bridge-hub",
"parachains-common",
"parity-scale-codec",
"paste",
@@ -10194,18 +10222,27 @@ dependencies = [
name = "pallet-bridge-relayers"
version = "0.7.0"
dependencies = [
+ "bp-header-chain",
"bp-messages",
+ "bp-parachains",
+ "bp-polkadot-core",
"bp-relayers",
"bp-runtime",
+ "bp-test-utils",
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
"pallet-balances",
+ "pallet-bridge-grandpa",
"pallet-bridge-messages",
+ "pallet-bridge-parachains",
+ "pallet-transaction-payment",
+ "pallet-utility",
"parity-scale-codec",
"scale-info",
"sp-arithmetic",
+ "sp-core",
"sp-io",
"sp-runtime",
"sp-std 14.0.0",
@@ -12100,7 +12137,6 @@ dependencies = [
"bp-messages",
"bp-runtime",
"bp-xcm-bridge-hub",
- "bridge-runtime-common",
"frame-support",
"frame-system",
"log",
@@ -12108,6 +12144,7 @@ dependencies = [
"pallet-bridge-messages",
"pallet-xcm-bridge-hub-router",
"parity-scale-codec",
+ "polkadot-parachain-primitives",
"scale-info",
"sp-core",
"sp-io",
@@ -21597,6 +21634,7 @@ dependencies = [
"rbtag",
"relay-substrate-client",
"relay-utils",
+ "rustc-hex",
"scale-info",
"sp-consensus-grandpa",
"sp-core",
diff --git a/bridges/bin/runtime-common/Cargo.toml b/bridges/bin/runtime-common/Cargo.toml
index 36f27b6aa03..b8835d55f0d 100644
--- a/bridges/bin/runtime-common/Cargo.toml
+++ b/bridges/bin/runtime-common/Cargo.toml
@@ -25,7 +25,6 @@ bp-polkadot-core = { workspace = true }
bp-relayers = { workspace = true }
bp-runtime = { workspace = true }
bp-xcm-bridge-hub = { workspace = true }
-bp-xcm-bridge-hub-router = { workspace = true }
pallet-bridge-grandpa = { workspace = true }
pallet-bridge-messages = { workspace = true }
pallet-bridge-parachains = { workspace = true }
@@ -43,12 +42,15 @@ sp-trie = { optional = true, workspace = true }
# Polkadot dependencies
xcm = { workspace = true }
-xcm-builder = { workspace = true }
[dev-dependencies]
bp-test-utils = { workspace = true }
pallet-balances = { workspace = true }
-pallet-bridge-messages = { features = ["std", "test-helpers"], workspace = true }
+pallet-bridge-messages = { features = [
+ "std",
+ "test-helpers",
+], workspace = true }
+sp-core = { workspace = true }
[features]
default = ["std"]
@@ -60,7 +62,6 @@ std = [
"bp-relayers/std",
"bp-runtime/std",
"bp-test-utils/std",
- "bp-xcm-bridge-hub-router/std",
"bp-xcm-bridge-hub/std",
"codec/std",
"frame-support/std",
@@ -74,12 +75,12 @@ std = [
"pallet-transaction-payment/std",
"pallet-utility/std",
"scale-info/std",
+ "sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"sp-trie/std",
"tuplex/std",
- "xcm-builder/std",
"xcm/std",
]
runtime-benchmarks = [
@@ -95,10 +96,6 @@ runtime-benchmarks = [
"pallet-utility/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-trie",
- "xcm-builder/runtime-benchmarks",
]
integrity-test = ["static_assertions"]
-test-helpers = [
- "bp-runtime/test-helpers",
- "sp-trie",
-]
+test-helpers = ["bp-runtime/test-helpers", "sp-trie"]
diff --git a/bridges/bin/runtime-common/src/extensions/check_obsolete_extension.rs b/bridges/bin/runtime-common/src/extensions.rs
similarity index 76%
rename from bridges/bin/runtime-common/src/extensions/check_obsolete_extension.rs
rename to bridges/bin/runtime-common/src/extensions.rs
index df75092af6e..dc7e14de28f 100644
--- a/bridges/bin/runtime-common/src/extensions/check_obsolete_extension.rs
+++ b/bridges/bin/runtime-common/src/extensions.rs
@@ -18,23 +18,20 @@
//! obsolete (duplicated) data or do not pass some additional pallet-specific
//! checks.
-use crate::{
- extensions::refund_relayer_extension::RefundableParachainId,
- messages_call_ext::MessagesCallSubType,
-};
+use bp_parachains::SubmitParachainHeadsInfo;
use bp_relayers::ExplicitOrAccountParams;
use bp_runtime::Parachain;
use pallet_bridge_grandpa::{
BridgedBlockNumber, CallSubType as GrandpaCallSubType, SubmitFinalityProofHelper,
};
-use pallet_bridge_parachains::{
- CallSubType as ParachainsCallSubtype, SubmitParachainHeadsHelper, SubmitParachainHeadsInfo,
-};
+use pallet_bridge_messages::CallSubType as MessagesCallSubType;
+use pallet_bridge_parachains::{CallSubType as ParachainsCallSubtype, SubmitParachainHeadsHelper};
use pallet_bridge_relayers::Pallet as RelayersPallet;
use sp_runtime::{
- traits::{Get, PhantomData, UniqueSaturatedInto},
+ traits::{Get, UniqueSaturatedInto},
transaction_validity::{TransactionPriority, TransactionValidity, ValidTransactionBuilder},
};
+use sp_std::marker::PhantomData;
// Re-export to avoid include tuplex dependency everywhere.
#[doc(hidden)]
@@ -126,17 +123,27 @@ where
/// `(BundledHeaderNumber - 1 - BestKnownHeaderNumber) * Priority::get()`.
/// The boost is only applied if submitter has active registration in the relayers
/// pallet.
-pub struct CheckAndBoostBridgeParachainsTransactions(
- PhantomData<(T, RefPara, Priority, SlashAccount)>,
-);
-
-impl, SlashAccount: Get>
- BridgeRuntimeFilterCall
- for CheckAndBoostBridgeParachainsTransactions
+pub struct CheckAndBoostBridgeParachainsTransactions<
+ T,
+ ParachainsInstance,
+ Para,
+ Priority,
+ SlashAccount,
+>(PhantomData<(T, ParachainsInstance, Para, Priority, SlashAccount)>);
+
+impl<
+ T,
+ ParachainsInstance,
+ Para,
+ Priority: Get,
+ SlashAccount: Get,
+ > BridgeRuntimeFilterCall
+ for CheckAndBoostBridgeParachainsTransactions
where
- T: pallet_bridge_relayers::Config + pallet_bridge_parachains::Config,
- RefPara: RefundableParachainId,
- T::RuntimeCall: ParachainsCallSubtype,
+ T: pallet_bridge_relayers::Config + pallet_bridge_parachains::Config,
+ ParachainsInstance: 'static,
+ Para: Parachain,
+ T::RuntimeCall: ParachainsCallSubtype,
{
// bridged header number, bundled in transaction
type ToPostDispatch = Option;
@@ -145,10 +152,10 @@ where
who: &T::AccountId,
call: &T::RuntimeCall,
) -> (Self::ToPostDispatch, TransactionValidity) {
- match ParachainsCallSubtype::::check_obsolete_submit_parachain_heads(
+ match ParachainsCallSubtype::::check_obsolete_submit_parachain_heads(
call,
) {
- Ok(Some(our_tx)) if our_tx.base.para_id.0 == RefPara::BridgedChain::PARACHAIN_ID => {
+ Ok(Some(our_tx)) if our_tx.base.para_id.0 == Para::PARACHAIN_ID => {
let to_post_dispatch = Some(our_tx.base);
let total_priority_boost =
compute_priority_boost::(&who, our_tx.improved_by);
@@ -167,7 +174,7 @@ where
let Some(update) = maybe_update else { return };
// we are only interested in failed or unneeded transactions
let has_failed = has_failed ||
- !SubmitParachainHeadsHelper::::was_successful(&update);
+ !SubmitParachainHeadsHelper::::was_successful(&update);
if !has_failed {
return
@@ -275,7 +282,7 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
type Pre = (
$account_id,
( $(
- <$filter_call as $crate::extensions::check_obsolete_extension::BridgeRuntimeFilterCall<
+ <$filter_call as $crate::extensions::BridgeRuntimeFilterCall<
$account_id,
$call,
>>::ToPostDispatch,
@@ -302,7 +309,7 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
$(
let (from_validate, call_filter_validity) = <
$filter_call as
- $crate::extensions::check_obsolete_extension::BridgeRuntimeFilterCall<
+ $crate::extensions::BridgeRuntimeFilterCall<
Self::AccountId,
$call,
>>::validate(&who, call);
@@ -319,12 +326,13 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
info: &sp_runtime::traits::DispatchInfoOf,
len: usize,
) -> Result {
- use $crate::extensions::check_obsolete_extension::__private::tuplex::PushBack;
+ use $crate::extensions::__private::tuplex::PushBack;
+
let to_post_dispatch = ();
$(
let (from_validate, call_filter_validity) = <
$filter_call as
- $crate::extensions::check_obsolete_extension::BridgeRuntimeFilterCall<
+ $crate::extensions::BridgeRuntimeFilterCall<
$account_id,
$call,
>>::validate(&relayer, call);
@@ -342,14 +350,15 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
len: usize,
result: &sp_runtime::DispatchResult,
) -> Result<(), sp_runtime::transaction_validity::TransactionValidityError> {
- use $crate::extensions::check_obsolete_extension::__private::tuplex::PopFront;
+ use $crate::extensions::__private::tuplex::PopFront;
+
let Some((relayer, to_post_dispatch)) = to_post_dispatch else { return Ok(()) };
let has_failed = result.is_err();
$(
let (item, to_post_dispatch) = to_post_dispatch.pop_front();
<
$filter_call as
- $crate::extensions::check_obsolete_extension::BridgeRuntimeFilterCall<
+ $crate::extensions::BridgeRuntimeFilterCall<
$account_id,
$call,
>>::post_dispatch(&relayer, has_failed, item);
@@ -363,25 +372,37 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
#[cfg(test)]
mod tests {
use super::*;
- use crate::{
- extensions::refund_relayer_extension::{
- tests::{
- initialize_environment, relayer_account_at_this_chain,
- submit_parachain_head_call_ex, submit_relay_header_call_ex,
- },
- RefundableParachain,
- },
- mock::*,
- };
- use bp_polkadot_core::parachains::ParaId;
+ use crate::mock::*;
+ use bp_header_chain::StoredHeaderDataBuilder;
+ use bp_messages::{InboundLaneData, LaneId, MessageNonce, OutboundLaneData};
+ use bp_parachains::{BestParaHeadHash, ParaInfo};
+ use bp_polkadot_core::parachains::{ParaHeadsProof, ParaId};
+ use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_runtime::HeaderId;
- use frame_support::{assert_err, assert_ok};
+ use bp_test_utils::{make_default_justification, test_keyring, TEST_GRANDPA_SET_ID};
+ use frame_support::{assert_err, assert_ok, traits::fungible::Mutate};
+ use pallet_bridge_grandpa::{Call as GrandpaCall, StoredAuthoritySet};
+ use pallet_bridge_parachains::Call as ParachainsCall;
use sp_runtime::{
- traits::{ConstU64, SignedExtension},
+ traits::{parameter_types, ConstU64, Header as _, SignedExtension},
transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction},
DispatchError,
};
+ parameter_types! {
+ pub MsgProofsRewardsAccount: RewardsAccountParams = RewardsAccountParams::new(
+ test_lane_id(),
+ TEST_BRIDGED_CHAIN_ID,
+ RewardsAccountOwner::ThisChain,
+ );
+ pub MsgDeliveryProofsRewardsAccount: RewardsAccountParams = RewardsAccountParams::new(
+ test_lane_id(),
+ TEST_BRIDGED_CHAIN_ID,
+ RewardsAccountOwner::BridgedChain,
+ );
+ pub TestLaneId: LaneId = test_lane_id();
+ }
+
pub struct MockCall {
data: u32,
}
@@ -455,6 +476,103 @@ mod tests {
}
}
+ fn test_lane_id() -> LaneId {
+ LaneId::new(1, 2)
+ }
+
+ fn initial_balance_of_relayer_account_at_this_chain() -> ThisChainBalance {
+ let test_stake: ThisChainBalance = TestStake::get();
+ ExistentialDeposit::get().saturating_add(test_stake * 100)
+ }
+
+ // in tests, the following accounts are equal (because of how `into_sub_account_truncating`
+ // works)
+
+ fn delivery_rewards_account() -> ThisChainAccountId {
+ TestPaymentProcedure::rewards_account(MsgProofsRewardsAccount::get())
+ }
+
+ fn confirmation_rewards_account() -> ThisChainAccountId {
+ TestPaymentProcedure::rewards_account(MsgDeliveryProofsRewardsAccount::get())
+ }
+
+ fn relayer_account_at_this_chain() -> ThisChainAccountId {
+ 0
+ }
+
+ fn initialize_environment(
+ best_relay_header_number: BridgedChainBlockNumber,
+ parachain_head_at_relay_header_number: BridgedChainBlockNumber,
+ best_message: MessageNonce,
+ ) {
+ let authorities = test_keyring().into_iter().map(|(a, w)| (a.into(), w)).collect();
+ let best_relay_header = HeaderId(best_relay_header_number, BridgedChainHash::default());
+ pallet_bridge_grandpa::CurrentAuthoritySet::::put(
+ StoredAuthoritySet::try_new(authorities, TEST_GRANDPA_SET_ID).unwrap(),
+ );
+ pallet_bridge_grandpa::BestFinalized::::put(best_relay_header);
+ pallet_bridge_grandpa::ImportedHeaders::::insert(
+ best_relay_header.hash(),
+ bp_test_utils::test_header::(0).build(),
+ );
+
+ let para_id = ParaId(BridgedUnderlyingParachain::PARACHAIN_ID);
+ let para_info = ParaInfo {
+ best_head_hash: BestParaHeadHash {
+ at_relay_block_number: parachain_head_at_relay_header_number,
+ head_hash: [parachain_head_at_relay_header_number as u8; 32].into(),
+ },
+ next_imported_hash_position: 0,
+ };
+ pallet_bridge_parachains::ParasInfo::::insert(para_id, para_info);
+
+ let lane_id = test_lane_id();
+ let in_lane_data =
+ InboundLaneData { last_confirmed_nonce: best_message, ..Default::default() };
+ pallet_bridge_messages::InboundLanes::::insert(lane_id, in_lane_data);
+
+ let out_lane_data =
+ OutboundLaneData { latest_received_nonce: best_message, ..Default::default() };
+ pallet_bridge_messages::OutboundLanes::::insert(lane_id, out_lane_data);
+
+ Balances::mint_into(&delivery_rewards_account(), ExistentialDeposit::get()).unwrap();
+ Balances::mint_into(&confirmation_rewards_account(), ExistentialDeposit::get()).unwrap();
+ Balances::mint_into(
+ &relayer_account_at_this_chain(),
+ initial_balance_of_relayer_account_at_this_chain(),
+ )
+ .unwrap();
+ }
+
+ fn submit_relay_header_call(relay_header_number: BridgedChainBlockNumber) -> RuntimeCall {
+ let relay_header = BridgedChainHeader::new(
+ relay_header_number,
+ Default::default(),
+ Default::default(),
+ Default::default(),
+ Default::default(),
+ );
+ let relay_justification = make_default_justification(&relay_header);
+
+ RuntimeCall::BridgeGrandpa(GrandpaCall::submit_finality_proof {
+ finality_target: Box::new(relay_header),
+ justification: relay_justification,
+ })
+ }
+
+ fn submit_parachain_head_call(
+ parachain_head_at_relay_header_number: BridgedChainBlockNumber,
+ ) -> RuntimeCall {
+ RuntimeCall::BridgeParachains(ParachainsCall::submit_parachain_heads {
+ at_relay_block: (parachain_head_at_relay_header_number, BridgedChainHash::default()),
+ parachains: vec![(
+ ParaId(BridgedUnderlyingParachain::PARACHAIN_ID),
+ [parachain_head_at_relay_header_number as u8; 32].into(),
+ )],
+ parachain_heads_proof: ParaHeadsProof { storage_proof: Default::default() },
+ })
+ }
+
#[test]
fn test_generated_obsolete_extension() {
generate_bridge_reject_obsolete_headers_and_messages!(
@@ -546,7 +664,7 @@ mod tests {
let priority_boost = BridgeGrandpaWrapper::validate(
&relayer_account_at_this_chain(),
- &submit_relay_header_call_ex(200),
+ &submit_relay_header_call(200),
)
.1
.unwrap()
@@ -564,7 +682,7 @@ mod tests {
let priority_boost = BridgeGrandpaWrapper::validate(
&relayer_account_at_this_chain(),
- &submit_relay_header_call_ex(200),
+ &submit_relay_header_call(200),
)
.1
.unwrap()
@@ -601,7 +719,8 @@ mod tests {
type BridgeParachainsWrapper = CheckAndBoostBridgeParachainsTransactions<
TestRuntime,
- RefundableParachain<(), BridgedUnderlyingParachain>,
+ (),
+ BridgedUnderlyingParachain,
ConstU64<1_000>,
SlashDestination,
>;
@@ -613,7 +732,7 @@ mod tests {
let priority_boost = BridgeParachainsWrapper::validate(
&relayer_account_at_this_chain(),
- &submit_parachain_head_call_ex(200),
+ &submit_parachain_head_call(200),
)
.1
.unwrap()
@@ -631,7 +750,7 @@ mod tests {
let priority_boost = BridgeParachainsWrapper::validate(
&relayer_account_at_this_chain(),
- &submit_parachain_head_call_ex(200),
+ &submit_parachain_head_call(200),
)
.1
.unwrap()
diff --git a/bridges/bin/runtime-common/src/extensions/mod.rs b/bridges/bin/runtime-common/src/extensions/mod.rs
deleted file mode 100644
index 3f1b506aaae..00000000000
--- a/bridges/bin/runtime-common/src/extensions/mod.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (C) Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! Bridge-specific transaction extensions.
-
-pub mod check_obsolete_extension;
-pub mod priority_calculator;
-pub mod refund_relayer_extension;
diff --git a/bridges/bin/runtime-common/src/integrity.rs b/bridges/bin/runtime-common/src/integrity.rs
index a0a9367dd14..2ff6c4c9165 100644
--- a/bridges/bin/runtime-common/src/integrity.rs
+++ b/bridges/bin/runtime-common/src/integrity.rs
@@ -68,21 +68,21 @@ macro_rules! assert_bridge_messages_pallet_types(
bridged_chain: $bridged:path,
) => {
{
- use $crate::messages_xcm_extension::XcmAsPlainPayload;
+ use $crate::integrity::__private::bp_xcm_bridge_hub::XcmAsPlainPayload;
use $crate::integrity::__private::static_assertions::assert_type_eq_all;
use bp_messages::ChainWithMessages;
use bp_runtime::Chain;
- use pallet_bridge_messages::Config as MessagesConfig;
+ use pallet_bridge_messages::Config as BridgeMessagesConfig;
// if one of asserts fail, then either bridge isn't configured properly (or alternatively - non-standard
// configuration is used), or something has broke existing configuration (meaning that all bridged chains
// and relays will stop functioning)
- assert_type_eq_all!(<$r as MessagesConfig<$i>>::ThisChain, $this);
- assert_type_eq_all!(<$r as MessagesConfig<$i>>::BridgedChain, $bridged);
+ assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::ThisChain, $this);
+ assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::BridgedChain, $bridged);
- assert_type_eq_all!(<$r as MessagesConfig<$i>>::OutboundPayload, XcmAsPlainPayload);
- assert_type_eq_all!(<$r as MessagesConfig<$i>>::InboundPayload, XcmAsPlainPayload);
+ assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::OutboundPayload, XcmAsPlainPayload);
+ assert_type_eq_all!(<$r as BridgeMessagesConfig<$i>>::InboundPayload, XcmAsPlainPayload);
}
}
);
@@ -174,12 +174,6 @@ where
R: pallet_bridge_messages::Config,
MI: 'static,
{
- assert!(
- !R::ActiveOutboundLanes::get().is_empty(),
- "ActiveOutboundLanes ({:?}) must not be empty",
- R::ActiveOutboundLanes::get(),
- );
-
assert!(
pallet_bridge_messages::BridgedChainOf::::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX
<= pallet_bridge_messages::BridgedChainOf::::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
diff --git a/bridges/bin/runtime-common/src/lib.rs b/bridges/bin/runtime-common/src/lib.rs
index b65bb6041d5..ac8b013086b 100644
--- a/bridges/bin/runtime-common/src/lib.rs
+++ b/bridges/bin/runtime-common/src/lib.rs
@@ -20,16 +20,11 @@
#![cfg_attr(not(feature = "std"), no_std)]
pub mod extensions;
-
pub mod messages_api;
pub mod messages_benchmarking;
-pub mod messages_call_ext;
-pub mod messages_xcm_extension;
pub mod parachains_benchmarking;
mod mock;
#[cfg(feature = "integrity-test")]
pub mod integrity;
-
-const LOG_TARGET_BRIDGE_DISPATCH: &str = "runtime::bridge-dispatch";
diff --git a/bridges/bin/runtime-common/src/messages_xcm_extension.rs b/bridges/bin/runtime-common/src/messages_xcm_extension.rs
deleted file mode 100644
index 46ed4da0d85..00000000000
--- a/bridges/bin/runtime-common/src/messages_xcm_extension.rs
+++ /dev/null
@@ -1,502 +0,0 @@
-// Copyright (C) Parity Technologies (UK) Ltd.
-// This file is part of Parity Bridges Common.
-
-// Parity Bridges Common is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Parity Bridges Common is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Parity Bridges Common. If not, see .
-
-//! Module provides utilities for easier XCM handling, e.g:
-//! `XcmExecutor` -> `MessageSender` -> `OutboundMessageQueue`
-//! |
-//! `Relayer`
-//! |
-//! `XcmRouter` <- `MessageDispatch` <- `InboundMessageQueue`
-
-use bp_messages::{
- source_chain::OnMessagesDelivered,
- target_chain::{DispatchMessage, MessageDispatch},
- LaneId, MessageNonce,
-};
-use bp_runtime::messages::MessageDispatchResult;
-pub use bp_xcm_bridge_hub::XcmAsPlainPayload;
-use bp_xcm_bridge_hub_router::XcmChannelStatusProvider;
-use codec::{Decode, Encode};
-use frame_support::{traits::Get, weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
-use pallet_bridge_messages::{
- Config as MessagesConfig, OutboundLanesCongestedSignals, WeightInfoExt as MessagesPalletWeights,
-};
-use scale_info::TypeInfo;
-use sp_runtime::SaturatedConversion;
-use sp_std::{fmt::Debug, marker::PhantomData};
-use xcm::prelude::*;
-use xcm_builder::{DispatchBlob, DispatchBlobError};
-
-/// Message dispatch result type for single message.
-#[derive(CloneNoBound, EqNoBound, PartialEqNoBound, Encode, Decode, Debug, TypeInfo)]
-pub enum XcmBlobMessageDispatchResult {
- /// We've been unable to decode message payload.
- InvalidPayload,
- /// Message has been dispatched.
- Dispatched,
- /// Message has **NOT** been dispatched because of given error.
- NotDispatched(#[codec(skip)] Option),
-}
-
-/// [`XcmBlobMessageDispatch`] is responsible for dispatching received messages
-///
-/// It needs to be used at the target bridge hub.
-pub struct XcmBlobMessageDispatch {
- _marker: sp_std::marker::PhantomData<(DispatchBlob, Weights, Channel)>,
-}
-
-impl<
- BlobDispatcher: DispatchBlob,
- Weights: MessagesPalletWeights,
- Channel: XcmChannelStatusProvider,
- > MessageDispatch for XcmBlobMessageDispatch
-{
- type DispatchPayload = XcmAsPlainPayload;
- type DispatchLevelResult = XcmBlobMessageDispatchResult;
-
- fn is_active() -> bool {
- !Channel::is_congested()
- }
-
- fn dispatch_weight(message: &mut DispatchMessage) -> Weight {
- match message.data.payload {
- Ok(ref payload) => {
- let payload_size = payload.encoded_size().saturated_into();
- Weights::message_dispatch_weight(payload_size)
- },
- Err(_) => Weight::zero(),
- }
- }
-
- fn dispatch(
- message: DispatchMessage,
- ) -> MessageDispatchResult {
- let payload = match message.data.payload {
- Ok(payload) => payload,
- Err(e) => {
- log::error!(
- target: crate::LOG_TARGET_BRIDGE_DISPATCH,
- "[XcmBlobMessageDispatch] payload error: {:?} - message_nonce: {:?}",
- e,
- message.key.nonce
- );
- return MessageDispatchResult {
- unspent_weight: Weight::zero(),
- dispatch_level_result: XcmBlobMessageDispatchResult::InvalidPayload,
- }
- },
- };
- let dispatch_level_result = match BlobDispatcher::dispatch_blob(payload) {
- Ok(_) => {
- log::debug!(
- target: crate::LOG_TARGET_BRIDGE_DISPATCH,
- "[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob was ok - message_nonce: {:?}",
- message.key.nonce
- );
- XcmBlobMessageDispatchResult::Dispatched
- },
- Err(e) => {
- log::error!(
- target: crate::LOG_TARGET_BRIDGE_DISPATCH,
- "[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob failed, error: {:?} - message_nonce: {:?}",
- e, message.key.nonce
- );
- XcmBlobMessageDispatchResult::NotDispatched(Some(e))
- },
- };
- MessageDispatchResult { unspent_weight: Weight::zero(), dispatch_level_result }
- }
-}
-
-/// A pair of sending chain location and message lane, used by this chain to send messages
-/// over the bridge.
-#[cfg_attr(feature = "std", derive(Debug, Eq, PartialEq))]
-pub struct SenderAndLane {
- /// Sending chain relative location.
- pub location: Location,
- /// Message lane, used by the sending chain.
- pub lane: LaneId,
-}
-
-impl SenderAndLane {
- /// Create new object using provided location and lane.
- pub fn new(location: Location, lane: LaneId) -> Self {
- SenderAndLane { location, lane }
- }
-}
-
-/// [`XcmBlobHauler`] is responsible for sending messages to the bridge "point-to-point link" from
-/// one side, where on the other it can be dispatched by [`XcmBlobMessageDispatch`].
-pub trait XcmBlobHauler {
- /// Runtime that has messages pallet deployed.
- type Runtime: MessagesConfig;
- /// Instance of the messages pallet that is used to send messages.
- type MessagesInstance: 'static;
-
- /// Actual XCM message sender (`HRMP` or `UMP`) to the source chain
- /// location (`Self::SenderAndLane::get().location`).
- type ToSourceChainSender: SendXcm;
- /// An XCM message that is sent to the sending chain when the bridge queue becomes congested.
- type CongestedMessage: Get