Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion consensus/misc/create2deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestEnsureCreate2Deployer(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
cfg := params.ChainConfig{
ChainID: big.NewInt(params.BaseMainnetChainID),
Optimism: &params.OptimismConfig{},
FeeParams: &params.FeeParamsConfig{},
CanyonTime: &canyonTime,
}
if tt.override != nil {
Expand Down
2 changes: 1 addition & 1 deletion consensus/misc/eip1559/eip1559.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
if !config.IsLondon(parent.Number) {
parentGasLimit = parent.GasLimit * config.ElasticityMultiplier()
}
if config.Optimism == nil { // gasLimit can adjust instantly in optimism
if config.FeeParams == nil { // gasLimit can adjust instantly in optimism
if err := misc.VerifyGaslimit(parentGasLimit, header.GasLimit); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion consensus/misc/eip1559/eip1559_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func opConfig() *params.ChainConfig {
config.CanyonTime = &ct
ht := uint64(12)
config.HoloceneTime = &ht
config.Optimism = &params.OptimismConfig{
config.FeeParams = &params.FeeParamsConfig{
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: &eip1559DenominatorCanyon,
Expand Down
2 changes: 1 addition & 1 deletion consensus/misc/eip4844/eip4844_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestCalcBlobFeeOPStack(t *testing.T) {
zero := uint64(0)
header := &types.Header{ExcessBlobGas: &zero}
// any non-nil optimism confic should do
config := &params.ChainConfig{Optimism: new(params.OptimismConfig)}
config := &params.ChainConfig{FeeParams: new(params.FeeParamsConfig)}
bfee := CalcBlobFee(config, header)
require.Equal(t, int64(1), bfee.Int64())

Expand Down
4 changes: 2 additions & 2 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error {
if o.OverrideOptimismCanyon != nil {
cfg.CanyonTime = o.OverrideOptimismCanyon
cfg.ShanghaiTime = o.OverrideOptimismCanyon
if cfg.Optimism != nil && (cfg.Optimism.EIP1559DenominatorCanyon == nil || *cfg.Optimism.EIP1559DenominatorCanyon == 0) {
if cfg.FeeParams != nil && (cfg.FeeParams.EIP1559DenominatorCanyon == nil || *cfg.FeeParams.EIP1559DenominatorCanyon == 0) {
eip1559DenominatorCanyon := uint64(250)
cfg.Optimism.EIP1559DenominatorCanyon = &eip1559DenominatorCanyon
cfg.FeeParams.EIP1559DenominatorCanyon = &eip1559DenominatorCanyon
}
}
if o.OverrideOptimismEcotone != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/accessors_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func ReadChainConfig(db ethdb.KeyValueReader, hash common.Hash) *params.ChainCon
log.Error("Invalid chain config JSON", "hash", hash, "err", err)
return nil
}
if config.Optimism != nil {
if config.FeeParams != nil {
config.Clique = nil // get rid of legacy clique data in chain config (optimism goerli issue)
}
return &config
Expand Down
2 changes: 1 addition & 1 deletion core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ func (st *stateTransition) innerExecute() (*ExecutionResult, error) {

// Check that we are post bedrock to enable op-geth to be able to create pseudo pre-bedrock blocks (these are pre-bedrock, but don't follow l2 geth rules)
// Note optimismConfig will not be nil if rules.IsOptimismBedrock is true
if optimismConfig := st.evm.ChainConfig().Optimism; optimismConfig != nil && rules.IsOptimismBedrock && !st.msg.IsDepositTx {
if optimismConfig := st.evm.ChainConfig().FeeParams; optimismConfig != nil && rules.IsOptimismBedrock && !st.msg.IsDepositTx {
gasCost := new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.evm.Context.BaseFee)
amtU256, overflow := uint256.FromBig(gasCost)
if overflow {
Expand Down
8 changes: 4 additions & 4 deletions core/superchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func TestRegistryChainConfigOverride(t *testing.T) {
rawdb.WriteCanonicalHash(db, bl.Hash(), 0)
rawdb.WriteBlock(db, bl)

if genesis.Config.Optimism == nil {
if genesis.Config.FeeParams == nil {
t.Fatal("expected non nil Optimism config")
}
genesis.Config.Optimism.EIP1559DenominatorCanyon = tt.setDenominator
genesis.Config.FeeParams.EIP1559DenominatorCanyon = tt.setDenominator
// create chain config, even with incomplete genesis input: the chain config should be corrected
chainConfig, _, _, err := SetupGenesisBlockWithOverride(db, tdb, genesis, tt.overrides)
if err != nil {
Expand All @@ -99,8 +99,8 @@ func TestRegistryChainConfigOverride(t *testing.T) {
t.Fatalf("expected regolith time to be %d, but got %d", *tt.expectedRegolithTime, *chainConfig.RegolithTime)
}

if *chainConfig.Optimism.EIP1559DenominatorCanyon != tt.expectedDenominator {
t.Fatalf("expected EIP1559DenominatorCanyon to be %d, but got %d", tt.expectedDenominator, *chainConfig.Optimism.EIP1559DenominatorCanyon)
if *chainConfig.FeeParams.EIP1559DenominatorCanyon != tt.expectedDenominator {
t.Fatalf("expected EIP1559DenominatorCanyon to be %d, but got %d", tt.expectedDenominator, *chainConfig.FeeParams.EIP1559DenominatorCanyon)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion core/txpool/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func EffectiveGasLimit(chainConfig *params.ChainConfig, gasLimit uint64, effecti
if effectiveLimit != 0 && effectiveLimit < gasLimit {
gasLimit = effectiveLimit
}
if chainConfig.Optimism != nil {
if chainConfig.FeeParams != nil {
if l1InfoGasOverhead < gasLimit {
gasLimit -= l1InfoGasOverhead
} else {
Expand Down
2 changes: 1 addition & 1 deletion core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu
logIndex++
}
}
if config.Optimism != nil && len(txs) >= 2 && config.IsBedrock(new(big.Int).SetUint64(number)) { // need at least an info tx and a non-info tx
if config.FeeParams != nil && len(txs) >= 2 && config.IsBedrock(new(big.Int).SetUint64(number)) { // need at least an info tx and a non-info tx
gasParams, err := extractL1GasParams(config, time, txs[0].Data())
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion core/types/receipt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (
conf := *params.AllCliqueProtocolChanges // copy the config
conf.Clique = nil
conf.BedrockBlock = big.NewInt(0)
conf.Optimism = &params.OptimismConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10}
conf.FeeParams = &params.FeeParamsConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10}
return &conf
}()
ecotoneTestConfig = func() *params.ChainConfig {
Expand Down
4 changes: 2 additions & 2 deletions core/types/rollup_cost.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func NewRollupCostData(data []byte) (out RollupCostData) {
// NewL1CostFunc returns a function used for calculating data availability fees, or nil if this is
// not an op-stack chain.
func NewL1CostFunc(config *params.ChainConfig, statedb StateGetter) L1CostFunc {
if config.Optimism == nil {
if config.FeeParams == nil {
return nil
}
forBlock := ^uint64(0)
Expand Down Expand Up @@ -206,7 +206,7 @@ func NewL1CostFunc(config *params.ChainConfig, statedb StateGetter) L1CostFunc {
// NewOperatorCostFunc returns a function used for calculating operator fees, or nil if this is
// not an op-stack chain.
func NewOperatorCostFunc(config *params.ChainConfig, statedb StateGetter) OperatorCostFunc {
if config.Optimism == nil {
if config.FeeParams == nil {
return nil
}
forBlock := ^uint64(0)
Expand Down
16 changes: 8 additions & 8 deletions core/types/rollup_cost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestFjordL1CostSolidityParity(t *testing.T) {
func TestExtractBedrockGasParams(t *testing.T) {
regolithTime := uint64(1)
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
RegolithTime: &regolithTime,
}

Expand Down Expand Up @@ -154,7 +154,7 @@ func TestExtractEcotoneGasParams(t *testing.T) {
zeroTime := uint64(0)
// create a config where ecotone upgrade is active
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
RegolithTime: &zeroTime,
EcotoneTime: &zeroTime,
}
Expand Down Expand Up @@ -186,7 +186,7 @@ func TestExtractFjordGasParams(t *testing.T) {
zeroTime := uint64(0)
// create a config where fjord is active
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
RegolithTime: &zeroTime,
EcotoneTime: &zeroTime,
FjordTime: &zeroTime,
Expand Down Expand Up @@ -214,7 +214,7 @@ func TestExtractIsthmusGasParams(t *testing.T) {
zeroTime := uint64(0)
// create a config where isthmus is active
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
RegolithTime: &zeroTime,
EcotoneTime: &zeroTime,
FjordTime: &zeroTime,
Expand Down Expand Up @@ -250,7 +250,7 @@ func TestFirstBlockEcotoneGasParams(t *testing.T) {
zeroTime := uint64(0)
// create a config where ecotone upgrade is active
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
RegolithTime: &zeroTime,
EcotoneTime: &zeroTime,
}
Expand Down Expand Up @@ -361,7 +361,7 @@ func TestNewL1CostFunc(t *testing.T) {
time := uint64(10)
timeInFuture := uint64(20)
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
}
statedb := &testStateGetter{
baseFee: baseFee,
Expand Down Expand Up @@ -435,7 +435,7 @@ func TestNewL1CostFunc(t *testing.T) {
func TestNewOperatorCostFunc(t *testing.T) {
time := uint64(10)
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
}
statedb := &testStateGetter{
baseFee: baseFee,
Expand Down Expand Up @@ -518,7 +518,7 @@ func TestTotalRollupCostFunc(t *testing.T) {
zero := uint64(0)
later := uint64(10)
config := &params.ChainConfig{
Optimism: params.OptimismTestConfig.Optimism,
FeeParams: params.OptimismTestConfig.FeeParams,
RegolithTime: &zero,
EcotoneTime: &zero,
FjordTime: &zero,
Expand Down
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if err != nil {
return nil, err
}
if chainConfig := eth.blockchain.Config(); chainConfig.Optimism != nil { // config.Genesis.Config.ChainID cannot be used because it's based on CLI flags only, thus default to mainnet L1
if chainConfig := eth.blockchain.Config(); chainConfig.FeeParams != nil { // config.Genesis.Config.ChainID cannot be used because it's based on CLI flags only, thus default to mainnet L1
config.NetworkId = chainConfig.ChainID.Uint64() // optimism defaults eth network ID to chain ID
eth.networkID = config.NetworkId
}
Expand Down
6 changes: 3 additions & 3 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
// If the specified head matches with our local head, do nothing and keep
// generating the payload. It's a special corner case that a few slots are
// missing and we are requested to generate the payload in slot.
} else if api.eth.BlockChain().Config().Optimism == nil { // minor Engine API divergence: allow proposers to reorg their own chain
} else if api.eth.BlockChain().Config().FeeParams == nil { // minor Engine API divergence: allow proposers to reorg their own chain
// If the head block is already in our canonical chain, the beacon client is
// probably resyncing. Ignore the update.
log.Info("Ignoring beacon update to old head", "number", block.NumberU64(), "hash", update.HeadBlockHash, "age", common.PrettyAge(time.Unix(int64(block.Time()), 0)), "have", api.eth.BlockChain().CurrentBlock().Number)
Expand Down Expand Up @@ -431,7 +431,7 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl

if payloadAttributes != nil {
var eip1559Params []byte
if api.eth.BlockChain().Config().Optimism != nil {
if api.eth.BlockChain().Config().FeeParams != nil {
if payloadAttributes.GasLimit == nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("gasLimit parameter is required"))
}
Expand Down Expand Up @@ -1161,7 +1161,7 @@ func (api *ConsensusAPI) invalid(err error, latestValid *types.Header) engine.Pa
//
// TODO(karalabe): Spin this goroutine down somehow
func (api *ConsensusAPI) heartbeat() {
if api.eth.BlockChain().Config().Optimism != nil { // don't start the api heartbeat, there is no transition
if api.eth.BlockChain().Config().FeeParams != nil { // don't start the api heartbeat, there is no transition
return
}
// Sleep a bit on startup since there's obviously no beacon client yet
Expand Down
2 changes: 1 addition & 1 deletion eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ type Config struct {
// Clique is allowed for now to live standalone, but ethash is forbidden and can
// only exist on already merged networks.
func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (consensus.Engine, error) {
if config.Optimism != nil {
if config.FeeParams != nil {
return beacon.New(&beacon.OpLegacy{}), nil
}
if config.TerminalTotalDifficulty == nil {
Expand Down
4 changes: 2 additions & 2 deletions eth/gasprice/gasprice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, cancunBlock *big.Int, pe
if opStack {
config.BlobScheduleConfig = nil
denom := uint64(250)
config.Optimism = &params.OptimismConfig{
config.FeeParams = &params.FeeParamsConfig{
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: &denom,
Expand Down Expand Up @@ -215,7 +215,7 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, cancunBlock *big.Int, pe
b.SetPoS()
}
if gspec.Config.IsOptimismHolocene(b.Timestamp()) {
b.SetExtra(eip1559.EncodeHoloceneExtraData(*gspec.Config.Optimism.EIP1559DenominatorCanyon, gspec.Config.Optimism.EIP1559Elasticity))
b.SetExtra(eip1559.EncodeHoloceneExtraData(*gspec.Config.FeeParams.EIP1559DenominatorCanyon, gspec.Config.FeeParams.EIP1559Elasticity))
}
if cancunBlock != nil && b.Number().Cmp(cancunBlock) >= 0 && gspec.Config.BlobScheduleConfig != nil {
b.SetPoS()
Expand Down
2 changes: 1 addition & 1 deletion ethclient/ethclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func generateTestChain(genesis *core.Genesis, length int) []*types.Block {
g.SetExtra([]byte("test"))
if i == 1 {
// Test transactions are included in block #2.
if genesis.Config.Optimism != nil && genesis.Config.IsBedrock(big.NewInt(1)) {
if genesis.Config.FeeParams != nil && genesis.Config.IsBedrock(big.NewInt(1)) {
g.AddTx(depositTx)
}
g.AddTx(testTx1)
Expand Down
8 changes: 4 additions & 4 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ func (api *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.Bloc
header, err := api.b.HeaderByNumber(ctx, number)
if header != nil && err == nil {
response := RPCMarshalHeader(header)
if number == rpc.PendingBlockNumber && api.b.ChainConfig().Optimism == nil {
if number == rpc.PendingBlockNumber && api.b.ChainConfig().FeeParams == nil {
// Pending header need to nil out a few fields
for _, field := range []string{"hash", "nonce", "miner"} {
response[field] = nil
Expand Down Expand Up @@ -532,7 +532,7 @@ func (api *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.Block
block, err := api.b.BlockByNumber(ctx, number)
if block != nil && err == nil {
response, err := RPCMarshalBlock(ctx, block, true, fullTx, api.b.ChainConfig(), api.b)
if err == nil && number == rpc.PendingBlockNumber && api.b.ChainConfig().Optimism == nil {
if err == nil && number == rpc.PendingBlockNumber && api.b.ChainConfig().FeeParams == nil {
// Pending blocks need to nil out a few fields
for _, field := range []string{"hash", "nonce", "miner"} {
response[field] = nil
Expand Down Expand Up @@ -1582,7 +1582,7 @@ func marshalReceipt(receipt *types.Receipt, blockHash common.Hash, blockNumber u
"effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice),
}

if chainConfig.Optimism != nil && !tx.IsDepositTx() {
if chainConfig.FeeParams != nil && !tx.IsDepositTx() {
fields["l1GasPrice"] = (*hexutil.Big)(receipt.L1GasPrice)
fields["l1GasUsed"] = (*hexutil.Big)(receipt.L1GasUsed)
fields["l1Fee"] = (*hexutil.Big)(receipt.L1Fee)
Expand All @@ -1608,7 +1608,7 @@ func marshalReceipt(receipt *types.Receipt, blockHash common.Hash, blockNumber u
fields["operatorFeeConstant"] = hexutil.Uint64(*receipt.OperatorFeeConstant)
}
}
if chainConfig.Optimism != nil && tx.IsDepositTx() && receipt.DepositNonce != nil {
if chainConfig.FeeParams != nil && tx.IsDepositTx() && receipt.DepositNonce != nil {
fields["depositNonce"] = hexutil.Uint64(*receipt.DepositNonce)
if receipt.DepositReceiptVersion != nil {
fields["depositReceiptVersion"] = hexutil.Uint64(*receipt.DepositReceiptVersion)
Expand Down
2 changes: 1 addition & 1 deletion miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func New(eth Backend, config Config, engine consensus.Engine) *Miner {
// and statedb. The returned values can be nil in case the pending block is
// not initialized.
func (miner *Miner) Pending() (*types.Block, types.Receipts, *state.StateDB) {
if miner.chainConfig.Optimism != nil && !miner.config.RollupComputePendingBlock {
if miner.chainConfig.FeeParams != nil && !miner.config.RollupComputePendingBlock {
// For compatibility when not computing a pending block, we serve the latest block as "pending"
headHeader := miner.chain.CurrentHeader()
headBlock := miner.chain.GetBlock(headHeader.Hash(), headHeader.Number.Uint64())
Expand Down
2 changes: 1 addition & 1 deletion miner/payload_building_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func holoceneConfig() *params.ChainConfig {
config.CanyonTime = &t
config.HoloceneTime = &t
canyonDenom := uint64(250)
config.Optimism = &params.OptimismConfig{
config.FeeParams = &params.FeeParamsConfig{
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: &canyonDenom,
Expand Down
6 changes: 3 additions & 3 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir
Coinbase: genParams.coinbase,
}
// Set the extra field.
if len(miner.config.ExtraData) != 0 && miner.chainConfig.Optimism == nil {
if len(miner.config.ExtraData) != 0 && miner.chainConfig.FeeParams == nil {
// Optimism chains have their own ExtraData handling rules
header.Extra = miner.config.ExtraData
}
Expand All @@ -275,7 +275,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir
}
if genParams.gasLimit != nil { // override gas limit if specified
header.GasLimit = *genParams.gasLimit
} else if miner.chain.Config().Optimism != nil && miner.config.GasCeil != 0 {
} else if miner.chain.Config().FeeParams != nil && miner.config.GasCeil != 0 {
// configure the gas limit of pending blocks with the miner gas limit config when using optimism
header.GasLimit = miner.config.GasCeil
}
Expand Down Expand Up @@ -335,7 +335,7 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
if err != nil {
return nil, err
}
if miner.chainConfig.Optimism != nil { // Allow the miner to reorg its own chain arbitrarily deep
if miner.chainConfig.FeeParams != nil { // Allow the miner to reorg its own chain arbitrarily deep
if historicalBackend, ok := miner.backend.(BackendWithHistoricalState); ok {
var release tracers.StateReleaseFunc
parentBlock := miner.backend.BlockChain().GetBlockByHash(parent.Hash())
Expand Down
Loading