diff --git a/core/services/ocr2/plugins/mercury/integration_test.go b/core/services/ocr2/plugins/mercury/integration_test.go index 680b05bd4d4..7be5177f765 100644 --- a/core/services/ocr2/plugins/mercury/integration_test.go +++ b/core/services/ocr2/plugins/mercury/integration_test.go @@ -184,15 +184,17 @@ func integration_MercuryV1(t *testing.T) { bootstrapNode := Node{App: appBootstrap, KeyBundle: bootstrapKb} logObservers = append(logObservers, observedLogs) - // Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from - ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String()) - require.NoError(t, err) - finalityDepth := ch.Config().EVM().FinalityDepth() - for i := 0; i < int(finalityDepth); i++ { - backend.Commit() - } - - fromBlock := int(finalityDepth) // cannot use zero, start from finality depth + // cannot use zero, start from finality depth + fromBlock := func() int { + // Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from + ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String()) + require.NoError(t, err) + finalityDepth := ch.Config().EVM().FinalityDepth() + for i := 0; i < int(finalityDepth); i++ { + backend.Commit() + } + return int(finalityDepth) + }() // Set up n oracles var ( @@ -225,8 +227,7 @@ func integration_MercuryV1(t *testing.T) { createBridge := func(name string, i int, p *big.Int, borm bridges.ORM) (bridgeName string) { bridge := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - var b []byte - b, err = io.ReadAll(req.Body) + b, err := io.ReadAll(req.Body) require.NoError(t, err) require.Equal(t, `{"data":{"from":"ETH","to":"USD"}}`, string(b))