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

Use Poseidon2 permutation opcode for Poseidon2 Noir implementation #4170

Closed
guipublic opened this issue Jan 25, 2024 · 0 comments · Fixed by #4398
Closed

Use Poseidon2 permutation opcode for Poseidon2 Noir implementation #4170

guipublic opened this issue Jan 25, 2024 · 0 comments · Fixed by #4398
Assignees
Labels
enhancement New feature or request

Comments

@guipublic
Copy link
Contributor

Problem

The goal is to replace Noir Poseidon implementation by an implementation which uses the Poseidon2Permutation opcode, in order to improve the performance of Poseidon.

Happy Case

We should be able to just replace the permutation function by the opcode.
However, we should make sure to use the same parameters.
The state size is included in the opcode but it must be supported by the backend.
We may need a poseidon init opcode to initialise/validate the parameters

Alternatives Considered

No response

Additional Context

Following #4037, we have an opcode which would perform the poseidon2 permutation function. This allows us to implement this opcode in Barretenberg using lookup tables.
We can then re-write our Poseidon implementation into Poseidon2, by calling the opcode during the Poseidon rounds.

Noir Poseidon implementation is available in noir_stdlib/src/hash./poseidon.nr
A Poseidon2 implementation in Noir is available here: https://github.com/TaceoLabs/noir-poseidon/tree/main/poseidon2

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@guipublic guipublic added the enhancement New feature or request label Jan 25, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jan 25, 2024
@Savio-Sou Savio-Sou moved this from 📋 Backlog to 🏗 In progress in Noir Feb 23, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 26, 2024
…4398)

and poseidon2 noir implementation

# Description

## Problem\*

Resolves #4170

## Summary\*

The PR implements Poseidon2 permutation for ACMV and Brillig, enabling
the use of the opcode.
Then it also includes a Noir implementation of Poseidon2 using the
opcode in the stdlib

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [X] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

---------

Co-authored-by: kevaundray <kevtheappdev@gmail.com>
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Feb 26, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 27, 2024
# Description

## Problem\*

Related to #4170, this PR address comments in PR #4398 

## Summary\*

Add a comment and a sanity check.

## Additional Context



## Documentation\*

Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant