Skip to content

Commit

Permalink
feat(docker-sandbox): allow forks in sandbox (#2831)
Browse files Browse the repository at this point in the history
Currently you can't fork anvil on the sandbox. This PR enables this.
Instructions:

```
export FORK_BLOCK_NUMBER=17514288
export FORK_URL=<YOUR_RPC_URL e.g. https://mainnet.infura.io/v3/API_KEY>
```

Now run the sandbox!

Blocks #2726
  • Loading branch information
rahul-kothari authored Oct 13, 2023
1 parent d393a59 commit ed8431c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion yarn-project/aztec-sandbox/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@ version: '3'
services:
ethereum:
image: ghcr.io/foundry-rs/foundry@sha256:29ba6e34379e79c342ec02d437beb7929c9e254261e8032b17e187be71a2609f
command: '"anvil --silent -p 8545 --host 0.0.0.0 --chain-id 31337"'
command: >
sh -c '
if [ -n "$FORK_BLOCK_NUMBER" ] && [ -n "$FORK_URL" ]; then
exec anvil -p 8545 --host 0.0.0.0 --chain-id 31337 --fork-url "$FORK_URL" --fork-block-number "$FORK_BLOCK_NUMBER"
elif [ -n "$FORK_URL" ]; then
exec anvil -p 8545 --host 0.0.0.0 --chain-id 31337 --fork-url "$FORK_URL"
else
exec anvil -p 8545 --host 0.0.0.0 --chain-id 31337
fi'
ports:
- '${SANDBOX_ANVIL_PORT:-8545}:8545'

Expand Down

0 comments on commit ed8431c

Please sign in to comment.