-
Couldn't load subscription status.
- Fork 5
feat: epoch blocks endpoints #244
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
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.
Just a very small nit, but nothing blocking :) well done!
common/src/messages.rs
Outdated
| /// First block time | ||
| pub first_block_time: u64, | ||
|
|
||
| /// First block height |
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.
Nit: these comments don't seem particularly necessary, since the variable names are quite clear. Is there a reason we need them? :3
| first_block_time: u64, | ||
|
|
||
| // first block height | ||
| first_block_height: u64, |
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.
Same nit applies here
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.
Looks good overall. The only change I would like to see is storing block numbers instead of block hashes in spo_state to reduce memory usage.
|
All requested changes have been implemented. Merging. |
Summary
This PR implements
/epochs/{number}/blocks/{pool_id}endpoints. And storefirst_block_heightandlast_block_heighttoepoch_statefor epoch's blocks distribution.Changes
New Features
/epochs/{number}/blocks/{pool_id}endpoint to retrieve block hashes minted by a specific pool during an epochfirst_block_heightandlast_block_heightfields toEpochActivityMessagefor epoch blocks distribution.Implementation Details
HashMap<KeyHash, Vector<BlockHash>>toHashMap<KeyHash, OrdMap<u64, Vector<BlockHash>>>to index blocks by epochget_pool_block_hashes: Now returnsResultand aggregates blocks across all epochsget_pool_block_hashes_by_epoch: New method to retrieve blocks for a specific epoch and pool