!5399perf/solvency-reporter-batched-reads → zoly/bifrost-unify-solvencyb33cf46c9a

Solvency vault reads: concurrent everywhere, JSON-RPC batches on ETH/EVM

AI-generatedEverything on this page was written by an AI agent from the diff: the summaries, the narration, the diagrams, the flags and the glossary. It can be wrong or incomplete, so check it against the code before you rely on it.

11commits
28files
2.8klines changed
786lines to read
8vaults read at once
≤500reads per batch

Where the diff is

How a solvency report reads vaults

Collect reads every vault up front: one batched call on ETH/EVM, eight at once elsewhere.

newchangedremoved

3-minute explainer

What changed

Concurrent vault reads

Up to 8 vaults at once; Monero limits itself to 1.

vault 1…vault 8
errgroup.SetLimit(8) · results by index

One call per report

Optional VaultAccountsReader reads every vault together.

lengths match → used
lengths differ → every vault fails

JSON-RPC batches

ETH/EVM balances batched; unanswered reads retried alone.

batch ≤ 500nil slotsGetBalance × 8

Fail, not zero

A partly read vault errors instead of looking insolvent.

before: missing = 0after: vault error

GAIA: bank query only

Auth Account query dropped from the solvency read.

AllBalances ✓Account ✗

State + upgrade

Bifrost config

  • newblock_scanner.solvency_batch_size0 (= transaction_batch_size, 500)
  • newsolvencyReadConcurrency (const)1 (serial) → 8
  • newsingleReadConcurrency (const)1 (serial) → 8

Line by line · every changed logic line, narrated

10:08runtime
18code chapters
100%logic lines narrated (602/602)
13flagged spots
speed

Chapters

What to check

Ask an AI about this change

Chat assistantClaude, ChatGPT, … (reads a link)

Coding agentClaude Code, Cursor, … (reads the repo)

The context file is context.md. Use Copy with context for an AI that can't open links; it pastes the whole file in.

Glossary

!4597
The parent MR this one stacks on: moves solvency off the scan path into a per-chain reporter worker.
Collect
The solvency reporter's per-round function: reads every vault of the chain and builds the report messages. reporter_solvency.go ↗
errgroup
Go package running goroutines as a group; SetLimit caps how many run at once. pkg.go.dev ↗
JSON-RPC batch
Several JSON-RPC requests sent in one HTTP round trip; each element gets its own result or error. JSON-RPC 2.0 spec ↗
Solvency report
Bifrost's periodic message telling THORChain each vault's on-chain balances, so an insolvent vault halts the chain. reporter_solvency.go ↗
solvency_batch_size
New bifrost block-scanner setting: max balance reads per batch; 0 uses transaction_batch_size, 1 disables batching. config/default.yaml ↗
SolvencyReadLimiter
New optional client interface lowering how many vaults are read at once; Monero returns 1. reporter/types.go ↗
VaultAccountsReader
New optional client interface: GetVaultAccounts reads all vaults in one call, results aligned with vaults. reporter/types.go ↗
vaultAllowance
THORChain router contract method returning a vault's token balance held by the router; read with eth_call. token_manager_batch.go ↗