Support base fee vault (#13)

This commit is contained in:
Moon Shiesty 2023-11-30 14:12:45 -06:00 committed by GitHub
parent 621aabde9e
commit a1b6b2229a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -506,6 +506,12 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
st.state.AddBalance(st.evm.Context.Coinbase, fee) st.state.AddBalance(st.evm.Context.Coinbase, fee)
} }
// <specular modification>
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))
}
// </specular modification>
return &ExecutionResult{ return &ExecutionResult{
UsedGas: st.gasUsed(), UsedGas: st.gasUsed(),
Err: vmerr, Err: vmerr,

View file

@ -336,6 +336,7 @@ type ChainConfig struct {
// <specular modification> // <specular modification>
EnableL2EngineApi bool `json:"enableL2EngineApi,omitempty"` EnableL2EngineApi bool `json:"enableL2EngineApi,omitempty"`
L2BaseFeeRecipient common.Address `json:"l2BaseFeeRecipient,omitempty"`
// <specular modification/> // <specular modification/>
} }
@ -372,6 +373,7 @@ func (c *ChainConfig) Description() string {
// <specular modification> // <specular modification>
case c.EnableL2EngineApi: case c.EnableL2EngineApi:
banner += "Consensus: L2 gas limit API enabled\n" banner += "Consensus: L2 gas limit API enabled\n"
banner += fmt.Sprintf(" - L2 Base fee recipient: %s\n", c.L2BaseFeeRecipient)
// <specular modification/> // <specular modification/>
case c.Ethash != nil: case c.Ethash != nil:
if c.TerminalTotalDifficulty == nil { if c.TerminalTotalDifficulty == nil {