Skip to content

execution/types/stateless: reject empty witness headers during decode#20432

Merged
awskii merged 3 commits into
erigontech:mainfrom
Sahil-4555:fix/stateless-empty-witness-decode
Apr 11, 2026
Merged

execution/types/stateless: reject empty witness headers during decode#20432
awskii merged 3 commits into
erigontech:mainfrom
Sahil-4555:fix/stateless-empty-witness-decode

Conversation

@Sahil-4555

Copy link
Copy Markdown
Contributor

This fixes a crash path when decoding an empty stateless witness. Some downstream witness logic assumes at least one header is present and may access Headers[0], so accepting an empty witness can lead to a panic later. The change adds a small validation in fromExtWitness to reject witnesses with no headers during decode, and includes a regression test for the RLP decode path.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a decode-time invariant check to the stateless witness RLP path to prevent accepting witnesses with zero headers (which can lead to later panics when code assumes Headers[0] exists), along with a regression test covering the empty-headers RLP decode case.

Changes:

  • Reject RLP-decoded witnesses that contain no headers in fromExtWitness.
  • Add a regression test that RLP-decoding an extWitness with empty Headers fails with the expected error.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
execution/types/stateless/encoding.go Adds validation during RLP decode to reject witnesses with an empty header list.
execution/types/stateless/witness_test.go Adds a regression test asserting RLP decode fails when headers are missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread execution/types/stateless/encoding.go
@Sahil-4555 Sahil-4555 force-pushed the fix/stateless-empty-witness-decode branch 2 times, most recently from be220ff to 4d7660f Compare April 9, 2026 09:32
@yperbasis yperbasis added this to the 3.5.0 milestone Apr 9, 2026
@yperbasis yperbasis requested a review from awskii April 9, 2026 09:57
@Sahil-4555 Sahil-4555 force-pushed the fix/stateless-empty-witness-decode branch from 4d7660f to 55d5e7b Compare April 9, 2026 17:22
@awskii awskii added this pull request to the merge queue Apr 11, 2026
Merged via the queue into erigontech:main with commit 47fdb5e Apr 11, 2026
32 checks passed
@Sahil-4555 Sahil-4555 deleted the fix/stateless-empty-witness-decode branch April 12, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants