Skip to content

fix: smt_verification: negative bitvecs, changed gates indicies. acir_formal_proofs: noir-style signed division#11649

Merged
defkit merged 14 commits intomasterfrom
sn/fix_negative_bv_values
Feb 11, 2025
Merged

fix: smt_verification: negative bitvecs, changed gates indicies. acir_formal_proofs: noir-style signed division#11649
defkit merged 14 commits intomasterfrom
sn/fix_negative_bv_values

Conversation

@defkit
Copy link
Contributor

@defkit defkit commented Jan 31, 2025

This pr fixes two issues in smt_verification and adds one feautre to acir_formal_proofs

  1. Previously negative values bitvectors were not parsed properly.
  2. Indices of selectors changed in ultra

for acir_formal_proofs added noir-style signed division, where first bit of number is sign of the number

@defkit defkit requested a review from Sarkoxed January 31, 2025 11:40
@defkit defkit changed the title fix: Fix negative values in BVTerms of smt_solver fix: smt_verification: negative bitvecs, changed gates indicies. acir_formal_proofs: noir-style signed division Feb 3, 2025
// add gate in its normal state to solver

size_t arith_cursor = 0;
while (arith_cursor < this->selectors[1].size()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an entry to ultra_circuit.hpp with the changed indices

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the pow2_8, you should use bit_extraction rather then direct & 1 value

// 2^64 - 1
auto mask = smt_terms::BVConst("18446744073709551615", solver, 10);
auto res = shifted & mask;
/*auto mask = smt_terms::BVConst("18446744073709551615", solver, 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these comments necessary?

@Sarkoxed Sarkoxed added the product-security PRs extending our security mechanisms label Feb 5, 2025

TEST(helpers, signed_div_2)
{
// using smt solver i found that 1879048194 >> 16 == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find out why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was bug in my implementation

return { res, this->solver, this->type };
}

STerm STerm::truncate(const uint32_t& to_size)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a test and update README.md with these new methods?

@defkit defkit requested a review from Sarkoxed February 11, 2025 11:30
*/
TEST(helpers, shl)
{
Solver s("30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001", default_solver_config, 16, 32);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the comments like , /*base=*/ 16, /*bvsize=*/32

@defkit defkit requested a review from Sarkoxed February 11, 2025 11:50
Copy link
Contributor

@Sarkoxed Sarkoxed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@defkit defkit merged commit 4146496 into master Feb 11, 2025
25 checks passed
@defkit defkit deleted the sn/fix_negative_bv_values branch February 11, 2025 12:35
sklppy88 pushed a commit that referenced this pull request Feb 11, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.76.2</summary>

##
[0.76.2](aztec-package-v0.76.1...aztec-package-v0.76.2)
(2025-02-11)


### Miscellaneous

* **logging:** Support explicit FORCE_COLOR parameter
([#11902](#11902))
([3b3f859](3b3f859))
</details>

<details><summary>barretenberg.js: 0.76.2</summary>

##
[0.76.2](barretenberg.js-v0.76.1...barretenberg.js-v0.76.2)
(2025-02-11)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.76.2</summary>

##
[0.76.2](aztec-packages-v0.76.1...aztec-packages-v0.76.2)
(2025-02-11)


### Features

* Batch writes to the proving broker database
([#11900](#11900))
([608f887](608f887))


### Bug Fixes

* Cleanup also post test_kind.sh
([#11886](#11886))
([50cdb15](50cdb15))
* Dont skip wasm civc tests
([#11909](#11909))
([0395e0b](0395e0b))
* Note hash collision
([#11869](#11869))
([f289b7c](f289b7c))
* Orchestrator test
([#11901](#11901))
([f1bb51c](f1bb51c))
* Smt_verification: negative bitvecs, changed gates indicies.
acir_formal_proofs: noir-style signed division
([#11649](#11649))
([4146496](4146496))
* Update path of stern logs
([#11906](#11906))
([05afb5b](05afb5b))


### Miscellaneous

* Arm runner start fix
([#11903](#11903))
([6c83c40](6c83c40))
* Fixing the sizes of VMs in CIVC
([#11793](#11793))
([1afddbd](1afddbd))
* **logging:** Support explicit FORCE_COLOR parameter
([#11902](#11902))
([3b3f859](3b3f859))
* Misc fixes to devnet deploy flow
([#11738](#11738))
([bc4cca7](bc4cca7))
* Remove warnings from noir protocol circuits
([#11803](#11803))
([c6cc3d3](c6cc3d3))
* Replace relative paths to noir-protocol-circuits
([74d6e6a](74d6e6a))
* Replacing use of capsules 1.0 with pxe_db + nuking capsules 1.0
([#11885](#11885))
([72be678](72be678))
</details>

<details><summary>barretenberg: 0.76.2</summary>

##
[0.76.2](barretenberg-v0.76.1...barretenberg-v0.76.2)
(2025-02-11)


### Bug Fixes

* Note hash collision
([#11869](#11869))
([f289b7c](f289b7c))
* Smt_verification: negative bitvecs, changed gates indicies.
acir_formal_proofs: noir-style signed division
([#11649](#11649))
([4146496](4146496))


### Miscellaneous

* Fixing the sizes of VMs in CIVC
([#11793](#11793))
([1afddbd](1afddbd))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Feb 12, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.76.2</summary>

##
[0.76.2](AztecProtocol/aztec-packages@aztec-package-v0.76.1...aztec-package-v0.76.2)
(2025-02-11)


### Miscellaneous

* **logging:** Support explicit FORCE_COLOR parameter
([#11902](AztecProtocol/aztec-packages#11902))
([3b3f859](AztecProtocol/aztec-packages@3b3f859))
</details>

<details><summary>barretenberg.js: 0.76.2</summary>

##
[0.76.2](AztecProtocol/aztec-packages@barretenberg.js-v0.76.1...barretenberg.js-v0.76.2)
(2025-02-11)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.76.2</summary>

##
[0.76.2](AztecProtocol/aztec-packages@aztec-packages-v0.76.1...aztec-packages-v0.76.2)
(2025-02-11)


### Features

* Batch writes to the proving broker database
([#11900](AztecProtocol/aztec-packages#11900))
([608f887](AztecProtocol/aztec-packages@608f887))


### Bug Fixes

* Cleanup also post test_kind.sh
([#11886](AztecProtocol/aztec-packages#11886))
([50cdb15](AztecProtocol/aztec-packages@50cdb15))
* Dont skip wasm civc tests
([#11909](AztecProtocol/aztec-packages#11909))
([0395e0b](AztecProtocol/aztec-packages@0395e0b))
* Note hash collision
([#11869](AztecProtocol/aztec-packages#11869))
([f289b7c](AztecProtocol/aztec-packages@f289b7c))
* Orchestrator test
([#11901](AztecProtocol/aztec-packages#11901))
([f1bb51c](AztecProtocol/aztec-packages@f1bb51c))
* Smt_verification: negative bitvecs, changed gates indicies.
acir_formal_proofs: noir-style signed division
([#11649](AztecProtocol/aztec-packages#11649))
([4146496](AztecProtocol/aztec-packages@4146496))
* Update path of stern logs
([#11906](AztecProtocol/aztec-packages#11906))
([05afb5b](AztecProtocol/aztec-packages@05afb5b))


### Miscellaneous

* Arm runner start fix
([#11903](AztecProtocol/aztec-packages#11903))
([6c83c40](AztecProtocol/aztec-packages@6c83c40))
* Fixing the sizes of VMs in CIVC
([#11793](AztecProtocol/aztec-packages#11793))
([1afddbd](AztecProtocol/aztec-packages@1afddbd))
* **logging:** Support explicit FORCE_COLOR parameter
([#11902](AztecProtocol/aztec-packages#11902))
([3b3f859](AztecProtocol/aztec-packages@3b3f859))
* Misc fixes to devnet deploy flow
([#11738](AztecProtocol/aztec-packages#11738))
([bc4cca7](AztecProtocol/aztec-packages@bc4cca7))
* Remove warnings from noir protocol circuits
([#11803](AztecProtocol/aztec-packages#11803))
([c6cc3d3](AztecProtocol/aztec-packages@c6cc3d3))
* Replace relative paths to noir-protocol-circuits
([74d6e6a](AztecProtocol/aztec-packages@74d6e6a))
* Replacing use of capsules 1.0 with pxe_db + nuking capsules 1.0
([#11885](AztecProtocol/aztec-packages#11885))
([72be678](AztecProtocol/aztec-packages@72be678))
</details>

<details><summary>barretenberg: 0.76.2</summary>

##
[0.76.2](AztecProtocol/aztec-packages@barretenberg-v0.76.1...barretenberg-v0.76.2)
(2025-02-11)


### Bug Fixes

* Note hash collision
([#11869](AztecProtocol/aztec-packages#11869))
([f289b7c](AztecProtocol/aztec-packages@f289b7c))
* Smt_verification: negative bitvecs, changed gates indicies.
acir_formal_proofs: noir-style signed division
([#11649](AztecProtocol/aztec-packages#11649))
([4146496](AztecProtocol/aztec-packages@4146496))


### Miscellaneous

* Fixing the sizes of VMs in CIVC
([#11793](AztecProtocol/aztec-packages#11793))
([1afddbd](AztecProtocol/aztec-packages@1afddbd))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product-security PRs extending our security mechanisms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants