fix(abi): add missing ABI validation in argument encoder#22529
Merged
Conversation
157ff25 to
0134d7b
Compare
benesjan
approved these changes
Apr 15, 2026
Contributor
There was a problem hiding this comment.
This is great. Thanks for cleaning our mess!
Just please wait for Jean's response before merging - would be nice to get a confirmation that the AVM truncation thingy is tested.
(Unrelated but we also got very lucky that AI matured fast enough for us to not have to suffer through this tech debt now. So in hindsight being sloppy a few years ago and move fast seemed to have been a good strategy)
0134d7b to
b882037
Compare
Collaborator
Author
|
❌ Failed to cherry-pick to |
3 tasks
vezenovm
added a commit
that referenced
this pull request
Apr 20, 2026
…2529) (#22608) ## Summary Backport of #22529 to v4-next. Adds missing ABI enforcement in the `ArgumentEncoder` that allowed invalid inputs to be silently accepted during simulation via aztec.js: - **Fixed-size arrays**: Oversized/undersized arrays were silently truncated. Now throws if array length doesn't match. - **Strings**: Strings longer than declared length were silently truncated. Now throws if string exceeds max length. - **Top-level argument count**: Extra arguments were silently ignored. Now throws if argument count doesn't match. - **Integer overflow**: Values outside valid range for declared width were accepted without error. Now validates ranges. - **Array type guard**: Non-array values for array parameters now get a clear error. ## Cherry-pick conflict One conflict in `e2e_ha_full.test.ts` — the incoming commit included a "should reload keystore" test block from a different PR not present on v4-next. Resolved by dropping the unrelated test block. ## Test plan - [x] Encoder unit tests pass (34/34) - [x] TypeScript compilation succeeds for changed packages - [x] Verified Noir contract ABIs on v4-next match the updated test arguments ClaudeBox log: https://claudebox.work/s/49d536b7c0544efb?run=1
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.
Summary
Adds missing ABI enforcement in the
ArgumentEncoderthat allowed invalid inputs to be silently accepted during simulation via aztec.js.Fixes
[Field; 2]would encode only the first 2). Now throws if array length doesn't match exactly.[0, 2^width - 1]and signed values fit in[-2^(width-1), 2^(width-1) - 1].Context
BoundedVec already had proper length validation — these checks bring fixed-size arrays, strings, integers, and top-level args to the same standard.
ClaudeBox log: https://claudebox.work/s/9a3d10cc66fed7fd?run=2
Fixes #12221