@@ -27,12 +27,40 @@ func TestCalculateGasPriceBumpBasedOnRetry(t *testing.T) {
2727
2828 for i := 0 ; i < len (gasPrices ); i ++ {
2929 currentGasPrice := gasPrices [i ]
30- bumpedGasPrice := utils .CalculateGasPriceBumpBasedOnRetry (currentGasPrice , baseBumpPercentage , incrementalRetryPercentage , i )
30+ bumpedGasPrice := utils .CalculateGasPriceBumpBasedOnRetry (currentGasPrice , baseBumpPercentage , incrementalRetryPercentage , 100 , i )
3131 expectedGasPrice := expectedBumpedGasPrices [i ]
3232
3333 if bumpedGasPrice .Cmp (expectedGasPrice ) != 0 {
3434 t .Errorf ("Bumped gas price does not match expected gas price, expected value %v, got: %v" , expectedGasPrice , bumpedGasPrice )
3535 }
3636 }
37+ }
38+
39+ func TestCalculateGasPriceBumpBasedOnRetryPercentageLimit (t * testing.T ) {
40+ baseBumpPercentage := uint (20 )
41+ incrementalRetryPercentage := uint (5 )
3742
43+ gasPrices := [5 ]* big.Int {
44+ big .NewInt (3000000000 ),
45+ big .NewInt (3000000000 ),
46+ big .NewInt (4000000000 ),
47+ big .NewInt (4000000000 ),
48+ big .NewInt (5000000000 )}
49+
50+ expectedBumpedGasPrices := [5 ]* big.Int {
51+ big .NewInt (3600000000 ),
52+ big .NewInt (3750000000 ),
53+ big .NewInt (5200000000 ),
54+ big .NewInt (5200000000 ),
55+ big .NewInt (6500000000 )}
56+
57+ for i := 0 ; i < len (gasPrices ); i ++ {
58+ currentGasPrice := gasPrices [i ]
59+ bumpedGasPrice := utils .CalculateGasPriceBumpBasedOnRetry (currentGasPrice , baseBumpPercentage , incrementalRetryPercentage , 30 , i )
60+ expectedGasPrice := expectedBumpedGasPrices [i ]
61+
62+ if bumpedGasPrice .Cmp (expectedGasPrice ) != 0 {
63+ t .Errorf ("Bumped gas price does not match expected gas price, expected value %v, got: %v" , expectedGasPrice , bumpedGasPrice )
64+ }
65+ }
3866}
0 commit comments