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

BCFR-1081: Fix flaky LogPoller testhelper deployment #15579

Merged
Merged
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
8 changes: 8 additions & 0 deletions core/chains/evm/logpoller/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,19 @@ func SetupTH(t testing.TB, opts logpoller.Opts) TestHarness {
opts.PollPeriod = 1 * time.Hour
}
lp := logpoller.NewLogPoller(o, esc, lggr, headTracker, opts)

pendingNonce, err := backend.Client().PendingNonceAt(testutils.Context(t), owner.From)
require.NoError(t, err)

owner.Nonce = big.NewInt(0).SetUint64(pendingNonce)
emitterAddress1, _, emitter1, err := log_emitter.DeployLogEmitter(owner, backend.Client())
require.NoError(t, err)

owner.Nonce.Add(owner.Nonce, big.NewInt(1)) // Avoid race where DeployLogEmitter returns before PendingNonce has been incremented
emitterAddress2, _, emitter2, err := log_emitter.DeployLogEmitter(owner, backend.Client())
require.NoError(t, err)
backend.Commit()
owner.Nonce = nil // Just use pending nonce after this

return TestHarness{
Lggr: lggr,
Expand Down
Loading