From 8f250fbf5c4e1df49b489f9a3c67150f9c12e0ee Mon Sep 17 00:00:00 2001 From: ungaro Date: Mon, 26 Aug 2024 20:19:06 -0400 Subject: [PATCH 1/2] Add deployment summary with comma-formatted variables and constraints counts. --- leo/cli/commands/deploy.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/leo/cli/commands/deploy.rs b/leo/cli/commands/deploy.rs index eac245f802..9cce16ff07 100644 --- a/leo/cli/commands/deploy.rs +++ b/leo/cli/commands/deploy.rs @@ -18,6 +18,7 @@ use super::*; use aleo_std::StorageMode; use dialoguer::{theme::ColorfulTheme, Confirm}; use leo_retriever::NetworkName; +use num_format::{Locale, ToFormattedString}; use snarkvm::{ circuit::{Aleo, AleoCanaryV0, AleoTestnetV0, AleoV0}, ledger::query::Query as SnarkVMQuery, @@ -129,6 +130,13 @@ fn handle_deploy, N: Network>( return Err(CliError::constraint_limit_exceeded(name, N::MAX_DEPLOYMENT_CONSTRAINTS, network).into()); } + // Print deployment summary with comma-formatted variables and constraints counts. + println!( + "📊 Deployment Summary:\n Total Variables: {:>10}\n Total Constraints: {:>10}", + deployment.num_combined_variables()?.to_formatted_string(&Locale::en), + deployment.num_combined_constraints()?.to_formatted_string(&Locale::en) + ); + let deployment_id = deployment.to_deployment_id()?; let store = ConsensusStore::>::open(StorageMode::Production)?; From 48bd83199506472e46c5dde7f2ef0526db5788ee Mon Sep 17 00:00:00 2001 From: ungaro Date: Mon, 26 Aug 2024 20:53:38 -0400 Subject: [PATCH 2/2] No need to call deployment.num_combined_variables etc multiple times --- leo/cli/commands/deploy.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/leo/cli/commands/deploy.rs b/leo/cli/commands/deploy.rs index 9cce16ff07..6d065f49c4 100644 --- a/leo/cli/commands/deploy.rs +++ b/leo/cli/commands/deploy.rs @@ -122,19 +122,22 @@ fn handle_deploy, N: Network>( // Generate the deployment let deployment = package.deploy::(None)?; + let variables = deployment.num_combined_variables()?; + let constraints = deployment.num_combined_constraints()?; + // Check if the number of variables and constraints are within the limits. - if deployment.num_combined_variables()? > N::MAX_DEPLOYMENT_VARIABLES { + if variables > N::MAX_DEPLOYMENT_VARIABLES { return Err(CliError::variable_limit_exceeded(name, N::MAX_DEPLOYMENT_VARIABLES, network).into()); } - if deployment.num_combined_constraints()? > N::MAX_DEPLOYMENT_CONSTRAINTS { + if constraints > N::MAX_DEPLOYMENT_CONSTRAINTS { return Err(CliError::constraint_limit_exceeded(name, N::MAX_DEPLOYMENT_CONSTRAINTS, network).into()); } - // Print deployment summary with comma-formatted variables and constraints counts. + // Print deployment summary println!( "📊 Deployment Summary:\n Total Variables: {:>10}\n Total Constraints: {:>10}", - deployment.num_combined_variables()?.to_formatted_string(&Locale::en), - deployment.num_combined_constraints()?.to_formatted_string(&Locale::en) + variables.to_formatted_string(&Locale::en), + constraints.to_formatted_string(&Locale::en) ); let deployment_id = deployment.to_deployment_id()?;