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

zoneconcierge: API for listing the last checkpointed headers #254

Merged
merged 2 commits into from
Dec 22, 2022

Conversation

SebastianElvis
Copy link
Member

Fixes BM-394

This PR implements the ListHeaders API. Given a chain ID and a pagination request, the API outputs a list of headers w.r.t. the pagination request.

This API allows the explorer to query the latest CZ headers checkpointed by Babylon. Note that one needs to specify Reverse to be true in PageRequest so that the API returns the latest headers (rather than earliest ones).

Copy link
Member

@vitsalis vitsalis left a comment

Choose a reason for hiding this comment

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

This is a useful query! Although I expect it to get bloated if the clients are updated all too often. I think the following queries might be useful:

  1. Retrieve the latest headers submitted for each epoch. This information would be useful, especially when epochs are listed to demonstrate the latest header that we have for an epoch and a corresponding checkpoint. The previous headers for that particular epoch don't have too much value.
  2. Retrieve the headers submitted for a particular epoch.

@SebastianElvis
Copy link
Member Author

  • Retrieve the latest headers submitted for each epoch. This information would be useful, especially when epochs are listed to demonstrate the latest header that we have for an epoch and a corresponding checkpoint. The previous headers for that particular epoch don't have too much value.

Yep this can be done. Created a ticket for it. Do we need a query for getting the latest header in a certain epoch as well? I remember we mentioned this before and there was a ticket for it.

  • Retrieve the headers submitted for a particular epoch.

This can be done as well. One minor concern is that this could lead to some overhead given the current KVStore schema. Basically the node needs to find the last header in the given epoch, find the last header in the previous epoch, then find all headers between these two headers. This leads to O(m) complexity where m is the epoch interval, but I'm not sure whether the iterator in KVStore has any optimisation for it or not. Wdyt?

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