Repository navigation
Conversation
… 53 (Step 11) Mainnet runs spec 153 (chain v1.0.2-Qm) with 7 leaves per private batch and 53 private batches per public batch. The wired capstones only existed at sizes 2 and 4. - Vendor the n = 7 and n_inner = 53 traces and generate their decode and bridge modules: private_batch_end_to_end_wired_n7 and public_batch_end_to_end_wired_n53, on the recursion tree PublicWrapper53 over Wrapper7 over the leaf. Both are in the axiom gate. - Exporter: one list of recorded sizes, recursion limits that scale with the circuit, facts cited by name instead of assumption, and a public bridge split into one lemma per inner batch. - Pin wormholeSpec at qp-zk-circuits 7c77311, which records the traces. - CI: run the two formal jobs on the 32 GB runner with a 60-minute limit.
n13
left a comment
There was a problem hiding this comment.
Verdict: Approve
Reviewer: GPT-6.1 Sol
Reviewed head 8b2ac4436b88d4a5e1c4022e71867753d4645716 against base e0b7637f00d08995d5037aa1da490b0f26edbdf5. No blocking findings.
The public bridge split preserves dummy masking, first-real reference selection, consistency checks, and forwarding order. The new tree uses PublicWrapper53 over Wrapper7 over LeafCircuit; the existing size-2/4 theorem statements remain unchanged. The axiom gate includes both new capstones, Wrapper7.accepted_sound, and both new wrapper soundness theorems.
Validation in an isolated detached worktree:
timeout 60 cargo +nightly test --locked --offline -p qp-plonky2-constraint-exporter: 41 passed.- Strict vendored-trace checks: 3 passed, covering all seven traces against files extracted directly from pinned dependency commit
7c7731111d91b5d991c723030e388814792c2ad4. - Ran
export-constraints; all generated files reproduced with no diff. - Rust formatting,
git diff --check, and the formal-source placeholder scan passed.
Validation limits: Lean/Lake are unavailable locally, so I did not independently compile the proofs or execute the axiom gate. GitHub's Linux/macOS build-and-test, generation, format, documentation, and security checks passed; both formal Lean jobs remain in progress at review submission.
Keep the documented merge prerequisite: after qp-zk-circuits 0xPolygonZero#209 is squash-merged, update the dependency pin to its merge commit before merging this PR.
Why
Mainnet runs runtime spec 153 (chain
v1.0.2-Qm), with theqp-wormhole4.3.0 circuits at 7 leaves per private batch and 53 private batches per public batch. The wired capstones only existed at sizes 2 and 4, and each size is a different circuit, so the deployed ones were not covered.mainhas since moved to the proof-of-burn leaf, which is not deployed.This PR proves the two wrappers at the deployed sizes. The traces and the tie to the on-chain wasm are in Quantus-Network/qp-zk-circuits#209.
Base branch
n13/rt153-baseise0b7637f(#114), the last commit before the leaf redesign. This is not meant to be merged intomain.Result
Plonky2Bridge.private_batch_end_to_end_wired_n7Plonky2Bridge.public_batch_end_to_end_wired_n53, on the recursion treePublicWrapper53.treeoverWrapper7.treeoverLeafCircuit.treeBoth depend on the standard Lean axioms plus
Plonky2Bridge.proof_sound, the same single trusted axiom as before.Wrapper7.soundandPublicWrapper53.sounduse standard axioms only. All five are in the CI axiom gate. Sizes 2 and 4 stay as fast regression checks.Where to look
The diff is 450k lines, almost all generated. The hand-written part is about 700 lines:
constraint-exporter/src/public_wrapper.rsconstraint-exporter/src/private_wrapper.rsconstsreused from the decode module, heartbeat budget that grows withn³.constraint-exporter/src/gadget.rsrec_depth_option:maxRecDepthscaled with the longest list literal, only above 256 elements.constraint-exporter/src/{lib,main,trace}.rsPRIVATE_WRAPPER_SIZESandPUBLIC_WRAPPER_SIZES.formal/Plonky2Bridge/PublicBatch.leanflatten_eq_of_forall₂.formal/Plonky2Bridge/{PrivateWrapper,PublicWrapper}.lean,formal/Plonky2Spec.lean,formal/ci/AxiomsCheck.leanformal/PLAN.md.github/workflows/ci.ymlGenerated, and reproducible with
cargo run -p qp-plonky2-constraint-exporter --bin export-constraints(CI fails if they are stale):Plonky2Spec/Generated/{PrivateBatchWrapper7,PublicBatchWrapper53}.lean,Plonky2Bridge/Generated/{Wrapper7,PublicWrapper53}.lean.Plonky2Bridge/Generated/{Wrapper2,Wrapper4,PublicWrapper2,PublicWrapper4}.lean. The size-2 and size-4 decode modules are byte-identical.constraint-exporter/traces/*_n7.jsonand*_n53.jsonare copies of the files in qp-zk-circuits#209; the strict trace check compares them with the pinned package.What scaling needed
The shape readers accepted both traces unchanged, including 7, the first odd leaf count. The Lean side did not scale as it was:
PublicWrapper{N}.soundwas one proof that projected every decode fact into its context. At 53 inners that is about 7,000 hypotheses; it held 16 GB without finishing. The generator now takes each fact from its own decode lemma and emits one lemma per inner (dummy{i},consistent{i},slots{i},nulls{i}) and per reference value.soundassembles them.assumptionsearched the whole context for every fact. The generator now names each one.rfland unfolding the circuit recurse once per list element, somaxRecDepthscales with the circuit. Files under the threshold are unchanged.Fin nmatches. Lean rejects literal arms onFin nas non-exhaustive fromn = 16, so the generator emits⟨k, _⟩arms and an explicit out-of-range arm.CI
The size-53 decode module peaks at 16.9 GB, which does not fit a standard 16 GB runner. The two formal jobs move to the org's 32 GB
Large-Linux-x64-Runnerwith a 60-minute limit (was 25 and 30).Building
PublicBatchWrapper53prints onePANICline fromLean.LibrarySuggestions.SymbolFrequency. That is Lean's export pass for library suggestions hitting its fixed heartbeat limit on a module this size. It does not fail the build and does not touch the proofs.Testing
Locally, on this commit:
lake build Plonky2Spec Plonky2Bridge: 1255 jobs, nosorry.leancheckeron the two new decode modules: exit 0.cargo test -p qp-plonky2-constraint-exporter, including the strict vendored-trace check against the pinned package.cargo +nightly fmt --all -- --check.Build cost on 18 cores:
PrivateBatchWrapper7268 s,PublicBatchWrapper53502 s,Wrapper7181 s,PublicWrapper53143 s.Merge order
wormholeSpecis pinned at7c77311, the head of qp-zk-circuits#209. After that PR is squash-merged, the pin has to move to the merge commit before this one merges.