fix(kona/derive): add over-fill check in BlobSource::load_blobs#19364
fix(kona/derive): add over-fill check in BlobSource::load_blobs#19364
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #19364 +/- ##
===========================================
+ Coverage 75.7% 75.9% +0.1%
===========================================
Files 671 477 -194
Lines 71228 59985 -11243
===========================================
- Hits 53974 45529 -8445
+ Misses 17110 14456 -2654
+ Partials 144 0 -144
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
ccf298a to
9fe6fd4
Compare
ajsutton
left a comment
There was a problem hiding this comment.
Remove references to matching op-node.
Reduce the number and verbosity of comments. No need to explain the same thing multiple times.
9fe6fd4 to
d0cc171
Compare
d0cc171 to
4b3f95e
Compare
ajsutton
left a comment
There was a problem hiding this comment.
LGTM. Correct fix matching Go's fillBlobPointers over-fill check.
Two minor notes:
-
PR body inaccuracy: The description says this is "symmetric with the existing
BlobsUnderFillvariant," but noBlobsUnderFillvariant exists. Under-fill is handled insideBlobData::fill()viaBlobDecodingError::InvalidLength. TheBlobsOverFillname is fine on its own, but the symmetry claim is misleading. -
Comment line-number references: The comments reference specific Go line numbers (e.g.,
blob_data_source.go:162). These go stale quickly — consider referencing just the function name (fillBlobPointers) instead.
78c1423 to
fd64d18
Compare
After the blob-pointer fill loop completes, add a post-loop check:
if `blob_index < blobs.len()` the provider returned more blobs than
were requested. Return `ResetError::BlobsOverFill` (→
PipelineErrorKind::Reset) rather than silently discarding the extras.
This mirrors op-node's `fillBlobPointers` check at
blob_data_source.go:162-163 which returns
`fmt.Errorf("got too many blobs")` wrapped as `NewResetError`.
Over-fill can occur with buggy blob providers (e.g. third-party RPC
services that ignore the requested hash list) or in rare L1 reorg
scenarios where the blob set shifts between hash collection and fetch.
Changes:
- Add `ResetError::BlobsOverFill(usize, usize)` variant to
`pipeline.rs` (symmetric with the existing `BlobsUnderFill` variant).
- Import `ResetError` in `blobs.rs` and add the post-loop guard.
- Add `should_return_extra_blob` flag to `TestBlobProvider` for testing.
- Add `test_load_blobs_overfill_triggers_reset` regression test.
Fixes #19363
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
#19480) Rename the `blob_index` variable in `load_blobs` to `filled_blobs` for clarity, as the variable tracks the number of blob placeholders that were filled rather than serving as a traditional index. Addresses review feedback from optimism#19364. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
823280d to
d52ee33
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c9b9f3e to
4d4da58
Compare
The `From<BlobProviderError> for PipelineErrorKind` impl already exists, so `?` handles the conversion automatically. The explicit `map_err` was redundant. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4d4da58 to
de05125
Compare
* fix(kona/derive): add over-fill check in BlobSource::load_blobs
After the blob-pointer fill loop completes, add a post-loop check:
if `blob_index < blobs.len()` the provider returned more blobs than
were requested. Return `ResetError::BlobsOverFill` (→
PipelineErrorKind::Reset) rather than silently discarding the extras.
This mirrors op-node's `fillBlobPointers` check at
blob_data_source.go:162-163 which returns
`fmt.Errorf("got too many blobs")` wrapped as `NewResetError`.
Over-fill can occur with buggy blob providers (e.g. third-party RPC
services that ignore the requested hash list) or in rare L1 reorg
scenarios where the blob set shifts between hash collection and fetch.
Changes:
- Add `ResetError::BlobsOverFill(usize, usize)` variant to
`pipeline.rs` (symmetric with the existing `BlobsUnderFill` variant).
- Import `ResetError` in `blobs.rs` and add the post-loop guard.
- Add `should_return_extra_blob` flag to `TestBlobProvider` for testing.
- Add `test_load_blobs_overfill_triggers_reset` regression test.
Fixes #19363
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: use function names instead of line numbers in Go references
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(kona/derive): use named fields for BlobsOverFill variant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(kona/derive): rename blob_index to filled_blobs in BlobSource (#19480)
Rename the `blob_index` variable in `load_blobs` to `filled_blobs`
for clarity, as the variable tracks the number of blob placeholders
that were filled rather than serving as a traditional index.
Addresses review feedback from optimism#19364.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove references to Go implementation in comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(kona/derive): remove useless BlobProviderError conversion in map_err
The `From<BlobProviderError> for PipelineErrorKind` impl already exists,
so `?` handles the conversion automatically. The explicit `map_err` was
redundant.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
BlobSource::load_blobswas missing a post-loop over-fill check. After the blob-pointer fill loop completes, ifblob_index < blobs.len()the blob provider returned more blobs than were requested. Previously kona silently discarded the extra blobs. This PR adds a guard that returnsResetError::BlobsOverFill(→PipelineErrorKind::Reset) in that case, mirroring the op-node reference.Background
The Go op-node performs this check in
fillBlobPointersinblob_data_source.go:This error is wrapped as
NewResetErrorat the call site, causing the pipeline to reset and retry from a clean state. Kona was missing the over-fill check; under-fill is handled separately viaBlobDecodingError::InvalidLengthinBlobData::fill().When Over-fill Can Occur
Changes
ResetError::BlobsOverFill(usize, usize)variant topipeline.rs(addresses the over-fill case; under-fill is handled separately viaBlobDecodingError::InvalidLengthinBlobData::fill()).ResetErrorinblobs.rsand add the post-loop check after the fill loop.should_return_extra_blobflag toTestBlobProviderfor testing.test_load_blobs_overfill_triggers_resetregression test.Testing
All 12 tests pass, including the new
test_load_blobs_overfill_triggers_reset.Fixes #19363