Skip to content

Commit d46b1f0

Browse files
feat(docker tests): add L1 messages to testing (#343)
* add dev genesis allocation * add util function to generate transactions * add functions to continuously send tx during a test * add continuous tx sending to test * add continuous transaction sender for migration test * add anvil test state * fix use correct system contract address for consensus * set correct addresses for l1MessageQueueV2Address and l1 deployer private key * add L1 message sending functionality and integrate with existing tests * update cargo * revert changes to cargo.lock * fix bug which didn't allow to build blocks with more than 1 L1 message * use latest l2geth image and configure new flag --l1.sync.interval=1s * fix error when there's no messages on the L1 contract * atomic rollup node * atomic rollup node * atomic rollup node * lint * add status rpc * fork choice fix and test coverage * add logs and optimise block handling in fork choice logic * update rpc and default optimistic sync threshold * commit merge files * implement functionality to start/stop docker containers from the test * start using Docker start/stop in the test * fixes after merge * fix lint * expose SyncMode and make Eq * add and verify restart of RN to test * add frequent sequencer switching test * fix anvil version * add timeout to container stop and restart * fix lint --------- Co-authored-by: jonastheis <[email protected]>
1 parent 50b63b2 commit d46b1f0

18 files changed

+685
-61
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/chain-orchestrator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ mod retry;
6868
pub use retry::Retry;
6969

7070
mod sync;
71-
pub use sync::SyncState;
71+
pub use sync::{SyncMode, SyncState};
7272

7373
mod status;
7474
pub use status::ChainOrchestratorStatus;

crates/chain-orchestrator/src/status.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::sync::{SyncMode, SyncState};
22
use scroll_engine::ForkchoiceState;
33

44
/// The current status of the chain orchestrator.
5-
#[derive(Debug, Clone)]
5+
#[derive(Debug, Clone, PartialEq, Eq)]
66
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
77
pub struct ChainOrchestratorStatus {
88
/// The chain status for L1.
@@ -33,7 +33,7 @@ impl ChainOrchestratorStatus {
3333
}
3434

3535
/// The status of the L1 chain.
36-
#[derive(Debug, Clone)]
36+
#[derive(Debug, Clone, PartialEq, Eq)]
3737
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3838
pub struct L1ChainStatus {
3939
/// The sync mode of the chain.
@@ -47,7 +47,7 @@ pub struct L1ChainStatus {
4747
}
4848

4949
/// The status of the L2 chain.
50-
#[derive(Debug, Clone)]
50+
#[derive(Debug, Clone, PartialEq, Eq)]
5151
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5252
pub struct L2ChainStatus {
5353
/// The sync mode of the chain.

crates/chain-orchestrator/src/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl SyncState {
4242
}
4343

4444
/// The sync mode of the chain orchestrator.
45-
#[derive(Debug, Default, Clone)]
45+
#[derive(Debug, Default, Clone, PartialEq, Eq)]
4646
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4747
pub enum SyncMode {
4848
/// Syncing mode.

crates/engine/src/fcs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use scroll_alloy_network::Scroll;
1414
///
1515
/// The state is composed of the [`BlockInfo`] for `head`, `safe` block, and the `finalized`
1616
/// blocks.
17-
#[derive(Debug, Clone)]
17+
#[derive(Debug, Clone, PartialEq, Eq)]
1818
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1919
pub struct ForkchoiceState {
2020
head: BlockInfo,

tests/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ alloy-primitives = { workspace = true }
1212
alloy-network = { workspace = true }
1313
alloy-provider = { workspace = true, features = ["reqwest", "ws"] }
1414
alloy-rpc-types-eth = { workspace = true }
15+
alloy-signer-local = { workspace = true }
16+
alloy-sol-types = { workspace = true }
1517
scroll-alloy-network = { workspace = true }
18+
rollup-node-chain-orchestrator = { path = "../crates/chain-orchestrator", features = ["serde"] }
1619
tokio = { workspace = true, features = ["rt", "time", "process"] }
1720
eyre = { workspace = true }
1821
getrandom = { workspace = true }
1922
tracing = { workspace = true }
2023
reth-tracing = { workspace = true }
2124
serde = { workspace = true }
22-
serde_json = "1.0"
25+
serde_json = { workspace = true }
2326
reth-e2e-test-utils.workspace = true

tests/anvil.env

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
CHAIN_ID_L2=938471
2+
NETWORK=sepolia
3+
L1_DEPLOYER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
4+
L1_PROXY_ADMIN_ADDR=0x5FbDB2315678afecb367f032d93F642f64180aa3
5+
L1_PROXY_IMPLEMENTATION_PLACEHOLDER_ADDR=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
6+
L1_SYSTEM_CONFIG_PROXY_ADDR=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
7+
L1_MESSAGE_QUEUE_V1_PROXY_ADDR=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
8+
L1_MESSAGE_QUEUE_V2_PROXY_ADDR=0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
9+
L1_SCROLL_CHAIN_PROXY_ADDR=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
10+
L1_ETH_GATEWAY_PROXY_ADDR=0x0165878A594ca255338adfa4d48449f69242Eb8F
11+
L1_WETH_GATEWAY_PROXY_ADDR=0xa513E6E4b8f2a923D98304ec87F64353C4D5C853
12+
L1_STANDARD_ERC20_GATEWAY_PROXY_ADDR=0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
13+
L1_SCROLL_MESSENGER_PROXY_ADDR=0x8A791620dd6260079BF849Dc5567aDC3F2FdC318
14+
L1_CUSTOM_ERC20_GATEWAY_PROXY_ADDR=0x610178dA211FEF7D417bC0e6FeD39F05609AD788
15+
L1_ERC721_GATEWAY_PROXY_ADDR=0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
16+
L1_ERC1155_GATEWAY_PROXY_ADDR=0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0
17+
L1_WETH_ADDR=0x0000000000000000000000000000000000000001
18+
L2_WETH_ADDR=0x0000000000000000000000000000000000000001
19+
L1_PLONK_VERIFIER_ADDR=0x0000000000000000000000000000000000000001
20+
VERIFIER_DIGEST_1=0x0000000000000000000000000000000000000000000000000000000000000001
21+
VERIFIER_DIGEST_2=0x0000000000000000000000000000000000000000000000000000000000000001
22+
L1_FEE_VAULT_ADDR=0x0000000000000000000000000000000000000001
23+
L2_SCROLL_MESSENGER_PROXY_ADDR=0x0000000000000000000000000000000000000001
24+
L2_CUSTOM_ERC20_GATEWAY_PROXY_ADDR=0x0000000000000000000000000000000000000001
25+
L2_ERC721_GATEWAY_PROXY_ADDR=0x0000000000000000000000000000000000000001
26+
L2_ERC1155_GATEWAY_PROXY_ADDR=0x0000000000000000000000000000000000000001
27+
L2_ETH_GATEWAY_PROXY_ADDR=0x0000000000000000000000000000000000000001
28+
L2_STANDARD_ERC20_GATEWAY_PROXY_ADDR=0x0000000000000000000000000000000000000001
29+
L2_WETH_GATEWAY_PROXY_ADDR=0x0000000000000000000000000000000000000001
30+
L2_SCROLL_STANDARD_ERC20_ADDR=0x0000000000000000000000000000000000000001
31+
L2_SCROLL_STANDARD_ERC20_FACTORY_ADDR=0x0000000000000000000000000000000000000001
32+
L1_SCROLL_MULTISIG_ADDR=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
33+
L1_SECURITY_COUNCIL_ADDR=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
34+
L1_PROPOSAL_EXECUTOR_ADDR=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
35+
L1_SCROLL_OWNER_ADDR=0x9E545E3C0baAB3E08CdfD552C960A1050f373042
36+
L1_1D_TIMELOCK_ADDR=0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9
37+
L1_7D_TIMELOCK_ADDR=0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8
38+
L1_14D_TIMELOCK_ADDR=0x851356ae760d987E095750cCeb3bC6014560891C
39+
MAX_TX_IN_CHUNK=100
40+
MAX_L1_MESSAGE_GAS_LIMIT=2000000
41+
FINALIZE_BATCH_DEADLINE_SEC=86400
42+
RELAY_MESSAGE_DEADLINE_SEC=86400
43+
L2GETH_SIGNER_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
44+
L1_COMMIT_SENDER_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
45+
L1_FINALIZE_SENDER_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
46+
L1_ZKEVM_VERIFIER_V1_ADDR=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82
47+
L1_MULTIPLE_VERSION_ROLLUP_VERIFIER_ADDR=0x9A676e781A523b5d0C0e43731313A708CB607508
48+
L1_WHITELIST_ADDR=0x0B306BF915C4d645ff596e518fAf3F9669b97016
49+
L1_SYSTEM_CONFIG_IMPLEMENTATION_ADDR=0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1
50+
L1_ENFORCED_TX_GATEWAY_IMPLEMENTATION_ADDR=0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE
51+
L1_ENFORCED_TX_GATEWAY_PROXY_ADDR=0x68B1D87F95878fE05B998F19b66F4baba5De1aed
52+
L1_MESSAGE_QUEUE_V1_IMPLEMENTATION_ADDR=0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
53+
L1_MESSAGE_QUEUE_V2_IMPLEMENTATION_ADDR=0xc6e7DF5E7b4f2A278906862b61205850344D4e7d
54+
L2_GAS_PRICE_ORACLE_IMPLEMENTATION_ADDR=0x59b670e9fA9D0A427751Af201D676719a970857b
55+
L2_GAS_PRICE_ORACLE_PROXY_ADDR=0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1
56+
L1_SCROLL_CHAIN_IMPLEMENTATION_ADDR=0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44
57+
L1_SCROLL_MESSENGER_IMPLEMENTATION_ADDR=0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f
58+
L1_GATEWAY_ROUTER_IMPLEMENTATION_ADDR=0x4A679253410272dd5232B3Ff7cF5dbB88f295319
59+
L1_GATEWAY_ROUTER_PROXY_ADDR=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F
60+
L1_ETH_GATEWAY_IMPLEMENTATION_ADDR=0x09635F643e140090A9A8Dcd712eD6285858ceBef
61+
L1_WETH_GATEWAY_IMPLEMENTATION_ADDR=0xc5a5C42992dECbae36851359345FE25997F5C42d
62+
L1_STANDARD_ERC20_GATEWAY_IMPLEMENTATION_ADDR=0x67d269191c92Caf3cD7723F116c85e6E9bf55933
63+
L1_CUSTOM_ERC20_GATEWAY_IMPLEMENTATION_ADDR=0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E
64+
L1_ERC721_GATEWAY_IMPLEMENTATION_ADDR=0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690
65+
L1_ERC1155_GATEWAY_IMPLEMENTATION_ADDR=0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB
66+
L1_CONSENSUS_ADDRESS=0xb674Ff99cca262c99D3eAb5B32796a99188543dA

tests/anvil_state.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

tests/docker-compose.test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
services:
22
l1-node:
3-
image: ghcr.io/foundry-rs/foundry:latest
4-
entrypoint: [ "bash", "/launch_l1.bash" ]
3+
image: ghcr.io/foundry-rs/foundry:v1.2.3
4+
entrypoint: ["bash", "/launch_l1.bash"]
55
ports:
66
- "8544:8545"
77
volumes:
88
- ./launch_l1.bash:/launch_l1.bash:ro
9+
- ./anvil.env:/anvil.env:ro
10+
- ./anvil_state.json:/anvil_state.json:ro
911
healthcheck:
10-
test: ["CMD", "bash", "-c", "[ \"$(cast storage 0x55B150d210356452e4E79cCb6B778b4e1B167091 0x67 --rpc-url http://localhost:8545)\" = \"0x000000000000000000000000b674ff99cca262c99d3eab5b32796a99188543da\" ]"]
12+
test: ["CMD", "bash", "-c", "[ \"$(cast storage 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 0x67 --rpc-url http://localhost:8545)\" = \"0x000000000000000000000000b674ff99cca262c99d3eab5b32796a99188543da\" ]"]
1113
interval: 3s
1214
timeout: 10s
1315
retries: 30
@@ -50,7 +52,7 @@ services:
5052
condition: service_healthy
5153

5254
l2geth-sequencer:
53-
image: scrolltech/l2geth:scroll-v5.9.4
55+
image: scrolltech/l2geth:scroll-v5.9.5
5456
platform: linux/amd64
5557
entrypoint: ["bash", "/launch_l2geth.bash"]
5658
ports:
@@ -65,7 +67,7 @@ services:
6567
condition: service_healthy
6668

6769
l2geth-follower:
68-
image: scrolltech/l2geth:scroll-v5.9.4
70+
image: scrolltech/l2geth:scroll-v5.9.5
6971
platform: linux/amd64
7072
entrypoint: ["bash", "/launch_l2geth.bash"]
7173
ports:

tests/l2geth-genesis-e2e.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"systemContract": {
2525
"period": 1,
2626
"blocks_per_second": 2,
27-
"system_contract_address": "0x55B150d210356452e4E79cCb6B778b4e1B167091",
27+
"system_contract_address": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
2828
"system_contract_slot": "0x0000000000000000000000000000000000000000000000000000000000000067"
2929
},
3030
"scroll": {
@@ -35,7 +35,7 @@
3535
"l1Config": {
3636
"l1ChainId": "22222222",
3737
"l1MessageQueueAddress": "0x0000000000000000000000000000000000000001",
38-
"l1MessageQueueV2Address": "0x160dd98613ba6C6E0a14086a87cf36244558422E",
38+
"l1MessageQueueV2Address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
3939
"l1MessageQueueV2DeploymentBlock": 0,
4040
"scrollChainAddress": "0x84044d3a645843bAF0752eA591E1EAB643beD904",
4141
"l2SystemConfigAddress": "0x2E48aC0df81f1fa57722e115e807C9dB1819bA13",

0 commit comments

Comments
 (0)