Skip to content

internal/plugincommon/discovery: don't error in Outcome from CCIPReader.Sync #899

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

Merged
merged 3 commits into from
May 8, 2025
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
9 changes: 8 additions & 1 deletion internal/plugincommon/discovery/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,15 @@ func (cdp *ContractDiscoveryProcessor) Outcome(
contracts[consts.ContractNameRouter] = routerConsensus

// call Sync to bind contracts.
// NOTE: since Sync may make network calls, it could potentially fail and we don't want to
// fail the entire outcome because of that. The reason being is that if this node is a leader
// of an OCR round, it will NOT be able to complete the round due to failing to compute the Outcome.
// TODO: we should move Sync calls to observation but that requires updates to the Outcome struct for discovery.
if err := (*cdp.reader).Sync(ctx, contracts); err != nil {
return dt.Outcome{}, fmt.Errorf("unable to sync contracts: %w", err)
lggr.Errorw(
"unable to sync contracts - this is usually due to RPC issues,"+
" please check your RPC endpoints and their health!",
"err", err)
}

return dt.Outcome{}, nil
Expand Down
5 changes: 2 additions & 3 deletions internal/plugincommon/discovery/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,8 @@ func TestContractDiscoveryProcessor_Outcome_ErrorSyncingContracts(t *testing.T)

ctx := tests.Context(t)
outcome, err := cdp.Outcome(ctx, discoverytypes.Outcome{}, discoverytypes.Query{}, aos)
assert.Error(t, err)
assert.ErrorIs(t, err, syncErr)
assert.Empty(t, outcome)
require.NoError(t, err)
require.Equal(t, outcome, discoverytypes.Outcome{})
}

func TestContractDiscoveryProcessor_ValidateObservation_HappyPath(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/reader/ccip_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ type CCIPReader interface {
LinkPriceUSD(ctx context.Context) (cciptypes.BigInt, error)

// Sync can be used to perform frequent syncing operations inside the reader implementation.
// Returns a bool indicating whether something was updated.
// NOTE: this method may make network calls.
Sync(ctx context.Context, contracts ContractAddresses) error

// GetLatestPriceSeqNr returns the latest price sequence number for the destination chain.
Expand Down
Loading