diff --git a/.changeset/hip-clocks-joke.md b/.changeset/hip-clocks-joke.md new file mode 100644 index 00000000000..21f53718b22 --- /dev/null +++ b/.changeset/hip-clocks-joke.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal OracleFactory error handling change diff --git a/core/services/standardcapabilities/delegate.go b/core/services/standardcapabilities/delegate.go index 17e7cf5c12f..80a60c334fc 100644 --- a/core/services/standardcapabilities/delegate.go +++ b/core/services/standardcapabilities/delegate.go @@ -114,32 +114,28 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser return nil, fmt.Errorf("failed to create relayer set: %w", err) } - ocrKeyBundles, err := d.ks.OCR2().GetAll() + ocrEvmKeyBundles, err := d.ks.OCR2().GetAllOfType(chaintype.EVM) if err != nil { return nil, err } - if len(ocrKeyBundles) > 1 { - return nil, fmt.Errorf("expected exactly one OCR key bundle, but found: %d", len(ocrKeyBundles)) - } - - var ocrKeyBundle ocr2key.KeyBundle - if len(ocrKeyBundles) == 0 { - ocrKeyBundle, err = d.ks.OCR2().Create(ctx, chaintype.EVM) + var ocrEvmKeyBundle ocr2key.KeyBundle + if len(ocrEvmKeyBundles) == 0 { + ocrEvmKeyBundle, err = d.ks.OCR2().Create(ctx, chaintype.EVM) if err != nil { return nil, errors.Wrap(err, "failed to create OCR key bundle") } } else { - ocrKeyBundle = ocrKeyBundles[0] + if len(ocrEvmKeyBundles) > 1 { + log.Infof("found %d EVM OCR key bundles, which may cause unexpected behavior if using the OracleFactory", len(ocrEvmKeyBundles)) + } + ocrEvmKeyBundle = ocrEvmKeyBundles[0] } ethKeyBundles, err := d.ks.Eth().GetAll(ctx) if err != nil { return nil, err } - if len(ethKeyBundles) > 1 { - return nil, fmt.Errorf("expected exactly one ETH key bundle, but found: %d", len(ethKeyBundles)) - } var ethKeyBundle ethkey.KeyV2 if len(ethKeyBundles) == 0 { @@ -148,6 +144,9 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser return nil, errors.Wrap(err, "failed to create ETH key bundle") } } else { + if len(ethKeyBundles) > 1 { + log.Infof("found %d ETH key bundles, which may cause unexpected behavior if using the OracleFactory", len(ethKeyBundles)) + } ethKeyBundle = ethKeyBundles[0] } @@ -159,7 +158,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobORM: d.jobORM, JobID: spec.ID, JobName: spec.Name.ValueOrZero(), - KB: ocrKeyBundle, + KB: ocrEvmKeyBundle, Config: spec.StandardCapabilitiesSpec.OracleFactory, PeerWrapper: d.peerWrapper, RelayerSet: relayerSet, @@ -180,7 +179,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser JobORM: d.jobORM, JobID: spec.ID, JobName: spec.Name.ValueOrZero(), - KB: ocrKeyBundle, + KB: ocrEvmKeyBundle, Config: spec.StandardCapabilitiesSpec.OracleFactory, PeerWrapper: d.peerWrapper, RelayerSet: relayerSet,