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

Reimplement pedersen generator generation in Rust 🦀 #4863

Closed
TomAFrench opened this issue Apr 21, 2024 · 2 comments · Fixed by #4871
Closed

Reimplement pedersen generator generation in Rust 🦀 #4863

TomAFrench opened this issue Apr 21, 2024 · 2 comments · Fixed by #4871
Labels
good first issue Good for newcomers

Comments

@TomAFrench
Copy link
Member

The generators for Noir's implementation of Pedersen are generated by the functions below.

https://github.com/AztecProtocol/aztec-packages/blob/e1eb98e85e6ef6ca87f502036426457c8c2a7efc/barretenberg/cpp/src/barretenberg/ecc/groups/group.hpp#L48-L105

https://github.com/AztecProtocol/aztec-packages/blob/e1eb98e85e6ef6ca87f502036426457c8c2a7efc/barretenberg/cpp/src/barretenberg/ecc/groups/affine_element_impl.hpp#L191-L263

If we reimplement this in Rust then we'll be able to remove the use of a wasm-ed barretenberg instance for ACVM execution which will help execution speeds and simplify working work with the ACVM in JS (as there will no longer be an async step for initialising this extra wasm).

@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Apr 21, 2024
@TomAFrench TomAFrench changed the title Reimplement pedersen generator generation in Rust Reimplement pedersen generator generation in Rust 🦀 Apr 21, 2024
@TomAFrench TomAFrench added the good first issue Good for newcomers label Apr 21, 2024
@TomAFrench
Copy link
Member Author

Marking this as good-first-issue, implementations of this will have to include unit tests to show equivalence with barretenberg.

Contributions can tackle the hash_to_curve and actual generator generation separately.

github-merge-queue bot pushed a commit that referenced this issue May 20, 2024
# Description

## Problem\*

Resolves #4863 

## Summary\*

This PR pulls in the relevant code from
[Barustenberg](https://github.com/laudiacay/barustenberg) for performing
pedersen commitments + hashes. Tests are currently failing (seems like
Barustenberg is failing its own CI) however it's a good starting point
for a working implementation.

In order for this PR to be merged we should have tests in barretenberg
which shows expected outputs for all of these added functions and this
code should replicate those.

Benchmarks relative to #5056 
```
pedersen_commitment     time:   [3.5018 µs 3.5059 µs 3.5102 µs]
                        change: [-99.357% -99.356% -99.354%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 40 measurements (2.50%)
  1 (2.50%) low mild

pedersen_hash           time:   [6.9828 µs 6.9920 µs 7.0021 µs]
                        change: [-99.181% -99.180% -99.178%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 40 measurements (5.00%)
  2 (5.00%) high mild
```

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** 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.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant