Skip to content

feat: merge-train/barretenberg#15963

Merged
AztecBot merged 5 commits into
nextfrom
merge-train/barretenberg
Jul 25, 2025
Merged

feat: merge-train/barretenberg#15963
AztecBot merged 5 commits into
nextfrom
merge-train/barretenberg

Conversation

@AztecBot

@AztecBot AztecBot commented Jul 24, 2025

Copy link
Copy Markdown
Collaborator

See merge-train-readme.md.

BEGIN_COMMIT_OVERRIDE
feat(bbapi): CIVC end to end (#15777)
fix: uint64_ct tests in stdlib (#15582)
END_COMMIT_OVERRIDE

AztecBot and others added 3 commits July 24, 2025 18:21
Continuing the vertical slice of doing CIVC API with the new BBAPI
end-to-end, this adds:
- revives a schema compiler that we were using with the circuits C++
code, adapting it for the unified bbapi
- adds code to bb.js, currently unused, to wrap a process and seamlessly
have bb.js use the native implementations via a process that spits in
and out msgpack
- implements gates and ivc verify in CIVC, uses them in
api_client_ivc.cpp (backs the CLI)
- move AztecBackend to the new API, using generated bindings
- refactor bb.js to adapt to new generation source

---------

Co-authored-by: Claude <noreply@anthropic.com>
@ludamad ludamad requested a review from charlielye as a code owner July 24, 2025 20:49
AztecBot and others added 2 commits July 24, 2025 20:50
The `stdlib::uint` module was only being tested for `uint32_ct`. This PR
makes the tests also run for `uint8_ct, uint16_ct, uint64_ct`.

The tests were failing for `uint64_ct` because the XOR and AND lookup
tables only supported 32-bit inputs. If we attempted to input more than
32-bits, it naturally led to the error message[^1]:
```bash
'C++ exception with description "Last key slice greater than 4" thrown in the test body."'
```
We slice the 64-bit number in 6-bit slices, starting from the least
significant slice:

<img width="704" alt="image"
src="https://github.com/user-attachments/assets/85b8feac-8913-44a8-bb3d-9538513c762a"
/>


such that the most-significant slice is 4 bits. Since we allowed only
32-bit XOR and AND lookup tables, it read the first 5 slices $(a_0,
\dots, a_4)$, i.e., 30 bits, and when it needs to read $a_5$ slice,
obviously the remainder $r = (a \gg 30)$ is greater than the allowed
value of the last slice (i.e., $r > 4$).

[^1]: Side note: the comment in the code noted the error message as `C++
exception with description "Last key slice greater than 64" thrown in
the test body` because it was referring to an error before the bug in
uint32 table was
[fixed](#11651).

Solution: simply added a 64-bit multi-table for XOR and AND operation of
two 64-bit numbers. Note that we still use the 6-bit basic table
repeated 10-times and a new 4-bit table for the last slice. Hence, one
64-bit XOR and AND operation would cost 11 lookup gates.

resolves AztecProtocol/barretenberg#1229

@ludamad ludamad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Auto-approved

@AztecBot AztecBot added this pull request to the merge queue Jul 25, 2025
@AztecBot

Copy link
Copy Markdown
Collaborator Author

🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass.

Merged via the queue into next with commit 0edc410 Jul 25, 2025
6 checks passed
@AztecBot AztecBot deleted the merge-train/barretenberg branch July 25, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants