core: simplify effectiveTip calculation (#31771)

Since we have the effective gas price in the message, we can compute tip by
simply subtracting the basefee. No need to recompute the effective price.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
zhiqiangxu 2025-06-19 17:43:24 +08:00 committed by GitHub
parent 4997a248ab
commit 6762006383
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -534,10 +534,7 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
effectiveTip := msg.GasPrice
if rules.IsLondon {
effectiveTip = new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee)
if effectiveTip.Cmp(msg.GasTipCap) > 0 {
effectiveTip = msg.GasTipCap
}
effectiveTip = new(big.Int).Sub(msg.GasPrice, st.evm.Context.BaseFee)
}
effectiveTipU256, _ := uint256.FromBig(effectiveTip)