This repository was archived by the owner on Jan 16, 2026. It is now read-only.
feat(protocol): add BatchDropReason enum for improved batch validation#3147
Merged
theochap merged 5 commits intoop-rs:mainfrom Jan 8, 2026
Merged
feat(protocol): add BatchDropReason enum for improved batch validation#3147theochap merged 5 commits intoop-rs:mainfrom
theochap merged 5 commits intoop-rs:mainfrom
Conversation
…n error handling ## Summary - Added `BatchDropReason` enum with 24 variants covering all possible batch drop scenarios - Modified `BatchValidity::Drop` to include the reason: `Drop(BatchDropReason)` - Updated `SingleBatch::check_batch` to return specific drop reasons - Updated `SpanBatch::check_batch` and `check_batch_prefix` to return specific drop reasons - Updated downstream consumers in `kona-derive` to handle the new signature - Enhanced logging to include drop reasons for better debugging ## Motivation Previously, batch validation failures could only be diagnosed by parsing log messages, which is fragile and not programmatically testable. This change enables: - Precise programmatic testing of batch validation logic - Better error messages with structured drop reasons - Improved debugging experience for node operators Closes op-rs#3127
Codecov Report❌ Patch coverage is ☔ View full report in Codecov by Sentry. |
- Use inline format args in Display impl (clippy::uninlined_format_args) - Fix test expectation: test_check_batch_block_timestamp_lt_l1_origin should expect TimestampBeforeL1Origin, not OverlappedTxMismatch
The test expects "batch exceeded sequencer time drift without adopting next origin" log message, which corresponds to SequencerDriftNotAdoptedNextOrigin, not EpochTooOld.
- Replace .init() with set_default() in span batch tests to avoid global subscriber conflicts when running tests in parallel - Add missing vec import in block.rs tests - Fix expected BatchDropReason values in tests: - test_check_batch_no_new_blocks: FutureTimestampHolocene -> SpanBatchNoNewBlocksPreHolocene - test_check_sequence_window_expired: ParentHashMismatch -> IncludedTooLate - test_starting_epoch_too_far_ahead: IncludedTooLate -> EpochTooFarInFuture
Contributor
|
This pull request has been automatically marked as stale because it has been inactive for 3 weeks. |
theochap
approved these changes
Jan 8, 2026
Member
theochap
left a comment
There was a problem hiding this comment.
Awesome, thanks for taking care of that
Member
|
@Himess can you fix the deny CI job? |
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Jan 15, 2026
op-rs/kona#3147) Closes #3127 Previously, batch validation failures could only be diagnosed by parsing log messages, which is fragile and not programmatically testable. This change enables: - Precise programmatic testing of batch validation logic - Better error messages with structured drop reasons - Improved debugging experience for node operators ## Changes - `BatchDropReason` enum with variants for all drop scenarios: - Timestamp related: `FutureTimestampHolocene`, `PastTimestampPreHolocene` - Parent/origin: `ParentHashMismatch`, `IncludedTooLate`, `EpochTooOld`, `EpochTooFarInFuture`, `EpochHashMismatch` - Sequencer drift: `TimestampBeforeL1Origin`, `SequencerDriftOverflow`, `SequencerDriftExceeded`, `SequencerDriftNotAdoptedNextOrigin` - Transaction validation: `EmptyTransaction`, `DepositTransaction`, `Eip7702PreIsthmus`, `NonEmptyTransitionBlock` - Span batch specific: `SpanBatchPreDelta`, `SpanBatchNoNewBlocksPreHolocene`, `SpanBatchMisalignedTimestamp`, `SpanBatchNotOverlappedExactly` - Overlap validation: `L1OriginBeforeSafeHead`, `MissingL1Origin`, `OverlappedTxCountMismatch`, `OverlappedTxMismatch`, `L2BlockInfoExtractionFailed`, `OverlappedL1OriginMismatch`
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #3127
Previously, batch validation failures could only be diagnosed by parsing log messages, which is fragile and not programmatically testable. This change enables:
Changes
BatchDropReasonenum with variants for all drop scenarios:FutureTimestampHolocene,PastTimestampPreHoloceneParentHashMismatch,IncludedTooLate,EpochTooOld,EpochTooFarInFuture,EpochHashMismatchTimestampBeforeL1Origin,SequencerDriftOverflow,SequencerDriftExceeded,SequencerDriftNotAdoptedNextOriginEmptyTransaction,DepositTransaction,Eip7702PreIsthmus,NonEmptyTransitionBlockSpanBatchPreDelta,SpanBatchNoNewBlocksPreHolocene,SpanBatchMisalignedTimestamp,SpanBatchNotOverlappedExactlyL1OriginBeforeSafeHead,MissingL1Origin,OverlappedTxCountMismatch,OverlappedTxMismatch,L2BlockInfoExtractionFailed,OverlappedL1OriginMismatch