Skip to content

Commit

Permalink
Bridges V2 refactoring backport and pallet_bridge_messages simplifi…
Browse files Browse the repository at this point in the history
…cations (paritytech#4935)

## Summary

This PR contains migrated code from the Bridges V2
[branch](paritytech#4427) from the
old `parity-bridges-common`
[repo](https://github.com/paritytech/parity-bridges-common/tree/bridges-v2).
Even though the PR looks large, it does not (or should not) contain any
significant changes (also not relevant for audit).
This PR is a requirement for permissionless lanes, as they were
implemented on top of these changes.

## TODO

- [x] generate fresh weights for BridgeHubs
- [x] run `polkadot-fellows` bridges zombienet tests with actual runtime
1.2.5. or 1.2.6 to check compatibility
- ☑️ working, checked with 1.2.8 fellows BridgeHubs
- [x] run `polkadot-sdk` bridges zombienet tests
  - ☑️ with old relayer in CI (1.6.5) 
- [x] run `polkadot-sdk` bridges zombienet tests (locally) - with the
relayer based on this branch -
paritytech/parity-bridges-common#3022
- [x] check/fix relayer companion in bridges repo -
paritytech/parity-bridges-common#3022
- [x] extract pruning stuff to separate PR
paritytech#4944

Relates to:
paritytech/parity-bridges-common#2976
Relates to:
paritytech/parity-bridges-common#2451

---------

Signed-off-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
Co-authored-by: command-bot <>
  • Loading branch information
3 people authored and TomaszWaszczyk committed Jul 13, 2024
1 parent d9c2595 commit cb8e283
Show file tree
Hide file tree
Showing 108 changed files with 4,708 additions and 4,639 deletions.
19 changes: 6 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions bridges/bin/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ workspace = true

[dependencies]
codec = { features = ["derive"], workspace = true }
hash-db = { workspace = true }
log = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
static_assertions = { optional = true, workspace = true, default-features = true }
tuplex = { workspace = true }

# Bridge dependencies

bp-header-chain = { workspace = true }
bp-messages = { workspace = true }
bp-parachains = { workspace = true }
Expand All @@ -34,25 +32,23 @@ pallet-bridge-parachains = { workspace = true }
pallet-bridge-relayers = { workspace = true }

# Substrate dependencies

frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-utility = { workspace = true }
sp-api = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
sp-trie = { workspace = true }
sp-trie = { optional = true, workspace = true }

# Polkadot dependencies
xcm = { workspace = true }
xcm-builder = { workspace = true }

[dev-dependencies]
bp-test-utils = { workspace = true, default-features = true }
pallet-balances = { workspace = true, default-features = true }
bp-test-utils = { workspace = true }
pallet-balances = { workspace = true }
pallet-bridge-messages = { features = ["std", "test-helpers"], workspace = true }

[features]
default = ["std"]
Expand All @@ -63,22 +59,21 @@ std = [
"bp-polkadot-core/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",
"frame-system/std",
"hash-db/std",
"log/std",
"pallet-balances/std",
"pallet-bridge-grandpa/std",
"pallet-bridge-messages/std",
"pallet-bridge-parachains/std",
"pallet-bridge-relayers/std",
"pallet-transaction-payment/std",
"pallet-utility/std",
"scale-info/std",
"sp-api/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
Expand All @@ -88,15 +83,22 @@ std = [
"xcm/std",
]
runtime-benchmarks = [
"bp-runtime/test-helpers",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
"pallet-bridge-messages/runtime-benchmarks",
"pallet-bridge-messages/test-helpers",
"pallet-bridge-parachains/runtime-benchmarks",
"pallet-bridge-relayers/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",
]
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ mod integrity_tests {
pub mod per_message {
use super::*;

use bp_messages::ChainWithMessages;
use pallet_bridge_messages::WeightInfoExt;

/// Ensures that the value of `PriorityBoostPerMessage` matches the value of
Expand All @@ -339,7 +340,7 @@ mod integrity_tests {
BalanceOf<Runtime>: Send + Sync + FixedPointOperand,
{
let maximal_messages_in_delivery_transaction =
Runtime::MaxUnconfirmedMessagesAtInboundLane::get();
Runtime::BridgedChain::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
super::ensure_priority_boost_is_sane::<PriorityBoostPerMessage, BalanceOf<Runtime>>(
"PriorityBoostPerMessage",
maximal_messages_in_delivery_transaction,
Expand Down
Loading

0 comments on commit cb8e283

Please sign in to comment.