Skip to content

fix(bloomfilter): load only the address types of the chains being indexed - #133

Merged
anhthii merged 1 commit into
mainfrom
fix/bloom-indexed-address-types
Nov 21, 2026
Merged

anhthii merged 1 commit into
mainfrom
fix/bloom-indexed-address-types

Conversation

@vietddude

Copy link
Copy Markdown
Collaborator

Summary

The address bloom filter loaded every enum.AllNetworkTypes at startup and in the sync worker, querying wallet_addresses once per type. On a database whose address_type enum does not have one of those values (the dev custody DB lacks apt, sui, cosmos, ton and xrp), the query fails and the indexer exits at startup, even when it only indexes stellar_testnet.

  • Chains.NetworkTypes(names) returns the distinct network types of the resolved chains, in order.
  • WalletAddressBloomFilter.Initialize(ctx, addressTypes) (Redis and in-memory) loads only those types.
  • BloomSyncConfig.NetworkTypes holds the same list, and the sync worker's two loops use it.
  • cmd/indexer/main.go initializes the bloom filter after chains are resolved and validated, so it knows which types to load.

Test plan

  • TestNetworkTypes_DistinctTypesOfGivenChains
  • TestAddressBloomFilter_InitializeLoadsOnlyGivenTypes
  • TestBloomSyncWorker_SyncsOnlyConfiguredNetworkTypes
  • go test -short ./...
  • Ran index --chains stellar_testnet against the dev custody DB: starts and loads only stellar (it crashed on apt before); used for the Stellar memo e2e runs of fystack/apex#871

…exed

Initialize and the bloom sync worker looped over every enum.AllNetworkTypes
and queried wallet_addresses for each. A database whose address_type enum
lacks one of them (e.g. apt, sui, cosmos, ton, xrp) failed the query, and the
indexer exited at startup even when only stellar was indexed. Derive the
types from the resolved chains (Chains.NetworkTypes) after validation and use
them for both the initial load and the periodic sync.
@anhthii
anhthii self-requested a review November 21, 2026 05:32
@anhthii
anhthii merged commit 0ec4526 into main Nov 21, 2026
5 checks passed
@anhthii
anhthii deleted the fix/bloom-indexed-address-types branch November 21, 2026 05:33
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