From 5706ecc03c3009125e812fdfc17165f932b41655 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Mon, 31 Oct 2022 15:41:27 -0700 Subject: [PATCH] op-geth: add hardcoded addresses for fee payouts Reduce the amount of consensus critical config by hardcoding the addresses that fees pay out to. The final recipient of the fees can now be controlled at the application layer, by the admin of the proxy sitting at the addresses that fees are paid out to. --- core/state_transition.go | 4 ++-- params/config.go | 6 ++---- params/protocol_params.go | 13 ++++++++++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index 5d6c790813..7d25e01350 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -427,9 +427,9 @@ func (st *StateTransition) innerTransitionDb() (*ExecutionResult, error) { } if optimismConfig := st.evm.ChainConfig().Optimism; optimismConfig != nil { - st.state.AddBalance(optimismConfig.BaseFeeRecipient, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)) + st.state.AddBalance(params.OptimismBaseFeeRecipient, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)) if cost := st.evm.Context.L1CostFunc(st.evm.Context.BlockNumber.Uint64(), st.msg); cost != nil { - st.state.AddBalance(optimismConfig.L1FeeRecipient, cost) + st.state.AddBalance(params.OptimismL1FeeRecipient, cost) } } diff --git a/params/config.go b/params/config.go index 7a75ce2e96..cf671b9e7c 100644 --- a/params/config.go +++ b/params/config.go @@ -411,10 +411,8 @@ func (c *CliqueConfig) String() string { // OptimismConfig is the optimism config. type OptimismConfig struct { - BaseFeeRecipient common.Address `json:"baseFeeRecipient"` - L1FeeRecipient common.Address `json:"l1FeeRecipient"` - EIP1559Elasticity uint64 `json:"eip1559Elasticity"` - EIP1559Denominator uint64 `json:"eip1559Denominator"` + EIP1559Elasticity uint64 `json:"eip1559Elasticity"` + EIP1559Denominator uint64 `json:"eip1559Denominator"` } // String implements the stringer interface, returning the optimism fee config details. diff --git a/params/protocol_params.go b/params/protocol_params.go index 5f154597a7..6373b7df88 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -16,7 +16,18 @@ package params -import "math/big" +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" +) + +var ( + // The base fee portion of the transaction fee accumulates at this predeploy + OptimismBaseFeeRecipient = common.HexToAddress("0x4200000000000000000000000000000000000019") + // The L1 portion of the transaction fee accumulates at this predeploy + OptimismL1FeeRecipient = common.HexToAddress("0x420000000000000000000000000000000000001A") +) const ( GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations.