From 43ad858e4d66757d1f99f80a4f175c54631ee350 Mon Sep 17 00:00:00 2001 From: faheelsattar Date: Wed, 16 Jul 2025 15:43:28 +0200 Subject: [PATCH 1/3] add mev-boost support --- mev-boost-relay/mev-boost-relay.go | 2 +- playground/catalog.go | 1 + playground/components.go | 52 ++++++++++++++++++++++++++++++ playground/recipe_l1.go | 34 +++++++++++++++---- 4 files changed, 81 insertions(+), 8 deletions(-) diff --git a/mev-boost-relay/mev-boost-relay.go b/mev-boost-relay/mev-boost-relay.go index b9fd3b5..14f0a3a 100644 --- a/mev-boost-relay/mev-boost-relay.go +++ b/mev-boost-relay/mev-boost-relay.go @@ -24,7 +24,7 @@ import ( "github.com/sirupsen/logrus" ) -var DefaultSecretKey = "5eae315483f028b5cdd5d1090ff0c7618b18737ea9bf3c35047189db22835c48" +var DefaultSecretKey = "0x5eae315483f028b5cdd5d1090ff0c7618b18737ea9bf3c35047189db22835c48" type Config struct { ApiListenAddr string diff --git a/playground/catalog.go b/playground/catalog.go index 383d94b..6cf842c 100644 --- a/playground/catalog.go +++ b/playground/catalog.go @@ -15,6 +15,7 @@ func init() { register(&LighthouseValidator{}) register(&ClProxy{}) register(&MevBoostRelay{}) + register(&MevBoost{}) register(&RollupBoost{}) register(&OpReth{}) register(&BuilderHub{}) diff --git a/playground/components.go b/playground/components.go index b459bd9..9df8ed2 100644 --- a/playground/components.go +++ b/playground/components.go @@ -6,6 +6,11 @@ import ( "io" "strconv" "time" + + "github.com/ethereum/go-ethereum/common/hexutil" + mevboostrelay "github.com/flashbots/builder-playground/mev-boost-relay" + "github.com/flashbots/go-boost-utils/bls" + "github.com/flashbots/go-boost-utils/utils" ) var defaultJWTToken = "04592280e1778419b7aa954d43871cb2cfb2ebda754fb735e8adeb293a88f9bf" @@ -656,6 +661,53 @@ func (p *OpReth) Watchdog(out io.Writer, instance *instance, ctx context.Context return watchChainHead(out, rethURL, 2*time.Second) } +type MevBoost struct { + RelayEndpoints []string +} + +func (m *MevBoost) Run(service *Service, ctx *ExContext) { + args := []string{ + "--addr", "0.0.0.0:" + `{{Port "http" 18550}}`, + "--loglevel", "info", + } + + for _, endpoint := range m.RelayEndpoints { + if endpoint == "mev-boost-relay" { + // create relay URL with public key for local mev-boost-relay + envSkBytes, err := hexutil.Decode(mevboostrelay.DefaultSecretKey) + if err != nil { + continue + } + secretKey, err := bls.SecretKeyFromBytes(envSkBytes[:]) + if err != nil { + continue + } + blsPublicKey, err := bls.PublicKeyFromSecretKey(secretKey) + if err != nil { + continue + } + publicKey, err := utils.BlsPublicKeyToPublicKey(blsPublicKey) + if err != nil { + continue + } + + relayURL := fmt.Sprintf("http://%s@%s:%s", publicKey.String(), endpoint, "5555") + args = append(args, "--relay", relayURL) + } else { + args = append(args, "--relay", Connect(endpoint, "http")) + } + } + + service. + WithImage("flashbots/mev-boost"). + WithTag("latest"). + WithArgs(args...) +} + +func (m *MevBoost) Name() string { + return "mev-boost" +} + type nullService struct { } diff --git a/playground/recipe_l1.go b/playground/recipe_l1.go index f639663..86f37cb 100644 --- a/playground/recipe_l1.go +++ b/playground/recipe_l1.go @@ -23,6 +23,8 @@ type L1Recipe struct { // will run on the host machine. This is useful if you want to bind to the Reth database and you // are running a host machine (i.e Mac) that is differerent from the docker one (Linux) useNativeReth bool + + useSeparateMevBoost bool } func (l *L1Recipe) Name() string { @@ -39,6 +41,7 @@ func (l *L1Recipe) Flags() *flag.FlagSet { flags.BoolVar(&l.useRethForValidation, "use-reth-for-validation", false, "use reth for validation") flags.Uint64Var(&l.secondaryELPort, "secondary-el", 0, "port to use for the secondary builder") flags.BoolVar(&l.useNativeReth, "use-native-reth", false, "use the native reth binary") + flags.BoolVar(&l.useSeparateMevBoost, "use-separate-mev-boost", false, "use separate mev-boost and mev-boost-relay services") return flags } @@ -78,14 +81,31 @@ func (l *L1Recipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest { BeaconNode: "beacon", }) - mevBoostValidationServer := "" - if l.useRethForValidation { - mevBoostValidationServer = "el" + if l.useSeparateMevBoost { + mevBoostValidationServer := "" + if l.useRethForValidation { + mevBoostValidationServer = "el" + } + + svcManager.AddService("mev-boost-relay", &MevBoostRelay{ + BeaconClient: "beacon", + ValidationServer: mevBoostValidationServer, + }) + + svcManager.AddService("mev-boost", &MevBoost{ + RelayEndpoints: []string{"mev-boost-relay"}, + }) + } else { + // single-service setup + mevBoostValidationServer := "" + if l.useRethForValidation { + mevBoostValidationServer = "el" + } + svcManager.AddService("mev-boost", &MevBoostRelay{ + BeaconClient: "beacon", + ValidationServer: mevBoostValidationServer, + }) } - svcManager.AddService("mev-boost", &MevBoostRelay{ - BeaconClient: "beacon", - ValidationServer: mevBoostValidationServer, - }) return svcManager } From b76d828417470a775f2f5e7467b22450017adcd3 Mon Sep 17 00:00:00 2001 From: faheelsattar Date: Fri, 18 Jul 2025 00:33:10 +0200 Subject: [PATCH 2/3] add for version env --- playground/components.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/playground/components.go b/playground/components.go index 9df8ed2..378258f 100644 --- a/playground/components.go +++ b/playground/components.go @@ -310,7 +310,7 @@ func (r *RethEL) ReleaseArtifact() *release { return &release{ Name: "reth", Org: "paradigmxyz", - Version: "v1.3.1", + Version: "v1.4.8", Arch: func(goos, goarch string) string { if goos == "linux" { return "x86_64-unknown-linux-gnu" @@ -345,7 +345,7 @@ func (r *RethEL) Run(svc *Service, ctx *ExContext) { // start the reth el client svc. WithImage("ghcr.io/paradigmxyz/reth"). - WithTag("v1.3.1"). + WithTag("v1.4.8"). WithEntrypoint("/usr/local/bin/reth"). WithArgs( "node", @@ -673,7 +673,7 @@ func (m *MevBoost) Run(service *Service, ctx *ExContext) { for _, endpoint := range m.RelayEndpoints { if endpoint == "mev-boost-relay" { - // create relay URL with public key for local mev-boost-relay + // creating relay url with public key for mev-boost-relay envSkBytes, err := hexutil.Decode(mevboostrelay.DefaultSecretKey) if err != nil { continue @@ -691,17 +691,17 @@ func (m *MevBoost) Run(service *Service, ctx *ExContext) { continue } - relayURL := fmt.Sprintf("http://%s@%s:%s", publicKey.String(), endpoint, "5555") + relayURL := ConnectRaw("mev-boost-relay", "http", "http", publicKey.String()) args = append(args, "--relay", relayURL) } else { args = append(args, "--relay", Connect(endpoint, "http")) } } - service. - WithImage("flashbots/mev-boost"). + service.WithImage("flashbots/mev-boost"). WithTag("latest"). - WithArgs(args...) + WithArgs(args...). + WithEnv("GENESIS_FORK_VERSION", "0x20000089") } func (m *MevBoost) Name() string { From f72e6aba3a2d1f85b83c78e54c0cb4227b7ddbaa Mon Sep 17 00:00:00 2001 From: faheelsattar Date: Fri, 18 Jul 2025 00:36:03 +0200 Subject: [PATCH 3/3] fix doc description --- playground/components.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/components.go b/playground/components.go index 378258f..fd01948 100644 --- a/playground/components.go +++ b/playground/components.go @@ -673,7 +673,7 @@ func (m *MevBoost) Run(service *Service, ctx *ExContext) { for _, endpoint := range m.RelayEndpoints { if endpoint == "mev-boost-relay" { - // creating relay url with public key for mev-boost-relay + // creating relay url with public key since mev-boost requires it envSkBytes, err := hexutil.Decode(mevboostrelay.DefaultSecretKey) if err != nil { continue