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

Snowbridge v2 - Outbound Queue #6706

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from

Conversation

yrong
Copy link
Contributor

@yrong yrong commented Nov 29, 2024

Context

This PR is for SnowbridgeV2, essentially unordered messaging system. This PR focus more on outbound changes, inbound changes will be addressed in another PR.

The point is that we want to make V1(i.e. ordered messaging) work side by side with V2, so we add new pallets without changing the legacy codes.

SnowbridgeV2 is based upon XCMV5 with new instructions like AliasOrigin, InitiateTransfer in place.

Initial PR yrong#4 which has been internally reviewed. It also requires some companion changes in:

Workflow

  1. Simulated test

cargo test -p bridge-hub-westend-integration-tests --lib tests::snowbridge_v2_outbound -- --nocapture

is the entry point where we build XCM to start the cross-chain transfer from AH.

  1. on AH we add a custom exporter returns a lower fee(without the execution cost on Ethereum comparing with V1) charged from the user when exporting with V2 specific instructions(i.e. AliasOrigin), essentially predict the route by content of XCM, more details in Predicate route table by Xcm #6074

  2. On BH also add a new exporter to handle V2 specific xcm, convert XCM to Message structure which will be executed on Ethereum as following:

pub struct Message {
    /// Origin of the original sender from source chain
    pub origin: H256,
    /// ID of the message
    pub id: H256,
    /// Fee amount in WETH
    pub fee: u128, 
    /// Commands be executed on Ethereum
    pub commands: BoundedVec<Command, ConstU32<5>>,
}
  1. In OutboundQueue encode the message and store it into a merkle tree as before, add the pending message into PendingOrder storage. Code here

  2. In OutboundQueue add a new extrinsic submit_delivery_proof in which we verify the Message has been delivered to Ethereum, after that add the fee to RewardLeger which can be redeemed by the relayer later, more details in Relayer rewards paid to specified location account #6578

Review notes

It may still require further change/refactoring but would be great if we can get some early feedback.

@yrong yrong changed the title [SnowbridgeV2]: Outbound queue Snowbridge Unordered Message Delivery - Outbound Queue Nov 29, 2024
@yrong yrong changed the title Snowbridge Unordered Message Delivery - Outbound Queue Snowbridge v2 - Outbound Queue Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant