Skip to content

Commit 5307729

Browse files
committed
jovian: remove feature toggles
the scope is now locked
1 parent 6658a36 commit 5307729

File tree

9 files changed

+30
-36
lines changed

9 files changed

+30
-36
lines changed

consensus/beacon/consensus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
412412

413413
// Store DA footprint in BlobGasUsed header field if it hasn't already been set yet.
414414
// Builder code may already calculate it during block building to avoid recalculating it here.
415-
if chain.Config().IsDAFootprintBlockLimit(header.Time) && (header.BlobGasUsed == nil || *header.BlobGasUsed == 0) {
415+
if chain.Config().IsJovian(header.Time) && (header.BlobGasUsed == nil || *header.BlobGasUsed == 0) {
416416
daFootprint, err := types.CalcDAFootprint(body.Transactions)
417417
if err != nil {
418418
return nil, fmt.Errorf("error calculating DA footprint: %w", err)

consensus/misc/eip1559/eip1559.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header, time uint64)
9292
func calcBaseFeeInner(config *params.ChainConfig, parent *types.Header, elasticity uint64, denominator uint64) *big.Int {
9393
parentGasTarget := parent.GasLimit / elasticity
9494
parentGasMetered := parent.GasUsed
95-
if config.IsDAFootprintBlockLimit(parent.Time) {
95+
if config.IsJovian(parent.Time) {
9696
if parent.BlobGasUsed == nil {
9797
panic("Jovian parent block has nil BlobGasUsed")
9898
} else if *parent.BlobGasUsed > parent.GasUsed {

consensus/misc/eip1559/eip1559_optimism.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const MinBaseFeeExtraDataVersionByte = uint8(0x01)
1212

1313
type ForkChecker interface {
1414
IsHolocene(time uint64) bool
15-
IsMinBaseFee(time uint64) bool
15+
IsJovian(time uint64) bool
1616
}
1717

1818
// ValidateOptimismExtraData validates the Optimism extra data.
1919
// It uses the config and parent time to determine how to do the validation.
2020
func ValidateOptimismExtraData(fc ForkChecker, time uint64, extraData []byte) error {
21-
if fc.IsMinBaseFee(time) {
22-
return ValidateMinBaseFeeExtraData(extraData)
21+
if fc.IsJovian(time) {
22+
return ValidateJovianExtraData(extraData)
2323
} else if fc.IsHolocene(time) {
2424
return ValidateHoloceneExtraData(extraData)
2525
} else if len(extraData) > 0 { // pre-Holocene
@@ -32,8 +32,8 @@ func ValidateOptimismExtraData(fc ForkChecker, time uint64, extraData []byte) er
3232
// It uses the config and parent time to determine how to do the decoding.
3333
// The parent.extraData is expected to be valid (i.e. ValidateOptimismExtraData has been called previously)
3434
func DecodeOptimismExtraData(fc ForkChecker, time uint64, extraData []byte) (uint64, uint64, *uint64) {
35-
if fc.IsMinBaseFee(time) {
36-
denominator, elasticity, minBaseFee := DecodeMinBaseFeeExtraData(extraData)
35+
if fc.IsJovian(time) {
36+
denominator, elasticity, minBaseFee := DecodeJovianExtraData(extraData)
3737
return denominator, elasticity, minBaseFee
3838
} else if fc.IsHolocene(time) {
3939
denominator, elasticity := DecodeHoloceneExtraData(extraData)
@@ -45,11 +45,11 @@ func DecodeOptimismExtraData(fc ForkChecker, time uint64, extraData []byte) (uin
4545
// EncodeOptimismExtraData encodes the Optimism extra data.
4646
// It uses the config and parent time to determine how to do the encoding.
4747
func EncodeOptimismExtraData(fc ForkChecker, time uint64, denominator, elasticity uint64, minBaseFee *uint64) []byte {
48-
if fc.IsMinBaseFee(time) {
48+
if fc.IsJovian(time) {
4949
if minBaseFee == nil {
5050
panic("minBaseFee cannot be nil since the MinBaseFee feature is enabled")
5151
}
52-
return EncodeMinBaseFeeExtraData(denominator, elasticity, *minBaseFee)
52+
return EncodeJovianExtraData(denominator, elasticity, *minBaseFee)
5353
} else if fc.IsHolocene(time) {
5454
return EncodeHoloceneExtraData(denominator, elasticity)
5555
} else {
@@ -136,9 +136,9 @@ func ValidateHoloceneExtraData(extra []byte) error {
136136
// DecodeMinBaseFeeExtraData decodes the extraData parameters from the encoded form defined here:
137137
// https://specs.optimism.io/protocol/jovian/exec-engine.html
138138
//
139-
// Returns 0,0,nil if the format is invalid, and d, e, nil for the Holocene length, to provide best effort behavior for non-MinBaseFee extradata, though ValidateMinBaseFeeExtraData should be used instead of this function for
139+
// Returns 0,0,nil if the format is invalid, and d, e, nil for the Holocene length, to provide best effort behavior for non-MinBaseFee extradata, though ValidateJovianExtraData should be used instead of this function for
140140
// validity checking.
141-
func DecodeMinBaseFeeExtraData(extra []byte) (uint64, uint64, *uint64) {
141+
func DecodeJovianExtraData(extra []byte) (uint64, uint64, *uint64) {
142142
// Best effort to decode the extraData for every block in the chain's history,
143143
// including blocks before the minimum base fee feature was enabled.
144144
if len(extra) == 9 {
@@ -156,7 +156,7 @@ func DecodeMinBaseFeeExtraData(extra []byte) (uint64, uint64, *uint64) {
156156

157157
// EncodeMinBaseFeeExtraData encodes the EIP-1559 and minBaseFee parameters into the header 'ExtraData' format.
158158
// Will panic if EIP-1559 parameters are outside uint32 range.
159-
func EncodeMinBaseFeeExtraData(denom, elasticity, minBaseFee uint64) []byte {
159+
func EncodeJovianExtraData(denom, elasticity, minBaseFee uint64) []byte {
160160
r := make([]byte, 17)
161161
if denom > gomath.MaxUint32 || elasticity > gomath.MaxUint32 {
162162
panic("eip-1559 parameters out of uint32 range")
@@ -168,8 +168,8 @@ func EncodeMinBaseFeeExtraData(denom, elasticity, minBaseFee uint64) []byte {
168168
return r
169169
}
170170

171-
// ValidateMinBaseFeeExtraData checks if the header extraData is valid according to the minimum base fee feature.
172-
func ValidateMinBaseFeeExtraData(extra []byte) error {
171+
// ValidateJovianExtraData checks if the header extraData is valid according to the minimum base fee feature.
172+
func ValidateJovianExtraData(extra []byte) error {
173173
if len(extra) != 17 {
174174
return fmt.Errorf("MinBaseFee extraData should be 17 bytes, got %d", len(extra))
175175
}

core/block_validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
117117
}
118118

119119
// OP Stack Jovian DA footprint block limit.
120-
if v.config.IsDAFootprintBlockLimit(header.Time) {
120+
if v.config.IsJovian(header.Time) {
121121
if header.BlobGasUsed == nil {
122122
return errors.New("nil blob gas used in post-Jovian block header, should store DA footprint")
123123
}

core/types/rollup_cost.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func NewOperatorCostFunc(config *params.ChainConfig, statedb StateGetter) Operat
234234
operatorFeeScalar, operatorFeeConstant := ExtractOperatorFeeParams(operatorFeeParams)
235235

236236
// Return the Operator Fee fix version if the feature is active
237-
if config.IsOperatorFeeFix(blockTime) {
237+
if config.IsJovian(blockTime) {
238238
return newOperatorCostFuncOperatorFeeFix(operatorFeeScalar, operatorFeeConstant)
239239
}
240240
return newOperatorCostFuncIsthmus(operatorFeeScalar, operatorFeeConstant)

miner/miner_optimism_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func testMineAndExecute(t *testing.T, numTxs uint64, cfg *params.ChainConfig, as
113113
parent := b.chain.CurrentBlock()
114114
ts := parent.Time + 12
115115
dtx := new(types.DepositTx)
116-
if cfg.IsDAFootprintBlockLimit(parent.Time) {
116+
if cfg.IsJovian(parent.Time) {
117117
dtx = jovianDepositTx(testDAFootprintGasScalar)
118118
}
119119

@@ -126,7 +126,7 @@ func testMineAndExecute(t *testing.T, numTxs uint64, cfg *params.ChainConfig, as
126126
txs: types.Transactions{types.NewTx(dtx)},
127127
eip1559Params: eip1559.EncodeHolocene1559Params(250, 6),
128128
}
129-
if cfg.IsMinBaseFee(ts) {
129+
if cfg.IsJovian(ts) {
130130
genParams.minBaseFee = new(uint64)
131131
}
132132
r := w.generateWork(genParams, false)

miner/payload_building_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ func newPayloadArgs(parentHash common.Hash, cfg *params.ChainConfig) *BuildPaylo
271271
args.EIP1559Params = validEIP1559Params
272272
}
273273
dtx := new(types.DepositTx)
274-
if cfg.IsDAFootprintBlockLimit(args.Timestamp) {
274+
if cfg.IsJovian(args.Timestamp) {
275275
dtx = jovianDepositTx(testDAFootprintGasScalar)
276276
}
277277
args.Transactions = []*types.Transaction{types.NewTx(dtx)}
278-
if cfg.IsMinBaseFee(args.Timestamp) {
278+
if cfg.IsJovian(args.Timestamp) {
279279
args.MinBaseFee = ptr(uint64(1e9))
280280
}
281281

@@ -344,7 +344,7 @@ func testBuildPayload(t *testing.T, noTxPool, interrupt bool, params1559 []byte,
344344
var expected []byte
345345
if len(params1559) != 0 {
346346
versionByte := eip1559.HoloceneExtraDataVersionByte
347-
if config.IsMinBaseFee(testTimestamp) {
347+
if config.IsJovian(testTimestamp) {
348348
versionByte = eip1559.MinBaseFeeExtraDataVersionByte
349349
}
350350
expected = []byte{versionByte}

miner/worker.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir
312312
// configure the gas limit of pending blocks with the miner gas limit config when using optimism
313313
header.GasLimit = miner.config.GasCeil
314314
}
315-
if miner.chainConfig.IsMinBaseFee(header.Time) && genParams.minBaseFee == nil {
315+
if miner.chainConfig.IsJovian(header.Time) && genParams.minBaseFee == nil {
316316
return nil, errors.New("missing minBaseFee")
317317
}
318318
if cfg := miner.chainConfig; cfg.IsHolocene(header.Time) {
@@ -355,7 +355,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir
355355
return nil, err
356356
}
357357
env.noTxs = genParams.noTxs
358-
if miner.chainConfig.IsDAFootprintBlockLimit(parent.Time) {
358+
if miner.chainConfig.IsJovian(parent.Time) {
359359
if len(genParams.txs) == 0 || !genParams.txs[0].IsDepositTx() {
360360
return nil, errors.New("missing L1 attributes deposit transaction")
361361
}
@@ -506,7 +506,7 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
506506

507507
// OP-Stack additions: throttling and DA footprint limit
508508
blockDABytes := new(big.Int)
509-
isJovian := miner.chainConfig.IsDAFootprintBlockLimit(env.header.Time)
509+
isJovian := miner.chainConfig.IsJovian(env.header.Time)
510510
minTransactionDAFootprint := types.MinTransactionSize.Uint64() * uint64(env.daFootprintGasScalar)
511511

512512
for {

params/optimism_feature_toggles.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package params
22

33
// OPStack diff
4-
// This file contains ephemeral feature toggles which should be removed
4+
// This file contains ephemeral feature toggles for the next
5+
// fork while it is in development. They should be removed
56
// after the fork scope is locked.
67

7-
func (c *ChainConfig) IsMinBaseFee(time uint64) bool {
8-
return c.IsJovian(time) // Replace with return false to disable
9-
}
10-
11-
func (c *ChainConfig) IsDAFootprintBlockLimit(time uint64) bool {
12-
return c.IsJovian(time) // Replace with return false to disable
13-
}
14-
15-
func (c *ChainConfig) IsOperatorFeeFix(time uint64) bool {
16-
return c.IsJovian(time) // Replace with return false to disable
17-
}
8+
// Example:
9+
// func (c *ChainConfig) IsMinBaseFee(time uint64) bool {
10+
// return c.IsJovian(time) // Replace with return false to disable
11+
// }

0 commit comments

Comments
 (0)