Skip to content

Reject ABI booleans that are not 0 or 1 - #98

Open
SashaMIT wants to merge 1 commit into
MetaMask:mainfrom
SashaMIT:codered-bool-reject-noncanonical
Open

SashaMIT wants to merge 1 commit into
MetaMask:mainfrom
SashaMIT:codered-bool-reject-noncanonical

Conversation

@SashaMIT

Copy link
Copy Markdown

Summary

bool.decode compared the decoded uint256 to 1 and returned false for every other value. A 32-byte 2 decoded as false. ABI booleans are only 0 and 1. Any other value now throws.

Test plan

  • rejects a boolean that is not 0 or 1 did not throw on main
  • npx jest src/parsers/bool.test.ts (16 tests OK)
  • npx eslint src/parsers/bool.ts src/parsers/bool.test.ts

Made with Cursor

bool.decode treated every uint256 other than 1 as false, so a 2 decoded as false. Only 0 and 1 are valid.
@SashaMIT
SashaMIT requested review from a team as code owners September 25, 2026 10:44

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