Skip to content

Commit

Permalink
feat: Mev container display on holesky, even if not supported (#322)
Browse files Browse the repository at this point in the history
* fix: mev container display on holesky, even if not supported

* chore: add tests for SupportMevBoost
  • Loading branch information
stdevMac authored Oct 18, 2023
1 parent 07606de commit b684e94
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions internal/pkg/generate/generate_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func ComposeFile(gd *GenData, at io.Writer) error {
}

cls := mapClients(gd)

networkConfig := configs.NetworksConfigs()[gd.Network]
for tmpKind, client := range cls {
var name string
if client == nil {
Expand All @@ -166,7 +166,7 @@ func ComposeFile(gd *GenData, at io.Writer) error {
}
tmp, err := templates.Services.ReadFile(strings.Join([]string{
"services",
configs.NetworksConfigs()[gd.Network].NetworkService,
networkConfig.NetworkService,
tmpKind,
name + ".tmpl",
}, "/"))
Expand Down Expand Up @@ -247,7 +247,7 @@ func ComposeFile(gd *GenData, at io.Writer) error {
Services: gd.Services,
Network: gd.Network,
XeeVersion: xeeVersion,
Mev: gd.MevBoostService || (mevSupported && gd.Mev),
Mev: networkConfig.SupportsMEVBoost && (gd.MevBoostService || (mevSupported && gd.Mev)),
MevBoostOnValidator: gd.MevBoostService || (mevSupported && gd.Mev) || gd.MevBoostOnValidator,
MevPort: gd.Ports["MevPort"],
MevBoostEndpoint: gd.MevBoostEndpoint,
Expand Down Expand Up @@ -311,13 +311,13 @@ func EnvFile(gd *GenData, at io.Writer) error {
}

cls := mapClients(gd)

networkConfig := configs.NetworksConfigs()[gd.Network]
for tmpKind, client := range cls {
var tmp []byte
if client == nil {
tmp, err = templates.Services.ReadFile(strings.Join([]string{
"services",
configs.NetworksConfigs()[gd.Network].NetworkService,
networkConfig.NetworkService,
tmpKind,
"empty.tmpl",
}, "/"))
Expand Down Expand Up @@ -400,7 +400,7 @@ func EnvFile(gd *GenData, at io.Writer) error {

data := EnvData{
Services: gd.Services,
Mev: gd.MevBoostService || (mevSupported && gd.Mev) || gd.MevBoostOnValidator,
Mev: networkConfig.SupportsMEVBoost && (gd.MevBoostService || (mevSupported && gd.Mev) || gd.MevBoostOnValidator),
ElImage: imageOrEmpty(cls[execution], gd.LatestVersion),
ElDataDir: "./" + configs.ExecutionDir,
CcImage: imageOrEmpty(cls[consensus], gd.LatestVersion),
Expand Down
5 changes: 4 additions & 1 deletion internal/pkg/generate/generate_scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ func defaultFunc(t *testing.T, data *GenData, compose, env io.Reader) error {
if utils.Contains(data.Services, configConsensus) {
assert.NotNil(t, composeData.Services.ConfigConsensus)
}

networkConfig := configs.NetworksConfigs()[data.Network]
if !networkConfig.SupportsMEVBoost {
assert.Nil(t, composeData.Services.Mevboost)
}
// load .env file
envData := retrieveEnvData(t, env)
if data.Network == "gnosis" {
Expand Down
1 change: 0 additions & 1 deletion templates/envs/holesky/env_base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{{ define "env" }}
# --- Global configuration ---
NETWORK=holesky
# --- {{if .WithMevBoostClient}}RELAY_URLS={{.RelayURLs}}{{end}} ---
{{if .FeeRecipient}}
FEE_RECIPIENT={{.FeeRecipient}}{{end}}
{{template "execution" .}}
Expand Down
1 change: 0 additions & 1 deletion templates/envs/holesky/validator/lighthouse.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ VL_INSTANCE_NAME=LighthouseValidator
VL_IMAGE_VERSION={{.VlImage}}
KEYSTORE_DIR={{.KeystoreDir}}
VL_DATA_DIR={{.VlDataDir}}
# --- MEV=true, not sure if MEV is enabled on holesky ---
{{ end }}
1 change: 0 additions & 1 deletion templates/envs/holesky/validator/lodestar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ VL_INSTANCE_NAME=LodestarValidator
VL_IMAGE_VERSION={{.VlImage}}
KEYSTORE_DIR={{.KeystoreDir}}
VL_DATA_DIR={{.VlDataDir}}
# --- MEV=true, not sure if MEV is enabled on holesky ---
VL_LODESTAR_PRESET=mainnet
{{ end }}
1 change: 0 additions & 1 deletion templates/envs/holesky/validator/teku.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ VL_INSTANCE_NAME=TekuValidator
VL_IMAGE_VERSION={{.VlImage}}
KEYSTORE_DIR={{.KeystoreDir}}
VL_DATA_DIR={{.VlDataDir}}
# --- MEV=true, not sure if MEV is enabled on holesky ---
{{ end }}

0 comments on commit b684e94

Please sign in to comment.