Skip to content

Commit

Permalink
fix(cli): Mev-boost not being generated for holesky (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiD2ta authored Jul 9, 2024
1 parent bdf9cfb commit 5231116
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
79 changes: 79 additions & 0 deletions cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestCli(t *testing.T) {
log.SetOutput(io.Discard)

mevboostRelayListUris, _ := mevboostrelaylist.RelaysURI("mainnet")
holeskyMevboostRelayListUris, _ := mevboostrelaylist.RelaysURI("holesky")

ETHClients := map[string][]string{
"execution": clients.AllClients["execution"],
Expand Down Expand Up @@ -594,6 +595,84 @@ func TestCli(t *testing.T) {
)
},
},
{
name: "full node with Lido, holesky",
setup: func(t *testing.T, sedgeActions *sedge_mocks.MockSedgeActions, prompter *sedge_mocks.MockPrompter, depsMgr *sedge_mocks.MockDependenciesManager) {
generationPath := t.TempDir()
genData := generate.GenData{
Services: []string{"execution", "consensus", "validator", "mev-boost"},
ExecutionClient: &clients.Client{
Name: "nethermind",
Type: "execution",
Image: configs.ClientImages.Execution.Nethermind.String(),
},
ConsensusClient: &clients.Client{
Name: "prysm",
Type: "consensus",
Image: configs.ClientImages.Consensus.Prysm.String(),
},
ValidatorClient: &clients.Client{
Name: "prysm",
Type: "validator",
Image: configs.ClientImages.Validator.Prysm.String(),
},
Network: "holesky",
CheckpointSyncUrl: "http://checkpoint.sync",
FeeRecipient: "0xE73a3602b99f1f913e72F8bdcBC235e206794Ac8",
MapAllPorts: true,
Graffiti: "test graffiti",
VLStartGracePeriod: 840,
Mev: true,
MevImage: "flashbots/mev-boost:latest",
RelayURLs: holeskyMevboostRelayListUris,
ContainerTag: "tag",
JWTSecretPath: filepath.Join(generationPath, "jwtsecret"),
}
sedgeActions.EXPECT().GetCommandRunner().Return(&test.SimpleCMDRunner{})
gomock.InOrder(
prompter.EXPECT().Select("Select node setup", "", []string{sedgeOpts.EthereumNode, sedgeOpts.LidoNode}).Return(1, nil),
prompter.EXPECT().Select("Select network", "", []string{NetworkMainnet, NetworkHolesky, NetworkSepolia}).Return(1, nil),
prompter.EXPECT().Select("Select node type", "", []string{NodeTypeFullNode, NodeTypeExecution, NodeTypeConsensus, NodeTypeValidator}).Return(0, nil),
prompter.EXPECT().Input("Generation path", configs.DefaultAbsSedgeDataPath, false, nil).Return(generationPath, nil),
prompter.EXPECT().Input("Container tag, sedge will add to each container and the network, a suffix with the tag", "", false, nil).Return("tag", nil),
prompter.EXPECT().Confirm("Do you want to set up a validator?", true).Return(true, nil),
prompter.EXPECT().Input("Mev-Boost image", "flashbots/mev-boost:latest", false, nil).Return("flashbots/mev-boost:latest", nil),
prompter.EXPECT().Select("Select execution client", "", ETHClients["execution"]).Return(0, nil),
prompter.EXPECT().Select("Select consensus client", "", ETHClients["consensus"]).Return(1, nil),
prompter.EXPECT().Select("Select validator client", "", ETHClients["validator"]).Return(1, nil),
prompter.EXPECT().InputInt64("Validator grace period. This is the number of epochs the validator will wait for security reasons before starting", int64(1)).Return(int64(2), nil),
prompter.EXPECT().Input("Graffiti to be used by the validator (press enter to skip it)", "", false, gomock.AssignableToTypeOf(ui.GraffitiValidator)).Return("test graffiti", nil),
prompter.EXPECT().InputURL("Checkpoint sync URL", configs.NetworksConfigs()[genData.Network].CheckpointSyncURL, false).Return("http://checkpoint.sync", nil),
prompter.EXPECT().Confirm("Do you want to expose all ports?", false).Return(true, nil),
prompter.EXPECT().Select("Select JWT source", "", []string{SourceTypeCreate, SourceTypeExisting}).Return(0, nil),
sedgeActions.EXPECT().Generate(gomock.Eq(actions.GenerateOptions{
GenerationPath: generationPath,
GenerationData: genData,
})).Return(genData, nil),
prompter.EXPECT().Select("Select keystore source", "", []string{SourceTypeCreate, SourceTypeExisting, SourceTypeSkip}).Return(0, nil),
prompter.EXPECT().Select("Select mnemonic source", "", []string{SourceTypeCreate, SourceTypeExisting}).Return(0, nil),
prompter.EXPECT().Select("Select passphrase source", "", []string{SourceTypeRandom, SourceTypeExisting, SourceTypeCreate}).Return(0, nil),
prompter.EXPECT().InputInt64("Number of validators", int64(1)).Return(int64(1), nil),
prompter.EXPECT().InputInt64("Existing validators. This number will be used as the initial index for the generated keystores.", int64(0)).Return(int64(0), nil),
depsMgr.EXPECT().Check([]string{dependencies.Docker}).Return([]string{dependencies.Docker}, nil),
depsMgr.EXPECT().DockerEngineIsOn().Return(nil),
depsMgr.EXPECT().DockerComposeIsInstalled().Return(nil),
sedgeActions.EXPECT().SetupContainers(actions.SetupContainersOptions{
GenerationPath: generationPath,
Services: []string{"validator"},
}),
sedgeActions.EXPECT().ImportValidatorKeys(actions.ImportValidatorKeysOptions{
ValidatorClient: "prysm",
Network: NetworkHolesky,
GenerationPath: generationPath,
From: filepath.Join(generationPath, "keystore"),
ContainerTag: "tag",
}).Return(nil),
prompter.EXPECT().Confirm("Do you want to import slashing protection data?", false).Return(false, nil),
prompter.EXPECT().Confirm("Run services now?", false).Return(false, nil),
)
},
},
}

for _, tt := range tests {
Expand Down
2 changes: 2 additions & 0 deletions internal/pkg/generate/generate_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"io"
"os"
"path/filepath"
"slices"
"strings"
"text/template"

Expand Down Expand Up @@ -242,6 +243,7 @@ func ComposeFile(gd *GenData, at io.Writer) error {
gd.MevBoostEndpoint = fmt.Sprintf("%s:%v", configs.DefaultMevBoostEndpoint, gd.Ports["MevPort"])
}
}
gd.MevBoostService = slices.Contains(gd.Services, "mev-boost")

data := DockerComposeData{
Services: gd.Services,
Expand Down
1 change: 1 addition & 0 deletions templates/envs/holesky/validator/lighthouse.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ VL_INSTANCE_NAME=LighthouseValidator
VL_IMAGE_VERSION={{.VlImage}}
KEYSTORE_DIR={{.KeystoreDir}}
VL_DATA_DIR={{.VlDataDir}}
MEV=true
{{ end }}
1 change: 1 addition & 0 deletions templates/envs/holesky/validator/lodestar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ VL_IMAGE_VERSION={{.VlImage}}
KEYSTORE_DIR={{.KeystoreDir}}
VL_DATA_DIR={{.VlDataDir}}
VL_LODESTAR_PRESET=mainnet
MEV=true
{{ end }}
1 change: 1 addition & 0 deletions templates/envs/holesky/validator/prysm.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ VL_IMAGE_VERSION={{.VlImage}}
KEYSTORE_DIR={{.KeystoreDir}}
WALLET_DIR=./wallet
VL_DATA_DIR={{.VlDataDir}}
MEV=true
{{ end }}
1 change: 1 addition & 0 deletions templates/envs/holesky/validator/teku.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ VL_INSTANCE_NAME=TekuValidator
VL_IMAGE_VERSION={{.VlImage}}
KEYSTORE_DIR={{.KeystoreDir}}
VL_DATA_DIR={{.VlDataDir}}
MEV=true
{{ end }}

0 comments on commit 5231116

Please sign in to comment.