Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/services/chainlink: normalize feature config #14324

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions core/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ type AppConfig interface {
Threshold() Threshold
WebServer() WebServer
Tracing() Tracing

FeatureMultiFeedsManagers() bool
}

type DatabaseBackupMode string
Expand Down
1 change: 1 addition & 0 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
jobSpawner,
keyStore,
cfg,
cfg.Feature(),
cfg.Insecure(),
cfg.JobPipeline(),
cfg.OCR(),
Expand Down
4 changes: 0 additions & 4 deletions core/services/chainlink/config_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@ func (g *generalConfig) FeatureFeedsManager() bool {
return *g.c.Feature.FeedsManager
}

func (g *generalConfig) FeatureMultiFeedsManagers() bool {
return *g.c.Feature.MultiFeedsManagers
}

func (g *generalConfig) OCR() config.OCR {
return &ocrConfig{c: g.c.OCR}
}
Expand Down
45 changes: 0 additions & 45 deletions core/services/chainlink/mocks/general_config.go

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

5 changes: 4 additions & 1 deletion core/services/feeds/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (
type GeneralConfig interface {
OCR() coreconfig.OCR
Insecure() coreconfig.Insecure
FeatureMultiFeedsManagers() bool
}

type FeatureConfig interface {
MultiFeedsManagers() bool
}

type JobConfig interface {
Expand Down
7 changes: 5 additions & 2 deletions core/services/feeds/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ type service struct {
ocr2KeyStore keystore.OCR2
jobSpawner job.Spawner
gCfg GeneralConfig
featCfg FeatureConfig
insecureCfg InsecureConfig
jobCfg JobConfig
ocrCfg OCRConfig
Expand All @@ -143,6 +144,7 @@ func NewService(
jobSpawner job.Spawner,
keyStore keystore.Master,
gCfg GeneralConfig,
fCfg FeatureConfig,
insecureCfg InsecureConfig,
jobCfg JobConfig,
ocrCfg OCRConfig,
Expand All @@ -163,6 +165,7 @@ func NewService(
ocr1KeyStore: keyStore.OCR(),
ocr2KeyStore: keyStore.OCR2(),
gCfg: gCfg,
featCfg: fCfg,
insecureCfg: insecureCfg,
jobCfg: jobCfg,
ocrCfg: ocrCfg,
Expand All @@ -187,7 +190,7 @@ type RegisterManagerParams struct {
// RegisterManager registers a new ManagerService and attempts to establish a
// connection.
func (s *service) RegisterManager(ctx context.Context, params RegisterManagerParams) (int64, error) {
if s.gCfg.FeatureMultiFeedsManagers() {
if s.featCfg.MultiFeedsManagers() {
exists, err := s.orm.ManagerExists(ctx, params.PublicKey)
if err != nil {
return 0, err
Expand Down Expand Up @@ -1034,7 +1037,7 @@ func (s *service) Start(ctx context.Context) error {
return nil
}

if s.gCfg.FeatureMultiFeedsManagers() {
if s.featCfg.MultiFeedsManagers() {
s.lggr.Infof("starting connection to %d feeds managers", len(mgrs))
for _, mgr := range mgrs {
s.connectFeedManager(ctx, mgr, privkey)
Expand Down
2 changes: 1 addition & 1 deletion core/services/feeds/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func setupTestServiceCfg(t *testing.T, overrideCfg func(c *chainlink.Config, s *
keyStore.On("P2P").Return(p2pKeystore)
keyStore.On("OCR").Return(ocr1Keystore)
keyStore.On("OCR2").Return(ocr2Keystore)
svc := feeds.NewService(orm, jobORM, db, spawner, keyStore, gcfg, gcfg.Insecure(), gcfg.JobPipeline(), gcfg.OCR(), gcfg.OCR2(), legacyChains, lggr, "1.0.0", nil)
svc := feeds.NewService(orm, jobORM, db, spawner, keyStore, gcfg, gcfg.Feature(), gcfg.Insecure(), gcfg.JobPipeline(), gcfg.OCR(), gcfg.OCR2(), legacyChains, lggr, "1.0.0", nil)
svc.SetConnectionsManager(connMgr)

return &TestService{
Expand Down
Loading