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

A few improvements to StakeAggregator #7705

Merged
merged 2 commits into from
Jan 27, 2023
Merged

A few improvements to StakeAggregator #7705

merged 2 commits into from
Jan 27, 2023

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Jan 26, 2023

This PR adds a specialization for AuthSignInfo. This will allow the stake aggregator reused much better in many other places. Specifically:

  1. Added epoch check to make sure AuthSignInfo is from the same epoch as committee
  2. Check that authority is valid (by checking that stake is > 0)
  3. By actively aggregating the signatures into a quorum signature and return it.

@lxfind lxfind requested a review from andll January 26, 2023 00:14
@lxfind lxfind marked this pull request as ready for review January 26, 2023 00:14
@vercel
Copy link

vercel bot commented Jan 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated
explorer ⬜️ Ignored (Inspect) Jan 27, 2023 at 4:30AM (UTC)
explorer-storybook ⬜️ Ignored (Inspect) Jan 27, 2023 at 4:30AM (UTC)
frenemies ⬜️ Ignored (Inspect) Jan 27, 2023 at 4:30AM (UTC)
wallet-adapter ⬜️ Ignored (Inspect) Jan 27, 2023 at 4:30AM (UTC)

}
InsertResult::QuorumReachedWithCert(cert) => Ok(cert),
InsertResult::QuorumReached => {
unreachable!("insert should only return QuorumReachedWithCert");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can avoid unreachable here by adding generic parameter to InsertResult.
insert_generic would return InsertResult<()> and insert would return InsertResult<Cert>. This way only one enum element is needed(QuorumReached)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. It does work though the translation from InsertResult<()> to InsertResult is a bit ugly.

@lxfind lxfind merged commit eaee14e into main Jan 27, 2023
@lxfind lxfind deleted the stake-agg-improve branch January 27, 2023 20:25
williampsmith pushed a commit that referenced this pull request Feb 3, 2023
This PR adds a specialization for AuthSignInfo. This will allow the
stake aggregator reused much better in many other places. Specifically:
1. Added epoch check to make sure AuthSignInfo is from the same epoch as
committee
2. Check that authority is valid (by checking that stake is > 0)
3. By actively aggregating the signatures into a quorum signature and
return it.
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