Skip to content

Debug: trace BBTC balance through refresh pipeline#3667

Merged
TaprootFreak merged 4 commits intodevelopfrom
debug/bbtc-balance-tracing
May 2, 2026
Merged

Debug: trace BBTC balance through refresh pipeline#3667
TaprootFreak merged 4 commits intodevelopfrom
debug/bbtc-balance-tracing

Conversation

@TaprootFreak
Copy link
Copy Markdown
Collaborator

Summary

  • BBTC (Asset 394) liquidity_balance shows 0.001 while on-chain balance is 1.73 BBTC
  • Direct Alchemy SDK calls return the correct value (1.73)
  • No errors in production logs
  • Root cause unknown — need to trace the actual values in production

Debug logging added

  1. BlockchainAdapter updateCoinAndTokenBalance: logs when a balance value changes between cache updates (old → new), including whether the chainId was found in the Alchemy response map
  2. BlockchainAdapter getForBlockchain: logs any assets missing from cache after an update cycle
  3. BalanceService saveBalanceResults: logs when saves are skipped due to updated > startDate, and when balance values actually change

All logs are verbose level — they'll appear in Application Insights but won't spam error channels.

After deploy

Search traces for:

  • "Balance change for Ethereum/BBTC" — confirms Alchemy returns different value than cache
  • "missing from cache after update" — confirms BBTC is dropped from cache
  • "Skipping save for Ethereum/BBTC" — confirms save is skipped due to timing
  • "Saving balance for Ethereum/BBTC" — confirms save goes through

Add verbose logging to trace token balance values through the pipeline:
- BlockchainAdapter: log when balance changes between cache updates
- BlockchainAdapter: log assets missing from cache after update
- BalanceService: log when saves are skipped (updated > startDate)
- BalanceService: log when balance values actually change
- Only log uncached assets when an update was actually attempted
- Log balance changes for all chains, not just Ethereum
- Remove redundant chainId from log message
- Only log balance changes when cache was previously populated
- Add always-on BBTC (394) trace to capture Alchemy response value
  even when unchanged (covers the case where Alchemy returns stale data)
@TaprootFreak TaprootFreak marked this pull request as ready for review May 2, 2026 18:00
@TaprootFreak TaprootFreak requested a review from davidleomay as a code owner May 2, 2026 18:00
@TaprootFreak TaprootFreak merged commit 8cadaae into develop May 2, 2026
6 checks passed
@TaprootFreak TaprootFreak deleted the debug/bbtc-balance-tracing branch May 2, 2026 18:03
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.

1 participant