Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bench_vs/lambda/deserialize-only/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions bench_vs/lambda/deserialize-only/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
//! Deserialize-only counterpart to the recursion guest.
//!
//! Reads the same private-input blob as `recursion-bench`, postcard-decodes
//! `(VmProof, Vec<u8>, ProofOptions)`, then commits and halts — without ever
//! calling `verify_with_options`. The cycle delta between this guest and
//! `recursion-bench` is the actual cost of the STARK verifier inside the VM.
//!
//! Mirrors the recursion guest's std setup (build-std + `lambda_vm_syscalls`)
//! so the two differ only in the verify call.
//! `(VmProof, Vec<u8>, ProofOptions, VerifyingKey)`, then commits and halts.
//! The cycle delta between this guest and `recursion-bench` is the cost of the
//! STARK verifier inside the VM.

#![no_main]

use lambda_vm_prover::{ProofOptions, VmProof};
use lambda_vm_prover::{ProofOptions, VmProof, VmVerifyingKey};

#[unsafe(export_name = "main")]
pub fn main() -> ! {
Expand All @@ -22,11 +19,11 @@ pub fn main() -> ! {
}));

let blob = lambda_vm_syscalls::syscalls::get_private_input();
let decoded: (VmProof, Vec<u8>, ProofOptions) =
postcard::from_bytes(&blob).expect("failed to deserialize recursion input");
let decoded: (VmProof, Vec<u8>, ProofOptions, VmVerifyingKey) =
postcard::from_bytes(&blob).expect("failed to deserialize");

// Tie the committed byte to the decoded value so LLVM can't elide the decode.
let marker = decoded.2.blowup_factor ^ *decoded.1.first().unwrap_or(&0);
let marker = decoded.2.blowup_factor ^ *decoded.1.first().unwrap_or(&0) ^ decoded.3.bitwise[0];
lambda_vm_syscalls::syscalls::commit(&[marker]);
lambda_vm_syscalls::syscalls::sys_halt();
}
82 changes: 42 additions & 40 deletions bench_vs/lambda/recursion/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions bench_vs/lambda/recursion/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#![no_main]

use lambda_vm_prover::{ProofOptions, VmProof};
use lambda_vm_prover::{ProofOptions, VmProof, VmVerifyingKey};

#[unsafe(export_name = "main")]
pub fn main() -> ! {
Expand All @@ -29,11 +29,18 @@ pub fn main() -> ! {
}));

let blob = lambda_vm_syscalls::syscalls::get_private_input();
let (vm_proof, inner_elf, options): (VmProof, Vec<u8>, ProofOptions) =
let (vm_proof, inner_elf, options, vkey): (VmProof, Vec<u8>, ProofOptions, VmVerifyingKey) =
postcard::from_bytes(&blob).expect("failed to deserialize recursion input");

let ok = lambda_vm_prover::verify_with_options(&vm_proof, &inner_elf, &options, None, None)
.expect("verify errored");
let ok = lambda_vm_prover::verify_with_options_with_vkey(
&vm_proof,
&inner_elf,
&options,
None,
None,
Some(&vkey),
)
.expect("verify errored");
assert!(ok, "inner proof failed verification");

lambda_vm_syscalls::syscalls::commit(&[1u8]);
Expand Down
1 change: 1 addition & 0 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ rayon = { version = "1.8.0", optional = true }
sysinfo = { version = "0.31", default-features = false, features = ["system"] }
log = "0.4"
sha3 = { version = "0.10.8", default-features = false }
postcard = { version = "1.0", default-features = false, features = ["alloc"] }

[dev-dependencies]
env_logger = "*"
Expand Down
Loading
Loading