Skip to content

fix: delay indexing by configured confirmations - #115

Merged
anhthii merged 3 commits into
mainfrom
fix/bsc-confirmation-delay
Sep 24, 2026
Merged

anhthii merged 3 commits into
mainfrom
fix/bsc-confirmation-delay

Conversation

@vietddude

@vietddude vietddude commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Delay regular/catchup indexing by the chain's configured confirmations so BSC blocks aren't queried for logs before the node has finished indexing them. Fixes BSC: ERC20 deposits silently missed when eth_getLogs returns incomplete logs at chain head #114 — a race where eth_getLogs silently returned partial/empty results at the chain head, causing missed ERC20 deposits.
  • Batch the bloom-filter membership checks used to match monitored wallet addresses. Previously each Transfer log / candidate transaction triggered its own Contains/Exist call — on the Redis-backed bloom filter that's one BF.EXISTS round trip per lookup, which on BSC (hundreds of Transfer events per block) dominated per-range processing time. Now all addresses in a range are deduplicated and checked in a single BF.MEXISTS/ContainsBatch call.

Changes

  • BaseWorker.processingHead / RegularWorker / CatchupWorker: compute and use latest - confirmations instead of the raw chain head for range boundaries, starting position, and lag detection. Never rewinds past an already-persisted checkpoint.
  • WalletAddressBloomFilter / pubkeystore.Store: new ContainsBatch / ExistBatch methods, implemented for both the Redis (BF.MEXISTS) and in-memory backends.
  • EVMIndexer.queryERC20TransfersToMonitoredAddresses: collects unique from/to addresses across all Transfer logs in a range, then resolves monitored status via a single batched lookup instead of one lookup per log.
  • EVMIndexer.extractReceiptTxHashes: same batching applied to the native-transfer and Gnosis Safe exec-transaction matching paths — address resolution for a whole block batch is deferred and done in one lookup instead of per-candidate-transaction.

@vietddude
vietddude requested a review from anhthii September 21, 2026 10:00
@anhthii
anhthii merged commit b2ab22d into main Sep 24, 2026
2 checks passed
@anhthii
anhthii deleted the fix/bsc-confirmation-delay branch September 24, 2026 15:08
engboustani added a commit to engboustani/multichain-indexer that referenced this pull request Oct 21, 2026
ContainsBatch only accepted int64 items. go-redis v9 speaks RESP3 by default,
where RedisBloom answers BF.MEXISTS with booleans, so every address read as
unmonitored and the EVM indexer matched no ERC-20 transfer (and no native
transfer to a watched address) since the batch check replaced per-address
lookups (fystack#115). Accept both reply shapes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

BSC: ERC20 deposits silently missed when eth_getLogs returns incomplete logs at chain head

2 participants