chore(test): Add smoke test for AST generation#8048
Merged
Conversation
rkarabut
approved these changes
Apr 14, 2025
This was referenced Apr 14, 2025
Closed
This was referenced Apr 23, 2025
Closed
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Apr 28, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE feat: let `nargo test` use the new greybox fuzzer (noir-lang/noir#8234) chore(docs): add fixed bugs to list (noir-lang/noir#8201) fix(parser): do not use `Ident::default()` (noir-lang/noir#8224) feat(fuzz): Add experimental comptime code generator (noir-lang/noir#8207) fix: let SSA parser parse calls to print (noir-lang/noir#8232) feat: added 1, -1 case for inversions in brillig (noir-lang/noir#8225) chore: clippy (noir-lang/noir#8220) fix: don't take implicitly added named generics when checking where clauses (noir-lang/noir#8184) chore(docs): Defunctionalization and some minor cleanup (noir-lang/noir#8217) feat: add `--no-fuzz` and `--only-fuzz` to `nargo test` (noir-lang/noir#8213) chore: add regression test for panic encountered in bigcurve library. (noir-lang/noir#8211) fix: validate numeric types when passing them to a FunctionBuilder (noir-lang/noir#8215) chore: refactor constrainedness checks on trait impls (noir-lang/noir#8170) chore(test): Add smoke test for AST generation (noir-lang/noir#8048) chore: bump more dependencies (noir-lang/noir#8208) chore: Don't use `i1` in the AST fuzzer (noir-lang/noir#8204) fix: Do not panic if RHS constant in division has more bits than the operand (noir-lang/noir#8197) chore: bump cargo deps (noir-lang/noir#8205) fix: Handle truncating constants to 128 bits (noir-lang/noir#8180) fix!: disallow the `i1` type (noir-lang/noir#8172) chore(fuzz): Make sure `main` makes at least one call (noir-lang/noir#8202) fix: Use `get_local_or_global_instruction` in `try_optimize_array_set_from_previous_get` (noir-lang/noir#8200) fix: returns 0 for right shift overflow (noir-lang/noir#8189) feat: avoid overflow check when subtracting from a value that is the maximum for its bitsize (noir-lang/noir#8190) feat: optimize `checked_to_unchecked` to take into account multiplications (noir-lang/noir#8188) chore: document ssa `inline_simple_functions` (noir-lang/noir#8169) chore(docs): remove_unreachable SSA pass (noir-lang/noir#8196) chore: Change AST fuzzer recursion limit (noir-lang/noir#8173) chore(acir): Unify how we display witness indices (noir-lang/noir#8192) fix: Detect ABI change of fuzzing harnesses (noir-lang/noir#8193) chore(acir): Test that `BLACKBOX::RANGE` display the number of bits (noir-lang/noir#8191) fix(debugger): send idle at loop end + fix test (noir-lang/noir#8187) fix: Use `get_local_or_global_instruction` when simplifying `IfElse` (noir-lang/noir#8185) fix(parser): avoid using `Location::dummy()` (noir-lang/noir#8178) chore: Push a bug list (noir-lang/noir#8186) feat(greybox_fuzzer): Should_fail and should_fail_with (noir-lang/noir#8118) chore: move unsigned overflow check from acir/brillig to ssa (noir-lang/noir#8163) feat: location tree for debug_info (noir-lang/noir#7034) fix: Use `IntegerConstant` for loop boundaries in `unrolling` (noir-lang/noir#8094) fix(ssa): Recursive shared Brillig entry points (noir-lang/noir#8099) chore: enable '--pedantic-solving' on more tests (noir-lang/noir#7701) chore(readme): Update `acvm-repo` READMEs (noir-lang/noir#8150) chore(test): add `test_programs` dir for expected-panic tests (noir-lang/noir#8147) chore(docs): minor updates in solidity doc (noir-lang/noir#8160) feat(debugger): debug test functions (noir-lang/noir#7958) chore: migrate recursive proof test to ultrahonk (noir-lang/noir#8038) chore: bump glob package (noir-lang/noir#8159) chore: bump external pinned commits (noir-lang/noir#8139) chore(docs): patch web app tutorial in 1.0.0-beta3 versioned docs (noir-lang/noir#8158) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com> Co-authored-by: TomAFrench <tom@tomfren.ch>
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Apr 28, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE feat: let `nargo test` use the new greybox fuzzer (noir-lang/noir#8234) chore(docs): add fixed bugs to list (noir-lang/noir#8201) fix(parser): do not use `Ident::default()` (noir-lang/noir#8224) feat(fuzz): Add experimental comptime code generator (noir-lang/noir#8207) fix: let SSA parser parse calls to print (noir-lang/noir#8232) feat: added 1, -1 case for inversions in brillig (noir-lang/noir#8225) chore: clippy (noir-lang/noir#8220) fix: don't take implicitly added named generics when checking where clauses (noir-lang/noir#8184) chore(docs): Defunctionalization and some minor cleanup (noir-lang/noir#8217) feat: add `--no-fuzz` and `--only-fuzz` to `nargo test` (noir-lang/noir#8213) chore: add regression test for panic encountered in bigcurve library. (noir-lang/noir#8211) fix: validate numeric types when passing them to a FunctionBuilder (noir-lang/noir#8215) chore: refactor constrainedness checks on trait impls (noir-lang/noir#8170) chore(test): Add smoke test for AST generation (noir-lang/noir#8048) chore: bump more dependencies (noir-lang/noir#8208) chore: Don't use `i1` in the AST fuzzer (noir-lang/noir#8204) fix: Do not panic if RHS constant in division has more bits than the operand (noir-lang/noir#8197) chore: bump cargo deps (noir-lang/noir#8205) fix: Handle truncating constants to 128 bits (noir-lang/noir#8180) fix!: disallow the `i1` type (noir-lang/noir#8172) chore(fuzz): Make sure `main` makes at least one call (noir-lang/noir#8202) fix: Use `get_local_or_global_instruction` in `try_optimize_array_set_from_previous_get` (noir-lang/noir#8200) fix: returns 0 for right shift overflow (noir-lang/noir#8189) feat: avoid overflow check when subtracting from a value that is the maximum for its bitsize (noir-lang/noir#8190) feat: optimize `checked_to_unchecked` to take into account multiplications (noir-lang/noir#8188) chore: document ssa `inline_simple_functions` (noir-lang/noir#8169) chore(docs): remove_unreachable SSA pass (noir-lang/noir#8196) chore: Change AST fuzzer recursion limit (noir-lang/noir#8173) chore(acir): Unify how we display witness indices (noir-lang/noir#8192) fix: Detect ABI change of fuzzing harnesses (noir-lang/noir#8193) chore(acir): Test that `BLACKBOX::RANGE` display the number of bits (noir-lang/noir#8191) fix(debugger): send idle at loop end + fix test (noir-lang/noir#8187) fix: Use `get_local_or_global_instruction` when simplifying `IfElse` (noir-lang/noir#8185) fix(parser): avoid using `Location::dummy()` (noir-lang/noir#8178) chore: Push a bug list (noir-lang/noir#8186) feat(greybox_fuzzer): Should_fail and should_fail_with (noir-lang/noir#8118) chore: move unsigned overflow check from acir/brillig to ssa (noir-lang/noir#8163) feat: location tree for debug_info (noir-lang/noir#7034) fix: Use `IntegerConstant` for loop boundaries in `unrolling` (noir-lang/noir#8094) fix(ssa): Recursive shared Brillig entry points (noir-lang/noir#8099) chore: enable '--pedantic-solving' on more tests (noir-lang/noir#7701) chore(readme): Update `acvm-repo` READMEs (noir-lang/noir#8150) chore(test): add `test_programs` dir for expected-panic tests (noir-lang/noir#8147) chore(docs): minor updates in solidity doc (noir-lang/noir#8160) feat(debugger): debug test functions (noir-lang/noir#7958) chore: migrate recursive proof test to ultrahonk (noir-lang/noir#8038) chore: bump glob package (noir-lang/noir#8159) chore: bump external pinned commits (noir-lang/noir#8139) chore(docs): patch web app tutorial in 1.0.0-beta3 versioned docs (noir-lang/noir#8158) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com> Co-authored-by: TomAFrench <tom@tomfren.ch>
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Apr 28, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE feat: let `nargo test` use the new greybox fuzzer (noir-lang/noir#8234) chore(docs): add fixed bugs to list (noir-lang/noir#8201) fix(parser): do not use `Ident::default()` (noir-lang/noir#8224) feat(fuzz): Add experimental comptime code generator (noir-lang/noir#8207) fix: let SSA parser parse calls to print (noir-lang/noir#8232) feat: added 1, -1 case for inversions in brillig (noir-lang/noir#8225) chore: clippy (noir-lang/noir#8220) fix: don't take implicitly added named generics when checking where clauses (noir-lang/noir#8184) chore(docs): Defunctionalization and some minor cleanup (noir-lang/noir#8217) feat: add `--no-fuzz` and `--only-fuzz` to `nargo test` (noir-lang/noir#8213) chore: add regression test for panic encountered in bigcurve library. (noir-lang/noir#8211) fix: validate numeric types when passing them to a FunctionBuilder (noir-lang/noir#8215) chore: refactor constrainedness checks on trait impls (noir-lang/noir#8170) chore(test): Add smoke test for AST generation (noir-lang/noir#8048) chore: bump more dependencies (noir-lang/noir#8208) chore: Don't use `i1` in the AST fuzzer (noir-lang/noir#8204) fix: Do not panic if RHS constant in division has more bits than the operand (noir-lang/noir#8197) chore: bump cargo deps (noir-lang/noir#8205) fix: Handle truncating constants to 128 bits (noir-lang/noir#8180) fix!: disallow the `i1` type (noir-lang/noir#8172) chore(fuzz): Make sure `main` makes at least one call (noir-lang/noir#8202) fix: Use `get_local_or_global_instruction` in `try_optimize_array_set_from_previous_get` (noir-lang/noir#8200) fix: returns 0 for right shift overflow (noir-lang/noir#8189) feat: avoid overflow check when subtracting from a value that is the maximum for its bitsize (noir-lang/noir#8190) feat: optimize `checked_to_unchecked` to take into account multiplications (noir-lang/noir#8188) chore: document ssa `inline_simple_functions` (noir-lang/noir#8169) chore(docs): remove_unreachable SSA pass (noir-lang/noir#8196) chore: Change AST fuzzer recursion limit (noir-lang/noir#8173) chore(acir): Unify how we display witness indices (noir-lang/noir#8192) fix: Detect ABI change of fuzzing harnesses (noir-lang/noir#8193) chore(acir): Test that `BLACKBOX::RANGE` display the number of bits (noir-lang/noir#8191) fix(debugger): send idle at loop end + fix test (noir-lang/noir#8187) fix: Use `get_local_or_global_instruction` when simplifying `IfElse` (noir-lang/noir#8185) fix(parser): avoid using `Location::dummy()` (noir-lang/noir#8178) chore: Push a bug list (noir-lang/noir#8186) feat(greybox_fuzzer): Should_fail and should_fail_with (noir-lang/noir#8118) chore: move unsigned overflow check from acir/brillig to ssa (noir-lang/noir#8163) feat: location tree for debug_info (noir-lang/noir#7034) fix: Use `IntegerConstant` for loop boundaries in `unrolling` (noir-lang/noir#8094) fix(ssa): Recursive shared Brillig entry points (noir-lang/noir#8099) chore: enable '--pedantic-solving' on more tests (noir-lang/noir#7701) chore(readme): Update `acvm-repo` READMEs (noir-lang/noir#8150) chore(test): add `test_programs` dir for expected-panic tests (noir-lang/noir#8147) chore(docs): minor updates in solidity doc (noir-lang/noir#8160) feat(debugger): debug test functions (noir-lang/noir#7958) chore: migrate recursive proof test to ultrahonk (noir-lang/noir#8038) chore: bump glob package (noir-lang/noir#8159) chore: bump external pinned commits (noir-lang/noir#8139) chore(docs): patch web app tutorial in 1.0.0-beta3 versioned docs (noir-lang/noir#8158) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com> Co-authored-by: TomAFrench <tom@tomfren.ch>
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 #7883
Summary*
Add a smoke test to the
noir_ast_fuzzerwhich generates random ASTs and executes them with random inputs, without comparing the results against any oracle, just asserting that the compiler didn't crash. This should help catch problems with the AST or input generation. The testing budget is limited to 10s, so this is not a replacement forcargo fuzz, just a property based test.Changes function call generation so that we don't call ACIR functions from Brillig functions. In theory there is nothing wrong with doing so, but I just realised debugging an inlining crash that in the normal compiler flow the
Monomorphizerwould duplicate ACIR functions called from Brillig asunconstrained, which I have not done; in the generated AST so far it was allowed to call ACIR from Brillig. In inlining the recursions weren't properly recognised there. We could duplicate them, but that would make the programs bigger and harder to deal with, and skew frequencies. Instead by not allowing such calls, we pretend that we have already done it. It can result in ACIR functions never being called ifmainisunconstrained.Additional Context
To execute the test run the following command:
cargo test -p noir_ast_fuzzer --test smokeWhen the test fails, it prints a seed. The failure can be debugged by putting that seed in the
NOIR_ARBTEST_SEEDenv var:NOIR_ARBTEST_SEED=0x1796975f00100000 cargo test -p noir_ast_fuzzer --test smokeCurrently it fails with various seeds:
simplify_cfg.rs:224:69: index out of bounds: the len is 2 but the index is 113should have been fixed by Compiler crashes with --force-brillig, passes with ACIR #7964brillig_globals: function has multiple entry points #8069u128cast fromFieldwith a condition #8024unrolling: Expected to find the induction variable by end of loop iteration #8073inlining.rs:359:17: internal error: entered unreachable code: All Value::Params should already be known from previous calls to translate_block. Unknown value v22 = Param { block: Id(1), position: 0, typ: Numeric(Unsigned { bit_size: 8 }) }-> Fixed by not calling ACIR from Brilliginlining.rs:280:13: Attempted to recur more than 1000 times during inlining function 'func_5'-> Fixed by not calling ACIR from Brilligacir_context:attempt to divide by zero#8175simplify.rs:index out of bounds#8174acir_context:attempted to divide by constant larger than operand type#8195brillig_ir/instructions:Constant 2 does not fit in bit size 1#8198simplify.rs:index out of bounds: Part 2 #8199These seeds might not work any more, because any change we make to the generation will result in a different program, but the tickets have the minimised version of the code that caused the problem.
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.