Updates/dev update#605
Merged
Merged
Conversation
Move tx-metric helpers from src/app/services/tx-service.ts into a dedicated utility module consumable by the upcoming update-aztec-tx-metrics daily cron job.
Fixes two regressions: (1) calculateAztecAverageFee now uses the correct getUiTxEffects(params, options) signature — previous code passed { cache: 'no-store' } as the first positional argument (query-params slot), and the redundant !tx.isOrphaned filter is removed since getUiTxEffects already returns confirmed tx effects only. (2) calculateAztecTps drops the isAztecFinalizedStatus(block.blockStatus) filter — the [from, to] window is bounded above by latestFinalizedHeight, so every block in the window is finalized by construction; the UI blocks endpoint lags on blockStatus in v4 alpha, which caused the filter to drop every block and return null.
Inner try/catch error swallowing is removed: the consuming job uses Promise.allSettled and needs the rejection to surface partial failures.
Writes totalTxs/txsLast24h/tps/avgFee to chain_tx_metrics and a daily snapshot to chain_tx_daily_snapshots. Derives txs30d from the snapshot 30 days ago (falls back to oldest snapshot when 30d history is not yet available). Preserves prior field values on partial indexer failures via Prisma partial-update semantics.
- Only assign txsLast24h/tps/avgFee to the upsert `update` object when the settled result is fulfilled AND the value is non-null/undefined. Previously, a fulfilled-but-null helper would overwrite prior DB values with null, violating the spec's null-omission rule for `update`. The `create` path still writes null defaults, which is correct per spec (first-insert has no prior row to preserve). - Rename logger namespace from 'update-aztec-tx-metrics' to 'aztec-tx-metrics' to match spec.
Allows the Aztec indexer client to authenticate when deployed against environments that gate the API behind a bearer token. When the env var is unset the client behaves as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix and improve aztec tx data service