From a1b6b2229ad2205ed565c6f651606536f2a6985f Mon Sep 17 00:00:00 2001 From: Moon Shiesty Date: Thu, 30 Nov 2023 14:12:45 -0600 Subject: [PATCH] Support base fee vault (#13) --- core/state_transition.go | 6 ++++++ params/config.go | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 {