Repository navigation
test(access): pad the nullifier domain like the other domains - #1246
andrew-fleming merged 1 commit into
Conversation
buildNullifierHash encoded NULLIFIER_DOMAIN with a bare TextEncoder, while the account and commitment helpers use encodePadded32. The contract defines nullifierDomain as a zero-padded 32-byte string, so use the same helper here. The hash is unchanged: persistentHash already zero-pads the 31-byte value. Fixes OpenZeppelin#441
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
andrew-fleming
left a comment
There was a problem hiding this comment.
Thanks @yash251! LGTM
What types of changes does your code introduce to OpenZeppelin Midnight Contracts?
Put an
xin the boxes that applyFixes #441
In
ShieldedAccessControl.test.ts,buildNullifierHashencodedNULLIFIER_DOMAINwith a bareTextEncoder, whilebuildAccountIdHashandbuildRoleCommitmentHashuseencodePadded32. The contract definesnullifierDomainaspad(32, "ShieldedAccessControl:nullifier"), so this switches the helper toencodePadded32for consistency.The resulting hash does not change. The domain string is 31 bytes and
persistentHashalready zero-pads it. I checked this with@midnight-ntwrk/compact-runtimefrom the lockfile: both encodings give the samepersistentHashover[commitment, domain]. So no expected values move.Test-only change, so I didn't add a CHANGELOG entry. Could a maintainer add the
skip-changeloglabel?PR Checklist
## Unreleased, or asked a maintainer to add theskip-changeloglabel because nothing user-facing changed (asked above)Further comments
biome checkpasses on the changed file. I don't have the Compact compiler installed locally, so I couldn't run the access test suite; I'm relying on CI for that, backed by the hash check above.Summary by CodeRabbit