fix(kona/protocol): bounds checks in read_tx_data for truncated/oversized payloads#19904
Merged
sebastianst merged 1 commit intodevelopfrom Apr 2, 2026
Merged
fix(kona/protocol): bounds checks in read_tx_data for truncated/oversized payloads#19904sebastianst merged 1 commit intodevelopfrom
sebastianst merged 1 commit intodevelopfrom
Conversation
…nd oversized payloads Add two bounds checks to `read_tx_data` before indexing into the slice: 1. Reject payloads exceeding `MAX_SPAN_BATCH_ELEMENTS` with `TooBigSpanBatchSize`, matching op-node's `rlp.NewStream(r, MaxSpanBatchElementCount)` behavior. Without this, kona accepts oversized transactions that op-node rejects, causing a consensus divergence. (Cantina finding #28) 2. Reject truncated payloads where `payload_length_with_header` exceeds the remaining buffer, preventing a panic on malformed input. (Cantina finding #25, item 4) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
theochap
approved these changes
Apr 2, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #19904 +/- ##
===========================================
Coverage 75.9% 75.9%
===========================================
Files 684 489 -195
Lines 73143 61816 -11327
===========================================
- Hits 55532 46974 -8558
+ Misses 17467 14842 -2625
+ 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:
|
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.
Summary
MAX_SPAN_BATCH_ELEMENTSsize cap toread_tx_data, matching op-node'srlp.NewStream(r, MaxSpanBatchElementCount)behavior — prevents consensus divergence on oversized transaction payloads (Cantina Make CALLs Revert Properly #28 / optimism-private#488)Fixes https://github.com/ethereum-optimism/optimism-private/issues/486
Fixes https://github.com/ethereum-optimism/optimism-private/issues/488
Test plan
cargo test --package kona-protocol --all-features --lib -- test_read_tx_data— both new tests passcargo check --package kona-protocol— compiles cleanlyjust tinrust/kona/(runs--all-features)🤖 Generated with Claude Code