diff --git a/errors/src/errors/cli/cli_errors.rs b/errors/src/errors/cli/cli_errors.rs index aedf394d95..556fdec39e 100644 --- a/errors/src/errors/cli/cli_errors.rs +++ b/errors/src/errors/cli/cli_errors.rs @@ -306,14 +306,14 @@ create_messages!( msg: "Failed to confirm transaction".to_string(), help: None, } - + @backtraced invalid_balance { args: (account: impl Display), msg: format!("Invalid public balance for account: {account}"), help: Some("Make sure the account has enough balance to pay for the deployment.".to_string()), } - + @backtraced table_render_failed { args: (error: impl Display), diff --git a/errors/src/errors/utils/util_errors.rs b/errors/src/errors/utils/util_errors.rs index cc92ac5435..da25660922 100644 --- a/errors/src/errors/utils/util_errors.rs +++ b/errors/src/errors/utils/util_errors.rs @@ -193,7 +193,7 @@ create_messages!( msg: format!("Invalid field: {field}."), help: Some("Field element must be numerical string with optional \"field\" suffix.".to_string()), } - + @backtraced invalid_bound { args: (bound: impl Display), diff --git a/leo/cli/commands/deploy.rs b/leo/cli/commands/deploy.rs index 640868da80..08cd8897c5 100644 --- a/leo/cli/commands/deploy.rs +++ b/leo/cli/commands/deploy.rs @@ -148,7 +148,7 @@ fn handle_deploy, N: Network>( synthesis_cost as f64 / 1_000_000.0, namespace_cost as f64 / 1_000_000.0, command.fee_options.priority_fee as f64 / 1_000_000.0, - ); + )?; // Initialize an RNG. let rng = &mut rand::thread_rng(); @@ -240,7 +240,7 @@ fn deploy_cost_breakdown( ["Total", &format!("{:.6}", total_cost)], ]; let mut out = Vec::new(); - text_tables::render(&mut out, data).map_err(|err| CliError::table_render_failed(err))?; - println!("{}", ::std::str::from_utf8(&out).map_err(|err| CliError::table_render_failed(err))?); + text_tables::render(&mut out, data).map_err(CliError::table_render_failed)?; + println!("{}", ::std::str::from_utf8(&out).map_err(CliError::table_render_failed)?); Ok(()) } diff --git a/leo/cli/commands/execute.rs b/leo/cli/commands/execute.rs index 63aa8bbc4c..ce07e70153 100644 --- a/leo/cli/commands/execute.rs +++ b/leo/cli/commands/execute.rs @@ -207,7 +207,7 @@ fn handle_execute( storage_cost as f64 / 1_000_000.0, finalize_cost as f64 / 1_000_000.0, command.fee_options.priority_fee as f64 / 1_000_000.0, - ); + )?; // Check if the public balance is sufficient. if fee_record.is_none() { @@ -261,7 +261,13 @@ fn handle_execute( } // Execute the request. let (response, execution, metrics) = package - .execute::(endpoint.to_string(), &private_key, Identifier::try_from(command.name.clone())?, &parsed_inputs, rng) + .execute::( + endpoint.to_string(), + &private_key, + Identifier::try_from(command.name.clone())?, + &parsed_inputs, + rng, + ) .map_err(PackageError::execution_error)?; let fee = None; @@ -369,7 +375,13 @@ fn load_program_from_network( } // A helper function to display a cost breakdown of the execution. -fn execution_cost_breakdown(name: &String, total_cost: f64, storage_cost: f64, finalize_cost: f64, priority_fee: f64) -> Result<()> { +fn execution_cost_breakdown( + name: &String, + total_cost: f64, + storage_cost: f64, + finalize_cost: f64, + priority_fee: f64, +) -> Result<()> { println!("\nBase execution cost for '{}' is {} credits.\n", name.bold(), total_cost); // Display the cost breakdown in a table. let data = [ @@ -380,7 +392,7 @@ fn execution_cost_breakdown(name: &String, total_cost: f64, storage_cost: f64, f ["Total", &format!("{:.6}", total_cost)], ]; let mut out = Vec::new(); - text_tables::render(&mut out, data).map_err(|err| CliError::table_render_failed(err))?; - println!("{}", std::str::from_utf8(&out).map_err(|err| CliError::table_render_failed(err))?); + text_tables::render(&mut out, data).map_err(CliError::table_render_failed)?; + println!("{}", std::str::from_utf8(&out).map_err(CliError::table_render_failed)?); Ok(()) }