@@ -47,6 +47,10 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
47
47
expectedGasPriceIncreaseDenominator = 5
48
48
)
49
49
var (
50
+ bigExpectedGasPriceIncreaseNumerator = big .NewInt (expectedGasPriceIncreaseNumerator )
51
+ bigExpectedGasPriceIncreaseDenominator = big .NewInt (expectedGasPriceIncreaseDenominator )
52
+ bigExpectedGasPriceIncreaseDenominatorMinus1 = big .NewInt (expectedGasPriceIncreaseDenominator - 1 )
53
+
50
54
gasFeeCap = big .NewInt (maxFeePerGas )
51
55
gasTipCap = big .NewInt (minFeePerGas )
52
56
)
@@ -138,8 +142,10 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
138
142
139
143
initialGasPrice := latest .BaseFee
140
144
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
+
143
149
tc .Log ().Info ("initializing gas prices" ,
144
150
zap .Stringer ("initialPrice" , initialGasPrice ),
145
151
zap .Stringer ("targetPrice" , targetGasPrice ),
@@ -158,7 +164,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
158
164
require .NoError (err )
159
165
160
166
// If the gas price has increased, stop the loop.
161
- if latest .BaseFee .Cmp (targetGasPrice ) > 0 {
167
+ if latest .BaseFee .Cmp (targetGasPrice ) >= 0 {
162
168
tc .Log ().Info ("gas price has increased" ,
163
169
zap .Stringer ("initialPrice" , initialGasPrice ),
164
170
zap .Stringer ("targetPrice" , targetGasPrice ),
@@ -207,7 +213,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
207
213
require .NoError (err )
208
214
209
215
// If the gas price has decreased, stop the loop.
210
- if initialGasPrice . Cmp ( latest .BaseFee ) > = 0 {
216
+ if latest .BaseFee . Cmp ( initialGasPrice ) < = 0 {
211
217
tc .Log ().Info ("gas price has decreased" ,
212
218
zap .Stringer ("initialPrice" , initialGasPrice ),
213
219
zap .Stringer ("newPrice" , latest .BaseFee ),
0 commit comments