-
Notifications
You must be signed in to change notification settings - Fork 234
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 the core of SMT Circuit class #5096
Conversation
… integers/bitvectors
- New member of CircuitSchema: real_variable_index - New member of Circuit class: variable_names_inverse - Changed add_gates method to prepare_gates which works a little bit different - Added new function unique_witness and renamed old unique_witness
CircuitSchema& circuit_info, | ||
Solver* s, | ||
const std::vector<std::string>& equal = {}, | ||
const std::vector<std::string>& not_equal = {}, | ||
const std::vector<std::string>& equal_at_the_same_time = {}, | ||
const std::vector<std::string>& not_eqaul_at_the_same_time = {}); | ||
|
||
/** | ||
* @brief Check your circuit for witness uniqness |
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.
Typo. uniqueness
using namespace smt_circuit_schema; | ||
|
||
CircuitSchema get_standard_range_constraint_circuit(size_t n); | ||
CircuitSchema get_standard_logic_circuit(size_t n, bool is_xor); |
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.
What is the purpose of these functions?
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.
They will be used in further constraint system relaxation
|
||
namespace smt_circuit_schema { | ||
|
||
struct CircuitSchema { |
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.
Would be nice if there was a description of what this is used for
|
||
/** | ||
* @brief Translates the schema to python format | ||
* @details Returns the conetents of the .py file |
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.
Typo "contents"
|
||
/** | ||
* @brief Get the CircuitSchema object | ||
* @details Initialize the CircuitSchmea from the binary file |
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.
Typo (CircuitSchema)
fin.seekg(0, std::ios_base::beg); | ||
|
||
CircuitSchema cir; | ||
char* encoded_data = (char*)aligned_alloc(64, static_cast<size_t>(fsize)); |
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.
This will fail if filesize is not a multiple of 64
CircuitSchema unpack_from_buffer(const msgpack::sbuffer& buf); | ||
CircuitSchema unpack_from_file(const std::string& fname); | ||
template <typename FF> | ||
std::pair<Circuit<FF>, Circuit<FF>> unique_witness_ext(CircuitSchema& circuit_info, |
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.
A description would really help 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.
Should I move it from .cpp file 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.
If it's in cpp file, it's ok. I must have missed it
Benchmark resultsMetrics with a significant change:
Detailed 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.
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contracts are deployed in the tx.
Transaction processing duration by data writes.
|
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.27.0</summary> ## [0.27.0](aztec-package-v0.26.6...aztec-package-v0.27.0) (2024-03-12) ### Features * Add api for inclusion proof of outgoing message in block [#4562](#4562) ([#4899](#4899)) ([26d2643](26d2643)) ### Miscellaneous * Pin foundry ([#5151](#5151)) ([69bd7dd](69bd7dd)) * Remove old contract deployment flow ([#4970](#4970)) ([6d15947](6d15947)) </details> <details><summary>barretenberg.js: 0.27.0</summary> ## [0.27.0](barretenberg.js-v0.26.6...barretenberg.js-v0.27.0) (2024-03-12) ### Miscellaneous * Move alpine containers to ubuntu ([#5026](#5026)) ([d483e67](d483e67)), closes [#4708](#4708) </details> <details><summary>aztec-cli: 0.27.0</summary> ## [0.27.0](aztec-cli-v0.26.6...aztec-cli-v0.27.0) (2024-03-12) ### Miscellaneous * Remove old contract deployment flow ([#4970](#4970)) ([6d15947](6d15947)) </details> <details><summary>aztec-packages: 0.27.0</summary> ## [0.27.0](aztec-packages-v0.26.6...aztec-packages-v0.27.0) (2024-03-12) ### ⚠ BREAKING CHANGES * Remove open keyword from Noir ([#4967](#4967)) ### Features * Add api for inclusion proof of outgoing message in block [#4562](#4562) ([#4899](#4899)) ([26d2643](26d2643)) * **avm-simulator:** External calls + integration ([#5051](#5051)) ([dde33f4](dde33f4)) * **avm-simulator:** External static calls + integration ([#5089](#5089)) ([428d950](428d950)) * **avm:** Equivalence check between Main trace and Mem trace ([#5032](#5032)) ([7f216eb](7f216eb)), closes [#4955](#4955) * **avm:** Fix some Brillig problems ([#5091](#5091)) ([07dd821](07dd821)) * Initial integration avm prover ([#4878](#4878)) ([2e2554e](2e2554e)) * Noir pull action ([#5062](#5062)) ([b2d7d14](b2d7d14)) * Restore contract inclusion proofs ([#5141](#5141)) ([a39cd61](a39cd61)) * Update the core of SMT Circuit class ([#5096](#5096)) ([1519d3b](1519d3b)) * Updating archiver with new inbox ([#5025](#5025)) ([f6d17c9](f6d17c9)), closes [#4828](#4828) ### Bug Fixes * Duplicate factory code temporarily to unblock ([#5099](#5099)) ([8b10600](8b10600)) * Remove hard coded canonical gas address ([#5106](#5106)) ([dc2fd9e](dc2fd9e)) ### Miscellaneous * **avm-simulator:** Enable compressed strings unencrypted log test ([#5083](#5083)) ([8f7519b](8f7519b)) * **avm-simulator:** Formatting and fixes ([#5092](#5092)) ([b3fa084](b3fa084)) * **AVM:** Negative unit tests for inter table relations ([#5143](#5143)) ([a74dccb](a74dccb)), closes [#5033](#5033) * Aztec-macros refactor ([#5127](#5127)) ([2195441](2195441)) * **ci:** Fail on clippy warnings in noir ([#5101](#5101)) ([54af648](54af648)) * Extract bb binary in bs fast ([#5128](#5128)) ([9ca41ef](9ca41ef)) * Increase bytecode size limit ([#5098](#5098)) ([53b2381](53b2381)) * Increase permitted bytecode size ([#5136](#5136)) ([6865c34](6865c34)) * Join-split example Part 2 ([#5016](#5016)) ([0718320](0718320)) * Move alpine containers to ubuntu ([#5026](#5026)) ([d483e67](d483e67)), closes [#4708](#4708) * Nicer snapshots ([#5133](#5133)) ([9a737eb](9a737eb)) * Pin foundry ([#5151](#5151)) ([69bd7dd](69bd7dd)) * Remove old contract deployment flow ([#4970](#4970)) ([6d15947](6d15947)) * Remove open keyword from Noir ([#4967](#4967)) ([401557e](401557e)) * Run nargo fmt on each nargo project ([#5102](#5102)) ([b327254](b327254)) * Use context interface in mark-as-initialized ([#5142](#5142)) ([932c1d5](932c1d5)) </details> <details><summary>barretenberg: 0.27.0</summary> ## [0.27.0](barretenberg-v0.26.6...barretenberg-v0.27.0) (2024-03-12) ### Features * **avm:** Equivalence check between Main trace and Mem trace ([#5032](#5032)) ([7f216eb](7f216eb)), closes [#4955](#4955) * Initial integration avm prover ([#4878](#4878)) ([2e2554e](2e2554e)) * Update the core of SMT Circuit class ([#5096](#5096)) ([1519d3b](1519d3b)) ### Miscellaneous * **AVM:** Negative unit tests for inter table relations ([#5143](#5143)) ([a74dccb](a74dccb)), closes [#5033](#5033) * Extract bb binary in bs fast ([#5128](#5128)) ([9ca41ef](9ca41ef)) * Join-split example Part 2 ([#5016](#5016)) ([0718320](0718320)) * Move alpine containers to ubuntu ([#5026](#5026)) ([d483e67](d483e67)), closes [#4708](#4708) * Pin foundry ([#5151](#5151)) ([69bd7dd](69bd7dd)) </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-package: 0.27.0</summary> ## [0.27.0](AztecProtocol/aztec-packages@aztec-package-v0.26.6...aztec-package-v0.27.0) (2024-03-12) ### Features * Add api for inclusion proof of outgoing message in block [#4562](AztecProtocol/aztec-packages#4562) ([#4899](AztecProtocol/aztec-packages#4899)) ([26d2643](AztecProtocol/aztec-packages@26d2643)) ### Miscellaneous * Pin foundry ([#5151](AztecProtocol/aztec-packages#5151)) ([69bd7dd](AztecProtocol/aztec-packages@69bd7dd)) * Remove old contract deployment flow ([#4970](AztecProtocol/aztec-packages#4970)) ([6d15947](AztecProtocol/aztec-packages@6d15947)) </details> <details><summary>barretenberg.js: 0.27.0</summary> ## [0.27.0](AztecProtocol/aztec-packages@barretenberg.js-v0.26.6...barretenberg.js-v0.27.0) (2024-03-12) ### Miscellaneous * Move alpine containers to ubuntu ([#5026](AztecProtocol/aztec-packages#5026)) ([d483e67](AztecProtocol/aztec-packages@d483e67)), closes [#4708](AztecProtocol/aztec-packages#4708) </details> <details><summary>aztec-cli: 0.27.0</summary> ## [0.27.0](AztecProtocol/aztec-packages@aztec-cli-v0.26.6...aztec-cli-v0.27.0) (2024-03-12) ### Miscellaneous * Remove old contract deployment flow ([#4970](AztecProtocol/aztec-packages#4970)) ([6d15947](AztecProtocol/aztec-packages@6d15947)) </details> <details><summary>aztec-packages: 0.27.0</summary> ## [0.27.0](AztecProtocol/aztec-packages@aztec-packages-v0.26.6...aztec-packages-v0.27.0) (2024-03-12) ### ⚠ BREAKING CHANGES * Remove open keyword from Noir ([#4967](AztecProtocol/aztec-packages#4967)) ### Features * Add api for inclusion proof of outgoing message in block [#4562](AztecProtocol/aztec-packages#4562) ([#4899](AztecProtocol/aztec-packages#4899)) ([26d2643](AztecProtocol/aztec-packages@26d2643)) * **avm-simulator:** External calls + integration ([#5051](AztecProtocol/aztec-packages#5051)) ([dde33f4](AztecProtocol/aztec-packages@dde33f4)) * **avm-simulator:** External static calls + integration ([#5089](AztecProtocol/aztec-packages#5089)) ([428d950](AztecProtocol/aztec-packages@428d950)) * **avm:** Equivalence check between Main trace and Mem trace ([#5032](AztecProtocol/aztec-packages#5032)) ([7f216eb](AztecProtocol/aztec-packages@7f216eb)), closes [#4955](AztecProtocol/aztec-packages#4955) * **avm:** Fix some Brillig problems ([#5091](AztecProtocol/aztec-packages#5091)) ([07dd821](AztecProtocol/aztec-packages@07dd821)) * Initial integration avm prover ([#4878](AztecProtocol/aztec-packages#4878)) ([2e2554e](AztecProtocol/aztec-packages@2e2554e)) * Noir pull action ([#5062](AztecProtocol/aztec-packages#5062)) ([b2d7d14](AztecProtocol/aztec-packages@b2d7d14)) * Restore contract inclusion proofs ([#5141](AztecProtocol/aztec-packages#5141)) ([a39cd61](AztecProtocol/aztec-packages@a39cd61)) * Update the core of SMT Circuit class ([#5096](AztecProtocol/aztec-packages#5096)) ([1519d3b](AztecProtocol/aztec-packages@1519d3b)) * Updating archiver with new inbox ([#5025](AztecProtocol/aztec-packages#5025)) ([f6d17c9](AztecProtocol/aztec-packages@f6d17c9)), closes [#4828](AztecProtocol/aztec-packages#4828) ### Bug Fixes * Duplicate factory code temporarily to unblock ([#5099](AztecProtocol/aztec-packages#5099)) ([8b10600](AztecProtocol/aztec-packages@8b10600)) * Remove hard coded canonical gas address ([#5106](AztecProtocol/aztec-packages#5106)) ([dc2fd9e](AztecProtocol/aztec-packages@dc2fd9e)) ### Miscellaneous * **avm-simulator:** Enable compressed strings unencrypted log test ([#5083](AztecProtocol/aztec-packages#5083)) ([8f7519b](AztecProtocol/aztec-packages@8f7519b)) * **avm-simulator:** Formatting and fixes ([#5092](AztecProtocol/aztec-packages#5092)) ([b3fa084](AztecProtocol/aztec-packages@b3fa084)) * **AVM:** Negative unit tests for inter table relations ([#5143](AztecProtocol/aztec-packages#5143)) ([a74dccb](AztecProtocol/aztec-packages@a74dccb)), closes [#5033](AztecProtocol/aztec-packages#5033) * Aztec-macros refactor ([#5127](AztecProtocol/aztec-packages#5127)) ([2195441](AztecProtocol/aztec-packages@2195441)) * **ci:** Fail on clippy warnings in noir ([#5101](AztecProtocol/aztec-packages#5101)) ([54af648](AztecProtocol/aztec-packages@54af648)) * Extract bb binary in bs fast ([#5128](AztecProtocol/aztec-packages#5128)) ([9ca41ef](AztecProtocol/aztec-packages@9ca41ef)) * Increase bytecode size limit ([#5098](AztecProtocol/aztec-packages#5098)) ([53b2381](AztecProtocol/aztec-packages@53b2381)) * Increase permitted bytecode size ([#5136](AztecProtocol/aztec-packages#5136)) ([6865c34](AztecProtocol/aztec-packages@6865c34)) * Join-split example Part 2 ([#5016](AztecProtocol/aztec-packages#5016)) ([0718320](AztecProtocol/aztec-packages@0718320)) * Move alpine containers to ubuntu ([#5026](AztecProtocol/aztec-packages#5026)) ([d483e67](AztecProtocol/aztec-packages@d483e67)), closes [#4708](AztecProtocol/aztec-packages#4708) * Nicer snapshots ([#5133](AztecProtocol/aztec-packages#5133)) ([9a737eb](AztecProtocol/aztec-packages@9a737eb)) * Pin foundry ([#5151](AztecProtocol/aztec-packages#5151)) ([69bd7dd](AztecProtocol/aztec-packages@69bd7dd)) * Remove old contract deployment flow ([#4970](AztecProtocol/aztec-packages#4970)) ([6d15947](AztecProtocol/aztec-packages@6d15947)) * Remove open keyword from Noir ([#4967](AztecProtocol/aztec-packages#4967)) ([401557e](AztecProtocol/aztec-packages@401557e)) * Run nargo fmt on each nargo project ([#5102](AztecProtocol/aztec-packages#5102)) ([b327254](AztecProtocol/aztec-packages@b327254)) * Use context interface in mark-as-initialized ([#5142](AztecProtocol/aztec-packages#5142)) ([932c1d5](AztecProtocol/aztec-packages@932c1d5)) </details> <details><summary>barretenberg: 0.27.0</summary> ## [0.27.0](AztecProtocol/aztec-packages@barretenberg-v0.26.6...barretenberg-v0.27.0) (2024-03-12) ### Features * **avm:** Equivalence check between Main trace and Mem trace ([#5032](AztecProtocol/aztec-packages#5032)) ([7f216eb](AztecProtocol/aztec-packages@7f216eb)), closes [#4955](AztecProtocol/aztec-packages#4955) * Initial integration avm prover ([#4878](AztecProtocol/aztec-packages#4878)) ([2e2554e](AztecProtocol/aztec-packages@2e2554e)) * Update the core of SMT Circuit class ([#5096](AztecProtocol/aztec-packages#5096)) ([1519d3b](AztecProtocol/aztec-packages@1519d3b)) ### Miscellaneous * **AVM:** Negative unit tests for inter table relations ([#5143](AztecProtocol/aztec-packages#5143)) ([a74dccb](AztecProtocol/aztec-packages@a74dccb)), closes [#5033](AztecProtocol/aztec-packages#5033) * Extract bb binary in bs fast ([#5128](AztecProtocol/aztec-packages#5128)) ([9ca41ef](AztecProtocol/aztec-packages@9ca41ef)) * Join-split example Part 2 ([#5016](AztecProtocol/aztec-packages#5016)) ([0718320](AztecProtocol/aztec-packages@0718320)) * Move alpine containers to ubuntu ([#5026](AztecProtocol/aztec-packages#5026)) ([d483e67](AztecProtocol/aztec-packages@d483e67)), closes [#4708](AztecProtocol/aztec-packages#4708) * Pin foundry ([#5151](AztecProtocol/aztec-packages#5151)) ([69bd7dd](AztecProtocol/aztec-packages@69bd7dd)) </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 massively updates the Circuit class and does a little refactoring to corresponding c++ files
circuit_schema
Moved CircuitSchema structure and the corresponding function to the separate file
Fixed the
read_from_file
function.subcircuits
These files will contain calls to the circuitbuilder to get the basic constraints for native operations(like +, ^ for uints). They will be used to relax the constraint system when working with Integers or BitVectors
Circuit and standard circuit builder
New member of CircuitSchema and Circuit: real_variable_index. Previously all the variables(even copied ones) were passed into solver and it lead to unreliable results. Won't happen anymore.
New member of Circuit: variable_names_inverse. Helps to identify existing named variables
add_gates()
method now renamed toprepare_gates()
and behaves differently. Going to include optimizations from subcircuits.New function
unique_witness
Previous
unique_witness
was renamed tounique_witness_ext
since it's the extended version of the new one. It has more flexible inputs.