Skip to content

core/validatorapi: preserve sync selections response order - #4641

Open
KaloyanTanev wants to merge 2 commits into
mainfrom
kalo/fix-sync-selections-order
Open

core/validatorapi: preserve sync selections response order#4641
KaloyanTanev wants to merge 2 commits into
mainfrom
kalo/fix-sync-selections-order

Conversation

@KaloyanTanev

@KaloyanTanev KaloyanTanev commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

SyncCommitteeSelections built its response by iterating a Go map, which randomizes order. Prysm matches response[i] to request[i] by array index, so shuffled order attaches proofs to wrong subcommittees - "signature not verified" 500s on submit_contribution_and_proofs.

Fix: build the response by iterating the original request slice instead of the map. Added a test that sends subcommittees in reverse order to catch this reliably.

category:bug
ticket:none

Build the response by iterating the original request slice instead of
the internal Go map, so response[i] corresponds to request[i]. Prysm
matches aggregated selection proofs to requests by array index; random
map iteration attached proofs to wrong subcommittees, causing
"signature not verified" 500s on submit_contribution_and_proofs.
@KaloyanTanev KaloyanTanev changed the title core/validatorapi: preserve SyncCommitteeSelections response order core/validatorapi: preserve sync selections response order Aug 11, 2026
@KaloyanTanev
KaloyanTanev requested a lite review from Copilot August 11, 2026 14:07
@KaloyanTanev KaloyanTanev self-assigned this Aug 11, 2026
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.17%. Comparing base (caefc2e) to head (b1bd8bb).

Files with missing lines Patch % Lines
core/validatorapi/validatorapi.go 71.42% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4641   +/-   ##
=======================================
  Coverage   58.16%   58.17%           
=======================================
  Files         247      247           
  Lines       34063    34065    +2     
=======================================
+ Hits        19814    19816    +2     
  Misses      11774    11774           
  Partials     2475     2475           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

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.

Pull request overview

Fixes incorrect ordering in SyncCommitteeSelections responses by avoiding Go map iteration order, ensuring validator clients that match responses by index (e.g., Prysm) receive proofs aligned to the original request order.

Changes:

  • Build SyncCommitteeSelections response by iterating the original request slice (preserving index order) rather than iterating the internal map.
  • Update existing tests to assert response order is preserved (instead of order-insensitive comparisons).
  • Add a new regression test that submits subcommittee selections in reverse order to reliably detect ordering regressions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
core/validatorapi/validatorapi.go Preserves request order when constructing the sync committee selections response.
core/validatorapi/validatorapi_test.go Strengthens order assertions and adds a regression test for response ordering.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/validatorapi/validatorapi_test.go Outdated
Avoid mutating shared package-level map state.
@KaloyanTanev
KaloyanTanev requested a review from pinebit August 11, 2026 16:15
@sonarqubecloud

Copy link
Copy Markdown

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