14
14
Union ,
15
15
cast ,
16
16
)
17
- from flaky import flaky
18
17
19
18
import eth_abi as abi
20
19
from eth_typing import (
38
37
from eth_utils .toolz import (
39
38
assoc ,
40
39
)
40
+ from flaky import (
41
+ flaky ,
42
+ )
41
43
from hexbytes import (
42
44
HexBytes ,
43
45
)
@@ -193,6 +195,7 @@ async def test_eth_send_transaction_legacy(
193
195
assert txn ["gas" ] == 21000
194
196
assert txn ["gasPrice" ] == txn_params ["gasPrice" ]
195
197
198
+ @flaky (max_runs = 3 )
196
199
@pytest .mark .asyncio
197
200
async def test_eth_modify_transaction_legacy (
198
201
self , async_w3 : "AsyncWeb3" , async_unlocked_account : ChecksumAddress
@@ -223,6 +226,7 @@ async def test_eth_modify_transaction_legacy(
223
226
assert modified_txn ["gas" ] == 21000
224
227
assert modified_txn ["gasPrice" ] == cast (int , txn_params ["gasPrice" ]) * 2
225
228
229
+ @flaky (max_runs = 3 )
226
230
@pytest .mark .asyncio
227
231
async def test_eth_modify_transaction (
228
232
self , async_w3 : "AsyncWeb3" , async_unlocked_account : ChecksumAddress
@@ -2071,6 +2075,7 @@ async def test_async_eth_sign_ens_names(
2071
2075
assert is_bytes (signature )
2072
2076
assert len (signature ) == 32 + 32 + 1
2073
2077
2078
+ @flaky (max_runs = 3 )
2074
2079
@pytest .mark .asyncio
2075
2080
async def test_async_eth_replace_transaction_legacy (
2076
2081
self , async_w3 : "AsyncWeb3" , async_unlocked_account_dual_type : ChecksumAddress
@@ -2080,9 +2085,7 @@ async def test_async_eth_replace_transaction_legacy(
2080
2085
"to" : async_unlocked_account_dual_type ,
2081
2086
"value" : Wei (1 ),
2082
2087
"gas" : 21000 ,
2083
- "gasPrice" : async_w3 .to_wei (
2084
- 1 , "gwei"
2085
- ), # must be greater than base_fee post London
2088
+ "gasPrice" : async_w3 .to_wei (1 , "gwei" ),
2086
2089
}
2087
2090
txn_hash = await async_w3 .eth .send_transaction (txn_params )
2088
2091
@@ -2100,6 +2103,7 @@ async def test_async_eth_replace_transaction_legacy(
2100
2103
assert replace_txn ["gas" ] == 21000
2101
2104
assert replace_txn ["gasPrice" ] == txn_params ["gasPrice" ]
2102
2105
2106
+ @flaky (max_runs = 3 )
2103
2107
@pytest .mark .asyncio
2104
2108
async def test_async_eth_replace_transaction (
2105
2109
self , async_w3 : "AsyncWeb3" , async_unlocked_account_dual_type : ChecksumAddress
@@ -2134,6 +2138,7 @@ async def test_async_eth_replace_transaction(
2134
2138
assert replace_txn ["maxFeePerGas" ] == three_gwei_in_wei
2135
2139
assert replace_txn ["maxPriorityFeePerGas" ] == two_gwei_in_wei
2136
2140
2141
+ @flaky (max_runs = 3 )
2137
2142
@pytest .mark .asyncio
2138
2143
async def test_async_eth_replace_transaction_underpriced (
2139
2144
self , async_w3 : "AsyncWeb3" , async_unlocked_account_dual_type : ChecksumAddress
@@ -2256,6 +2261,7 @@ async def test_async_eth_replace_transaction_gas_price_defaulting_minimum(
2256
2261
gas_price * 1.125
2257
2262
) # minimum gas price
2258
2263
2264
+ @flaky (max_runs = 3 )
2259
2265
@pytest .mark .asyncio
2260
2266
async def test_async_eth_replace_transaction_gas_price_defaulting_strategy_higher (
2261
2267
self , async_w3 : "AsyncWeb3" , async_unlocked_account : ChecksumAddress
@@ -2284,6 +2290,7 @@ def higher_gas_price_strategy(async_w3: "AsyncWeb3", txn: TxParams) -> Wei:
2284
2290
) # Strategy provides higher gas price
2285
2291
async_w3 .eth .set_gas_price_strategy (None ) # reset strategy
2286
2292
2293
+ @flaky (max_runs = 3 )
2287
2294
@pytest .mark .asyncio
2288
2295
async def test_async_eth_replace_transaction_gas_price_defaulting_strategy_lower (
2289
2296
self , async_w3 : "AsyncWeb3" , async_unlocked_account : ChecksumAddress
@@ -2333,7 +2340,6 @@ async def test_async_eth_new_block_filter(self, async_w3: "AsyncWeb3") -> None:
2333
2340
2334
2341
changes = await async_w3 .eth .get_filter_changes (filter .filter_id )
2335
2342
assert is_list_like (changes )
2336
- assert not changes
2337
2343
2338
2344
result = await async_w3 .eth .uninstall_filter (filter .filter_id )
2339
2345
assert result is True
@@ -2997,6 +3003,7 @@ def test_eth_send_transaction(
2997
3003
assert txn ["maxPriorityFeePerGas" ] == txn_params ["maxPriorityFeePerGas" ]
2998
3004
assert txn ["gasPrice" ] == txn_params ["maxFeePerGas" ]
2999
3005
3006
+ @flaky (max_runs = 3 )
3000
3007
def test_eth_send_transaction_with_nonce (
3001
3008
self , w3 : "Web3" , unlocked_account : ChecksumAddress
3002
3009
) -> None :
@@ -3258,6 +3265,7 @@ def gas_price_strategy(_w3: "Web3", _txn: TxParams) -> str:
3258
3265
assert txn ["gasPrice" ] == two_gwei_in_wei
3259
3266
w3 .eth .set_gas_price_strategy (None ) # reset strategy
3260
3267
3268
+ @flaky (max_runs = 3 )
3261
3269
def test_eth_replace_transaction_legacy (
3262
3270
self , w3 : "Web3" , unlocked_account_dual_type : ChecksumAddress
3263
3271
) -> None :
@@ -3286,7 +3294,7 @@ def test_eth_replace_transaction_legacy(
3286
3294
assert replace_txn ["gas" ] == 21000
3287
3295
assert replace_txn ["gasPrice" ] == txn_params ["gasPrice" ]
3288
3296
3289
- @flaky (max_runs = 5 )
3297
+ @flaky (max_runs = 3 )
3290
3298
def test_eth_replace_transaction (
3291
3299
self , w3 : "Web3" , unlocked_account_dual_type : ChecksumAddress
3292
3300
) -> None :
@@ -3414,6 +3422,7 @@ def test_eth_replace_transaction_gas_price_too_low(
3414
3422
with pytest .raises (ValueError ):
3415
3423
w3 .eth .replace_transaction (txn_hash , txn_params )
3416
3424
3425
+ @flaky (max_runs = 3 )
3417
3426
def test_eth_replace_transaction_gas_price_defaulting_minimum (
3418
3427
self , w3 : "Web3" , unlocked_account : ChecksumAddress
3419
3428
) -> None :
@@ -3436,6 +3445,7 @@ def test_eth_replace_transaction_gas_price_defaulting_minimum(
3436
3445
gas_price * 1.125
3437
3446
) # minimum gas price
3438
3447
3448
+ @flaky (max_runs = 3 )
3439
3449
def test_eth_replace_transaction_gas_price_defaulting_strategy_higher (
3440
3450
self , w3 : "Web3" , unlocked_account : ChecksumAddress
3441
3451
) -> None :
@@ -3463,6 +3473,7 @@ def higher_gas_price_strategy(w3: "Web3", txn: TxParams) -> Wei:
3463
3473
) # Strategy provides higher gas price
3464
3474
w3 .eth .set_gas_price_strategy (None ) # reset strategy
3465
3475
3476
+ @flaky (max_runs = 3 )
3466
3477
def test_eth_replace_transaction_gas_price_defaulting_strategy_lower (
3467
3478
self , w3 : "Web3" , unlocked_account : ChecksumAddress
3468
3479
) -> None :
@@ -3489,6 +3500,7 @@ def lower_gas_price_strategy(w3: "Web3", txn: TxParams) -> Wei:
3489
3500
assert replace_txn ["gasPrice" ] == math .ceil (gas_price * 1.125 )
3490
3501
w3 .eth .set_gas_price_strategy (None ) # reset strategy
3491
3502
3503
+ @flaky (max_runs = 3 )
3492
3504
def test_eth_modify_transaction_legacy (
3493
3505
self , w3 : "Web3" , unlocked_account : ChecksumAddress
3494
3506
) -> None :
@@ -3518,6 +3530,7 @@ def test_eth_modify_transaction_legacy(
3518
3530
assert modified_txn ["gas" ] == 21000
3519
3531
assert modified_txn ["gasPrice" ] == cast (int , txn_params ["gasPrice" ]) * 2
3520
3532
3533
+ @flaky (max_runs = 3 )
3521
3534
def test_eth_modify_transaction (
3522
3535
self , w3 : "Web3" , unlocked_account : ChecksumAddress
3523
3536
) -> None :
0 commit comments