-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Most of these comments relate to improving error handling clarity in the reference implementation.
- In
hostpubkey_gen, currently aValueErroris raised whenhostseckeyis out of range. It would be clearer to wrap thepubkey_gen_plaincall in a try-except block, catching theValueErrorand raising aHostSeckeyErrorinstead.- The
participant_step1function already follows a similar pattern.
- The
- In
chilldkg.participant_step1, we should explicitly check iflen(random) != 32and raise a clearValueError. Currently, this condition causes a crash becauseencpedpop.participant_step1asserts it implicitly. - In
chilldkg.participant_step2:- We should add checks for [1] "Host secret key does not match any host public key" and [2]
hostseckeylength (32 bytes), similar to those present inparticipant_step1.- This seems to have been overlooked, as the documentation indicates that
step2raisesHostSeckeyError, but it doesn't currently do so.
- This seems to have been overlooked, as the documentation indicates that
- The docstring also fails to mention the
FaultyCoordinatorError.
- We should add checks for [1] "Host secret key does not match any host public key" and [2]
- The checks in
simplepedpop.participant_step1currently raiseValueErrororIndexError. It might be more consistent to replace these withassertstatements, similar toencpedpop.participant_step1. certeq_verifyraises aValueErrorfor an invalid certificate length, which callers (participant_finalize,coordinator_finalize, andrecover) propagate directly. It would be clearer if these callers caught thisValueErrorand raised their own specific exceptions instead.- Also, the docstring of
chilldkg.participant_finalizementions raisingFaultyCoordinatorError, but currently, this error is never actually raised. Implementing the above suggestion would resolve this discrepancy.
- Also, the docstring of
- The docstring of
chilldkg.participant_finalizecurrently misses mentioning thecmsg2argument.- This issue is already fixed in Serialize Messages as Bytes #88.
encpedpop.coordinator_step1currently raises aFaultyParticipantOrCoordinatorError. Should it instead raiseFaultyParticipantError?- Also, the docstring of
chilldkg.coordinator_step1does not currently mention this error.
- Also, the docstring of
- The
__all__list inchilldkg.pyis missingFaultyParticipantErrorandInvalidSignatureInCertificateError. - In
encpedpop.participant_step2, the current code snippet:
bip-frost-dkg/python/chilldkg_ref/encpedpop.py
Lines 227 to 228 in 1e34161
pads = decaps_multi(deckey, enckeys[idx], pubnonces, enc_context, idx) secshare = enc_secshare - Scalar.sum(*pads)
can be simplified to:secshare = decrypt_sum(deckey, enckeys[idx], pubnonces, enc_context, idx, enc_secshare)
Metadata
Metadata
Assignees
Labels
No labels