Delete withdrawal bundle event block from the correct db on disconnect#85
Open
1440000bytes wants to merge 2 commits into
Open
Conversation
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.
In
disconnect, the withdrawal-event branch reads the sequence index fromwithdrawal_bundle_event_blocks.last()but deletes that index fromdeposit_blocks:So on a reorg disconnecting a two-way peg block that carries a withdrawal bundle event, the event-block record is never removed, and an unrelated deposit record sharing the same sequence index is deleted instead (or the disconnect errors if no such deposit record exists). Both
get_last_deposit_block_hashandget_last_withdrawal_bundle_event_block_hashdrive mainchain sync position, so this corrupts deposit/withdrawal tracking and can diverge state across nodes.Fix
Delete from
withdrawal_bundle_event_blocks, matching the lookup and mirroring the deposit branch just below.Test
Added a unit test that seeds a
withdrawal_bundle_event_blocksrow and adeposit_blocksrow at the same index, disconnects a withdrawal bundle event and asserts the event-block row is removed while the deposit row survives. It fails on the old code and passes with the fix.