Skip to content

add mev-boost support #184

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion mev-boost-relay/mev-boost-relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/sirupsen/logrus"
)

var DefaultSecretKey = "5eae315483f028b5cdd5d1090ff0c7618b18737ea9bf3c35047189db22835c48"
var DefaultSecretKey = "0x5eae315483f028b5cdd5d1090ff0c7618b18737ea9bf3c35047189db22835c48"

type Config struct {
ApiListenAddr string
Expand Down
1 change: 1 addition & 0 deletions playground/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func init() {
register(&LighthouseValidator{})
register(&ClProxy{})
register(&MevBoostRelay{})
register(&MevBoost{})
register(&RollupBoost{})
register(&OpReth{})
register(&BuilderHub{})
Expand Down
56 changes: 54 additions & 2 deletions playground/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -305,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"
Expand Down Expand Up @@ -340,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",
Expand Down Expand Up @@ -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" {
// creating relay url with public key since mev-boost requires it
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 := 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").
WithTag("latest").
WithArgs(args...).
WithEnv("GENESIS_FORK_VERSION", "0x20000089")
}

func (m *MevBoost) Name() string {
return "mev-boost"
}

type nullService struct {
}

Expand Down
34 changes: 27 additions & 7 deletions playground/recipe_l1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down