Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@
"type": "boolean",
"description": "Skips variables debugging instrumentation of code, making debugging less convenient but the resulting binary smaller and closer to production",
"default": false
},
"testName": {
"type": "string",
"description": "Optional test name to debug",
"default": null
},
"oracleResolver": {
"type": "string",
"description": "JSON RPC url to solve oracle calls",
"default": null
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class NoirDebugConfigurationProvider implements DebugConfigurationProvider {
proverName: config.proverName || `Prover`,
generateAcir: config.generateAcir || false,
skipInstrumentation: config.skipInstrumentation || false,
testName: config.testName,
oracleResolver: config.oracleResolver,
};

return resolvedConfig;
Expand Down Expand Up @@ -111,6 +113,11 @@ class NoirDebugConfigurationProvider implements DebugConfigurationProvider {
preflightArgs.push(config.package);
}

if (config.testName) {
preflightArgs.push(`--preflight-test-name`);
preflightArgs.push(config.testName);
}

if (config.generateAcir) {
preflightArgs.push(`--preflight-generate-acir`);
}
Expand Down Expand Up @@ -141,6 +148,11 @@ class NoirDebugConfigurationProvider implements DebugConfigurationProvider {
throw new Error(`Error launching debugger. Please inspect the Output pane for more details.`);
} else {
outputChannel.appendLine(`Starting debugger session...`);
if (config.oracleResolver) {
outputChannel.appendLine(`Using oracle resolver target ${config.oracleResolver}`);
} else {
outputChannel.appendLine(`No oracle resolver set`);
}
}

return config;
Expand Down
18 changes: 18 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
TaskGroup,
ProcessExecution,
ProgressLocation,
debug,
} from 'vscode';
import os from 'os';

Expand Down Expand Up @@ -174,7 +175,24 @@ function registerCommands(uri: Uri) {
const debugCommand$ = commands.registerCommand('nargo.debug.dap', async (..._args) => {
return commands.executeCommand('workbench.action.debug.start');
});

commands$.push(debugCommand$);
const debugTestCommand$ = commands.registerCommand('nargo.debug.test', async (...args) => {
const exactIndex = args.indexOf('--exact');
const testName = args.at(exactIndex + 1);
const oracleResolver = process.env['TXE_TARGET'];
const workspaceFolder = workspace.getWorkspaceFolder(uri);
await debug.startDebugging(workspaceFolder, {
type: 'noir',
request: 'launch',
name: 'Noir binary package',
projectFolder: '${workspaceFolder}',
proverName: 'Prover',
...(testName && { testName }),
...(oracleResolver && { oracleResolver }),
});
});
commands$.push(debugTestCommand$);

const selectNargoPathCommand$ = commands.registerCommand('nargo.config.path.select', async (..._args) => {
const homeDir = os.homedir();
Expand Down