From 039bbd100bde3be67a0d2d080b648d987e7ca6a3 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Thu, 19 Dec 2024 13:03:15 -0500 Subject: [PATCH] Fix restore of config in blue-green mode The OCR3 database must be scoped to each instance, not to the job, otherwise we can restore the wrong config on node restart. --- core/services/llo/delegate.go | 4 ++-- core/services/ocr2/delegate.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/services/llo/delegate.go b/core/services/llo/delegate.go index ba4ddbb8fb0..c5c44761ada 100644 --- a/core/services/llo/delegate.go +++ b/core/services/llo/delegate.go @@ -69,12 +69,12 @@ type DelegateConfig struct { // One Oracle will be started for each ContractConfigTracker ContractConfigTrackers []ocr2types.ContractConfigTracker ContractTransmitter ocr3types.ContractTransmitter[llotypes.ReportInfo] - Database ocr3types.Database OCR3MonitoringEndpoint ocrcommontypes.MonitoringEndpoint OffchainConfigDigester ocr2types.OffchainConfigDigester OffchainKeyring ocr2types.OffchainKeyring OnchainKeyring ocr3types.OnchainKeyring[llotypes.ReportInfo] LocalConfig ocr2types.LocalConfig + NewOCR3DB func(pluginID int32) ocr3types.Database } func NewDelegate(cfg DelegateConfig) (job.ServiceCtx, error) { @@ -146,7 +146,7 @@ func (d *delegate) Start(ctx context.Context) error { V2Bootstrappers: d.cfg.V2Bootstrappers, ContractConfigTracker: configTracker, ContractTransmitter: d.cfg.ContractTransmitter, - Database: d.cfg.Database, + Database: d.cfg.NewOCR3DB(int32(i)), LocalConfig: d.cfg.LocalConfig, Logger: ocrLogger, MonitoringEndpoint: d.cfg.OCR3MonitoringEndpoint, diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index edcc816bf04..a11d6c9ee0f 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -1055,7 +1055,6 @@ func (d *Delegate) newServicesLLO( V2Bootstrappers: bootstrapPeers, ContractTransmitter: provider.ContractTransmitter(), ContractConfigTrackers: provider.ContractConfigTrackers(), - Database: ocrDB, LocalConfig: lc, OCR3MonitoringEndpoint: d.monitoringEndpointGen.GenMonitoringEndpoint(rid.Network, rid.ChainID, telemetryContractID, synchronization.OCR3Mercury), OffchainConfigDigester: provider.OffchainConfigDigester(), @@ -1064,6 +1063,9 @@ func (d *Delegate) newServicesLLO( // Enable verbose logging if either Mercury.VerboseLogging is on or OCR2.TraceLogging is on ReportingPluginConfig: datastreamsllo.Config{VerboseLogging: d.cfg.Mercury().VerboseLogging() || d.cfg.OCR2().TraceLogging()}, + NewOCR3DB: func(pluginID int32) ocr3types.Database { + return NewDB(d.ds, spec.ID, pluginID, lggr) + }, } oracle, err := llo.NewDelegate(cfg) if err != nil {