From 858ae915164ce6a9137cd7dedfa840e013bd33f0 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 8 Jul 2024 21:21:34 +0200 Subject: [PATCH] [TT-1387] log warning if any custom network config for CL node is present (#13775) * log warning if any custom network config for CL node is present * Update integration-tests/testconfig/testconfig.go Co-authored-by: Adam Hamrick --------- Co-authored-by: Adam Hamrick --- integration-tests/smoke/ocr_test.go | 4 +-- integration-tests/testconfig/testconfig.go | 38 +++++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index 67f8c44f8a1..0b4ac3de30b 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -81,9 +81,7 @@ func TestOCRJobReplacement(t *testing.T) { func prepareORCv1SmokeTestEnv(t *testing.T, l zerolog.Logger, firstRoundResult int64) (*test_env.CLClusterTestEnv, []contracts.OffchainAggregator, *seth.Client) { config, err := tc.GetConfig([]string{"Smoke"}, tc.OCR) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err, "Error getting config") network, err := actions.EthereumNetworkConfigFromConfig(l, &config) require.NoError(t, err, "Error building ethereum network config") diff --git a/integration-tests/testconfig/testconfig.go b/integration-tests/testconfig/testconfig.go index 3a73d39dfe9..34832625154 100644 --- a/integration-tests/testconfig/testconfig.go +++ b/integration-tests/testconfig/testconfig.go @@ -13,6 +13,7 @@ import ( "github.com/google/uuid" "github.com/pelletier/go-toml/v2" "github.com/pkg/errors" + "github.com/rs/zerolog" "golang.org/x/text/cases" "golang.org/x/text/language" @@ -21,8 +22,10 @@ import ( ctf_config "github.com/smartcontractkit/chainlink-testing-framework/config" k8s_config "github.com/smartcontractkit/chainlink-testing-framework/k8s/config" "github.com/smartcontractkit/chainlink-testing-framework/logging" + "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink-testing-framework/utils/conversions" "github.com/smartcontractkit/chainlink-testing-framework/utils/osutil" + a_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/automation" f_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/functions" keeper_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/keeper" @@ -386,27 +389,34 @@ func GetConfig(configurationNames []string, product Product) (TestConfig, error) testConfig.Common = &Common{} } + testConfig.logRiskySettings(logger) + + logger.Debug().Msg("Correct test config constructed successfully") + return testConfig, nil +} + +func (c *TestConfig) logRiskySettings(logger zerolog.Logger) { isAnySimulated := false - for _, network := range testConfig.Network.SelectedNetworks { + for _, network := range c.Network.SelectedNetworks { if strings.Contains(strings.ToUpper(network), "SIMULATED") { isAnySimulated = true break } } - if testConfig.Seth != nil && !isAnySimulated && (testConfig.Seth.EphemeralAddrs != nil && *testConfig.Seth.EphemeralAddrs != 0) { - testConfig.Seth.EphemeralAddrs = new(int64) + if c.Seth != nil && !isAnySimulated && (c.Seth.EphemeralAddrs != nil && *c.Seth.EphemeralAddrs != 0) { + c.Seth.EphemeralAddrs = new(int64) logger.Warn(). Msg("Ephemeral addresses were enabled, but test was setup to run on a live network. Ephemeral addresses will be disabled.") } - if testConfig.Seth != nil && (testConfig.Seth.EphemeralAddrs != nil && *testConfig.Seth.EphemeralAddrs != 0) { - rootBuffer := testConfig.Seth.RootKeyFundsBuffer + if c.Seth != nil && (c.Seth.EphemeralAddrs != nil && *c.Seth.EphemeralAddrs != 0) { + rootBuffer := c.Seth.RootKeyFundsBuffer zero := int64(0) if rootBuffer == nil { rootBuffer = &zero } - clNodeFunding := testConfig.Common.ChainlinkNodeFunding + clNodeFunding := c.Common.ChainlinkNodeFunding if clNodeFunding == nil { zero := 0.0 clNodeFunding = &zero @@ -433,8 +443,20 @@ root_key_funds_buffer = 1_000 } } - logger.Debug().Msg("Correct test config constructed successfully") - return testConfig, nil + var customChainSettings []string + for _, network := range networks.MustGetSelectedNetworkConfig(c.Network) { + if c.NodeConfig != nil && len(c.NodeConfig.ChainConfigTOMLByChainID) > 0 { + if _, ok := c.NodeConfig.ChainConfigTOMLByChainID[fmt.Sprint(network.ChainID)]; ok { + logger.Warn().Msgf("You have provided custom Chainlink Node configuration for network '%s' (chain id: %d). Chainlink Node's default settings won't be used", network.Name, network.ChainID) + customChainSettings = append(customChainSettings, fmt.Sprint(network.ChainID)) + } + } + } + + if len(customChainSettings) == 0 && c.NodeConfig != nil && c.NodeConfig.CommonChainConfigTOML != "" { + logger.Warn().Msg("***** You have provided your own default Chainlink Node configuration for all networks. Chainlink Node's default settings for selected networks won't be used *****") + } + } func (c *TestConfig) readNetworkConfiguration() error {