Skip to content

Reject uint JSON strings that are not entirely digits - #552

Open
SashaMIT wants to merge 1 commit into
ChainSafe:masterfrom
SashaMIT:codered-uint-json-full-digits
Open

SashaMIT wants to merge 1 commit into
ChainSafe:masterfrom
SashaMIT:codered-uint-json-full-digits

Conversation

@SashaMIT

Copy link
Copy Markdown

Summary

UintNumberType.fromJson parsed strings with parseInt, which stops at the first non-digit. fromJson("10abc") returned 10. A uint JSON string now has to be all digits before it is converted. UintBigintType.fromJson already uses BigInt, which throws on that string.

Test plan

  • Trailing junk - fromJson failed on master (expected [Function] to throw an error) and passes here
  • pnpm --dir packages/ssz exec vitest run test/unit/byType/uint (101 tests OK)

Made with Cursor

UintNumberType.fromJson used parseInt, so "10abc" became 10. Require the whole string to be digits before converting.
@SashaMIT
SashaMIT requested a review from a team as a code owner September 25, 2026 09:16

This branch has not been deployed

No deployments
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