fix(syscalls): raise the private-input clamp to 512 MiB#843
Conversation
64 MiB was sized for the old naive-recursion VmProof case. Real proofs at production options (blowup=2, 219 queries) are much larger - ethrex/20 proves to ~231 MiB monolithic, and a continuation bundle carries one such proof per epoch. Bump both sides of the clamp (executor's cap and the guest's mirrored constant) together so an honest length prefix is always within bound on both.
|
Benchmark Results for modified programs 🚀
|
|
Benchmark Results for unmodified programs 🚀
|
|
/ai-review |
Codex Code Review
|
|
Reviewed — this is a clean, well-scoped constant bump (64 MiB → 512 MiB) with no issues found. Checks performed:
One inherent tradeoff worth noting (not a defect): LGTM. |
AI ReviewPR #843 · 4 changed files Findings
Status column reflects the verdict from the verifier: deepseek-verifier (openrouter/deepseek/deepseek-v4-pro). AI-001: 512 MiB private input blows up executor Memory hashmap
Claim store_private_inputs writes the full input via set_bytes_aligned, which inserts one HashMap entry per 4-byte word. With the new 512 MiB cap this creates ~134M entries, consuming several GB of memory for a max-size input and risking OOM or swapping even on server hardware. Evidence set_bytes_aligned loops over inputs.chunks(4) and calls self.cells.insert(addr, bytes) for each chunk (lines 265-280). Memory::cells is a U64HashMap<[u8; 4]>, so a 512 MiB input becomes ~134 million entries. This is a large constant-factor blow-up on top of the already-allocated input Vec. Suggested fix Re-evaluate Memory's private-input backing before shipping the larger cap: either store the region as a dense Vec<u8> keyed by PRIVATE_INPUT_START_INDEX, or at least warn that 512 MiB inputs require multiple GB of executor RAM. A denser representation would avoid making Memory a memory bottleneck for recursion bundles. AI-002: Test no longer exercises the "exceeds max" code path it claims to test
Claim test_verify_rejects_num_private_input_pages_exceeds_max hardcodes Evidence Line 2821: hardcoded Suggested fix Replace AI-003: Test allocates ~512 MiB to exercise the oversized-input failure path
Claim The oversized-input test now allocates a Vec of Evidence Line 895: Suggested fix Avoid tying the test allocation to the full MAX value. Either keep a small fixed oversized value (e.g. a few KiB) by temporarily lowering the threshold via a test-only constructor, or document/skip this test on memory-constrained runners. If the design truly requires >MAX bytes here, at minimum mark the test AI-005: Stale 64 MiB reference in test comment
Claim The comment in test_max_private_input_pages_is_tight still says the test avoids allocating a 64 MiB test input, but the constant was raised to 512 MiB. Evidence Line 1500 in prover/src/continuation.rs: Suggested fix Update the comment to 512 MiB or rephrase it to refer to the MAX_PRIVATE_INPUT_SIZE constant so it cannot go stale again. Reviewer Lanes
Verification Lanes
Native Codex and Claude reviews run separately and post their own comments. They are not included in this structured provenance report. Discarded candidates (1) — rejected by the verifier
Raw lane outputs, candidates, final issues, and model metrics are uploaded as workflow artifacts. |
Replace the hardcoded 1000-page bound with page::max_private_input_pages() + 1 so the "exceeds max" test keeps exercising the intended early-bounds-check code path (1000 pages is now within range at 512 MiB). Also fix a stale 64 MiB reference in a neighboring test comment.
|
Addressed the two cheap review findings (67bc664):
Known issue, tracked separately (not fixed in this PR): the reviewers are right that |
|
Memory explosion will be fixed in a follow-up PR. For now it's rather theoretical. |
Summary
VmProofcase. Real proofs at production options (blowup=2, 219 queries) are much larger — ethrex/20 proves to ~231 MiB monolithic, and a continuation bundle carries one such proof per epoch.executor::vm::memory::MAX_PRIVATE_INPUT_SIZE) and the guest's mirrored constant (syscalls::syscalls::MAX_PRIVATE_INPUT_SIZE), so an honest length prefix stays within bound on both — a prior version of this change bumped only the host side and silently truncated real guest inputs.Test plan
cargo test -p lambda-vm-prover --lib(continuation page-count regression test updated: 257 → 2049 pages)cargo test -p executor --test flamegraph test_run_with_flamegraph_returns_generator_on_executor_new_failure