Skip to content
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

chore(binaries): Small tweaks for latest reth and lighthouse. #20

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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 artifacts/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func DownloadArtifacts() (map[string]string, error) {
{
Name: "reth",
Org: "paradigmxyz",
Version: "v1.0.2",
Version: "v1.1.0",
Arch: func(goos, goarch string) string {
if goos == "linux" {
return "x86_64-unknown-linux-gnu"
Expand All @@ -39,12 +39,12 @@ func DownloadArtifacts() (map[string]string, error) {
{
Name: "lighthouse",
Org: "sigp",
Version: "v5.2.1",
Version: "v5.3.0",
Arch: func(goos, goarch string) string {
if goos == "linux" {
return "x86_64-unknown-linux-gnu"
} else if goos == "darwin" && goarch == "arm64" { // Apple M1
return "x86_64-apple-darwin-portable"
return "x86_64-apple-darwin"
} else if goos == "darwin" && goarch == "amd64" {
return "x86_64-apple-darwin"
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/flashbots/go-boost-utils v1.8.0
github.com/flashbots/mev-boost-relay v0.29.2-0.20240705093628-4d4478a9c9dc
github.com/hashicorp/go-uuid v1.0.3
github.com/prysmaticlabs/prysm/v5 v5.1.1-0.20241001143536-6d499bc9fc99
github.com/prysmaticlabs/prysm/v5 v5.1.2
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.1.3
Expand Down Expand Up @@ -99,7 +99,7 @@ require (
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3 // indirect
github.com/prysmaticlabs/fastssz v0.0.0-20241008181541-518c4ce73516 // indirect
github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e // indirect
github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b // indirect
github.com/r3labs/sse/v2 v2.10.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,16 @@ github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3 h1:0LZAwwHnsZFfXm4IK4rzFV4N5IVSKZKLmuBMA4kAlFk=
github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3/go.mod h1:h2OlIZD/M6wFvV3YMZbW16lFgh3Rsye00G44J2cwLyU=
github.com/prysmaticlabs/fastssz v0.0.0-20241008181541-518c4ce73516 h1:xuVAdtz5ShYblG2sPyb4gw01DF8InbOI/kBCQjk7NiM=
github.com/prysmaticlabs/fastssz v0.0.0-20241008181541-518c4ce73516/go.mod h1:h2OlIZD/M6wFvV3YMZbW16lFgh3Rsye00G44J2cwLyU=
github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e h1:ATgOe+abbzfx9kCPeXIW4fiWyDdxlwHw07j8UGhdTd4=
github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4=
github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b h1:VK7thFOnhxAZ/5aolr5Os4beiubuD08WiuiHyRqgwks=
github.com/prysmaticlabs/gohashtree v0.0.4-beta.0.20240624100937-73632381301b/go.mod h1:HRuvtXLZ4WkaB1MItToVH2e8ZwKwZPY5/Rcby+CvvLY=
github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20230228205207-28762a7b9294 h1:q9wE0ZZRdTUAAeyFP/w0SwBEnCqlVy2+on6X2/e+eAU=
github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20230228205207-28762a7b9294/go.mod h1:ZVEbRdnMkGhp/pu35zq4SXxtvUwWK0J1MATtekZpH2Y=
github.com/prysmaticlabs/prysm/v5 v5.1.1-0.20241001143536-6d499bc9fc99 h1:rE0dxF3PjNikB1KZMtpw9WM/gJ7h/OTJYnkfwX1ojV0=
github.com/prysmaticlabs/prysm/v5 v5.1.1-0.20241001143536-6d499bc9fc99/go.mod h1:x6JZSankdPmZvNCNya5ipc7bOQeRhnce61LFPzEKxcA=
github.com/prysmaticlabs/prysm/v5 v5.1.2 h1:ib9D7Drh7QPoetJPnYXAHaArmjIreXPZ0FboW9EMzT8=
github.com/prysmaticlabs/prysm/v5 v5.1.2/go.mod h1:ykj3Bl9dHv35cC7fRw6Cd1aCd9l+eNvInHY6gsPbEig=
github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0=
github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktEmkNJ7I=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down
16 changes: 15 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var validateFlag bool
var genesisDelayFlag uint64
var watchPayloadsFlag bool
var latestForkFlag bool
var useRethForValidation bool

var rootCmd = &cobra.Command{
Use: "playground",
Expand Down Expand Up @@ -159,6 +160,7 @@ func main() {
rootCmd.Flags().Uint64Var(&genesisDelayFlag, "genesis-delay", 5, "")
rootCmd.Flags().BoolVar(&watchPayloadsFlag, "watch-payloads", false, "")
rootCmd.Flags().BoolVar(&latestForkFlag, "electra", false, "")
rootCmd.Flags().BoolVar(&useRethForValidation, "use-reth-for-validation", false, "enable flashbots_validateBuilderSubmissionV* on reth and use them for validation")

downloadArtifactsCmd.Flags().BoolVar(&validateFlag, "validate", false, "")
validateCmd.Flags().Uint64Var(&numBlocksValidate, "num-blocks", 5, "")
Expand Down Expand Up @@ -370,7 +372,11 @@ func setupServices(svcManager *serviceManager, out *output) error {
"--http.port", "8545",
"--authrpc.port", "8551",
"--authrpc.jwtsecret", "{{.Dir}}/jwtsecret",
"--engine.legacy",
).
If(useRethForValidation, func(s *service) *service {
return s.WithArgs("--http.api", "eth,web3,net,rpc,flashbots")
}).
WithPort("http", 8545).
WithPort("authrpc", 8551).
Run()
Expand All @@ -386,7 +392,6 @@ func setupServices(svcManager *serviceManager, out *output) error {
"--enable-private-discovery",
"--disable-peer-scoring",
"--staking",
"--http-allow-sync-stalled",
"--enr-address", "127.0.0.1",
"--enr-udp-port", "9000",
"--enr-tcp-port", "9000",
Expand All @@ -403,6 +408,7 @@ func setupServices(svcManager *serviceManager, out *output) error {
"--builder-fallback-disable-checks",
"--always-prepare-payload",
"--prepare-payload-lookahead", "8000",
"--suggested-fee-recipient", "0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990",
).
WithPort("http", 3500).
Run()
Expand All @@ -427,6 +433,7 @@ func setupServices(svcManager *serviceManager, out *output) error {
if cfg.LogOutput, err = out.LogOutput("mev-boost-relay"); err != nil {
return err
}
cfg.UseRethForValidation = useRethForValidation
relay, err := mevboostrelay.New(cfg)
if err != nil {
return fmt.Errorf("failed to create relay: %w", err)
Expand Down Expand Up @@ -714,6 +721,13 @@ func (s *service) WithArgs(args ...string) *service {
return s
}

func (s *service) If(cond bool, fn func(*service) *service) *service {
if cond {
return fn(s)
}
return s
}

func (s *service) Run() {
s.srvMng.Run(s)
}
Expand Down
34 changes: 22 additions & 12 deletions mev-boost-relay/mev-boost-relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ type Config struct {
ApiSecretKey string
BeaconClientAddr string
LogOutput io.Writer

UseRethForValidation bool
}

func DefaultConfig() *Config {
return &Config{
ApiListenAddr: "127.0.0.1",
ApiListenPort: 5555,
ApiSecretKey: defaultSecretKey,
BeaconClientAddr: "http://localhost:3500",
LogOutput: os.Stdout,
ApiListenAddr: "127.0.0.1",
ApiListenPort: 5555,
ApiSecretKey: defaultSecretKey,
BeaconClientAddr: "http://localhost:3500",
LogOutput: os.Stdout,
UseRethForValidation: false,
}
}

Expand Down Expand Up @@ -119,13 +122,20 @@ func New(config *Config) (*MevBoostRelay, error) {

housekeeperSrv := housekeeper.NewHousekeeper(housekeeperOpts)

// start a mock block validation service that always
// returns the blocks as valids.
apiBlockSimURL, err := startMockBlockValidationServiceServer()
if err != nil {
return nil, fmt.Errorf("failed to start mock block validation service: %w", err)
var blockSimURL string
if config.UseRethForValidation {
log.Info("Using reth for block validation")
blockSimURL = "http://localhost:8545"
} else {
// start a mock block validation service that always
// returns the blocks as valids.
apiBlockSimURL, err := startMockBlockValidationServiceServer()
if err != nil {
return nil, fmt.Errorf("failed to start mock block validation service: %w", err)
}
log.Info("Started mock block validation service, addr: ", apiBlockSimURL)
blockSimURL = apiBlockSimURL
}
log.Info("Started mock block validation service, addr: ", apiBlockSimURL)

// decode the secret key
envSkBytes, err := hex.DecodeString(strings.TrimPrefix(config.ApiSecretKey, "0x"))
Expand All @@ -146,7 +156,7 @@ func New(config *Config) (*MevBoostRelay, error) {
DB: pqDB,
SecretKey: secretKey,
EthNetDetails: *ethNetworkDetails,
BlockSimURL: apiBlockSimURL,
BlockSimURL: blockSimURL,
ProposerAPI: true,
BlockBuilderAPI: true,
DataAPI: true,
Expand Down
Loading