Skip to content

sszgen: refuse invalid bitfields in HashTreeRoot - #28

Open
syjn99 wants to merge 2 commits into
fix/sszgen-validationfrom
fix/sszgen-htr-bitfield
Open

syjn99 wants to merge 2 commits into
fix/sszgen-validationfrom
fix/sszgen-htr-bitfield

Conversation

@syjn99

@syjn99 syjn99 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Stacked on #27.

  • HashTreeRootWith runs the check of MarshalSSZ before each bitfield hash call (ssz.ValidateBitlist, ssz.ValidateProgressiveBitlist, ssz.ValidateBitvector). It returned a root for a Bitlist with no delimiter bit or above its limit, and for a Bitvector with set padding bits.
  • PutBitlist and PutProgressiveBitlist validate their input, and HashRoot returns the first error. A zero last byte made PutProgressiveBitlist panic.
  • The bitlist validators wrap ErrEmptyBitlist, so an empty bitlist still gives that error.
  • Add ProgBits (a progressive bitlist) to genfixture, and check HashTreeRoot in its bitfield tests.

Prysm develop regenerated with this branch, compared with #27: patch

🤖 Generated with Claude Code

Store the error when validation fails, and `HashRoot` will then return it.
HashTreeRootWith runs the check of MarshalSSZ before the hash call.
@syjn99
syjn99 added this pull request to stack #29 November 18, 2026 03:10
@syjn99 syjn99 changed the title Fix/sszgen htr bitfield sszgen: refuse invalid bitfields in HashTreeRoot Nov 18, 2026
@syjn99
syjn99 marked this pull request as ready for review November 18, 2026 03:12
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.

1 participant