feat(minibf): add /epochs/{number}/blocks/{pool_id} endpoint - #1233
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughAdds ChangesPool-filtered epoch blocks
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🟡 Moderate · up to The change adds a pool-filtered epoch block endpoint and adjusts final-slot handling; without supplied successful lint, build, and test results, regressions in routing or scan behavior are not yet cleared, so merge should wait for those checks. Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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 the Blockfrost-compatible endpoint for listing blocks minted by a pool during an epoch.
Changes:
- Implements issuer-based block filtering with pagination.
- Registers and documents the endpoint.
- Adds endpoint and error-path tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
docs/content/apis/minibf.mdx |
Documents endpoint support. |
crates/minibf/src/routes/epochs/mod.rs |
Implements handler and tests. |
crates/minibf/src/lib.rs |
Registers the route. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
7fa4b35 to
9687f50
Compare
9687f50 to
43787c4
Compare
Closes #1102. Closes #1234.
Summary
Adds
GET /epochs/{number}/blocks/{pool_id}: the hashes of the blocks a pool minted in an epoch. Standardcount/page/orderpagination.Semantics (pinned against live Blockfrost)
decode_pool_id)200400404404200 []Implementation
A bounded epoch-range scan, as sketched in the issue — no new index.
archive().get_rangeover the epoch's slots. Match each block's issuer vkey hash against the pool. Runs inspawn_blocking. Stops when the page fills.descis the exact mirror ofasc.decode_block_headersteps over the[era_tag, [header, txs, ...]]wrapper and never parses transactions. ~10x on the worst epochs.404: a pool is known when it registered (PoolStateentity) or when the scan finds a block it minted. A pool must register before it can mint, so the entity check covers every real pool.Bug found on the way (#1234)
get_rangetreats its upper bound as exclusive. This endpoint and the pre-existing/epochs/{number}/blocksboth dropped a block minted on the epoch's final slot.Performance (measured, 346 GB mainnet archive)
Full scans are the common case:
404s, empty pages, and anycountthe pool's blocks don't fill all read the whole epoch (~21k blocks).count=1(early exit)Cold now beats warm by ~40%: flatfile I/O is the remaining floor, not CPU.
Testing
desc= reversedasc, empty page,400, both404s, archive fault500, final-slot regression.decode_block_header: equals the full decode on a Conway block, decodes the Shelley header shape,Nonefor Byron, error on malformed bytes.dolos-minibfsuite green (329 tests). Workspace clippy clean with-D warnings. Nightly fmt clean.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation