From a2441ba8cc44b6455338410b739d394a3bf3557e Mon Sep 17 00:00:00 2001 From: Dimitris Grigoriou Date: Tue, 4 Jun 2024 14:59:31 +0300 Subject: [PATCH] Decouple config tests (#12971) * Add first version of evm utils * Remove unused context util * Add WSServer tests * Add NewLegacyTransaction test * Update NewTestChainScopedConfig to apply correct defaults * Decouple config tests * Move testutils * Update paths * Add default config validation * Fix assert import * Rename test method * Use common multierror * Fixes * Add changeset * Update dependencies --- .changeset/dry-doors-do.md | 5 + .../evm/config/chain_scoped_ocr2_test.go | 6 +- .../evm/config/chain_scoped_ocr_test.go | 22 +- core/chains/evm/config/config_test.go | 311 +++++------------- core/chains/evm/config/toml/config_test.go | 31 ++ core/config/docs/docs.go | 4 +- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/chainlink/cfgtest/cfgtest.go | 4 +- core/services/chainlink/config.go | 37 ++- core/services/chainlink/config_general.go | 6 +- core/utils/config/validate.go | 118 ------- core/utils/errors.go | 48 --- core/utils/errors_test.go | 52 --- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 +- 20 files changed, 167 insertions(+), 501 deletions(-) create mode 100644 .changeset/dry-doors-do.md create mode 100644 core/chains/evm/config/toml/config_test.go delete mode 100644 core/utils/errors.go delete mode 100644 core/utils/errors_test.go diff --git a/.changeset/dry-doors-do.md b/.changeset/dry-doors-do.md new file mode 100644 index 00000000000..abc03c9489b --- /dev/null +++ b/.changeset/dry-doors-do.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +Decouple evm config tests from core #internal diff --git a/core/chains/evm/config/chain_scoped_ocr2_test.go b/core/chains/evm/config/chain_scoped_ocr2_test.go index 03bf5fd4f14..5a41b4dedac 100644 --- a/core/chains/evm/config/chain_scoped_ocr2_test.go +++ b/core/chains/evm/config/chain_scoped_ocr2_test.go @@ -5,10 +5,10 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/testutils" ) func Test_ocr2Config(t *testing.T) { - evmOcrCfg := cltest.NewTestChainScopedConfig(t) //fallback.toml values - require.Equal(t, uint32(5400000), evmOcrCfg.EVM().OCR2().Automation().GasLimit()) + cfg := testutils.NewTestChainScopedConfig(t, nil) //fallback.toml values + require.Equal(t, uint32(5400000), cfg.EVM().OCR2().Automation().GasLimit()) } diff --git a/core/chains/evm/config/chain_scoped_ocr_test.go b/core/chains/evm/config/chain_scoped_ocr_test.go index e42de465c5c..e027037031c 100644 --- a/core/chains/evm/config/chain_scoped_ocr_test.go +++ b/core/chains/evm/config/chain_scoped_ocr_test.go @@ -2,16 +2,26 @@ package config_test import ( "testing" + "time" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/testutils" ) func Test_ocrConfig(t *testing.T) { - evmOcrCfg := cltest.NewTestChainScopedConfig(t) //fallback.toml values - require.Equal(t, uint16(4), evmOcrCfg.EVM().OCR().ContractConfirmations()) - require.Equal(t, cltest.MustParseDuration(t, "10s"), evmOcrCfg.EVM().OCR().ContractTransmitterTransmitTimeout()) - require.Equal(t, cltest.MustParseDuration(t, "10s"), evmOcrCfg.EVM().OCR().DatabaseTimeout()) - require.Equal(t, cltest.MustParseDuration(t, "1s"), evmOcrCfg.EVM().OCR().ObservationGracePeriod()) + cfg := testutils.NewTestChainScopedConfig(t, nil) //fallback.toml values + + require.Equal(t, uint16(4), cfg.EVM().OCR().ContractConfirmations()) + require.Equal(t, mustParseDuration(t, "10s"), cfg.EVM().OCR().ContractTransmitterTransmitTimeout()) + require.Equal(t, mustParseDuration(t, "10s"), cfg.EVM().OCR().DatabaseTimeout()) + require.Equal(t, mustParseDuration(t, "1s"), cfg.EVM().OCR().ObservationGracePeriod()) +} + +func mustParseDuration(t testing.TB, durationStr string) time.Duration { + t.Helper() + + duration, err := time.ParseDuration(durationStr) + require.NoError(t, err) + return duration } diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index 69f6ea0875f..26ac2db0852 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -1,7 +1,6 @@ package config_test import ( - "fmt" "math/big" "math/rand" "strings" @@ -11,51 +10,27 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - configurl "github.com/smartcontractkit/chainlink-common/pkg/config" - - commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/testutils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" - "github.com/smartcontractkit/chainlink/v2/core/config" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/store/models" ) func TestChainScopedConfig(t *testing.T) { t.Parallel() - gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - id := ubig.New(big.NewInt(rand.Int63())) - c.EVM[0] = &toml.EVMConfig{ - ChainID: id, - Chain: toml.Defaults(id, &toml.Chain{ - GasEstimator: toml.GasEstimator{PriceMax: assets.NewWeiI(100000000000000)}, - }), - } + cfg := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = assets.NewWeiI(100000000000000) }) - cfg := evmtest.NewChainScopedConfig(t, gcfg) - - overrides := func(c *chainlink.Config, s *chainlink.Secrets) { - id := ubig.New(big.NewInt(rand.Int63())) - c.EVM[0] = &toml.EVMConfig{ - ChainID: id, - Chain: toml.Defaults(id, &toml.Chain{ - GasEstimator: toml.GasEstimator{ - PriceMax: assets.NewWeiI(100000000000000), - PriceDefault: assets.NewWeiI(42000000000), - }, - }), - } - } + + cfg2 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = assets.NewWeiI(100000000000000) + c.GasEstimator.PriceDefault = assets.NewWeiI(42000000000) + }) + t.Run("EVM().GasEstimator().PriceDefault()", func(t *testing.T) { assert.Equal(t, assets.NewWeiI(20000000000), cfg.EVM().GasEstimator().PriceDefault()) - gcfg2 := configtest.NewGeneralConfig(t, overrides) - cfg2 := evmtest.NewChainScopedConfig(t, gcfg2) assert.Equal(t, assets.NewWeiI(42000000000), cfg2.EVM().GasEstimator().PriceDefault()) }) @@ -65,53 +40,42 @@ func TestChainScopedConfig(t *testing.T) { }) t.Run("uses customer configured value when set", func(t *testing.T) { - var override uint32 = 10 - gasBumpOverrides := func(c *chainlink.Config, s *chainlink.Secrets) { - id := ubig.New(big.NewInt(rand.Int63())) - c.EVM[0] = &toml.EVMConfig{ - ChainID: id, - Chain: toml.Defaults(id, &toml.Chain{ - GasEstimator: toml.GasEstimator{ - BumpTxDepth: ptr(override), - }, - }), - } - } - gcfg2 := configtest.NewGeneralConfig(t, gasBumpOverrides) - cfg2 := evmtest.NewChainScopedConfig(t, gcfg2) + var bumpTxDepth uint32 = 10 + cfg2 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.BumpTxDepth = &bumpTxDepth + }) assert.NotEqual(t, cfg2.EVM().Transactions().MaxInFlight(), cfg2.EVM().GasEstimator().BumpTxDepth()) - assert.Equal(t, override, cfg2.EVM().GasEstimator().BumpTxDepth()) + assert.Equal(t, bumpTxDepth, cfg2.EVM().GasEstimator().BumpTxDepth()) }) }) t.Run("PriceMaxKey", func(t *testing.T) { addr := testutils.NewAddress() randomOtherAddr := testutils.NewAddress() - gcfg2 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - overrides(c, s) - c.EVM[0].KeySpecific = toml.KeySpecificConfig{ + cfg2 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.KeySpecific = toml.KeySpecificConfig{ {Key: ptr(types.EIP55AddressFromAddress(randomOtherAddr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: assets.GWei(850), }, }, } + c.GasEstimator.PriceMax = assets.NewWeiI(100000000000000) + c.GasEstimator.PriceDefault = assets.NewWeiI(42000000000) }) - cfg2 := evmtest.NewChainScopedConfig(t, gcfg2) t.Run("uses chain-specific default value when nothing is set", func(t *testing.T) { assert.Equal(t, assets.NewWeiI(100000000000000), cfg2.EVM().GasEstimator().PriceMaxKey(addr)) }) t.Run("uses chain-specific override value when that is set", func(t *testing.T) { - val := assets.NewWeiI(rand.Int63()) - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = val + priceMax := assets.NewWeiI(rand.Int63()) + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = priceMax }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) - - assert.Equal(t, val.String(), cfg3.EVM().GasEstimator().PriceMaxKey(addr).String()) + assert.Equal(t, priceMax.String(), cfg3.EVM().GasEstimator().PriceMaxKey(addr).String()) }) + t.Run("uses key-specific override value when set", func(t *testing.T) { tests := []struct { name string @@ -123,8 +87,8 @@ func TestChainScopedConfig(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].KeySpecific = toml.KeySpecificConfig{ + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.KeySpecific = toml.KeySpecificConfig{ {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: tt.val, @@ -132,7 +96,6 @@ func TestChainScopedConfig(t *testing.T) { }, } }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) assert.Equal(t, tt.val.String(), cfg3.EVM().GasEstimator().PriceMaxKey(addr).String()) }) @@ -141,9 +104,9 @@ func TestChainScopedConfig(t *testing.T) { t.Run("uses key-specific override value when set and lower than chain specific config", func(t *testing.T) { keySpecificPrice := assets.GWei(900) chainSpecificPrice := assets.GWei(1200) - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice - c.EVM[0].KeySpecific = toml.KeySpecificConfig{ + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = chainSpecificPrice + c.KeySpecific = toml.KeySpecificConfig{ {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, @@ -151,16 +114,15 @@ func TestChainScopedConfig(t *testing.T) { }, } }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) assert.Equal(t, keySpecificPrice.String(), cfg3.EVM().GasEstimator().PriceMaxKey(addr).String()) }) t.Run("uses chain-specific value when higher than key-specific value", func(t *testing.T) { keySpecificPrice := assets.GWei(1400) chainSpecificPrice := assets.GWei(1200) - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice - c.EVM[0].KeySpecific = toml.KeySpecificConfig{ + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = chainSpecificPrice + c.KeySpecific = toml.KeySpecificConfig{ {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, @@ -168,14 +130,13 @@ func TestChainScopedConfig(t *testing.T) { }, } }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) assert.Equal(t, chainSpecificPrice.String(), cfg3.EVM().GasEstimator().PriceMaxKey(addr).String()) }) t.Run("uses key-specific override value when set and lower than global config", func(t *testing.T) { keySpecificPrice := assets.GWei(900) - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].KeySpecific = toml.KeySpecificConfig{ + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.KeySpecific = toml.KeySpecificConfig{ {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, @@ -183,16 +144,15 @@ func TestChainScopedConfig(t *testing.T) { }, } }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) assert.Equal(t, keySpecificPrice.String(), cfg3.EVM().GasEstimator().PriceMaxKey(addr).String()) }) t.Run("uses global value when higher than key-specific value", func(t *testing.T) { keySpecificPrice := assets.GWei(1400) chainSpecificPrice := assets.GWei(1200) - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice - c.EVM[0].KeySpecific = toml.KeySpecificConfig{ + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = chainSpecificPrice + c.KeySpecific = toml.KeySpecificConfig{ {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, @@ -200,19 +160,17 @@ func TestChainScopedConfig(t *testing.T) { }, } }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) assert.Equal(t, chainSpecificPrice.String(), cfg3.EVM().GasEstimator().PriceMaxKey(addr).String()) }) t.Run("uses global value when there is no key-specific price", func(t *testing.T) { - val := assets.NewWeiI(rand.Int63()) + priceMax := assets.NewWeiI(rand.Int63()) unsetAddr := testutils.NewAddress() - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = val + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = priceMax }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) - assert.Equal(t, val.String(), cfg3.EVM().GasEstimator().PriceMaxKey(unsetAddr).String()) + assert.Equal(t, priceMax.String(), cfg3.EVM().GasEstimator().PriceMaxKey(unsetAddr).String()) }) }) @@ -222,14 +180,13 @@ func TestChainScopedConfig(t *testing.T) { }) t.Run("uses chain-specific override value when that is set", func(t *testing.T) { - val := testutils.NewAddress() + addr := testutils.NewAddress() - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].LinkContractAddress = ptr(types.EIP55AddressFromAddress(val)) + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.LinkContractAddress = ptr(types.EIP55AddressFromAddress(addr)) }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) - assert.Equal(t, val.String(), cfg3.EVM().LinkContractAddress()) + assert.Equal(t, addr.String(), cfg3.EVM().LinkContractAddress()) }) }) @@ -241,10 +198,9 @@ func TestChainScopedConfig(t *testing.T) { t.Run("uses chain-specific override value when that is set", func(t *testing.T) { val := testutils.NewAddress() - gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].OperatorFactoryAddress = ptr(types.EIP55AddressFromAddress(val)) + cfg3 := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.OperatorFactoryAddress = ptr(types.EIP55AddressFromAddress(val)) }) - cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) assert.Equal(t, val.String(), cfg3.EVM().OperatorFactoryAddress()) }) @@ -253,8 +209,7 @@ func TestChainScopedConfig(t *testing.T) { func TestChainScopedConfig_BlockHistory(t *testing.T) { t.Parallel() - gcfg := configtest.NewTestGeneralConfig(t) - cfg := evmtest.NewChainScopedConfig(t, gcfg) + cfg := testutils.NewTestChainScopedConfig(t, nil) bh := cfg.EVM().GasEstimator().BlockHistory() assert.Equal(t, uint32(25), bh.BatchSize()) @@ -268,10 +223,9 @@ func TestChainScopedConfig_BlockHistory(t *testing.T) { func TestChainScopedConfig_GasEstimator(t *testing.T) { t.Parallel() - gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = assets.GWei(500) + cfg := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.GasEstimator.PriceMax = assets.GWei(500) }) - cfg := evmtest.NewChainScopedConfig(t, gcfg) ge := cfg.EVM().GasEstimator() assert.Equal(t, "BlockHistory", ge.Mode()) @@ -292,17 +246,9 @@ func TestChainScopedConfig_GasEstimator(t *testing.T) { } func TestChainScopedConfig_BSCDefaults(t *testing.T) { - chainID := big.NewInt(56) - gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, secrets *chainlink.Secrets) { - id := ubig.New(chainID) - cfg := toml.Defaults(id) - c.EVM[0] = &toml.EVMConfig{ - ChainID: id, - Enabled: ptr(true), - Chain: cfg, - } + cfg := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.ChainID = (*ubig.Big)(big.NewInt(56)) }) - cfg := evmtest.NewChainScopedConfig(t, gcfg) timeout := cfg.EVM().OCR().DatabaseTimeout() require.Equal(t, 2*time.Second, timeout) @@ -345,16 +291,9 @@ func TestChainScopedConfig_Profiles(t *testing.T) { t.Run(tt.name, func(t *testing.T) { t.Parallel() - gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, secrets *chainlink.Secrets) { - id := ubig.NewI(tt.chainID) - cfg := toml.Defaults(id) - c.EVM[0] = &toml.EVMConfig{ - ChainID: id, - Enabled: ptr(true), - Chain: cfg, - } + config := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { + c.ChainID = ubig.NewI(tt.chainID) }) - config := evmtest.NewChainScopedConfig(t, gcfg) assert.Equal(t, tt.expectedGasLimitDefault, config.EVM().GasEstimator().LimitDefault()) assert.Nil(t, config.EVM().GasEstimator().LimitJobType().OCR()) @@ -369,8 +308,7 @@ func TestChainScopedConfig_Profiles(t *testing.T) { func TestChainScopedConfig_HeadTracker(t *testing.T) { t.Parallel() - gcfg := configtest.NewTestGeneralConfig(t) - cfg := evmtest.NewChainScopedConfig(t, gcfg) + cfg := testutils.NewTestChainScopedConfig(t, nil) ht := cfg.EVM().HeadTracker() assert.Equal(t, uint32(100), ht.HistoryDepth()) @@ -380,100 +318,8 @@ func TestChainScopedConfig_HeadTracker(t *testing.T) { assert.Equal(t, uint32(10000), ht.MaxAllowedFinalityDepth()) } -func Test_chainScopedConfig_Validate(t *testing.T) { - configWithChains := func(t *testing.T, id int64, chains ...*toml.Chain) config.AppConfig { - return configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - s.Database.URL = models.MustSecretURL("postgresql://doesnotexist:justtopassvalidationtests@localhost:5432/chainlink_na_test") - chainID := ubig.NewI(id) - c.EVM[0] = &toml.EVMConfig{ChainID: chainID, Enabled: ptr(true), Chain: toml.Defaults(chainID, chains...), - Nodes: toml.EVMNodes{{ - Name: ptr("fake"), - WSURL: configurl.MustParseURL("wss://foo.test/ws"), - HTTPURL: configurl.MustParseURL("http://foo.test"), - }}} - }) - } - - // Validate built-in - for _, id := range toml.DefaultIDs { - id := id - t.Run(fmt.Sprintf("chainID-%s", id), func(t *testing.T) { - cfg := configWithChains(t, id.Int64()) - assert.NoError(t, cfg.Validate()) - }) - } - - // Invalid Cases: - - t.Run("arbitrum-estimator", func(t *testing.T) { - t.Run("custom", func(t *testing.T) { - cfg := configWithChains(t, 0, &toml.Chain{ - ChainType: commonconfig.NewChainTypeConfig(string(commonconfig.ChainArbitrum)), - GasEstimator: toml.GasEstimator{ - Mode: ptr("BlockHistory"), - }, - }) - assert.NoError(t, cfg.Validate()) - }) - t.Run("mainnet", func(t *testing.T) { - cfg := configWithChains(t, 42161, &toml.Chain{ - GasEstimator: toml.GasEstimator{ - Mode: ptr("BlockHistory"), - BlockHistory: toml.BlockHistoryEstimator{ - BlockHistorySize: ptr[uint16](1), - }, - }, - }) - assert.NoError(t, cfg.Validate()) - }) - t.Run("testnet", func(t *testing.T) { - cfg := configWithChains(t, 421611, &toml.Chain{ - GasEstimator: toml.GasEstimator{ - Mode: ptr("SuggestedPrice"), - }, - }) - assert.NoError(t, cfg.Validate()) - }) - }) - - t.Run("optimism-estimator", func(t *testing.T) { - t.Run("custom", func(t *testing.T) { - cfg := configWithChains(t, 0, &toml.Chain{ - ChainType: commonconfig.NewChainTypeConfig(string(commonconfig.ChainOptimismBedrock)), - GasEstimator: toml.GasEstimator{ - Mode: ptr("BlockHistory"), - }, - }) - assert.NoError(t, cfg.Validate()) - }) - t.Run("mainnet", func(t *testing.T) { - cfg := configWithChains(t, 10, &toml.Chain{ - GasEstimator: toml.GasEstimator{ - Mode: ptr("FixedPrice"), - }, - }) - assert.NoError(t, cfg.Validate()) - }) - t.Run("testnet", func(t *testing.T) { - cfg := configWithChains(t, 69, &toml.Chain{ - GasEstimator: toml.GasEstimator{ - Mode: ptr("FixedPrice"), - }, - }) - assert.NoError(t, cfg.Validate()) - }) - }) -} - func TestNodePoolConfig(t *testing.T) { - gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - id := ubig.New(big.NewInt(rand.Int63())) - c.EVM[0] = &toml.EVMConfig{ - ChainID: id, - Chain: toml.Defaults(id, &toml.Chain{}), - } - }) - cfg := evmtest.NewChainScopedConfig(t, gcfg) + cfg := testutils.NewTestChainScopedConfig(t, nil) require.Equal(t, "HighestHead", cfg.EVM().NodePool().SelectionMode()) require.Equal(t, uint32(5), cfg.EVM().NodePool().SyncThreshold()) @@ -486,37 +332,28 @@ func TestClientErrorsConfig(t *testing.T) { t.Parallel() t.Run("EVM().NodePool().Errors()", func(t *testing.T) { - clientErrorsOverrides := func(c *chainlink.Config, s *chainlink.Secrets) { + cfg := testutils.NewTestChainScopedConfig(t, func(c *toml.EVMConfig) { id := ubig.New(big.NewInt(rand.Int63())) - c.EVM[0] = &toml.EVMConfig{ - ChainID: id, - Chain: toml.Defaults(id, &toml.Chain{ - NodePool: toml.NodePool{ - Errors: toml.ClientErrors{ - NonceTooLow: ptr[string]("client error nonce too low"), - NonceTooHigh: ptr[string]("client error nonce too high"), - ReplacementTransactionUnderpriced: ptr[string]("client error replacement underpriced"), - LimitReached: ptr[string]("client error limit reached"), - TransactionAlreadyInMempool: ptr[string]("client error transaction already in mempool"), - TerminallyUnderpriced: ptr[string]("client error terminally underpriced"), - InsufficientEth: ptr[string]("client error insufficient eth"), - TxFeeExceedsCap: ptr[string]("client error tx fee exceeds cap"), - L2FeeTooLow: ptr[string]("client error l2 fee too low"), - L2FeeTooHigh: ptr[string]("client error l2 fee too high"), - L2Full: ptr[string]("client error l2 full"), - TransactionAlreadyMined: ptr[string]("client error transaction already mined"), - Fatal: ptr[string]("client error fatal"), - ServiceUnavailable: ptr[string]("client error service unavailable"), - }, - }, - }), + c.ChainID = id + c.NodePool = toml.NodePool{ + Errors: toml.ClientErrors{ + NonceTooLow: ptr("client error nonce too low"), + NonceTooHigh: ptr("client error nonce too high"), + ReplacementTransactionUnderpriced: ptr("client error replacement underpriced"), + LimitReached: ptr("client error limit reached"), + TransactionAlreadyInMempool: ptr("client error transaction already in mempool"), + TerminallyUnderpriced: ptr("client error terminally underpriced"), + InsufficientEth: ptr("client error insufficient eth"), + TxFeeExceedsCap: ptr("client error tx fee exceeds cap"), + L2FeeTooLow: ptr("client error l2 fee too low"), + L2FeeTooHigh: ptr("client error l2 fee too high"), + L2Full: ptr("client error l2 full"), + TransactionAlreadyMined: ptr("client error transaction already mined"), + Fatal: ptr("client error fatal"), + ServiceUnavailable: ptr("client error service unavailable"), + }, } - } - - gcfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - clientErrorsOverrides(c, s) }) - cfg := evmtest.NewChainScopedConfig(t, gcfg) errors := cfg.EVM().NodePool().Errors() assert.Equal(t, "client error nonce too low", errors.NonceTooLow()) diff --git a/core/chains/evm/config/toml/config_test.go b/core/chains/evm/config/toml/config_test.go new file mode 100644 index 00000000000..61b75e229a1 --- /dev/null +++ b/core/chains/evm/config/toml/config_test.go @@ -0,0 +1,31 @@ +package toml_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/smartcontractkit/chainlink-common/pkg/config" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" +) + +func TestEVMConfig_ValidateConfig(t *testing.T) { + name := "fake" + for _, id := range toml.DefaultIDs { + t.Run(fmt.Sprintf("chainID-%s", id), func(t *testing.T) { + evmCfg := &toml.EVMConfig{ + ChainID: id, + Chain: toml.Defaults(id), + Nodes: toml.EVMNodes{{ + Name: &name, + WSURL: config.MustParseURL("wss://foo.test/ws"), + HTTPURL: config.MustParseURL("http://foo.test"), + }}, + } + + assert.NoError(t, config.Validate(evmCfg)) + }) + } +} diff --git a/core/config/docs/docs.go b/core/config/docs/docs.go index df082465036..5a17ab0090a 100644 --- a/core/config/docs/docs.go +++ b/core/config/docs/docs.go @@ -8,7 +8,7 @@ import ( "go.uber.org/multierr" - "github.com/smartcontractkit/chainlink/v2/core/utils" + "github.com/smartcontractkit/chainlink-common/pkg/config" ) const ( @@ -220,7 +220,7 @@ func (k keyval) String() string { } func parseTOMLDocs(s string) (items []fmt.Stringer, err error) { - defer func() { _, err = utils.MultiErrorList(err) }() + defer func() { _, err = config.MultiErrorList(err) }() globalTable := table{name: "Global"} currentTable := &globalTable items = append(items, currentTable) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 5b9c9a30a90..69ddfb58278 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_golang v1.17.0 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink-automation v1.0.3 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c diff --git a/core/scripts/go.sum b/core/scripts/go.sum index a9fd8e14641..9745a09531e 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1185,8 +1185,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.3 h1:h/ijT0NiyV06VxYVgcNfsE3+8OEzT3Q0Z9au0z1BPWs= github.com/smartcontractkit/chainlink-automation v1.0.3/go.mod h1:RjboV0Qd7YP+To+OrzHGXaxUxoSONveCoAK2TQ1INLU= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 h1:6KxgmkZdVE/nU5ym5j114MELSs13HgMy5FV0TpnocS8= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 h1:y2AKnwEybyhr7LEvBRn0RoLBABuckvB6S9gQJMEDrgU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo= diff --git a/core/services/chainlink/cfgtest/cfgtest.go b/core/services/chainlink/cfgtest/cfgtest.go index 1438b702fc1..3bf95452650 100644 --- a/core/services/chainlink/cfgtest/cfgtest.go +++ b/core/services/chainlink/cfgtest/cfgtest.go @@ -10,12 +10,12 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/multierr" - "github.com/smartcontractkit/chainlink/v2/core/utils" + "github.com/smartcontractkit/chainlink-common/pkg/config" ) func AssertFieldsNotNil(t *testing.T, s interface{}) { err := assertValNotNil(t, "", reflect.ValueOf(s)) - _, err = utils.MultiErrorList(err) + _, err = config.MultiErrorList(err) assert.NoError(t, err) } diff --git a/core/services/chainlink/config.go b/core/services/chainlink/config.go index 64c83323e39..200d4973ed1 100644 --- a/core/services/chainlink/config.go +++ b/core/services/chainlink/config.go @@ -12,12 +12,13 @@ import ( solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/store/models" - "github.com/smartcontractkit/chainlink/v2/core/utils" "github.com/smartcontractkit/chainlink/v2/core/utils/config" ) @@ -57,7 +58,7 @@ func (c *Config) warnings() (err error) { deprecationErr := c.deprecationWarnings() warningErr := c.valueWarnings() err = multierr.Append(deprecationErr, warningErr) - _, list := utils.MultiErrorList(err) + _, list := commonconfig.MultiErrorList(err) return list } @@ -82,7 +83,7 @@ func (c *Config) deprecationWarnings() (err error) { // Validate returns an error if the Config is not valid for use, as-is. // This is typically used after defaults have been applied. func (c *Config) Validate() error { - if err := config.Validate(c); err != nil { + if err := commonconfig.Validate(c); err != nil { return fmt.Errorf("invalid configuration: %w", err) } return nil @@ -128,22 +129,22 @@ func (c *Config) SetFrom(f *Config) (err error) { c.Core.SetFrom(&f.Core) if err1 := c.EVM.SetFrom(&f.EVM); err1 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err1, "EVM")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err1, "EVM")) } if err2 := c.Cosmos.SetFrom(&f.Cosmos); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "Cosmos")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "Cosmos")) } if err3 := c.Solana.SetFrom(&f.Solana); err3 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err3, "Solana")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err3, "Solana")) } if err4 := c.Starknet.SetFrom(&f.Starknet); err4 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err4, "Starknet")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err4, "Starknet")) } - _, err = utils.MultiErrorList(err) + _, err = commonconfig.MultiErrorList(err) return err } @@ -154,34 +155,34 @@ type Secrets struct { func (s *Secrets) SetFrom(f *Secrets) (err error) { if err2 := s.Database.SetFrom(&f.Database); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "Database")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "Database")) } if err2 := s.Password.SetFrom(&f.Password); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "Password")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "Password")) } if err2 := s.WebServer.SetFrom(&f.WebServer); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "WebServer")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "WebServer")) } if err2 := s.Pyroscope.SetFrom(&f.Pyroscope); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "Pyroscope")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "Pyroscope")) } if err2 := s.Prometheus.SetFrom(&f.Prometheus); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "Prometheus")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "Prometheus")) } if err2 := s.Mercury.SetFrom(&f.Mercury); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "Mercury")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "Mercury")) } if err2 := s.Threshold.SetFrom(&f.Threshold); err2 != nil { - err = multierr.Append(err, config.NamedMultiErrorList(err2, "Threshold")) + err = multierr.Append(err, commonconfig.NamedMultiErrorList(err2, "Threshold")) } - _, err = utils.MultiErrorList(err) + _, err = commonconfig.MultiErrorList(err) return err } @@ -205,7 +206,7 @@ var ErrInvalidSecrets = errors.New("invalid secrets") // Validate validates every consitutent secret and return an accumulated error func (s *Secrets) Validate() error { - if err := config.Validate(s); err != nil { + if err := commonconfig.Validate(s); err != nil { return fmt.Errorf("%w: %s", ErrInvalidSecrets, err) } return nil @@ -227,7 +228,7 @@ func (s *Secrets) ValidateDB() error { } s.setDefaults() v := &dbValidationType{s.Database} - if err := config.Validate(v); err != nil { + if err := commonconfig.Validate(v); err != nil { return fmt.Errorf("%w: %s", ErrInvalidSecrets, err) } return nil diff --git a/core/services/chainlink/config_general.go b/core/services/chainlink/config_general.go index ce34cc47e47..5b4a6271d52 100644 --- a/core/services/chainlink/config_general.go +++ b/core/services/chainlink/config_general.go @@ -135,7 +135,7 @@ func (o GeneralConfigOpts) New() (GeneralConfig, error) { return nil, err } - _, warning := utils.MultiErrorList(o.Config.warnings()) + _, warning := commonconfig.MultiErrorList(o.Config.warnings()) o.Config.setDefaults() if !o.SkipEnv { @@ -220,7 +220,7 @@ func (g *generalConfig) validate(secretsValidationFn func() error) error { secretsValidationFn(), ) - _, errList := utils.MultiErrorList(err) + _, errList := commonconfig.MultiErrorList(err) return errList } @@ -235,7 +235,7 @@ var emptyStringsEnv string func validateEnv() (err error) { defer func() { if err != nil { - _, err = utils.MultiErrorList(err) + _, err = commonconfig.MultiErrorList(err) err = fmt.Errorf("invalid environment: %w", err) } }() diff --git a/core/utils/config/validate.go b/core/utils/config/validate.go index 5fbae24ad53..5c62a66ba14 100644 --- a/core/utils/config/validate.go +++ b/core/utils/config/validate.go @@ -2,130 +2,12 @@ package config import ( "fmt" - "reflect" - "strconv" - "strings" "github.com/Masterminds/semver/v3" - "go.uber.org/multierr" "github.com/smartcontractkit/chainlink-common/pkg/config" - "github.com/smartcontractkit/chainlink/v2/core/utils" ) -// Validated configurations impose constraints that must be checked. -type Validated interface { - // ValidateConfig returns nil if the config is valid, otherwise an error describing why it is invalid. - // - // For implementations: - // - Use package multierr to accumulate all errors, rather than returning the first encountered. - // - If an anonymous field also implements ValidateConfig(), it must be called explicitly! - ValidateConfig() error -} - -// Validate returns any errors from calling Validated.ValidateConfig on cfg and any nested types that implement Validated. -func Validate(cfg interface{}) (err error) { - _, err = utils.MultiErrorList(validate(reflect.ValueOf(cfg), true)) - return -} - -func validate(v reflect.Value, checkInterface bool) (err error) { - if checkInterface { - i := v.Interface() - if vc, ok := i.(Validated); ok { - err = multierr.Append(err, vc.ValidateConfig()) - } else if v.CanAddr() { - i = v.Addr().Interface() - if vc, ok := i.(Validated); ok { - err = multierr.Append(err, vc.ValidateConfig()) - } - } - } - - t := v.Type() - if t.Kind() == reflect.Ptr { - if v.IsNil() { - return - } - t = t.Elem() - v = v.Elem() - } - switch t.Kind() { - case reflect.Bool, reflect.Chan, reflect.Complex128, reflect.Complex64, reflect.Float32, reflect.Float64, - reflect.Func, reflect.Int, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int8, reflect.Interface, - reflect.Invalid, reflect.Ptr, reflect.String, reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64, - reflect.Uint8, reflect.Uintptr, reflect.UnsafePointer: - return - case reflect.Struct: - for i := 0; i < t.NumField(); i++ { - ft := t.Field(i) - if !ft.IsExported() { - continue - } - fv := v.Field(i) - if !fv.CanInterface() { - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - continue - } - // skip the interface if Anonymous, since the parent struct inherits the methods - if fe := validate(fv, !ft.Anonymous); fe != nil { - if ft.Anonymous { - err = multierr.Append(err, fe) - } else { - err = multierr.Append(err, NamedMultiErrorList(fe, ft.Name)) - } - } - } - return - case reflect.Map: - iter := v.MapRange() - for iter.Next() { - mk := iter.Key() - mv := iter.Value() - if !v.CanInterface() { - continue - } - if mv.Kind() == reflect.Ptr && mv.IsNil() { - continue - } - if me := validate(mv, true); me != nil { - err = multierr.Append(err, NamedMultiErrorList(me, fmt.Sprintf("%s", mk.Interface()))) - } - } - return - case reflect.Slice, reflect.Array: - for i := 0; i < v.Len(); i++ { - iv := v.Index(i) - if !v.CanInterface() { - continue - } - if iv.Kind() == reflect.Ptr && iv.IsNil() { - continue - } - if me := validate(iv, true); me != nil { - err = multierr.Append(err, NamedMultiErrorList(me, strconv.Itoa(i))) - } - } - return - } - - return fmt.Errorf("should be unreachable: switch missing case for kind: %s", t.Kind()) -} - -func NamedMultiErrorList(err error, name string) error { - l, merr := utils.MultiErrorList(err) - if l == 0 { - return nil - } - msg := strings.ReplaceAll(merr.Error(), "\n", "\n\t") - if l == 1 { - return fmt.Errorf("%s.%s", name, msg) - } - return fmt.Errorf("%s: %s", name, msg) -} - type ErrInvalid = config.ErrInvalid // NewErrDuplicate returns an ErrInvalid with a standard duplicate message. diff --git a/core/utils/errors.go b/core/utils/errors.go deleted file mode 100644 index 5ed8bc25201..00000000000 --- a/core/utils/errors.go +++ /dev/null @@ -1,48 +0,0 @@ -package utils - -import ( - "fmt" - "strings" -) - -type multiErrorList []error - -// MultiErrorList returns an error which formats underlying errors as a list, or nil if err is nil. -func MultiErrorList(err error) (int, error) { - if err == nil { - return 0, nil - } - errs := Flatten(err) - return len(errs), multiErrorList(errs) -} - -func (m multiErrorList) Error() string { - l := len(m) - if l == 1 { - return m[0].Error() - } - var sb strings.Builder - fmt.Fprintf(&sb, "%d errors:", l) - for _, e := range m { - fmt.Fprintf(&sb, "\n\t- %v", e) - } - return sb.String() -} - -func (m multiErrorList) Unwrap() []error { - return m -} - -// Flatten calls `Unwrap() []error` on each error and subsequent returned error that implement the method, returning a fully flattend sequence. -// -//nolint:errorlint // error type checks will fail on wrapped errors. Disabled since we are not doing checks on error types. -func Flatten(errs ...error) (flat []error) { - for _, err := range errs { - if me, ok := err.(interface{ Unwrap() []error }); ok { - flat = append(flat, Flatten(me.Unwrap()...)...) - continue - } - flat = append(flat, err) - } - return -} diff --git a/core/utils/errors_test.go b/core/utils/errors_test.go deleted file mode 100644 index f55b593c455..00000000000 --- a/core/utils/errors_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package utils - -import ( - "errors" - "testing" - - "github.com/stretchr/testify/assert" - "go.uber.org/multierr" -) - -func TestFlatten(t *testing.T) { - e := []error{ - errors.New("0"), - errors.New("1"), - errors.New("2"), - errors.New("3"), - } - - // nested errors - // [[[0, 1], 2], 3] - err0 := errors.Join(nil, e[0]) - err0 = errors.Join(err0, e[1]) - err0 = errors.Join(err0, e[2]) - err0 = errors.Join(err0, e[3]) - - // flat error - err1 := errors.Join(e...) - - // multierr provides a flat error - err2 := multierr.Append(nil, e[0]) - err2 = multierr.Append(err2, e[1]) - err2 = multierr.Append(err2, e[2]) - err2 = multierr.Append(err2, e[3]) - - params := []struct { - name string - err error - out []error - }{ - {"errors.Join nested", err0, e}, - {"errors.Join flat", err1, e}, - {"multierr.Append", err2, e}, - {"nil", nil, []error{nil}}, - {"single", e[0], []error{e[0]}}, - } - - for _, p := range params { - t.Run(p.name, func(t *testing.T) { - assert.Equal(t, p.out, Flatten(p.err)) - }) - } -} diff --git a/go.mod b/go.mod index d41c7c3bda6..f9f8cc6000e 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chain-selectors v1.0.10 github.com/smartcontractkit/chainlink-automation v1.0.3 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 diff --git a/go.sum b/go.sum index 34b3491c136..05c8c9ffe3c 100644 --- a/go.sum +++ b/go.sum @@ -1171,8 +1171,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.3 h1:h/ijT0NiyV06VxYVgcNfsE3+8OEzT3Q0Z9au0z1BPWs= github.com/smartcontractkit/chainlink-automation v1.0.3/go.mod h1:RjboV0Qd7YP+To+OrzHGXaxUxoSONveCoAK2TQ1INLU= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 h1:6KxgmkZdVE/nU5ym5j114MELSs13HgMy5FV0TpnocS8= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 h1:y2AKnwEybyhr7LEvBRn0RoLBABuckvB6S9gQJMEDrgU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index ae5a5e9ebd7..76fb1264b5a 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -27,7 +27,7 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.3 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 github.com/smartcontractkit/chainlink-testing-framework v1.28.17 github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 9d50dc1e79f..53462f9be60 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1512,8 +1512,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.3 h1:h/ijT0NiyV06VxYVgcNfsE3+8OEzT3Q0Z9au0z1BPWs= github.com/smartcontractkit/chainlink-automation v1.0.3/go.mod h1:RjboV0Qd7YP+To+OrzHGXaxUxoSONveCoAK2TQ1INLU= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 h1:6KxgmkZdVE/nU5ym5j114MELSs13HgMy5FV0TpnocS8= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 h1:y2AKnwEybyhr7LEvBRn0RoLBABuckvB6S9gQJMEDrgU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 284dea95d7c..0163e4acd04 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -16,7 +16,7 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-automation v1.0.3 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 github.com/smartcontractkit/chainlink-testing-framework v1.28.17 github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240214231432-4ad5eb95178c github.com/smartcontractkit/chainlink/v2 v2.9.0-beta0.0.20240216210048-da02459ddad8 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 7abcbbae9f0..1fe677a4843 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1502,8 +1502,8 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= github.com/smartcontractkit/chainlink-automation v1.0.3 h1:h/ijT0NiyV06VxYVgcNfsE3+8OEzT3Q0Z9au0z1BPWs= github.com/smartcontractkit/chainlink-automation v1.0.3/go.mod h1:RjboV0Qd7YP+To+OrzHGXaxUxoSONveCoAK2TQ1INLU= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9 h1:6KxgmkZdVE/nU5ym5j114MELSs13HgMy5FV0TpnocS8= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240531185627-1ff5b506c5f9/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034 h1:y2AKnwEybyhr7LEvBRn0RoLBABuckvB6S9gQJMEDrgU= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240603100528-9e4ad2c80034/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d h1:5tgMC5Gi2UAOKZ+m28W8ubjLeR0pQCAcrz6eQ0rW510= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d/go.mod h1:0UNuO3nDt9MFsZPaHJBEUolxVkN0iC69j1ccDp95e8k= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo=