diff --git a/playground/catalog.go b/playground/catalog.go index 383d94b..39c34a1 100644 --- a/playground/catalog.go +++ b/playground/catalog.go @@ -23,6 +23,7 @@ func init() { register(&nullService{}) register(&OpRbuilder{}) register(&FlashblocksRPC{}) + register(&Bootnode{}) } func FindComponent(name string) ServiceGen { diff --git a/playground/components.go b/playground/components.go index b459bd9..55427b8 100644 --- a/playground/components.go +++ b/playground/components.go @@ -77,7 +77,7 @@ func (o *OpRbuilder) Run(service *Service, ctx *ExContext) { WithVolume("data", "/data_op_reth") if ctx.Bootnode != nil { - service.WithArgs("--trusted-peers", ctx.Bootnode.Connect()) + service.WithArgs("--bootnodes", ctx.Bootnode.Connect()) } if o.Flashblocks { @@ -123,7 +123,7 @@ func (f *FlashblocksRPC) Run(service *Service, ctx *ExContext) { if ctx.Bootnode != nil { service.WithArgs( - "--trusted-peers", ctx.Bootnode.Connect(), + "--bootnodes", ctx.Bootnode.Connect(), ) } } @@ -665,3 +665,36 @@ func (n *nullService) Run(service *Service, ctx *ExContext) { func (n *nullService) Name() string { return "null" } + +type BootnodeProtocol string + +const ( + BootnodeProtocolV5 BootnodeProtocol = "v5" +) + +type Bootnode struct { + Protocol BootnodeProtocol + Enode *EnodeAddr +} + +func (b *Bootnode) Run(service *Service, ctx *ExContext) { + b.Enode = ctx.Output.GetEnodeAddr() + + service.WithImage("ghcr.io/paradigmxyz/reth"). + WithTag("v1.5.1"). + WithEntrypoint("/usr/local/bin/reth"). + WithArgs( + "p2p", "bootnode", + "--addr", `0.0.0.0:{{Port "rpc" 30303}}`, + "--node-key", "/data/p2p_key.txt", + ). + WithArtifact("/data/p2p_key.txt", b.Enode.Artifact) + + if b.Protocol == BootnodeProtocolV5 { + service.WithArgs("--v5") + } +} + +func (b *Bootnode) Name() string { + return "bootnode" +} diff --git a/playground/recipe_opstack.go b/playground/recipe_opstack.go index b720d51..c0b9a30 100644 --- a/playground/recipe_opstack.go +++ b/playground/recipe_opstack.go @@ -71,12 +71,12 @@ func (o *OpRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest { flashblocksBuilderURLRef := o.flashblocksBuilderURL externalBuilderRef := o.externalBuilder - opGeth := &OpGeth{} - svcManager.AddService("op-geth", opGeth) + bootnode := &Bootnode{} + svcManager.AddService("bootnode", bootnode) ctx.Bootnode = &BootnodeRef{ - Service: "op-geth", - ID: opGeth.Enode.NodeID(), + Service: "bootnode", + ID: bootnode.Enode.NodeID(), } if o.externalBuilder == "op-reth" { @@ -114,6 +114,7 @@ func (o *OpRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest { }) } + svcManager.AddService("op-geth", &OpGeth{}) svcManager.AddService("op-node", &OpNode{ L1Node: "el", L1Beacon: "beacon",