Skip to content

Commit 8a84249

Browse files
committed
MIN_LOG_MEMORY_SIZE
1 parent cb8f9dc commit 8a84249

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

crates/lean_prover/src/verify_execution.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ pub fn verify_execution(
7272

7373
let public_memory = build_public_memory(public_input);
7474

75-
if log2_ceil_usize(private_memory_len + private_memory_len) > MAX_MEMORY_SIZE {
76-
return Err(ProofError::InvalidProof);
77-
}
78-
7975
let log_public_memory = log2_strict_usize(public_memory.len());
8076
let log_memory = log2_ceil_usize(public_memory.len() + private_memory_len);
8177
let log_n_p16 = log2_ceil_usize(n_poseidons_16);
8278
let log_n_p24 = log2_ceil_usize(n_poseidons_24);
8379

80+
if !(MIN_LOG_MEMORY_SIZE..=MAX_LOG_MEMORY_SIZE).contains(&log_memory) {
81+
return Err(ProofError::InvalidProof);
82+
}
83+
8484
let table_dot_products_log_n_rows = log2_ceil_usize(n_rows_table_dot_products);
8585
let dot_product_padding_len =
8686
n_rows_table_dot_products.next_power_of_two() - n_rows_table_dot_products;

crates/lean_vm/src/memory.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ use rayon::prelude::*;
55

66
use crate::*;
77

8-
pub const MAX_MEMORY_SIZE: usize = 1 << 29;
8+
pub const MIN_LOG_MEMORY_SIZE: usize = 16;
9+
pub const MAX_LOG_MEMORY_SIZE: usize = 29;
910

1011
// For now, we restrict ourselves to executions where memory usage < 2^24 words.
11-
// But the VM supports theorically a memory of size MAX_MEMORY_SIZE = 2^29.
12+
// But the VM supports theorically a memory of size 2^29.
1213
pub(crate) const MAX_RUNNER_MEMORY_SIZE: usize = 1 << 24;
1314

1415
#[derive(Debug, Clone, Default)]

0 commit comments

Comments
 (0)