latticexyz / mud

MUD is a framework for building autonomous worlds
https://mud.dev
MIT License
721 stars 180 forks source link

Forked tests in `mud test` don't seem to work #2004

Open qbzzt opened 9 months ago

qbzzt commented 9 months ago

I deployed a World on Holesky: https://eth-holesky.blockscout.com/address/0x7Bd472fC101d3A7caf3064B7C5788965CB34685F?tab=logs

When I try to use mud test on it, it ignores the --rpc parameter:

qbzzt@Oris-MacBook-Pro contracts % echo $WORLD_ADDR 
0x7bd472fc101d3a7caf3064b7c5788965cb34685f
qbzzt@Oris-MacBook-Pro contracts % pnpm mud test --rpc $ETH_RPC_URL --worldAddress $WORLD_ADDR --printConfig
(node:48265) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:48265) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
World address 0x7bd472fc101d3a7caf3064b7c5788965cb34685f
running "forge test --fork-url http://127.0.0.1:8545"
[⠢] Compiling...
No files changed, compilation skipped
Error: Error: 
Could not instantiate forked environment with fork url: http://127.0.0.1:8545

Context:
- Error #0: Failed to get latest block number
- Error #1: error sending request for url (http://127.0.0.1:8545/): error trying to connect: tcp connect error: Connection refused (os error 61)
- Error #2: error trying to connect: tcp connect error: Connection refused (os error 61)
- Error #3: tcp connect error: Connection refused (os error 61)
- Error #4: Connection refused (os error 61)
Error running "forge test --fork-url http://127.0.0.1:8545"
    at o (file:///Users/qbzzt/run/tutorial/node_modules/.pnpm/@latticexyz+common@2.0.0-next.14_typescript@5.1.6_zod@3.22.4/node_modules/@latticexyz/common/dist/foundry.js:2:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async x (file:///Users/qbzzt/run/tutorial/node_modules/.pnpm/@latticexyz+common@2.0.0-next.14_typescript@5.1.6_zod@3.22.4/node_modules/@latticexyz/common/dist/foundry.js:1:615)
    at async Object.handler (file:///Users/qbzzt/run/tutorial/node_modules/.pnpm/@latticexyz+cli@2.0.0-next.14_google-protobuf@3.21.2/node_modules/@latticexyz/cli/dist/commands-UYAATBY6.js:20:1361)
qbzzt@Oris-MacBook-Pro contracts % 

When I try not to tell it about an existing World, I get a similar problem:

qbzzt@Oris-MacBook-Pro contracts % pnpm mud test --rpc $ETH_RPC_URL &| tee x
(node:49000) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:49000) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
running "anvil --block-base-fee-per-gas 0 --port 4242"

 Deploying MUD contracts to RPC http://127.0.0.1:4242 

running "forge build"
Osub commented 8 months ago
mud test --profile=local

This is effective