Skip to content

Commit

Permalink
Remove Explorer (#10581)
Browse files Browse the repository at this point in the history
* Remove the Explorer client

* Remove Explorer config

* Update mocks

* Update changelog

* Remove additional `ExplorerURL` references

* Generate docs

* Specify removed config in changelog

* Make error numbers sequential

* Update CHANGELOG.md

Co-authored-by: Patrick <[email protected]>

* Update docs/CHANGELOG.md

* Update docs/CHANGELOG.md

Co-authored-by: Jordan Krage <[email protected]>

---------

Co-authored-by: Patrick <[email protected]>
Co-authored-by: Jordan Krage <[email protected]>
  • Loading branch information
3 people authored Sep 14, 2023
1 parent 3f1ec39 commit c4557c1
Show file tree
Hide file tree
Showing 45 changed files with 25 additions and 1,168 deletions.
16 changes: 0 additions & 16 deletions core/chains/evm/config/mocks/chain_scoped_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions core/cmd/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func Test_initServerConfig(t *testing.T) {
fileNames: []string{testtomlutils.WriteTOMLFile(t, testConfigFileContents, "test.toml")},
secretsFiles: []string{
"../services/chainlink/testdata/mergingsecretsdata/secrets-database.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-explorer.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-password.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-pyroscope.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-prometheus.toml",
Expand All @@ -168,18 +167,6 @@ func Test_initServerConfig(t *testing.T) {
},
wantErr: true,
},
{
name: "reading multiple secrets with overrides: Explorer",
args: args{
opts: new(chainlink.GeneralConfigOpts),
fileNames: []string{testtomlutils.WriteTOMLFile(t, testConfigFileContents, "test.toml")},
secretsFiles: []string{
"../testdata/mergingsecretsdata/secrets-explorer.toml",
"../testdata/mergingsecretsdata/secrets-explorer.toml",
},
},
wantErr: true,
},
{
name: "reading multiple secrets with overrides: Password",
args: args{
Expand Down
1 change: 0 additions & 1 deletion core/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type AppConfig interface {
AuditLogger() AuditLogger
AutoPprof() AutoPprof
Database() Database
Explorer() Explorer
Feature() Feature
FluxMonitor() FluxMonitor
Insecure() Insecure
Expand Down
2 changes: 0 additions & 2 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# ExplorerURL is the websocket URL used by the node to push stats. This variable is required to deliver telemetry.
ExplorerURL = 'ws://explorer.url' # Example
# **ADVANCED**
# InsecureFastScrypt causes all key stores to encrypt using "fast" scrypt params instead. This is insecure and only useful for local testing. DO NOT ENABLE THIS IN PRODUCTION.
InsecureFastScrypt = false # Default
Expand Down
10 changes: 0 additions & 10 deletions core/config/docs/secrets.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ BackupURL = "postgresql://user:[email protected]:5432/dbname?sslmode
# Environment variable: `CL_DATABASE_ALLOW_SIMPLE_PASSWORDS`
AllowSimplePasswords = false # Default

[Explorer]
# AccessKey is the access key for authenticating with the Explorer.
#
# Environment variable: `CL_EXPLORER_ACCESS_KEY`
AccessKey = "access_key" # Example
# Secret is the secret for authenticating with the Explorer.
#
# Environment variable: `CL_EXPLORER_SECRET`
Secret = "secret" # Example

[Password]
# Keystore is the password for the node's account.
#
Expand Down
2 changes: 0 additions & 2 deletions core/config/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ var (
DatabaseAllowSimplePasswords = Var("CL_DATABASE_ALLOW_SIMPLE_PASSWORDS")
DatabaseURL = Secret("CL_DATABASE_URL")
DatabaseBackupURL = Secret("CL_DATABASE_BACKUP_URL")
ExplorerAccessKey = Secret("CL_EXPLORER_ACCESS_KEY")
ExplorerSecret = Secret("CL_EXPLORER_SECRET")
PasswordKeystore = Secret("CL_PASSWORD_KEYSTORE")
PasswordVRF = Secret("CL_PASSWORD_VRF")
PyroscopeAuthToken = Secret("CL_PYROSCOPE_AUTH_TOKEN")
Expand Down
9 changes: 0 additions & 9 deletions core/config/explorer_config.go

This file was deleted.

38 changes: 0 additions & 38 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ var ErrUnsupported = errors.New("unsupported with config v2")
type Core struct {
// General/misc
AppID uuid.UUID `toml:"-"` // random or test
ExplorerURL *models.URL
InsecureFastScrypt *bool
RootDir *string
ShutdownGracePeriod *models.Duration
Expand All @@ -57,9 +56,6 @@ type Core struct {

// SetFrom updates c with any non-nil values from f. (currently TOML field only!)
func (c *Core) SetFrom(f *Core) {
if v := f.ExplorerURL; v != nil {
c.ExplorerURL = v
}
if v := f.InsecureFastScrypt; v != nil {
c.InsecureFastScrypt = v
}
Expand Down Expand Up @@ -102,7 +98,6 @@ func (c *Core) ValidateConfig() (err error) {

type Secrets struct {
Database DatabaseSecrets `toml:",omitempty"`
Explorer ExplorerSecrets `toml:",omitempty"`
Password Passwords `toml:",omitempty"`
Pyroscope PyroscopeSecrets `toml:",omitempty"`
Prometheus PrometheusSecrets `toml:",omitempty"`
Expand Down Expand Up @@ -197,39 +192,6 @@ func (d *DatabaseSecrets) validateMerge(f *DatabaseSecrets) (err error) {
return err
}

type ExplorerSecrets struct {
AccessKey *models.Secret
Secret *models.Secret
}

func (e *ExplorerSecrets) SetFrom(f *ExplorerSecrets) (err error) {
err = e.validateMerge(f)
if err != nil {
return err
}

if v := f.AccessKey; v != nil {
e.AccessKey = v
}
if v := f.Secret; v != nil {
e.Secret = v
}

return nil
}

func (e *ExplorerSecrets) validateMerge(f *ExplorerSecrets) (err error) {
if e.AccessKey != nil && f.AccessKey != nil {
err = multierr.Append(err, configutils.ErrOverride{Name: "AccessKey"})
}

if e.Secret != nil && f.Secret != nil {
err = multierr.Append(err, configutils.ErrOverride{Name: "Secret"})
}

return err
}

type Passwords struct {
Keystore *models.Secret
VRF *models.Secret
Expand Down
17 changes: 2 additions & 15 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ type ChainlinkApplication struct {
ExternalInitiatorManager webhook.ExternalInitiatorManager
SessionReaper utils.SleeperTask
shutdownOnce sync.Once
explorerClient synchronization.ExplorerClient
srvcs []services.ServiceCtx
HealthChecker services.Checker
Nurse *services.Nurse
Expand Down Expand Up @@ -222,21 +221,10 @@ func NewApplication(opts ApplicationOpts) (Application, error) {

telemetryIngressClient := synchronization.TelemetryIngressClient(&synchronization.NoopTelemetryIngressClient{})
telemetryIngressBatchClient := synchronization.TelemetryIngressBatchClient(&synchronization.NoopTelemetryIngressBatchClient{})
explorerClient := synchronization.ExplorerClient(&synchronization.NoopExplorerClient{})
monitoringEndpointGen := telemetry.MonitoringEndpointGenerator(&telemetry.NoopAgent{})

if cfg.Explorer().URL() != nil && cfg.TelemetryIngress().URL() != nil {
globalLogger.Warn("Both ExplorerUrl and TelemetryIngress.Url are set, defaulting to Explorer")
}

if cfg.Explorer().URL() != nil {
explorerClient = synchronization.NewExplorerClient(cfg.Explorer().URL(), cfg.Explorer().AccessKey(), cfg.Explorer().Secret(), globalLogger)
monitoringEndpointGen = telemetry.NewExplorerAgent(explorerClient)
}

ticfg := cfg.TelemetryIngress()
// Use Explorer over TelemetryIngress if both URLs are set
if cfg.Explorer().URL() == nil && ticfg.URL() != nil {
if ticfg.URL() != nil {
if ticfg.UseBatchSend() {
telemetryIngressBatchClient = synchronization.NewTelemetryIngressBatchClient(ticfg.URL(),
ticfg.ServerPubKey(), keyStore.CSA(), ticfg.Logging(), globalLogger, ticfg.BufferSize(), ticfg.MaxBatchSize(), ticfg.SendInterval(), ticfg.SendTimeout(), ticfg.UniConn())
Expand All @@ -248,7 +236,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
monitoringEndpointGen = telemetry.NewIngressAgentWrapper(telemetryIngressClient)
}
}
srvcs = append(srvcs, explorerClient, telemetryIngressClient, telemetryIngressBatchClient)
srvcs = append(srvcs, telemetryIngressClient, telemetryIngressBatchClient)

backupCfg := cfg.Database().Backup()
if backupCfg.Mode() != config.DatabaseBackupModeNone && backupCfg.Frequency() > 0 {
Expand Down Expand Up @@ -471,7 +459,6 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
KeyStore: keyStore,
SessionReaper: sessions.NewSessionReaper(db.DB, cfg.WebServer(), globalLogger),
ExternalInitiatorManager: externalInitiatorManager,
explorerClient: explorerClient,
HealthChecker: healthChecker,
Nurse: nurse,
logger: globalLogger,
Expand Down
30 changes: 10 additions & 20 deletions core/services/chainlink/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,28 +129,24 @@ func (s *Secrets) SetFrom(f *Secrets) (err error) {
err = multierr.Append(err, config.NamedMultiErrorList(err1, "Database"))
}

if err2 := s.Explorer.SetFrom(&f.Explorer); err2 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err2, "Explorer"))
if err2 := s.Password.SetFrom(&f.Password); err2 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err2, "Password"))
}

if err3 := s.Password.SetFrom(&f.Password); err3 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err3, "Password"))
if err3 := s.Pyroscope.SetFrom(&f.Pyroscope); err3 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err3, "Pyroscope"))
}

if err4 := s.Pyroscope.SetFrom(&f.Pyroscope); err4 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err4, "Pyroscope"))
if err4 := s.Prometheus.SetFrom(&f.Prometheus); err4 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err4, "Prometheus"))
}

if err5 := s.Prometheus.SetFrom(&f.Prometheus); err5 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err5, "Prometheus"))
if err5 := s.Mercury.SetFrom(&f.Mercury); err5 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err5, "Mercury"))
}

if err6 := s.Mercury.SetFrom(&f.Mercury); err6 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err6, "Mercury"))
}

if err7 := s.Threshold.SetFrom(&f.Threshold); err7 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err7, "Threshold"))
if err6 := s.Threshold.SetFrom(&f.Threshold); err6 != nil {
err = multierr.Append(err, config.NamedMultiErrorList(err6, "Threshold"))
}

_, err = utils.MultiErrorList(err)
Expand Down Expand Up @@ -223,12 +219,6 @@ func (s *Secrets) setEnv() error {
s.Database.AllowSimplePasswords = new(bool)
*s.Database.AllowSimplePasswords = true
}
if explorerKey := env.ExplorerAccessKey.Get(); explorerKey != "" {
s.Explorer.AccessKey = &explorerKey
}
if explorerSecret := env.ExplorerSecret.Get(); explorerSecret != "" {
s.Explorer.Secret = &explorerSecret
}
if keystorePassword := env.PasswordKeystore.Get(); keystorePassword != "" {
s.Password.Keystore = &keystorePassword
}
Expand Down
35 changes: 0 additions & 35 deletions core/services/chainlink/config_explorer.go

This file was deleted.

20 changes: 0 additions & 20 deletions core/services/chainlink/config_explorer_test.go

This file was deleted.

12 changes: 0 additions & 12 deletions core/services/chainlink/config_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,18 +409,6 @@ func (g *generalConfig) ShutdownGracePeriod() time.Duration {
return g.c.ShutdownGracePeriod.Duration()
}

func (g *generalConfig) Explorer() config.Explorer {
return &explorerConfig{s: g.secrets.Explorer, explorerURL: g.c.ExplorerURL}
}

func (g *generalConfig) ExplorerURL() *url.URL {
u := (*url.URL)(g.c.ExplorerURL)
if *u == zeroURL {
u = nil
}
return u
}

func (g *generalConfig) FluxMonitor() config.FluxMonitor {
return &fluxMonitorConfig{c: g.c.FluxMonitor}
}
Expand Down
14 changes: 0 additions & 14 deletions core/services/chainlink/config_general_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,3 @@ func (g *generalConfig) DatabaseURL() url.URL {
func (g *generalConfig) DatabaseBackupURL() *url.URL {
return g.secrets.Database.BackupURL.URL()
}

func (g *generalConfig) ExplorerAccessKey() string {
if g.secrets.Explorer.AccessKey == nil {
return ""
}
return string(*g.secrets.Explorer.AccessKey)
}

func (g *generalConfig) ExplorerSecret() string {
if g.secrets.Explorer.Secret == nil {
return ""
}
return string(*g.secrets.Explorer.Secret)
}
8 changes: 0 additions & 8 deletions core/services/chainlink/config_general_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ func TestConfig_LogSQL(t *testing.T) {
//go:embed testdata/mergingsecretsdata/secrets-database.toml
var databaseSecretsTOML string

//go:embed testdata/mergingsecretsdata/secrets-explorer.toml
var explorerSecretsTOML string

//go:embed testdata/mergingsecretsdata/secrets-password.toml
var passwordSecretsTOML string

Expand All @@ -158,8 +155,6 @@ func TestConfig_SecretsMerging(t *testing.T) {
t.Run("verify secrets merging in GeneralConfigOpts.New()", func(t *testing.T) {
databaseSecrets, err := parseSecrets(databaseSecretsTOML)
require.NoErrorf(t, err, "error: %s", err)
explorerSecrets, err1 := parseSecrets(explorerSecretsTOML)
require.NoErrorf(t, err1, "error: %s", err1)
passwordSecrets, err2 := parseSecrets(passwordSecretsTOML)
require.NoErrorf(t, err2, "error: %s", err2)
pyroscopeSecrets, err3 := parseSecrets(pyroscopeSecretsTOML)
Expand All @@ -179,7 +174,6 @@ func TestConfig_SecretsMerging(t *testing.T) {
}
secretsFiles := []string{
"testdata/mergingsecretsdata/secrets-database.toml",
"testdata/mergingsecretsdata/secrets-explorer.toml",
"testdata/mergingsecretsdata/secrets-password.toml",
"testdata/mergingsecretsdata/secrets-pyroscope.toml",
"testdata/mergingsecretsdata/secrets-prometheus.toml",
Expand All @@ -196,8 +190,6 @@ func TestConfig_SecretsMerging(t *testing.T) {
assert.Equal(t, databaseSecrets.Database.URL.URL().String(), opts.Secrets.Database.URL.URL().String())
assert.Equal(t, databaseSecrets.Database.BackupURL.URL().String(), opts.Secrets.Database.BackupURL.URL().String())

assert.Equal(t, (string)(*explorerSecrets.Explorer.AccessKey), (string)(*opts.Secrets.Explorer.AccessKey))
assert.Equal(t, (string)(*explorerSecrets.Explorer.Secret), (string)(*opts.Secrets.Explorer.Secret))
assert.Equal(t, (string)(*passwordSecrets.Password.Keystore), (string)(*opts.Secrets.Password.Keystore))
assert.Equal(t, (string)(*passwordSecrets.Password.VRF), (string)(*opts.Secrets.Password.VRF))
assert.Equal(t, (string)(*pyroscopeSecrets.Pyroscope.AuthToken), (string)(*opts.Secrets.Pyroscope.AuthToken))
Expand Down
Loading

0 comments on commit c4557c1

Please sign in to comment.