Skip to content

*: fix lock share binding validation#4514

Merged
KaloyanTanev merged 10 commits into
mainfrom
fix/lock-share-binding-validation
May 8, 2026
Merged

*: fix lock share binding validation#4514
KaloyanTanev merged 10 commits into
mainfrom
fix/lock-share-binding-validation

Conversation

@HananINouman
Copy link
Copy Markdown
Contributor

@HananINouman HananINouman commented May 7, 2026

This PR hardens cluster lock validation to close a reported vulnerability where malformed validator entries could pass per-validator checks.

What changed

  • Enforce distributed validator key uniqueness across all validators in the lock.
  • Enforce public share uniqueness within each validator.
  • Validate full share-binding to the distributed key polynomial:
    • Reconstruct the DV key from the first threshold shares.
    • For every extra share beyond threshold, reconstruct again with a subset that includes that share and confirm it yields the same DV key.
  • Refactor reconstruction logic to use a dedicated tbls.RecoverPubkey path (Herumi-backed) and improve error context.
  • Remove the now-redundant identity-share guard because full share-binding verification supersedes it.
  • Add tests around extra-share polynomial consistency and pubkey recovery behavior.

Why

Previously, duplicated/malformed lock entries could satisfy local checks while still being structurally unsafe.
These checks ensure each validator’s shares are globally consistent with its distributed key and prevent duplicate-key lock entries from being accepted.

Compatibility / behavior

  • No API changes.
  • Validation is stricter by design; previously accepted malformed locks are now rejected.
  • Logic remains aligned with the equivalent fix in obol-sdk (fix/lock-share-binding-validation).

category: bug
ticket: none

HananINouman and others added 6 commits May 7, 2026 18:44
Enforce that threshold public shares reconstruct each validator distributed public key during lock signature verification to prevent inconsistent lock key material.

Co-authored-by: Cursor <cursoragent@cursor.com>
Fail lock signature verification when validator public shares contain duplicates to enforce one distinct share per operator.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 62.06897% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.15%. Comparing base (7e09491) to head (7b625d8).
⚠️ Report is 52 commits behind head on main.

Files with missing lines Patch % Lines
cluster/lock.go 67.79% 13 Missing and 6 partials ⚠️
tbls/herumi.go 46.15% 11 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4514      +/-   ##
==========================================
+ Coverage   56.48%   57.15%   +0.66%     
==========================================
  Files         244      245       +1     
  Lines       32550    33020     +470     
==========================================
+ Hits        18386    18871     +485     
+ Misses      11819    11775      -44     
- Partials     2345     2374      +29     

☔ View full report in Codecov by Sentry.
📢 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.

HananINouman and others added 2 commits May 7, 2026 20:14
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The polynomial check already catches identity shares in any position.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens cluster.Lock.VerifySignatures by validating that each distributed validator’s PubShares are well-formed and actually bind to (reconstruct) the declared distributed validator public key, preventing malformed or inconsistent lock files from being accepted.

Changes:

  • Add validation for duplicate distributed validator pubkeys, share count mismatches, duplicate shares, and share-to-DV-key reconstruction.
  • Validate that “extra” shares (beyond threshold) are consistent with the distributed key polynomial.
  • Add unit tests covering the new rejection cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
cluster/lock.go Adds share-binding validation during lock signature verification, including reconstruction checks and duplicate detection.
cluster/lock_test.go Adds tests to ensure malformed share bindings are rejected with expected errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cluster/lock.go
Comment thread cluster/lock.go Outdated
Comment thread cluster/lock.go Outdated
Comment thread cluster/lock.go Outdated
@KaloyanTanev KaloyanTanev requested a review from Copilot May 7, 2026 18:28
@KaloyanTanev KaloyanTanev changed the title Fix/lock share binding validation *: fix lock share binding validation May 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread cluster/lock.go
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@KaloyanTanev KaloyanTanev merged commit 764e780 into main May 8, 2026
15 of 17 checks passed
@KaloyanTanev KaloyanTanev deleted the fix/lock-share-binding-validation branch May 8, 2026 11:44
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