Skip to content

Commit

Permalink
fix: use lower fair l2 gas price for cbt (#2690)
Browse files Browse the repository at this point in the history
this PR reduces fair l2 gas price for chains that use custom base token.
This is needed because CBT quote might fluctuate a lot for volatile
tokens. By the time a transaction reaches the server, it could have
already changed. Such transactions might fail validation without even
getting into the mempool.
  • Loading branch information
ischasny committed Aug 20, 2024
1 parent 835d2d3 commit e1146fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/node/api_server/src/tx_sender/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,12 @@ impl TxSender {
);
return Err(SubmitTxError::GasLimitIsTooBig);
}
if tx.common_data.fee.max_fee_per_gas < fee_input.fair_l2_gas_price().into() {

// At the moment fair_l2_gas_price is rarely changed for ETH-based chains. But for CBT
// chains it gets changed every few blocks because of token price change. We want to avoid
// situations when transactions with low gas price gets into mempool and sit there for a
// long time, so we require max_fee_per_gas to be at least current_l2_fair_gas_price / 2
if tx.common_data.fee.max_fee_per_gas < (fee_input.fair_l2_gas_price() / 2).into() {
tracing::info!(
"Submitted Tx is Unexecutable {:?} because of MaxFeePerGasTooLow {}",
tx.hash(),
Expand Down

0 comments on commit e1146fc

Please sign in to comment.