Skip to content

fix: Validate EIP-712 integer values fit declared bit width#194

Merged
roninjin10 merged 1 commit intomainfrom
fix/issue-65-eip712-integer-range
Jan 4, 2026
Merged

fix: Validate EIP-712 integer values fit declared bit width#194
roninjin10 merged 1 commit intomainfrom
fix/issue-65-eip712-integer-range

Conversation

@roninjin10
Copy link
Contributor

Summary

Changes

  • Added range validation for uintN types (0 to 2^N-1)
  • Added range validation for intN types (-2^(N-1) to 2^(N-1)-1)
  • Added bit width validation (must be 8-256, multiple of 8)
  • Added 14 new tests for range validation edge cases

Test plan

  • Added range validation tests for uint8, uint16, uint256
  • Added range validation tests for int8 boundary cases
  • Ran EIP712 tests (75 tests passing)

🤖 Generated with Claude Code

Fixes #65

EIP-712 encodeValue now validates that integer values fit within their
declared bit width before encoding. Previously, a uint8 field with value
300 would silently encode incorrectly.

- Added range validation for uint8-uint256 (0 to 2^N-1)
- Added range validation for int8-int256 (-2^(N-1) to 2^(N-1)-1)
- Added bit width validation (must be 8-256, multiple of 8)
- Added 14 new tests for range validation edge cases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dist Error Error Jan 2, 2026 3:03pm
voltaire Error Error Jan 2, 2026 3:03pm

Copy link
Contributor Author

@roninjin10 roninjin10 left a comment

Choose a reason for hiding this comment

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

Automated review summary for PR #194 — fix: Validate EIP-712 integer values fit declared bit width\n\nTouched areas: Domain | Files changed: 3 (+156/-0)\n\n- Tests: yes\n- Types & API: yes\n- Docs: ensure behavior is documented where user-facing.\n- Performance: consider micro-allocations in tight loops.\n\nOutcome: Comment-only review; no blocking issues spotted. Please consider the above suggestions.\n

@roninjin10 roninjin10 merged commit 70f5fd3 into main Jan 4, 2026
35 of 49 checks passed
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.

Bug: EIP-712 integer encoding lacks range validation

1 participant

Comments