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

Allow querying the gates in a Program in a single request #6168

Closed
TomAFrench opened this issue May 2, 2024 · 1 comment · Fixed by #6228
Closed

Allow querying the gates in a Program in a single request #6168

TomAFrench opened this issue May 2, 2024 · 1 comment · Fixed by #6228
Assignees

Comments

@TomAFrench
Copy link
Member

Migration of noir-lang/noir#4851

See noir-lang/noir#4962

/**
* @brief Computes the number of Barretenberg specific gates needed to create a proof for the specific ACIR circuit
*
* Communication:
* - stdout: The number of gates is written to stdout
*
* @param bytecodePath Path to the file containing the serialized circuit
*/
void gateCount(const std::string& bytecodePath)
{
auto constraint_system = get_constraint_system(bytecodePath);
acir_proofs::AcirComposer acir_composer(0, verbose);
acir_composer.create_circuit(constraint_system);
auto gate_count = acir_composer.get_total_circuit_size();
writeUint64AsRawBytesToStdout(static_cast<uint64_t>(gate_count));
vinfo("gate count: ", gate_count);
}

We want to be able to query the number of constraints in a multi-circuit program in a single go. It should also be easy to generate a report for a whole workspace of programs.

@TomAFrench
Copy link
Member Author

@vezenovm assigning you to this as you've been working on the noir-gates-diff action as well. Ideally the bb gates command should respond with the same json format we're using to feed into the action.

We can have a nice human readable report later on (making ASCII formatting in c++ 🤮).

@TomAFrench TomAFrench added this to Noir May 3, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir May 3, 2024
TomAFrench added a commit that referenced this issue May 9, 2024
…single request (#6228)

Resolves #6168

This PR does a very minor update to simply now go through the entire
list of functions contained inside of a Program and generate a basic
circuit report for each functions. Currently `nargo info` now takes in a
JSON report that it works with instead of an individual printed gate
count. This PR also does some initial work on making a gate report that
is ready for noir-lang/noir-gates-diff. This is yet to be updated but
has most of the initial skeleton needed to get a gates report for an
entire workspace.

Also, once noir-lang/noir#4975 is merged and
synced into this repo we can remove the `bb info` command and rename `bb
gates` -> `bb info`

Nargo info still works as expected:
<img width="662" alt="Screenshot 2024-05-08 at 2 55 32 PM"
src="https://github.com/AztecProtocol/aztec-packages/assets/43554004/dab5e819-18c4-4bbd-a727-d4bf42f7b95c">

---------

Co-authored-by: Tom French <tom@tomfren.ch>
@github-project-automation github-project-automation bot moved this from Todo to Done in A3 May 9, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir May 9, 2024
AztecBot pushed a commit to AztecProtocol/barretenberg that referenced this issue May 10, 2024
…single request (#6228)

Resolves AztecProtocol/aztec-packages#6168

This PR does a very minor update to simply now go through the entire
list of functions contained inside of a Program and generate a basic
circuit report for each functions. Currently `nargo info` now takes in a
JSON report that it works with instead of an individual printed gate
count. This PR also does some initial work on making a gate report that
is ready for noir-lang/noir-gates-diff. This is yet to be updated but
has most of the initial skeleton needed to get a gates report for an
entire workspace.

Also, once noir-lang/noir#4975 is merged and
synced into this repo we can remove the `bb info` command and rename `bb
gates` -> `bb info`

Nargo info still works as expected:
<img width="662" alt="Screenshot 2024-05-08 at 2 55 32 PM"
src="https://github.com/AztecProtocol/aztec-packages/assets/43554004/dab5e819-18c4-4bbd-a727-d4bf42f7b95c">

---------

Co-authored-by: Tom French <tom@tomfren.ch>
TomAFrench added a commit that referenced this issue May 10, 2024
This PR further harmonises the `nargo`/`bb` interface by switching `bb`
over to reading the ACIR bytecode directly out of a `nargo` JSON build
artifact.

I've dropped support for contracts in `nargo info` as we're dropping
this feature anyway and this would require us to write a whole bunch of
extra files which we don't need.

Draft as it builds on #6279 plus requires
#6168 to migrate
`nargo info` over.
AztecBot pushed a commit to AztecProtocol/barretenberg that referenced this issue May 11, 2024
This PR further harmonises the `nargo`/`bb` interface by switching `bb`
over to reading the ACIR bytecode directly out of a `nargo` JSON build
artifact.

I've dropped support for contracts in `nargo info` as we're dropping
this feature anyway and this would require us to write a whole bunch of
extra files which we don't need.

Draft as it builds on #6279 plus requires
AztecProtocol/aztec-packages#6168 to migrate
`nargo info` over.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants