Skip to content

Commit

Permalink
EIP-4844-pectra (collect blob gas fee) (#12611)
Browse files Browse the repository at this point in the history
Cherry pick #12574 into `release/2.61`
  • Loading branch information
yperbasis authored and somnathb1 committed Nov 4, 2024
1 parent 46ce559 commit de36b50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 4 additions & 5 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,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.
Expand Down Expand Up @@ -125,7 +123,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,
Expand All @@ -139,8 +136,6 @@ func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool) *StateTransition

sharedBuyGas: uint256.NewInt(0),
sharedBuyGasBalance: uint256.NewInt(0),

isBor: isBor,
}
}

Expand Down Expand Up @@ -487,6 +482,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)
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)
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion erigon-lib/chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de36b50

Please sign in to comment.