Skip to content

feat(minibf): implement /epochs/{number}/stakes endpoint - #1152

Open
mmahut wants to merge 1 commit into
mmahut/epoch-stake-logfrom
mmahut/epoch-stakes
Open

feat(minibf): implement /epochs/{number}/stakes endpoint#1152
mmahut wants to merge 1 commit into
mmahut/epoch-stake-logfrom
mmahut/epoch-stakes

Conversation

@mmahut

@mmahut mmahut commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Implements /epochs/{number}/stakes (#1082).

Serves the per-account stake distribution from the account-stakes log 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.

@mmahut
mmahut requested a review from scarmuega as a code owner July 31, 2026 22:25
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5979a2cc-1019-4cf0-be89-4c2b79368d66

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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}/stakes route that scans AccountStakeLog entries for the epoch-start temporal key, filters zero-amount rows, and maps results to Blockfrost models.
  • Extend synthetic test seeding to write AccountStakeLog rows 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.

Comment on lines +124 to +125
let pagination = Pagination::try_from(params)?;

Comment on lines +144 to +147
let inner = domain.inner.clone();
let skip = pagination.skip();
let count = pagination.count;

@mmahut
mmahut force-pushed the mmahut/epoch-stakes branch from d6ecc38 to 2e67328 Compare July 31, 2026 22:45
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