@@ -107,18 +107,20 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header, parentL1BaseF
107107 return big .NewInt (10000000 ) // 0.01 Gwei
108108 }
109109
110+ scalar , overhead := ReadL2BaseFeeCoefficients ()
111+
110112 if parent == nil || parent .Number == nil || ! config .IsFeynman (currentHeaderTime ) {
111- scalar , overhead := ReadL2BaseFeeCoefficients ()
112113 return calcBaseFee (scalar , overhead , parentL1BaseFee )
113114 }
114- return calcBaseFeeFeynman (config , parent )
115+ // In Feynman base fee calculation, we reuse the contract's baseFeeOverhead slot as the proving base fee.
116+ return calcBaseFeeFeynman (config , parent , overhead )
115117}
116118
117119// calcBaseFeeFeynman calculates the basefee of the header for Feynman fork.
118- func calcBaseFeeFeynman (config * params.ChainConfig , parent * types.Header ) * big.Int {
120+ func calcBaseFeeFeynman (config * params.ChainConfig , parent * types.Header , overhead * big. Int ) * big.Int {
119121 baseFeeEIP1559 := calcBaseFeeEIP1559 (config , parent )
120122 baseFee := new (big.Int ).Set (baseFeeEIP1559 )
121- baseFee .Add (baseFee , config . ProvingBaseFee )
123+ baseFee .Add (baseFee , overhead )
122124
123125 return baseFee
124126}
@@ -170,7 +172,9 @@ func calcBaseFeeEIP1559(config *params.ChainConfig, parent *types.Header) *big.I
170172}
171173
172174func extractBaseFeeEIP1559 (config * params.ChainConfig , baseFee * big.Int ) * big.Int {
173- return new (big.Int ).Sub (baseFee , config .ProvingBaseFee )
175+ _ , overhead := ReadL2BaseFeeCoefficients ()
176+ // In Feynman base fee calculation, we reuse the contract's baseFeeOverhead slot as the proving base fee.
177+ return new (big.Int ).Sub (baseFee , overhead )
174178}
175179
176180// MinBaseFee calculates the minimum L2 base fee based on the current coefficients.
0 commit comments