-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Hook up secondary calldata column in dsl (#7759)
Previously we could use a single calldata and return_data from noir with support from the bberg backend. With [this](https://github.com/noir-lang/noir/pull/5599/files) PR, noir has an interface for multiple calldata entities. The backend has support for two calldata columns (`calldata` and `secondary_calldata`). This work hooks up a second calldata column in dsl. The main limitation of this work is that there is no way to distinguish between the two calldata columns in dsl. This is OK for the operations within a single circuit because in that context there is no important distinction between the two calldata columns (`calldata`, `secondary_calldata`). It does cause a problem however in the mechanism for linking two circuits via the databus. This is because we need to know which calldata corresponds to app data and which corresponds to previous kernel data in order to prove that the connection was made faithfully. The ideal solution is probably to treat `secondary_calldata` (possibly rename to `app_calldata`?) as a unique entity in noir (similar to how `calldata` and `return_data` are treated as different entities), rather than allowing arbitrarily many individual `calldata` entities. I made an issue [here](AztecProtocol/barretenberg#1070). --------- Co-authored-by: sirasistant <sirasistant@gmail.com>
- Loading branch information
1 parent
1ecfe1d
commit f0f28fc
Showing
11 changed files
with
148 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
# Run from within barretenberg/acir_tests | ||
|
||
# clean and rebuild noir then compile the test programs | ||
cd ../../noir/noir-repo | ||
cargo clean | ||
noirup -p . | ||
cd test_programs && ./rebuild.sh | ||
|
||
# remove and repopulate the test artifacts in bberg | ||
cd ../../../barretenberg/acir_tests | ||
rm -rf acir_tests | ||
./clone_test_vectors.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
noir/noir-repo/test_programs/execution_success/databus_two_calldata/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "databus_two_calldata" | ||
type = "bin" | ||
authors = [""] | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
noir/noir-repo/test_programs/execution_success/databus_two_calldata/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
x = [0,1,2,3] | ||
y = [0,2,4] | ||
z = [1,3,5,7] |
11 changes: 11 additions & 0 deletions
11
noir/noir-repo/test_programs/execution_success/databus_two_calldata/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// An simple program demonstrating two calldata array inputs and a single return data array. As an arbitrary example, | ||
// the return data is computed as a linear combination of the calldata. | ||
fn main(mut x: [u32; 4], y: call_data(0) [u32; 3], z: call_data(1) [u32; 4]) -> return_data [u32; 4] { | ||
let mut result = [0; 4]; | ||
for i in 0..3 { | ||
let idx = x[i]; | ||
result[idx] = y[idx] + z[idx]; | ||
} | ||
result[x[3]] = z[x[3]]; | ||
result | ||
} |
6 changes: 6 additions & 0 deletions
6
noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "databus_two_calldata_simple" | ||
type = "bin" | ||
authors = [""] | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
idx = "1" | ||
y = [7, 9] | ||
z = [1,2,3,4] |
5 changes: 5 additions & 0 deletions
5
noir/noir-repo/test_programs/execution_success/databus_two_calldata_simple/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fn main(mut idx: u32, y: call_data(0) [u32; 2], z: call_data(1) [u32; 4]) -> return_data u32 { | ||
let a = y[idx]; | ||
let b = z[idx]; | ||
a + b | ||
} |