-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XCM bridge hub pallet (will be deployed at bridge hubs) #2213
Conversation
…llets 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
…locations where possible
modules/xcm-bridge-hub/src/lib.rs
Outdated
/// to return to regular bridge operations. | ||
#[pallet::call_index(2)] | ||
#[pallet::weight(Weight::zero())] // TODO: https://github.com/paritytech/parity-bridges-common/issues/1760 - weights | ||
pub fn report_misbehavior( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things to add:
- if Implement additional require primitives for dynamic fees directly for pallet-xcm-bridge-hub #2261 will be implemented, we'll probably just remove this function or at least the current misbehavior. That's because it will be a sending chain problem to deal with its own queue/storage. Let's keep it for now, though, until we have a confidence that Implement additional require primitives for dynamic fees directly for pallet-xcm-bridge-hub #2261 is the right option;
- there's currently a problem - if bridge is closed at one side and misbehaving at other, the messages and the bridge remains will live here forever. I'll deal with that in a follow up PRs - that is noted here under the " start closing lane at this side if the same lane is in closing state at the bridged side" point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not sure about the misbehavior part yet, could we keep in this PR only the open-close bridge part ? And move the misbehavior to #2261 ? Or to a separate PR anyway ?
To me it seems easier to review and merge this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! It doesn't belong actually to #2261, because it isn't about dynamic fees, it just depends on the way our low-level transport works. So separate PR (on top of this one) looks good - I'll extract those two calls (report_misbehavior
and resume_misbehaving_bridges
) soon. Thanks for suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…rmat will likely change to be able to resume bridges from the on_iniitalize/on_idle
/// | ||
/// Returns error if `bridge_origin_relative_location` is outside of `here_universal_location` | ||
/// local consensus OR if `bridge_destination_universal_location` is not a universal location. | ||
pub fn bridge_locations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I would define this on the BridgeLocations
struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't trivial and I'm in favor of having easier "constructors", so left it as a free function
) * Adjust commands * Use `NetworkWorker::next_action()` instead of `poll()` * rustfmt * minor: fix mutability * Move imports * Replace `NetworkWorker::next_action()` with `run()` * Import fix * Make `NetworkWorker::run` consume self * Retire `OldV1SessionInfo` * update lockfile for {"polkadot", "substrate"} * update lockfile for {"substrate", "polkadot"} * update lockfile for {"substrate", "polkadot"} * Make stuff compile Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Piotr Mikołajczyk <piomiko41@gmail.com> Co-authored-by: Dmitry Markin <dmitry@markin.tech> Co-authored-by: parity-processbot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* 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
related to #2451
There's a lot of work here, but I'd like to do something in a separate PR. Opening PR early for visibility and to avoid losing it accidentally (because it'll take at least couple of weeks to solve and test everything).
Important things here:
we can't use cumulus code directly from the pallet directly (before we'll move everything to a monorepo?), so either this pallet goes to the Cumulus repo OR we'll use some abstractions. I'll yet to think about thatLooks like we don't need anything explicit from cumulus, but I'll double check during polishingI assume we can have some collisions for the lane id generation mechanism, because lane id is just 4 bytes. I'd start with accepting this risk and changeDecided to fix it first in to avoid unnecessary complexities - Change LaneId underlying type from [u8; 4] to H256 #2221;LaneId
to some abstractLaneKey
in the future. We'll use ordered pair of bridge side locations as this key. Ordered means that on both sides of the bridge we need to generate the same key. So we can't use simply(source, destination)
here