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

Flatten memberships into a single type #3867

Merged
merged 17 commits into from
Nov 25, 2024
Merged

Flatten memberships into a single type #3867

merged 17 commits into from
Nov 25, 2024

Conversation

tbro
Copy link
Contributor

@tbro tbro commented Nov 8, 2024

Needed for #3726

This PR:

Removes Memberships struct and updates Membership trait to support DA and Quorum w/ a single interface. Essentially, instead of having qourom_membership and committee_membership (DA) fields in most places we now have a single membership field. In some places, where only one of the membership types was previously used, the previous name is preserved. To obtain the correct data, we now have to call the correct method: membership.leader() for quorum membership.da_leader() for da.

This PR does not:

Shouldn't change behavior. It is only preparation for EspressoSystems/espresso-sequencer#2237

Key places to review:

The trait is used extensively and there are changes across many files.

  • The trait lives in crates/types/src/traits/election.rs
  • SimpleCert impls in crates/types/src/simple_certificate.rs

@tbro tbro requested a review from ss-es November 8, 2024 00:55
@tbro tbro changed the title Tb/pos/flatten members Flatten memberships into a single type Nov 8, 2024
@tbro tbro force-pushed the tb/pos/flatten-members branch 4 times, most recently from 0d9e849 to 859aa47 Compare November 11, 2024 22:39
@tbro tbro mentioned this pull request Nov 19, 2024
@tbro tbro force-pushed the tb/pos/flatten-members branch 2 times, most recently from dbd49cf to d4815f9 Compare November 19, 2024 20:21
Delete Memberships and replace functionality. Add some methods to
`Membership` trait to deal w/ collapsing into one type both kinds of
memberships (stake and DA).

  * avoid passing membership into `is_valid_cert
  * for DA, avoid proxying threshold through `Threshold` trait
  * remove `Topic` param from `Membership::new
  * Split cert impls by marker (#3891)
  * add membership methods to Cert trait
  * remove non-existent tests from justfile
We can keep the old name where we only have one membership type to
keep the diff smaller.
Copy link
Contributor

@ss-es ss-es left a comment

Choose a reason for hiding this comment

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

left some comments, but couldn't find the issue. I'll check a few more things

crates/examples/infra/mod.rs Outdated Show resolved Hide resolved
crates/examples/infra/mod.rs Outdated Show resolved Hide resolved
crates/task-impls/src/request.rs Outdated Show resolved Hide resolved
crates/testing/src/helpers.rs Outdated Show resolved Hide resolved
crates/testing/src/helpers.rs Show resolved Hide resolved
crates/types/src/simple_certificate.rs Show resolved Hide resolved
Always use quorum for leader selection
@tbro tbro marked this pull request as ready for review November 22, 2024 19:24
@tbro tbro requested a review from bfish713 as a code owner November 22, 2024 19:24
Copy link
Contributor

@ss-es ss-es left a comment

Choose a reason for hiding this comment

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

approving, but I think we should follow-up on some of the changes here (left some comments on Zulip)

Copy link
Contributor

@ss-es ss-es left a comment

Choose a reason for hiding this comment

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

oops, forgot one thing -- I think da_membership is the wrong name here

crates/testing/src/helpers.rs Outdated Show resolved Hide resolved
@tbro tbro requested a review from ss-es November 25, 2024 10:31
@tbro tbro merged commit 723dc4a into main Nov 25, 2024
17 checks passed
@tbro tbro deleted the tb/pos/flatten-members branch November 25, 2024 19:54
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.

4 participants