diff --git a/executor/programs/asm/test_private_input_multipage.s b/executor/programs/asm/test_private_input_multipage.s index bba65dff0..39b37e435 100644 --- a/executor/programs/asm/test_private_input_multipage.s +++ b/executor/programs/asm/test_private_input_multipage.s @@ -6,17 +6,17 @@ main: # private input: two touched private pages => two non-preprocessed # GLOBAL_MEMORY tables in the continuation global proof. # - # Layout: [len:u32 LE] at 0xFF000000, data follows. Page size = 1<<18 = 0x40000. - # Page 0 = [0xFF000000, 0xFF040000); page 1 = [0xFF040000, 0xFF080000). + # Layout: [len:u32 LE] at 0xFF000000, data follows. Page size = 1<<15 = 0x8000. + # Page 0 = [0xFF000000, 0xFF008000); page 1 = [0xFF008000, 0xFF010000). li t0, 0xFF000000 # page 0 base lw t3, 0(t0) # touch page 0 (read length) - li t2, 0xFF040000 # page 1 base (0xFF000000 + 0x40000) + li t2, 0xFF008000 # page 1 base (0xFF000000 + 0x8000) ld t4, 0(t2) # touch page 1 (read 8 bytes) - # Commit 8 bytes from page 1 (0xFF040000), so the output depends on page 1. - mv a1, t2 # buf_addr = 0xFF040000 + # Commit 8 bytes from page 1 (0xFF008000), so the output depends on page 1. + mv a1, t2 # buf_addr = 0xFF008000 li a0, 1 # fd = 1 li a2, 8 # count = 8 li a7, 64 # syscall = Commit diff --git a/prover/src/auto_storage.rs b/prover/src/auto_storage.rs index 49707cb4c..1b38694cb 100644 --- a/prover/src/auto_storage.rs +++ b/prover/src/auto_storage.rs @@ -201,7 +201,7 @@ fn table_specs(lengths: &TableLengths) -> Vec { 2, ), ]; - // Each unique 256 KB page → its own PAGE table at PAGE_SIZE rows. + // Each unique 32 KB page → its own PAGE table at PAGE_SIZE rows. for _ in 0..lengths.unique_page_count { specs.push(( page_rows, diff --git a/prover/src/continuation.rs b/prover/src/continuation.rs index 169cd7278..f66eac2d0 100644 --- a/prover/src/continuation.rs +++ b/prover/src/continuation.rs @@ -1970,9 +1970,9 @@ mod tests { let page_size = page::DEFAULT_PAGE_SIZE; let max = page::max_private_input_pages(); - // (512 MiB + 4-byte prefix) / 256 KiB page = 2049 pages (2048 full data pages plus + // (512 MiB + 4-byte prefix) / 32 KiB page = 16385 pages (16384 full data pages plus // the one page the length prefix spills into). Pinned so a size/page change is caught. - assert_eq!(max, 2049); + assert_eq!(max, 16385); // No slack: an honest MAX-size input needs the whole last page (the bound is not // padded), and never overflows into an extra one. @@ -2033,7 +2033,7 @@ mod tests { let _ = env_logger::builder().is_test(true).try_init(); let elf_bytes = asm_elf_bytes("test_private_input_multipage"); - // Page 1 starts at memory address START + page_size = 0xFF040000, which is data + // Page 1 starts at memory address START + page_size = 0xFF008000, which is data // index `page_size - 4` (the 4-byte length prefix sits at START). The program // commits the 8 bytes there, so the input must extend through that. let page_size = page::DEFAULT_PAGE_SIZE; diff --git a/prover/src/paged_mem.rs b/prover/src/paged_mem.rs index 196d077bf..39ea9f6f8 100644 --- a/prover/src/paged_mem.rs +++ b/prover/src/paged_mem.rs @@ -9,7 +9,7 @@ //! footprint is ~98% two big *contiguous* blocks — i.e. dense. For dense data a //! flat array indexed by offset is far cheaper: no keys, no hashing, no slack, //! and cache-friendly. This stores one dense `[T; PAGE_SIZE]` array per touched -//! 256 KB page, in a small `Vec` sorted by page base (few entries — binary-search +//! 32 KB page, in a small `Vec` sorted by page base (few entries — binary-search //! lookup + sorted insert, no hashing at all; the bulk lives in the arrays). //! //! Unset cells read back as `fill` (the genesis/default value) — pages are diff --git a/prover/src/tables/page.rs b/prover/src/tables/page.rs index 18ce6b52b..022e94e08 100644 --- a/prover/src/tables/page.rs +++ b/prover/src/tables/page.rs @@ -46,8 +46,8 @@ use super::types::{BusId, FE, GoldilocksExtension, GoldilocksField, VmTable}; // Constants // ========================================================================= -/// Default page size in bytes (256KB). -pub const DEFAULT_PAGE_SIZE: usize = 1 << 18; +/// Default page size in bytes (32KB). +pub const DEFAULT_PAGE_SIZE: usize = 1 << 15; /// Stack top address (where SP starts). Re-exported from executor. pub use executor::vm::registers::STACK_TOP; @@ -321,19 +321,19 @@ pub fn generate_page_trace( pub(crate) fn static_zero_page_commitment(blowup_factor: u8) -> Option { match blowup_factor { 2 => Some([ - 0x7d, 0x74, 0x85, 0xf0, 0x2b, 0x74, 0xe0, 0x3f, 0x14, 0x99, 0xb3, 0xa0, 0x5f, 0x1d, - 0x6e, 0xf2, 0x21, 0xff, 0xaf, 0x24, 0x7e, 0x30, 0xb0, 0xda, 0x48, 0x79, 0xe1, 0x43, - 0xee, 0xea, 0x6a, 0x0f, + 0x77, 0x88, 0xad, 0xfe, 0x2a, 0x2b, 0x7d, 0xfb, 0x38, 0x9b, 0xdb, 0x5b, 0xad, 0x72, + 0x97, 0x9b, 0xd7, 0x1c, 0xc7, 0xee, 0x91, 0x0e, 0x84, 0xd8, 0xda, 0xde, 0x5b, 0x55, + 0x21, 0xf5, 0x5f, 0xae, ]), 4 => Some([ - 0x5c, 0xcc, 0x5b, 0xb1, 0xe8, 0x11, 0x91, 0x81, 0xbd, 0xdd, 0x39, 0x40, 0x77, 0x87, - 0xdc, 0x98, 0x06, 0x06, 0x8c, 0x63, 0xcd, 0xfd, 0xf1, 0xda, 0x4a, 0x55, 0x31, 0x4d, - 0x6a, 0x16, 0x18, 0xd0, + 0x4c, 0x7d, 0xab, 0x35, 0xca, 0xb1, 0xe5, 0xbc, 0x99, 0x34, 0x71, 0xdc, 0x19, 0x79, + 0xea, 0xc2, 0x97, 0x93, 0xa6, 0x6e, 0x8a, 0xb9, 0x03, 0xcc, 0xae, 0x16, 0x01, 0xb8, + 0xce, 0xf9, 0xe2, 0x0c, ]), 8 => Some([ - 0xf0, 0xc0, 0x69, 0xed, 0xf8, 0x59, 0xd6, 0x56, 0x15, 0x3c, 0x2f, 0x93, 0x65, 0xd6, - 0xe9, 0xe9, 0x8e, 0xd1, 0x83, 0x94, 0xf9, 0x75, 0x59, 0xd1, 0xec, 0x16, 0xe1, 0x37, - 0xd5, 0x32, 0xd6, 0xd9, + 0x21, 0x24, 0x30, 0x6b, 0x0f, 0xe7, 0xbf, 0x42, 0x78, 0x31, 0x15, 0xb2, 0x70, 0x82, + 0x12, 0x2a, 0x38, 0xf7, 0x18, 0xd9, 0xb5, 0x1d, 0xa3, 0x8d, 0x4b, 0x6f, 0xe4, 0x1a, + 0x60, 0xd6, 0x9c, 0x1f, ]), _ => None, } diff --git a/prover/src/tests/page_tests.rs b/prover/src/tests/page_tests.rs index f1bcc6933..ee46daad5 100644 --- a/prover/src/tests/page_tests.rs +++ b/prover/src/tests/page_tests.rs @@ -11,27 +11,27 @@ use crate::{prove, verify_with_options}; #[test] fn test_page_base_for_address() { - // DEFAULT_PAGE_SIZE = 1 << 18 = 0x40000 + // DEFAULT_PAGE_SIZE = 1 << 15 = 0x8000 assert_eq!(page_base_for_address(0x00000), 0x00000); - assert_eq!(page_base_for_address(0x1000), 0x00000); // 0x1000 < 0x40000 - assert_eq!(page_base_for_address(0x3FFFF), 0x00000); // last byte of first page - assert_eq!(page_base_for_address(0x40000), 0x40000); // start of second page - assert_eq!(page_base_for_address(0x40001), 0x40000); // one byte into second page + assert_eq!(page_base_for_address(0x1000), 0x00000); // 0x1000 < 0x8000 + assert_eq!(page_base_for_address(0x7FFF), 0x00000); // last byte of first page + assert_eq!(page_base_for_address(0x8000), 0x8000); // start of second page + assert_eq!(page_base_for_address(0x8001), 0x8000); // one byte into second page } #[test] fn test_offset_in_page() { - // DEFAULT_PAGE_SIZE = 0x40000 + // DEFAULT_PAGE_SIZE = 0x8000 assert_eq!(offset_in_page(0x00000), 0); assert_eq!(offset_in_page(0x1000), 0x1000); // 4096 - assert_eq!(offset_in_page(0x3FFFF), 0x3FFFF); // last offset in first page - assert_eq!(offset_in_page(0x40000), 0); // start of second page → offset 0 - assert_eq!(offset_in_page(0x40001), 1); // one byte into second page + assert_eq!(offset_in_page(0x7FFF), 0x7FFF); // last offset in first page + assert_eq!(offset_in_page(0x8000), 0); // start of second page → offset 0 + assert_eq!(offset_in_page(0x8001), 1); // one byte into second page } #[test] fn test_generate_page_trace_zero_init() { - // Use 0 as page_base (aligned to DEFAULT_PAGE_SIZE = 256KB) + // Use 0 as page_base (aligned to DEFAULT_PAGE_SIZE = 32KB) let config = PageConfig::zero_init(0); let final_state = FinalStateMap::new(); @@ -63,7 +63,7 @@ fn test_generate_page_trace_zero_init() { #[test] fn test_generate_page_trace_with_data() { - // Use 0 as page_base (aligned to DEFAULT_PAGE_SIZE = 256KB) + // Use 0 as page_base (aligned to DEFAULT_PAGE_SIZE = 32KB) let data = vec![0x01, 0x02, 0x03, 0x04]; let config = PageConfig::with_data(0, data); let final_state = FinalStateMap::new(); @@ -94,7 +94,7 @@ fn test_generate_page_trace_with_data() { #[test] fn test_generate_page_trace_with_accesses() { - // Use 0 as page_base (aligned to DEFAULT_PAGE_SIZE = 256KB) + // Use 0 as page_base (aligned to DEFAULT_PAGE_SIZE = 32KB) let data = vec![0xAA, 0xBB]; let config = PageConfig::with_data(0, data);