Skip to content

Commit 3a5a705

Browse files
author
colinlyguo
committed
remove an impossible underflow scenario
1 parent 87e5f85 commit 3a5a705

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

consensus/misc/eip1559.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ func calcBaseFeeEIP1559(config *params.ChainConfig, parent *types.Header) *big.I
183183

184184
func extractBaseFeeEIP1559(_ *params.ChainConfig, baseFee *big.Int) *big.Int {
185185
_, overhead := ReadL2BaseFeeCoefficients()
186+
186187
// In Feynman base fee calculation, we reuse the contract's baseFeeOverhead slot as the proving base fee.
187188
result := new(big.Int).Sub(baseFee, overhead)
188189

189190
// Add underflow protection: return max(0, baseFee - overhead)
190191
//
191192
// Potential underflow scenarios:
192-
// 1. During transition to Feynman: parent base fee might be < overhead
193-
// 2. Contract overhead updates: when overhead is updated via contract,
194-
// it might become larger than current base fee
193+
// - Contract overhead updates: when overhead is updated via contract,
194+
// it might become larger than current base fee
195195
if result.Sign() < 0 {
196196
return big.NewInt(0)
197197
}

0 commit comments

Comments
 (0)