move FinalizeLatest inside the tx sending loop#22614
Conversation
|
I see you updated files related to
|
|
✅ No conflicts with other open PRs targeting |
There was a problem hiding this comment.
Pull request overview
Risk Rating: LOW (changes are confined to integration test utilities, but can impact CI stability/flakiness)
This PR updates the Functions OCR2 v1 integration test utilities to mine/finalize after each request transaction, reducing the likelihood of nonce collisions (e.g., “replacement transaction underpriced”) when sending multiple requests in quick succession.
Changes:
- Move
client.FinalizeLatest(t, b)inside the per-request send loop to commit/finalize after eachSendRequest. - Rename the loop variable (
client→cc) to avoid shadowing the importedclientpackage. - Refactor the response-validation goroutine spawning to use
wg.Go(...).
Scrupulous human review recommended (high impact on CI behavior):
ClientTestRequestsrequest-sending loop (FinalizeLatestplacement): verifyFinalizeLatestis the correct mechanism to advance nonce state on the backend and doesn’t introduce excessive test runtime.
| // require/gomega assertions call t.FailNow which must run on the test goroutine; | ||
| // calling them from spawned goroutines panics or behaves unpredictably, so we | ||
| // poll without assertions in the goroutines and fail here on the main goroutine. |
There was a problem hiding this comment.
Typically assert can be used instead of require. Errors are fine off the main goroutine. Only fatal is a problem.
There was a problem hiding this comment.
True, but from what I see, when Eventually times out it calls t.Fatalf, which afaik should not be used in goroutines
There was a problem hiding this comment.
Yeah but that is just gomega. The require and assert packages have their own versions:
https://pkg.go.dev/github.com/stretchr/testify/assert#Eventually
There was a problem hiding this comment.
@jmank88 wasn't aware assert also has such a function. Switched to it. Pls review again.
|





commit after each tx to avoid nonce collisions like this one:
MQ failure: https://github.com/smartcontractkit/chainlink/actions/runs/26240637562/job/77225788271