diff --git a/core/state_transition.go b/core/state_transition.go index d31a2975b0..1dc0fb8e55 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -506,6 +506,12 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { st.state.AddBalance(st.evm.Context.Coinbase, fee) } + // + if (st.evm.ChainConfig().L2BaseFeeRecipient != common.Address{}) { + st.state.AddBalance(st.evm.ChainConfig().L2BaseFeeRecipient, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)) + } + // + return &ExecutionResult{ UsedGas: st.gasUsed(), Err: vmerr, diff --git a/params/config.go b/params/config.go index 55df8579d6..2cc45eae3e 100644 --- a/params/config.go +++ b/params/config.go @@ -335,7 +335,8 @@ type ChainConfig struct { IsDevMode bool `json:"isDev,omitempty"` // - EnableL2EngineApi bool `json:"enableL2EngineApi,omitempty"` + EnableL2EngineApi bool `json:"enableL2EngineApi,omitempty"` + L2BaseFeeRecipient common.Address `json:"l2BaseFeeRecipient,omitempty"` // } @@ -372,6 +373,7 @@ func (c *ChainConfig) Description() string { // case c.EnableL2EngineApi: banner += "Consensus: L2 gas limit API enabled\n" + banner += fmt.Sprintf(" - L2 Base fee recipient: %s\n", c.L2BaseFeeRecipient) // case c.Ethash != nil: if c.TerminalTotalDifficulty == nil {