Skip to content

gnark-solana verifier OOM on Solana: heap allocations inside prepare_inputs() #44

@tanctl

Description

@tanctl

Description
In gnark-solana/crates/verifier-lib/src/verifier.rs:157–172, prepare_inputs() allocates temporary Vec buffers per public input using .concat() and syscall helpers that return Vec. On Solana the program heap is a bump allocator that does not free during execution, so these allocations accumulate and can exhaust the ~32 KiB heap, causing memory allocation failed, out of memory and a program panic on proofs with enough public inputs.

Suggested fix
Remove heap allocation from the hot path: build syscall input buffers on the stack (eg, [u8; 96] and [u8; 128]) and return fixed-size arrays (eg, [u8; 64]) instead of Vec, keeping heap usage flat and preventing OOM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions