Repository navigation
Feat/spend v3 cross tree canonical key - #23
Merged
Merged
Conversation
…sm matches its published bytes
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
Releases circuits 0.17.0 with two rotated circuits:
transferv3: spends across trees. Each input is proven against its own Merkle root (merkle_roots[0..1]), so two notes from different trees of the forest can be spent together instead of being consolidated first. 9 public inputs.unshieldv3: canonical spending key. Same 8 public inputs as v2.Both versions fix a critical flaw present in every earlier spend circuit. Transfer v2 and unshield v2 must be retired on-chain as soon as v3 is active.
Security
One note admitted several nullifiers (transfer v1/v2, unshield v1/v2).
BabyPbkaccepts any key below 2^253, butBase8generates a subgroup of orderl ≈ 2^251.6.k, k + l, …therefore derive the same owner key (the same note), while each gives a different nullifierPoseidon(commitment, key).Fix
SpendingKeyOwner(note.circom) also requiresspending_key < l.[1, l), so no honest note is affected.Also in v3
amountto u128.recipienta constraint of its own instead of relying on the setup to bind an unused public input.Changes
Circuits
SpentNote(tree_depth)innote.circomcovers ownership, commitment, membership and nullifier of a spent note. Transfer uses it twice and unshield once.Constraint sections are renumbered in reading order. Stale EdDSA notes and unused includes are removed.
Constraint counts:
Tooling
setup.tsverifies the ptau against the published blake2b-512 ofpowersOfTau28_hez_final_16.ptau, both on download and when cached.setup.tswarns loudly.SETUP_CEREMONY=releaserequiresSETUP_ENTROPYand a 32-byte hexSETUP_BEACON.lib/rotation.tsis the single reader ofROTATE_CIRCUIT/ROTATE_VERSION, shared by build, manifest and fixtures. A typo fails instead of building over published artifacts.lint:circomrunscircom --inspectand fails on any unconstrained signal outside the circomlib internals it lists.Release
package.jsonandmanifest.jsonare at 0.17.0.Commits
chore(scripts): shared rotation reader, verified ptau and release-mode ceremonyfeat!: transfer v3 across trees and unshield v3 with canonical spending key (0.17.0)chore(lint): fail lint:circom on unconstrained signals reported by circom --inspectTests
test/helpers/freedom.ts): with the public statement fixed, every private input is perturbed (±1, +l, 0, 2^252, 2^253−1, p−1). No input outside an explicit whitelist (the dummy slot, an absent change note) may still satisfy the circuit. Covers transfer (two real notes, two trees, one note + dummy), unshield (total, partial) and shield.0, 1, l−1are accepted;l, l+1, 2^252, 2^253−1, 2^253, p−1are refused;kandl − kderive different owner keys.amountthat would wrap the conservation is refused.Test plan
pnpm check(lint, typecheck, prettier, lint:circom with--inspect)pnpm test:strict: 301 passingpnpm release:verify: manifest verified against local artifacts