diff --git a/docker-compose.yml b/docker-compose.yml index f9c8ac9ec..4c502782d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,10 +10,19 @@ services: timeout: 5s retries: 3 - ganache: - image: trufflesuite/ganache:latest + anvil: + image: ghcr.io/foundry-rs/foundry:latest + environment: + ANVIL_IP_ADDR: "0.0.0.0" ports: - "8545:8545" - command: --defaultBalanceEther 10000 --gasLimit 10000000 -a 10 --chain.chainId 1337 --chain.networkId 1337 -d --host 0.0.0.0 + entrypoint: ["anvil"] + command: + - --chain-id + - "${ANVIL_CHAIN_ID:-1337}" + - -a + - "${ANVIL_ACCOUNTS:-10}" + - -m + - "${ANVIL_MNEMONIC:-myth like bonus scare over problem client lizard pioneer submit female collect}" healthcheck: test: bash -c "echo 'hello' > /dev/tcp/localhost/8545" diff --git a/safe_eth/eth/tests/test_ethereum_client.py b/safe_eth/eth/tests/test_ethereum_client.py index 61146b960..f4e6774b5 100644 --- a/safe_eth/eth/tests/test_ethereum_client.py +++ b/safe_eth/eth/tests/test_ethereum_client.py @@ -26,7 +26,7 @@ TracingManager, get_auto_ethereum_client, ) -from ..exceptions import BatchCallException, InvalidERC20Info +from ..exceptions import BatchCallException, InvalidERC20Info, NonceTooLow from .ethereum_test_case import EthereumTestCaseMixin from .mocks.mock_internal_txs import creation_internal_txs, internal_txs_errored from .mocks.mock_log_receipts import invalid_log_receipt, log_receipts @@ -1037,7 +1037,7 @@ def test_send_unsigned_transaction(self): self.assertGreaterEqual(first_nonce, 0) # Will use the same nonce - with self.assertRaisesMessage(InvalidNonce, "correct nonce"): + with self.assertRaisesMessage(NonceTooLow, "nonce too low"): self.ethereum_client.send_unsigned_transaction(tx, public_key=address) # With retry, everything should work diff --git a/safe_eth/eth/tests/test_utils.py b/safe_eth/eth/tests/test_utils.py index bc48af288..48d4d0da4 100644 --- a/safe_eth/eth/tests/test_utils.py +++ b/safe_eth/eth/tests/test_utils.py @@ -43,8 +43,9 @@ def test_generate_address2_with_proxy(self): deployer_account.address, block_identifier="pending" ) tx = proxy_factory_contract.constructor().build_transaction( - {"nonce": nonce, "from": deployer_account.address} + {"from": deployer_account.address} ) + tx["nonce"] = nonce signed_tx = deployer_account.sign_transaction(tx) tx_hash = self.w3.eth.send_raw_transaction(signed_tx.raw_transaction) tx_receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash) @@ -59,12 +60,8 @@ def test_generate_address2_with_proxy(self): master_copy = proxy_factory_contract.address tx = proxy_factory_contract.functions.createProxyWithNonce( master_copy, initializer, salt_nonce - ).build_transaction( - { - "nonce": nonce + 1, - "from": deployer_account.address, - } - ) + ).build_transaction({"from": deployer_account.address}) + tx["nonce"] = nonce + 1 signed_tx = deployer_account.sign_transaction(tx) tx_hash = self.w3.eth.send_raw_transaction(signed_tx.raw_transaction) tx_receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash) diff --git a/safe_eth/eth/tests/utils.py b/safe_eth/eth/tests/utils.py index 60b08fd43..ba52ab297 100644 --- a/safe_eth/eth/tests/utils.py +++ b/safe_eth/eth/tests/utils.py @@ -122,12 +122,9 @@ def deploy_erc20( erc20_contract = get_example_erc20_contract(w3) tx = erc20_contract.constructor( name, symbol, decimals, owner, amount - ).build_transaction( - { - "nonce": w3.eth.get_transaction_count( - account.address, block_identifier="pending" - ) - } + ).build_transaction() + tx["nonce"] = w3.eth.get_transaction_count( + account.address, block_identifier="pending" ) signed_tx = account.sign_transaction(tx) tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)