@@ -47,6 +47,10 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
4747 expectedGasPriceIncreaseDenominator = 5
4848 )
4949 var (
50+ bigExpectedGasPriceIncreaseNumerator = big .NewInt (expectedGasPriceIncreaseNumerator )
51+ bigExpectedGasPriceIncreaseDenominator = big .NewInt (expectedGasPriceIncreaseDenominator )
52+ bigExpectedGasPriceIncreaseDenominatorMinus1 = big .NewInt (expectedGasPriceIncreaseDenominator - 1 )
53+
5054 gasFeeCap = big .NewInt (maxFeePerGas )
5155 gasTipCap = big .NewInt (minFeePerGas )
5256 )
@@ -138,8 +142,10 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
138142
139143 initialGasPrice := latest .BaseFee
140144 targetGasPrice := new (big.Int ).Set (initialGasPrice )
141- targetGasPrice .Mul (targetGasPrice , big .NewInt (expectedGasPriceIncreaseNumerator ))
142- targetGasPrice .Div (targetGasPrice , big .NewInt (expectedGasPriceIncreaseDenominator ))
145+ targetGasPrice .Mul (targetGasPrice , bigExpectedGasPriceIncreaseNumerator )
146+ targetGasPrice .Add (targetGasPrice , bigExpectedGasPriceIncreaseDenominatorMinus1 )
147+ targetGasPrice .Div (targetGasPrice , bigExpectedGasPriceIncreaseDenominator )
148+
143149 tc .Log ().Info ("initializing gas prices" ,
144150 zap .Stringer ("initialPrice" , initialGasPrice ),
145151 zap .Stringer ("targetPrice" , targetGasPrice ),
@@ -158,7 +164,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
158164 require .NoError (err )
159165
160166 // If the gas price has increased, stop the loop.
161- if latest .BaseFee .Cmp (targetGasPrice ) > 0 {
167+ if latest .BaseFee .Cmp (targetGasPrice ) >= 0 {
162168 tc .Log ().Info ("gas price has increased" ,
163169 zap .Stringer ("initialPrice" , initialGasPrice ),
164170 zap .Stringer ("targetPrice" , targetGasPrice ),
@@ -207,7 +213,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
207213 require .NoError (err )
208214
209215 // If the gas price has decreased, stop the loop.
210- if initialGasPrice . Cmp ( latest .BaseFee ) > = 0 {
216+ if latest .BaseFee . Cmp ( initialGasPrice ) < = 0 {
211217 tc .Log ().Info ("gas price has decreased" ,
212218 zap .Stringer ("initialPrice" , initialGasPrice ),
213219 zap .Stringer ("newPrice" , latest .BaseFee ),
0 commit comments