diff --git a/tooling/debugger/src/lib.rs b/tooling/debugger/src/lib.rs index 5534861a463..d6b0147b34f 100644 --- a/tooling/debugger/src/lib.rs +++ b/tooling/debugger/src/lib.rs @@ -1,7 +1,7 @@ +use acvm::acir::circuit::OpcodeLocation; use acvm::pwg::{ACVMStatus, ErrorLocation, OpcodeResolutionError, ACVM}; use acvm::BlackBoxFunctionSolver; use acvm::{acir::circuit::Circuit, acir::native_types::WitnessMap}; -use acvm::acir::circuit::OpcodeLocation; use nargo::artifacts::debug::DebugArtifact; use nargo::errors::ExecutionError; @@ -11,7 +11,7 @@ use nargo::ops::ForeignCallExecutor; use thiserror::Error; -use easy_repl::{Repl, CommandStatus, command, Critical}; +use easy_repl::{command, CommandStatus, Critical, Repl}; use std::cell::RefCell; enum SolveResult { @@ -79,7 +79,8 @@ impl<'backend, B: BlackBoxFunctionSolver> DebugContext<'backend, B> { })) } ACVMStatus::RequiresForeignCall(foreign_call) => { - let foreign_call_result = self.foreign_call_executor.execute(&foreign_call, self.show_output)?; + let foreign_call_result = + self.foreign_call_executor.execute(&foreign_call, self.show_output)?; self.acvm.as_mut().unwrap().resolve_pending_foreign_call(foreign_call_result); Ok(SolveResult::Ok) } @@ -104,7 +105,7 @@ impl<'backend, B: BlackBoxFunctionSolver> DebugContext<'backend, B> { println!("At {}:{start}-{end}", file.path.as_path().display()); println!("\n{}\n", &source[start..end]); } - }, + } None => {} } } @@ -113,7 +114,7 @@ impl<'backend, B: BlackBoxFunctionSolver> DebugContext<'backend, B> { loop { match self.step_opcode()? { SolveResult::Done => break, - SolveResult::Ok => {}, + SolveResult::Ok => {} } } Ok(SolveResult::Done) @@ -132,7 +133,7 @@ impl From for DebuggingError { fn map_command_status(result: SolveResult) -> CommandStatus { match result { SolveResult::Ok => CommandStatus::Done, - SolveResult::Done => CommandStatus::Quit + SolveResult::Done => CommandStatus::Quit, } } @@ -168,22 +169,28 @@ pub fn debug_circuit( }; let mut repl = Repl::builder() - .add("s", command! { - "step to the next opcode", - () => || { - let result = ref_step.borrow_mut().step_opcode().into_critical()?; - ref_step.borrow().show_current_vm_status(); - handle_result(result) - } - }) - .add("c", command! { - "continue execution until the end of the program", - () => || { - println!("(Continuing execution...)"); - let result = ref_cont.borrow_mut().cont().into_critical()?; - handle_result(result) - } - }) + .add( + "s", + command! { + "step to the next opcode", + () => || { + let result = ref_step.borrow_mut().step_opcode().into_critical()?; + ref_step.borrow().show_current_vm_status(); + handle_result(result) + } + }, + ) + .add( + "c", + command! { + "continue execution until the end of the program", + () => || { + println!("(Continuing execution...)"); + let result = ref_cont.borrow_mut().cont().into_critical()?; + handle_result(result) + } + }, + ) .build() .expect("Failed to initialize debugger repl"); diff --git a/tooling/nargo/src/ops/mod.rs b/tooling/nargo/src/ops/mod.rs index ab0aaf6c37d..491320482cf 100644 --- a/tooling/nargo/src/ops/mod.rs +++ b/tooling/nargo/src/ops/mod.rs @@ -1,7 +1,7 @@ pub use self::execute::execute_circuit; +pub use self::foreign_calls::ForeignCallExecutor; pub use self::optimize::{optimize_contract, optimize_program}; pub use self::test::{run_test, TestStatus}; -pub use self::foreign_calls::ForeignCallExecutor; mod execute; mod foreign_calls; diff --git a/tooling/nargo_cli/src/cli/debug_cmd.rs b/tooling/nargo_cli/src/cli/debug_cmd.rs index db1b75428c5..5f457d9fe2d 100644 --- a/tooling/nargo_cli/src/cli/debug_cmd.rs +++ b/tooling/nargo_cli/src/cli/debug_cmd.rs @@ -1,9 +1,9 @@ use acvm::acir::native_types::WitnessMap; use clap::Args; +use nargo::artifacts::debug::DebugArtifact; use nargo::constants::PROVER_INPUT_FILE; use nargo::package::Package; -use nargo::artifacts::debug::DebugArtifact; use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; use noirc_abi::input_parser::{Format, InputValue}; use noirc_abi::InputMap; @@ -116,8 +116,6 @@ pub(crate) fn debug_program( ); match solved_witness_err { Ok(solved_witness) => Ok(solved_witness), - Err(err) => { - Err(crate::errors::CliError::NargoError(err)) - } + Err(err) => Err(crate::errors::CliError::NargoError(err)), } }