feat(debugger): debug test functions (#5208) #7838
Closed
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
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): add debug test codelens manastech/vscode-noir#3))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
nargomoduleOpcodeResolutionErrorto anExecutionErrorfromnargo::ops::executeinto a new functionnargo::errors::execution_error_from. Use this new function indebugger::contextandnargo::ops::executenargo::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_cmdcheck_crate_and_report_errorsfromcheck_cmdtonargo::opssince it was being used in different commandsnargo::ops::testfunctions publicTestResult::newfunction to be able to construct one from dapRPCForeignCallExecutorto apply workaround for RPCForeignCallExecutor fails on long delays between requests #7463Modifications 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.