Skip to content
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

[asset-hubs/bridge-hubs] Bridging Polkadot Asset Hub <-> Kusama Asset Hub to enable asset transfer of KSMs/DOTs #1352

Closed
wants to merge 22 commits into from

Commits on Sep 5, 2023

  1. asset-hubs: transfer assets via bridge using pallet-xcm

    Add xcm routing configuration for bridging between
    	Polkadot Asset Hub <-> Kusama Asset Hub.
    
    We explicitly allow only reserve based transfer for KSM/DOT to
    cross-consensus AssetHubs and nothing else at first (start defensively).
    We can later allow whatever (ETH, TrustBackedAssets, ForeignAssets,
    PoolAssets ...).
    
    Add tests for simulation:
    - `limited_reserve_transfer_assets` with `pallet_xcm` both ways
    - handling `ReserveAssetDeposisted` on both sides
    
    Add local zomienet run for:
    - reserve based transfer of KSMs from AHK to AHP
    - reserve based transfer of DOTs from AHP to AHK
    (check parachains/runtimes/bridge-hubs/README.md in this PR)
    
    Signed-off-by: Branislav Kontur <[email protected]>
    Signed-off-by: Adrian Catangiu <[email protected]>
    acatangiu authored and bkontur committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    4617ffa View commit details
    Browse the repository at this point in the history
  2. Transfer reserve asset with dynamic fees and back-pressure.

    Change XCM routing configuration for bridging from unpaid to paid version.
    
    Paid version means that origin (besides extrinsic fees) pays delivery fees at source Asset Hub
    and also Asset Hub sovereign account pays for execution of `ExportMessage` instruction at local Bridge Hub.
    
    Change XCM bridging router from `UnpaidRemoteExporter` to `ToPolkadotXcmRouter` and `ToKusamaXcmRouter`
    which are pallet instances of new module `pallet-xcm-bridge-hub-router`.
    
    The main thing that the pallet `pallet-xcm-bridge-hub-router` offers is the dynamic message fee,
    that is computed based on the bridge queues state. It starts exponentially increasing
    if the queue between this chain and the sibling/child bridge hub is congested.
    
    More about dynamic fees and back-preasure for v1 can be found [here](paritytech/parity-bridges-common#2294).
    
    Signed-off-by: Branislav Kontur <[email protected]>
    Signed-off-by: Adrian Catangiu <[email protected]>
    Signed-off-by: Svyatoslav Nikolsky <[email protected]>
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    Co-authored-by: Svyatoslav Nikolsky <[email protected]>
    3 people committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    a517420 View commit details
    Browse the repository at this point in the history
  3. Kusama/Polkadot BridgeHub allows bridging between Kusama/Polkadot (re…

    …lay, para) chains
    
    Add bridging pallets to Bridge Hub runtime configuration:
    - `pallet-bridge-grandpa` is an on-chain GRANDPA light client, used for verifying GRANDPA finality proofs on-chain.
    - `pallet-bridge-parachains` is a Parachain finality module.
    - `pallet-bridge-messages` module that allows sending and receiving messages using lane concept.
    - `pallet-bridge-relayers` module that is used to store relayer rewards.
    
    Kusma Bridge Hub and Polkadot Bridge Hub runtimes are configred with those pallets in the way that:
    - allows to verify bridged relay chain GRANDPA finality proofs, e.g. Kusama Bridge Hub can track and verify Polkadot relay chain GRANDPA proofs and Polkadot Bridge Hub can track and verify Kusama relay chain GRANDPA proofs.
    - allows to verify bridged parachain finality proofs e.g. Kusama Bridge Hub can track and verify Polkadot Bridge Hub proofs and vice versa.
    - allows to relay messages between them which can be verified with mentioned finality modules.
    
    Add tests for simulation:
    - handling `ExportMessage` on both sides
    - handling message dispatch and routing to target on both side
    - relayer can submit proofs with `submit_finality_proof` / `submit_parachain_heads` and relay messages with `receive_messages_proof`
    
    To the lane concept mentioned above, actual bridging configuration allows to send/relay/receive messages only with one hard-coded lane `[0, 0, 0, 0]`,
    which is dedicated lane for Kusama Asset Hub and Polkadot Asset Hub communication.
    
    Next stage will be focused on adding support to allow bridging between arbitrary parachains.
    More about [Bridges V2](https://github.com/paritytech/parity-bridges-common/milestone/17).
    
    Signed-off-by: Branislav Kontur <[email protected]>
    Signed-off-by: Adrian Catangiu <[email protected]>
    Signed-off-by: Svyatoslav Nikolsky <[email protected]>
    Signed-off-by: Serban Iorga <[email protected]>
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    Co-authored-by: Svyatoslav Nikolsky <[email protected]>
    Co-authored-by: Serban Iorga <[email protected]>
    4 people committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    945ea7f View commit details
    Browse the repository at this point in the history
  4. Extended Kusama/Polkadot BridgeHub with dynamic fees and congestion s…

    …upport
    
    Add congestion detection to the Bridge Hub runtimes and report congestion status to the sending chain.
    
    Bridge Hub's `ExportMessage` handling is extended with check if outbound message queue is congested,
    if so then `CongestedMessage` signal is sent to the sending chain's relevant `pallet-xcm-bridge-hub-router` pallet instance,
    where dynamic fees factor is processed.
    When then same Bridge Hub receives message delivery confirmation, there is a another check is outbound queue is still congested,
    if not then `UncongestedMessage` signal is sent to the sending chain's relevant `pallet-xcm-bridge-hub-router` pallet instance.
    
    `pallet-bridge-messages`'s `receive_messages_proof` does another check for congestion or back-preassure
    with checking status of underlaying XCMP queue (`cumulus_pallet_xcmp_queue::bridging::OutboundXcmpChannelCongestionStatusProvider`).
    If we cannot deliver a message to the target, then `receive_messages_proof` returns error and Bridge Hub does not allow to receive new bridged messages.
    
    More about congestion detection [here](paritytech/parity-bridges-common#2318).
    
    Signed-off-by: Branislav Kontur <[email protected]>
    Signed-off-by: Adrian Catangiu <[email protected]>
    Signed-off-by: Svyatoslav Nikolsky <[email protected]>
    Signed-off-by: Serban Iorga <[email protected]>
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    Co-authored-by: Svyatoslav Nikolsky <[email protected]>
    Co-authored-by: Serban Iorga <[email protected]>
    4 people committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    4af6519 View commit details
    Browse the repository at this point in the history
  5. Update review comments from Adrian

    Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/bridge_hub_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/bridge_hub_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/bridge_hub_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/xcm_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/asset-hub-polkadot/src/xcm_config.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Update cumulus/parachains/runtimes/assets/common/src/matching.rs
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    
    Fmt + one any to all
    
    Co-authored-by: Adrian Catangiu <[email protected]>
    bkontur and acatangiu committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    867321c View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2023

  1. Configuration menu
    Copy the full SHA
    11e0931 View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2023

  1. Configuration menu
    Copy the full SHA
    a3d1264 View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2023

  1. Configuration menu
    Copy the full SHA
    0aeb13a View commit details
    Browse the repository at this point in the history
  2. Zombienet nits

    bkontur committed Sep 19, 2023
    Configuration menu
    Copy the full SHA
    c20f3e4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    80964f9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6fe8678 View commit details
    Browse the repository at this point in the history
  5. Fix benchmarks

    bkontur committed Sep 19, 2023
    Configuration menu
    Copy the full SHA
    b2015dc View commit details
    Browse the repository at this point in the history
  6. Fix benchmarks

    bkontur committed Sep 19, 2023
    Configuration menu
    Copy the full SHA
    1fd7aaa View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2023

  1. Backporting nits from #1215

    bkontur committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    791d6dd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2cd5e55 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    344e0b0 View commit details
    Browse the repository at this point in the history
  4. Fix

    bkontur committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    d42e481 View commit details
    Browse the repository at this point in the history
  5. Fix

    bkontur committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    76ca00b View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2023

  1. Configuration menu
    Copy the full SHA
    03511e0 View commit details
    Browse the repository at this point in the history
  2. Constants nit

    bkontur committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    fc9727c View commit details
    Browse the repository at this point in the history
  3. Deps

    bkontur committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    534c718 View commit details
    Browse the repository at this point in the history
  4. Cargo.lock

    bkontur committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    58d6319 View commit details
    Browse the repository at this point in the history