Skip to content

Commit 29e87b3

Browse files
committed
fix: undo msg_max_fee > user_last_max_fee_limit changes
1 parent 1a706b2 commit 29e87b3

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

  • batcher/aligned-batcher/src

batcher/aligned-batcher/src/lib.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -719,18 +719,6 @@ impl Batcher {
719719
return Ok(());
720720
};
721721

722-
if msg_max_fee > user_last_max_fee_limit {
723-
std::mem::drop(batch_state_lock);
724-
warn!("Invalid max fee for address {addr}, had fee limit of {user_last_max_fee_limit:?}, sent {msg_max_fee:?}");
725-
send_message(
726-
ws_conn_sink.clone(),
727-
SubmitProofResponseMessage::InvalidMaxFee,
728-
)
729-
.await;
730-
self.metrics.user_error(&["invalid_max_fee", ""]);
731-
return Ok(());
732-
}
733-
734722
let Some(user_accumulated_fee) = batch_state_lock.get_user_total_fees_in_queue(&addr).await
735723
else {
736724
std::mem::drop(batch_state_lock);
@@ -795,6 +783,20 @@ impl Batcher {
795783
return Ok(());
796784
}
797785

786+
// We check this after replacement logic because if user wants to replace a proof, their
787+
// new_max_fee must be greater or equal than old_max_fee
788+
if msg_max_fee > user_last_max_fee_limit {
789+
std::mem::drop(batch_state_lock);
790+
warn!("Invalid max fee for address {addr}, had fee limit of {user_last_max_fee_limit:?}, sent {msg_max_fee:?}");
791+
send_message(
792+
ws_conn_sink.clone(),
793+
SubmitProofResponseMessage::InvalidMaxFee,
794+
)
795+
.await;
796+
self.metrics.user_error(&["invalid_max_fee", ""]);
797+
return Ok(());
798+
}
799+
798800
// * ---------------------------------------------------------------------*
799801
// * Perform validation over batcher queue *
800802
// * ---------------------------------------------------------------------*

0 commit comments

Comments
 (0)