From 274986c5e390a3dc933f1145202f68014976bde2 Mon Sep 17 00:00:00 2001 From: antazoey Date: Thu, 8 Feb 2024 11:18:30 -0600 Subject: [PATCH] test: check that web3.py did fix geth (#1921) --- .github/workflows/test.yaml | 2 +- tests/functional/geth/test_contract.py | 20 ++++++++++---------- tests/functional/test_history.py | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a5e490b5ae..276a79524f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -86,7 +86,7 @@ jobs: - name: Install Geth uses: gacts/install-geth-tools@v1 with: - version: 1.13.10 + version: 1.13.11 - name: Install Dependencies run: | diff --git a/tests/functional/geth/test_contract.py b/tests/functional/geth/test_contract.py index dbe0e9dd54..280b60dc4d 100644 --- a/tests/functional/geth/test_contract.py +++ b/tests/functional/geth/test_contract.py @@ -29,7 +29,7 @@ def test_contract_interaction(geth_provider, geth_account, geth_contract, mocker @geth_process_test -def test_tx_revert(accounts, not_owner, geth_contract): +def test_revert(accounts, not_owner, geth_contract): # 'sender' is not the owner so it will revert (with a message) with pytest.raises(ContractLogicError, match="!authorized") as err: geth_contract.setNumber(5, sender=not_owner) @@ -48,7 +48,7 @@ def test_revert_no_message(accounts, geth_contract, geth_account): @geth_process_test -def test_custom_error(error_contract_geth, geth_second_account): +def test_revert_custom_error(error_contract_geth, geth_second_account): contract = error_contract_geth with pytest.raises(contract.Unauthorized) as err: contract.withdraw(sender=geth_second_account) @@ -58,16 +58,17 @@ def test_custom_error(error_contract_geth, geth_second_account): @geth_process_test -def test_custom_error_on_deploy(error_contract_container, geth_account, chain, geth_provider): +def test_revert_custom_error_deploy(error_contract_container, geth_account, chain, geth_provider): with pytest.raises(Exception) as err: geth_account.deploy(error_contract_container, 0) - assert isinstance(err.value, ContractLogicError) - if err.value.address: - contract = chain.contracts.instance_at(err.value.address) + err_cls = err.value + assert isinstance(err_cls, ContractLogicError) + if err_cls.address: + contract = chain.contracts.instance_at(err_cls.address) # Ensure it is the custom error. - assert isinstance(err.value, contract.OtherError) + assert isinstance(err_cls, contract.OtherError) else: # skip this test - still covered in reverts() tests anyway. @@ -75,13 +76,12 @@ def test_custom_error_on_deploy(error_contract_container, geth_account, chain, g @geth_process_test -def test_out_of_gas_error(geth_contract, geth_account, geth_provider): +def test_revert_out_of_gas_error(geth_account, geth_second_account, geth_provider): """ Attempt to transact with not quite enough gas. We should get an error saying we ran out of gas. """ - txn = geth_contract.setNumber.as_transaction(333, sender=geth_account, gas_limit=1) with pytest.raises(OutOfGasError) as err: - geth_account.call(txn) + geth_account.transfer(geth_second_account, 1, gas_limit=1) assert err.value.txn is not None diff --git a/tests/functional/test_history.py b/tests/functional/test_history.py index 2b7283f3ea..1d0bacaba4 100644 --- a/tests/functional/test_history.py +++ b/tests/functional/test_history.py @@ -4,7 +4,7 @@ def test_history(sender, receiver, chain): length_at_start = len(chain.history[sender].sessional) - receipt = sender.transfer(receiver, "1 wei") + receipt = sender.transfer(receiver, 1) transactions_from_cache = list(sender.history) assert len(transactions_from_cache) == length_at_start + 1 assert sender.history[-1] == receipt