-
Notifications
You must be signed in to change notification settings - Fork 310
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(acir)!: Program and witness stack structure #5149
Changes from 146 commits
71998b8
d081ecc
a70156e
dcb6d9e
d822483
2376e16
10195f3
0792a08
9be6881
4c7f82e
96a719c
288a7ec
1f65f18
0dc8b38
e602ecd
c3d825d
cd27e74
695d85e
e1757fd
ba1369e
4c357ac
ad8129b
1dac703
14cea93
fc7c8b7
e45f50d
3ac2c53
299d0dd
9ceee33
6d08e8a
d3b5032
94b4739
c01aa62
2023556
3a31504
0b5ab14
babb483
127e03f
111089e
4e361fe
6905b96
6ddfd30
2b1639a
a755f8a
3b2a7e4
24749d9
5ce2b3e
c6cc631
d6707ca
7748098
a2c7297
de216d6
fdae079
0d6ed9d
45040e4
441942e
20d58ac
a5b7d09
6ec4afd
a8ccd5c
0c78c33
27359e8
1d04bdb
8ac7d2c
a7ce531
576f092
ac72a93
9217b4a
1407de4
671cb93
b7f6609
352c335
9624796
9350526
52b3773
88ad6cd
6177b62
0ffc638
4bb76b6
1200597
42485d5
25b3f4f
e02a4bc
9180274
914af07
c351300
a418cb4
b665ff7
a094e24
90cd0cf
a4d7ace
210569f
dbfdb07
accc62a
db9eac3
15d7622
c9d5fa6
c786c7d
bc13ebe
1e59a4c
204ec20
0be14a1
4ee6462
cf7cb11
99bee54
9a57443
f5327b7
8612d41
246adb2
61387df
5bc6d2f
fc84eb6
8c4fcde
9818d7e
b515cf5
cf91d52
fc4a158
722b7dc
9ebf404
aa6c430
d1c4bee
301f4b8
2df6fbd
c41b403
9f566ca
49523c0
c94e520
cdae556
231a500
2803b20
f767793
159b895
6d4436f
8fbac37
a55ed45
aacbd24
bb3027d
853d005
d9c71f7
7821f84
1fa4732
8bee903
20f7b88
6830ae8
1e8693d
7bb56c2
4c37b4b
72157ca
3230eef
fdcabd9
fb75544
223b3c8
4cdefa7
33c90fd
b085914
45ca74c
004fe2c
3ea3cc1
2a07951
ef33716
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had wrote this flow to easily write contracts against the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remove it if we're not using it. |
||
set -eu | ||
|
||
export TEST_NAME=$(basename $(pwd)) | ||
|
||
$BIN write_vk -o vk | ||
$BIN contract -k vk -c $CRS_PATH -b ./target/acir.gz -o $TEST_NAME.sol |
vezenovm marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Domain Specific Language | ||
|
||
This package adds support to use [ACIR](https://github.com/noir-lang/noir/tree/master/acvm-repo/acir) with barretenberg. | ||
|
||
## Serialization Changes | ||
|
||
There are two types of breaking serialization changes. One that alters that alters the internal ACIR structure passed to barretenberg, and one that changes how we serialize the buffer passed to barretenberg. | ||
|
||
1. Internal Structure Change | ||
|
||
Go to the ACVM `acir` crate and re-run the [serde reflection test](../../../../../noir/noir-repo/acvm-repo/acir/src/lib.rs#L51). Remember to comment out the hash check to write the updated C++ serde file. Copy that file into the `dsl` package's [serde folder](./acir_format/serde/) where you will see an `acir.hpp` file. | ||
|
||
You will have to update a couple things in the new `acir.hpp`: | ||
- Replace all `throw serde::deserialization_error` with `throw_or_abort` | ||
- The top-level struct (such as `Program`) will still use its own namespace for its internal fields. This extra `Program::` can be removed from the top-level `struct Program { .. }` object. | ||
|
||
The same can then be done for any breaking changes introduced to `witness_stack.hpp`. | ||
|
||
2. Full Breaking Change | ||
|
||
This type of breaking change is rarely expected to happen, however, due to its nature there are multiple consumers of the pre-existing serialization you should be aware of if you ever need to make this change. | ||
|
||
A full change is when you attempt to change the object whose buffer we are actually deserializing in barretenberg. To give more detail, when [deserializing the constraint buffer](./acir_format/acir_to_constraint_buf.hpp#366) if the object for which we call `bincodeDeserialize` on changes, anything that has pre-existing ACIR using the previous object's `bincodeDeserialize` method will now fail. The serialization is once again determined by the top-level object in the [acir crate](../../../../../noir/noir-repo/acvm-repo/acir/src/circuit/mod.rs). After performing the steps outlined for an internal structure breaking change as listed in (1) above, we need to update all consumers of barretenberg. | ||
|
||
Even if you correctly update all serialization in [acvm_js](../../../../../noir/noir-repo/acvm-repo/acvm_js/README.md) such as during [execution](../../../../../noir/noir-repo/acvm-repo/acvm_js/src/execute.rs#57), there is multiple places the `yarn-project` uses the ACIR top-level serialization. The `yarn-project` sequencer also uses the native `acvm_cli tool` that has an execute method that [expects raw byte code](../../../../../noir/noir-repo/tooling/acvm_cli/src/cli/execute_cmd.rs#63). | ||
|
||
In the context of Aztec we need to regenerate all the artifacts in [noir-projects](../../../../../noir-projects/bootstrap.sh). This regeneration assumes that we have rebuilt the compilers (Noir compiler and AVM transpiler) to use the new serialization. After regenerating these artifacts we can bootstrap the yarn-project. There are multiple packages in the yarn-project that rely on pre-computed artifacts such as `yarn-project/circuits.js` and `yarn-project/protocol-contracts`. | ||
|
||
The Aztec artifacts can be individually regenerated as well using `yarn test -u`. | ||
You can also run the command on the relevant workspaces, which at the time are the following: | ||
``` | ||
yarn workspace @aztec/circuits.js test -u | ||
yarn workspace @aztec/protocol-contracts test -u | ||
``` |
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 order was changed as we now portal
bb.js
innoir_js_backend_barretenberg
in order to get CI fully passing onaztec-packages
. We just will not be able to sync to Noir until we do a bb.js release