diff --git a/consensus/misc/create2deployer_test.go b/consensus/misc/create2deployer_test.go index c547a90fea..0da1e8bd13 100644 --- a/consensus/misc/create2deployer_test.go +++ b/consensus/misc/create2deployer_test.go @@ -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: ¶ms.OptimismConfig{}, + FeeParams: ¶ms.FeeParamsConfig{}, CanyonTime: &canyonTime, } if tt.override != nil { diff --git a/consensus/misc/eip1559/eip1559.go b/consensus/misc/eip1559/eip1559.go index 1a405d6121..052774ffb6 100644 --- a/consensus/misc/eip1559/eip1559.go +++ b/consensus/misc/eip1559/eip1559.go @@ -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 } diff --git a/consensus/misc/eip1559/eip1559_test.go b/consensus/misc/eip1559/eip1559_test.go index c48b540b74..089f105bbb 100644 --- a/consensus/misc/eip1559/eip1559_test.go +++ b/consensus/misc/eip1559/eip1559_test.go @@ -63,7 +63,7 @@ func opConfig() *params.ChainConfig { config.CanyonTime = &ct ht := uint64(12) config.HoloceneTime = &ht - config.Optimism = ¶ms.OptimismConfig{ + config.FeeParams = ¶ms.FeeParamsConfig{ EIP1559Elasticity: 6, EIP1559Denominator: 50, EIP1559DenominatorCanyon: &eip1559DenominatorCanyon, diff --git a/consensus/misc/eip4844/eip4844_test.go b/consensus/misc/eip4844/eip4844_test.go index e40eafe6d4..636d609ec2 100644 --- a/consensus/misc/eip4844/eip4844_test.go +++ b/consensus/misc/eip4844/eip4844_test.go @@ -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 := ¶ms.ChainConfig{Optimism: new(params.OptimismConfig)} + config := ¶ms.ChainConfig{FeeParams: new(params.FeeParamsConfig)} bfee := CalcBlobFee(config, header) require.Equal(t, int64(1), bfee.Int64()) diff --git a/core/genesis.go b/core/genesis.go index 37b3e0b203..33c5997f33 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -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 { diff --git a/core/rawdb/accessors_metadata.go b/core/rawdb/accessors_metadata.go index 7dae87a98f..dcf584f232 100644 --- a/core/rawdb/accessors_metadata.go +++ b/core/rawdb/accessors_metadata.go @@ -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 diff --git a/core/state_transition.go b/core/state_transition.go index cfa818a4ac..8acb53c4b1 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -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 { diff --git a/core/superchain_test.go b/core/superchain_test.go index a3ee2c8f0b..0cd6f58230 100644 --- a/core/superchain_test.go +++ b/core/superchain_test.go @@ -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 { @@ -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) } }) } diff --git a/core/txpool/validation.go b/core/txpool/validation.go index 9015685633..333581aef9 100644 --- a/core/txpool/validation.go +++ b/core/txpool/validation.go @@ -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 { diff --git a/core/types/receipt.go b/core/types/receipt.go index a445399c03..b189569efa 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -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 diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index 107500a992..e9fdff08ac 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -38,7 +38,7 @@ var ( conf := *params.AllCliqueProtocolChanges // copy the config conf.Clique = nil conf.BedrockBlock = big.NewInt(0) - conf.Optimism = ¶ms.OptimismConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10} + conf.FeeParams = ¶ms.FeeParamsConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10} return &conf }() ecotoneTestConfig = func() *params.ChainConfig { diff --git a/core/types/rollup_cost.go b/core/types/rollup_cost.go index 68db0a1188..5be9db0910 100644 --- a/core/types/rollup_cost.go +++ b/core/types/rollup_cost.go @@ -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) @@ -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) diff --git a/core/types/rollup_cost_test.go b/core/types/rollup_cost_test.go index b595a14f62..b0fd9d8030 100644 --- a/core/types/rollup_cost_test.go +++ b/core/types/rollup_cost_test.go @@ -119,7 +119,7 @@ func TestFjordL1CostSolidityParity(t *testing.T) { func TestExtractBedrockGasParams(t *testing.T) { regolithTime := uint64(1) config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, RegolithTime: ®olithTime, } @@ -154,7 +154,7 @@ func TestExtractEcotoneGasParams(t *testing.T) { zeroTime := uint64(0) // create a config where ecotone upgrade is active config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, RegolithTime: &zeroTime, EcotoneTime: &zeroTime, } @@ -186,7 +186,7 @@ func TestExtractFjordGasParams(t *testing.T) { zeroTime := uint64(0) // create a config where fjord is active config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, RegolithTime: &zeroTime, EcotoneTime: &zeroTime, FjordTime: &zeroTime, @@ -214,7 +214,7 @@ func TestExtractIsthmusGasParams(t *testing.T) { zeroTime := uint64(0) // create a config where isthmus is active config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, RegolithTime: &zeroTime, EcotoneTime: &zeroTime, FjordTime: &zeroTime, @@ -250,7 +250,7 @@ func TestFirstBlockEcotoneGasParams(t *testing.T) { zeroTime := uint64(0) // create a config where ecotone upgrade is active config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, RegolithTime: &zeroTime, EcotoneTime: &zeroTime, } @@ -361,7 +361,7 @@ func TestNewL1CostFunc(t *testing.T) { time := uint64(10) timeInFuture := uint64(20) config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, } statedb := &testStateGetter{ baseFee: baseFee, @@ -435,7 +435,7 @@ func TestNewL1CostFunc(t *testing.T) { func TestNewOperatorCostFunc(t *testing.T) { time := uint64(10) config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, } statedb := &testStateGetter{ baseFee: baseFee, @@ -518,7 +518,7 @@ func TestTotalRollupCostFunc(t *testing.T) { zero := uint64(0) later := uint64(10) config := ¶ms.ChainConfig{ - Optimism: params.OptimismTestConfig.Optimism, + FeeParams: params.OptimismTestConfig.FeeParams, RegolithTime: &zero, EcotoneTime: &zero, FjordTime: &zero, diff --git a/eth/backend.go b/eth/backend.go index 7465ad772b..e5e55c0e77 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -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 } diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index 4c41dc5551..71ba2e1a1e 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -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) @@ -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")) } @@ -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 diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 7668ee28f5..8414ed0232 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -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 { diff --git a/eth/gasprice/gasprice_test.go b/eth/gasprice/gasprice_test.go index 0c36eb4e77..8333d1824f 100644 --- a/eth/gasprice/gasprice_test.go +++ b/eth/gasprice/gasprice_test.go @@ -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 = ¶ms.OptimismConfig{ + config.FeeParams = ¶ms.FeeParamsConfig{ EIP1559Elasticity: 6, EIP1559Denominator: 50, EIP1559DenominatorCanyon: &denom, @@ -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() diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index 00d0ab34b0..0e774ca42e 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -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) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index cc102e16f9..1e64bc4e9e 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -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 @@ -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 @@ -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) @@ -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) diff --git a/miner/miner.go b/miner/miner.go index d1dbaca2c8..68a73dfea4 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -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()) diff --git a/miner/payload_building_test.go b/miner/payload_building_test.go index a8a50c1130..52d54a7a1d 100644 --- a/miner/payload_building_test.go +++ b/miner/payload_building_test.go @@ -201,7 +201,7 @@ func holoceneConfig() *params.ChainConfig { config.CanyonTime = &t config.HoloceneTime = &t canyonDenom := uint64(250) - config.Optimism = ¶ms.OptimismConfig{ + config.FeeParams = ¶ms.FeeParamsConfig{ EIP1559Elasticity: 6, EIP1559Denominator: 50, EIP1559DenominatorCanyon: &canyonDenom, diff --git a/miner/worker.go b/miner/worker.go index 6726b88b03..c79f729283 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -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 } @@ -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 } @@ -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()) diff --git a/params/config.go b/params/config.go index 780234ab60..92cca7cfc8 100644 --- a/params/config.go +++ b/params/config.go @@ -317,7 +317,7 @@ var ( conf := *AllCliqueProtocolChanges // copy the config conf.Clique = nil conf.BedrockBlock = big.NewInt(5) - conf.Optimism = &OptimismConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10} + conf.FeeParams = &FeeParamsConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10} return &conf }() @@ -336,7 +336,7 @@ var ( conf.IsthmusTime = &zero conf.InteropTime = nil conf.JovianTime = nil - conf.Optimism = &OptimismConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10, EIP1559DenominatorCanyon: uint64ptr(250)} + conf.FeeParams = &FeeParamsConfig{EIP1559Elasticity: 50, EIP1559Denominator: 10, EIP1559DenominatorCanyon: uint64ptr(250)} return &conf }() ) @@ -449,8 +449,8 @@ type ChainConfig struct { Clique *CliqueConfig `json:"clique,omitempty"` BlobScheduleConfig *BlobScheduleConfig `json:"blobSchedule,omitempty"` - // Optimism config, nil if not active - Optimism *OptimismConfig `json:"optimism,omitempty"` + // FeeParams config, nil if not active + FeeParams *FeeParamsConfig `json:"feeParams,omitempty"` } // EthashConfig is the consensus engine configs for proof-of-work based sealing. @@ -472,15 +472,15 @@ func (c CliqueConfig) String() string { return fmt.Sprintf("clique(period: %d, epoch: %d)", c.Period, c.Epoch) } -// OptimismConfig is the optimism config. -type OptimismConfig struct { +// FeeParamsConfig is the optimism config. +type FeeParamsConfig struct { EIP1559Elasticity uint64 `json:"eip1559Elasticity"` EIP1559Denominator uint64 `json:"eip1559Denominator"` EIP1559DenominatorCanyon *uint64 `json:"eip1559DenominatorCanyon,omitempty"` } // String implements the stringer interface, returning the optimism fee config details. -func (o *OptimismConfig) String() string { +func (o *FeeParamsConfig) String() string { return "optimism" } @@ -495,7 +495,7 @@ func (c *ChainConfig) Description() string { } banner += fmt.Sprintf("Chain ID: %v (%s)\n", c.ChainID, network) switch { - case c.Optimism != nil: + case c.FeeParams != nil: banner += "Consensus: Optimism\n" case c.Ethash != nil: banner += "Consensus: Beacon (proof-of-stake), merged from Ethash (proof-of-work)\n" @@ -773,7 +773,7 @@ func (c *ChainConfig) IsInterop(time uint64) bool { // IsOptimism returns whether the node is an optimism node or not. func (c *ChainConfig) IsOptimism() bool { - return c.Optimism != nil + return c.FeeParams != nil } // IsOptimismBedrock returns true iff this is an optimism node & bedrock is active @@ -1069,22 +1069,22 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, // BaseFeeChangeDenominator bounds the amount the base fee can change between blocks. // The time parameters is the timestamp of the block to determine if Canyon is active or not func (c *ChainConfig) BaseFeeChangeDenominator(time uint64) uint64 { - if c.Optimism != nil { + if c.FeeParams != nil { if c.IsCanyon(time) { - if c.Optimism.EIP1559DenominatorCanyon == nil || *c.Optimism.EIP1559DenominatorCanyon == 0 { + if c.FeeParams.EIP1559DenominatorCanyon == nil || *c.FeeParams.EIP1559DenominatorCanyon == 0 { panic("invalid ChainConfig.Optimism.EIP1559DenominatorCanyon value: '0' or 'nil'") } - return *c.Optimism.EIP1559DenominatorCanyon + return *c.FeeParams.EIP1559DenominatorCanyon } - return c.Optimism.EIP1559Denominator + return c.FeeParams.EIP1559Denominator } return DefaultBaseFeeChangeDenominator } // ElasticityMultiplier bounds the maximum gas limit an EIP-1559 block may have. func (c *ChainConfig) ElasticityMultiplier() uint64 { - if c.Optimism != nil { - return c.Optimism.EIP1559Elasticity + if c.FeeParams != nil { + return c.FeeParams.EIP1559Elasticity } return DefaultElasticityMultiplier } diff --git a/params/config_test.go b/params/config_test.go index 609ac3c05a..d63f04f22d 100644 --- a/params/config_test.go +++ b/params/config_test.go @@ -220,7 +220,7 @@ func TestConfigRulesRegolith(t *testing.T) { c := &ChainConfig{ RegolithTime: newUint64(500), LondonBlock: new(big.Int), - Optimism: &OptimismConfig{}, + FeeParams: &FeeParamsConfig{}, } var stamp uint64 if r := c.Rules(big.NewInt(0), true, stamp); r.IsOptimismRegolith { diff --git a/params/superchain.go b/params/superchain.go index 2bfcef031b..c108c2dbc1 100644 --- a/params/superchain.go +++ b/params/superchain.go @@ -61,13 +61,13 @@ func LoadOPStackChainConfig(chConfig *superchain.ChainConfig) (*ChainConfig, err Clique: nil, } - if chConfig.Optimism != nil { - out.Optimism = &OptimismConfig{ - EIP1559Elasticity: chConfig.Optimism.EIP1559Elasticity, - EIP1559Denominator: chConfig.Optimism.EIP1559Denominator, + if chConfig.Genesis.FeeParams != nil { + out.FeeParams = &FeeParamsConfig{ + EIP1559Elasticity: chConfig.Genesis.FeeParams.EIP1559Elasticity, + EIP1559Denominator: chConfig.Genesis.FeeParams.EIP1559Denominator, } - if chConfig.Optimism.EIP1559DenominatorCanyon != nil { - out.Optimism.EIP1559DenominatorCanyon = uint64ptr(*chConfig.Optimism.EIP1559DenominatorCanyon) + if chConfig.Genesis.FeeParams.EIP1559DenominatorCanyon != nil { + out.FeeParams.EIP1559DenominatorCanyon = uint64ptr(*chConfig.Genesis.FeeParams.EIP1559DenominatorCanyon) } } diff --git a/superchain-registry-commit.txt b/superchain-registry-commit.txt index 7af3fd6bb6..62d6968073 100644 --- a/superchain-registry-commit.txt +++ b/superchain-registry-commit.txt @@ -1 +1 @@ -4791054602a56a72705ac7ecd601433c9c955791 \ No newline at end of file +79b30ac92a7c42f726d20cbfb1820c2b71d3f360 \ No newline at end of file diff --git a/superchain/superchain-configs.zip b/superchain/superchain-configs.zip index e89d48f491..c138bbf95a 100644 Binary files a/superchain/superchain-configs.zip and b/superchain/superchain-configs.zip differ diff --git a/superchain/types.go b/superchain/types.go index 76599e9302..9bd600ebbf 100644 --- a/superchain/types.go +++ b/superchain/types.go @@ -16,13 +16,11 @@ type ChainConfig struct { DeploymentTxHash *common.Hash `toml:"deployment_tx_hash"` ChainID uint64 `toml:"chain_id"` - BatchInboxAddr common.Address `toml:"batch_inbox_addr"` BlockTime uint64 `toml:"block_time"` SeqWindowSize uint64 `toml:"seq_window_size"` MaxSequencerDrift uint64 `toml:"max_sequencer_drift"` GasPayingToken *common.Address `toml:"gas_paying_token"` Hardforks HardforkConfig `toml:"hardforks"` - Optimism *OptimismConfig `toml:"optimism,omitempty"` AltDA *AltDAConfig `toml:"alt_da,omitempty"` @@ -47,7 +45,7 @@ type HardforkConfig struct { PectraBlobScheduleTime *uint64 `toml:"pectra_blob_schedule_time,omitempty"` } -type OptimismConfig struct { +type FeeParamsConfig struct { EIP1559Elasticity uint64 `toml:"eip1559_elasticity"` EIP1559Denominator uint64 `toml:"eip1559_denominator"` EIP1559DenominatorCanyon *uint64 `toml:"eip1559_denominator_canyon"` @@ -61,10 +59,11 @@ type AltDAConfig struct { } type GenesisConfig struct { - L2Time uint64 `toml:"l2_time"` - L1 GenesisRef `toml:"l1"` - L2 GenesisRef `toml:"l2"` - SystemConfig SystemConfig `toml:"system_config"` + L2Time uint64 `toml:"l2_time"` + L1 GenesisRef `toml:"l1"` + L2 GenesisRef `toml:"l2"` + SystemConfig SystemConfig `toml:"system_config"` + FeeParams *FeeParamsConfig `toml:"fee_params,omitempty"` } type GenesisRef struct { @@ -74,6 +73,7 @@ type GenesisRef struct { type SystemConfig struct { BatcherAddr common.Address `json:"batcherAddr" toml:"batcherAddress"` + BatchInboxAddr common.Address `json:"batchInboxAddr" toml:"batch_inbox_addr"` Overhead common.Hash `json:"overhead" toml:"overhead"` Scalar common.Hash `json:"scalar" toml:"scalar"` GasLimit uint64 `json:"gasLimit" toml:"gasLimit"`