Skip to content

Commit 0780443

Browse files
codyguntonclaude
andcommitted
refactor: drop the lambdavm cycle cap and resource test
No other prover caps execution cycles or tests the unsupported resource error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 6bd4aec commit 0780443

4 files changed

Lines changed: 6 additions & 32 deletions

File tree

‎crates/prover/lambdavm/src/error.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ pub enum Error {
1818
#[error("LambdaVM execution failed: {0}")]
1919
Execute(#[source] ExecutorError),
2020

21-
#[error("LambdaVM execution exceeded {0} cycles")]
22-
CycleLimitExceeded(u64),
23-
2421
#[error("LambdaVM cost estimation failed: {0}")]
2522
EstimateCost(#[source] lambda_vm_prover::Error),
2623

‎crates/prover/lambdavm/src/executor.rs‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ use lambda_vm_executor::{elf::Elf, vm::execution::Executor as VmExecutor};
1010

1111
use crate::error::Error;
1212

13-
/// Execution stops with an error beyond this many cycles, so a guest that never
14-
/// halts cannot hang the caller.
15-
pub(crate) const MAX_CYCLES: u64 = 1 << 32;
16-
17-
/// Cycles run between two checks of [`MAX_CYCLES`].
18-
const CHUNK_CYCLES: usize = 1 << 20;
19-
2013
/// An execution instance of a loaded program.
2114
pub(crate) struct Executor {
2215
program: Arc<Elf>,
@@ -48,14 +41,8 @@ pub(crate) fn run(program: &Elf, stdin: &[u8]) -> Result<(VmExecutor, u64), Erro
4841
let mut executor = VmExecutor::new(program, stdin.to_vec()).map_err(Error::Execute)?;
4942

5043
let mut cycles = 0;
51-
while let Some(logs) = executor
52-
.resume_with_limit(CHUNK_CYCLES)
53-
.map_err(Error::Execute)?
54-
{
44+
while let Some(logs) = executor.resume().map_err(Error::Execute)? {
5545
cycles += logs.len() as u64;
56-
if cycles > MAX_CYCLES {
57-
return Err(Error::CycleLimitExceeded(MAX_CYCLES));
58-
}
5946
}
6047

6148
Ok((executor, cycles))

‎crates/prover/lambdavm/src/lib.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
//! | `main_elements` | Field elements of the main traces of all tables |
3232
//! | `aux_elements` | Field elements of the auxiliary (LogUp) traces of all tables |
3333
//!
34-
//! Execution fails after 2^32 cycles. It runs in chunks, so its memory use does
35-
//! not grow with the cycle count, but the element counts and proving keep one
36-
//! log per cycle in memory, because `lambda-vm-prover` executes at once.
34+
//! Execution runs in chunks, so its memory use does not grow with the cycle
35+
//! count, but the element counts and proving keep one log per cycle in memory,
36+
//! because `lambda-vm-prover` executes at once.
3737
//!
3838
//! `peak_heap_bytes` spans from the `_end` symbol up to the highest non-zero
3939
//! byte below the top of the guest heap at `0xC0000000`, or is `None` when the

‎crates/prover/lambdavm/src/prover.rs‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ mod tests {
119119

120120
use ere_compiler_core::{Compiler, Elf};
121121
use ere_compiler_lambdavm::{LambdaVMRustRv64ima, LambdaVMRustRv64imaCustomized};
122-
use ere_prover_core::{CommonError, Input, ProverResource, codec::Encode, zkVMProver};
122+
use ere_prover_core::{Input, ProverResource, codec::Encode, zkVMProver};
123123
use ere_util_test::{
124124
codec::BincodeLegacy,
125125
host::{
@@ -129,7 +129,7 @@ mod tests {
129129
program::basic::BasicProgram,
130130
};
131131

132-
use crate::{error::Error, prover::LambdaVMProver};
132+
use crate::prover::LambdaVMProver;
133133

134134
fn basic_elf() -> Elf {
135135
static ELF: OnceLock<Elf> = OnceLock::new();
@@ -241,16 +241,6 @@ mod tests {
241241
run_zkvm_prove(&zkvm, &test_case);
242242
}
243243

244-
#[test]
245-
fn test_unsupported_prover_resource() {
246-
let elf = basic_elf();
247-
let err = LambdaVMProver::new(elf, ProverResource::Gpu).err().unwrap();
248-
assert!(matches!(
249-
err,
250-
Error::CommonError(CommonError::UnsupportedProverResourceKind { .. })
251-
));
252-
}
253-
254244
#[test]
255245
fn test_execute_switchable() {
256246
let mut zkvm = LambdaVMProver::new(basic_elf(), ProverResource::Cpu).unwrap();

0 commit comments

Comments
 (0)