-
Notifications
You must be signed in to change notification settings - Fork 297
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: Merge SMT Terms in one class #5254
Conversation
STerm: - fixed lots of errors in methods Tests: - fixed old ones to use STerm class - added new tests to check for unsupported functionality
- Switch to field_t native operations - Switch to the new STerm api - Use smt_timer
- removed zero initialization for optimized variables, since it doesn't do anything helpful - fixed logic_flag output - fixed range constraint so it now fits in bitvector size
|
||
// MUL, LSH, RSH, AND and OR are not tested, since they are not bijective | ||
|
||
TEST(BVTerm, unsupported_operations) |
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 does this test do exactly?
uint_ct a = witness_ct(&builder, static_cast<uint32_t>(fr::random_element())); | ||
uint_ct b = witness_ct(&builder, static_cast<uint32_t>(fr::random_element())); | ||
uint_ct c = a + b; | ||
Solver s("30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001", default_solver_config, 16, 32); |
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 are the values 16 and 32?
namespace { | ||
auto& engine = numeric::get_debug_randomness(); | ||
} | ||
|
||
msgpack::sbuffer create_circuit(size_t n, bool pub_coeffs) | ||
msgpack::sbuffer create_polynomial_evaluation_circuit(size_t n, bool pub_coeffs) |
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 do we need this for?
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'm using this function in the two tests below. Since it is quite large, I decided to take it out separately.
std::string bvals = s.getValue(bval.term).getIntegerValue(); | ||
ASSERT_EQ(bvals, yvals); | ||
} | ||
|
||
TEST(FFITerm, unsupported_operations) |
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 does this function do?
std::string bvals = s.getValue(bval.term).getFiniteFieldValue(); | ||
ASSERT_EQ(bvals, yvals); | ||
} | ||
|
||
TEST(FFTerm, unsupported_operations) |
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 does this function do?
*/ | ||
STerm STerm::operator/(const STerm& other) const | ||
{ | ||
if (!this->operations.contains(OpType::DIV)) { |
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.
Uhm. Why can't you replace it with multilication and non-zero?
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.
Because of BitVectors. They are not supposed to be divided by each other(well at least not like the real division, truncated - maybe. At least for now they are not)
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.
Please address my comments
Benchmark resultsNo metrics with a significant change found. 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 contract classes are registered in the tx.
Transaction processing duration by data writes.
|
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.30.1</summary> ## [0.30.1](aztec-package-v0.30.0...aztec-package-v0.30.1) (2024-03-20) ### Miscellaneous * **aztec-package:** Synchronize aztec-packages versions </details> <details><summary>barretenberg.js: 0.30.1</summary> ## [0.30.1](barretenberg.js-v0.30.0...barretenberg.js-v0.30.1) (2024-03-20) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-cli: 0.30.1</summary> ## [0.30.1](aztec-cli-v0.30.0...aztec-cli-v0.30.1) (2024-03-20) ### Miscellaneous * **aztec-cli:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.30.1</summary> ## [0.30.1](aztec-packages-v0.30.0...aztec-packages-v0.30.1) (2024-03-20) ### Features * Add CMOV instruction to brillig and brillig gen ([#5308](#5308)) ([208abbb](208abbb)) * **avm:** Indirect memory support for arithmetic/bitwise opcodes ([#5328](#5328)) ([d5ffa17](d5ffa17)), closes [#5273](#5273) * **avm:** Indirect memory support for MOV ([#5257](#5257)) ([10ef970](10ef970)), closes [#5205](#5205) * Merge SMT Terms in one class ([#5254](#5254)) ([f5c9b0f](f5c9b0f)) * Sorted execution trace ([#5252](#5252)) ([a216759](a216759)) ### Bug Fixes * Fix recursion tests and reinstate in CI ([#5300](#5300)) ([96c6f21](96c6f21)) * Skip uniswap l1 tests ([#5334](#5334)) ([7a56941](7a56941)) * Update smt_verification README.md ([#5332](#5332)) ([46b15e3](46b15e3)) ### Miscellaneous * Avm team as generated codeowners ([#5325](#5325)) ([06d2786](06d2786)) * No Translator composer ([#5202](#5202)) ([c8897ca](c8897ca)) * Remove toy vm files ([#5326](#5326)) ([d940356](d940356)) * Replace relative paths to noir-protocol-circuits ([ea2ac09](ea2ac09)) </details> <details><summary>barretenberg: 0.30.1</summary> ## [0.30.1](barretenberg-v0.30.0...barretenberg-v0.30.1) (2024-03-20) ### Features * Add CMOV instruction to brillig and brillig gen ([#5308](#5308)) ([208abbb](208abbb)) * **avm:** Indirect memory support for arithmetic/bitwise opcodes ([#5328](#5328)) ([d5ffa17](d5ffa17)), closes [#5273](#5273) * **avm:** Indirect memory support for MOV ([#5257](#5257)) ([10ef970](10ef970)), closes [#5205](#5205) * Merge SMT Terms in one class ([#5254](#5254)) ([f5c9b0f](f5c9b0f)) * Sorted execution trace ([#5252](#5252)) ([a216759](a216759)) ### Bug Fixes * Fix recursion tests and reinstate in CI ([#5300](#5300)) ([96c6f21](96c6f21)) * Update smt_verification README.md ([#5332](#5332)) ([46b15e3](46b15e3)) ### Miscellaneous * No Translator composer ([#5202](#5202)) ([c8897ca](c8897ca)) * Remove toy vm files ([#5326](#5326)) ([d940356](d940356)) </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.30.1</summary> ## [0.30.1](AztecProtocol/aztec-packages@aztec-package-v0.30.0...aztec-package-v0.30.1) (2024-03-20) ### Miscellaneous * **aztec-package:** Synchronize aztec-packages versions </details> <details><summary>barretenberg.js: 0.30.1</summary> ## [0.30.1](AztecProtocol/aztec-packages@barretenberg.js-v0.30.0...barretenberg.js-v0.30.1) (2024-03-20) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-cli: 0.30.1</summary> ## [0.30.1](AztecProtocol/aztec-packages@aztec-cli-v0.30.0...aztec-cli-v0.30.1) (2024-03-20) ### Miscellaneous * **aztec-cli:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.30.1</summary> ## [0.30.1](AztecProtocol/aztec-packages@aztec-packages-v0.30.0...aztec-packages-v0.30.1) (2024-03-20) ### Features * Add CMOV instruction to brillig and brillig gen ([#5308](AztecProtocol/aztec-packages#5308)) ([208abbb](AztecProtocol/aztec-packages@208abbb)) * **avm:** Indirect memory support for arithmetic/bitwise opcodes ([#5328](AztecProtocol/aztec-packages#5328)) ([d5ffa17](AztecProtocol/aztec-packages@d5ffa17)), closes [#5273](AztecProtocol/aztec-packages#5273) * **avm:** Indirect memory support for MOV ([#5257](AztecProtocol/aztec-packages#5257)) ([10ef970](AztecProtocol/aztec-packages@10ef970)), closes [#5205](AztecProtocol/aztec-packages#5205) * Merge SMT Terms in one class ([#5254](AztecProtocol/aztec-packages#5254)) ([f5c9b0f](AztecProtocol/aztec-packages@f5c9b0f)) * Sorted execution trace ([#5252](AztecProtocol/aztec-packages#5252)) ([a216759](AztecProtocol/aztec-packages@a216759)) ### Bug Fixes * Fix recursion tests and reinstate in CI ([#5300](AztecProtocol/aztec-packages#5300)) ([96c6f21](AztecProtocol/aztec-packages@96c6f21)) * Skip uniswap l1 tests ([#5334](AztecProtocol/aztec-packages#5334)) ([7a56941](AztecProtocol/aztec-packages@7a56941)) * Update smt_verification README.md ([#5332](AztecProtocol/aztec-packages#5332)) ([46b15e3](AztecProtocol/aztec-packages@46b15e3)) ### Miscellaneous * Avm team as generated codeowners ([#5325](AztecProtocol/aztec-packages#5325)) ([06d2786](AztecProtocol/aztec-packages@06d2786)) * No Translator composer ([#5202](AztecProtocol/aztec-packages#5202)) ([c8897ca](AztecProtocol/aztec-packages@c8897ca)) * Remove toy vm files ([#5326](AztecProtocol/aztec-packages#5326)) ([d940356](AztecProtocol/aztec-packages@d940356)) * Replace relative paths to noir-protocol-circuits ([ea2ac09](AztecProtocol/aztec-packages@ea2ac09)) </details> <details><summary>barretenberg: 0.30.1</summary> ## [0.30.1](AztecProtocol/aztec-packages@barretenberg-v0.30.0...barretenberg-v0.30.1) (2024-03-20) ### Features * Add CMOV instruction to brillig and brillig gen ([#5308](AztecProtocol/aztec-packages#5308)) ([208abbb](AztecProtocol/aztec-packages@208abbb)) * **avm:** Indirect memory support for arithmetic/bitwise opcodes ([#5328](AztecProtocol/aztec-packages#5328)) ([d5ffa17](AztecProtocol/aztec-packages@d5ffa17)), closes [#5273](AztecProtocol/aztec-packages#5273) * **avm:** Indirect memory support for MOV ([#5257](AztecProtocol/aztec-packages#5257)) ([10ef970](AztecProtocol/aztec-packages@10ef970)), closes [#5205](AztecProtocol/aztec-packages#5205) * Merge SMT Terms in one class ([#5254](AztecProtocol/aztec-packages#5254)) ([f5c9b0f](AztecProtocol/aztec-packages@f5c9b0f)) * Sorted execution trace ([#5252](AztecProtocol/aztec-packages#5252)) ([a216759](AztecProtocol/aztec-packages@a216759)) ### Bug Fixes * Fix recursion tests and reinstate in CI ([#5300](AztecProtocol/aztec-packages#5300)) ([96c6f21](AztecProtocol/aztec-packages@96c6f21)) * Update smt_verification README.md ([#5332](AztecProtocol/aztec-packages#5332)) ([46b15e3](AztecProtocol/aztec-packages@46b15e3)) ### Miscellaneous * No Translator composer ([#5202](AztecProtocol/aztec-packages#5202)) ([c8897ca](AztecProtocol/aztec-packages@c8897ca)) * Remove toy vm files ([#5326](AztecProtocol/aztec-packages#5326)) ([d940356](AztecProtocol/aztec-packages@d940356)) </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 brings major changes in symbolic terms usage.
STerm
A new class that is merged from
FFTerm
andFFITerm
classes. Now you can useFFTerm
orFFITerm
by providing aTermType::FFTerm
orTermType::FFITerm
toSTerm
constructor.All the operations are now stored in
unordered_map<OpType, cvc5::Kind> operations
. e.g. if the type isFFTerm
, thenoperations[OpType::ADD] = cvc5::Kind::FINITE_FIELD_ADD
, andoperations[OpType::ADD] = cvc5::Kind::ADD
forFFITerm
Also now you can use new
BVTerm
type. It can be used to solve constraints with lots of bitwise operations. However, it can be used only once all the optimizations are added. You simply can't use it to simulate finite field operations and it's not really optimal.Symbolic variables can be initialized using new functions
FFVar
,FFIVar
andBVVar
Solver
Added
bv_sort
memberAdded bitvector operations parser to
stringify_term
Circuit
No more templates. All the circuit methods are moved to .cpp file
Fixes:
<= 2^n - 1
instead of< 2^n
xor_gate
tologic_gate
ininfo
functionUtils
smt_timer
now hasbool mins
param, that tells in what format to output elapsed time