Repository navigation
feat: release 0.3.1 with verifying key setup metadata - #36
Merged
Merged
Conversation
ananas-block
force-pushed
the
jorrit/vk-setup-metadata
branch
from
October 27, 2026 22:24
70a9380 to
8b6121f
Compare
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.
Release
groth16-solana0.3.1 with the setup-metadata APIs from a0c5c2b, rebased onto master with Arkworks 0.6. Version 0.3.0 does not contain these APIs.spr-programremains Git-only.Summary
Both vk generators (
vk::circom,vk::gnark) now require aSetupKind(InsecureTest|Production) and aProvingKeySource(File(path)|Sha256(digest)), and write next to the vk const:<NAME>_PROVING_KEY_SHA256: SHA-256 of the proving key file (streamed). A prover compares it againstvk::setup::proving_key_sha256(path)of the key it is about to load, so a stale or mismatched key fails before proving.<NAME>_INSECURE_TEST_SETUP:truefor seeded or untrusted setups (whoever knows the setup randomness can make the vk accept a proof for any public inputs; honest proofs still need a witness). Such a vk also gets a warning header and acompile_error!unless the including crate enables aninsecure-test-setupfeature, so a test vk cannot end up in a deployable program by accident.<NAME>_SETUP_TXT: both values as an exported, delimited string (thesecurity.txttechnique). It is present in the SBF binary, so deploy tooling can read it withvk::setup::find_setup_txtsafter deployment, or by hand:The marker is set by whoever builds the program; it catches mistakes, not a malicious deployer.
The export name includes a content hash, so several vks sharing a const name in different modules do not collide at link time.
Declaring
Productionfor a vk withdelta_g2 == gamma_g2(snarkjs / gnark mpcsetup before any phase-2 contribution) is an error; test setups with that shape still generate.delta_equal_gamma_vk_accepts_forged_proofshows why: the crate's own unit-test vk has delta == gamma, andA = α, B = β, C = -L(x)verifies against it for arbitrary inputs.Breaking
generate_vk_file,parse_vk_json_to_rust_stringandgenerate_bsb22_vk_filetake the new arguments. New error variants:VkParseError::ForgeableProductionVk,Groth16Error::ForgeableProductionVk(code 22).Test crates
{label}_pk.bin(covered byTestGenerateIsDeterministic).tests/programandtests/rust-vkdeclareInsecureTestand enableinsecure-test-setupby default;gnark-vk/circom-vkreach them only as dev-dependencies (the program's normal dependency carries onlybsb22).tests/program/tests/setup_txt.rsreads the 8 markers back from the built.soand checks each pk hash.Test plan
cargo test --workspace(incl. FFI differential tests)cargo test -p groth16-solana --features "bsb22 gnark-vk circom-vk"(57 unit + 6 codegen)cargo build-sbf+cargo test -p bsb22-integration-program --test failing --test setup_txtcargo test -p rust-vk-integration-testgo test ./...intests/gnark-ffi/gnark-fixture-D warnings, feature matrix,check-nostd,cargo rdme --checkBENCHMARKS.mdunchanged (no CU cost)Follow-ups (zolana)
setup_cli.rsprepends withSetupKind::InsecureTest; enableinsecure-test-setuponly in the example programs.LoadKeyscomparesha256(pk.bin)against the baked const.vk::setup::find_setup_txtson the.soand fails on an insecure marker or on no markers at all.*_SETUP_TXTliving in a dependency crate (zolana keeps vks in interface crates) survives into the program.so. Verified here only for vk files included in the program crate itself.