Skip to content

Commit 952b785

Browse files
committed
use debug instead of warn for printing times
1 parent 1e6e958 commit 952b785

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

crates/batcher/src/lib.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ pub struct Batcher {
108108
/// Flag to indicate when recovery is in progress
109109
/// When true, message handlers will return ServerBusy responses
110110
/// It's used a way to "lock" all the user_states at the same time
111-
/// If one needed is taken in the handle message it will timeout
111+
/// If one needed is taken in the handle message it will time out
112112
is_recovering_from_submission_failure: RwLock<bool>,
113-
user_states: Arc<tokio::sync::RwLock<HashMap<Address, Arc<Mutex<UserState>>>>>,
113+
user_states: Arc<RwLock<HashMap<Address, Arc<Mutex<UserState>>>>>,
114114

115115
last_uploaded_batch_block: Mutex<u64>,
116116

@@ -180,7 +180,7 @@ impl Batcher {
180180
let deployment_output =
181181
ContractDeploymentOutput::new(config.aligned_layer_deployment_config_file_path);
182182

183-
log::info!(
183+
info!(
184184
"Starting metrics server on port {}",
185185
config.batcher.metrics_port
186186
);
@@ -261,7 +261,7 @@ impl Batcher {
261261
.await
262262
.expect("Failed to get fallback Service Manager contract");
263263

264-
let user_states = Arc::new(tokio::sync::RwLock::new(HashMap::new()));
264+
let user_states = Arc::new(RwLock::new(HashMap::new()));
265265
let batch_state = BatchState::new(config.batcher.max_queue_size);
266266
let non_paying_config = if let Some(non_paying_config) = config.batcher.non_paying {
267267
warn!("Non-paying address configuration detected. Will replace non-paying address {} with configured address.",
@@ -391,7 +391,7 @@ impl Batcher {
391391

392392
fn calculate_new_user_states_data(
393393
&self,
394-
batch_queue: &types::batch_queue::BatchQueue,
394+
batch_queue: &batch_queue::BatchQueue,
395395
) -> HashMap<Address, (usize, U256, U256)> {
396396
let mut updated_user_states = HashMap::new();
397397
for (entry, _) in batch_queue.iter() {
@@ -847,7 +847,7 @@ impl Batcher {
847847
return Ok(());
848848
};
849849

850-
warn!("Message validations completed for {:?} in {:?}", addr_in_msg, validation_start.elapsed());
850+
debug!("Message validations completed for {:?} in {:?}", addr_in_msg, validation_start.elapsed());
851851

852852
let addr;
853853
let signature = client_msg.signature;
@@ -883,12 +883,12 @@ impl Batcher {
883883
let is_user_in_state = self.user_states.read().await.contains_key(&addr);
884884

885885
if !is_user_in_state {
886-
warn!("User state for address {addr:?} not found, creating a new one");
886+
debug!("User state for address {addr:?} not found, creating a new one");
887887
// We add a dummy user state to grab a lock on the user state
888888
let dummy_user_state = UserState::new(U256::zero());
889889
self.user_states
890890
.write().await.insert(addr, Arc::new(Mutex::new(dummy_user_state)));
891-
warn!("Dummy user state for address {addr:?} created");
891+
debug!("Dummy user state for address {addr:?} created");
892892
}
893893

894894
let Some(user_state_ref) = self.user_states.read().await.get(&addr).cloned() else {
@@ -911,7 +911,7 @@ impl Batcher {
911911
return Ok(());
912912
};
913913

914-
warn!("User lock acquired for {:?} in {:?}", addr, user_state_start.elapsed());
914+
debug!("User lock acquired for {:?} in {:?}", addr, user_state_start.elapsed());
915915

916916
// If the user state was not present, we need to get the nonce from the Ethereum contract and update the dummy user state
917917
if !is_user_in_state {
@@ -1011,8 +1011,8 @@ impl Batcher {
10111011
self.metrics.user_error(&["invalid_max_fee", ""]);
10121012
return Ok(());
10131013
}
1014-
1015-
warn!("Balance and nonce validations completed for {:?} in {:?}", addr, balance_validation_start.elapsed());
1014+
1015+
debug!("Balance and nonce validations completed for {:?} in {:?}", addr, balance_validation_start.elapsed());
10161016

10171017
let proof_verification_start = std::time::Instant::now();
10181018
if !self
@@ -1024,7 +1024,7 @@ impl Batcher {
10241024
{
10251025
return Ok(());
10261026
}
1027-
warn!("Proof verification completed for {:?} in {:?}", addr, proof_verification_start.elapsed());
1027+
debug!("Proof verification completed for {:?} in {:?}", addr, proof_verification_start.elapsed());
10281028

10291029
// * ---------------------------------------------------------------------*
10301030
// * Perform validation over batcher queue *
@@ -1134,8 +1134,8 @@ impl Batcher {
11341134
return Ok(());
11351135
}
11361136
}
1137-
1138-
warn!("Queue management and eviction logic completed for {:?} in {:?}", addr, queue_management_start.elapsed());
1137+
1138+
debug!("Queue management and eviction logic completed for {:?} in {:?}", addr, queue_management_start.elapsed());
11391139

11401140
// * ---------------------------------------------------------------------*
11411141
// * Add message data into the queue and update user state *
@@ -1165,10 +1165,9 @@ impl Batcher {
11651165
user_state_guard.last_max_fee_limit = max_fee;
11661166
user_state_guard.proofs_in_batch += 1;
11671167
user_state_guard.total_fees_in_queue += max_fee;
1168-
1169-
warn!("Add to batch and user state update completed for {:?} in {:?}", addr, add_to_batch_start.elapsed());
1168+
debug!("Add to batch and user state update completed for {:?} in {:?}", addr, add_to_batch_start.elapsed());
11701169

1171-
warn!("Verification data message handled for {:?} - total time: {:?}", addr, start_time.elapsed());
1170+
debug!("Verification data message handled for {:?} - total time: {:?}", addr, start_time.elapsed());
11721171
Ok(())
11731172
}
11741173

0 commit comments

Comments
 (0)