-
Notifications
You must be signed in to change notification settings - Fork 598
feat: Correct circuit construction from acir #3757
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
Changes from all commits
4833af4
ec262d5
4a0c291
32a1bc0
57bb2c0
72b8ff7
92b49f1
a4f79cd
69c7734
a99d496
4806d12
149a3a7
321e074
5514cef
4f559fc
77170fd
7ec3a4e
90de8ee
d82176e
f356bff
94c060d
8523bf2
fc4fdff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,17 +81,26 @@ std::vector<uint8_t> AcirComposer::create_proof(acir_format::acir_format& constr | |
| void AcirComposer::create_goblin_circuit(acir_format::acir_format& constraint_system, | ||
| acir_format::WitnessVector& witness) | ||
| { | ||
| // Provide the builder with the op queue owned by the goblin instance | ||
| goblin_builder_.op_queue = goblin.op_queue; | ||
|
|
||
| create_circuit_with_witness(goblin_builder_, constraint_system, witness); | ||
| // The public inputs in constraint_system do not index into "witness" but rather into the future "variables" which | ||
| // it assumes will be equal to witness but with a prepended zero. We want to remove this +1 so that public_inputs | ||
| // properly indexes into witness because we're about to make calls like add_variable(witness[public_inputs[idx]]). | ||
| // Once the +1 is removed from noir, this correction can be removed entirely and we can use | ||
| // constraint_system.public_inputs directly. | ||
| const uint32_t pre_applied_noir_offset = 1; | ||
| std::vector<uint32_t> corrected_public_inputs; | ||
| for (const auto& index : constraint_system.public_inputs) { | ||
| corrected_public_inputs.emplace_back(index - pre_applied_noir_offset); | ||
| } | ||
|
|
||
| info("after create_circuit_with_witness: num_gates = ", goblin_builder_.num_gates); | ||
| // Construct a builder using the witness and public input data from acir | ||
| goblin_builder_ = | ||
| acir_format::GoblinBuilder{ goblin.op_queue, witness, corrected_public_inputs, constraint_system.varnum }; | ||
|
|
||
| // Correct for the addition of const variables in the builder constructor | ||
| acir_format::apply_wire_index_offset(goblin_builder_); | ||
| // Populate constraints in the builder via the data in constraint_system | ||
| acir_format::build_constraints(goblin_builder_, constraint_system, true); | ||
|
|
||
| // Add some arbitrary op gates to ensure the associated polynomials are non-zero | ||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/817): Add some arbitrary op gates to ensure the | ||
| // associated polynomials are non-zero and to give ECCVM and Translator some ECC ops to process. | ||
| GoblinTestingUtils::construct_goblin_ecc_op_circuit(goblin_builder_); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an issue open for this? Its not blocking this PR as it was already there before this PR was merged. Would be good to clean this up in a near-future PR as having TestingUtils being used anywhere except for tests seems like a footgun
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the relevant issue. The hope is to get all of this sorted out in the near future |
||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.