chore(fuzz): Test AST print-and-parse roundtrip#9083
Merged
Conversation
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 8450e51 | Previous: 6a68ca1 | Ratio |
|---|---|---|---|
test_report_noir-lang_noir_bigcurve_ |
314 s |
240 s |
1.31 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jul 4, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: remove redundant associated constant lookup (noir-lang/noir#9114) chore: test that associated function and constant with the same name collide (noir-lang/noir#9112) feat: Allow TraitAsType syntax to refer to associated constants in expressions (noir-lang/noir#9041) chore: clippy (noir-lang/noir#9101) chore(fuzz): Recursively generate lvalue for multi dimensional arrays and nested tuples (noir-lang/noir#9086) fix!: remove `hash_to_field` from stdlib (noir-lang/noir#9098) chore(docs): Brillig gen (noir-lang/noir#9085) chore(fuzz): Test AST print-and-parse roundtrip (noir-lang/noir#9083) fix(ssa): Do not fail for static assertions in a map over empty dynamic slices (noir-lang/noir#9060) chore: merge `RangeCheckFailed` and `RangeCheckFailedWithMessage` (noir-lang/noir#9093) chore(fuzz): Capture printed output in `comptime_vs_brillig_direct` (noir-lang/noir#9090) chore(debug): Add trait constraint to string helper (noir-lang/noir#9082) chore: bump some deps (noir-lang/noir#9076) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
danielntmd
pushed a commit
to danielntmd/aztec-packages
that referenced
this pull request
Jul 16, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: remove redundant associated constant lookup (noir-lang/noir#9114) chore: test that associated function and constant with the same name collide (noir-lang/noir#9112) feat: Allow TraitAsType syntax to refer to associated constants in expressions (noir-lang/noir#9041) chore: clippy (noir-lang/noir#9101) chore(fuzz): Recursively generate lvalue for multi dimensional arrays and nested tuples (noir-lang/noir#9086) fix!: remove `hash_to_field` from stdlib (noir-lang/noir#9098) chore(docs): Brillig gen (noir-lang/noir#9085) chore(fuzz): Test AST print-and-parse roundtrip (noir-lang/noir#9083) fix(ssa): Do not fail for static assertions in a map over empty dynamic slices (noir-lang/noir#9060) chore: merge `RangeCheckFailed` and `RangeCheckFailedWithMessage` (noir-lang/noir#9093) chore(fuzz): Capture printed output in `comptime_vs_brillig_direct` (noir-lang/noir#9090) chore(debug): Add trait constraint to string helper (noir-lang/noir#9082) chore: bump some deps (noir-lang/noir#9076) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Problem*
Resolves #9058
Summary*
Adds a new prop test to the AST fuzzer to ensure that if we render the monomorphized AST created by the fuzzer and parse it back, it renders the same way a second time, indicating that there are no significant differences between the fuzzer and the compiler, no hidden assumptions that the generator does not respect.
cargo test -p noir_ast_fuzzer --test monoAdditional Context
The can be subtle differences, for example rendering
Unary { op: Minus, rhs: Literal(1) }could be parsed back asLiteral(-1). These don't cause a test failure, because we only compare the printed Noir source, and I made some changes to the printer to ensure they appear identical. Other instances that cause no harm such as--1being parsed as1are handled in the test itself.The test did highlight some actual semantic differences, such as a misunderstanding in the
return_typeof a unary reference, which resulted in an extra&mutin the printed output. Similarly it uncovered that the separation of array indexes into a temporary variable had a different definition of "side effect" than the fuzzer.After investigation there remains a discrepancy in how these array indexes are handled for multi-dimensional arrays: the compiler creates temporary variables for all dimensions in a single block, ie.
a[0 + 1][2 - 1] = 3;is turned into{ let i_1 = 0 - 1; let i_2 = 2 - 1; a[i][j] = 3;. The generator only considers a single index. This doesn't cause an issue at the moment because the generator doesn't assign to multiple dimensions, only the top one. I'll create a follow-up PR to add multi-dimensional assignments.Documentation*
Check one:
PR Checklist*
cargo fmton default settings.