Skip to content

feat(minibf): add /assets/{subject}/txs endpoint - #1220

Open
vladimirvolek wants to merge 3 commits into
mainfrom
minibf-assets-txs
Open

feat(minibf): add /assets/{subject}/txs endpoint#1220
vladimirvolek wants to merge 3 commits into
mainfrom
minibf-assets-txs

Conversation

@vladimirvolek

@vladimirvolek vladimirvolek commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

resolves: #1100

Summary by CodeRabbit

  • New Features

    • Added an asset transaction endpoint that returns transaction hashes with pagination and ordering support.
    • Added stake-address transaction lookup and policy asset listing.
    • Added endpoints for epoch information, latest-epoch lookup, pool listing, retiring pools, and pool relays.
  • Bug Fixes

    • Asset transaction requests now return a clear “Not Found” response when the asset does not exist.
  • Documentation

    • Updated API documentation to reflect the newly supported endpoints.

@vladimirvolek
vladimirvolek requested review from a team and scarmuega as code owners August 17, 2026 13:03
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f102185-ca0d-4c37-b3a9-00effa4c05ac

📥 Commits

Reviewing files that changed from the base of the PR and between 68e1894 and 637ff08.

📒 Files selected for processing (1)
  • docs/content/apis/minibf.mdx

Included review availability: Your plan includes up to 2 reviews per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Mini Blockfrost API adds /assets/{subject}/txs, validates asset existence for transaction lookup, preserves filtering and pagination behavior, adds hash-only response tests, and updates endpoint coverage documentation.

Changes

Asset transaction lookup

Layer / File(s) Summary
Transaction lookup and validation
crates/minibf/src/routes/assets.rs
Asset transaction lookup now checks asset state and returns 404 Not Found for unknown assets. Tests cover retrieval, slot filtering, pagination, ordering, and errors.
Hash alias and API wiring
crates/minibf/src/routes/assets.rs, crates/minibf/src/lib.rs, docs/content/apis/minibf.mdx
The /assets/{subject}/txs route delegates to transaction lookup and returns transaction hashes. Tests verify equivalent ordering, pagination, and errors. Documentation lists the new alias and related endpoints.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 637ff

This localized API and documentation change has no actionable merge-blocking risk remaining beyond normal checks and review.

Suggested reviewers: scarmuega

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant by_subject_txs
  participant by_subject_transactions
  participant AssetState
  participant BlockStore
  Client->>by_subject_txs: Request asset transaction hashes
  by_subject_txs->>by_subject_transactions: Delegate lookup
  by_subject_transactions->>AssetState: Validate asset subject
  AssetState-->>by_subject_transactions: Asset state or not found
  by_subject_transactions->>BlockStore: Retrieve filtered transactions
  BlockStore-->>by_subject_transactions: Paginated transaction models
  by_subject_txs-->>Client: Transaction hashes
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The documentation adds unrelated epoch and pool API entries beyond the linked asset transaction endpoint [#1100]. Move unrelated documentation changes to separate pull requests and keep this PR focused on /assets/{subject}/txs.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the new /assets/{subject}/txs endpoint, which is the primary change.
Linked Issues check ✅ Passed The PR adds the requested route and hash-only handler based on the existing transactions endpoint, with pagination and ordering preserved [#1100].
Docstring Coverage ✅ Passed Docstring coverage is 84.21% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch minibf-assets-txs

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.

@michalrus michalrus added enhancement New feature or request area:minibf Mini Blockfrost (minibf) API labels Aug 19, 2026
@michalrus
michalrus requested a lite review from Copilot August 19, 2026 10:05

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 support in dolos-minibf for the hash-only asset transactions endpoint, aligning Dolos’ lightweight API surface with Blockfrost clients and expectations around pagination/order semantics.

Changes:

  • Add /assets/{subject}/txs route that returns only transaction hashes while reusing the existing asset-transaction scan/pagination logic.
  • Update /assets/{subject}/transactions to return 404 Not Found for valid-but-unknown assets (matching Blockfrost behavior).
  • Update Minibf API documentation to list the newly supported endpoints (including /assets/{subject}/txs).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/content/apis/minibf.mdx Documents the new/now-supported Minibf endpoints, including /assets/{subject}/txs.
crates/minibf/src/routes/assets.rs Implements asset existence check for /transactions, adds /txs handler, and extends test coverage for both endpoints.
crates/minibf/src/lib.rs Registers the new /assets/{subject}/txs route in the Axum router.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@slowbackspace slowbackspace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the code and verified behavior against ryo, mimicry, and the official blockfrost-tests suite.

Severity legend: 🔴 must fix · 🟡 should fix · 🟢 optional

Verification done:

  • Ran blockfrost-tests on preview with this branch: assets/:asset/txs 5 passed, assets/:asset/transactions 9 passed.
  • Ran blockfrost-tests on mainnet: happy-path, ordering, and from/to tests pass on both endpoints. Six deep-pagination tests fail (page=42420, page=10000) with the max_scan_items 400. The same tests fail on /transactions before this PR. This is inherited, not a regression.
  • The entity-key hashing matches write-time (MintStatsUpdate::key). The eager 404 pre-check matches both ryo (assets_404) and mimicry (is_asset_on_chain).

One request for the PR description: this PR changes the contract of the shipped /assets/{subject}/transactions endpoint. A well-formed but unknown asset returned 200 [] before. It now returns 404. The change is correct Blockfrost parity, but please call it out as a behavior change, not only a feature addition.

let pagination = Pagination::try_from(params)?;
pagination.enforce_max_scan_limit(domain.config.max_scan_items())?;

let subject = hex::decode(&subject).map_err(|_| Error::InvalidAsset)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Blockfrost validates the asset length before the lookup. validateAsset (ryo) and validate_asset_name (mimicry, src/asset.rs:32) require 56–120 hex chars and return 400 otherwise. Dolos only runs hex::decode. With the new 404 gate, GET /assets/abcd/transactions now returns 404 where Blockfrost returns 400 'Invalid or malformed asset format.' (verified live against this branch). Add a length check that maps to 400. The same gap exists in by_subject and by_subject_addresses; a shared helper would fix all of them.


let subject = hex::decode(&subject).map_err(|_| Error::InvalidAsset)?;

// Blockfrost returns 404 for a valid but unknown asset, same as `/addresses`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 The comment cites the wrong precedent. /addresses/{address}/transactions checks existence lazily, only when the page is empty (addresses.rs:550-556), and the /addresses/{address}/txs alias has no check at all. The matching precedent is /assets/{subject}/addresses in this file. Suggest: name that endpoint, or state the Blockfrost rule without a cross-reference.


// Blockfrost returns 404 for a valid but unknown asset, same as `/addresses`.
let entity_key = pallas::crypto::hash::Hasher::<256>::hash(subject.as_slice());
if !domain.cardano_entity_exists::<AssetState>(entity_key.as_slice())? {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 This is the third inline copy of the decode → Hasher::<256>cardano_entity_exists gate in this file (by_subject line 484, by_subject_addresses line 525). The copies already drift: by_subject maps bad hex to StatusCode::BAD_REQUEST and uses read_cardano_entity. Extract one helper that decodes the subject, validates it, checks existence, and returns the subject bytes. Call it from all three handlers. That also gives the 56–120 length check a single home.

D: Domain + Clone + Send + Sync + 'static,
Option<AssetState>: From<D::Entity>,
{
let Json(transactions) = by_subject_transactions(path, params, state).await?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 The alias inherits from/to through PaginationParameters, but Blockfrost's /assets/{asset}/txs does not define them. Ryo's handler reads only order/count/page (no getAdditionalParametersFromRequest). Mimicry parses from/to but its assets_asset_txs.sql binds only order, count, page, and asset — the values never reach the query. So both references return the full list for GET /assets/{unit}/txs?from=X&to=Y, while this alias filters by the range. Suggest clearing from/to from the params before delegating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:minibf Mini Blockfrost (minibf) API enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

minibf: add /assets/<asset>/txs

4 participants