Conversation
… inputs The AbiParametersInputs component used a loose regex for bytesN types that accepted any hex length, and a loose regex for intN/uintN types that accepted any decimal value regardless of bit width. Replace the bytesN pattern with an exact-length regex that enforces 2N hex characters for a bytesN type. Replace the intN/uintN pattern with a BigInt range validator that checks the parsed value fits within the declared bit width, and also accepts negative integers for signed intN types. Closes paradigmxyz#121
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The AbiParametersInputs component used two loose regex patterns that accepted invalid values:
For bytesN types (e.g. bytes32): the regex
/^0x[0-9a-fA-F]*$/accepted any hex length. This replaces it with an exact-length pattern (e.g. 64 hex chars for bytes32).For intN/uintN types: the regex
/^[0-9]+$/accepted any decimal digit string regardless of bit width, and rejected negative integers for intN types entirely. This replaces it with a BigInt range validator that checks the value fits within the declared bit width, and accepts negative values for signed intN.Both gaps were marked with TODO comments in the source.
Verified: biome check, tsc --noEmit, and bun run build all pass.
Closes #121