-
Notifications
You must be signed in to change notification settings - Fork 266
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
feat: Update goblin translator circuit builder (Goblin Translator part 1) #2764
feat: Update goblin translator circuit builder (Goblin Translator part 1) #2764
Conversation
08f2ace
to
0d146e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great. Most of my comments are minor suggestions around naming/comments. I went ahead and clicked Approve rather than request changes simply because I'll be out soon and don't want this to get hung up. Nice work
...berg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp
Outdated
Show resolved
Hide resolved
...berg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp
Outdated
Show resolved
Hide resolved
...berg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp
Show resolved
Hide resolved
...berg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp
Show resolved
Hide resolved
insert_pair_into_wire( | ||
RELATION_WIDE_LIMBS_RANGE_CONSTRAINT_3, low_relation_microlimbs[3], high_relation_microlimbs[3]); | ||
|
||
// Next ones go into top P_x and P_y, current accumulator and quotient unused microlimbs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a typo or a missing word here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate?
...berg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp
Show resolved
Hide resolved
static constexpr auto MAX_MICRO_LIMB_SIZE = (uint256_t(1) << MICRO_LIMB_BITS) - 1; | ||
|
||
// To range constrain a limb to 68 bits we need 6 limbs: 5 for 14-bit windowed chunks and 1 to range constrain the | ||
// highest to a more restrictive range (0 <= a < 2¹⁴ && 0 <= 4*a < 2¹⁴ ) ~ ( 0 <= a < 2¹² ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment makes sense to me but the comparison expressions are confusing. Is there a typo here? I cant make sense of constraing a to 14 bits then also 4a to 14 bits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imagine, you have a range constraint that ensures all values are in range {0,1,2,3,4,5,6,7}, but you want to range constrain to {0,1}. What you do is range constrain a to [0-7] and then range constrain 4*a to [0-7]. Then a can only be {0,1}
...berg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp
Show resolved
Hide resolved
auto [quotient_0, quotient_1, quotient_2, quotient_3, quotient_prime] = uint512_t_to_bigfield(quotient); | ||
std::array<Fr, 5> quotient_witnesses = { quotient_0, quotient_1, quotient_2, quotient_3, quotient_prime }; | ||
std::array<Fr, NUM_BINARY_LIMBS> quotient_witnesses = { quotient_0, quotient_1, quotient_2, quotient_3 }; | ||
|
||
// We will divide by shift_2 instantly in the relation itself, but first we need to compute the low part (0*0) and | ||
// the high part (0*1, 1*0) multiplied by a signle limb shift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what these expressions are doing is not so complicated but they're fairly hard to read/check. I wonder if some combination of breaking them up into smaller components plus adding more comments would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a bit more in places, but I am not sure how to expand this
...berg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.cpp
Outdated
Show resolved
Hide resolved
4b0b196
to
2f7d21a
Compare
Benchmark resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Values are compared against data from master at commit L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 16 txs.
Circuits statsStats on running time and I/O sizes collected for every circuit run across all benchmarks.
MiscellaneousTransaction sizes based on how many contracts are deployed in the tx.
|
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.8.11</summary> ## [0.8.11](aztec-packages-v0.8.10...aztec-packages-v0.8.11) (2023-10-13) ### Features * **archiver:** Use registry to fetch searchStartBlock ([#2830](#2830)) ([e5bc067](e5bc067)) * Configure sandbox for network ([#2818](#2818)) ([d393a59](d393a59)) * **docker-sandbox:** Allow forks in sandbox ([#2831](#2831)) ([ed8431c](ed8431c)), closes [#2726](#2726) * Goblin Translator Decomposition relation (Goblin Translator part 4) ([#2802](#2802)) ([3c3cd9f](3c3cd9f)) * Goblin Translator GenPermSort relation (Goblin Translator part 3) ([#2795](#2795)) ([b36fdc4](b36fdc4)) * Goblin translator opcode constraint and accumulator transfer relations (Goblin Translator part 5) ([#2805](#2805)) ([b3d1f28](b3d1f28)) * Goblin Translator Permutation relation (Goblin Translator part 2) ([#2790](#2790)) ([9a354c9](9a354c9)) * Integrate ZeroMorph into Honk ([#2774](#2774)) ([ea86869](ea86869)) * Purge non native token + reorder params in token portal ([#2723](#2723)) ([447dade](447dade)) * Throw compile error if read/write public state from private ([#2804](#2804)) ([a3649df](a3649df)) * Unencrypted log filtering ([#2600](#2600)) ([7ae554a](7ae554a)), closes [#1498](#1498) [#1500](#1500) * Update goblin translator circuit builder (Goblin Translator part 1) ([#2764](#2764)) ([32c69ae](32c69ae)) ### Bug Fixes * Outdated `noir:clean` ([#2821](#2821)) ([2ea199f](2ea199f)) ### Miscellaneous * Benchmark tx sizes in p2p pool ([#2810](#2810)) ([f63219c](f63219c)) * Change acir_tests branch to point to master ([#2815](#2815)) ([73f229d](73f229d)) * Fix typo ([#2839](#2839)) ([5afdf91](5afdf91)) * From < genesis allowed in getBlocks ([#2816](#2816)) ([5622b50](5622b50)) * Remove Ultra Grumpkin flavor ([#2825](#2825)) ([bde77b8](bde77b8)) * Remove work queue from honk ([#2814](#2814)) ([bca7d12](bca7d12)) * Spell check ([#2817](#2817)) ([4777a11](4777a11)) ### Documentation * Slight changes to update portal page ([#2799](#2799)) ([eb65819](eb65819)) * Update aztec_connect_sunset.mdx ([#2808](#2808)) ([5f659a7](5f659a7)) </details> <details><summary>barretenberg.js: 0.8.11</summary> ## [0.8.11](barretenberg.js-v0.8.10...barretenberg.js-v0.8.11) (2023-10-13) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>barretenberg: 0.8.11</summary> ## [0.8.11](barretenberg-v0.8.10...barretenberg-v0.8.11) (2023-10-13) ### Features * Goblin Translator Decomposition relation (Goblin Translator part 4) ([#2802](#2802)) ([3c3cd9f](3c3cd9f)) * Goblin Translator GenPermSort relation (Goblin Translator part 3) ([#2795](#2795)) ([b36fdc4](b36fdc4)) * Goblin translator opcode constraint and accumulator transfer relations (Goblin Translator part 5) ([#2805](#2805)) ([b3d1f28](b3d1f28)) * Goblin Translator Permutation relation (Goblin Translator part 2) ([#2790](#2790)) ([9a354c9](9a354c9)) * Integrate ZeroMorph into Honk ([#2774](#2774)) ([ea86869](ea86869)) * Update goblin translator circuit builder (Goblin Translator part 1) ([#2764](#2764)) ([32c69ae](32c69ae)) ### Miscellaneous * Change acir_tests branch to point to master ([#2815](#2815)) ([73f229d](73f229d)) * Remove Ultra Grumpkin flavor ([#2825](#2825)) ([bde77b8](bde77b8)) * Remove work queue from honk ([#2814](#2814)) ([bca7d12](bca7d12)) * Spell check ([#2817](#2817)) ([4777a11](4777a11)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.8.11</summary> ## [0.8.11](AztecProtocol/aztec-packages@aztec-packages-v0.8.10...aztec-packages-v0.8.11) (2023-10-13) ### Features * **archiver:** Use registry to fetch searchStartBlock ([#2830](AztecProtocol/aztec-packages#2830)) ([e5bc067](AztecProtocol/aztec-packages@e5bc067)) * Configure sandbox for network ([#2818](AztecProtocol/aztec-packages#2818)) ([d393a59](AztecProtocol/aztec-packages@d393a59)) * **docker-sandbox:** Allow forks in sandbox ([#2831](AztecProtocol/aztec-packages#2831)) ([ed8431c](AztecProtocol/aztec-packages@ed8431c)), closes [#2726](AztecProtocol/aztec-packages#2726) * Goblin Translator Decomposition relation (Goblin Translator part 4) ([#2802](AztecProtocol/aztec-packages#2802)) ([3c3cd9f](AztecProtocol/aztec-packages@3c3cd9f)) * Goblin Translator GenPermSort relation (Goblin Translator part 3) ([#2795](AztecProtocol/aztec-packages#2795)) ([b36fdc4](AztecProtocol/aztec-packages@b36fdc4)) * Goblin translator opcode constraint and accumulator transfer relations (Goblin Translator part 5) ([#2805](AztecProtocol/aztec-packages#2805)) ([b3d1f28](AztecProtocol/aztec-packages@b3d1f28)) * Goblin Translator Permutation relation (Goblin Translator part 2) ([#2790](AztecProtocol/aztec-packages#2790)) ([9a354c9](AztecProtocol/aztec-packages@9a354c9)) * Integrate ZeroMorph into Honk ([#2774](AztecProtocol/aztec-packages#2774)) ([ea86869](AztecProtocol/aztec-packages@ea86869)) * Purge non native token + reorder params in token portal ([#2723](AztecProtocol/aztec-packages#2723)) ([447dade](AztecProtocol/aztec-packages@447dade)) * Throw compile error if read/write public state from private ([#2804](AztecProtocol/aztec-packages#2804)) ([a3649df](AztecProtocol/aztec-packages@a3649df)) * Unencrypted log filtering ([#2600](AztecProtocol/aztec-packages#2600)) ([7ae554a](AztecProtocol/aztec-packages@7ae554a)), closes [#1498](AztecProtocol/aztec-packages#1498) [#1500](AztecProtocol/aztec-packages#1500) * Update goblin translator circuit builder (Goblin Translator part 1) ([#2764](AztecProtocol/aztec-packages#2764)) ([32c69ae](AztecProtocol/aztec-packages@32c69ae)) ### Bug Fixes * Outdated `noir:clean` ([#2821](AztecProtocol/aztec-packages#2821)) ([2ea199f](AztecProtocol/aztec-packages@2ea199f)) ### Miscellaneous * Benchmark tx sizes in p2p pool ([#2810](AztecProtocol/aztec-packages#2810)) ([f63219c](AztecProtocol/aztec-packages@f63219c)) * Change acir_tests branch to point to master ([#2815](AztecProtocol/aztec-packages#2815)) ([73f229d](AztecProtocol/aztec-packages@73f229d)) * Fix typo ([#2839](AztecProtocol/aztec-packages#2839)) ([5afdf91](AztecProtocol/aztec-packages@5afdf91)) * From < genesis allowed in getBlocks ([#2816](AztecProtocol/aztec-packages#2816)) ([5622b50](AztecProtocol/aztec-packages@5622b50)) * Remove Ultra Grumpkin flavor ([#2825](AztecProtocol/aztec-packages#2825)) ([bde77b8](AztecProtocol/aztec-packages@bde77b8)) * Remove work queue from honk ([#2814](AztecProtocol/aztec-packages#2814)) ([bca7d12](AztecProtocol/aztec-packages@bca7d12)) * Spell check ([#2817](AztecProtocol/aztec-packages#2817)) ([4777a11](AztecProtocol/aztec-packages@4777a11)) ### Documentation * Slight changes to update portal page ([#2799](AztecProtocol/aztec-packages#2799)) ([eb65819](AztecProtocol/aztec-packages@eb65819)) * Update aztec_connect_sunset.mdx ([#2808](AztecProtocol/aztec-packages#2808)) ([5f659a7](AztecProtocol/aztec-packages@5f659a7)) </details> <details><summary>barretenberg.js: 0.8.11</summary> ## [0.8.11](AztecProtocol/aztec-packages@barretenberg.js-v0.8.10...barretenberg.js-v0.8.11) (2023-10-13) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>barretenberg: 0.8.11</summary> ## [0.8.11](AztecProtocol/aztec-packages@barretenberg-v0.8.10...barretenberg-v0.8.11) (2023-10-13) ### Features * Goblin Translator Decomposition relation (Goblin Translator part 4) ([#2802](AztecProtocol/aztec-packages#2802)) ([3c3cd9f](AztecProtocol/aztec-packages@3c3cd9f)) * Goblin Translator GenPermSort relation (Goblin Translator part 3) ([#2795](AztecProtocol/aztec-packages#2795)) ([b36fdc4](AztecProtocol/aztec-packages@b36fdc4)) * Goblin translator opcode constraint and accumulator transfer relations (Goblin Translator part 5) ([#2805](AztecProtocol/aztec-packages#2805)) ([b3d1f28](AztecProtocol/aztec-packages@b3d1f28)) * Goblin Translator Permutation relation (Goblin Translator part 2) ([#2790](AztecProtocol/aztec-packages#2790)) ([9a354c9](AztecProtocol/aztec-packages@9a354c9)) * Integrate ZeroMorph into Honk ([#2774](AztecProtocol/aztec-packages#2774)) ([ea86869](AztecProtocol/aztec-packages@ea86869)) * Update goblin translator circuit builder (Goblin Translator part 1) ([#2764](AztecProtocol/aztec-packages#2764)) ([32c69ae](AztecProtocol/aztec-packages@32c69ae)) ### Miscellaneous * Change acir_tests branch to point to master ([#2815](AztecProtocol/aztec-packages#2815)) ([73f229d](AztecProtocol/aztec-packages@73f229d)) * Remove Ultra Grumpkin flavor ([#2825](AztecProtocol/aztec-packages#2825)) ([bde77b8](AztecProtocol/aztec-packages@bde77b8)) * Remove work queue from honk ([#2814](AztecProtocol/aztec-packages#2814)) ([bca7d12](AztecProtocol/aztec-packages@bca7d12)) * Spell check ([#2817](AztecProtocol/aztec-packages#2817)) ([4777a11](AztecProtocol/aztec-packages@4777a11)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This PR updates the goblin translator circuit builder to the latest version needed for Goblin Translator proofs. Most of the code is moved from the header to the cpp files and all constraints are being checked in check_circuit
Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.