feat(debugger): debug test functions#7958
Conversation
- Add the possibility to compile and debug a test function - Add a new config parameter to configure an external oracle resolver when debugging - REPL: execute the debugger in a separate thread than the repl cli
|
Thank you for your contribution to the Noir language. Please do not force push to this branch after the Noir team have started review of this PR. Doing so will only delay us merging your PR as we will need to start the review process from scratch. Thanks for your understanding. |
Co-authored-by: Ary Borenszweig <asterite@gmail.com>
asterite
left a comment
There was a problem hiding this comment.
Looks great, thank you! I'll merge this tomorrow in case you want to push a couple more things, but it's fine like this too.
e7a360f
|
@anaPerezGhiglia I think this PR broke something. Look at the difference between Note how the ">" character doesn't immediately show up in the bad nargo unless I type something and erase it, or hit enter. And for a reason I still don't understand it makes the I'll try to debug this to figure out what changed, but if you have any ideas before I do, please let me know! 🙏 |
|
@asterite one of the main changes for the Repl debugger was that I had to make it async, so that the debugger can wait the |
|
Thank you! Just now I tried debugging it again and I found something: I changed it to send I'll send a PR and ask you for an optional review :-) |
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>
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>
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>

Description
Expand debugger funcionality to support debugging test functions and configure an external oracle-resolver url.
This will allow to debug contract tests using the TXE as oracle resolver
Problem*
Resolves #5208
Summary*
Debug testcodelens request. Related vscode-noir PR (feat(codelens): trigger debugger on 'Debug test' command (#3) vscode-noir#100))Additional Context
Debugger changes
test-nameandoracle-resolverarg options to debugger (both repl and dap interfaces)DebugForeignCallExecutorto support setting aresolver_urlmainfunctionDebugExecutionResultenum that represents the possible outcomes of debugging a programshould_fail)ReplDebuggerintoAsyncReplDebugger_cmdto the debugger mod, and from thereplto thecontext- like creating theBn254BlackBoxSolveror restarting the debugging contextDebugCommandAPIenumModifications in
nargomodulenargo::ops::debugmodule. Extract reused debug functions into it.The moved functions are mostly about knowing how to compile or prepare the package for compiling for debugging. This also avoids generating inter-dependencies between
debug_cmdanddap_cmdnargo::ops::testfunctions publicTestResult::newfunction to be able to construct one from dapModifications in
noirc_frontend::debugmoduleDebugInstrumenterto instrument contract functions in addition to top-level functionsObservations
Documentation*
Check one:
Evidence
REPL: Debug simple noir test function
REPL: Debug aztec contract test function
dapDebuggerContractTest.mov
PR Checklist*
cargo fmton default settings.