Skip to content

feat(contracts): vendor and cover the libid-circuits Honk verifiers - #40

Merged
xgreenx merged 4 commits into
mainfrom
feat/honk-verifiers
Sep 14, 2026
Merged

xgreenx merged 4 commits into
mainfrom
feat/honk-verifiers

Conversation

@xgreenx

@xgreenx xgreenx commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

libid-circuits v0.4.0 ships each circuit's Solidity verifier beside its vk, so bb leaves every downstream repo; this crate compiles, covers and deploys them.

Changes

  • circuits.json pins the release version and each tarball's sha256 as literals; scripts/vendor-circuit-verifiers.sh downloads the verifiers into solidity/contracts/circuits/, refusing a tarball whose digest is not the pin's.
  • The two .sol files are gitignored, not committed: they are libid-circuits' release asset, like the forge artifacts and npm ABIs. The forge-build action vendors them before every build, test, dry-run and publish; locally the script runs once before forge build (README).
  • [lint] ignore for bb's output. HonkVerifiers.t.sol reads logN off each verifier, asserts the circuits differ and fit EIP-170, initializes X and Google against the real artifacts.
  • COVERED and vendor-artifacts.sh list both verifiers with RelationsLib and ZKTranscriptLib.
  • circuits::deploy_honk_verifier deploys the libraries, links and deploys the verifier, returns its address; PlatformVerifier::circuit(), circuits::version(), bindings::circuits::HonkVerifier.
  • Anvil: Platform Verifiers pin real verifiers; Initializer's code hash equals the chain's; a test decodes ProofLengthWrongWithLogN and proves the circuits distinct.

Verified

  • forge test: 482 passed. forge lint -D notes, forge fmt --check clean.
  • cargo +nightly fmt --check, clippy -D warnings, cargo test --all: 14 unit + 6 anvil pass; cargo doc -D warnings clean.
  • Clean clone: submodules, scripts/vendor-circuit-verifiers.sh, forge build, forge test (482), scripts/vendor-artifacts.sh (18 artifacts).

Not verified / known issues

  • @libid/contracts (TS) lists no verifier ABI; out of scope.
  • Libraries deploy per verifier, not shared: three transactions per circuit.

bb belongs to libid-circuits, which now ships each circuit's Solidity
verifier beside its vk. The pin is committed digests, never a manifest
that came down with the download; forge fmt is the one change to what
shipped, and CI's generated-tables job regenerates and diffs so the
committed bytes stay checkable. The linter skips bb's output, nothing
else does.

Assisted-by: Claude Fable 5.1
Signed-off-by: xgreenx <xgreenx9999@gmail.com>
The two verifiers are the first covered contracts that link a library,
so COVERED, vendor-artifacts.sh and the linked_bytecode docs now say so,
and circuits::deploy_honk_verifier is the one call that deploys
RelationsLib and ZKTranscriptLib, links them and returns the verifier's
address. The circuits pin rides into the artifacts so a consumer can
name a deploy after the release its verifier came from.

Assisted-by: Claude Fable 5.1
Signed-off-by: xgreenx <xgreenx9999@gmail.com>
… anvil

The stand-in is gone: each Platform Verifier initializes against its
circuit's verifier, the initializer's code hash is the chain's, and a
wrong-length proof reads logN back so the two circuits are proven
distinct, which is the check that catches a mixed-up vk.

Assisted-by: Claude Fable 5.1
Signed-off-by: xgreenx <xgreenx9999@gmail.com>
@xgreenx
xgreenx changed the base branch from feat/platform-verifier-coverage to main September 14, 2026 18:10
The two .sol files are libid-circuits' release asset; circuits.json is
the pin. Committing them made this repo a second copy of what that
release already publishes, guarded by a --check that only existed
because the copies did. Now the forge-build action runs the vendor
script before every build, test, dry-run and publish, and each download
is held to the pinned sha256 — the guarantee the copies stood in for.
Locally: scripts/vendor-circuit-verifiers.sh before the first forge build.

Assisted-by: Claude Fable 5.1
Signed-off-by: xgreenx <xgreenx9999@gmail.com>
@xgreenx
xgreenx merged commit 65175cc into main Sep 14, 2026
11 checks passed
@xgreenx xgreenx mentioned this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant