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

Inconsistent behaviour with .as_slice() #2557

Closed
Tracked by #28
kevaundray opened this issue Sep 4, 2023 · 2 comments · Fixed by #2562
Closed
Tracked by #28

Inconsistent behaviour with .as_slice() #2557

kevaundray opened this issue Sep 4, 2023 · 2 comments · Fixed by #2562
Assignees
Labels
bug Something isn't working

Comments

@kevaundray
Copy link
Contributor

kevaundray commented Sep 4, 2023

Aim

The double_verify_proof was recently not working as expected for barretenberg.

The code that panics in barretenberg:

use dep::std;

fn main(
    verification_key : [Field; 114], 
    proof : [Field; 94], 
    public_inputs : [Field; 1], 
    key_hash : Field, 
    input_aggregation_object : [Field; 16],
    proof_b : [Field; 94],
) -> pub [Field; 16] {
    let output_aggregation_object_a = std::verify_proof(
        verification_key.as_slice(), 
        proof.as_slice(), 
        public_inputs.as_slice(), 
        key_hash, 
        input_aggregation_object
    );

    let output_aggregation_object = std::verify_proof(
        verification_key.as_slice(),
        proof_b.as_slice(),
        public_inputs.as_slice(),
        key_hash,
        output_aggregation_object_a
    );

    let mut output = [0; 16];
    for i in 0..16 {
        output[i] = output_aggregation_object[i];
    }
    output
}

The code that works in barretenberg:

use dep::std;

fn main(
    verification_key : [Field; 114], 
    proof : [Field; 94], 
    public_inputs : [Field; 1], 
    key_hash : Field, 
    input_aggregation_object : [Field; 16],
    proof_b : [Field; 94],
) -> pub [Field; 16] {

    let verification_key : [Field] = verification_key;
    let proof : [Field] = proof;
    let proof_b : [Field] = proof_b;
    let public_inputs : [Field] = public_inputs;

    let output_aggregation_object_a = std::verify_proof(
        verification_key, 
        proof, 
        public_inputs, 
        key_hash,
        input_aggregation_object
    );

    let output_aggregation_object = std::verify_proof(
        verification_key,
        proof_b,
        public_inputs,
        key_hash,
        output_aggregation_object_a
    );

    let mut output = [0; 16];
    for i in 0..16 {
        output[i] = output_aggregation_object[i];
    }
    output
}
image

Expected Behavior

Both of these codepaths should work

Bug

We get a panic in barretenberg and barretenberg when deserializing says that input aggregation object has 1 value instead of 16. It is the witness with index 342.

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@kevaundray kevaundray added the bug Something isn't working label Sep 4, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 4, 2023
@kevaundray
Copy link
Contributor Author

Note that both of these pass execution, so it may be a bug in serde-reflect

@kevaundray
Copy link
Contributor Author

Retroactive questions so that we can spot this earlier:

  • Why did this not pop up on any other test?
  • Why do both of those pass execution, but only fail in barretenberg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants