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

Keccak256 preimage proof cannot be verified #1934

Closed
ax0 opened this issue Jul 14, 2023 · 7 comments
Closed

Keccak256 preimage proof cannot be verified #1934

ax0 opened this issue Jul 14, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@ax0
Copy link
Contributor

ax0 commented Jul 14, 2023

Aim

Generate and verify a proof for the program

use dep::std::hash::keccak256;

fn main(x: [u8; 3], len: Field) -> pub [u8; 32] {
    let len_u32 = len as u32;
    keccak256(x, len_u32)
}

with Prover.toml given by

x = [1,2,3]
len = 2

Expected Behavior

A proof may be generated and verified.

Bug

A proof may be generated but verification fails.

To Reproduce

  1. Create a new Nargo project and populate main.nr and Prover.toml with the above snippets.
  2. Run nargo prove p.
  3. Run nargo verify p.

Installation Method

Compiled from source

Nargo Version

nargo 0.8.0 (git version hash: 1056ba1, is dirty: false)

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@kevaundray
Copy link
Contributor

Is this ran with the experimental-ssa or the old ssa? cc @guipublic for visibility

@ax0
Copy link
Contributor Author

ax0 commented Jul 20, 2023

Just checked and passing --experimental-ssa yields the same result, so both.

@kevaundray
Copy link
Contributor

@guipublic are there any blockers on diagnosing this issue?

@guipublic
Copy link
Contributor

@guipublic are there any blockers on diagnosing this issue?

no, had to work around barretenberg but now I have a repro there and I am experimenting a fix.

@kevaundray
Copy link
Contributor

Update on this: @guipublic will create a unit test that is failing on the barretenberg side

@guipublic
Copy link
Contributor

Fixed by AztecProtocol/barretenberg#632

Rumata888 pushed a commit to AztecProtocol/aztec-packages that referenced this issue Aug 30, 2023
This PR fixes noir issue 1934
(noir-lang/noir#1934):

When using variable size keccak, the inputs that are after the provided
length where not set to 0.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [X] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [X] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [X] Every change is related to the PR description.
- [X] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).
AztecBot pushed a commit to AztecProtocol/barretenberg that referenced this issue Aug 30, 2023
This PR fixes noir issue 1934
(noir-lang/noir#1934):

When using variable size keccak, the inputs that are after the provided
length where not set to 0.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [X] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [X] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [X] Every change is related to the PR description.
- [X] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).
@guipublic
Copy link
Contributor

The fix has now been integrated into noir with the last backend update. I am closing the issue.

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

No branches or pull requests

4 participants