Skip to content

Exact circuit size + update for new aztec_backend#551

Merged
vezenovm merged 28 commits intomasterfrom
mv/circuit-size
Dec 9, 2022
Merged

Exact circuit size + update for new aztec_backend#551
vezenovm merged 28 commits intomasterfrom
mv/circuit-size

Conversation

@vezenovm
Copy link
Contributor

@vezenovm vezenovm commented Dec 2, 2022

Related issue(s)

Resolves #568

Description

This adds a get_exact_circuit_size method to look at the exact constraints of a circuit. If the circuit size has been used to initialize the prover it has already been rounded to the closest power of 2. However, if we want to fine tune our circuits it helps to have the exact size of the circuit.

In order to add this method we need to upgrade Noir to interop with the new aztec_backend that is based off of noir-lang/aztec-connect rather than the old barretenberg repo (which has now been renamed and lives here.

Summary of changes

I added a new method to the ProofSystemCompiler that requires a backend to specify a function for fetching the exact constraint size of a proof. This was already included in the new barretenberg_static_lib package in aztec_backend. I have this PR where I also fetch the exact circuit size in barretenberg_wasm (noir-lang/acvm-backend-barretenberg#22). That PR also contains an updated reference to the new barretenberg repo as changes had to be made in noir-lang/aztec-connect. These changes to barretenberg can be found here: noir-lang/aztec-connect#5.

Dependency additions / changes

The aztec_backend reference has been changed to reflect that we added a new method to ProofSystemCompiler but also that aztec_backend required a new reference to barretenberg.

Test additions / changes

I had to update some inputs to the nargo functions to reflect changes in the functionality of std_lib functions from barretenberg. These included different signatures for programs that use schnorr and changes to hash outputs for anything that uses pedersen.

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Additional context

(If applicable.)

@jfecher
Copy link
Contributor

jfecher commented Dec 8, 2022

What is the current status on this PR?

@vezenovm
Copy link
Contributor Author

vezenovm commented Dec 8, 2022

What is the current status on this PR?

About to set it ready for review and write some more context. The last thing that had to be fixed was check_membership which I just got working.

@vezenovm vezenovm marked this pull request as ready for review December 8, 2022 20:02
Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

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

Looks good, builds locally for me as well

@Savio-Sou
Copy link
Collaborator

Any known backward-incompatible in addition to the Pedersen changes? Would love to consolidate a list for external comm (e.g. Discord announcement) when this goes out.

@vezenovm
Copy link
Contributor Author

vezenovm commented Dec 9, 2022

Any known backward-incompatible in addition to the Pedersen changes? Would love to consolidate a list for external comm (e.g. Discord announcement) when this goes out.

Schnorr signatures also had to be updated. And anything dependent on pedersen such as the merkle membership functions in the std lib. This is mainly relevant to those who are using nargo for proving and verifying their circuits. The TS wrapper is based off this updated backend. If they were operating exclusively with the TS wrapper when proving circuits, they are using the same backend as this update.

@vezenovm vezenovm merged commit 34ac7fd into master Dec 9, 2022
@vezenovm vezenovm deleted the mv/circuit-size branch December 9, 2022 16:14
TomAFrench added a commit to TomAFrench/noir that referenced this pull request Dec 9, 2022
* master:
  Exact circuit size + update for new aztec_backend (noir-lang#551)
  Separate parsing of inputs from toml format from file loading. (noir-lang#552)
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.

Upgrade to aztec_backend based off of noir-lang/aztec-connect

4 participants