Skip to content

Commit 4b097d6

Browse files
apollo_proof_manager: log verify and store times
1 parent a3af478 commit 4b097d6

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_class_manager_types/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ strum = { workspace = true, features = ["derive"] }
2626
strum_macros.workspace = true
2727
thiserror.workspace = true
2828
tokio.workspace = true
29+
tracing.workspace = true
2930

3031
[dev-dependencies]
3132
apollo_proof_manager_types = { workspace = true, features = ["testing"] }

crates/apollo_class_manager_types/src/transaction_converter.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::time::Instant;
2+
13
use apollo_proof_manager_types::{ProofManagerClientError, SharedProofManagerClient};
24
use async_trait::async_trait;
35
#[cfg(any(feature = "testing", test))]
@@ -27,6 +29,7 @@ use starknet_api::transaction::fields::{Fee, Proof, ProofFacts};
2729
use starknet_api::transaction::CalculateContractAddress;
2830
use starknet_api::{executable_transaction, transaction, StarknetApiError};
2931
use thiserror::Error;
32+
use tracing::info;
3033

3134
use crate::{ClassHashes, ClassManagerClientError, SharedClassManagerClient};
3235

@@ -338,7 +341,14 @@ impl TransactionConverter {
338341
};
339342
let internal_tx = self.convert_rpc_tx_to_internal_rpc_tx(tx).await?;
340343
if let Some((proof_facts, proof)) = proof_data {
344+
let proof_manager_store_start = Instant::now();
341345
self.proof_manager_client.set_proof(proof_facts, proof).await?;
346+
let proof_manager_store_duration = proof_manager_store_start.elapsed();
347+
let tx_hash = internal_tx.tx_hash;
348+
info!(
349+
"Proof manager store in the consensus took: {proof_manager_store_duration:?} for \
350+
tx hash: {tx_hash:?}"
351+
);
342352
}
343353
Ok(internal_tx)
344354
}
@@ -362,7 +372,14 @@ impl TransactionConverter {
362372
return Ok(());
363373
}
364374

375+
let verify_start = Instant::now();
365376
self.verify_proof(proof_facts.clone(), proof.clone())?;
377+
let verify_duration = verify_start.elapsed();
378+
let proof_facts_hash = proof_facts.hash();
379+
info!(
380+
"Proof verification took: {verify_duration:?} for proof facts hash: \
381+
{proof_facts_hash:?}"
382+
);
366383
Ok(())
367384
}
368385

crates/apollo_gateway/src/gateway.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::clone::Clone;
22
use std::sync::Arc;
3+
use std::time::Instant;
34

45
use apollo_class_manager_types::transaction_converter::{
56
TransactionConverter,
@@ -36,7 +37,7 @@ use starknet_api::rpc_transaction::{
3637
RpcTransaction,
3738
};
3839
use starknet_api::transaction::fields::TransactionSignature;
39-
use tracing::{debug, error, warn};
40+
use tracing::{debug, error, info, warn};
4041

4142
use crate::errors::{
4243
mempool_client_result_to_deprecated_gw_result,
@@ -169,16 +170,29 @@ impl Gateway {
169170
.inspect_err(|e| metric_counters.record_add_tx_failure(e))?;
170171

171172
if let Some((proof_facts, proof)) = proof_data {
173+
let tx_hash = internal_tx.tx_hash;
172174
let proof_manager_client = self.transaction_converter.get_proof_manager_client();
175+
let proof_manager_store_start = Instant::now();
173176
if let Err(e) = proof_manager_client.set_proof(proof_facts.clone(), proof.clone()).await
174177
{
175178
error!("Failed to set proof in proof manager: {}", e);
176179
}
180+
let proof_manager_store_duration = proof_manager_store_start.elapsed();
181+
info!(
182+
"Proof manager store took: {proof_manager_store_duration:?} for tx hash: \
183+
{tx_hash:?}"
184+
);
185+
let proof_archive_writer_start = Instant::now();
177186
let proof_archive_writer = self.proof_archive_writer.clone();
178187
tokio::spawn(async move {
179188
if let Err(e) = proof_archive_writer.set_proof(proof_facts, proof).await {
180189
error!("Failed to archive proof to GCS: {}", e);
181190
}
191+
let proof_archive_writer_duration = proof_archive_writer_start.elapsed();
192+
info!(
193+
"Proof archive writer took: {proof_archive_writer_duration:?} for tx hash: \
194+
{tx_hash:?}"
195+
);
182196
});
183197
}
184198
let gateway_output = create_gateway_output(&internal_tx);

0 commit comments

Comments
 (0)