Skip to content

Commit 3a67f58

Browse files
jonastheisyiweichi
andauthored
feat: improve Docker e2e test framework and implement sequencer switching in the test (#315)
* feat: add CLAUDE.md file * fix: use correct function to recover signer * enable gossip to all on l2geth nodes and make gaslimit the same as RN sequencer * do not statically connect peers, disable discovery and make block time 500ms for both sequencers * dump logs before cleanup and provide convenience functions for nodes to connect to each other via RPC * fix: use sig_encode_hash to calculate block hash * Revert "fix: use sig_encode_hash to calculate block hash" This reverts commit 8bbc5e2. * fix: use sig_encode_hash to calculate block hash * fix: ci * rename value * fix using wrong hash when computing signature and loading signature from database in header transform * add caching to Dockerfile.test to speed up consecutive builds * add test_heterogeneous_client_sync_and_sequencer_handoff * fix: correctly encode signature when handling block import * move all reth dependencies to workspace Cargo.toml and reference fix branch in reth * restore initial network topology after reth broadcast to all is enabled * add more verbose logs * update reth dependency * fix issues after merge * fix issues after merge * build docker image by default * fix typo * adjust run scripts after merging changes to flags * remove sscache * add Deref for NamedProvider --------- Co-authored-by: Morty <[email protected]> Co-authored-by: Morty <[email protected]>
1 parent b233c8c commit 3a67f58

19 files changed

+474
-103
lines changed

Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,29 +138,50 @@ scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", defa
138138
scroll-alloy-hardforks = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
139139
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
140140
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
141+
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
142+
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
141143
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
142144

143145
# reth
144146
reth-chainspec = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
145147
reth-e2e-test-utils = { git = "https://github.com/scroll-tech/reth.git" }
148+
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
146149
reth-eth-wire-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
147150
reth-network = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
148151
reth-network-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
152+
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
149153
reth-network-peers = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
154+
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
150155
reth-node-builder = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
151156
reth-node-core = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
157+
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
158+
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
152159
reth-payload-primitives = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
153160
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
154161
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
155162
reth-provider = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
156163
reth-rpc-builder = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
164+
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
165+
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
166+
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
157167
reth-rpc-server-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
168+
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
158169
reth-tasks = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
159170
reth-tokio-util = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
160171
reth-tracing = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
172+
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
173+
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
174+
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
175+
reth-revm = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
176+
reth-evm = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
177+
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
178+
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
161179

162180
# reth-scroll
163181
reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
182+
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
183+
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
184+
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
164185
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
165186
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
166187
reth-scroll-node = { git = "https://github.com/scroll-tech/reth.git", default-features = false }

Dockerfile.test

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG CARGO_FEATURES=""
44

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

99
FROM chef AS planner
1010
WORKDIR /app
@@ -23,17 +23,18 @@ RUN mkdir -p tests/src && \
2323
echo 'name = "tests"' >> tests/Cargo.toml && \
2424
echo 'path = "src/lib.rs"' >> tests/Cargo.toml && \
2525
echo 'pub fn dummy() {}' > tests/src/lib.rs
26-
RUN --mount=type=cache,target=/usr/local/cargo/registry \
27-
cargo chef prepare --recipe-path /recipe.json
26+
RUN cargo chef prepare --recipe-path /recipe.json
2827

2928
FROM chef AS builder
3029
WORKDIR /app
3130
COPY --from=planner /recipe.json recipe.json
3231
RUN --mount=type=cache,target=/usr/local/cargo/registry \
32+
--mount=type=cache,target=/usr/local/cargo/git \
3333
cargo chef cook --release --recipe-path recipe.json
3434

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

3940
# Release

crates/chain-orchestrator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ scroll-network.workspace = true
3232

3333
# reth
3434
reth-chainspec.workspace = true
35-
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
35+
reth-network-p2p.workspace = true
3636
reth-network-peers.workspace = true
3737
reth-primitives-traits.workspace = true
3838

crates/engine/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ reth-primitives-traits.workspace = true
3232
# reth-scroll
3333
reth-scroll-chainspec.workspace = true
3434
reth-scroll-primitives.workspace = true
35-
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
35+
reth-scroll-engine-primitives.workspace = true
3636

3737
# rollup-node
3838
rollup-node-primitives.workspace = true
@@ -56,7 +56,7 @@ tracing.workspace = true
5656
alloy-consensus.workspace = true
5757
arbitrary.workspace = true
5858
async-trait.workspace = true
59-
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
59+
reth-testing-utils.workspace = true
6060
rollup-node-providers = { workspace = true, features = ["test-utils"] }
6161
scroll-alloy-consensus.workspace = true
6262
scroll-alloy-rpc-types-engine = { workspace = true, features = ["arbitrary"] }

crates/network/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ reth-chainspec.workspace = true
1515
reth-eth-wire-types.workspace = true
1616
reth-network.workspace = true
1717
reth-network-api.workspace = true
18-
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
18+
reth-network-types.workspace = true
1919
reth-network-peers.workspace = true
2020
reth-primitives-traits.workspace = true
21-
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
21+
reth-storage-api.workspace = true
2222
reth-tokio-util.workspace = true
2323

2424
# scroll

crates/network/src/manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<
210210

211211
// Announce block to the filtered set of peers
212212
for peer_id in peers {
213-
trace!(target: "scroll::network::manager", peer_id = %peer_id, block_hash = %hash, "Announcing new block to peer");
213+
trace!(target: "scroll::network::manager", peer_id = %peer_id, block_number = %block.block.header.number, block_hash = %hash, "Announcing new block to peer");
214214
self.scroll_wire.announce_block(peer_id, &block, hash);
215215
}
216216
}
@@ -315,7 +315,7 @@ impl<
315315
if self.blocks_seen.contains(&(block_hash, signature)) {
316316
return None;
317317
}
318-
trace!(target: "scroll::bridge::import", peer_id = %peer_id, block_hash = %block_hash, "Received new block from eth-wire protocol");
318+
trace!(target: "scroll::bridge::import", peer_id = %peer_id, block_hash = %block_hash, signature = %signature.to_string(), extra_data = %extra_data.to_string(), "Received new block from eth-wire protocol");
319319

320320
// Update the state of the peer cache i.e. peer has seen this block.
321321
self.scroll_wire

crates/node/Cargo.toml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,37 @@ alloy-signer = "1.0.30"
2828
alloy-transport.workspace = true
2929

3030
scroll-alloy-consensus.workspace = true
31-
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git" }
31+
scroll-alloy-evm.workspace = true
3232
scroll-alloy-hardforks.workspace = true
3333
scroll-alloy-network.workspace = true
3434
scroll-alloy-provider.workspace = true
3535

3636
reth-primitives-traits.workspace = true
3737
reth-scroll-engine-primitives.workspace = true
38-
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git" }
39-
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git" }
38+
reth-scroll-evm.workspace = true
39+
reth-scroll-cli.workspace = true
4040
reth-scroll-primitives.workspace = true
4141
reth-scroll-chainspec.workspace = true
4242
reth-scroll-node.workspace = true
43-
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git" }
43+
reth-scroll-rpc.workspace = true
4444

4545
reth-chainspec.workspace = true
46-
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git" }
46+
reth-cli-util.workspace = true
4747
reth-eth-wire-types.workspace = true
48-
reth-evm = { git = "https://github.com/scroll-tech/reth.git" }
48+
reth-evm.workspace = true
4949
reth-node-builder.workspace = true
50-
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
50+
reth-node-api.workspace = true
5151
reth-node-core.workspace = true
52-
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
52+
reth-node-types.workspace = true
5353
reth-network.workspace = true
5454
reth-network-api.workspace = true
55-
reth-revm = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
56-
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
57-
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
58-
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
55+
reth-revm.workspace = true
56+
reth-rpc-api.workspace = true
57+
reth-rpc-eth-api.workspace = true
58+
reth-rpc-eth-types.workspace = true
5959
reth-tasks.workspace = true
60-
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
61-
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
60+
reth-transaction-pool.workspace = true
61+
reth-trie-db.workspace = true
6262

6363
# rollup node
6464
rollup-node-chain-orchestrator.workspace = true
@@ -76,12 +76,12 @@ aws-sdk-kms = "1.76.0"
7676
# test-utils
7777
alloy-rpc-types-engine = { workspace = true, optional = true }
7878
reth-e2e-test-utils = { workspace = true, optional = true }
79-
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", default-features = false, optional = true }
79+
reth-engine-local = { workspace = true, optional = true }
8080
reth-provider = { workspace = true, optional = true }
8181
reth-rpc-server-types = { workspace = true, optional = true }
8282
scroll-alloy-rpc-types-engine = { workspace = true, optional = true }
8383
scroll-derivation-pipeline = { workspace = true, optional = true }
84-
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
84+
scroll-alloy-rpc-types.workspace = true
8585

8686
scroll-db.workspace = true
8787
scroll-engine.workspace = true

crates/scroll-wire/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ alloy-primitives = { workspace = true, features = ["map-foldhash"] }
1515
alloy-rlp = { version = "0.3.10", default-features = false }
1616

1717
# reth
18-
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
18+
reth-eth-wire.workspace = true
1919
reth-network.workspace = true
2020
reth-network-api.workspace = true
2121

crates/sequencer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ scroll-alloy-consensus.workspace = true
5151
# reth
5252
reth-e2e-test-utils.workspace = true
5353
reth-node-core.workspace = true
54-
reth-tracing = { git = "https://github.com/scroll-tech/reth.git" }
54+
reth-tracing.workspace = true
5555

5656
# reth-scroll
5757
reth-scroll-chainspec.workspace = true

tests/l2geth-genesis-e2e.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"feynmanTime": 0,
2424
"systemContract": {
2525
"period": 1,
26+
"blocks_per_second": 2,
2627
"system_contract_address": "0x55B150d210356452e4E79cCb6B778b4e1B167091",
2728
"system_contract_slot": "0x0000000000000000000000000000000000000000000000000000000000000067"
2829
},

0 commit comments

Comments
 (0)