Repository navigation
Use abi.encode for multiRequestId hash - #464
Merged
Merged
Conversation
multiRequestId was keccak256(abi.encodePacked(requestIds, groupIds, sender)). With two dynamic uint256[] arrays the packed encoding is ambiguous, so e.g. ([1,2],[3]) and ([1],[2,3]) produced the same id (slither encode-packed-collision). Switch to abi.encode. Breaking for multiRequest creators: ids computed with the old formula now revert with MultiRequestIdNotValid. Existing multiRequests are unaffected, since the id is only checked in setMultiRequest. - UniversalVerifier VERSION 3.0.0 -> 3.1.0 - Tests use the local calculateMultiRequestId helper instead of js-sdk's - Add tests for legacy id rejection and split collision Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
daveroga
approved these changes
Sep 29, 2026
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
VerifierLib.setMultiRequestcheckedmultiRequestId == keccak256(abi.encodePacked(requestIds, groupIds, sender)). With two dynamicuint256[]arrays the packed encoding is ambiguous:([1,2],[3])and([1],[2,3])produce the same ID, so they collide. Slither reports this as Highencode-packed-collision. The practical impact was limited to self-DoS, becausesenderis part of the hash, but the ID didn't commit to how the IDs were split between requests and groups.VerifierLib:abi.encodePacked→abi.encode. This is a hard switch.UniversalVerifier.VERSION3.0.0 → 3.1.0 (andhelpers/constants.ts).test/utils/id-calculation-utils.ts:calculateMultiRequestIdusesabi.encode. The verifier tests now import this local helper instead of js-sdk's, so they don't depend on a js-sdk release.MultiRequestIdNotValid, and different splits give different IDs.setMultiRequest. Reads, proof submission and status checks all use the stored ID, and the storage layout doesn't change.MultiRequestIdNotValid(expected, given).Verifier, such asIdentityVerifierin attestations-registry, pick this up when they bump@iden3/contracts.Tests
npm run test→ 481 passing. solhint clean.🤖 Generated with Claude Code