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 blackbox instruction injectivity test fails #5690

Closed
michaeljklein opened this issue Aug 6, 2024 · 2 comments
Closed

Keccak256 blackbox instruction injectivity test fails #5690

michaeljklein opened this issue Aug 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@michaeljklein
Copy link
Contributor

Aim

Attempted to test that the Keccak256 blackbox instruction is injective as part of #5614

Expected Behavior

Expected to find that solving the Keccak256 blackbox function on different inputs resolves to different outputs, i.e.

forall x, y. x != y -> f x != f y

Bug

The following test passes:

#[test]
fn keccak256_injective_regression() {
    // 2⁸×61916068613087029720904767285796661
    let x = FieldElement::from(15850513564950279608551620425163945216u128);

    // 2⁸×220343640628484768581538005104492351
    let y = FieldElement::from(56407972000892100756873729306750041856u128);
    assert!(x != y);

    let inputs = vec![(x, false)];
    let distinct_inputs = vec![(y, false)];
    let num_outputs = 32;

    assert_eq!(
        solve_array_input_blackbox_call(inputs, num_outputs, keccak256_op),
        solve_array_input_blackbox_call(distinct_inputs, num_outputs, keccak256_op));

    assert!(result, "{}", message);
}

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@michaeljklein michaeljklein added the bug Something isn't working label Aug 6, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 6, 2024
@michaeljklein
Copy link
Contributor Author

I am still looking into this, but @vezenovm suggested that keccak256 could silently require the num_bits of the FunctionInput to be 8.

@TomAFrench
Copy link
Member

Closing as we no longer have a keccak256 opcode

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Oct 31, 2024
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

2 participants