From a1d9d0f9f9cf2ef96ca7db3310376ca803dc2167 Mon Sep 17 00:00:00 2001 From: Lee Gyumin Date: Mon, 16 Mar 2026 14:17:42 +0900 Subject: [PATCH] core: refactor fee payment guard in state transition --- core/state_transition.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index 6a40b4f7ab..b0a0745514 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -563,17 +563,19 @@ func (st *stateTransition) execute() (*ExecutionResult, error) { if err != nil { return nil, err } - effectiveTip := msg.GasPrice - if rules.IsLondon { - effectiveTip = new(big.Int).Sub(msg.GasPrice, st.evm.Context.BaseFee) - } - effectiveTipU256, _ := uint256.FromBig(effectiveTip) - if st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 { - // Skip fee payment when NoBaseFee is set and the fee fields - // are 0. This avoids a negative effectiveTip being applied to - // the coinbase when simulating calls. - } else { + skipFeePayment := st.evm.Config.NoBaseFee && msg.GasFeeCap.Sign() == 0 && msg.GasTipCap.Sign() == 0 + + // Skip fee payment when NoBaseFee is set and the fee fields + // are 0. This avoids a negative effectiveTip being applied to + // the coinbase when simulating calls. + if !skipFeePayment { + effectiveTip := msg.GasPrice + if rules.IsLondon { + effectiveTip = new(big.Int).Sub(msg.GasPrice, st.evm.Context.BaseFee) + } + effectiveTipU256, _ := uint256.FromBig(effectiveTip) + fee := new(uint256.Int).SetUint64(st.gasUsed()) fee.Mul(fee, effectiveTipU256) st.state.AddBalance(st.evm.Context.Coinbase, fee, tracing.BalanceIncreaseRewardTransactionFee)