@@ -93,38 +93,3 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
9393 return math .BigMax (baseFee , common .Big0 )
9494 }
9595}
96-
97- // CHANGE(taiko): CalcBaseFeeOntake calculates the basefee of the an ontake block header.
98- func CalcBaseFeeOntake (config * params.ChainConfig , parent * types.Header , parentGasTarget uint64 ) * big.Int {
99- // If the parent gasUsed is the same as the target, the baseFee remains unchanged.
100- if parent .GasUsed == parentGasTarget {
101- return new (big.Int ).Set (parent .BaseFee )
102- }
103-
104- var (
105- num = new (big.Int )
106- denom = new (big.Int )
107- )
108-
109- if parent .GasUsed > parentGasTarget {
110- // If the parent block used more gas than its target, the baseFee should increase.
111- // max(1, parentBaseFee * gasUsedDelta / parentGasTarget / baseFeeChangeDenominator)
112- num .SetUint64 (parent .GasUsed - parentGasTarget )
113- num .Mul (num , parent .BaseFee )
114- num .Div (num , denom .SetUint64 (parentGasTarget ))
115- num .Div (num , denom .SetUint64 (config .BaseFeeChangeDenominator ()))
116- baseFeeDelta := math .BigMax (num , common .Big1 )
117-
118- return num .Add (parent .BaseFee , baseFeeDelta )
119- } else {
120- // Otherwise if the parent block used less gas than its target, the baseFee should decrease.
121- // max(0, parentBaseFee * gasUsedDelta / parentGasTarget / baseFeeChangeDenominator)
122- num .SetUint64 (parentGasTarget - parent .GasUsed )
123- num .Mul (num , parent .BaseFee )
124- num .Div (num , denom .SetUint64 (parentGasTarget ))
125- num .Div (num , denom .SetUint64 (config .BaseFeeChangeDenominator ()))
126- baseFee := num .Sub (parent .BaseFee , num )
127-
128- return math .BigMax (baseFee , common .Big0 )
129- }
130- }
0 commit comments