feat(minibf): implement /epochs/{number}/stakes endpoint - #1152
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds Blockfrost-compatible /epochs/{epoch}/stakes support to the minibf service by serving per-account epoch stake distribution from the archived account-stakes log (emitted by Cardano RUPD), with pagination and tests.
Changes:
- Implement
/epochs/{epoch}/stakesroute that scansAccountStakeLogentries for the epoch-start temporal key, filters zero-amount rows, and maps results to Blockfrost models. - Extend synthetic test seeding to write
AccountStakeLogrows and add endpoint tests (happy path, pagination, empty epoch, 404/400, fault handling). - Document the new endpoint in the minibf API docs and register the route in the router.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/content/apis/minibf.mdx | Documents /epochs/{epoch}/stakes as a supported minibf endpoint. |
| crates/testing/src/synthetic.rs | Adds a helper to seed per-epoch AccountStakeLog entries for integration tests. |
| crates/minibf/src/test_support.rs | Seeds account-stake logs in the synthetic domain builder and adds a helper to compute tip epoch for tests. |
| crates/minibf/src/routes/epochs/mod.rs | Implements the new /epochs/{epoch}/stakes handler and adds comprehensive route tests. |
| crates/minibf/src/lib.rs | Wires the new endpoint into the Axum router. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let pagination = Pagination::try_from(params)?; | ||
|
|
| let inner = domain.inner.clone(); | ||
| let skip = pagination.skip(); | ||
| let count = pagination.count; | ||
|
|
d6ecc38 to
2e67328
Compare
Implements
/epochs/{number}/stakes(#1082).Serves the per-account stake distribution from the
account-stakeslog added in the base PR. One key-range scan per page, Blockfrost pagination (count/page), 404 above the current epoch, zero-amount rows filtered out to match dbsync.Verified against hosted Blockfrost on preview and the known gap: the current epoch returns
[]until its RUPD emission lands, so we lag hosted Blockfrost by one epoch. A follow-up can close this by emitting from the mark snapshot as well. Epochs before the node's sync start have no rows.