Skip to content
Merged
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
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/charmbracelet/lipgloss v1.0.0
github.com/docker/docker v28.0.1+incompatible
github.com/dustinkirkland/golang-petname v0.0.0-20240428194347-eebcea082ee0
github.com/ethereum/go-ethereum v1.16.8
github.com/ethereum/go-ethereum v1.16.3
github.com/fatih/color v1.18.0
github.com/flashbots/go-boost-utils v1.9.1-0.20250819134059-e5294cb450c9
github.com/flashbots/go-template v1.0.0
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
github.com/goccy/go-json v0.10.4 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v1.0.0 // indirect
github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/gofuzz v1.2.1-0.20220503160820-4a35382e8fc8 // indirect
github.com/google/uuid v1.6.0 // indirect
Expand Down Expand Up @@ -170,7 +170,7 @@ require (
golang.org/x/sys v0.38.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/time v0.11.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/grpc v1.71.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e h1:4bw4WeyTYPp0smaXiJZCNnLrvVBqirQVreixayXezGc=
github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
Expand Down Expand Up @@ -567,8 +567,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down
4 changes: 0 additions & 4 deletions playground/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ var opStateJovian []byte
//go:embed config.yaml.tmpl
var clConfigContent []byte

//go:embed utils/builderhub-config.yaml
var defaultBuilderHubConfig []byte

// l2ForkConfig holds the selected L2 fork configuration files
type l2ForkConfig struct {
genesis []byte // L2 genesis JSON
Expand Down Expand Up @@ -252,7 +249,6 @@ func (b *ArtifactsBuilder) Build(out *output) error {

genesisTime := time.Now().Add(time.Duration(b.genesisDelay) * time.Second)
config := params.BeaconConfig()
config.ElectraForkEpoch = 0

gen := interop.GethTestnetGenesis(genesisTime, config)
// HACK: fix this in prysm?
Expand Down
89 changes: 21 additions & 68 deletions playground/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
mevboostrelay "github.com/flashbots/builder-playground/mev-boost-relay"
"github.com/flashbots/go-boost-utils/bls"
"github.com/flashbots/go-boost-utils/utils"
"github.com/goccy/go-yaml"
)

var (
Expand Down Expand Up @@ -548,9 +547,7 @@ func (l *LighthouseBeaconNode) Apply(ctx *ExContext) *Component {
"--http-address", "0.0.0.0",
"--http-allow-origin", "*",
"--disable-packet-filter",
"--target-peers", "1",
//"--target-peers", "0",
"--subscribe-all-subnets",
"--target-peers", "0",
"--execution-endpoint", Connect(l.ExecutionNode, "authrpc"),
"--execution-jwt", "/data/jwtsecret",
"--always-prepare-payload",
Expand All @@ -561,8 +558,7 @@ func (l *LighthouseBeaconNode) Apply(ctx *ExContext) *Component {
WithArtifact("/data/jwtsecret", "jwtsecret").
WithVolume("data", "/data_beacon")

// TODO: Enable later - doesn't work with --target-peers=1 which is required for builder VM
//UseHealthmon(component, svc, healthmonBeacon)
UseHealthmon(component, svc, healthmonBeacon)

if l.MevBoostNode != "" {
svc.WithArgs(
Expand Down Expand Up @@ -639,8 +635,7 @@ func (m *MevBoostRelay) Apply(ctx *ExContext) *Component {
WithTag(latestPlaygroundUtilsTag).
WithEnv("ALLOW_SYNCING_BEACON_NODE", "1").
WithEntrypoint("mev-boost-relay").
// TODO: Enable later - doesn't work when beacon healthmon is disabled.
//DependsOnHealthy(m.BeaconClient).
DependsOnHealthy(m.BeaconClient).
WithArgs(
"--api-listen-addr", "0.0.0.0",
"--api-listen-port", `{{Port "http" 5555}}`,
Expand Down Expand Up @@ -947,8 +942,8 @@ func (b *BuilderHub) Apply(ctx *ExContext) *Component {
StartPeriod: 2 * time.Second,
})

// API service
component.NewService("builder-hub-api").
// API service
apiSrv := component.NewService("builder-hub-api").
WithImage("docker.io/flashbots/builder-hub").
WithTag("0.3.1-alpha1").
DependsOnHealthy("builder-hub-db").
Expand All @@ -970,14 +965,15 @@ func (b *BuilderHub) Apply(ctx *ExContext) *Component {
Timeout: 30 * time.Second,
Retries: 3,
StartPeriod: 1 * time.Second,
}).
WithPostHook(&postHook{
Name: "register-builder",
Action: func(m *Manifest, s *Service) error {
return registerBuilderHook(ctx, m, s, b)
},
})

apiSrv.WithPostHook(&postHook{
Name: "register-builder",
Action: func(s *Service) error {
return registerBuilderHook(ctx, s, b)
},
})

// Proxy service
component.NewService("builder-hub-proxy").
WithImage("docker.io/flashbots/builder-hub-mock-proxy").
Expand All @@ -996,33 +992,14 @@ func (b *BuilderHub) Apply(ctx *ExContext) *Component {
return component
}

type builderHubConfig struct {
Playground struct {
BuilderHubConfig struct {
BuilderID string `yaml:"builder_id"`
BuilderIP string `yaml:"builder_ip"`
MeasurementID string `yaml:"measurement_id"`
Network string `yaml:"network"`
} `yaml:"builder_hub_config"`
} `yaml:"playground"`
}

func registerBuilderHook(ctx *ExContext, manifest *Manifest, s *Service, b *BuilderHub) error {
func registerBuilderHook(ctx *ExContext, s *Service, b *BuilderHub) error {
genesis, err := ctx.Output.Read("genesis.json")
if err != nil {
return err
}

configYaml := defaultBuilderHubConfig
if len(b.BuilderConfig) > 0 {
configYaml, err = os.ReadFile(b.BuilderConfig)
if err != nil {
return err
}
}

var config builderHubConfig
if err := yaml.Unmarshal([]byte(configYaml), &config); err != nil {
configYaml, err := os.ReadFile(b.BuilderConfig)
if err != nil {
return err
}

Expand All @@ -1039,17 +1016,15 @@ func registerBuilderHook(ctx *ExContext, manifest *Manifest, s *Service, b *Buil
return err
}

endpoint := fmt.Sprintf("http://localhost:%d", s.MustGetPort("admin").HostPort)
input := &builderHubRegisterBuilderInput{
BuilderID: config.Playground.BuilderHubConfig.BuilderID,
BuilderIP: config.Playground.BuilderHubConfig.BuilderIP,
MeasurementID: config.Playground.BuilderHubConfig.MeasurementID,
Network: config.Playground.BuilderHubConfig.Network,
BuilderID: "builder",
BuilderIP: b.BuilderIP,
MeasurementID: "test",
Network: "playground",
Config: string(configJSON),
}
adminApi := fmt.Sprintf("http://localhost:%d", manifest.MustGetService("builder-hub-api").MustGetPort("admin").HostPort)
beaconApi := fmt.Sprintf("http://localhost:%d", manifest.MustGetService("beacon").MustGetPort("http").HostPort)
rethApi := fmt.Sprintf("http://localhost:%d", manifest.MustGetService("el").MustGetPort("http").HostPort)
if err := registerBuilder(adminApi, beaconApi, rethApi, input); err != nil {
if err := registerBuilder(endpoint, input); err != nil {
return err
}
return nil
Expand Down Expand Up @@ -1077,25 +1052,3 @@ func UseHealthmon(component *Component, s *Service, chain string) {
StartPeriod: 1 * time.Second,
})
}

// Fileserver serves genesis and testnet files over HTTP using Caddy.
// This allows VMs or external clients to fetch configuration files.
type Fileserver struct{}

func (f *Fileserver) Apply(ctx *ExContext) *Component {
component := NewComponent("fileserver")

component.NewService("server").
WithImage("caddy").
WithTag("2-alpine").
WithArgs(
"caddy", "file-server",
"--root", "/data",
"--listen", `:{{Port "http" 8100}}`,
"--browse",
).
WithArtifact("/data/genesis.json", "genesis.json").
WithArtifact("/data/testnet", "testnet")

return component
}
2 changes: 1 addition & 1 deletion playground/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func TestRecipeBuilderHub_RegisterBuilder(t *testing.T) {
apiPort := manifest.MustGetService("builder-hub-api").MustGetPort("admin")
endpoint := fmt.Sprintf("http://localhost:%d", apiPort.HostPort)

err := registerBuilder(endpoint, "", "", &builderHubRegisterBuilderInput{
err := registerBuilder(endpoint, &builderHubRegisterBuilderInput{
BuilderID: "test_builder",
BuilderIP: "1.2.3.4",
MeasurementID: "test",
Expand Down
4 changes: 2 additions & 2 deletions playground/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (s *Service) WithReady(check ReadyCheck) *Service {

type postHook struct {
Name string
Action func(m *Manifest, s *Service) error
Action func(s *Service) error
}

func (s *Service) WithPostHook(hook *postHook) *Service {
Expand All @@ -551,7 +551,7 @@ func (m *Manifest) ExecutePostHookActions() error {
for _, svc := range m.Services {
if svc.postHook != nil {
slog.Info("Executing post-hook operation", "name", svc.postHook.Name)
if err := svc.postHook.Action(m, svc); err != nil {
if err := svc.postHook.Action(svc); err != nil {
return err
}
}
Expand Down
Loading