Skip to content

Commit 5e21e62

Browse files
committed
Change user_last_max_fee validation
1 parent b77e8fd commit 5e21e62

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

  • batcher/aligned-batcher/src

batcher/aligned-batcher/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,18 @@ impl Batcher {
750750
return Ok(());
751751
};
752752

753+
if msg_max_fee > user_last_max_fee_limit {
754+
std::mem::drop(batch_state_lock);
755+
warn!("Invalid max fee for address {addr}, had fee limit of {user_last_max_fee_limit:?}, sent {msg_max_fee:?}");
756+
send_message(
757+
ws_conn_sink.clone(),
758+
SubmitProofResponseMessage::InvalidMaxFee,
759+
)
760+
.await;
761+
self.metrics.user_error(&["invalid_max_fee", ""]);
762+
return Ok(());
763+
}
764+
753765
let Some(user_accumulated_fee) = batch_state_lock.get_user_total_fees_in_queue(&addr).await
754766
else {
755767
std::mem::drop(batch_state_lock);
@@ -814,18 +826,6 @@ impl Batcher {
814826
return Ok(());
815827
}
816828

817-
if msg_max_fee > user_last_max_fee_limit {
818-
std::mem::drop(batch_state_lock);
819-
warn!("Invalid max fee for address {addr}, had fee limit of {user_last_max_fee_limit:?}, sent {msg_max_fee:?}");
820-
send_message(
821-
ws_conn_sink.clone(),
822-
SubmitProofResponseMessage::InvalidMaxFee,
823-
)
824-
.await;
825-
self.metrics.user_error(&["invalid_max_fee", ""]);
826-
return Ok(());
827-
}
828-
829829
// * ---------------------------------------------------------------------*
830830
// * Add message data into the queue and update user state *
831831
// * ---------------------------------------------------------------------*

0 commit comments

Comments
 (0)