Skip to content

wip - #249

Closed
rdmcd wants to merge 1 commit into
devfrom
fix/nft-whitelist-addresses-only
Closed

wip#249
rdmcd wants to merge 1 commit into
devfrom
fix/nft-whitelist-addresses-only

Conversation

@rdmcd

@rdmcd rdmcd commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

get_whitelisted() loaded whole NFTCollection rows, including blockchain_metadata, which aggregates the names, descriptions and traits of every item in a collection. Its only caller needs the addresses alone, so select the address column instead.

…whitelist

`get_whitelisted()` loaded whole `NFTCollection` rows, including
`blockchain_metadata`. That column aggregates the distinct names, descriptions
and trait values of every item in a collection, so it dominates the row size:
99 enabled collections currently weigh 6.7 MB, while its only caller —
`fetch_wallet_details` — used nothing but `.address`, about 6.6 KB.

The task runs on every wallet re-index, roughly 4.5 times per minute in
production, so the query accounted for ~1.25 TB/month of traffic between the
indexer pods and Postgres: `indexer-blockchain` averaged 483 kB/s of receive
over 18 days, which is exactly 6.7 MB x 4.5/min. Every new whitelisted
collection carrying 300 KB of metadata added ~56 GB/month on top.

Select the address column instead. The WHERE clause is unchanged, so the same
rows match; only the projection narrows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118Xs3FazE6Sf1ocbztppqC
Copilot AI lite review requested due to automatic review settings September 10, 2026 15:12
@rdmcd rdmcd changed the title fix(indexer-blockchain): select only addresses in the NFT collection whitelist wip Sep 10, 2026
@rdmcd rdmcd closed this Sep 10, 2026
@rdmcd
rdmcd deleted the fix/nft-whitelist-addresses-only branch September 10, 2026 15:14

Copilot AI 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.

🟢 Approval recommended

The change is narrowly scoped, updates the only verified call site, and adds targeted unit tests for the new behavior.

Pull request overview

This PR reduces unnecessary database/network load in the blockchain indexer by changing the NFT collection whitelist query to fetch only collection addresses (instead of full NFTCollection rows containing large blockchain_metadata blobs).

Changes:

  • Updated NftCollectionService.get_whitelisted() to return list[str] (addresses only) and documented the rationale.
  • Simplified fetch_wallet_details() to use the new get_whitelisted() return type directly.
  • Added unit tests to verify enabled collections are included and disabled ones are excluded.
File summaries
File Description
backend/core/src/core/services/nft.py Narrowed whitelist query projection to NFTCollection.address and updated return type/documentation.
backend/indexer_blockchain/tasks.py Adjusted whitelist address retrieval to match the new service return type.
backend/tests/unit/core/services/test_nft_collection_service.py Added coverage for get_whitelisted() returning only enabled collection addresses.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants