Skip to content

Commit

Permalink
core: move balanceCheck addition in buyGas (ethereum#29762)
Browse files Browse the repository at this point in the history
It's a bit confusing to add msg.value into the balanceCheck within the conditional.
No impact on block validation since GasFeeCap is always set when processing transactions.
  • Loading branch information
zhiqiangxu authored and stwiname committed Sep 9, 2024
1 parent 9ddb3f0 commit 47e9572
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ func (st *StateTransition) buyGas() error {
if st.msg.GasFeeCap != nil {
balanceCheck.SetUint64(st.msg.GasLimit)
balanceCheck = balanceCheck.Mul(balanceCheck, st.msg.GasFeeCap)
balanceCheck.Add(balanceCheck, st.msg.Value)
}
balanceCheck.Add(balanceCheck, st.msg.Value)

if st.evm.ChainConfig().IsCancun(st.evm.Context.BlockNumber, st.evm.Context.Time) {
if blobGas := st.blobGasUsed(); blobGas > 0 {
// Check that the user has enough funds to cover blobGasUsed * tx.BlobGasFeeCap
Expand Down

0 comments on commit 47e9572

Please sign in to comment.