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

Support for epoch winning bakers and first block queries. #999

Merged
merged 7 commits into from
Aug 18, 2023
Merged

Conversation

td202
Copy link
Contributor

@td202 td202 commented Aug 15, 2023

Purpose

Support GRPCv2 endpoints GetWinningBakersEpoch (for getting the list of bakers that won in a given epoch) and GetFirstBlockEpoch (for getting the first block in a given epoch).

Changes

  • Add a new query result code that represents when a query refers to a future epoch.
  • Implement getting the first finalized block of an epoch for both consensus versions.
  • Implement the GetWinningBakersEpoch endpoint (supports consensus v1 only).
  • Implement the GetFirstBlockEpoch endpoint (supports both consensus versions).

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

Copy link
Contributor

@MilkywayPirate MilkywayPirate left a comment

Choose a reason for hiding this comment

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

Looking good!
A few comments and questions.

Copy link
Contributor

@MilkywayPirate MilkywayPirate left a comment

Choose a reason for hiding this comment

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

Please update changelog.

Copy link
Contributor

@abizjak abizjak left a comment

Choose a reason for hiding this comment

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

As discussed in the office, it's a bit annoying that these two queries take a BlockHashInput (potentially) as argument but do not respond with the block hash that was used for the query.

But since they can also take an epoch number it is not always possible to return a block like it is for other queries that take just the BlockHashInput.

So it's probably the best if it stays like this.

And in the SDKs, we probably want to take only specific block hash, block height, or epoch number as arguments for the winning bakers to avoid mistakes.

@td202 td202 merged commit 556bc4e into main Aug 18, 2023
2 checks passed
@td202 td202 deleted the epoch-queries branch August 18, 2023 12:29
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.

3 participants