From 8cbb3beab7bf6a08f88d2b6f39ce9e276564c1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Bebi=C4=87=E2=80=AE?= Date: Thu, 20 Jun 2024 12:44:19 +0200 Subject: [PATCH] fix blob gas awards --- consensus/consensus.go | 5 +++++ core/state_transition.go | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/consensus/consensus.go b/consensus/consensus.go index b47caf33a0..22bac9d6a8 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -27,6 +27,11 @@ import ( "github.com/tenderly/binance-geth/rpc" ) +// Binance: SystemAddress +var ( + SystemAddress = common.HexToAddress("0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE") +) + // ChainHeaderReader defines a small collection of methods needed to access the local // blockchain during header verification. type ChainHeaderReader interface { diff --git a/core/state_transition.go b/core/state_transition.go index 8092394f2a..56e1b6fcd5 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -24,6 +24,7 @@ import ( "github.com/tenderly/binance-geth/common" cmath "github.com/tenderly/binance-geth/common/math" + "github.com/tenderly/binance-geth/consensus" "github.com/tenderly/binance-geth/core/types" "github.com/tenderly/binance-geth/core/vm" "github.com/tenderly/binance-geth/params" @@ -440,7 +441,14 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } else { fee := new(big.Int).SetUint64(st.gasUsed()) fee.Mul(fee, effectiveTip) - st.state.AddBalance(st.evm.Context.Coinbase, fee) + + st.state.AddBalance(consensus.SystemAddress, fee) + // add extra blob fee reward + if rules.IsCancun { + blobFee := new(big.Int).SetUint64(st.blobGasUsed()) + blobFee.Mul(blobFee, st.evm.Context.BlobBaseFee) + st.state.AddBalance(consensus.SystemAddress, blobFee) + } } return &ExecutionResult{