Expand description
Pezpallet for committing outbound messages for delivery to Ethereum
§Overview
Messages come either from sibling teyrchains via XCM, or BridgeHub itself
via the pezsnowbridge-pezpallet-system-v2:
pezsnowbridge_outbound_queue_primitives::v2::EthereumBlobExporter::deliverpezsnowbridge_pezpallet_system_v2::Pezpallet::send
The message submission pipeline works like this:
- The message is first validated via the implementation for
pezsnowbridge_outbound_queue_primitives::v2::SendMessage::validate - The message is then enqueued for later processing via the implementation for
pezsnowbridge_outbound_queue_primitives::v2::SendMessage::deliver - The underlying message queue is implemented by
Config::MessageQueue - The message queue delivers messages to this pezpallet via the implementation for
pezframe_support::traits::ProcessMessage::process_message - The message is processed in
Pezpallet::do_process_message: a. Convert toOutboundMessage, and stored into theMessagesvector storage b. ABI-encode theOutboundMessageand store the committed Keccak256 hash inMessageLeavesc. GeneratePendingOrderwith assigned nonce and fee attached, stored into thePendingOrdersmap storage, with nonce as the key d. Increment nonce and update theNoncestorage - At the end of the block, a merkle root is constructed from all the leaves in
MessageLeaves. At the beginning of the next block, bothMessagesandMessageLeavesare dropped so that state at each block only holds the messages processed in that block. - This merkle root is inserted into the teyrchain header as a digest item
- Offchain relayers are able to relay the message to Ethereum after:
a. Generating a merkle proof for the committed message using the
prove_messageruntime API b. Reading the actual message content from theMessagesvector in storage - On the Ethereum side, the message root is ultimately the thing being verified by the Beefy light client.
- When the message has been verified and executed, the relayer will call the extrinsic
submit_delivery_receiptto: a. Verify the message with proof for a transaction receipt containing the event log, same as the inbound queue verification flow b. Fetch the pending order by nonce of the message, pay reward with fee attached in the order c. Remove the order fromPendingOrdersmap storage by nonce
§Extrinsics
Call::submit_delivery_receipt: Submit delivery proof
§Runtime API
prove_message: Generate a merkle proof for a committed message
Re-exports§
pub use types::OnNewCommitment;pub use types::PendingOrder;pub use types::ProcessMessageOriginOf;pub use weights::WeightInfo;pub use pezpallet::*;
Modules§
- api
- Helpers for implementing runtime api
- pezpallet
- The
pezpalletmodule in each FRAME pezpallet hosts the most important items needed to construct this pezpallet. - process_
message_ impl - Implementation for
pezframe_support::traits::ProcessMessage - send_
message_ impl - Implementation for
pezsnowbridge_outbound_queue_primitives::v2::SendMessage - types
- weights
- Autogenerated weights for
pezsnowbridge-pezpallet-outbound-queue