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

Use layered traits to dedup common coordinator code #37

Open
xoloki opened this issue Nov 19, 2023 · 0 comments
Open

Use layered traits to dedup common coordinator code #37

xoloki opened this issue Nov 19, 2023 · 0 comments
Assignees

Comments

@xoloki
Copy link
Collaborator

xoloki commented Nov 19, 2023

The original frost::Coordinator provided basic functionality, but the new fire::Coordinator does much more in terms of handling timeouts etc, even without the byzantine handling.

In a reasonable OO language, it would be trivial to pull the common code into a base class. Rust, sadly, is not reasonable in this way.

To make this work in Rust, do the following:

  1. define a coordinator::common::Coordinator trait, where we put common functionality
  2. define a coordinator::common::Fields trait, which has accessors for common fields
  3. common::Coordinator is a subtrait of common::Fields, which gives it access to needed fields
  4. fire::Coordinator will then impl both common traits, with some boilerplate to connect its data fields to the trait (this can be replaced by a macro)
  5. frost::Coordinator will do the same as fire::Coordinator. If they use a macro then they will actually manage to inherit code from the base trait in a reasonably sane way
@xoloki xoloki self-assigned this Nov 19, 2023
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

No branches or pull requests

1 participant