-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow returning nested arrays from brillig (#2047)
* feat: allow returning nested arrays from brillig * style: remove extraneous println * style: restore whitespace * chore: update json and witness * style: whitespacing * docs: added doc comment
- Loading branch information
1 parent
5907e96
commit 4378bb8
Showing
6 changed files
with
65 additions
and
11 deletions.
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 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 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 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 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/qX3Tt3zTsa4PcD4AFp/ZVi3zhlmmUm/PHD0oD4h9pN5yAe/Dc/IPsQWw7sGRmT0R8HFCNtv+uAF/DOGcfDGyfNGx5Bzg2gefjGGdgd/kyC2zTC0jBFvI/jH4IajP8T48J9uJLYD1APzBzJ4I+Dg554/bT/hj/I4/mPM7FajDDH2gh6uHYK3Qkc6xZlDOQbn3w22sGTvel+SInVf/U83Y/eAj/nivZpjZUwEfp+f8IZEf3PUu0Je2aI8erufupfsQH3zg2ocws+cCPt6RzbY/sKd+dR+CPZW7/0n0aS3ju5673P1Pok+f84fEvow5vwuBOtyjD/Rw9ZCv7kNw797GmmnRc/dbaqZF+7JUYm9zzh/c+YHvmPrW9xSshbXv+rx2mjoYOPT1wc5efY7vcDxeDpN/voPDAw7Sj72Guf+m5/yPvZL04x5KIi6ufQ7Gxd7nSMUlcHBgXEi/4HPRxGXs4MC4kP4xcDD3GvM3fejgwL5A+kPguOPlyLWMiYPjDjhI/wQ47nk5Ci1j6uC4Bw7SPwWOGS/Hdmhx6NH0PnoGLA+8LKZ256CLuEhPAOtYM3NeDvM/yQfLfrqeg95HXr3pUJ3ar0dTLB6BJeJlMbFYgC7iisD/tI79fMHLYWIRWfbTNfJdyjq6Ala8x5XjkWWHQHwbczyS81E2VKf269GU4wtgWfKymBxfgS7iIj0BrPeAY8XLYWKxtOyna+S7lHXQIlb/CljxHlc9Li07BHKxsR6Xn2Cd/GNWgXia5yPar0dT71gBy5qXxfSODegiLtITwDruqze8HCYWa8t+uka+S1nDK2DFe1w5vrbsEIhvY46v5fR++PmILMzxMjn+BLqIi/QEsI7PxydeDhOLjWU/XSPfpayDFrH6V8CK97jqcWPZIdU7ztUj6RrCZ1P4rGsxa5/aNcX64odGj1n2BGRl8TbPj7v0mGTJjzjdP5dFnBfP2zIpk6IsfqVllh3LvNztn/e7eJ/k2TF5KfbZSy1sxigrUrxNR8p/PqOsIaOsBUMsji9m7CT9FzLKihjzb8HHFeOPSnFw/4h3xsiMvNgk6aV315ETnoBNytJj+zFUwo1XIkgPAnLnii/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 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