Skip to content

Commit d60cfd2

Browse files
lxexlxex
andauthored
core: fix london-check to avoid duplication (#23333)
Co-authored-by: lxex <[email protected]>
1 parent 9e59474 commit d60cfd2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/state_transition.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
287287
sender := vm.AccountRef(msg.From())
288288
homestead := st.evm.ChainConfig().IsHomestead(st.evm.Context.BlockNumber)
289289
istanbul := st.evm.ChainConfig().IsIstanbul(st.evm.Context.BlockNumber)
290+
london := st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber)
290291
contractCreation := msg.To() == nil
291292

292293
// Check clauses 4-5, subtract intrinsic gas if everything is correct
@@ -319,15 +320,16 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
319320
st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1)
320321
ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value)
321322
}
322-
if !st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) {
323+
324+
if !london {
323325
// Before EIP-3529: refunds were capped to gasUsed / 2
324326
st.refundGas(params.RefundQuotient)
325327
} else {
326328
// After EIP-3529: refunds are capped to gasUsed / 5
327329
st.refundGas(params.RefundQuotientEIP3529)
328330
}
329331
effectiveTip := st.gasPrice
330-
if st.evm.ChainConfig().IsLondon(st.evm.Context.BlockNumber) {
332+
if london {
331333
effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee))
332334
}
333335
st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip))

0 commit comments

Comments
 (0)