Skip to content

fix/non-determinism-in-aggregator-order#1961

Merged
mchain0 merged 2 commits intomainfrom
fix/non-determinism-in-aggregator-order
Apr 3, 2026
Merged

fix/non-determinism-in-aggregator-order#1961
mchain0 merged 2 commits intomainfrom
fix/non-determinism-in-aggregator-order

Conversation

@mchain0
Copy link
Copy Markdown
Contributor

@mchain0 mchain0 commented Apr 3, 2026

with a multimodal tie (e.g. two distinct values each appear the same number of times, and that number still satisfies modeHasQuorum for the chosen quorum type), different processes can legitimately build modes in different orders and return different modes[0]. that breaks the expectation that all honest nodes compute the same aggregated value for the same observation multiset.

fix: after collecting tied modes, choose one deterministically - by ordering and returning the observation for the smallest SHA.

TDD test approach: the test calls mode 400 times with the same slice and requires every result to match the first under proto.Equal, before the fix it pretty quickly failed: iteration 13: mode() must pick the same tied winner on every call, and after the fix it passes.

@mchain0 mchain0 requested a review from a team as a code owner April 3, 2026 12:24
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

👋 mchain0, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-common

View full report

@mchain0 mchain0 requested a review from jmank88 April 3, 2026 12:51
jmank88
jmank88 previously approved these changes Apr 3, 2026
MStreet3
MStreet3 previously approved these changes Apr 3, 2026
Co-authored-by: Street <5597260+MStreet3@users.noreply.github.com>
@mchain0 mchain0 added this pull request to the merge queue Apr 3, 2026
Merged via the queue into main with commit 9f76f0c Apr 3, 2026
31 of 33 checks passed
@mchain0 mchain0 deleted the fix/non-determinism-in-aggregator-order branch April 3, 2026 14:50
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.

3 participants