Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues handling large inputs in Jolt #493

Open
sashafrolov opened this issue Oct 28, 2024 · 0 comments
Open

Having issues handling large inputs in Jolt #493

sashafrolov opened this issue Oct 28, 2024 · 0 comments

Comments

@sashafrolov
Copy link
Contributor

sashafrolov commented Oct 28, 2024

I have been trying to port some code that applies a simple filter to an image in Jolt from Succinct SP1 to Jolt. I had to raise the memory limits, and also encountered some OOM issues if the input images were too large. Now, when I run the code on images of size 40x40 with 1 input channel (i.e. 3.2kB of input to the ZKVM), my prover executions always fail with something that looks like this:

GUEST PANIC
Trace length: 245557
program_io.outputs.len(): 0
program_io.memory_layout: MemoryLayout { ram_witness_offset: 4194304, max_input_size: 4000000, max_output_size: 4096, input_start: 2143289408, input_end: 2147289408, output_start: 2147289409, output_end: 2147293505, panic: 2147293506, termination: 2147293507 }
thread 'main' panicked at guest/src/lib.rs:8:1:
called `Result::unwrap()` on an `Err` value: DeserializeUnexpectedEnd
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Line 8 of lib.rs in my code is the line that is #[jolt::provable()]. This DeserializeUnexpectedEnd error comes from the postcard library, which is only used in a couple places in the Jolt codebase. I did a bit of experimentation, and this does not seem to be related to input parameter types (e.g. I made the method signature of my provable function the same as the sha2_ex/sha3_ex examples even though my function initially had multiple parameters). Here is the serialized function (it is too big to upload directly in a github issue).

Here is the code I'm running to call the function:


    let input_file = "./resources/resized_img_channels/chebu_resized_R.txt"; 
    let target_file = "./resources/resized_img_channels/chebu_resized_R.txt"; 

    let mut image: Vec<u8> = lib::load_image_from_file(input_file);
    let target_image: Vec<u8> = lib::load_image_from_file(target_file);
    image.extend(target_image);
   
   // Image is ~3.2kB here
    let (prove_frame_resize, verify_frame_resize) = guest::build_frame_resize();
    println!("Build provers!");


    let (output, proof) = prove_frame_resize(&image);
    println!("Ran proof?");
    let is_valid = verify_frame_resize(proof);

    println!("output: {}", output);
    println!("valid: {}", is_valid);

I think there may be a bug that occurs when the input being passed into the prove function is too large, but there may be some other issue. Let me know if there is any other required information needed to understand the issue. Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant