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

Proof invalid when creating Vec<[u8; 32]> in proof #552

Open
jswalens opened this issue Jan 8, 2025 · 2 comments
Open

Proof invalid when creating Vec<[u8; 32]> in proof #552

jswalens opened this issue Jan 8, 2025 · 2 comments

Comments

@jswalens
Copy link

jswalens commented Jan 8, 2025

I'm running the following program:

#[jolt::provable]
fn example() -> Vec<[u8; 32]> {
    vec![[0; 32]; 10]
}

Using the following host code:

pub fn main() {
    let (prove, verify) = guest::build_example();

    let (output, proof) = prove();
    let is_valid = verify(proof);

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

The proof returned by this code is invalid, i.e. it prints valid: false. This seems to be related to creating a Vec of arrays in the proof. I've encountered the same problem with code like:

let result: Vec<[u8; 32]> = input.iter().map(|data| [0; 32]).collect();

The proof is generated without any errors, but afterwards verification fails.

I've tried setting a bigger maximum output size but that doesn't solve the issue. I'm running the latest revision of Jolt on the main branch.

@jswalens
Copy link
Author

jswalens commented Jan 8, 2025

I did some more experimenting, and this succeeds:

#[jolt::provable]
fn example() -> Vec<[u8; 16]> {
    vec![[0; 16]; 1]
}

while this fails:

#[jolt::provable]
fn example() -> Vec<[u8; 17]> {
    vec![[0; 17]; 1]
}

@moodlezoup
Copy link
Collaborator

Thanks for flagging, will investigate

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

2 participants