fix(prover): deterministic blob layout tag + continuation tamper coverage#851
Open
diegokingston wants to merge 3 commits into
Open
fix(prover): deterministic blob layout tag + continuation tamper coverage#851diegokingston wants to merge 3 commits into
diegokingston wants to merge 3 commits into
Conversation
…e input for continuation verify Mirrors #782's monolithic mechanism for the continuation path: a caller (the recursion guest) can supply the DECODE preprocessed root and each touched data page's genesis root instead of the verifier recomputing them from the ELF, skipping the in-VM FFT + Merkle build. Supplied roots are used verbatim; the binding shifts to the consumer's recompute-and-compare of the folded identity, exactly like the monolithic path. verify_global's genesis-page classification (ELF-backed vs zero-init) is derived from ELF segment address ranges instead of materializing a full byte-level image when roots are supplied, since the real bytes are never read once a root covers that page. Page lookups are keyed by page number (page_base >> log2(page_size)) rather than the raw page-aligned address, since the low bits are always zero. verify_continuation keeps its existing signature (trustless recompute); verify_continuation_with_roots is the new supplied-roots entry point, and continuation_precomputed_commitments lets a caller derive the roots to supply for a given bundle.
Adapts continuation verification to the same in-place rkyv pattern verify_recursion_blob already uses for the monolithic path (#769): verify_epoch/verify_global take a StarkProofView slice (owned or archived) instead of an owned MultiProof/EpochProof, so the new guest entry point (verify_continuation_and_attest_blob, via verify_continuation_archived) reads every per-epoch/global STARK proof straight out of the archive. Only small per-epoch metadata (table counts, reg_fini, l2g_root, public output) is materialized - the (large) per-epoch/global proof data is never copied into an owned MultiProof just to verify it. Adds the continuation guest's wire format (ContinuationGuestInput, encode_continuation_guest_input) mirroring GuestInput's magic-prefixed rkyv layout, and verify_continuation_and_attest[_blob] mirroring verify_and_attest_blob's program_id fold. replay_transcript_phase_a/compute_expected_commit_bus_balance (owned) lose their last production caller to this refactor; deleted rather than kept as compatibility wrappers now that every caller (production and test) goes through the _view variants already introduced by #769.
…ion tamper coverage Stacked on #845, addressing review findings: - Reuse the first reserved prefix byte as a layout kind (RECURSION_INPUT_KIND_MONOLITHIC=0, KIND_CONTINUATION=1). Both blob verifiers now check it at the prefix stage via the new recursion_archive_bytes_for_kind, so a blob of the wrong layout is rejected deterministically instead of relying on the rkyv bytecheck happening to fail on a differently-shaped archive. Backwards compatible: pre-kind blobs have zeros there (= KIND_MONOLITHIC). - New tests: test_recursion_continuation_rejects_corrupted_commitment (continuation analog of the monolithic corrupted-commitment guard) and test_recursion_blob_kind_byte_discriminates_layouts (both directions + kind-byte tamper). - KEEP IN SYNC notes between verify_continuation_with_roots and verify_continuation_archived; note that owned verify_continuation_and_attest is the host-side symmetric counterpart. - docs/continuations_design.md: update the deleted compute_expected_commit_bus_balance reference to the _view variant.
Oppen
force-pushed
the
perf/continuation-rkyv-zero-copy
branch
3 times, most recently
from
July 17, 2026 22:17
9e9f790 to
995f971
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.
Summary
Stacked on #845 — fixes for the findings from its review:
RECURSION_INPUT_KIND_MONOLITHIC = 0,RECURSION_INPUT_KIND_CONTINUATION = 1). Both blob verifiers check it at the prefix stage via the newrecursion_archive_bytes_for_kind, so a blob of the wrong layout is rejected deterministically instead of relying on the rkyv bytecheck happening to fail on a differently-shaped archive. Backwards compatible: blobs encoded before this change have zeros there, which is exactlyKIND_MONOLITHIC.test_recursion_continuation_rejects_corrupted_commitment— the continuation analog of the monolithic corrupted-commitment guard: honest bundle + corrupted DECODE root →Ok(None).test_recursion_blob_kind_byte_discriminates_layouts— continuation blob rejected by the monolithic verifier and vice versa at the prefix stage, plus kind-byte tamper rejection.verify_continuation_with_rootsandverify_continuation_archived(the two must apply the same validation in the same order), and a doc note that ownedverify_continuation_and_attestis the host-side symmetric counterpart of the_blobentry point.docs/continuations_design.mdnow referencescompute_expected_commit_bus_balance_view(the owned variant was deleted in perf(prover): verify continuation proofs in place via rkyv #845).Test plan
cargo test -p lambda-vm-prover --lib recursion_smoke— 5 passed, 0 failed (includes both new tests; pre-existing monolithic + continuation blob tests unaffected)cargo clippy -p lambda-vm-prover --all-targets -- -D warnings— clean