Skip to content
Merged
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
7 changes: 3 additions & 4 deletions executor/src/vm/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ pub type U64HashMap<V> = HashMap<u64, V, U64BuildHasher>;
/// The COMMIT AIR concatenates calls via the running `x254` index, so this
/// is enforced as a running-total budget rather than a per-call limit.
pub const MAX_PUBLIC_OUTPUT_TOTAL_SIZE: u64 = 1024 * 1024;
/// Maximum size of the private input memory region (in bytes). 64 MiB so that a
/// whole `VmProof` can be passed as private input to a verifier guest (naive
/// recursion).
pub const MAX_PRIVATE_INPUT_SIZE: u64 = 64 * 1024 * 1024;
/// Maximum size of the private input memory region (in bytes). 512 MiB so a
/// real proof (e.g. a continuation bundle) fits as private input.
pub const MAX_PRIVATE_INPUT_SIZE: u64 = 512 * 1024 * 1024;
/// Fixed high address where private input is mapped. Guest programs can read
/// directly from this address (ZisK-style memory-mapped input).
/// Layout: 4-byte LE length prefix at `PRIVATE_INPUT_START_INDEX`, then data at +4.
Expand Down
2 changes: 1 addition & 1 deletion executor/tests/flamegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ fn test_run_with_flamegraph_returns_generator_on_executor_new_failure() {
// even on failure.
let elf_bytes = std::fs::read("./program_artifacts/rust/add.elf").unwrap();
let program = executor::elf::Elf::load(&elf_bytes).unwrap();
let oversized_input = vec![0u8; 64 * 1024 * 1024 + 1];
let oversized_input = vec![0u8; executor::vm::memory::MAX_PRIVATE_INPUT_SIZE as usize + 1];

let (generator, result) = executor::flamegraph::run_with_flamegraph(
&elf_bytes,
Expand Down
6 changes: 3 additions & 3 deletions prover/src/continuation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1497,16 +1497,16 @@ mod tests {

// The deserialized-count bound is the tight honest max: exactly the pages a MAX-size
// input occupies, with no slack. Pin the value and the tightness (checked via the byte
// span so we don't allocate a 64 MiB test input).
// span so we don't allocate a 512 MiB test input).
#[test]
fn test_max_private_input_pages_is_tight() {
use executor::vm::memory::{MAX_PRIVATE_INPUT_SIZE, PRIVATE_INPUT_LENGTH_PREFIX_BYTES};
let page_size = page::DEFAULT_PAGE_SIZE;
let max = page::max_private_input_pages();

// (64 MiB + 4-byte prefix) / 256 KiB page = 257 pages (256 full data pages plus
// (512 MiB + 4-byte prefix) / 256 KiB page = 2049 pages (2048 full data pages plus
// the one page the length prefix spills into). Pinned so a size/page change is caught.
assert_eq!(max, 257);
assert_eq!(max, 2049);

// No slack: an honest MAX-size input needs the whole last page (the bound is not
// padded), and never overflows into an extra one.
Expand Down
2 changes: 1 addition & 1 deletion prover/src/tests/prove_elfs_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2818,7 +2818,7 @@ fn test_verify_rejects_num_private_input_pages_exceeds_max() {
let vm_proof = crate::prove_with_inputs(&elf_bytes, &input).expect("prove should succeed");

let tampered = crate::VmProof {
num_private_input_pages: 1000,
num_private_input_pages: crate::tables::page::max_private_input_pages() + 1,
..vm_proof
};

Expand Down
4 changes: 2 additions & 2 deletions syscalls/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use core::arch::asm;
#[cfg(target_arch = "riscv64")]
pub const PRIVATE_INPUT_START: usize = 0xFF000000;

/// Maximum private-input length the guest will read, in bytes (64 MiB).
/// Maximum private-input length the guest will read, in bytes (512 MiB).
/// The host caps stored input at this size in `Memory::store_private_inputs`,
/// so an honest length prefix is always `<=` this bound; a larger value can only
/// come from a malformed or forged prefix. The reader clamps to this cap so a
/// bogus length can never make the guest fabricate an arbitrarily long slice.
/// Must match `executor::vm::memory::MAX_PRIVATE_INPUT_SIZE`.
#[cfg(target_arch = "riscv64")]
const MAX_PRIVATE_INPUT_SIZE: usize = 64 * 1024 * 1024;
const MAX_PRIVATE_INPUT_SIZE: usize = 512 * 1024 * 1024;

#[cfg(target_arch = "riscv64")]
pub enum SyscallNumbers {
Expand Down
Loading