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

Refrains From Explicitly Requesting New OCR Rounds #11656

Merged
merged 2 commits into from
Jan 5, 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
19 changes: 19 additions & 0 deletions integration-tests/actions/ocr_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,25 @@ func StartNewRound(
return nil
}

// WatchNewRound watches for a new OCR round, similarly to StartNewRound, but it does not explicitly request a new
// round from the contract, as this can cause some odd behavior in some cases
func WatchNewRound(
roundNumber int64,
ocrInstances []contracts.OffchainAggregator,
client blockchain.EVMClient,
logger zerolog.Logger,
) error {
for i := 0; i < len(ocrInstances); i++ {
ocrRound := contracts.NewOffchainAggregatorRoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), client.GetNetworkConfig().Timeout.Duration, logger)
client.AddHeaderEventSubscription(ocrInstances[i].Address(), ocrRound)
err := client.WaitForEvents()
if err != nil {
return fmt.Errorf("failed to wait for event subscriptions of OCR instance %d: %w", i+1, err)
}
}
return nil
}

// SetAdapterResponse sets a single adapter response that correlates with an ocr contract and a chainlink node
func SetAdapterResponse(
response int,
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/forwarder_ocr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestForwarderOCRBasic(t *testing.T) {

err = actions.CreateOCRJobsWithForwarderLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockAdapter, env.EVMClient.GetChainID().String())
require.NoError(t, err, "failed to setup forwarder jobs")
err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l)
err = actions.WatchNewRound(1, ocrInstances, env.EVMClient, l)
require.NoError(t, err)
err = env.EVMClient.WaitForEvents()
require.NoError(t, err, "Error waiting for events")
Expand All @@ -79,7 +79,7 @@ func TestForwarderOCRBasic(t *testing.T) {

err = actions.SetAllAdapterResponsesToTheSameValueLocal(10, ocrInstances, workerNodes, env.MockAdapter)
require.NoError(t, err)
err = actions.StartNewRound(2, ocrInstances, env.EVMClient, l)
err = actions.WatchNewRound(2, ocrInstances, env.EVMClient, l)
require.NoError(t, err)
err = env.EVMClient.WaitForEvents()
require.NoError(t, err, "Error waiting for events")
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/smoke/ocr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestOCRBasic(t *testing.T) {
err = actions.CreateOCRJobsLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockAdapter, env.EVMClient.GetChainID())
require.NoError(t, err)

err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l)
err = actions.WatchNewRound(1, ocrInstances, env.EVMClient, l)
require.NoError(t, err)

answer, err := ocrInstances[0].GetLatestAnswer(testcontext.Get(t))
Expand All @@ -56,7 +56,7 @@ func TestOCRBasic(t *testing.T) {

err = actions.SetAllAdapterResponsesToTheSameValueLocal(10, ocrInstances, workerNodes, env.MockAdapter)
require.NoError(t, err)
err = actions.StartNewRound(2, ocrInstances, env.EVMClient, l)
err = actions.WatchNewRound(2, ocrInstances, env.EVMClient, l)
require.NoError(t, err)

answer, err = ocrInstances[0].GetLatestAnswer(testcontext.Get(t))
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestOCRJobReplacement(t *testing.T) {
err = actions.CreateOCRJobsLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockAdapter, env.EVMClient.GetChainID())
require.NoError(t, err)

err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l)
err = actions.WatchNewRound(1, ocrInstances, env.EVMClient, l)
require.NoError(t, err)

answer, err := ocrInstances[0].GetLatestAnswer(testcontext.Get(t))
Expand All @@ -103,7 +103,7 @@ func TestOCRJobReplacement(t *testing.T) {

err = actions.SetAllAdapterResponsesToTheSameValueLocal(10, ocrInstances, workerNodes, env.MockAdapter)
require.NoError(t, err)
err = actions.StartNewRound(2, ocrInstances, env.EVMClient, l)
err = actions.WatchNewRound(2, ocrInstances, env.EVMClient, l)
require.NoError(t, err)

answer, err = ocrInstances[0].GetLatestAnswer(testcontext.Get(t))
Expand All @@ -120,7 +120,7 @@ func TestOCRJobReplacement(t *testing.T) {
err = actions.CreateOCRJobsLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockAdapter, env.EVMClient.GetChainID())
require.NoError(t, err)

err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l)
err = actions.WatchNewRound(1, ocrInstances, env.EVMClient, l)
require.NoError(t, err)

answer, err = ocrInstances[0].GetLatestAnswer(testcontext.Get(t))
Expand Down
Loading