mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-25 02:14:31 +03:00
Merge pull request #28330 from ungaro/alp/number-of-variables-in-deployment
[Feature] Add deployment summary with comma-formatted variables and constraints counts.
This commit is contained in:
commit
73632ba713
@ -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,
|
||||
@ -121,14 +122,24 @@ fn handle_deploy<A: Aleo<Network = N, BaseField = N::Field>, N: Network>(
|
||||
// Generate the deployment
|
||||
let deployment = package.deploy::<A>(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
|
||||
println!(
|
||||
"📊 Deployment Summary:\n Total Variables: {:>10}\n Total Constraints: {:>10}",
|
||||
variables.to_formatted_string(&Locale::en),
|
||||
constraints.to_formatted_string(&Locale::en)
|
||||
);
|
||||
|
||||
let deployment_id = deployment.to_deployment_id()?;
|
||||
|
||||
let store = ConsensusStore::<N, ConsensusMemory<N>>::open(StorageMode::Production)?;
|
||||
|
Loading…
Reference in New Issue
Block a user