Skip to content

Commit cd62e68

Browse files
authored
fix: add missing is_fee_charge_disabled check (#3007)
1 parent 4cb0230 commit cd62e68

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

crates/op-revm/src/handler.rs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,30 +115,32 @@ where
115115
let mut additional_cost = U256::ZERO;
116116

117117
// The L1-cost fee is only computed for Optimism non-deposit transactions.
118-
if !is_deposit && !ctx.cfg().is_fee_charge_disabled() {
118+
if !is_deposit {
119119
// L1 block info is stored in the context for later use.
120120
// and it will be reloaded from the database if it is not for the current block.
121121
if ctx.chain().l2_block != block_number {
122122
*ctx.chain_mut() = L1BlockInfo::try_fetch(ctx.db_mut(), block_number, spec)?;
123123
}
124124

125-
// account for additional cost of l1 fee and operator fee
126-
let enveloped_tx = ctx
127-
.tx()
128-
.enveloped_tx()
129-
.expect("all not deposit tx have enveloped tx")
130-
.clone();
131-
132-
// compute L1 cost
133-
additional_cost = ctx.chain_mut().calculate_tx_l1_cost(&enveloped_tx, spec);
134-
135-
// compute operator fee
136-
if spec.is_enabled_in(OpSpecId::ISTHMUS) {
137-
let gas_limit = U256::from(ctx.tx().gas_limit());
138-
let operator_fee_charge =
139-
ctx.chain()
140-
.operator_fee_charge(&enveloped_tx, gas_limit, spec);
141-
additional_cost = additional_cost.saturating_add(operator_fee_charge);
125+
if !ctx.cfg().is_fee_charge_disabled() {
126+
// account for additional cost of l1 fee and operator fee
127+
let enveloped_tx = ctx
128+
.tx()
129+
.enveloped_tx()
130+
.expect("all not deposit tx have enveloped tx")
131+
.clone();
132+
133+
// compute L1 cost
134+
additional_cost = ctx.chain_mut().calculate_tx_l1_cost(&enveloped_tx, spec);
135+
136+
// compute operator fee
137+
if spec.is_enabled_in(OpSpecId::ISTHMUS) {
138+
let gas_limit = U256::from(ctx.tx().gas_limit());
139+
let operator_fee_charge =
140+
ctx.chain()
141+
.operator_fee_charge(&enveloped_tx, gas_limit, spec);
142+
additional_cost = additional_cost.saturating_add(operator_fee_charge);
143+
}
142144
}
143145
}
144146

@@ -289,7 +291,9 @@ where
289291
) -> Result<(), Self::Error> {
290292
let mut additional_refund = U256::ZERO;
291293

292-
if evm.ctx().tx().tx_type() != DEPOSIT_TRANSACTION_TYPE {
294+
if evm.ctx().tx().tx_type() != DEPOSIT_TRANSACTION_TYPE
295+
&& !evm.ctx().cfg().is_fee_charge_disabled()
296+
{
293297
let spec = evm.ctx().cfg().spec();
294298
additional_refund = evm
295299
.ctx()

0 commit comments

Comments
 (0)