From 6caf9a5a3b14830523ab81e5e2e7884f72cd969a Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Wed, 2 Apr 2025 12:38:37 +0100 Subject: [PATCH] Run block builder internal with rollup-boost --- examples/op-stack-rollup-boost.md | 8 ++++++++ internal/components.go | 28 +++++++++++++++++++++++++--- internal/recipe_opstack.go | 10 +++++++++- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/examples/op-stack-rollup-boost.md b/examples/op-stack-rollup-boost.md index 0946828..d7a9581 100644 --- a/examples/op-stack-rollup-boost.md +++ b/examples/op-stack-rollup-boost.md @@ -45,3 +45,11 @@ The command above starts op-reth as an external block builder with the following - `--trusted-peers`: Connects to our Op Stack's EL node using the deterministic enode address Once op-reth is running, it will connect to the Op Stack and begin participating in block building. You can verify it's working by checking the logs of both the sequencer and op-reth for successful block proposals. + +## Internal block builder + +To use an internal `op-reth` as a block builder, run: + +``` +$ go run main.go cook opstack --external-builder op-reth +``` diff --git a/internal/components.go b/internal/components.go index 80bbdc0..7bb46a2 100644 --- a/internal/components.go +++ b/internal/components.go @@ -195,8 +195,8 @@ func (o *OpGeth) Ready(service *service) error { var _ ServiceWatchdog = &OpGeth{} func (o *OpGeth) Watchdog(out io.Writer, service *service, ctx context.Context) error { - rethURL := fmt.Sprintf("http://localhost:%d", service.MustGetPort("http").HostPort) - return watchChainHead(out, rethURL, 2*time.Second) + gethURL := fmt.Sprintf("http://localhost:%d", service.MustGetPort("http").HostPort) + return watchChainHead(out, gethURL, 2*time.Second) } type RethEL struct { @@ -497,7 +497,22 @@ type OpReth struct { } func (o *OpReth) Run(service *service, ctx *ExContext) { - panic("BUG: op-reth is not implemented yet") + service.WithImage("ghcr.io/paradigmxyz/op-reth"). + WithTag("nightly"). + WithEntrypoint("op-reth"). + WithArgs( + "node", + "--authrpc.port", `{{Port "authrpc" 8551}}`, + "--authrpc.addr", "0.0.0.0", + "--authrpc.jwtsecret", "{{.Dir}}/jwtsecret", + "--http", + "--http.addr", "0.0.0.0", + "--http.port", `{{Port "http" 8545}}`, + "--chain", "{{.Dir}}/l2-genesis.json", + "--datadir", "{{.Dir}}/data_op_reth", + "--disable-discovery", + "--color", "never", + "--port", `{{Port "rpc" 30303}}`) } func (o *OpReth) Name() string { @@ -522,3 +537,10 @@ func (o *OpReth) ReleaseArtifact() *release { }, } } + +var _ ServiceWatchdog = &OpReth{} + +func (p *OpReth) Watchdog(out io.Writer, service *service, ctx context.Context) error { + rethURL := fmt.Sprintf("http://localhost:%d", service.MustGetPort("http").HostPort) + return watchChainHead(out, rethURL, 2*time.Second) +} diff --git a/internal/recipe_opstack.go b/internal/recipe_opstack.go index 940e821..dfac98c 100644 --- a/internal/recipe_opstack.go +++ b/internal/recipe_opstack.go @@ -47,13 +47,21 @@ func (o *OpRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest { BeaconNode: "beacon", }) + externalBuilderRef := o.externalBuilder + if o.externalBuilder == "op-reth" { + // Add a new op-reth service and connect it to Rollup-boost + svcManager.AddService("op-reth", &OpReth{}) + + externalBuilderRef = Connect("op-reth", "authrpc") + } + elNode := "op-geth" if o.externalBuilder != "" { elNode = "rollup-boost" svcManager.AddService("rollup-boost", &RollupBoost{ ELNode: "op-geth", - Builder: o.externalBuilder, + Builder: externalBuilderRef, }) } svcManager.AddService("op-node", &OpNode{