-
Notifications
You must be signed in to change notification settings - Fork 170
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
epoching: range query for epochs #289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Only a minor suggestion. One question about the usage of this API: what's the frequency of this API being called? I was asking because if this API is called upon every epoch, it does not seem very efficient as it returns all the epochs upon each call. Maybe a more efficient approach is to return recent epochs specified by a parameter and the caller can accumulate historical results.
@@ -21,6 +21,11 @@ service Query { | |||
option (google.api.http).get = "/babylon/epoching/v1/epochs/{epoch_num=*}"; | |||
} | |||
|
|||
// EpochsInfo range-queries the information of epochs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo range-query usually queries stuff in a range, which is specified by the parameter. But this API seems to return all the epoch information up to the latest.
// EpochsInfo range-queries the information of epochs | |
// EpochsInfo returns information of epochs from epoch 0 to the latest epoch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's paginated so will only return a limited number of epochs, depending on the pagination request. The main use case would be querying the latest X epochs in time order. Updated the comments to reflect this 👍
It's called only once for the explorer's epochs page. Specifically, the API backend will call this API to get metadata of a number of epochs, then get corresponding BTC checkpoint and finalisation status of them. |
Fixes BM-459
This PR adds a range query for epochs in order to support the epoch table in the explorer. This PR also has a fuzz test for it.