Repository navigation
Replace the RNG criterion that latched healthy co-signers with one that catches partial fills - #1073
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ealthy draws never hit
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.
Both RNG health checks refused healthy randomness often enough to take a working co-signer out of service, and a refusal latches the node until an operator clears it. This replaces the criterion responsible with one that refuses more of what matters and does not fire on a sound source.
The criterion it replaces
It refused any byte position holding
0x00, or0xff, in every sample. That is wrong in rate and in coverage.Rate. A given position does that in three independent random samples with probability 1 in 256³, and there are 32 positions and two extreme values, so a sound source fails about once in 260,000 calls. Measured on the OS source:
The checked draws are pure OS output and match the analytic 11.4 closely; the periodic figure, from two calls per check, is within ordinary variance of its expected 7.6. Two consequences in production:
It surfaced as a CI failure on Windows, in a test that generates up to 64 dealer keys.
Coverage. It caught positions frozen at an extreme value, any number of them, and never a position frozen at any other value. The failure worth catching is a source that fills only part of what it is asked for and leaves the rest as it was. That matters because several draws turn bytes straight into a scalar with no hash between: the dealer's key, every polynomial coefficient, refresh and repair deltas, and the DKG proof-of-knowledge nonce. Twelve frozen bytes there leave 160 bits in known positions, about 2^80 work to recover, and the remaining criteria (no all-zero sample, all distinct, every pair at least 64 bits apart) do not catch it until roughly half the bytes are frozen. Signing nonces are not exposed this way, since they are derived through a hash of the random bytes and the share.
The replacement
Count the byte positions that hold the same value, whatever it is, across every sample, and refuse at four or more. Applied in both the periodic check and the checked draw.
A position matches across three independent samples with probability 1 in 65,536, so four or more of 32 doing so is a binomial tail of about 2 × 10⁻¹⁵, the same order as the Hamming floor. No healthy node latches on it. What it lets through, one to three frozen positions, leaves at least 232 bits per sample.
It only runs across three or more samples. Across two, a position matches with probability 1 in 256 and four of 32 matching becomes about 8 × 10⁻⁶ per call, the rate this exists to get away from. Both sites already judge at least three.
Tests
0x00is refused, in the checked draw and in the periodic check. Every pair is still distinct, nonzero and far apart, so nothing else sees it.0x5a, which the old criterion never caught.Each fails if the count is removed. Every existing degraded-source test still refuses: stuck, barely moving, alternating, all-zero, wide fills, and group keys from a stuck or alternating source. A stale doc saying the probe draws "until two have been judged", when it draws until three, is corrected.