Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] Add debug prints for execution time of a tx / dry run #19374

Merged
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
19 changes: 15 additions & 4 deletions crates/sui/src/client_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ use tabled::{
},
};

use tracing::info;
use tracing::{debug, info};

#[path = "unit_tests/profiler_tests.rs"]
#[cfg(test)]
Expand Down Expand Up @@ -2702,11 +2702,13 @@ pub async fn execute_dry_run(
.transaction_builder()
.tx_data_for_dry_run(signer, kind, gas_budget, gas_price, gas_payment, sponsor)
.await;
debug!("Executing dry run");
let response = client
.read_api()
.dry_run_transaction_block(dry_run_tx_data)
.await
.map_err(|e| anyhow!("Dry run failed: {e}"))?;
debug!("Finished executing dry run");
let resp = SuiClientCommandResult::DryRun(response)
.prerender_clever_errors(client.read_api())
.await;
Expand Down Expand Up @@ -2820,18 +2822,22 @@ pub(crate) async fn dry_run_or_execute_or_serialize(
let gas_budget = match gas_budget {
Some(gas_budget) => gas_budget,
None => {
estimate_gas_budget(
debug!("Estimating gas budget");
let budget = estimate_gas_budget(
&client,
signer,
tx_kind.clone(),
gas_price,
gas.clone(),
None,
)
.await?
.await?;
debug!("Finished estimating gas budget");
budget
}
};

debug!("Preparing transaction data");
let tx_data = client
.transaction_builder()
.tx_data(
Expand All @@ -2843,6 +2849,7 @@ pub(crate) async fn dry_run_or_execute_or_serialize(
None,
)
.await?;
debug!("Finished preparing transaction data");

if serialize_unsigned_transaction {
Ok(SuiClientCommandResult::SerializedUnsignedTransaction(
Expand All @@ -2861,7 +2868,11 @@ pub(crate) async fn dry_run_or_execute_or_serialize(
))
} else {
let transaction = Transaction::new(sender_signed_data);
let mut response = context.execute_transaction_may_fail(transaction).await?;
debug!("Executing transaction: {:?}", transaction);
let mut response = context
.execute_transaction_may_fail(transaction.clone())
.await?;
debug!("Transaction executed: {:?}", transaction);
if let Some(effects) = response.effects.as_mut() {
prerender_clever_errors(effects, client.read_api()).await;
}
Expand Down
Loading