Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a9f1127
feat: integrate l2geth in docker-compose e2e tests
Jul 31, 2025
c431b54
Merge branch 'main' into e2e-test-integrate-l2geth
Aug 1, 2025
21fe045
Merge branch 'main' into e2e-test-integrate-l2geth
colinlyguo Aug 7, 2025
e3bb57f
support local genesis
Aug 12, 2025
cd57546
Merge branch 'main' into feat-support-genesis-file
colinlyguo Aug 13, 2025
39dc24c
address comments
Aug 13, 2025
21c7f2d
fix CI
Aug 13, 2025
c71aea3
Merge branch 'main' into e2e-test-integrate-l2geth
colinlyguo Aug 15, 2025
bf3dcb1
update scripts
Aug 15, 2025
13a7364
increase log level
Aug 15, 2025
cf2b45c
update gas limits
Aug 15, 2025
eff6dd2
Merge branch 'feat-support-genesis-file' into e2e-test-integrate-l2geth
Aug 15, 2025
0abcdc5
update reth commit
Aug 15, 2025
15b2ebc
Merge remote-tracking branch 'origin/main' into e2e-test-integrate-l2…
jonastheis Sep 1, 2025
1c89b47
cargo.lock
jonastheis Sep 1, 2025
5cec77b
fix compile errors
jonastheis Sep 2, 2025
5eff652
add initial test
jonastheis Sep 2, 2025
e35185d
Merge remote-tracking branch 'origin/main' into e2e-test-integrate-l2…
jonastheis Sep 4, 2025
0d665cb
fix lint
jonastheis Sep 4, 2025
0b19260
launch l2geth sequencer and read active signer from L1
jonastheis Sep 5, 2025
622474a
launch l2geth follower
jonastheis Sep 5, 2025
e534fc0
Merge remote-tracking branch 'origin/main' into e2e-test-integrate-l2…
jonastheis Sep 5, 2025
fb88f9e
fix issue with custom genesis where fields are missing and mixed up
jonastheis Sep 5, 2025
7562397
adjust chain id to arbitrary number to avoid conflict with named chain
jonastheis Sep 5, 2025
8429e33
rollup node follower can follow chain produced by l2geth sequencer
jonastheis Sep 5, 2025
e12af9d
configure rollup node sequencer correctly and connect to other nodes
jonastheis Sep 8, 2025
f668874
add health check for l1-node to make sure it is fully set up before l…
jonastheis Sep 8, 2025
41662ff
Merge remote-tracking branch 'origin/main' into e2e-test-integrate-l2…
jonastheis Sep 8, 2025
4ede953
refactor DockerComposeEnv and add more convenience functions for test…
jonastheis Sep 9, 2025
9e8c498
Merge remote-tracking branch 'origin/main' into e2e-test-integrate-l2…
jonastheis Sep 9, 2025
fae1c34
fix CI
jonastheis Sep 9, 2025
58b3507
remove todos
jonastheis Sep 10, 2025
c994e52
avoid building Docker image when only Docker integration test changes
jonastheis Sep 10, 2025
7956b64
Merge remote-tracking branch 'origin/main' into e2e-test-integrate-l2…
jonastheis Sep 10, 2025
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
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ alloy-consensus = { version = "1.0.13", default-features = false }
alloy-eips = { version = "1.0.13", default-features = false }
alloy-json-rpc = { version = "1.0.13", default-features = false }
alloy-network = { version = "1.0.13", default-features = false }
alloy-primitives = { version = "1.2.0", default-features = false }
alloy-primitives = { version = "1.3.1", default-features = false }
alloy-provider = { version = "1.0.13", default-features = false }
alloy-rpc-client = { version = "1.0.13", default-features = false }
alloy-rpc-types-engine = { version = "1.0.13", default-features = false }
Expand Down Expand Up @@ -185,7 +185,7 @@ scroll-wire = { path = "crates/scroll-wire" }
scroll-migration = { path = "crates/database/migration" }

# misc
arbitrary = { version = "1.4", default-features = false }
arbitrary = { version = "1.4", default-features = false, features = ["derive"] }
async-trait = "0.1"
auto_impl = "1.2"
bitvec = { version = "1.0", default-features = false }
Expand Down
51 changes: 51 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM rust:1.88.0 AS chef

ARG CARGO_FEATURES=""

# Install basic packages
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config
RUN cargo install cargo-chef --locked --version 0.1.71

FROM chef AS planner
WORKDIR /app

COPY . .
# Hacky: Replace tests with dummy stub to avoid workspace member issues of top-level Cargo.toml.
Comment thread
frisitano marked this conversation as resolved.
# This is needed because within the Docker integration tests we don't need the tests crate
# and want to avoid rebuilding it on every change.
RUN mkdir -p tests/src && \
echo '[package]' > tests/Cargo.toml && \
echo 'name = "tests"' >> tests/Cargo.toml && \
echo 'version = "0.0.1"' >> tests/Cargo.toml && \
echo 'edition = "2021"' >> tests/Cargo.toml && \
echo '' >> tests/Cargo.toml && \
echo '[lib]' >> tests/Cargo.toml && \
echo 'name = "tests"' >> tests/Cargo.toml && \
echo 'path = "src/lib.rs"' >> tests/Cargo.toml && \
echo 'pub fn dummy() {}' > tests/src/lib.rs
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo chef prepare --recipe-path /recipe.json

FROM chef AS builder
WORKDIR /app
COPY --from=planner /recipe.json recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo chef cook --release --recipe-path recipe.json

COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo build ${CARGO_FEATURES:+--features $CARGO_FEATURES} --release --target-dir=/app-target

# Release
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl sqlite3 && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY --from=builder /app-target/release/rollup-node /bin/

EXPOSE 30303 30303/udp 9001 8545 8546

ENTRYPOINT ["rollup-node"]
14 changes: 14 additions & 0 deletions Dockerfile.test.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# exclude everything
*

# include source files
!/bin
!/crates
!/testing
!book.toml
!Cargo.lock
!Cargo.toml
!Cross.toml
!deny.toml
!Makefile

2 changes: 2 additions & 0 deletions crates/node/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ impl ScrollRollupNodeConfig {
db.insert_genesis_block(genesis_hash)
.await
.expect("failed to insert genesis block (custom chain)");

tracing::info!(target: "scroll::node::args", ?genesis_hash, "Overwriting genesis hash for custom chain");
}

// Wrap the database in an Arc
Expand Down
5 changes: 3 additions & 2 deletions crates/node/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,9 +1322,10 @@ async fn test_custom_genesis_block_production_and_propagation() -> eyre::Result<
"l1MessageQueueAddress": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
"l1MessageQueueV2Address": "0x000000000000000000000000000000000003dead",
"scrollChainAddress": "0x000000000000000000000000000000000003dead",
"l2SystemConfigAddress": "0x000000000000000000000000000000000003dead",
"l2SystemConfigAddress": "0x0000000000000000000000000000000dddd3dead",
"systemContractAddress": "0x110000000000000000000000000000000003dead",
"numL1MessagesPerBlock": 10,
"l1MessageQueueV2DeploymentBlock": 12345
"startL1Block": 12345
}
}
},
Expand Down
42 changes: 37 additions & 5 deletions crates/primitives/src/node/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,59 @@ impl NodeConfig {
return Ok(Self::from_named_chain(named_chain));
}

// Note: It is important to make sure the chain id is not a named chain accidentally.
// For example, a custom `chain id=1337` will be treated as a named chain as it
// matches the dev chain. https://github.com/scroll-tech/rollup-node/issues/303
// If not a named chain, extract the configuration from the chain spec
let config = chain_spec.chain_config();

let genesis = chain_spec.genesis();
let l1_message_queue_v2_deployment_block = genesis

// let l1_message_queue_v2_deployment_block = genesis
// .config
// .extra_fields
// .get("scroll")
// .and_then(|scroll| scroll.get("l1Config"))
// .and_then(|l1_config| l1_config.get("l1MessageQueueV2DeploymentBlock"))
// .and_then(|v| v.as_u64())
// .ok_or_else(|| eyre::eyre!("Invalid or missing 'l1MessageQueueV2DeploymentBlock'"))?;
Comment thread
frisitano marked this conversation as resolved.

let start_l1_block = genesis
.config
.extra_fields
.get("scroll")
.and_then(|scroll| scroll.get("l1Config"))
.and_then(|l1_config| l1_config.get("l1MessageQueueV2DeploymentBlock"))
.and_then(|l1_config| l1_config.get("startL1Block"))
.and_then(|v| v.as_u64())
.ok_or_else(|| eyre::eyre!("Invalid or missing 'l1MessageQueueV2DeploymentBlock'"))?;
.ok_or_else(|| eyre::eyre!("Invalid or missing 'startL1Block'"))?;

let system_contract_address = genesis
.config
.extra_fields
.get("scroll")
.and_then(|scroll| scroll.get("l1Config"))
.and_then(|l1_config| l1_config.get("systemContractAddress"))
.and_then(|v| v.as_str())
.and_then(|s| s.parse().ok())
.ok_or_else(|| eyre::eyre!("Invalid or missing 'systemContractAddress'"))?;

// TODO:
// - config.l1_config.l2_system_config_address is not used here.
// - start_l1_block is not present currently in the config.
// - system_contract_address is not extracted from the config in https://github.com/scroll-tech/reth/blob/scroll/crates/scroll/chainspec/src/genesis.rs#L20
// - do we need: l1_message_queue_v2_deployment_block? maybe instead we could use
// v2_message_queue_starting_index
// - ultimately we want to make sure all relevant config is extracted from `ScrollChainInfo`
// and not partially here. see https://github.com/scroll-tech/rollup-node/issues/303

Ok(Self {
address_book: ScrollAddressBook {
rollup_node_contract_address: config.l1_config.scroll_chain_address,
v1_message_queue_address: config.l1_config.l1_message_queue_address,
v2_message_queue_address: config.l1_config.l1_message_queue_v2_address,
system_contract_address: config.l1_config.l2_system_config_address,
system_contract_address,
},
start_l1_block: l1_message_queue_v2_deployment_block,
start_l1_block,
})
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ tokio = { workspace = true, features = ["rt", "time"] }
eyre = { workspace = true }
getrandom = { workspace = true }
tracing = { workspace = true }
reth-tracing = { workspace = true }
serde = { workspace = true }
serde_json = "1.0"
1 change: 0 additions & 1 deletion tests/discovery-secret

This file was deleted.

76 changes: 58 additions & 18 deletions tests/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,91 @@
version: '3.8'

services:
l1-node:
image: ghcr.io/foundry-rs/foundry:latest
container_name: l1-node
entrypoint: [ "bash", "/launch_l1.bash" ]
ports:
- "8544:8545"
volumes:
- ./launch_l1.bash:/launch_l1.bash:ro
healthcheck:
test: ["CMD", "bash", "-c", "[ \"$(cast storage 0x55B150d210356452e4E79cCb6B778b4e1B167091 0x67 --rpc-url http://localhost:8545)\" = \"0x000000000000000000000000b674ff99cca262c99d3eab5b32796a99188543da\" ]"]
Comment thread
frisitano marked this conversation as resolved.
interval: 3s
timeout: 10s
retries: 30
start_period: 0s

rollup-node-sequencer:
build:
context: ../
dockerfile: Dockerfile
dockerfile: Dockerfile.test
container_name: rollup-node-sequencer
entrypoint: ["bash", "/launch_rollup_node_sequencer.bash"]
environment:
- ENV=dev
- RUST_LOG=info
ports:
- "8545:8545" # JSON-RPC
- "8546:8546" # WebSocket
- "6060:6060" # Metrics
volumes:
- ./launch_rollup_node_sequencer.bash:/launch_rollup_node_sequencer.bash:ro
- ./discovery-secret:/l2reth/discovery-secret:ro
- ./l2reth-genesis-e2e.json:/l2reth/l2reth-genesis-e2e.json:ro
- l2reth-sequencer:/l2reth
networks:
- test-scroll-network
depends_on:
l1-node:
condition: service_healthy

rollup-node-follower:
build:
context: ../
dockerfile: Dockerfile
dockerfile: Dockerfile.test
container_name: rollup-node-follower
entrypoint: ["bash", "/launch_rollup_node_follower.bash"]
environment:
- ENV=dev
- RUST_LOG=info
ports:
- "8547:8545" # JSON-RPC
- "8548:8546" # WebSocket
- "8546:8545" # JSON-RPC
- "6061:6060" # Metrics
volumes:
- ./launch_rollup_node_follower.bash:/launch_rollup_node_follower.bash:ro
- ./l2reth-genesis-e2e.json:/l2reth/l2reth-genesis-e2e.json:ro
- l2reth-follower:/l2reth
networks:
- test-scroll-network
depends_on:
- rollup-node-sequencer
l1-node:
condition: service_healthy

networks:
test-scroll-network:
driver: bridge
l2geth-sequencer:
image: scrolltech/l2geth:scroll-v5.9.4
platform: linux/amd64
container_name: l2geth-sequencer
entrypoint: ["bash", "/launch_l2geth.bash"]
ports:
- "8547:8545" # JSON-RPC
- "6062:6060" # Metrics
volumes:
- ./l2geth-genesis-e2e.json:/l2geth-genesis-e2e.json:ro
- ./launch_l2geth_sequencer.bash:/launch_l2geth.bash:ro
- l2geth-sequencer:/l2geth
depends_on:
l1-node:
condition: service_healthy

l2geth-follower:
image: scrolltech/l2geth:scroll-v5.9.4
platform: linux/amd64
container_name: l2geth-follower
entrypoint: ["bash", "/launch_l2geth.bash"]
ports:
- "8548:8545" # JSON-RPC
- "6063:6060" # Metrics
volumes:
- ./l2geth-genesis-e2e.json:/l2geth-genesis-e2e.json:ro
- ./launch_l2geth_follower.bash:/launch_l2geth.bash:ro
- l2geth-follower:/l2geth
depends_on:
l1-node:
condition: service_healthy

volumes:
l2reth-sequencer:
l2reth-follower:
l2geth-sequencer:
l2geth-follower:
Loading
Loading