From d229d8586148e95bef19601cd8c105c9d8007c20 Mon Sep 17 00:00:00 2001 From: Gabriel Martinez Rodriguez Date: Fri, 1 Nov 2024 11:31:11 +0100 Subject: [PATCH] feat: allow starting L2 node in non-sequencer mode --- config/l2_node.py | 5 +++++ l2_deploy.py | 2 +- l2_node.py | 1 + roll.py | 11 +++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/l2_node.py b/config/l2_node.py index 7e56887..2edc9da 100644 --- a/config/l2_node.py +++ b/config/l2_node.py @@ -58,6 +58,11 @@ def __init__(self): # === P2P Options === + self.l2_node_p2p_static_peers = "" + """ + Comma-separated list of bootnodes to connect to. + """ + self.l2_node_p2p_enabled = False """ Whether to enable P2P (peer discovery + block gossip — False by default). diff --git a/l2_deploy.py b/l2_deploy.py index a4e8580..1509ade 100644 --- a/l2_deploy.py +++ b/l2_deploy.py @@ -186,7 +186,7 @@ def _generate_l2_genesis(config: Config): print("Generating L2 genesis and rollup configs") try: log_file = f"{config.logs_dir}/generate_l2_genesis.log" - l2_allocs_path = os.path.join(config.artifacts_dir, 'allocs-l2.json') + l2_allocs_path = os.path.join(config.artifacts_dir, 'allocs-l2-granite.json') lib.run_roll_log("generate l2 genesis and rollup configs", [ 'go', 'run', 'cmd/main.go', 'genesis', 'l2', '--l1-rpc', 'http://localhost:8545', diff --git a/l2_node.py b/l2_node.py index 694a7f9..af41ad5 100644 --- a/l2_node.py +++ b/l2_node.py @@ -51,6 +51,7 @@ def start(config: Config, sequencer: bool = True): # https://github.com/ethereum-optimism/optimism/blob/develop/op-node/flags/p2p_flags.go *(["--p2p.disable"] if not config.l2_node_p2p_enabled else [ + f"--p2p.static={config.l2_node_p2p_static_peers}", f"--p2p.listen.ip={config.l2_node_p2p_listen_addr}", f"--p2p.listen.tcp={config.l2_node_p2p_tcp_listen_port}", f"--p2p.listen.udp={config.l2_node_p2p_udp_listen_port}", diff --git a/roll.py b/roll.py index 8f00980..289ed9b 100755 --- a/roll.py +++ b/roll.py @@ -131,6 +131,10 @@ "l2-sequencer", help="starts a local L2 node (op-node) in sequencer mode") +p.command( + "l2-node", + help="starts a local L2 node (op-node) in non-sequencer mode") + p.command( "l2-batcher", help="starts a local L2 transaction batcher") @@ -393,6 +397,13 @@ def main(): l2_node.start(config, sequencer=True) wait(config) + elif state.args.command == "l2-node": + if state.args.clean_first: + l2_node.clean(config) + + l2_node.start(config, sequencer=False) + wait(config) + elif state.args.command == "l2-batcher": # nothing to clean l2_batcher.start(config)