Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use structured concurrency for tss processes #160

Merged
merged 26 commits into from
May 9, 2023

Conversation

mpetrun5
Copy link
Collaborator

@mpetrun5 mpetrun5 commented Apr 17, 2023

This PR implements:

  • switch to go 1.19 (needed for the conc library) for syntax sugar
  • refactor coordinator and tss processes to use structured concurrency and fix all not closed routines
  • remove concurrency where not needed (handle of refresh and keygen events)

Sorry for the big change, but there were some problems with memory leaks before so wanted to make sure everything is properly cleaned up now when running singing, keygen and refresh.
@keks

The long running routines in the tss process are now running under the same context pool of routines and when 1 errors out or cancel is called manually they are all closed.
ExecuteProposals function now waits until coordinator Execute is over which waits until tss process is finished.

Related Issue Or Context

Closes: #159

How Has This Been Tested? Testing details.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation

@github-actions
Copy link
Contributor

Go Test coverage is 66.6 %\ ✨ ✨ ✨

@mpetrun5 mpetrun5 changed the title Structured concurrency feat: use structured concurrency for tss processes Apr 17, 2023
@mpetrun5 mpetrun5 marked this pull request as ready for review April 17, 2023 12:47
Copy link

@keks keks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey all, I have looked at the structured concurrency changes and I think think this is on a good path. My main comments relate to the way the goroutines are started around the TSS code (they do not only apply to the keygen code but resharing.go and signing.go as well). Also there still is an error channel being passed around, which could probably be removed by just returning the error.

I left some more comments in other places that I think would further improve the robustness of the concurrent code.

tss/common/base.go Outdated Show resolved Hide resolved
tss/common/base.go Outdated Show resolved Hide resolved
tss/common/base.go Show resolved Hide resolved
tss/keygen/keygen.go Outdated Show resolved Hide resolved
tss/keygen/keygen.go Outdated Show resolved Hide resolved
tss/coordinator.go Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

Go Test coverage is 66.7 %\ ✨ ✨ ✨

@github-actions
Copy link
Contributor

Go Test coverage is 66.9 %\ ✨ ✨ ✨

@mpetrun5
Copy link
Collaborator Author

Hey all, I have looked at the structured concurrency changes and I think think this is on a good path. My main comments relate to the way the goroutines are started around the TSS code (they do not only apply to the keygen code but resharing.go and signing.go as well). Also there still is an error channel being passed around, which could probably be removed by just returning the error.

I left some more comments in other places that I think would further improve the robustness of the concurrent code.

Hey, thanks for the comments.
Refactored the tss process so it returns an error now.
Please take another look.

@MakMuftic MakMuftic requested a review from keks May 8, 2023 09:02
@bashirabuamr
Copy link

Hey @MakMuftic @keks is unavailable for the time being, however he passed along that the PR looks good to approve. If you want to add me @bashirabuamr I can approve it on his behalf. We will mark it resolved in the Final Audit Report.

@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2023

Go Test coverage is 67.0 %\ ✨ ✨ ✨

comm/p2p/libp2p.go Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2023

Go Test coverage is 67.0 %\ ✨ ✨ ✨

@mpetrun5 mpetrun5 merged commit 986966f into main May 9, 2023
@mpetrun5 mpetrun5 deleted the mpetrun5/structured-concurrency branch May 9, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Structured Concurrency in the Relayer
5 participants