Skip to content

Add Bootnode component (Part 2) #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions playground/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func init() {
register(&nullService{})
register(&OpRbuilder{})
register(&FlashblocksRPC{})
register(&Bootnode{})
}

func FindComponent(name string) ServiceGen {
Expand Down
37 changes: 35 additions & 2 deletions playground/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
)
}
}
Expand Down Expand Up @@ -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"
}
9 changes: 5 additions & 4 deletions playground/recipe_opstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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",
Expand Down