Skip to content

Commit

Permalink
EIP-4844-pectra (collect blob gas fee) (#12574)
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis authored Nov 4, 2024
1 parent 2c85f69 commit 4b602ca
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 @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -141,8 +138,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 @@ -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)
}
}
}

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 4b602ca

Please sign in to comment.