Repository navigation
Conversation
📏 PR diffNote Actual code changed: 261 lines🟢 +213 added 🔴 −48 removed Tests, docs, fixtures, and helper scripts excluded.
Every changed line is classified once. |
PR SummaryHigh Risk Overview Adds Breaking: verifier setup encoding changes—regenerate bundles and pinned digests; legacy bundles are not supported. Proof encoding and transcript binding are unchanged. Book docs describe bundle authentication and the new preparation flow. Reviewed by Cursor Bugbot for commit 136b5e2. Bugbot is set up for automated code reviews on this repo. Configure here. |
qun-huang
left a comment
There was a problem hiding this comment.
Reviewed all 6 changed files and the exact Akita dependency, including offline registry transport, required-slot checks, canonical matrix sizing, eager/lazy preparation and transcript identity. No runtime correctness defects or structural quality blockers were found. All 12 affected nextest tests passed; 30 other unit tests were not selected. The current 66 CI checks are successful or accepted/skipped. One nonblocking stale compatibility comment is noted inline. Authenticated pinned bundle installation remains the required caller contract.
| /// | ||
| /// The exact validated schedule artifacts are serialized; derived scheme | ||
| /// objects, prepared keys, and caches are rebuilt lazily after transport. | ||
| /// The exact catalogs and setup-prefix commitments are serialized. The bundle |
There was a problem hiding this comment.
[P3, nonblocking] Remove the stale legacy verifier-format promise
The new offline catalog-plus-prefix format and the book correctly require regenerated bundles, but the public AkitaSetupParams rustdoc at lines 362–363 still says the legacy Single verifier encoding is preserved. That now gives callers contradictory migration guidance. Delete that final sentence, leaving /// bincode backward compatibility. at the end of the paragraph. The same sweep found stale shape-only reconstruction wording in tests/scheme_surface.rs:81 and its assertion message at line 118; those should describe loading offline commitments and deriving the public matrix prefix.
This is a documentation cleanup; both source passes found no additional runtime or soundness defect.
bochunbai
left a comment
There was a problem hiding this comment.
Self-review
Verdict: merge after fixes. This change fixes zero-consensus#286. No blocker or major issue survived independent verification; five minor items should land before the bundle bytes are pinned at re-genesis.
Scope: commit 02098a7d3 (Akita 252abb89), this PR's content before the rebase; line numbers refer to it. On the rebased head 136b5e268 (Akita d98400c5), only byte identity across CPU backends was re-checked.
Full write-up with evidence, measurements and a status column per finding: https://claude.ai/artifact/Fi3vSon1JutMtBPiL9n5H2
What it achieves (measured)
| before | with patch | |
|---|---|---|
| Verifier key kept per setup, 2^25–2^30 | 1–8 GiB | 128 MiB |
| First key build at 2^28 | 641 s, 9.7 GiB peak | 2.6 s, 139 MiB |
| All 11 setups warm, 2^20–2^30 | ~21.6 GiB | ~1.1 GiB |
Proof bytes and transcripts are byte-identical to base. An exact-size key verifies and a key one element shorter fails without a panic, up to a K256 nv39 chain with two offloaded levels. The new 2^26 cap has 8–16× headroom at production shapes.
Fix before merge
- Test the narrowed key (
crates/jolt-akita/src/scheme.rs:1093-1199). Every serde round-trip test runs at shapes where the narrowed key equals the prover's, so a mutant that sizes the key fromSetupRequirements::matrix_capacity(undoing the fix) passes the suite. Add a K16 nv31 real-proof test through a reloaded setup with exact length asserts, plus a grouped K16 nv16 test. - Document the trust model (
book/src/how/akita.md:54-63). The shipped commitments are trusted setup material: neither the preprocessing digest nor the transcript binds them, and a well-formed wrong registry was shown to let one commitment open to two values. Require an independent regenerate-and-compare of every setup section before pinning; generation is deterministic. - Run the validator load path at generation (
scheme.rs:625). Callprepare_verifier()on a cache-less clone insideAkitaScheme::setup(≤145 MiB, 1–2 s), so an unloadable section fails at bundle build instead of after genesis. - Validate at decode (
verifier_artifact.rs:18-24, 63-104). Version, registry decode and seed are only checked lazily inbuild(), and libeacon would cache the resulting error as "proof invalid". Check them in a serdetry_from. - Tighten the new tests (
scheme.rs:1107-1125, 1188-1198). The dense test compares two empty registries;.skip(1)empties a one-slot registry; the decode test only uses the empty registry; nothing verifies from a cold cache.
13 nits
- Capacity covers rows Jolt never selects, so keys are 1.33–4× larger than needed; the book overstates the narrowing (
verifier_artifact.rs:80-99). - Setups that compare equal hold different keys: full prover matrix in-process, narrowed matrix once loaded (
scheme.rs:586-625). - One-hot setups with
max_num_vars < log2 Kfail with an unclear "missing offline one-hot verifier"; no real caller reaches this (adapters.rs:609-612). build()keeps the whole decoded registry, including extra or non-canonically ordered slots (verifier_artifact.rs:73-79, 116).- The capacity loop duplicates Akita's admitted-row logic; the slot check is vacuous for dense (
verifier_artifact.rs:70-99). version: u32is an unnamed literal 1, checked only at key build (verifier_artifact.rs:21, 29, 63).- Akita errors map to
VerificationFailed, so an undersized key looks like a forged proof (native_batching.rs:459, 923). - Concurrent first callers each build the key, now ≤128 MiB and ~1 s each (
adapters.rs:679-683). - No test reaches the version check, the 2^26 cap, the no-rows branch, or a reloaded
Bothsetup's one-hot key (verifier_artifact.rs:63-67, 100-104). - Stale or inaccurate docs: the key also depends on commitments the transcript does not absorb; "called only by offline setup"; two meanings of "bundle" (
adapters.rs:757-760and others). - Two-phase construction: artifacts are born without commitments and completed by a
&mut, fallible cache primer;pub(crate)fields (adapters.rs:589-618). - Naming drift:
schedule_artifactsholds commitments, "artifact" has three meanings, the seed is sampled twice (adapters.rs:517). - Moving to this fork means every hard-coded
a16z/joltreference downstream must change together.
Downstream, for adoption
- zero-consensus: call
prepare_verifier()per setup at startup and map errors to unavailable; regeneratejolt-advice-v1; rewrite the memory model, which would still log ~69 GiB. - zero-evm-zone: make
check-bundledecode and prepare every setup section; add an independent regenerate-and-compare; compare one IFMA-host bundle with the CI build. - zero-deploy: add the regenerate-and-compare step to the re-genesis runbook; re-size validators.
- zero-zone-core: pin bump.
|
i think we should have this at verifier binary not necessary part of jolt protocol cc @qun-huang @bochunbai |
bochunbai
left a comment
There was a problem hiding this comment.
Self-review, rebased head
Verdict: one blocker, on the bundle encoding rather than correctness, plus five nits. Scope: head 136b5e268 (Akita d98400c5). The earlier review of 02098a7d3 found no blocker in correctness or safety; this one adds the encoding question.
Blocker: collapse AkitaVerifierArtifacts to Dense | OneHot | Both in this PR (crates/jolt-akita/src/adapters.rs:605-625)
a16z#1976 added OneHotChunked and BothChunked beside OneHot and Both so that Single-profile bundles kept their bincode bytes; adapters.rs:362-363 and schedules/README.md:38 say so. This PR changes those bytes anyway: every variant now wraps AkitaVerifierBackendArtifact instead of Vec<u8>, so every bundle is regenerated at re-genesis. Collapsing now costs nothing extra. Collapsing later means a second encoding break, regenerating every bundle again (zero-evm-zone apps/proving/host/src/bundle.rs), and a new set of pinned digests.
The split also gives one setup two encodings: nothing rejects OneHotChunked { profile: Single, .. }, which loads exactly like OneHot. Carry the chunk profile as a plain field, as AkitaSetupParams already does. The five-arm matches in adapters.rs:627-654, adapters.rs:697-740 and scheme.rs:484-505 then shrink to three.
Nits
adapters.rs:362-363(@qun-huang's inline P3) andcrates/jolt-akita/schedules/README.md:38still promise that the legacySingleencoding is preserved. The collapse removes what they describe.adapters.rsgrows from 1,518 to 1,577 lines. Move the artifact enum and the verifier-loading methods (prepare_verifier,prime_backend_cache,dense_verifier,one_hot_verifier) intoverifier_artifact.rs.
The last three restate items from the earlier review at their locations on this head, each with a concrete fix:
- Artifacts are built half-empty (
verifier_artifact.rs:27-42) and completed later byprime_backend_cache(&mut self)(scheme.rs:509-572,adapters.rs:697-740). Build each artifact with its key instead. build(verifier_artifact.rs:57-111) re-implements Akita's setup sizing as a hand-written fold (:80-95). Use an iteratormax()now, and an Akita-owned helper at the next Akita bump.versionis always 1 and is checked only inbuild(verifier_artifact.rs:21, 29, 63). Drop it, or check it at decode (earlier review, fix 4).
|
On hold: no further review needed. Omid is reworking this fix across akita and jolt together, which replaces this jolt-only workaround. The PR stays open for reference only. Reviewers and review agents can stop monitoring this PR: don't re-review it, post findings or approve it. The open findings here (the |
Summary
Loading a serialized Akita verifier setup currently calls
setup_prover, rebuilding setup-prefix commitments and allocating prover state. Carry the commitments already produced by offline setup in the verifier bundle, and load them without constructing a prover setup.Changes
AkitaVerifierSetup::prepare_verifier()for startup preparation; lazy first verification uses the same loader.Testing
RAYON_NUM_THREADS=4 CARGO_BUILD_JOBS=6 cargo nextest run --locked -p jolt-akita --lib -E 'test(scheme::tests) | test(verifier_artifact::tests)' --test-threads 2 --no-fail-fast— 12 passed.CARGO_BUILD_JOBS=6 cargo clippy --locked -p jolt-akita --all-targets -- -D warningscargo fmt --all -- --checkpython3 scripts/check_style_invariants.py --base layerzero/mainCoverage includes verification after binary transport across one-hot profiles, dense and recursive grouped setup transport, missing commitments, malformed registry bytes, and the existing transcript digest fixture.
Manual EVM-zone / VID / validator integration used local consumer adapters and aligned VID to Jolt's existing Akita revision
d98400c5; no Akita source patch was needed.2^20..=2^30(90,784,588 bytes).2^23, with a 95,855-byte proof.ModularJoltVerifierpaths in a fresh process.new_prover_setupcall; external schedule and VID cache paths remained absent throughout verification.make checkand the fullmake testtarget passed, including 1,756 workspace tests, 309 DA tests, and the debug malformed-proof check. Both standalone VID/Jolt interoperability tests and EVMmake examplepassed.The consumer adapters remain local and are not part of this PR. A live EVM-zone/consensus chain was not run: the full EVM service's
make check,make test, andmake buildremain blocked by zone-core's compatibility with newer consensus APIs. The actual proof exercises the2^23setup; this run does not establish proving at2^30or worst-case memory with every setup warm. The2^30limit is unchanged.Security Considerations
Callers must authenticate the containing bundle against a trusted pinned digest before preparing or using the verifier. Loading checks registry structure, the setup seed, and required commitment presence; it does not prove the stored commitments were honestly derived. Public matrix coefficients are derived locally from the fixed seed.
Breaking Changes
Verifier setup serialization changes. Regenerate verifier bundles from the same ELF and update their pinned digests; old bundles have no fallback. Proof encoding and transcript binding are unchanged.