diff --git a/internal/artifacts.go b/internal/artifacts.go index 55fd802..746c26e 100644 --- a/internal/artifacts.go +++ b/internal/artifacts.go @@ -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) } diff --git a/internal/catalog.go b/internal/catalog.go index 83c97c2..481fd6b 100644 --- a/internal/catalog.go +++ b/internal/catalog.go @@ -21,6 +21,7 @@ func init() { register(&BuilderHubPostgres{}) register(&BuilderHubMockProxy{}) register(&nullService{}) + register(&Bootnode{}) } func FindComponent(name string) ServiceGen { diff --git a/internal/components.go b/internal/components.go index 298e1a3..b14376e 100644 --- a/internal/components.go +++ b/internal/components.go @@ -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 { @@ -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() @@ -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" +} diff --git a/internal/recipe_l1.go b/internal/recipe_l1.go index ee267af..f6f02dc 100644 --- a/internal/recipe_l1.go +++ b/internal/recipe_l1.go @@ -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,