-
Notifications
You must be signed in to change notification settings - Fork 387
feat: allow returning nested arrays from brillig #2047
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1fab353
feat: allow returning nested arrays from brillig
sirasistant 8c59aef
style: remove extraneous println
sirasistant 85dba2a
style: restore whitespace
sirasistant e5ec8dd
chore: update json and witness
sirasistant 00e89ba
style: whitespacing
sirasistant 05554c7
docs: added doc comment
sirasistant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data_ssa_refactor/nested_arrays_from_brillig/Nargo.toml
This file contains hidden or 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 @@ | ||
| [package] | ||
| authors = [""] | ||
| compiler_version = "0.6.0" | ||
|
|
||
| [dependencies] |
1 change: 1 addition & 0 deletions
1
crates/nargo_cli/tests/test_data_ssa_refactor/nested_arrays_from_brillig/Prover.toml
This file contains hidden or 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 @@ | ||
| values = [1,2,3,4,5,6] |
26 changes: 26 additions & 0 deletions
26
crates/nargo_cli/tests/test_data_ssa_refactor/nested_arrays_from_brillig/src/main.nr
This file contains hidden or 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,26 @@ | ||
| struct Header { | ||
| params: [Field; 3], | ||
| } | ||
|
|
||
| struct MyNote { | ||
| plain: Field, | ||
| array: [Field; 2], | ||
| header: Header, | ||
| } | ||
|
|
||
| fn access_nested(notes: [MyNote; 2]) -> Field { | ||
| notes[0].array[1] + notes[1].array[0] + notes[0].plain + notes[1].header.params[0] | ||
| } | ||
|
|
||
| unconstrained fn create_inside_brillig(values: [Field; 6]) -> [MyNote; 2] { | ||
| let header = Header { params: [values[0], values[1], values[2]]}; | ||
| let note0 = MyNote { array: [values[0], values[1]], plain : values[2], header }; | ||
| let note1 = MyNote { array: [values[3], values[4]], plain : values[5], header }; | ||
| [note0, note1] | ||
| } | ||
|
|
||
| fn main(values: [Field; 6]) { | ||
| let notes = create_inside_brillig(values); | ||
| assert(access_nested(notes) == (2 + 4 + 3 + 1)); | ||
| } | ||
|
|
1 change: 1 addition & 0 deletions
1
crates/nargo_cli/tests/test_data_ssa_refactor/nested_arrays_from_brillig/target/main.json
This file contains hidden or 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 @@ | ||
| {"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"values","type":{"kind":"array","length":6,"type":{"kind":"field"}},"visibility":"private"}],"param_witnesses":{"values":[1,2,3,4,5,6]},"return_type":null,"return_witnesses":[]},"bytecode":"H4sIAAAAAAAA/92a21LiQBCGh1MiBCOCGE6+Q44Q7niVdRcv9pn3YTYzpsufqSGidrtkp2oqCRO6vz5mjKyUUkP1Om7qo1cfO9XsVrNXzX41B/WaV6/RPXS/gs/0ONTH+Gsj6fDJiqUYuy1g7LWAsd8CxkELGD1GRqz1cX3uq9d+oXvHqJpBvXZbzbCad9WcVPO+mlP1Nv7UR/29rjod2EcOPOxbj9+3sY7/b2Ae8Mr/qX3Tt3zTsa4PcD4A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1XIkgPAnLnii/5peye88fopLlfu09x/AWj8PM1SjMAAA==","proving_key":null,"verification_key":null} |
Binary file added
BIN
+119 Bytes
crates/nargo_cli/tests/test_data_ssa_refactor/nested_arrays_from_brillig/target/witness.tr
Binary file not shown.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.