Repository navigation
Refactor/architecture and tooling - #20
Merged
Merged
Conversation
…r CIRCUITS_REQUIRE_ARTIFACTS
…al counts from layouts
…ng on absent artifacts
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.
Refactor the tooling so the repository can be maintained
19 commits. 63 files, +5410/-1996. No circuit changed — every
.r1csand.zkeybyte-identical to the manifest, verified before and after each phase.What was wrong
scripts/was 7 shell scripts and 4 TypeScript files with nothing shared. Three failures were being swallowed:setup.shcurl -Lwithout-fsetup.shset -ekills the script at exit 6; the mirror never runsrelease.shgit ls-remoteguard fails openbuild.shalso ransnarkjswith> /dev/null 2>&1, so a failed ceremony step looked like a successful one.What changed
All 7 shell scripts are now TypeScript. Zero
.shremain. Seven shared modules underscripts/lib/(circuits,paths,log,run,manifest,note,vk-hash) replace what was copied across files. The circuit list lived in five places; it now lives in one, andPUBLIC_SIGNALSis derived from the signal layouts rather than maintained beside them.run()exits on failure;tryRun()returns a status. That distinction is what closes the three bugs above.Two layering fixes:
NoteCryptomoved fromtest/helpers/toscripts/lib/— it's the reference implementation of note cryptography, with a build script among its consumers, so the oldscripts/ → test/edge pointed backwards. Andsetup.tsgained atry/finally, so a mid-ceremony failure no longer strands_0000.zkey/_0001.zkey.Tests: 159 → 254
The additions cover what had no coverage:
run()'s error path, manifest rotation (ROTATE_CIRCUIT, previously unreachable in any test), the note primitives, and the strict-mode guards.Two pre-existing tests passed without artifacts present —
returninstead ofthis.skip(), reporting green on nothing. Both now respectCIRCUITS_REQUIRE_ARTIFACTS. Four Poseidon tests asserted only!= 0; they now pin real vectors.Every fix here was confirmed by reintroducing the bug and watching the test fail.
Documentation
~35 errors. The consequential one:
value_proof's public signal order was documented backwards. Circom emitssignal outputbefore public inputs, soowner_hashis signal 0 — verified againstvalue_proof.sym. Anyone building a verifier from those docs would produce proofs that fail with no diagnostic.Also:
value_prooflisted at ~300 constraints (real: 1151),unshieldat 16,033 (real: 16,903), a constraint-breakdown table with its two rows inverted,private_link— a deleted circuit — in two tables, 11 broken commands, 9 broken links, and documented pre-commit hooks that don't exist.test/docs.test.tsnow checks numbers against the.r1csand manifest, that every documentedpnpm run Xexists, and that every relative link resolves. The~300figure had survived three written explanations of why it was wrong; prose alone doesn't hold.License
The published package contradicted itself:
package.jsonsaid Apache-2.0,npm/package.json.templatesaid GPL-3.0. Worse,LICENSEwas 17 lines — the per-file header Apache suggests, not the license text. Every release shipped with no actual terms.Now GPL-3.0-or-later throughout, with the full 690-line text. Four tests keep the five sources in agreement.
Verification
pnpm checkclean. 254 passing.pnpm run build-allreproduces all 15 artifacts at their manifest sha256.release:drygreen.Two things worth knowing. The ceremony is not deterministic — two runs give two different
vk_hashvalues. I confirmed the old shell behaved identically, so this is inherent tozkey contribute, not a regression from the port;release:restorerecovers the published keys from npm with sha256 verification.And
release/is desynced fromkeys/. Pre-existing, untouched here, worth a look before the next publish.