Skip to content

fix: resolve two root causes of vrf v1 nightly race#22073

Closed
Fletch153 wants to merge 1 commit intodevelopfrom
fix/vrf-v1-race-central
Closed

fix: resolve two root causes of vrf v1 nightly race#22073
Fletch153 wants to merge 1 commit intodevelopfrom
fix/vrf-v1-race-central

Conversation

@Fletch153
Copy link
Copy Markdown
Collaborator

@Fletch153 Fletch153 commented Apr 19, 2026

Summary

@github-actions
Copy link
Copy Markdown
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

✅ No conflicts with other open PRs targeting develop

@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Apr 19, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
TestETHKeysController_Index_Errors The test failed without a specific error message, indicating an unspecified failure during execution. Logs ↗︎
TestETHKeysController_Index_Errors The test failed without a specific error message, indicating an unspecified failure during execution. Logs ↗︎
TestJobController_Create_HappyPath The test failed without a specific error message, indicating an unspecified failure during execution. Logs ↗︎
TestJobController_Create_HappyPath The test failed without a specific error message, indicating an unspecified failure during test execution. Logs ↗︎

... and 63 more

View Full Report ↗︎Docs

The scheduled go_core_race_tests job on develop reports three data races
in TestDelegate_InvalidLog. They trace to two independent root causes:

1. core/services/vrf/delegate_test.go double-spawns the v1 listener's
   head and log goroutines. Listener.Start already spawns both
   (listener_v1.go:154-155). The extra goroutines send to the unbuffered
   WaitOnStop channel, which Close drains exactly twice (listener_v1.go:
   519-520), so two goroutines leak per test. A leaked head listener can
   still invoke pipeline.Run → Debugw after t.done=true is written at
   testing.go:2023, racing with the stdlib's deliberately-unsynchronized
   test-completion flag.

2. core/internal/cltest.NewEthMocksWithStartupAssertions omits a
   BalanceAt expectation. The chain's default-enabled BalanceMonitor
   worker calls BalanceAt on the mock while its ctx is being cancelled
   by StopRChan.CtxCancel. Without an expectation, testify's
   m.fail → callString path uses %#v (mock.go:463), which reflects
   through *cancelCtx's unexported atomic.Value fields and races with
   the concurrent atomic stores in (*cancelCtx).cancel. Registering a
   Maybe() expectation routes calls through the happy path, which only
   uses %v via Stringer and never reflects.
@Fletch153 Fletch153 force-pushed the fix/vrf-v1-race-central branch from 39b7ae3 to 4573dc3 Compare April 20, 2026 10:47
@Fletch153 Fletch153 closed this Apr 20, 2026
@Fletch153 Fletch153 reopened this Apr 20, 2026
c.On("CodeAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return([]byte{}, nil)
c.On("NonceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(uint64(0), nil)
c.On("PendingNonceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(uint64(0), nil)
c.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(big.NewInt(0), nil)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I thought we tried this? Don't some callers set it themselves with different values? Great if not though

Comment on lines -201 to -207
// Start the listenerV1
go func() {
listener.RunLogListener([]func(){}, 6)
}()
go func() {
listener.RunHeadListener(func() {})
}()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, still passes?

@cl-sonarqube-production
Copy link
Copy Markdown

@Fletch153
Copy link
Copy Markdown
Collaborator Author

Closing — helper-level BalanceAt mock in cltest.go breaks ~20 tests deterministically (testify first-match-wins absorbs per-test .Once() expectations). Will reopen targeted approach per #22042.

@Fletch153 Fletch153 closed this Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants