forked from noir-lang/noir
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle nested arrays in calldata (noir-lang#6232)
# Description ## Problem\* This PR builds on noir-lang#6225 and adds support for nested arrays in calldata ## Summary\* Reconstruct the acir array when reading a nested structure from calldata. ## Additional Context ## Documentation\* Check one: - [X] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
4 changed files
with
59 additions
and
31 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
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
10 changes: 6 additions & 4 deletions
10
test_programs/execution_success/databus_composite_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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
zero = "0" | ||
one = "1" | ||
values = [[["12", "33"], ["37", "11"]],[["14", "37"], ["30", "10"]],[["10", "30"], ["30", "10"]]] | ||
|
||
[[foos]] | ||
x = "27" | ||
y = "40" | ||
x = 1 | ||
y = [1,2,3,4,5,6,7,8,9,0] | ||
|
||
[[foos]] | ||
x = "28" | ||
y = "42" | ||
x = 2 | ||
y = [1,2,3,5,6,8,7,8,9,0] |
15 changes: 10 additions & 5 deletions
15
test_programs/execution_success/databus_composite_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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
struct Foo { | ||
x: u32, | ||
y: u32, | ||
y: [u32; 10], | ||
} | ||
|
||
fn main(foos: call_data(0) [Foo; 2], zero: u32, one: u32) -> return_data u32 { | ||
fn main( | ||
foos: call_data(0) [Foo; 2], | ||
values: call_data(0) [[[u32; 2]; 2]; 3], | ||
zero: u32, | ||
one: u32 | ||
) -> pub u32 { | ||
assert_eq(foos[zero].x + 1, foos[one].x); | ||
assert_eq(foos[zero].y + 2, foos[one].y); | ||
foos[zero].x + foos[one].y | ||
assert_eq(foos[zero].y[3] + 2, foos[one].y[4]); | ||
assert_eq(values[zero][one][zero], values[one][zero][one]); | ||
foos[zero].x + foos[one].y[0] | ||
} | ||
|