Disconnect two-way peg data at the connecting block height#95
Merged
Ash-L2L merged 2 commits intoJun 19, 2026
Merged
Conversation
3af8b74 to
76d036a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
disconnect_two_way_peg_dataasserted that the most recentdeposit_blocksrecord,withdrawal_bundle_event_blocksrecord and pending withdrawal-bundle status were stamped atblock_height- 1 and gated the pending-bundle removal onblock_height- last_failure >WITHDRAWAL_BUNDLE_FAILURE_GAP.connect_two_way_peg_datastamps all of these atblock_heightand every other status assertion in disconnect already usesblock_height.connectanddisconnectof the same block run at the same height (connect_prevalidated_blockbumps the height beforeconnect_two_way_peg_dataanddisconnect_two_way_peg_dataruns beforedisconnect_tipreverts it), so theblock_height- 1 checks never matched.As a result, disconnecting a sidechain block that applied a mainchain deposit or withdrawal-bundle event on a reorg panicked on the assertion and a pending bundle created by that block was never removed. This wedges a node on any mainchain reorg that orphans such a block. The off-by-one also underflowed at height 0.
Align the four checks with connect (
block_height, >=). This also matches the existing disconnect status assertions. Add a regression test that connects a deposit and disconnects it through the real connect/disconnect paths.Fuzzing logs
Assertion failure (reorg of a deposit block at height >= 1):
Underflow variant (deposit in the first block, height 0), minimized input [65, 6, 10, 93]: