Commit 6f4d27f
authored
feat(indexer): genesis import framework with account and balance seed (#3587)
* feat(indexer): add genesis import framework with account and balance seed
Balance tracking is only trustworthy from a network's genesis, so this
seeds genesis state before the first block: accounts, per-denom balances
(recorded as genesis-reason ledger entries), validators, and staking
delegations, all in one transaction.
It is gated behind GENESIS_IMPORT (default off). When enabled, the sync
role runs a per-module seeder framework exactly once, using a genesis
checkpoint in indexer_state so a restart is a no-op, and it rejects a
fresh start that is not at the network's genesis height. Genesis is
fetched over RPC /genesis_chunked and its chain_id is asserted against
the node being indexed.
This adds the accounts, account_balances, balance_changes, validators,
and delegations tables (L-3); the ongoing per-block ledger lands in L-4.
Refs CON-805
* refactor(indexer): share genesis validator and chunked-insert helpers
Extract mapDescription/mapCommissionRates so the staking and gentx validator
mappers stop duplicating the description and commission field mapping, and add
an insertChunked helper the bank and staking seeders call instead of
hand-rolling the chunked insert loop.
* fix(indexer): warn when genesis import is enabled too late to seed
The seed only runs on a fresh start, so turning GENESIS_IMPORT on after the
indexer already has a sync checkpoint silently skips it and leaves the account
and balance tables empty with no signal. Add a hasSeeded check on resume and
log a warning so the operator knows genesis was never backfilled.1 parent f13778e commit 6f4d27f
36 files changed
Lines changed: 2410 additions & 17 deletions
File tree
- apps/chain-indexer
- drizzle
- meta
- env
- src
- config
- db
- genesis
- pipeline
- providers
- rpc
- test/fakes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
0 commit comments