Skip to content

Commit

Permalink
pydoc: do not replace bold by italics for should/must
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasnick committed Dec 9, 2024
1 parent 71d3a8d commit 2357d57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ TODO Refer to the FROST signing BIP instead, once that one has a number.
*Arguments*:

- `hostseckey` - This participant's long-term secret key (32 bytes).
The key *must* be 32 bytes of cryptographically secure randomness
The key **must** be 32 bytes of cryptographically secure randomness
with sufficient entropy to be unpredictable. All outputs of a
successful participant in a session can be recovered from (a backup
of) the key and per-session recovery data.
Expand Down Expand Up @@ -641,9 +641,9 @@ A `SessionParams` tuple holds the common parameters of a DKG session.
- `hostpubkeys` - Ordered list of the host public keys of all participants.
- `t` - The participation threshold `t`.
This is the number of participants that will be required to sign.
It *must* hold that `1 <= t <= len(hostpubkeys)` and `t <= 2^32 - 1`.
It must hold that `1 <= t <= len(hostpubkeys)` and `t <= 2^32 - 1`.

Participants *must* ensure that they have obtained authentic host
Participants **must** ensure that they have obtained authentic host
public keys of all the other participants in the session to make
sure that they run the DKG and generate a threshold public key with
the intended set of participants. This is analogous to traditional
Expand All @@ -656,15 +656,14 @@ A `SessionParams` tuple holds the common parameters of a DKG session.
where the participants need to obtain authentic individual public
keys of the other participants to generate an aggregated public key.

All participants and the coordinator in a session *must* be given an identical
`SessionParams` tuple. In particular, the host public keys *must* be in the
same order. This will make sure that honest participants agree on the order
as part of the session, which is useful if the order carries an implicit
meaning in the application (e.g., if the first `t` participants are the
primary participants for signing and the others are fallback participants).
If there is no canonical order of the participants in the application, the
caller can sort the list of host public keys with the [KeySort algorithm
specified in
DKG session will fail if the participants and the coordinator in a session
don't have the hostpubkeys in the same order. This will make sure that honest
participants agree on the order as part of the session, which is useful if the
order carries an implicit meaning in the application (e.g., if the first `t`
participants are the primary participants for signing and the others are
fallback participants). If there is no canonical order of the participants in
the application, the caller can sort the list of host public keys with the
[KeySort algorithm specified in
BIP327](https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki#key-sorting)
to abstract away from the order.

Expand Down Expand Up @@ -736,7 +735,7 @@ Perform a participant's first step of a ChillDKG session.
*Returns*:

- `ParticipantState1` - The participant's session state after this step, to
be passed as an argument to `participant_step2`. The state *must not*
be passed as an argument to `participant_step2`. The state **must not**
be reused (i.e., it must be passed only to one
`participant_step2` call).
- `ParticipantMsg1` - The first message to be sent to the coordinator.
Expand Down Expand Up @@ -772,8 +771,8 @@ Perform a participant's second step of a ChillDKG session.
*Returns*:

- `ParticipantState2` - The participant's session state after this step, to
be passed as an argument to `participant_finalize`. The state *must
not* be reused (i.e., it must be passed only to one
be passed as an argument to `participant_finalize`. The state **must
not** be reused (i.e., it must be passed only to one
`participant_finalize` call).
- `ParticipantMsg2` - The second message to be sent to the coordinator.

Expand Down Expand Up @@ -815,8 +814,8 @@ function.

*Warning:*
Changing perspectives, this implies that even when obtaining a
`SessionNotFinalizedError`, you *must not* conclude that the DKG session has
failed, and as a consequence, you *must not* erase the hostseckey. The underlying
`SessionNotFinalizedError`, you **must not** conclude that the DKG session has
failed, and as a consequence, you **must not** erase the hostseckey. The underlying
reason is that some other participant may deem the DKG session successful
and use the resulting threshold public key (e.g., by sending funds to it).
That other participant can, at any point in the future, wish to convince us
Expand Down
6 changes: 4 additions & 2 deletions update-pydoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ for i in "chilldkg,Tuples" "util,Expection"; do
pydoc-markdown -I python/chilldkg_ref -m "$module" "{renderer: {type: markdown, insert_header_anchors: false, render_module_header: no, format_code: no, header_level_by_type: {\"Function\": 4, \"Class\": 4, \"Method\": 5}, descriptive_class_title: \"$ ${class_title}\" }}" |
# Remove header
sed -z 's/[^#]*#/#/' |
# Replace bold (**) by italics (*)
sed -z 's/\*\*/*/g' >> pydoc.md
# Replace bold (**) by italics (*), but not for **must**, **must not**,
# **should**, or **should not**.
python3 -c "import re, sys; sys.stdout.write(re.sub(r'\*\*(?!must\*\*|should\*\*|must not\*\*|should not\*\*)(.*?)\*\*', r'*\1*', sys.stdin.read()))" >> pydoc.md

done

# Remove trailing newline
Expand Down

0 comments on commit 2357d57

Please sign in to comment.