Skip to content

Commit

Permalink
refactor(dojo): change usage of trace! to avoid path prefix (#2830)
Browse files Browse the repository at this point in the history
[ISSUES#2829] Optimize trace!.
  • Loading branch information
847850277 authored Dec 21, 2024
1 parent 7ff762c commit 12c96ae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions crates/dojo/utils/src/tx/declarer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use starknet::core::types::{
BlockId, BlockTag, DeclareTransactionResult, Felt, FlattenedSierraClass, StarknetError,
};
use starknet::providers::{Provider, ProviderError};
use tracing::trace;

use crate::{
FeeConfig, TransactionError, TransactionExt, TransactionResult, TransactionWaiter, TxnConfig,
Expand Down Expand Up @@ -92,7 +93,7 @@ where
match account.provider().get_class(BlockId::Tag(BlockTag::Pending), class_hash).await {
Err(ProviderError::StarknetError(StarknetError::ClassHashNotFound)) => {}
Ok(_) => {
tracing::trace!(
trace!(
label = labeled_class.label,
class_hash = format!("{:#066x}", class_hash),
"Class already declared."
Expand All @@ -104,7 +105,7 @@ where

let casm_class_hash = labeled_class.casm_class_hash;

tracing::trace!(
trace!(
label = labeled_class.label,
class_hash = format!("{:#066x}", class_hash),
casm_class_hash = format!("{:#066x}", casm_class_hash),
Expand All @@ -127,7 +128,7 @@ where
}
};

tracing::trace!(
trace!(
label = labeled_class.label,
transaction_hash = format!("{:#066x}", transaction_hash),
class_hash = format!("{:#066x}", class_hash),
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo/utils/src/tx/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
match provider.get_class_hash_at(BlockId::Tag(BlockTag::Pending), contract_address).await {
Err(ProviderError::StarknetError(StarknetError::ContractNotFound)) => Ok(false),
Ok(_) => {
tracing::trace!(
trace!(
contract_address = format!("{:#066x}", contract_address),
"Contract already deployed."
);
Expand Down
3 changes: 2 additions & 1 deletion crates/dojo/world/src/diff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use starknet::core::types::contract::SierraClass;
use starknet::core::types::{BlockId, BlockTag, StarknetError};
use starknet::providers::{Provider, ProviderError};
use starknet_crypto::Felt;
use tracing::trace;

use super::local::{ResourceLocal, WorldLocal};
use super::remote::{ResourceRemote, WorldRemote};
Expand Down Expand Up @@ -171,7 +172,7 @@ impl WorldDiff {
{
Err(ProviderError::StarknetError(StarknetError::ContractNotFound)) => Ok(false),
Ok(_) => {
tracing::trace!(
trace!(
contract_address = format!("{:#066x}", world_address),
"World already deployed."
);
Expand Down
6 changes: 3 additions & 3 deletions crates/dojo/world/src/remote/events_to_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl WorldRemote {
// The world contract exists, we can continue and fetch the events.
}
Err(ProviderError::StarknetError(StarknetError::ContractNotFound)) => {
tracing::trace!(%world_address, "No remote world contract found.");
trace!(%world_address, "No remote world contract found.");
return Ok(world);
}
Err(e) => return Err(e.into()),
Expand Down Expand Up @@ -70,7 +70,7 @@ impl WorldRemote {

let chunk_size = 500;

tracing::trace!(
trace!(
world_address = format!("{:#066x}", world_address),
chunk_size,
?filter,
Expand Down Expand Up @@ -106,7 +106,7 @@ impl WorldRemote {
for event in &events {
match world::Event::try_from(event) {
Ok(ev) => {
tracing::trace!(?ev, "Processing world event.");
trace!(?ev, "Processing world event.");
world.match_event(ev)?;
}
Err(e) => {
Expand Down

0 comments on commit 12c96ae

Please sign in to comment.