From dbfbe5c1efd013cda21b29291f401cb23285b8cf Mon Sep 17 00:00:00 2001 From: Marcos Antonio Maceo Reyes Date: Tue, 17 Oct 2023 00:25:08 +0400 Subject: [PATCH 1/2] fix: mev container display on holesky, even if not supported --- internal/pkg/generate/generate_scripts.go | 12 ++++++------ templates/envs/holesky/env_base.tmpl | 1 - templates/envs/holesky/validator/lighthouse.tmpl | 1 - templates/envs/holesky/validator/lodestar.tmpl | 1 - templates/envs/holesky/validator/teku.tmpl | 1 - 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/internal/pkg/generate/generate_scripts.go b/internal/pkg/generate/generate_scripts.go index 7cc39bc03..424bd4bc9 100644 --- a/internal/pkg/generate/generate_scripts.go +++ b/internal/pkg/generate/generate_scripts.go @@ -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 { @@ -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", }, "/")) @@ -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, @@ -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", }, "/")) @@ -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), diff --git a/templates/envs/holesky/env_base.tmpl b/templates/envs/holesky/env_base.tmpl index 1e3ab6d3d..95c0b8c70 100644 --- a/templates/envs/holesky/env_base.tmpl +++ b/templates/envs/holesky/env_base.tmpl @@ -2,7 +2,6 @@ {{ define "env" }} # --- Global configuration --- NETWORK=holesky -# --- {{if .WithMevBoostClient}}RELAY_URLS={{.RelayURLs}}{{end}} --- {{if .FeeRecipient}} FEE_RECIPIENT={{.FeeRecipient}}{{end}} {{template "execution" .}} diff --git a/templates/envs/holesky/validator/lighthouse.tmpl b/templates/envs/holesky/validator/lighthouse.tmpl index b9c3ab327..49b040fdd 100644 --- a/templates/envs/holesky/validator/lighthouse.tmpl +++ b/templates/envs/holesky/validator/lighthouse.tmpl @@ -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 }} \ No newline at end of file diff --git a/templates/envs/holesky/validator/lodestar.tmpl b/templates/envs/holesky/validator/lodestar.tmpl index 38d1420b4..3b1ab5cba 100644 --- a/templates/envs/holesky/validator/lodestar.tmpl +++ b/templates/envs/holesky/validator/lodestar.tmpl @@ -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 }} diff --git a/templates/envs/holesky/validator/teku.tmpl b/templates/envs/holesky/validator/teku.tmpl index 03020a171..7ca5f6461 100644 --- a/templates/envs/holesky/validator/teku.tmpl +++ b/templates/envs/holesky/validator/teku.tmpl @@ -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 }} \ No newline at end of file From 68a93fe42d3cf3558d0bf037dde5413d79bf07ab Mon Sep 17 00:00:00 2001 From: Marcos Antonio Maceo Reyes Date: Tue, 17 Oct 2023 20:07:34 +0400 Subject: [PATCH 2/2] chore: add tests for SupportMevBoost --- internal/pkg/generate/generate_scripts_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/pkg/generate/generate_scripts_test.go b/internal/pkg/generate/generate_scripts_test.go index fd67799c8..38ad4355b 100644 --- a/internal/pkg/generate/generate_scripts_test.go +++ b/internal/pkg/generate/generate_scripts_test.go @@ -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" {