-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: Change serialization of struct field order to match the user de…
…fined order (#1166) * Change struct field order to the user defined order * Remove remnants of old test_data folder * Fix test * Fix tests * move poseidon tests to nargo * Update crates/noirc_abi/src/input_parser/mod.rs Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> * add simple example of using structs which will fail * chore: remove unused import * fix: respect struct ordering when abi encoding * chore: run only `struct_inputs_simple` test * chore: update from `constrain` to `assert` * fix: maintain field ordering when generating struct witnesses * chore: run all tests * fix: fix serialisation test * chore: nit refactor * chore: fix nits * chore: switch to using `.remove` * fix: prevent panics on nested structs * chore: replace `into_iter()` with equivalent `iter()` * chore: rename test to make it clearer what it's testing --------- Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Tom French <tom@tomfren.ch>
- Loading branch information
1 parent
cceaca0
commit 809aa3a
Showing
16 changed files
with
158 additions
and
88 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
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data/struct_fields_ordering/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.1" | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
crates/nargo_cli/tests/test_data/struct_fields_ordering/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 @@ | ||
[y] | ||
foo = "5" | ||
bar = "7" |
14 changes: 14 additions & 0 deletions
14
crates/nargo_cli/tests/test_data/struct_fields_ordering/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,14 @@ | ||
use dep::std; | ||
|
||
// Note that fields are not in alphabetical order. | ||
// We want to check that this ordering is maintained | ||
struct myStruct { | ||
foo: u32, | ||
bar: Field, | ||
} | ||
|
||
fn main(y : pub myStruct) { | ||
assert(y.foo == 5); | ||
assert(y.bar == 7); | ||
} | ||
|
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
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
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
Oops, something went wrong.