More clarity in threshold sign comments#30
Merged
Conversation
jordanschalm
approved these changes
Jul 10, 2025
| // For safety, the function attemps the reconstruction and only returns a signature that is valid against the group public key. | ||
| // This is done by first reconstructing the signature and then validating it against the group public key. | ||
| // The reconstructed may fail the validation if at least one signature share added via `TrustedAdd` is invalid. | ||
| // The threshold signature is reconstructed only once and is cached for subsequent calls. |
Member
There was a problem hiding this comment.
A literal reading of this comment implies it, but I assume we don't cache reconstructed signatures that fail validation? 😄
Collaborator
Author
There was a problem hiding this comment.
Yes an invalid reconstructed signature isn't cached, I'll update the wording. However, your question raises a useful point: Since the invalid signature isn't cached, the function would attempt a reconstruction each time it is called, which is useless because there is no way currently to update the internal state of signature shares, once we reach the threshold of shares. All reconstructed signatures in the current code are computed from the same internal state and are equal.
There are two ways to improve this:
- cache the invalidity of the reconstructed signature so that we don't attempt a new reconstruction each time. Once set, this flag is immutable (because the internal state is immutable).
- add a new API to remove signature shares, which is useful to remove invalid shares. This allows to continue updating the internal state and not have it fixed at some point.
I can update this in a subsequent PR, my preference is the second option.
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.
No description provided.