Repository navigation
feat(contracts,core)!: attestors sign the nullifier - #317
Draft
nicolasLuduena wants to merge 17 commits into
Draft
nicolasLuduena wants to merge 17 commits into
nicolasLuduena wants to merge 17 commits into
Conversation
Attestors sign seven fields: the version, the layout (V and B), and the nullifier and the holder as two limbs each. Every other claim field reaches the signature through the nullifier, which verifyAttestation already computes, so the circuit no longer splits five 32-byte fields into halves. The registry verifies seven fields, and the message length is no longer a module parameter. Core adds nullifierOf, the off-chain mirror of the circuit's nullifier, and claimToMessage returns the same seven fields as buildMessage. The parity tests hold both equal to the circuits over random claims.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
… feat/310-sign-nullifier
# Conflicts: # package.json # packages/contracts/README.md # packages/core/README.md
This branch has not been deployed
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.
Closes #310
Part of #309
PR 2 of 6, stacked on #316.
Summary
Attestors now sign seven fields instead of the flat list of claim fields.
versionandholderreach the signature directly. Every other claim field reaches it through the nullifier, whichverifyAttestationalready computes for replay. The circuit no longer cuts five 32-byte fields at byte 16, and that cut was three quarters ofverifyAttestation.limbs(b) = [b[31], bytes 0–30 little-endian]is how a circuit already holds 32 bytes, so it needs no byte-by-byte decomposition.claimToMessagereturns the same seven fields, and the new keylessnullifierOfmirrors the circuit's nullifier.VandB. The identity is hashed as a plain concatenation (136 + 9V + 17B bytes), soV = 34, B = 0andV = 0, B = 18can give two claims the same nullifier. A new test mock,MockAttestationLayout(V=0, B=18), shows that a signature made for the other layout is rejected.test/helpers/random-claims.ts, replay withTHOTH_SEED) draws 200 claims per mock and per property. It holdsclaimToMessageandnullifierOfequal to the circuits on both mocks. fast-check is not used, because it is not a dependency on this base.Insufficient valid signatures. That covers policyHash, subjectHash, salt, both window bounds, each value and flag, byte halves and byte flags, and appId (tested against a contract sealed to the changed id). A changed holder or version is rejected too.attestation.compactheader and the DESIGN.md tables, the glossary, the kind author guide, AGENTS.md, and the contracts, core and cardano docs. There are changesets for contracts, core, zk-tls and cardano.Evidence
npm run benchon a Ryzen 7 5700G (16 threads, 31 GiB), proof server 9.0.0, 3 warm proofs per circuit. The proof server verified every proof against its verifier key and refused a proof under the wrong one.Before (
feat/192-proving-benchmark):After (this branch):
Both mocks are within the 32,768-row (
k = 15) budget. The open circuits are unchanged because this ticket does not touchopenClaim.Tests:
No verification skill in this repo.
Merge Danger
Door: two-way
Nothing is deployed, and
versionstays1before launch, so this can be reverted. After a deploy, any change to the observation identity changes what attestors sign and needs a version bump (ADR 0015).Blast Radius: breaking
Every signature made over the old message stops verifying. Embedding contracts drop the
#Kparameter (attestation<V, B, N, M>,attestor_registry<M>). zkFetch and Cardano attestors sign the new message throughclaimToMessage, so they need the matching contracts release.