dkg: validate cluster definition threshold - #4634
Open
pinebit wants to merge 2 commits into
Open
Conversation
Reject cluster definitions with a threshold below 2 or above the number of operators, and log a warning when the threshold differs from the recommended ceil(2n/3) value. Previously charon dkg ran the ceremony silently with any threshold, unlike charon create dkg which validates and warns. category: bug ticket: none Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wrap the test write syncer with zapcore.Lock and restore the previous global logger on test cleanup. Previously Init*ForT replaced the global logger permanently, so tests running afterwards in the same package wrote to the test buffer, racing on unsynchronized writers when logging concurrently (caught by CI in dkg TestFrostDKG after TestCheckThreshold). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
pinebit
commented
Aug 10, 2026
Collaborator
Author
There was a problem hiding this comment.
There is a race condition in our logging, which is now fixed here
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4634 +/- ##
==========================================
+ Coverage 58.16% 58.21% +0.05%
==========================================
Files 247 247
Lines 34056 34073 +17
==========================================
+ Hits 19807 19834 +27
+ Misses 11779 11762 -17
- Partials 2470 2477 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
Have you tested if the new logger works fine on loki/grafana? |
KaloyanTanev
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Add threshold validation to
charon dkg. The cluster definition threshold is now rejected with an error when below 2 or above the number of operators, and a warning is logged when it differs from the recommendedceil(2n/3)value.Previously
charon dkgran the ceremony with any threshold in the definition file.charon create dkgalready validates and warns on non-default thresholds, but definitions from other sources (URL, handcrafted JSON) reached the DKG ceremony unchecked. An unsafe threshold (e.g. 2 in a 4-operator cluster) allows fewer members than intended to reconstruct the validator key.The check runs after the definition is loaded, covering both the definition file path and the append-validators path.
Also makes the
app/logtest initializers (InitConsoleForT,InitJSONForT,InitLogfmtForT) safe for use in packages with concurrent logging: the write syncer is now wrapped withzapcore.Lockand the previous global logger is restored on test cleanup. Previously the initializers replaced the global logger permanently, so tests running afterwards in the same package wrote to the test buffer, racing on unsynchronized writers (caught by CI inTestFrostDKGrunning after the newTestCheckThreshold).category: bug
ticket: none