Snowbridge: drop outbound-queue-v2 message leaves from state#12211
Snowbridge: drop outbound-queue-v2 message leaves from state#12211dimartiro wants to merge 3 commits into
Conversation
0340bb0 to
e8988a0
Compare
|
/cmd bench --pallet snowbridge_pallet_outbound_queue_v2 --runtime bridge-hub-westend |
|
Command "bench --pallet snowbridge_pallet_outbound_queue_v2 --runtime bridge-hub-westend" has started 🚀 See logs here |
|
Command "bench --pallet snowbridge_pallet_outbound_queue_v2 --runtime bridge-hub-westend" has failed ❌! See logs here DetailsCommand output:✅ Successful benchmarks of runtimes/pallets: |
a5c7518 to
f2ab526
Compare
…ridge_pallet_outbound_queue_v2 --runtime bridge-hub-westend'
aed6100 to
b5c6eab
Compare
|
@acatangiu You might be interested in this |
|
Nice improvement! Some potential issues and suggestions came up from AI review — not directly related to the changes in this PR, but still worth taking a look at. Just FYI.
|
Description
The
outbound-queue-v2pallet stored the per-message merkle leaves in theMessageLeavesstorage value and onlycleared them at the start of the next block. As a result the leaves persisted in state across blocks and were
needlessly included in the PoV, even though they are only required to build the commitment root and to generate proofs
off-chain.
This PR makes
MessageLeavestruly transient: the leaves are still appended during block execution to build the merkleroot, but the value is now killed within the same block, right after the commitment is produced in
commit(). Thecommitted root inserted into the header digest is unchanged.
Closes #7971
Integration
No integration steps are required for downstream runtimes. The change is internal to the
outbound-queue-v2pallet:Ethereum-side verification are unaffected.
prove_messageruntime API keeps the same signature and return value; it now recomputes the leaves fromMessagesinstead of readingMessageLeaves.MessageLeavesis no longer expected to be present in state after a block; any tooling that read it directly (thereshould be none, as it was transient by design) must recompute leaves from
Messagesinstead.Review Notes
commit()now callsMessageLeaves::kill()immediately after building the root, so the value never persists beyondthe block in which it is produced and never enters the PoV.
prove_messageruntime API reconstructs them from theMessagesstorage, in the same order they were appended during block execution, so
leaf_indexstays valid. This API is readoff-chain only, so reading
Messageshere does not enter any block's PoV.Pallet::message_leafhelper,shared by message processing and proof generation, so both always produce identical leaves.
MessageLeaves::kill()inon_initializeis kept as a defensive cleanup that also removes any value leftpersisted by a pre-upgrade runtime.
prove_message_recomputes_committed_leaves_after_commitasserts that, aftercommitdrops the leaves,proofs recomputed from
Messagesstill verify against the very same root committed on-chain.Checklist
Trequired)