Repository navigation
[CLI] Run the test suite on anvil instead of ganache - #690
Uxío (Uxio0) wants to merge 1 commit into
Conversation
- Replace ganache with anvil in docker compose, CI and run_tests.sh. Same mnemonic and chain id 1337, so test accounts do not change. - CI starts anvil with the compose service, so CI and local tests use the same node setup. - Bump safe-eth-py to 7.29.1. - Fix drain: get_erc_20_list asked for logs past the requested block range, which anvil rejects. - Node and connection errors in the interactive prompt are printed and the session keeps running. Switching mode only happens after the Safe info is loaded. - Tests read the node URL from the configuration instead of a hardcoded localhost:8545. - run_tests.sh uses uv with the lockfile, returns the pytest exit code and always stops the containers.
4b88eb3 to
de5c20a
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de5c20a26f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
Felipe Alvarado (falvaradorodriguez)
left a comment
There was a problem hiding this comment.
LGTM!
Closes PLA-2321
Ganache is not maintained. safe-eth-py and safe-transaction-service already run their tests on anvil, this PR does the same for safe-cli.
Changes
Test node
run_tests.shuse anvil (ghcr.io/foundry-rs/foundry:v1.9.0) instead of ganache. Same setup as safe-transaction-service: the ganache-dmnemonic, chain id 1337, 10 accounts and gas limit 200M. Test keys and addresses do not change.docker compose --profile develop up --detach --wait anvil, so CI and local tests use the same node. CI used 30 accounts before, no test needs more than 10.safe-eth-pyto 7.29.1.ETHEREUM_NODE_URL) instead of a hardcodedlocalhost:8545.run_tests.sh: fix the shebang, use uv with the lockfile, return the pytest exit code and always stop the containers.test_executeused nonce 0, which only works on a fresh chain. It now uses the real account nonce and waits for the receipt (anvil returns the tx hash before the block is mined).CLI fixes found by running on anvil
drain:get_erc_20_listasked for logs past the requested block range (up to block 500000 on a chain at block 87). Anvil rejects it. Each log range now ends at the requestedto_block.Web3RPCError,ContractLogicError,TimeExhausted,ProviderConnectionError,requestserrors) are printed and the session keeps running. Before, the session crashed with a traceback. Switching mode (blockchain/tx-service) only happens, and prints its message, after the Safe info is loaded.Testing
ETHEREUM_MAINNET_NODE).safe-creator,safe-cli send-ether,drainin the interactive prompt, and a node error in the prompt (session keeps running).Not in this PR
drainreads logs from block 1 in steps of 500000 blocks. Many public RPC providers reject ranges that big, sodraincan still fail on mainnet. This existed before.safe-cli send-ether) still end with a traceback and a non-zero exit code.