Skip to content

Commit 863477d

Browse files
authored
Merge pull request #184 from faheelsattar/faheelsattar/mev-boost
add mev-boost support
2 parents 3b272d6 + f72e6ab commit 863477d

File tree

4 files changed

+83
-10
lines changed

4 files changed

+83
-10
lines changed

mev-boost-relay/mev-boost-relay.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/sirupsen/logrus"
2525
)
2626

27-
var DefaultSecretKey = "5eae315483f028b5cdd5d1090ff0c7618b18737ea9bf3c35047189db22835c48"
27+
var DefaultSecretKey = "0x5eae315483f028b5cdd5d1090ff0c7618b18737ea9bf3c35047189db22835c48"
2828

2929
type Config struct {
3030
ApiListenAddr string

playground/catalog.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func init() {
1515
register(&LighthouseValidator{})
1616
register(&ClProxy{})
1717
register(&MevBoostRelay{})
18+
register(&MevBoost{})
1819
register(&RollupBoost{})
1920
register(&OpReth{})
2021
register(&BuilderHub{})

playground/components.go

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import (
66
"io"
77
"strconv"
88
"time"
9+
10+
"github.com/ethereum/go-ethereum/common/hexutil"
11+
mevboostrelay "github.com/flashbots/builder-playground/mev-boost-relay"
12+
"github.com/flashbots/go-boost-utils/bls"
13+
"github.com/flashbots/go-boost-utils/utils"
914
)
1015

1116
var defaultJWTToken = "04592280e1778419b7aa954d43871cb2cfb2ebda754fb735e8adeb293a88f9bf"
@@ -305,7 +310,7 @@ func (r *RethEL) ReleaseArtifact() *release {
305310
return &release{
306311
Name: "reth",
307312
Org: "paradigmxyz",
308-
Version: "v1.3.1",
313+
Version: "v1.4.8",
309314
Arch: func(goos, goarch string) string {
310315
if goos == "linux" {
311316
return "x86_64-unknown-linux-gnu"
@@ -340,7 +345,7 @@ func (r *RethEL) Run(svc *Service, ctx *ExContext) {
340345
// start the reth el client
341346
svc.
342347
WithImage("ghcr.io/paradigmxyz/reth").
343-
WithTag("v1.3.1").
348+
WithTag("v1.4.8").
344349
WithEntrypoint("/usr/local/bin/reth").
345350
WithArgs(
346351
"node",
@@ -656,6 +661,53 @@ func (p *OpReth) Watchdog(out io.Writer, instance *instance, ctx context.Context
656661
return watchChainHead(out, rethURL, 2*time.Second)
657662
}
658663

664+
type MevBoost struct {
665+
RelayEndpoints []string
666+
}
667+
668+
func (m *MevBoost) Run(service *Service, ctx *ExContext) {
669+
args := []string{
670+
"--addr", "0.0.0.0:" + `{{Port "http" 18550}}`,
671+
"--loglevel", "info",
672+
}
673+
674+
for _, endpoint := range m.RelayEndpoints {
675+
if endpoint == "mev-boost-relay" {
676+
// creating relay url with public key since mev-boost requires it
677+
envSkBytes, err := hexutil.Decode(mevboostrelay.DefaultSecretKey)
678+
if err != nil {
679+
continue
680+
}
681+
secretKey, err := bls.SecretKeyFromBytes(envSkBytes[:])
682+
if err != nil {
683+
continue
684+
}
685+
blsPublicKey, err := bls.PublicKeyFromSecretKey(secretKey)
686+
if err != nil {
687+
continue
688+
}
689+
publicKey, err := utils.BlsPublicKeyToPublicKey(blsPublicKey)
690+
if err != nil {
691+
continue
692+
}
693+
694+
relayURL := ConnectRaw("mev-boost-relay", "http", "http", publicKey.String())
695+
args = append(args, "--relay", relayURL)
696+
} else {
697+
args = append(args, "--relay", Connect(endpoint, "http"))
698+
}
699+
}
700+
701+
service.WithImage("flashbots/mev-boost").
702+
WithTag("latest").
703+
WithArgs(args...).
704+
WithEnv("GENESIS_FORK_VERSION", "0x20000089")
705+
}
706+
707+
func (m *MevBoost) Name() string {
708+
return "mev-boost"
709+
}
710+
659711
type nullService struct {
660712
}
661713

playground/recipe_l1.go

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type L1Recipe struct {
2323
// will run on the host machine. This is useful if you want to bind to the Reth database and you
2424
// are running a host machine (i.e Mac) that is differerent from the docker one (Linux)
2525
useNativeReth bool
26+
27+
useSeparateMevBoost bool
2628
}
2729

2830
func (l *L1Recipe) Name() string {
@@ -39,6 +41,7 @@ func (l *L1Recipe) Flags() *flag.FlagSet {
3941
flags.BoolVar(&l.useRethForValidation, "use-reth-for-validation", false, "use reth for validation")
4042
flags.Uint64Var(&l.secondaryELPort, "secondary-el", 0, "port to use for the secondary builder")
4143
flags.BoolVar(&l.useNativeReth, "use-native-reth", false, "use the native reth binary")
44+
flags.BoolVar(&l.useSeparateMevBoost, "use-separate-mev-boost", false, "use separate mev-boost and mev-boost-relay services")
4245
return flags
4346
}
4447

@@ -78,14 +81,31 @@ func (l *L1Recipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest {
7881
BeaconNode: "beacon",
7982
})
8083

81-
mevBoostValidationServer := ""
82-
if l.useRethForValidation {
83-
mevBoostValidationServer = "el"
84+
if l.useSeparateMevBoost {
85+
mevBoostValidationServer := ""
86+
if l.useRethForValidation {
87+
mevBoostValidationServer = "el"
88+
}
89+
90+
svcManager.AddService("mev-boost-relay", &MevBoostRelay{
91+
BeaconClient: "beacon",
92+
ValidationServer: mevBoostValidationServer,
93+
})
94+
95+
svcManager.AddService("mev-boost", &MevBoost{
96+
RelayEndpoints: []string{"mev-boost-relay"},
97+
})
98+
} else {
99+
// single-service setup
100+
mevBoostValidationServer := ""
101+
if l.useRethForValidation {
102+
mevBoostValidationServer = "el"
103+
}
104+
svcManager.AddService("mev-boost", &MevBoostRelay{
105+
BeaconClient: "beacon",
106+
ValidationServer: mevBoostValidationServer,
107+
})
84108
}
85-
svcManager.AddService("mev-boost", &MevBoostRelay{
86-
BeaconClient: "beacon",
87-
ValidationServer: mevBoostValidationServer,
88-
})
89109
return svcManager
90110
}
91111

0 commit comments

Comments
 (0)