-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add anvil to docker-compose to enable shadowfork #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yiweichi
wants to merge
7
commits into
main
Choose a base branch
from
feat-add-docker-compose-anvil
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+141
−3
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
62b02b7
feat: add l1 anvil for shadow fork
yiweichi 6f5d7fe
refactor: docker compose shadow-fork
yiweichi f144ff6
Merge branch 'main' into feat-add-docker-compose-anvil
yiweichi a0f9820
update docker image
yiweichi da206ce
update docker image
yiweichi 1dcc81b
fix: l1-devent host issue
yiweichi 43bf496
add README for docker-compose
yiweichi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# .env.shadow-fork | ||
SHADOW_FORK=true | ||
FORK_BLOCK_NUMBER=8700000 | ||
ENV=sepolia |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Scroll Rollup Node Docker Compose | ||
|
||
This guide explains how to use Docker Compose to launch the Scroll Rollup Node, including standard and shadow-fork modes. | ||
|
||
--- | ||
|
||
## Prerequisites | ||
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) installed | ||
- Clone this repository | ||
|
||
--- | ||
|
||
## Quick Start: Launching the Node | ||
|
||
1. **Navigate to the `docker-compose` directory:** | ||
```sh | ||
cd docker-compose | ||
``` | ||
|
||
2. **Start the node and monitoring stack:** | ||
```sh | ||
docker compose up -d | ||
``` | ||
This will launch the rollup node, Prometheus, and Grafana with default settings. | ||
|
||
3. **Access the services:** | ||
- Rollup Node JSON-RPC: [http://localhost:8545](http://localhost:8545) | ||
- Rollup Node WebSocket: [ws://localhost:8546](ws://localhost:8546) | ||
- Prometheus: [http://localhost:19090](http://localhost:19090) | ||
- Grafana: [http://localhost:13000](http://localhost:13000) | ||
|
||
--- | ||
|
||
## Shadow-Fork Mode | ||
|
||
Shadow-fork mode allows you to run the node against a forked L1 chain for testing and development. | ||
|
||
### 1. Edit the `.env.shadow-fork` file | ||
|
||
The file `docker-compose/.env.shadow-fork` contains environment variables for shadow-fork mode: | ||
|
||
``` | ||
SHADOW_FORK=true | ||
FORK_BLOCK_NUMBER=8700000 # Change to your desired fork block | ||
ENV=sepolia # Or 'mainnet' for mainnet fork | ||
``` | ||
|
||
### 2. Launch with the shadow-fork profile | ||
|
||
**Recommended (Docker Compose v1.28+):** | ||
|
||
```sh | ||
docker compose --env-file .env.shadow-fork --profile shadow-fork up -d | ||
``` | ||
|
||
- This will start both the L1 devnet and the rollup node in shadow-fork mode. | ||
- The `FORK_BLOCK_NUMBER` and `ENV` variables control the fork point and network. | ||
|
||
**Alternative:** | ||
You can also copy or rename `.env.shadow-fork` to `.env` if you want it to be loaded automatically: | ||
|
||
```sh | ||
cp .env.shadow-fork .env | ||
# Then run: | ||
docker compose --profile shadow-fork up -d | ||
``` | ||
|
||
--- | ||
|
||
## Stopping the Stack | ||
|
||
To stop all services: | ||
```sh | ||
docker compose down | ||
``` | ||
|
||
--- | ||
|
||
## Troubleshooting | ||
- Make sure the ports (8545, 8546, 19090, 13000) are not used by other processes. | ||
- If you change environment variables, restart the stack with `docker compose down && docker compose up -d`. | ||
- For shadow-fork mode, always ensure you specify the correct `--env-file` or have the right `.env` file in place. | ||
|
||
--- | ||
|
||
## More | ||
- See `docker-compose/docker-compose.yml` for all available services and configuration options. | ||
- For advanced usage, refer to the official [Docker Compose documentation](https://docs.docker.com/compose/). | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,74 @@ | ||
version: '3' | ||
|
||
services: | ||
l1-devnet: | ||
image: scrolltech/l1-devnet:v0.0.4 | ||
container_name: l1-devnet | ||
entrypoint: ["bash", "-c"] | ||
command: > | ||
' | ||
EXTRA_PARAMS=""; | ||
if [ "$${FORK_BLOCK_NUMBER}" != "" ]; then | ||
EXTRA_PARAMS="--fork-block-number $${FORK_BLOCK_NUMBER}"; | ||
fi; | ||
if [ "$${ENV:-}" = "sepolia" ]; then | ||
anvil --fork-url http://l1reth-rpc.sepolia.scroll.tech:8545 --chain-id 11155111 --host 0.0.0.0 --block-time 12 $EXTRA_PARAMS | ||
elif [ "$${ENV:-}" = "mainnet" ]; then | ||
anvil --fork-url http://l1geth-rpc.mainnet.scroll.tech:8545/l1 --chain-id 1 --host 0.0.0.0 --block-time 12 $EXTRA_PARAMS | ||
fi | ||
' | ||
profiles: | ||
- shadow-fork | ||
env_file: | ||
- .env.shadow-fork | ||
environment: | ||
- ENV=${ENV} | ||
- FORK_BLOCK_NUMBER=${FORK_BLOCK_NUMBER} | ||
ports: | ||
- "8543:8545" # JSON-RPC | ||
- "8544:8546" # WebSocket | ||
volumes: | ||
- ./l1devnet:/l1devnet | ||
networks: | ||
- scroll-network | ||
|
||
rollup-node: | ||
image: scrolltech/rollup-node:v0.0.1-rc9 | ||
image: scrolltech/rollup-node:v0.0.1-rc19 | ||
container_name: rollup-node | ||
entrypoint: ["sh", "-c"] | ||
command: > | ||
' | ||
if [ "$${ENV:-}" = "dev" ]; then | ||
exec rollup-node node --chain dev --datadir=/l2reth --metrics=0.0.0.0:6060 --disable-discovery --http --http.addr=0.0.0.0 --http.port=8545 --http.corsdomain "*" --http.api admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev --ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.api admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev --log.stdout.format log-fmt -vvv --sequencer.enabled --sequencer.block-time 250 --sequencer.payload-building-duration 230 --txpool.pending-max-count=1000000 --builder.gaslimit=10000000000 --rpc.max-connections=5000 | ||
elif [ "$${ENV:-}" = "sepolia" ]; then | ||
if [ "$SHADOW_FORK" = "true" ]; then | ||
URL_PARAMS="--l1.url l1-devnet:8545"; | ||
else | ||
URL_PARAMS="--l1.url http://l1reth-rpc.sepolia.scroll.tech:8545"; | ||
fi | ||
exec rollup-node node --chain scroll-sepolia --datadir=/l2reth --metrics=0.0.0.0:6060 --disable-discovery \ | ||
--http --http.addr=0.0.0.0 --http.port=8545 --http.corsdomain "*" --http.api admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev \ | ||
--ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.api admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev \ | ||
--log.stdout.format log-fmt -vvv --l1.url http://l1reth-rpc.sepolia.scroll.tech:8545 --beacon.url http://l1reth-cl.sepolia.scroll.tech:5052 --network.scroll-wire --network.bridge | ||
--log.stdout.format log-fmt -vvv $URL_PARAMS --beacon.url http://l1reth-cl.sepolia.scroll.tech:5052 --network.scroll-wire --network.bridge | ||
--trusted-peers "enode://29cee709c400533ae038a875b9ca975c8abef9eade956dcf3585e940acd5c0ae916968f514bd37d1278775aad1b7db30f7032a70202a87fd7365bd8de3c9f5fc@44.242.39.33:30303,enode://ceb1636bac5cbb262e5ad5b2cd22014bdb35ffe7f58b3506970d337a63099481814a338dbcd15f2d28757151e3ecd40ba38b41350b793cd0d910ff0436654f8c@35.85.84.250:30303,enode://dd1ac5433c5c2b04ca3166f4cb726f8ff6d2da83dbc16d9b68b1ea83b7079b371eb16ef41c00441b6e85e32e33087f3b7753ea9e8b1e3f26d3e4df9208625e7f@54.148.111.168:30303" | ||
elif [ "$${ENV:-}" = "mainnet" ]; then | ||
if [ "$SHADOW_FORK" = "true" ]; then | ||
URL_PARAMS="--l1.url l1-devnet:8545"; | ||
else | ||
URL_PARAMS="--l1.url http://l1geth-rpc.mainnet.scroll.tech:8545/l1"; | ||
fi | ||
exec rollup-node node --chain scroll-mainnet --datadir=/l2reth --metrics=0.0.0.0:6060 --disable-discovery \ | ||
--http --http.addr=0.0.0.0 --http.port=8545 --http.corsdomain "*" --http.api admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev | ||
--ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.api admin,debug,eth,net,trace,txpool,web3,rpc,reth,ots,flashbots,miner,mev \ | ||
--log.stdout.format log-fmt -vvv --l1.url http://l1geth-rpc.mainnet.scroll.tech:8545/l1 --beacon.url http://l1reth-cl.mainnet.scroll.tech:5052 --network.scroll-wire --network.bridge \ | ||
--log.stdout.format log-fmt -vvv $URL_PARAMS --beacon.url http://l1reth-cl.mainnet.scroll.tech:5052 --network.scroll-wire --network.bridge \ | ||
--trusted-peers "enode://c6ac91f43df3d63916ac1ae411cdd5ba249d55d48a7bec7f8cd5bb351a31aba437e5a69e8a1de74d73fdfeba8af1cfe9caf9846ecd3abf60d1ffdf4925b55b23@54.186.123.248:30303,enode://fdcc807b5d1353f3a1e98b90208ce6ef1b7d446136e51eaa8ad657b55518a2f8b37655e42375d61622e6ea18f3faf9d070c9bbdf012cf5484bcbad33b7a15fb1@44.227.91.206:30303,enode://6beb5a3efbb39be73d17630b6da48e94c0ce7ec665172111463cb470197b20c12faa1fa6f835b81c28571277d1017e65c4e426cc92a46141cf69118ecf28ac03@44.237.194.52:30303,enode://7cf893d444eb8e129dca0f6485b3df579911606e7c728be4fa55fcc5f155a37c3ce07d217ccec5447798bde465ac2bdba2cb8763d107e9f3257e787579e9f27e@52.35.203.107:30303,enode://c7b2d94e95da343db6e667a01cef90376a592f2d277fbcbf6e9c9186734ed8003d01389571bd10cdbab7a6e5adfa6f0c7b55644d0db24e0b9deb4ec80f842075@54.70.236.187:30303" | ||
fi | ||
Comment on lines
40
to
65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we extract this and the command for |
||
' | ||
env_file: | ||
- .env.shadow-fork | ||
environment: | ||
- ENV=${ENV:-dev} | ||
- SHADOW_FORK=${SHADOW_FORK:-false} | ||
- RUST_LOG=sqlx=off,info | ||
ports: | ||
- "8545:8545" # JSON-RPC | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide a reference to the
Dockerfile
which is used to build this image, please? Is there a reason we don't use the vanillafoundry
image (https://github.com/foundry-rs/foundry/pkgs/container/foundry)?