Skip to content

Add bootnode #147

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 1 commit 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
4 changes: 4 additions & 0 deletions internal/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ type EnodeAddr struct {
Artifact string
}

func (e *EnodeAddr) PrivKeyHex() string {
return hex.EncodeToString(gethcommon.LeftPadBytes(e.PrivKey.D.Bytes(), 32))
}

func (e *EnodeAddr) ID() enode.ID {
return enode.PubkeyToIDV4(&e.PrivKey.PublicKey)
}
Expand Down
1 change: 1 addition & 0 deletions internal/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func init() {
register(&BuilderHubPostgres{})
register(&BuilderHubMockProxy{})
register(&nullService{})
register(&Bootnode{})
}

func FindComponent(name string) ServiceGen {
Expand Down
28 changes: 28 additions & 0 deletions internal/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (o *OpGeth) Watchdog(out io.Writer, instance *instance, ctx context.Context
type RethEL struct {
UseRethForValidation bool
UseNativeReth bool
Bootnode *EnodeAddr
}

func (r *RethEL) ReleaseArtifact() *release {
Expand Down Expand Up @@ -262,6 +263,10 @@ func (r *RethEL) Run(svc *Service, ctx *ExContext) {
WithArtifact("/data/jwtsecret", "jwtsecret").
WithVolume("data", "/data_reth")

if r.Bootnode != nil {

}

if r.UseNativeReth {
// we need to use this otherwise the db cannot be binded
svc.UseHostExecution()
Expand Down Expand Up @@ -559,3 +564,26 @@ func (n *nullService) Run(service *Service, ctx *ExContext) {
func (n *nullService) Name() string {
return "null"
}

type Bootnode struct {
Enode *EnodeAddr
}

func (b *Bootnode) Run(service *Service, ctx *ExContext) {
// bootnode is not available in modern versions of Geth anymore https://github.com/ethereum/go-ethereum/pull/30813
b.Enode = ctx.Output.GetEnodeAddr()

service.
WithImage("ethereum/client-go").
WithTag("alltools-release-1.10").
WithEntrypoint("bootnode").
WithArgs(
"--nodekeyhex", b.Enode.PrivKeyHex(),
"--addr", `0.0.0.0:{{Port "p2p" 33333}}`,
"--verbosity", logLevelToGethVerbosity(ctx.LogLevel),
)
}

func (b *Bootnode) Name() string {
return "bootnode"
}
2 changes: 2 additions & 0 deletions internal/recipe_l1.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func (l *L1Recipe) Artifacts() *ArtifactsBuilder {
func (l *L1Recipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest {
svcManager := NewManifest(ctx, artifacts.Out)

svcManager.AddService("bootnode", &Bootnode{})

svcManager.AddService("el", &RethEL{
UseRethForValidation: l.useRethForValidation,
UseNativeReth: l.useNativeReth,
Expand Down