feat(minibf): implement /pools/retired endpoint - #1218
Conversation
List the pools that already retired. The scan reuses the `pools/extended` iteration over `PoolState`. It keeps the pools whose live snapshot has `is_retired` set, and reports `retiring_epoch` as the epoch. The endpoint sorts by retirement epoch. For pools that retire in the same epoch, it breaks the tie by `register_slot`. Blockfrost breaks the tie by the retirement announcement transaction, which our ledger model does not store. The two orders differ for one pair of pools in epoch 185, so two preview fixtures still fail. A separate issue will track the fix (add `retiring_slot` to `PoolState`). That fix changes the CBOR encoding of the `PoolState` entity, so it will require a resync. The test that covers this endpoint is defined in `vendor/blockfrost-tests/src/fixtures/preview/pools/retired.ts`.
|
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 (2)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe minibf service adds ChangesRetired pools endpoint
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This is a localized endpoint addition with no actionable merge-blocking risk remaining; merge after the normal build, lint, and test checks pass. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Client
participant all_retired
participant Facade
participant select_retired_pools
Client->>all_retired: GET /pools/retired with pagination
all_retired->>Facade: Load pool states
Facade-->>all_retired: Return pool states or an error
all_retired->>select_retired_pools: Filter and paginate pool states
select_retired_pools-->>all_retired: Return ordered retired pools
all_retired-->>Client: Return JSON results or an internal error
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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
This PR adds Blockfrost-compatible support in the dolos-minibf service for listing already-retired stake pools via a new /pools/retired route, reusing the existing pool-entity scan/pagination patterns in routes::pools.
Changes:
- Implemented
/pools/retiredhandler that filters pools byPoolState.snapshot.live().is_retired, orders results, and applies pagination. - Added selection/unit tests and endpoint-level tests for the new retired-pools behavior.
- Registered the new route in the minibf router.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/minibf/src/routes/pools.rs | Adds retired-pool selection logic, the /pools/retired route handler, and associated tests. |
| crates/minibf/src/lib.rs | Wires the new /pools/retired endpoint into the HTTP router. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Resolves #1097.
Implementation
List the pools that already retired. The scan reuses the
pools/extendediteration overPoolState. It keeps the pools whose live snapshot hasis_retiredset, and reportsretiring_epochas the epoch.Testing
The test that covers this endpoint is defined in:
Further work
register_slot.The two orders differ for one pair of pools in epoch 185, so two Preview fixtures of
blockfrost-testsstill fail.A separate issue will track the fix (add
retiring_slottoPoolState). That fix changes the CBOR encoding of thePoolStateentity, so it will require a resync:Summary by CodeRabbit
New Features
Tests