fix: 🐛 outbound queue now correctly commits messages' root (#93)

This PR fixes a critical issue in which the messages enqueued in the
`MessageQueue` pallet weren't being correctly commited by the
`SnowbridgeOutboundQueueV2` pallet because of a misconfiguration in our
runtimes:
- Before this PR, the `MessageQueue` pallet had a lower index than the
`SnowbridgeOutboundQueueV2` pallet. This means that its `on_initialize`
hook was executed before the `on_initialize` hook of the latter.
- The `MessageQueue` pallets processes messages in its `on_initialize`
hook. In our case, this processing meant calling the
`do_process_message` function of the `SnowbridgeOutboundQueueV2` pallet,
which pushes the message into both its `Messages` and `MessageLeaves`
storage for further processing afterwards, sets a pending order for it
for the relayer and increments the nonce for the next message.
- Then, the `SnowbridgeOutboundQueueV2`'s `on_initialize` hook gets
called, and it completely clears both the `Messages` and `MessageLeaves`
storage to start fresh for the new block. This means it would clear up
the previously processed messages.
- Finally, in the `on_finalize` hook, the messages processed in this
block would get commited from the `MessageLeaves` storage, but since it
would always be empty nothing got commited, which means the Solochain
relayer never found anything to relay and messages weren't getting to
Ethereum.
This commit is contained in:
Tobi Demeco 2025-06-11 22:07:36 +02:00 committed by GitHub
parent 70934ef6ac
commit 1e09d404b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 34 additions and 13 deletions

View file

@ -301,9 +301,6 @@ mod runtime {
#[runtime::pallet_index(36)]
pub type Sudo = pallet_sudo;
#[runtime::pallet_index(37)]
pub type MessageQueue = pallet_message_queue;
// ╚═════════════════ Polkadot SDK Utility Pallets ══════════════════╝
// ╔════════════════════ Frontier (EVM) Pallets ═════════════════════╗
@ -334,8 +331,18 @@ mod runtime {
pub type SnowbridgeSystemV2 = snowbridge_pallet_system_v2;
// ╚══════════════════════ Snowbridge Pallets ═══════════════════════╝
// ╔════════════ Polkadot SDK Utility Pallets - Block 2 ═════════════╗
// The Message Queue pallet has to be after the Snowbridge Outbound
// Queue V2 pallet since the former processes messages in its
// `on_initialize` hook and the latter clears up messages in
// its `on_initialize` hook, so otherwise messages will be cleared
// up before they are processed.
#[runtime::pallet_index(70)]
pub type MessageQueue = pallet_message_queue;
// ╚════════════ Polkadot SDK Utility Pallets - Block 2 ═════════════╝
// ╔══════════════════════ StorageHub Pallets ═══════════════════════╗
// Start with index 70
// Start with index 80
// ╚══════════════════════ StorageHub Pallets ═══════════════════════╝
// ╔═══════════════════ DataHaven-specific Pallets ══════════════════╗

View file

@ -301,9 +301,6 @@ mod runtime {
#[runtime::pallet_index(36)]
pub type Sudo = pallet_sudo;
#[runtime::pallet_index(37)]
pub type MessageQueue = pallet_message_queue;
// ╚═════════════════ Polkadot SDK Utility Pallets ══════════════════╝
// ╔════════════════════ Frontier (EVM) Pallets ═════════════════════╗
@ -334,8 +331,18 @@ mod runtime {
pub type SnowbridgeSystemV2 = snowbridge_pallet_system_v2;
// ╚══════════════════════ Snowbridge Pallets ═══════════════════════╝
// ╔════════════ Polkadot SDK Utility Pallets - Block 2 ═════════════╗
// The Message Queue pallet has to be after the Snowbridge Outbound
// Queue V2 pallet since the former processes messages in its
// `on_initialize` hook and the latter clears up messages in
// its `on_initialize` hook, so otherwise messages will be cleared
// up before they are processed.
#[runtime::pallet_index(70)]
pub type MessageQueue = pallet_message_queue;
// ╚════════════ Polkadot SDK Utility Pallets - Block 2 ═════════════╝
// ╔══════════════════════ StorageHub Pallets ═══════════════════════╗
// Start with index 70
// Start with index 80
// ╚══════════════════════ StorageHub Pallets ═══════════════════════╝
// ╔═══════════════════ DataHaven-specific Pallets ══════════════════╗

View file

@ -301,9 +301,6 @@ mod runtime {
#[runtime::pallet_index(36)]
pub type Sudo = pallet_sudo;
#[runtime::pallet_index(37)]
pub type MessageQueue = pallet_message_queue;
// ╚═════════════════ Polkadot SDK Utility Pallets ══════════════════╝
// ╔════════════════════ Frontier (EVM) Pallets ═════════════════════╗
@ -334,8 +331,18 @@ mod runtime {
pub type SnowbridgeSystemV2 = snowbridge_pallet_system_v2;
// ╚══════════════════════ Snowbridge Pallets ═══════════════════════╝
// ╔════════════ Polkadot SDK Utility Pallets - Block 2 ═════════════╗
// The Message Queue pallet has to be after the Snowbridge Outbound
// Queue V2 pallet since the former processes messages in its
// `on_initialize` hook and the latter clears up messages in
// its `on_initialize` hook, so otherwise messages will be cleared
// up before they are processed.
#[runtime::pallet_index(70)]
pub type MessageQueue = pallet_message_queue;
// ╚════════════ Polkadot SDK Utility Pallets - Block 2 ═════════════╝
// ╔══════════════════════ StorageHub Pallets ═══════════════════════╗
// Start with index 70
// Start with index 80
// ╚══════════════════════ StorageHub Pallets ═══════════════════════╝
// ╔═══════════════════ DataHaven-specific Pallets ══════════════════╗

View file

@ -1,5 +1,5 @@
{
"version": "0.1.0-autogenerated.7852383907238203444",
"version": "0.1.0-autogenerated.14950524012264222870",
"name": "@polkadot-api/descriptors",
"files": [
"dist"

Binary file not shown.