Skip to content

Use new Pedersen generator infra from bberg#454

Merged
dbanks12 merged 14 commits into
masterfrom
sb/pedersen-generators
Jun 28, 2023
Merged

Use new Pedersen generator infra from bberg#454
dbanks12 merged 14 commits into
masterfrom
sb/pedersen-generators

Conversation

@suyash67

@suyash67 suyash67 commented May 3, 2023

Copy link
Copy Markdown
Contributor

Description

The Pedersen generator memory usage was reduced by a factor of 3 in this bb PR. This PR uses the latest Pedersen generators from bberg in packages to avoid running into issues when using hash indices more than 16 (this is what was allowed in the past in bberg) or hashing more than 32 elements (we now can hash ≤ 44 elements and this can easily be increased if need be, without memory consequences).

As a result, the hash indices have slightly been reordered according to how many sub-generators a hash index needs. The following conditions are to be followed:

Hash size Number of elements hashed (n) Condition
LOW n ≤ 8 0 < hash_index ≤ 32
MID 8 < n ≤ 16 32 < hash_index ≤ 40
HIGH 16 < n ≤ 44 40 < hash_index ≤ 44

If you need more generators, simply put in a PR to increase existing limits in bberg and use the new hash indices in packages. The existing limits in bberg are defined here:

https://github.com/AztecProtocol/barretenberg/blob/d60b16a14219fd4bd130ce4537c3e94bfa10128f/cpp/src/barretenberg/crypto/generators/generator_data.cpp#L25-L27

Why do we have the limits? Because we need to store generator tables in static memory so we need to know at compile time, the number of generators we are ever going to need.

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • I have linked this pull request to the issue(s) that it resolves.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • The branch has been merged or rebased against the head of its merge target.
  • I'm happy for the PR to be merged at the reviewer's next convenience.

@suyash67 suyash67 force-pushed the sb/pedersen-generators branch from cc706dd to 666575f Compare May 4, 2023 22:29
@suyash67 suyash67 force-pushed the sb/pedersen-generators branch 2 times, most recently from 62f9cbe to 3855007 Compare June 23, 2023 04:22
Get circuits.js working by changing snapshots.

The snapshots have changed because the generator index ordering as well as sizes have changed.

Fix snapshot of public kernel tests.

update bb.

update bb.

update bb.

abi snapshot fixes

fix: updated generator index on the noir side

prettier.

Fix circuits.js tests
@suyash67 suyash67 force-pushed the sb/pedersen-generators branch from 3855007 to 7809788 Compare June 24, 2023 14:36
@suyash67 suyash67 marked this pull request as ready for review June 28, 2023 15:28
@suyash67 suyash67 requested review from dbanks12 and jeanmon June 28, 2023 15:28

@jeanmon jeanmon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. My comments are nice to have.

Comment thread circuits/cpp/src/aztec3/constants.hpp Outdated
Comment thread circuits/cpp/src/aztec3/constants.hpp
Comment thread yarn-project/circuits.js/src/structs/generators.ts

@dbanks12 dbanks12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dbanks12 dbanks12 merged commit 9cbda1b into master Jun 28, 2023
@dbanks12 dbanks12 deleted the sb/pedersen-generators branch June 28, 2023 17:46
ludamad pushed a commit that referenced this pull request Jul 14, 2023
codygunton pushed a commit that referenced this pull request Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants