From af2b1bc1b06bc4babbd0b12c19964359f7db95cc Mon Sep 17 00:00:00 2001 From: yperbasis Date: Fri, 1 Nov 2024 09:54:13 +0100 Subject: [PATCH] EIP-4844-pectra (collect blob gas fee) --- core/state_transition.go | 9 ++++----- erigon-lib/chain/chain_config.go | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index 2716b25806f..cd9c59a1adf 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -79,8 +79,6 @@ type StateTransition struct { //some pre-allocated intermediate variables sharedBuyGas *uint256.Int sharedBuyGasBalance *uint256.Int - - isBor bool } // Message represents a message sent to a contract. @@ -127,7 +125,6 @@ func IntrinsicGas(data []byte, accessList types2.AccessList, isContractCreation // NewStateTransition initialises and returns a new state transition object. func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool) *StateTransition { - isBor := evm.ChainConfig().Bor != nil return &StateTransition{ gp: gp, evm: evm, @@ -141,8 +138,6 @@ func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool) *StateTransition sharedBuyGas: uint256.NewInt(0), sharedBuyGasBalance: uint256.NewInt(0), - - isBor: isBor, } } @@ -481,6 +476,10 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype if burntContractAddress != nil { burnAmount := new(uint256.Int).Mul(new(uint256.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee) st.state.AddBalance(*burntContractAddress, burnAmount, tracing.BalanceChangeUnspecified) + if rules.IsAura && rules.IsPrague { + // https://github.com/gnosischain/specs/blob/master/network-upgrades/pectra.md#eip-4844-pectra + st.state.AddBalance(*burntContractAddress, st.evm.BlobFee, tracing.BalanceChangeUnspecified) + } } } diff --git a/erigon-lib/chain/chain_config.go b/erigon-lib/chain/chain_config.go index 55c97d6f736..96fbfc7666f 100644 --- a/erigon-lib/chain/chain_config.go +++ b/erigon-lib/chain/chain_config.go @@ -75,7 +75,10 @@ type Config struct { TargetBlobGasPerBlock *uint64 `json:"targetBlobGasPerBlock,omitempty"` BlobGasPriceUpdateFraction *uint64 `json:"blobGasPriceUpdateFraction,omitempty"` - // (Optional) governance contract where EIP-1559 fees will be sent to that otherwise would be burnt since the London fork + // (Optional) governance contract where EIP-1559 fees will be sent to, which otherwise would be burnt since the London fork. + // A key corresponds to the block number, starting from which the fees are sent to the address (map value). + // Starting from Prague, EIP-4844 fees might be collected as well: + // see https://github.com/gnosischain/specs/blob/master/network-upgrades/pectra.md#eip-4844-pectra. BurntContract map[string]common.Address `json:"burntContract,omitempty"` // (Optional) deposit contract of PoS chains