Skip to content

Commit

Permalink
[OPCORE-863]: fix(service): start multiple feeds managers (#14197)
Browse files Browse the repository at this point in the history
* fix(service): start multiple feeds managers

In order to support connection to multiple feed managers, when on start of the node, we want to  attempt to connect to list of registered feed managers.

* fix: feature flag for multi feeds managers

Introduce a new feature flag for enabling support for multi feeds managers.

* refactor(service): delete ListJobProposals

No longer used, since it was replaced by ListJobProposalsByManagersIDs

* [OPCORE-855]: fix: support creating more than 1 manager (#14225)

---------

Co-authored-by: Margaret Ma <[email protected]>
  • Loading branch information
graham-chainlink and eutopian authored Aug 29, 2024
1 parent 5fe6eff commit 7f69993
Show file tree
Hide file tree
Showing 42 changed files with 445 additions and 301 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-lobsters-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#changed Connect to multiple feeds managers on app start instead of just one (default to first)
5 changes: 5 additions & 0 deletions .changeset/moody-turkeys-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#changed Allow registration of more than 1 feeds manager on CreateFeedsManager
2 changes: 2 additions & 0 deletions core/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type AppConfig interface {
Threshold() Threshold
WebServer() WebServer
Tracing() Tracing

FeatureMultiFeedsManagers() bool
}

type DatabaseBackupMode string
Expand Down
2 changes: 2 additions & 0 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ LogPoller = false # Default
UICSAKeys = false # Default
# CCIP enables the CCIP service.
CCIP = true # Default
# MultiFeedsManagers enables support for multiple feeds manager connections.
MultiFeedsManagers = false # Default

[Database]
# DefaultIdleInTxSessionTimeout is the maximum time allowed for a transaction to be open and idle before timing out. See Postgres `idle_in_transaction_session_timeout` for more details.
Expand Down
1 change: 1 addition & 0 deletions core/config/feature_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ type Feature interface {
FeedsManager() bool
UICSAKeys() bool
LogPoller() bool
MultiFeedsManagers() bool
}
12 changes: 8 additions & 4 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,11 @@ func (p *PrometheusSecrets) validateMerge(f *PrometheusSecrets) (err error) {
}

type Feature struct {
FeedsManager *bool
LogPoller *bool
UICSAKeys *bool
CCIP *bool
FeedsManager *bool
LogPoller *bool
UICSAKeys *bool
CCIP *bool
MultiFeedsManagers *bool
}

func (f *Feature) setFrom(f2 *Feature) {
Expand All @@ -319,6 +320,9 @@ func (f *Feature) setFrom(f2 *Feature) {
if v := f2.CCIP; v != nil {
f.CCIP = v
}
if v := f2.MultiFeedsManagers; v != nil {
f.MultiFeedsManagers = v
}
}

type Database struct {
Expand Down
4 changes: 4 additions & 0 deletions core/services/chainlink/config_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ func (f *featureConfig) LogPoller() bool {
func (f *featureConfig) UICSAKeys() bool {
return *f.c.UICSAKeys
}

func (f *featureConfig) MultiFeedsManagers() bool {
return *f.c.MultiFeedsManagers
}
1 change: 1 addition & 0 deletions core/services/chainlink/config_feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ func TestFeatureConfig(t *testing.T) {
assert.True(t, f.LogPoller())
assert.True(t, f.FeedsManager())
assert.True(t, f.UICSAKeys())
assert.True(t, f.MultiFeedsManagers())
}
4 changes: 4 additions & 0 deletions core/services/chainlink/config_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ 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
10 changes: 6 additions & 4 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@ func TestConfig_Marshal(t *testing.T) {
}

full.Feature = toml.Feature{
FeedsManager: ptr(true),
LogPoller: ptr(true),
UICSAKeys: ptr(true),
CCIP: ptr(true),
FeedsManager: ptr(true),
LogPoller: ptr(true),
UICSAKeys: ptr(true),
CCIP: ptr(true),
MultiFeedsManagers: ptr(true),
}
full.Database = toml.Database{
DefaultIdleInTxSessionTimeout: commoncfg.MustNewDuration(time.Minute),
Expand Down Expand Up @@ -775,6 +776,7 @@ FeedsManager = true
LogPoller = true
UICSAKeys = true
CCIP = true
MultiFeedsManagers = true
`},
{"Database", Config{Core: toml.Core{Database: full.Database}}, `[Database]
DefaultIdleInTxSessionTimeout = '1m0s'
Expand Down
45 changes: 45 additions & 0 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.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FeedsManager = true
LogPoller = false
UICSAKeys = false
CCIP = true
MultiFeedsManagers = false

[Database]
DefaultIdleInTxSessionTimeout = '1h0m0s'
Expand Down
1 change: 1 addition & 0 deletions core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FeedsManager = true
LogPoller = true
UICSAKeys = true
CCIP = true
MultiFeedsManagers = true

[Database]
DefaultIdleInTxSessionTimeout = '1m0s'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FeedsManager = true
LogPoller = false
UICSAKeys = false
CCIP = true
MultiFeedsManagers = false

[Database]
DefaultIdleInTxSessionTimeout = '1h0m0s'
Expand Down
1 change: 1 addition & 0 deletions core/services/feeds/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type GeneralConfig interface {
OCR() coreconfig.OCR
Insecure() coreconfig.Insecure
FeatureMultiFeedsManagers() bool
}

type JobConfig interface {
Expand Down
117 changes: 59 additions & 58 deletions core/services/feeds/mocks/orm.go

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

Loading

0 comments on commit 7f69993

Please sign in to comment.