Skip to content

Commit

Permalink
test: check that web3.py did fix geth (#1921)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Feb 8, 2024
1 parent ef2192a commit 274986c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
20 changes: 10 additions & 10 deletions tests/functional/geth/test_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -58,30 +58,30 @@ 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.
return


@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
2 changes: 1 addition & 1 deletion tests/functional/test_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 274986c

Please sign in to comment.