Skip to content

Conversation

@pinebit
Copy link
Collaborator

@pinebit pinebit commented Feb 2, 2026

Added threshold validation for RunDKG and RunReshareDKG. Previous behavior delegated the check down the stack to allow underlying library (kyber) to validate the threshold. Given that Kyber has weak validation that can lead to weird late errors, it is more convenient to verify the threshold upfront.

Additionally added verification such that users cannot remove all nodes with "remove operators" command.

category: refactor
ticket: none

@pinebit pinebit force-pushed the pinebit/threshold-validation branch from cb0b9d8 to 1656296 Compare February 2, 2026 09:01
Comment on lines 56 to 59
threshold := config.Threshold
if threshold == 0 {
threshold = cluster.Threshold(len(nodes))
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a plausible scenario if this is called from the CLI? If the default is 0, can we add a debug log here?

Can a user set a negative number? It might be worth it making it a uint?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Improved this in the new iteration. Thank you for the feedback!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 27.27273% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.66%. Comparing base (e1f4b2f) to head (6681ddd).

Files with missing lines Patch % Lines
dkg/pedersen/reshare.go 15.00% 14 Missing and 3 partials ⚠️
dkg/pedersen/dkg.go 46.15% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4268      +/-   ##
==========================================
+ Coverage   56.64%   56.66%   +0.02%     
==========================================
  Files         237      237              
  Lines       31332    31362      +30     
==========================================
+ Hits        17748    17772      +24     
- Misses      11311    11319       +8     
+ Partials     2273     2271       -2     

☔ 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.

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