Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions safe_eth/eth/tests/test_ethereum_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions safe_eth/eth/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions safe_eth/eth/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading