diff --git a/core/config/docs/core.toml b/core/config/docs/core.toml index 3cb6bb0aaa7..95d59cca062 100644 --- a/core/config/docs/core.toml +++ b/core/config/docs/core.toml @@ -88,10 +88,6 @@ LeaseRefreshInterval = '1s' # Default UniConn = true # Default # Logging toggles verbose logging of the raw telemetry messages being sent. Logging = false # Default -# ServerPubKey is the public key of the telemetry server. This field will be removed in a furture version -ServerPubKey = 'test-pub-key' # Example -# URL is where to send telemetry. This field will be removed in a furture version -URL = 'https://prom.test' # Example # BufferSize is the number of telemetry messages to buffer before dropping new ones. BufferSize = 100 # Default # MaxBatchSize is the maximum number of messages to batch into one telemetry request. diff --git a/core/config/docs/docs_test.go b/core/config/docs/docs_test.go index 508bd62e338..dc1e0f2af12 100644 --- a/core/config/docs/docs_test.go +++ b/core/config/docs/docs_test.go @@ -15,7 +15,6 @@ import ( stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" "github.com/smartcontractkit/chainlink-common/pkg/config" - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/config/docs" @@ -38,12 +37,6 @@ func TestDoc(t *testing.T) { require.NoError(t, err) } - // Except for TelemetryIngress.ServerPubKey and TelemetryIngress.URL as this will be removed in the future - // and its only use is to signal to NOPs that these fields are no longer allowed - emptyString := "" - c.TelemetryIngress.ServerPubKey = &emptyString - c.TelemetryIngress.URL = new(commonconfig.URL) - cfgtest.AssertFieldsNotNil(t, c) var defaults chainlink.Config diff --git a/core/config/telemetry_ingress_config.go b/core/config/telemetry_ingress_config.go index f6c9fa3f858..a4923391011 100644 --- a/core/config/telemetry_ingress_config.go +++ b/core/config/telemetry_ingress_config.go @@ -16,9 +16,6 @@ type TelemetryIngress interface { SendTimeout() time.Duration UseBatchSend() bool Endpoints() []TelemetryIngressEndpoint - - ServerPubKey() string // Deprecated: Use TelemetryIngressEndpoint.ServerPubKey instead, this field will be removed in future versions - URL() *url.URL // Deprecated: Use TelemetryIngressEndpoint.URL instead, this field will be removed in future versions } //go:generate mockery --quiet --name TelemetryIngressEndpoint --output ./mocks/ --case=underscore --filename telemetry_ingress_endpoint.go diff --git a/core/config/toml/types.go b/core/config/toml/types.go index eae5b2f533a..7b4656da1f6 100644 --- a/core/config/toml/types.go +++ b/core/config/toml/types.go @@ -438,9 +438,6 @@ type TelemetryIngress struct { SendTimeout *commonconfig.Duration UseBatchSend *bool Endpoints []TelemetryIngressEndpoint `toml:",omitempty"` - - URL *commonconfig.URL `toml:",omitempty"` // Deprecated: Use TelemetryIngressEndpoint.URL instead, this field will be removed in future versions - ServerPubKey *string `toml:",omitempty"` // Deprecated: Use TelemetryIngressEndpoint.ServerPubKey instead, this field will be removed in future versions } type TelemetryIngressEndpoint struct { @@ -475,26 +472,6 @@ func (t *TelemetryIngress) setFrom(f *TelemetryIngress) { if v := f.Endpoints; v != nil { t.Endpoints = v } - if v := f.ServerPubKey; v != nil { - t.ServerPubKey = v - } - if v := f.URL; v != nil { - t.URL = v - } -} - -func (t *TelemetryIngress) ValidateConfig() (err error) { - if (!t.URL.IsZero() || *t.ServerPubKey != "") && len(t.Endpoints) > 0 { - return configutils.ErrInvalid{Name: "URL", Value: t.URL.String(), - Msg: `Cannot set both TelemetryIngress.URL and TelemetryIngress.ServerPubKey alongside TelemetryIngress.Endpoints. Please use only TelemetryIngress.Endpoints: - [[TelemetryIngress.Endpoints]] - Network = '...' # e.g. EVM. Solana, Starknet, Cosmos - ChainID = '...' # e.g. 1, 5, devnet, mainnet-beta - URL = '...' - ServerPubKey = '...'`} - } - - return nil } type AuditLogger struct { diff --git a/core/services/chainlink/config_telemetry_ingress.go b/core/services/chainlink/config_telemetry_ingress.go index 5126833134e..3ad721ad303 100644 --- a/core/services/chainlink/config_telemetry_ingress.go +++ b/core/services/chainlink/config_telemetry_ingress.go @@ -46,16 +46,6 @@ func (t *telemetryIngressConfig) UseBatchSend() bool { return *t.c.UseBatchSend } -// Deprecated: Use TelemetryIngressEndpoint.ServerPubKey, this field will be removed in future versions -func (t *telemetryIngressConfig) ServerPubKey() string { - return *t.c.ServerPubKey -} - -// Deprecated: Use TelemetryIngressEndpoint.URL instead, this field will be removed in future versions -func (t *telemetryIngressConfig) URL() *url.URL { - return t.c.URL.URL() -} - func (t *telemetryIngressConfig) Endpoints() []config.TelemetryIngressEndpoint { var endpoints []config.TelemetryIngressEndpoint for _, e := range t.c.Endpoints { diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index a7ac1e86d84..6cd052077a8 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -293,8 +293,6 @@ func TestConfig_Marshal(t *testing.T) { SendInterval: commonconfig.MustNewDuration(time.Minute), SendTimeout: commonconfig.MustNewDuration(5 * time.Second), UseBatchSend: ptr(true), - URL: ptr(commonconfig.URL{}), - ServerPubKey: ptr(""), Endpoints: []toml.TelemetryIngressEndpoint{{ Network: ptr("EVM"), ChainID: ptr("1"), @@ -744,8 +742,6 @@ MaxBatchSize = 4321 SendInterval = '1m0s' SendTimeout = '5s' UseBatchSend = true -URL = '' -ServerPubKey = '' [[TelemetryIngress.Endpoints]] Network = 'EVM' @@ -1141,17 +1137,6 @@ func TestConfig_full(t *testing.T) { } } - // Except for TelemetryIngress.ServerPubKey as this will be removed in the future - // and its only use is to signal to NOPs that these fields are no longer allowed - if got.TelemetryIngress.ServerPubKey == nil { - got.TelemetryIngress.ServerPubKey = ptr("") - } - // Except for TelemetryIngress.URL as this will be removed in the future - // and its only use is to signal to NOPs that these fields are no longer allowed - if got.TelemetryIngress.URL == nil { - got.TelemetryIngress.URL = new(commonconfig.URL) - } - cfgtest.AssertFieldsNotNil(t, got) } diff --git a/core/services/chainlink/testdata/config-empty-effective.toml b/core/services/chainlink/testdata/config-empty-effective.toml index cc4dddcf8af..148f6b24ff5 100644 --- a/core/services/chainlink/testdata/config-empty-effective.toml +++ b/core/services/chainlink/testdata/config-empty-effective.toml @@ -40,8 +40,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/core/services/chainlink/testdata/config-full.toml b/core/services/chainlink/testdata/config-full.toml index da8b68cfdb1..bc1b124ccb6 100644 --- a/core/services/chainlink/testdata/config-full.toml +++ b/core/services/chainlink/testdata/config-full.toml @@ -40,8 +40,6 @@ MaxBatchSize = 4321 SendInterval = '1m0s' SendTimeout = '5s' UseBatchSend = true -URL = '' -ServerPubKey = '' [[TelemetryIngress.Endpoints]] Network = 'EVM' diff --git a/core/services/chainlink/testdata/config-multi-chain-effective.toml b/core/services/chainlink/testdata/config-multi-chain-effective.toml index d5352a685c4..bd64ae04812 100644 --- a/core/services/chainlink/testdata/config-multi-chain-effective.toml +++ b/core/services/chainlink/testdata/config-multi-chain-effective.toml @@ -40,8 +40,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = true diff --git a/core/services/telemetry/manager.go b/core/services/telemetry/manager.go index c457aca5bf8..228a997eeca 100644 --- a/core/services/telemetry/manager.go +++ b/core/services/telemetry/manager.go @@ -18,13 +18,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/synchronization" ) -//// Client encapsulates all the functionality needed to -//// send telemetry to the ingress server using wsrpc -//type Client interface { -// services.ServiceCtx -// Send(context.Context, synchronization.TelemPayload) -//} - type Manager struct { services.StateMachine bufferSize uint @@ -38,32 +31,6 @@ type Manager struct { uniConn bool useBatchSend bool MonitoringEndpointGenerator MonitoringEndpointGenerator - - //legacyMode means that we are sending all telemetry to a single endpoint. - //In order for this to be set as true, we need to have no endpoints defined with TelemetryIngress.URL and TelemetryIngress.ServerPubKey set. - //This mode will be supported until we completely switch to TelemetryIngress.Endpoints in config.toml - legacyMode bool -} - -type legacyEndpointConfig struct { - Url *url.URL - PubKey string -} - -func (l *legacyEndpointConfig) Network() string { - return "-" -} - -func (l *legacyEndpointConfig) ChainID() string { - return "-" -} - -func (l *legacyEndpointConfig) ServerPubKey() string { - return l.PubKey -} - -func (l *legacyEndpointConfig) URL() *url.URL { - return l.Url } type telemetryEndpoint struct { @@ -87,30 +54,12 @@ func NewManager(cfg config.TelemetryIngress, csaKeyStore keystore.CSA, lggr logg sendTimeout: cfg.SendTimeout(), uniConn: cfg.UniConn(), useBatchSend: cfg.UseBatchSend(), - legacyMode: false, } for _, e := range cfg.Endpoints() { if err := m.addEndpoint(e); err != nil { m.lggr.Error(err) } } - - if len(cfg.Endpoints()) == 0 && cfg.URL() != nil && cfg.ServerPubKey() != "" { - m.lggr.Error(`TelemetryIngress.URL and TelemetryIngress.ServerPubKey will be removed in a future version, please switch to TelemetryIngress.Endpoints: - [[TelemetryIngress.Endpoints]] - Network = '...' # e.g. EVM. Solana, Starknet, Cosmos - ChainID = '...' # e.g. 1, 5, devnet, mainnet-beta - URL = '...' - ServerPubKey = '...'`) - m.legacyMode = true - if err := m.addEndpoint(&legacyEndpointConfig{ - Url: cfg.URL(), - PubKey: cfg.ServerPubKey(), - }); err != nil { - m.lggr.Error(err) - } - } - return m } @@ -165,11 +114,11 @@ func (m *Manager) GenMonitoringEndpoint(network string, chainID string, contract } func (m *Manager) addEndpoint(e config.TelemetryIngressEndpoint) error { - if e.Network() == "" && !m.legacyMode { + if e.Network() == "" { return errors.New("cannot add telemetry endpoint, network cannot be empty") } - if e.ChainID() == "" && !m.legacyMode { + if e.ChainID() == "" { return errors.New("cannot add telemetry endpoint, chainID cannot be empty") } @@ -205,11 +154,6 @@ func (m *Manager) addEndpoint(e config.TelemetryIngressEndpoint) error { } func (m *Manager) getEndpoint(network string, chainID string) (*telemetryEndpoint, bool) { - //in legacy mode we send telemetry to a single endpoint - if m.legacyMode && len(m.endpoints) == 1 { - return m.endpoints[0], true - } - for _, e := range m.endpoints { if e.Network == strings.ToUpper(network) && e.ChainID == strings.ToUpper(chainID) { return e, true diff --git a/core/services/telemetry/manager_test.go b/core/services/telemetry/manager_test.go index 23752151cd0..2d3409ba569 100644 --- a/core/services/telemetry/manager_test.go +++ b/core/services/telemetry/manager_test.go @@ -9,12 +9,10 @@ import ( "testing" "time" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" - commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/mocks" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -201,7 +199,6 @@ func TestNewManager(t *testing.T) { func TestCorrectEndpointRouting(t *testing.T) { tic := setupMockConfig(t, true) tic.On("Endpoints").Return(nil) - tic.On("URL").Return(nil) lggr, obsLogs := logger.TestLoggerObserved(t, zapcore.InfoLevel) ks := mocks3.NewCSA(t) @@ -287,53 +284,3 @@ func TestCorrectEndpointRouting(t *testing.T) { } } - -func TestLegacyMode(t *testing.T) { - tic := setupMockConfig(t, true) - tic.On("Endpoints").Return(nil) - url, err := commonconfig.ParseURL("test.test") - require.NoError(t, err) - tic.On("URL").Return(url.URL()) - tic.On("ServerPubKey").Return("some-pub-key") - - lggr, obsLogs := logger.TestLoggerObserved(t, zapcore.InfoLevel) - ks := mocks3.NewCSA(t) - - tm := NewManager(tic, ks, lggr) - require.Equal(t, true, tm.legacyMode) - require.Len(t, tm.endpoints, 1) - - var clientSent []synchronization.TelemPayload - clientMock := mocks2.NewTelemetryService(t) - clientMock.On("Send", mock.Anything, mock.AnythingOfType("[]uint8"), mock.AnythingOfType("string"), mock.AnythingOfType("TelemetryType")).Return().Run(func(args mock.Arguments) { - clientSent = append(clientSent, synchronization.TelemPayload{ - Telemetry: args[1].([]byte), - ContractID: args[2].(string), - TelemType: args[3].(synchronization.TelemetryType), - }) - }) - tm.endpoints[0].client = clientMock - - e := tm.GenMonitoringEndpoint("unknown-network", "unknown-chainID", "some-contractID", "some-type") - require.Equal(t, "*telemetry.IngressAgentBatch", reflect.TypeOf(e).String()) - - e.SendLog([]byte("endpoint-1-message-1")) - e.SendLog([]byte("endpoint-1-message-2")) - e.SendLog([]byte("endpoint-1-message-3")) - require.Len(t, clientSent, 3) - - e2 := tm.GenMonitoringEndpoint("another-unknown-network", "another-unknown-chainID", "another-contractID", "another-type") - require.Equal(t, "*telemetry.IngressAgentBatch", reflect.TypeOf(e).String()) - - e2.SendLog([]byte("endpoint-2-message-1")) - e2.SendLog([]byte("endpoint-2-message-2")) - e2.SendLog([]byte("endpoint-2-message-3")) - require.Len(t, clientSent, 6) - assert.Equal(t, []byte("endpoint-1-message-1"), clientSent[0].Telemetry) - assert.Equal(t, []byte("endpoint-1-message-2"), clientSent[1].Telemetry) - assert.Equal(t, []byte("endpoint-1-message-3"), clientSent[2].Telemetry) - assert.Equal(t, []byte("endpoint-2-message-1"), clientSent[3].Telemetry) - assert.Equal(t, []byte("endpoint-2-message-2"), clientSent[4].Telemetry) - assert.Equal(t, []byte("endpoint-2-message-3"), clientSent[5].Telemetry) - assert.Equal(t, 1, obsLogs.Len()) // Deprecation warning for TelemetryIngress.URL and TelemetryIngress.ServerPubKey -} diff --git a/core/web/resolver/testdata/config-empty-effective.toml b/core/web/resolver/testdata/config-empty-effective.toml index cc4dddcf8af..148f6b24ff5 100644 --- a/core/web/resolver/testdata/config-empty-effective.toml +++ b/core/web/resolver/testdata/config-empty-effective.toml @@ -40,8 +40,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/core/web/resolver/testdata/config-full.toml b/core/web/resolver/testdata/config-full.toml index 957ffdc968e..67ddbb33efd 100644 --- a/core/web/resolver/testdata/config-full.toml +++ b/core/web/resolver/testdata/config-full.toml @@ -40,8 +40,6 @@ MaxBatchSize = 4321 SendInterval = '1m0s' SendTimeout = '5s' UseBatchSend = true -URL = '' -ServerPubKey = '' [[TelemetryIngress.Endpoints]] Network = 'EVM' diff --git a/core/web/resolver/testdata/config-multi-chain-effective.toml b/core/web/resolver/testdata/config-multi-chain-effective.toml index d5352a685c4..bd64ae04812 100644 --- a/core/web/resolver/testdata/config-multi-chain-effective.toml +++ b/core/web/resolver/testdata/config-multi-chain-effective.toml @@ -40,8 +40,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = true diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 421b0ea9dad..4ed88e7ca4b 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -244,8 +244,6 @@ LeaseRefreshInterval determines how often to refresh the lease lock. Also contro [TelemetryIngress] UniConn = true # Default Logging = false # Default -ServerPubKey = 'test-pub-key' # Example -URL = 'https://prom.test' # Example BufferSize = 100 # Default MaxBatchSize = 50 # Default SendInterval = '500ms' # Default @@ -266,18 +264,6 @@ Logging = false # Default ``` Logging toggles verbose logging of the raw telemetry messages being sent. -### ServerPubKey -```toml -ServerPubKey = 'test-pub-key' # Example -``` -ServerPubKey is the public key of the telemetry server. This field will be removed in a furture version - -### URL -```toml -URL = 'https://prom.test' # Example -``` -URL is where to send telemetry. This field will be removed in a furture version - ### BufferSize ```toml BufferSize = 100 # Default diff --git a/testdata/scripts/node/validate/default.txtar b/testdata/scripts/node/validate/default.txtar index 32a7e5f71b3..8a3c99ee8da 100644 --- a/testdata/scripts/node/validate/default.txtar +++ b/testdata/scripts/node/validate/default.txtar @@ -52,8 +52,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar index 9cca8764eed..187e4d16328 100644 --- a/testdata/scripts/node/validate/disk-based-logging-disabled.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-disabled.txtar @@ -96,8 +96,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar index d1658a1772d..cd61c8e477b 100644 --- a/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar +++ b/testdata/scripts/node/validate/disk-based-logging-no-dir.txtar @@ -96,8 +96,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/testdata/scripts/node/validate/disk-based-logging.txtar b/testdata/scripts/node/validate/disk-based-logging.txtar index 18ac99db785..f87352fd482 100644 --- a/testdata/scripts/node/validate/disk-based-logging.txtar +++ b/testdata/scripts/node/validate/disk-based-logging.txtar @@ -96,8 +96,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/testdata/scripts/node/validate/invalid.txtar b/testdata/scripts/node/validate/invalid.txtar index f048e35547e..f2f1f0a4ee1 100644 --- a/testdata/scripts/node/validate/invalid.txtar +++ b/testdata/scripts/node/validate/invalid.txtar @@ -86,8 +86,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/testdata/scripts/node/validate/valid.txtar b/testdata/scripts/node/validate/valid.txtar index 47c63e4c03e..0f99fb3f6d8 100644 --- a/testdata/scripts/node/validate/valid.txtar +++ b/testdata/scripts/node/validate/valid.txtar @@ -93,8 +93,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false diff --git a/testdata/scripts/node/validate/warnings.txtar b/testdata/scripts/node/validate/warnings.txtar index c6daa829ddb..01968ffd65d 100644 --- a/testdata/scripts/node/validate/warnings.txtar +++ b/testdata/scripts/node/validate/warnings.txtar @@ -75,8 +75,6 @@ MaxBatchSize = 50 SendInterval = '500ms' SendTimeout = '10s' UseBatchSend = true -URL = '' -ServerPubKey = '' [AuditLogger] Enabled = false