From 0cd790f1f0dd3ff60a35dbd3063837cc8fcd840b Mon Sep 17 00:00:00 2001 From: Nipun Jindal Date: Wed, 16 Oct 2024 12:54:19 +0530 Subject: [PATCH] validator docker file is not generated from templates --- shared/services/config/stader-config.go | 1 + shared/services/stader/client.go | 52 +++++++++++++------------ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/shared/services/config/stader-config.go b/shared/services/config/stader-config.go index 88338892..86166b22 100644 --- a/shared/services/config/stader-config.go +++ b/shared/services/config/stader-config.go @@ -850,6 +850,7 @@ func (cfg *StaderConfig) GenerateEnvironmentVariables() map[string]string { envVars["TX_FEE_CAP_IN_WEI"] = txFeeCapInWei.String() envVars["TX_FEE_CAP"] = fmt.Sprintf("%d", int64(txFeeCap)) envVars["TX_FEE_CAP_IN_GWEI"] = fmt.Sprintf("%d", int64(txFeeCapInGwei)) + envVars["SSV_MODE"] = fmt.Sprintf("%v", cfg.IsSSVMode) config.AddParametersToEnvVars(cfg.StaderNode.GetParameters(), envVars) config.AddParametersToEnvVars(cfg.GetParameters(), envVars) diff --git a/shared/services/stader/client.go b/shared/services/stader/client.go index 9861f291..43e2f171 100644 --- a/shared/services/stader/client.go +++ b/shared/services/stader/client.go @@ -1455,19 +1455,20 @@ func (c *Client) deployTemplates(cfg *config.StaderConfig, staderDir string, set deployedContainers = append(deployedContainers, guardianComposePath) deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.GuardianContainerName+composeFileSuffix)) - // Validator - contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.ValidatorContainerName+templateSuffix)) - if err != nil { - return []string{}, fmt.Errorf("error reading and substituting validator container template: %w", err) - } - validatorComposePath := filepath.Join(runtimeFolder, config.ValidatorContainerName+composeFileSuffix) - err = ioutil.WriteFile(validatorComposePath, contents, 0664) - if err != nil { - return []string{}, fmt.Errorf("could not write validator container file to %s: %w", validatorComposePath, err) + if !cfg.IsSSVMode { + // Validator + contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.ValidatorContainerName+templateSuffix)) + if err != nil { + return []string{}, fmt.Errorf("error reading and substituting validator container template: %w", err) + } + validatorComposePath := filepath.Join(runtimeFolder, config.ValidatorContainerName+composeFileSuffix) + err = ioutil.WriteFile(validatorComposePath, contents, 0664) + if err != nil { + return []string{}, fmt.Errorf("could not write validator container file to %s: %w", validatorComposePath, err) + } + deployedContainers = append(deployedContainers, validatorComposePath) + deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.ValidatorContainerName+composeFileSuffix)) } - deployedContainers = append(deployedContainers, validatorComposePath) - deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.ValidatorContainerName+composeFileSuffix)) - // Check the EC mode to see if it needs to be deployed if cfg.ExecutionClientMode.Value.(cfgtypes.Mode) == cfgtypes.Mode_Local { contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.Eth1ContainerName+templateSuffix)) @@ -1482,20 +1483,21 @@ func (c *Client) deployTemplates(cfg *config.StaderConfig, staderDir string, set deployedContainers = append(deployedContainers, eth1ComposePath) deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.Eth1ContainerName+composeFileSuffix)) } - - // Check the Consensus mode - if cfg.ConsensusClientMode.Value.(cfgtypes.Mode) == cfgtypes.Mode_Local { - contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.Eth2ContainerName+templateSuffix)) - if err != nil { - return []string{}, fmt.Errorf("error reading and substituting consensus client container template: %w", err) - } - eth2ComposePath := filepath.Join(runtimeFolder, config.Eth2ContainerName+composeFileSuffix) - err = ioutil.WriteFile(eth2ComposePath, contents, 0664) - if err != nil { - return []string{}, fmt.Errorf("could not write consensus client container file to %s: %w", eth2ComposePath, err) + if !cfg.IsSSVMode { + // Check the Consensus mode + if cfg.ConsensusClientMode.Value.(cfgtypes.Mode) == cfgtypes.Mode_Local { + contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.Eth2ContainerName+templateSuffix)) + if err != nil { + return []string{}, fmt.Errorf("error reading and substituting consensus client container template: %w", err) + } + eth2ComposePath := filepath.Join(runtimeFolder, config.Eth2ContainerName+composeFileSuffix) + err = ioutil.WriteFile(eth2ComposePath, contents, 0664) + if err != nil { + return []string{}, fmt.Errorf("could not write consensus client container file to %s: %w", eth2ComposePath, err) + } + deployedContainers = append(deployedContainers, eth2ComposePath) + deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.Eth2ContainerName+composeFileSuffix)) } - deployedContainers = append(deployedContainers, eth2ComposePath) - deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.Eth2ContainerName+composeFileSuffix)) } // Check the metrics containers