Skip to content

Commit 44a93ac

Browse files
committed
Fix failing tests and use 1559 defaults for test params
- Fixed tests that broke from the implementation of the new EIP-1559 fields (maxFeePerGas and maxPriorityFeePerGas). Updated most of our existing tests to use these new fields in order to encourage their use / be updated to the new standard.
1 parent 78860fe commit 44a93ac

File tree

7 files changed

+210
-90
lines changed

7 files changed

+210
-90
lines changed

newsfragments/2053.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix broken tests and use the new 1559 params for most of our test transactions.

tests/integration/conftest.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@
1515
)
1616

1717

18+
def pytest_collection_modifyitems(items):
19+
"""
20+
Certain tests have their context dirtied by other tests. We can somewhat
21+
control when these tests are run by overriding this pytest hook and setting
22+
conflicting tests at either the start or the end of the test suite.
23+
"""
24+
25+
test_names_to_append_to_start = [
26+
'test_eth_get_logs_with_logs',
27+
'test_eth_call_old_contract_state',
28+
]
29+
# test_names_to_append_to_end = []
30+
index = 0
31+
for item in enumerate(items):
32+
test_name = item[1].name
33+
test_name = test_name if "[" not in test_name else test_name[:test_name.find("[")]
34+
if test_name in test_names_to_append_to_start:
35+
test_item = items.pop(index)
36+
items.insert(0, test_item)
37+
# if test_name in test_names_to_append_to_end:
38+
# test_item = items.pop(index)
39+
# items.append(test_item)
40+
index += 1
41+
42+
1843
@pytest.fixture(scope="module")
1944
def math_contract_factory(web3):
2045
contract_factory = web3.eth.contract(abi=MATH_ABI, bytecode=MATH_BYTECODE)

tests/integration/go_ethereum/common.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# from concurrent.futures._base import (
2-
# TimeoutError as FuturesTimeoutError,
3-
# )
41
import pytest
52

63
from web3._utils.module_testing import ( # noqa: F401
@@ -20,20 +17,16 @@ def _check_web3_clientVersion(self, client_version):
2017

2118

2219
class GoEthereumEthModuleTest(EthModuleTest):
23-
# @pytest.mark.xfail(
24-
# strict=False,
25-
# raises=FuturesTimeoutError,
26-
# reason='Sometimes a TimeoutError is hit when waiting for the txn to be mined',
27-
# )
28-
@pytest.mark.skip(reason="London TODO: crashes on [address_conversion_func1]")
20+
@pytest.mark.xfail(
21+
strict=False,
22+
reason='Sometimes a TimeoutError is hit when waiting for the txn to be mined',
23+
)
2924
def test_eth_replace_transaction_already_mined(self, web3, unlocked_account_dual_type):
30-
web3.geth.miner.start()
31-
super().test_eth_replace_transaction_already_mined(web3, unlocked_account_dual_type)
32-
web3.geth.miner.stop()
33-
34-
@pytest.mark.skip(reason="London TODO: pending call isn't found")
35-
def test_eth_call_old_contract_state(self, web3, math_contract, unlocked_account):
36-
super().test_eth_call_old_contract_state(web3, math_contract, unlocked_account)
25+
try:
26+
web3.geth.miner.start()
27+
super().test_eth_replace_transaction_already_mined(web3, unlocked_account_dual_type)
28+
finally:
29+
web3.geth.miner.stop()
3730

3831
@pytest.mark.xfail(reason='eth_signTypedData has not been released in geth')
3932
def test_eth_sign_typed_data(self, web3, unlocked_account_dual_type):

tests/integration/test_ethereum_tester.py

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,34 @@ def test_eth_getBlockByHash_pending(
272272
assert block['hash'] is not None
273273

274274
@disable_auto_mine
275+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
275276
def test_eth_get_transaction_receipt_unmined(self, eth_tester, web3, unlocked_account):
276277
super().test_eth_get_transaction_receipt_unmined(web3, unlocked_account)
277278

278279
@disable_auto_mine
279-
def test_eth_replaceTransaction_deprecated(self, eth_tester, web3, unlocked_account):
280-
super().test_eth_replaceTransaction_deprecated(web3, unlocked_account)
280+
def test_eth_replace_transaction_legacy(self, eth_tester, web3, unlocked_account):
281+
super().test_eth_replace_transaction_legacy(web3, unlocked_account)
281282

282283
@disable_auto_mine
284+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
283285
def test_eth_replace_transaction(self, eth_tester, web3, unlocked_account):
284286
super().test_eth_replace_transaction(web3, unlocked_account)
285287

288+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
289+
def test_eth_replace_transaction_underpriced(self, web3, emitter_contract_address):
290+
super().test_eth_replace_transaction_underpriced(web3, emitter_contract_address)
291+
292+
@disable_auto_mine
293+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
294+
def test_eth_replaceTransaction_deprecated(self, eth_tester, web3, unlocked_account):
295+
super().test_eth_replaceTransaction_deprecated(web3, unlocked_account)
296+
297+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
298+
def test_eth_replace_transaction_already_mined(self, web3, emitter_contract_address):
299+
super().test_eth_replace_transaction_already_mined(web3, emitter_contract_address)
300+
286301
@disable_auto_mine
302+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
287303
def test_eth_replace_transaction_incorrect_nonce(self, eth_tester, web3, unlocked_account):
288304
super().test_eth_replace_transaction_incorrect_nonce(web3, unlocked_account)
289305

@@ -429,24 +445,32 @@ def test_eth_estimate_gas_revert_without_msg(self, web3, revert_contract, unlock
429445
web3.eth.estimate_gas(txn_params)
430446

431447
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
432-
def test_1559_default_fees(self, web3, emitter_contract_address):
433-
super().test_1559_default_fees(web3, emitter_contract_address)
448+
def test_eth_send_transaction(self, web3, emitter_contract_address):
449+
super().test_eth_send_transaction(web3, emitter_contract_address)
450+
451+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
452+
def test_eth_sendTransaction_deprecated(self, web3, emitter_contract_address):
453+
super().test_eth_sendTransaction_deprecated(web3, emitter_contract_address)
454+
455+
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
456+
def test_eth_send_transaction_with_nonce(self, web3, emitter_contract_address):
457+
super().test_eth_send_transaction_with_nonce(web3, emitter_contract_address)
434458

435459
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
436-
def test_1559_canonical(self, web3, emitter_contract_address):
437-
super().test_1559_canonical(web3, emitter_contract_address)
460+
def test_eth_send_transaction_default_fees(self, web3, emitter_contract_address):
461+
super().test_eth_send_transaction_default_fees(web3, emitter_contract_address)
438462

439463
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
440-
def test_1559_hex_fees(self, web3, emitter_contract_address):
441-
super().test_1559_hex_fees(web3, emitter_contract_address)
464+
def test_eth_send_transaction_hex_fees(self, web3, emitter_contract_address):
465+
super().test_eth_send_transaction_hex_fees(web3, emitter_contract_address)
442466

443467
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
444-
def test_1559_no_gas(self, web3, emitter_contract_address):
445-
super().test_1559_no_gas(web3, emitter_contract_address)
468+
def test_eth_send_transaction_no_gas(self, web3, emitter_contract_address):
469+
super().test_eth_send_transaction_no_gas(web3, emitter_contract_address)
446470

447471
@pytest.mark.xfail(reason='EIP 1559 is not implemented on eth-tester')
448-
def test_1559_no_max_fee(self, web3, emitter_contract_address):
449-
super().test_1559_no_max_fee(web3, emitter_contract_address)
472+
def test_eth_send_transaction_no_max_fee(self, web3, emitter_contract_address):
473+
super().test_eth_send_transaction_no_max_fee(web3, emitter_contract_address)
450474

451475

452476
class TestEthereumTesterVersionModule(VersionModuleTest):

0 commit comments

Comments
 (0)