Issue/712 blockforst compatible api for epoch module#780
Conversation
…ress and epoch controllers
- Create H2 migration schema for jOOQ generation - Add module to jooq_modules in publish-common.gradle - Refactor BFEpochStorageReaderImpl to use generated Tables
I checked in mainnet and you're right, it' slow. Postgres used idx_block_number index, but WHERE condition is epoch filter, so postgres scanned a large number of rows. ex: explain analyze select b.hash from block b where b.epoch = 547 order by b."number" asc limit 5; I think composite index is right choice here, should be applied after sync. Another option is rewriting query, but I tried, and the results was still the same. |
Should we create another issue for this? It seems we might have an issue in epoch-aggr. |
Also, |
Here we are: #781
@satran004 you mean we sum all of fee in it kind of works, but I’m quite sure this query very slowly |
Yes, it could be slow for current epoch. But in My concern with epoch_aggr is that I am not sure whether rollbacks are handled properly in that module. It’s a very old module and hasn’t been used before. One possible approach is to focus on data accuracy first rather than performance, while keeping a note of all endpoints that will need additional performance optimization later. |
…and disable Blockfrost extensions
Issue 744: blockforst compatible api for address module
…kforst-compatible-api-for-epoch-module
|



#712
#768
Epoch Module
Status Checklist (per endpoint)
Open Issues / Notes
The
total_feesepoch calulated wrong somewhere and mismatch with blockforst api.The correct fees can calculate by the first query bebow
select b.hash from block b where b.epoch = ? order by b."number" asc limit 5Address Module
BFAddressStorageReaderImplusing generated tables fromextensions/blockfrost/address/build/generated-src/jooq./addresses/{address}and/extendedread fromaddress_balance_currentwhen account aggregation is enabled; otherwise they fall back to unspent sums fromaddress_utxo./addresses/{address}/totaland unspent balance uselovelace_amountfor ADA and JSONB expansion for non-lovelace assets./addresses/{address}/transactionssupports inclusivefrom/towithblock[:txIndex]format.page >= 1, internalpage-1).Open issue Notes:
/addresses/{address}/extendedcurrently mirrors the base response.decimalsandhas_nft_onchain_metadataare not available because we do not ingest CIP-68 metadata in the indexer yet (no core source of truth).address_utxo(owner_addr)is required to avoid full scans.tx_input(tx_hash, output_index)should be present (PK). Addaddress_utxo(owner_addr_full)if you support long Byron addresses.Assets Module
Implementation Notes (Design + Changes)
BFAssetStorageReaderImpl(asset extension) with generated jOOQ tables from core stores (assets,transaction,utxo).page >= 1, internalpage-1).BFAssetMapper(MapStruct), service no longer builds DTO inline.asset_nameis returned in hex (derived fromunit.substring(56)).metadata,onchain_metadata,onchain_metadata_standard,onchain_metadata_extraarenull(no token-registry/CIP metadata ingestion in store).GET /assetsstrategy (no N+1):first_mints—DISTINCT ON (unit)to find each asset's earliest mint slot (materialized, ~1.37M rows)page_window— approximate page viaOFFSET/LIMITordered by(slot, unit)boundary— extract min/max slot from the page windowprefix— count rows strictly before the boundary (for offset calculation)candidates— allfirst_mintsrows within the boundary slot rangeenriched— lateral join toassets+transactionto fetchtx_hashandtx_index(only for candidate rows, ~100-200)ranked—ROW_NUMBER()ordered by(slot, tx_index, unit)matching Blockfrost orderingSELECTfilters by rank to extract the exact pageStatus Checklist (per endpoint)
Index Script (PostgreSQL)
Open Issues / Notes
GET /assetstakes ~2.5s (warm) due tofirst_mintsCTE materializing ~1.37M rows. Recommended fix: summary tableasset_first_mintfor <10ms response.pagevery large) is still offset-bound and may degrade; current implementation minimizes scan scope but cannot fully avoid OFFSET cost.