fix: wait should timeout instead of checking at beginning of protocol#485
Merged
ChaoticTempest merged 2 commits intodevelopfrom Aug 21, 2025
Merged
fix: wait should timeout instead of checking at beginning of protocol#485ChaoticTempest merged 2 commits intodevelopfrom
ChaoticTempest merged 2 commits intodevelopfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a timeout handling issue in the chain-signatures protocol generators that was causing ongoing generators to never expire, leading to resource leaks. The fix moves timeout checking from the main protocol loop to the message receiving function, ensuring that generators properly timeout when waiting for messages.
- Moved timeout logic from main loop to message receiving for proper timeout handling
- Added dedicated
recv()methods with timeout for triple, signature, and presignature generators - Removed a TODO comment about timeout handling for votes in posit.rs
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
chain-signatures/node/src/protocol/triple.rs |
Added timeout-aware recv() method and removed loop-based timeout check |
chain-signatures/node/src/protocol/signature.rs |
Added timeout-aware recv() method and removed timeout() function |
chain-signatures/node/src/protocol/presignature.rs |
Added timeout-aware recv() method and removed loop-based timeout check |
chain-signatures/node/src/protocol/posit.rs |
Removed outdated TODO comment about timeout handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
volovyks
approved these changes
Aug 21, 2025
Contributor
volovyks
left a comment
There was a problem hiding this comment.
Make sense,
some day we will need to have some kind of abstraction on top of all the protocols. Lot's of things are repetitive.
jakmeier
approved these changes
Aug 21, 2025
jakmeier
added a commit
to jakmeier/mpc
that referenced
this pull request
Aug 28, 2025
Adds a test that would fail without the fix in sig-net#485
jakmeier
added a commit
to jakmeier/mpc
that referenced
this pull request
Aug 28, 2025
…protocol (sig-net#485)" This reverts commit 5775a93.
jakmeier
added a commit
to jakmeier/mpc
that referenced
this pull request
Aug 28, 2025
…protocol (sig-net#485)" This reverts commit 5775a93.
jakmeier
added a commit
that referenced
this pull request
Aug 29, 2025
* add regression test for presignature timeout Adds a test that would fail without the fix in #485 * make clippy happy * increase default triple timeout in test setup
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.
This is most likely what was causing our introduction issue. We should timeout not at the beginning of the protocol loop, but when trying to receive messages. This is because when awaiting for a message, it will stall till the next message, meaning we don't check the timeout until we get a new message if ever. This means that there will be a set of owned ongoing generators that will never wake up given that they receive no messages, which means our introduced "counter" never gets decremented since there will be live generators that never expire that contribute to this count.