fix(akita)!: eliminate redundant opening framing and rehashing - #1842
Open
quangvdao wants to merge 5 commits into
Open
fix(akita)!: eliminate redundant opening framing and rehashing#1842quangvdao wants to merge 5 commits into
quangvdao wants to merge 5 commits into
Conversation
Contributor
📏 PR diffNote Actual code changed: 180 lines🟢 +54 added 🔴 −126 removed Tests, docs, fixtures, and helper scripts excluded.
Every changed line is classified once. |
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.
Summary
This PR makes Jolt's Akita opening envelope minimal and gives transcript binding and proof decoding one canonical owner each.
It now:
The Akita backend proof remains fully verified. This removes only derivable wire metadata and challenge-dead outer transcript work; the nested Akita transcript still binds the concrete instance and every proof message required by its Fiat–Shamir schedule.
Diff metadata
959686da3d72e0cb69f8102eb8e2f30af44034ff(mainmerge base)1efb96ce64079277f83fc9f6fefd236922e99417Motivation
Before this cut,
AkitaBatchProofwrapped Akita's already-canonical proof body in three additional prover-controlled values:All three were redundant.
The old representation therefore spent proof bytes on verifier-derivable data and let the proof provide metadata that controlled backend decoding before the verifier compared it with its own expected shape.
There was a second, independent redundancy at the transcript boundary. After Jolt derived the bridge—the final outer challenge—the adapter appended the complete serialized Akita opening back into the outer Jolt transcript. No later Jolt challenge consumed that state. Akita separately decoded the body and absorbed its semantic proof messages into the nested Akita transcript, where those messages actually determine challenges and acceptance. Rehashing the raw body in the outer transcript could not affect verification, but it imposed avoidable native work and would be especially expensive for a recursive or circuit transcript replay.
Architecture
flowchart LR A[Jolt verifier setup and opening statement] --> B[Jolt transcript] B -->|one canonical Fp128 bridge| C[Akita session label] C --> D[Akita instance and semantic proof transcript] D --> E[Akita verification] F[Wire: 32-byte row digest and backend body] --> G[Resolve trusted schedule] G --> H[Derive canonical shape and decode budget] H --> DThe outer-to-inner handoff is one-way for this terminal opening stage:
Fp128bridge challenge.If a future protocol adds an outer challenge after Akita verification, that protocol will need an explicit compact inner-transcript receipt. Rehashing the transport encoding is not retained speculatively for that currently nonexistent continuation.
Change-surface overview
[u8; 32]schedule identity plus one backendVec<u8>OpeningScheduleSelectionLean proof envelope
AkitaBatchProofnow contains exactly:The fixed array makes malformed selection lengths unrepresentable after deserialization.
selection()reconstructs the publicOpeningScheduleSelectiondirectly from the digest, whilebackend_proof_body_size()andunframed_payload_size()report the remaining wire components without mirroring the backend shape.For the forced-K=256 release sample measured at
fdc9e1976—whose wire representation is unchanged by the later transcript-only commits—the resulting encoding was:Vec<u8>boundary: 5 bytes.Thus
70,302 + 32 + 5 = 70,339: the Akita opening contains no copied challenge or proof-shape blob. Removing the final five serializer bytes would require changing Jolt's enclosing proof codec and is out of scope.Verifier-owned shape and bounded decoding
The verifier now owns the entire decode shape:
OpeningClaimsLayout;AkitaBatchedProofShape;The old 16 KiB cap on a prover-controlled shape blob disappears because that blob no longer exists. Commitment coefficient counts and serialized commitment lengths remain checked before shape-backed allocations. Malformed inputs continue to return
OpeningsErrorrather than reaching unchecked allocation or indexing paths.Cross-protocol transcript binding
The bridge remains one Jolt
challenge_scalar()sampled at the same point in both grouped and single-group opening flows. Its canonical 16-byte representation contains the full entropy of the approximately 128-bit Akita base-field element; a 32-byte container would not add entropy.The important change is where those bytes live. Akita replaces its sponge state when it binds the concrete instance but preserves its session label, so the adapter constructs:
This makes the nested Akita proof depend on everything the outer Jolt transcript observed before the bridge without transporting a proof-controlled copy.
The complete
AppendToTranscript for AkitaBatchProofimplementation and all four prover/verifier append calls are removed. The Fiat–Shamir inventory records:AkitaBatchProof; andThe backend body is still decoded and verified by Akita. Corrupting either the schedule identity or the backend body continues to reject; acceptance never depended on the challenge-dead outer append.
Security and verifier safety
Breaking changes
This intentionally changes the serialized Akita opening representation and nested transcript initialization.
Previously serialized Akita-mode Jolt proofs do not decode or verify under this representation. The removed fields are not accepted through aliases, compatibility wrappers, or an alternate decoder.
The following remain supported:
The native Akita backend proof encoding itself is unchanged.
Commit map
fdc9e1976— replace the redundant envelope, derive the canonical proof shape verifier-side, and bind the bridge through the Akita session label;6bd109b9f— refresh the reviewed Fiat–Shamir challenge and absorption inventory;b45c1ec79— remove challenge-dead outer absorption of the terminal Akita opening; andef77d826a— document the exact terminal challenge boundary; and1efb96ce6— merge currentmain(959686da3) while preserving the seven-file PR surface.Validation
Completed locally for the behavior change at
b45c1ec797037da1ac76f4fe85c143845627c34c:cargo nextest run --release -p jolt-akita --cargo-quiet— 54 passed, 1 skipped;cargo nextest run --cargo-profile ci -p jolt-prover --features akita,prover-fixtures --test akita_e2e --cargo-quiet— 6 passed;Repeated on
ef77d826a05fc4e960f6e2276652966e09b1f2a6after the documentation-only follow-up:cargo nextest run -p jolt-verifier --test fs_obligations --features fs-audit --cargo-quiet— 1 passed;cargo clippy -p jolt-akita --all-targets -- -D warnings;cargo fmt --check;git diff --check.After merging current
main, final head1efb96ce64079277f83fc9f6fefd236922e99417preserves the same seven-file, 72-insertion/239-deletion PR diff. The Fiat–Shamir obligation test, Akita Clippy target, formatting check, and diff check were repeated successfully on that exact head.Fresh GitHub checks for
1efb96ce6are running. No current-head failure was observed when this description was published; prior-head green results are not presented as final-head CI evidence.Remaining work and deliberate non-goals
Reviewer map
Suggested review order:
crates/jolt-akita/src/adapters.rs— final proof envelope and the outer-to-inner bridge owner;crates/jolt-akita/src/native_batching.rs— grouped and single-group prover/verifier transcript flow;crates/jolt-akita/src/shape_guard.rs— trusted shape derivation, decode budget, and malformed-input boundary;crates/jolt-verifier/tests/fs_inventory/— exact challenge preservation and deleted terminal absorptions;crates/jolt-akita/tests/pathologies.rs— corrupted payload and forged commitment-metadata rejection; andcrates/jolt-prover/tests/akita_e2e.rs— exact lean-wire assertion and end-to-end schedule tampering.