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 PeerConfig for stake table committees #2702

Merged
merged 9 commits into from
Mar 3, 2025
Merged

Use PeerConfig for stake table committees #2702

merged 9 commits into from
Mar 3, 2025

Conversation

imabdulbasit
Copy link
Contributor

@imabdulbasit imabdulbasit commented Feb 28, 2025

This PR:

  • changes StakeTableEntry type to PeerConfig
  • changes return type of membership get functions to return Result

@imabdulbasit imabdulbasit changed the title change stake table entry to peer config for epoch committees Use PeerConfig for stake table committees Feb 28, 2025
.into_iter()
.map(|config| config.stake_table_entry)
.collect::<Vec<_>>();

justify_qc
.is_valid_cert(
Copy link
Contributor Author

@imabdulbasit imabdulbasit Feb 28, 2025

Choose a reason for hiding this comment

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

might be better to change this function signature to pass PeerConfig instead of StakeTableEntry but I'll leave it for now

@@ -31,56 +29,64 @@ pub trait Membership<TYPES: NodeType>: Debug + Send + Sync {
fn stake_table(
&self,
epoch: Option<TYPES::Epoch>,
) -> Vec<<TYPES::SignatureKey as SignatureKey>::StakeTableEntry>;
) -> Result<Vec<PeerConfig<TYPES::SignatureKey>>, Self::Error>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to wrap these returns in Result? All the impls seem infallible and the uses simply do something like unwrap_or_default().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was part of tech-debt that we discussed on zulip few weeks ago. Basically, we wanted this to return Option or Result. I agree that this doesn't do much because of unwrap_or_default() but that requires more work.

Copy link
Contributor

@mrain mrain left a comment

Choose a reason for hiding this comment

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

LGTM

@imabdulbasit imabdulbasit merged commit c1431fb into main Mar 3, 2025
51 checks passed
@imabdulbasit imabdulbasit deleted the ab/peerconfig branch March 3, 2025 13:49
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.

2 participants