Skip to content

Commit 296094d

Browse files
tynesprotolambda
authored andcommitted
op-geth: add hardcoded addresses for fee payouts (ethereum#23)
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.
1 parent 7b465fe commit 296094d

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

core/state_transition.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,9 @@ func (st *StateTransition) innerTransitionDb() (*ExecutionResult, error) {
429429
}
430430

431431
if optimismConfig := st.evm.ChainConfig().Optimism; optimismConfig != nil {
432-
st.state.AddBalance(optimismConfig.BaseFeeRecipient, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee))
432+
st.state.AddBalance(params.OptimismBaseFeeRecipient, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee))
433433
if cost := st.evm.Context.L1CostFunc(st.evm.Context.BlockNumber.Uint64(), st.msg); cost != nil {
434-
st.state.AddBalance(optimismConfig.L1FeeRecipient, cost)
434+
st.state.AddBalance(params.OptimismL1FeeRecipient, cost)
435435
}
436436
}
437437

params/config.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,8 @@ func (c *CliqueConfig) String() string {
413413

414414
// OptimismConfig is the optimism config.
415415
type OptimismConfig struct {
416-
BaseFeeRecipient common.Address `json:"baseFeeRecipient"`
417-
L1FeeRecipient common.Address `json:"l1FeeRecipient"`
418-
EIP1559Elasticity uint64 `json:"eip1559Elasticity"`
419-
EIP1559Denominator uint64 `json:"eip1559Denominator"`
416+
EIP1559Elasticity uint64 `json:"eip1559Elasticity"`
417+
EIP1559Denominator uint64 `json:"eip1559Denominator"`
420418
}
421419

422420
// String implements the stringer interface, returning the optimism fee config details.

params/protocol_params.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@
1616

1717
package params
1818

19-
import "math/big"
19+
import (
20+
"math/big"
21+
22+
"github.com/ethereum/go-ethereum/common"
23+
)
24+
25+
var (
26+
// The base fee portion of the transaction fee accumulates at this predeploy
27+
OptimismBaseFeeRecipient = common.HexToAddress("0x4200000000000000000000000000000000000019")
28+
// The L1 portion of the transaction fee accumulates at this predeploy
29+
OptimismL1FeeRecipient = common.HexToAddress("0x420000000000000000000000000000000000001A")
30+
)
2031

2132
const (
2233
GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations.

0 commit comments

Comments
 (0)