Skip to content

Commit

Permalink
XCM bridge hub pallet (will be deployed at bridge hubs) (#2213)
Browse files Browse the repository at this point in the history
* XCM over bridge pallet (won't ever be merged to this repo): initial commit

* try both bridge-id and lane-id

* flush

* flush

* flush

* flush

* first prototype

* started working on xcm-over-bridge tests

* proper open_bridge_works test

* more open_bridge tests

* request_bridge_closure tests

* tests for close_bridge

* report_misbehavior tests

* renaming xcm-over-bridge ad xcm-bridge-hub: we'll have two similar pallets for dynamic lanes/fees support. One will be deployed at the bridge hub (xcm-bridge-hub) and another one (xcm-bridge-hub-router) at sibling/parent chains to send messages to remote network over the bridge hub

* added couple of TODOs

* moved BridgeQueuesState here + TODO for implementing report_bridge_queues_state + fmt

* fixing TODOs

* fixing TODOs

* moved bridge locations to primitives

* added a couple of TODOs

* ref issue from TODO

* clippy and spelling

* fix tests

* another TODOs

* typo

* LaneState -> force_close_bridge

* start_closing_the_bridge -> start_closing_bridge

* removed Closing bridge state, so now we only have the Opened -> optional temporary Closed state -> None

* spelling

* started prototyping suspend+resume on misbehavior

* continue prototyping

* more tests for open_bridge

* more tests for close_bridge

* more tests for report_misbehavior

* started tests for resume_misbehaving_bridges

* implemented tests for resume_misbehaving_bridges

* remove UnsuspendedChannelWithMisbehavingOwner because now, when all bridges are resumed at once + we assume that the inbound XCM channel is suspended immediately it is no longer actual

* added TODO

* add comment re misbehavior reporter if he's associated with the bridge owner

* ignored clippy

* fmt

* use versioned XCM structs in public interfaces and storage + Box XCM locations where possible

* spelling

* removed TODO in favor of #2257

* LocalChannelManager -> LocalXcmChannelManager

* removed code specific to #2233, because it isn't the only option now

* removemisbehavior mentions

* also temporary (?) remove BridgesByLocalOrigin because the storage format will likely change to be able to resume bridges from the on_iniitalize/on_idle

* AllowedOpenBridgeOrigin -> OpenBridgeOrigin

* - TooManyBridgesForLocalOrigin

* use bridge_destination_relative_location in args

* better impl of strip_low_level_junctions

* get rid of xcm_into_latest

* clippy

* added #![warn(missing_docs)] to new crates
  • Loading branch information
svyatonik authored and bkontur committed May 7, 2024
1 parent 0fa1b01 commit 19357c1
Show file tree
Hide file tree
Showing 8 changed files with 1,793 additions and 12 deletions.
30 changes: 30 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"modules/parachains",
"modules/relayers",
"modules/shift-session-manager",
"modules/xcm-bridge-hub",
"primitives/beefy",
"primitives/chain-bridge-hub-cumulus",
"primitives/chain-bridge-hub-kusama",
Expand Down
57 changes: 57 additions & 0 deletions modules/xcm-bridge-hub/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[package]
name = "pallet-xcm-bridge-hub"
description = "Module that adds dynamic bridges/lanes support to XCM infrastucture at the bridge hub."
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
log = { version = "0.4.19", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }

# Bridge Dependencies

bp-messages = { path = "../../primitives/messages", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-xcm-bridge-hub = { path = "../../primitives/xcm-bridge-hub", default-features = false }
pallet-bridge-messages = { path = "../messages", default-features = false }

# Substrate Dependencies

frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

# Polkadot Dependencies

xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }

[dev-dependencies]
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master" }

[features]
default = ["std"]
std = [
"bp-messages/std",
"bp-runtime/std",
"codec/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-bridge-messages/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"xcm/std",
"xcm-executor/std",
]
runtime-benchmarks = []
Loading

0 comments on commit 19357c1

Please sign in to comment.