Skip to content

fix(indexer): upgrade Ponder so rollups found during live indexing are kept - #132

Open
aminsammara wants to merge 1 commit into
mainfrom
amin/ponder-factory-fix
Open

aminsammara wants to merge 1 commit into
mainfrom
amin/ponder-factory-fix

Conversation

@aminsammara

Copy link
Copy Markdown
Collaborator

Problem

The indexer has no Rollup events from v5 or v6: no Deposit, FailedDeposit, WithdrawInitiated, WithdrawFinalized or Slashed.

I checked the prod API against chain:

  • v4 and v4.x deposits come back as real deposit rows at the exact chain block, including those synced live after the single-instance box launched.
  • No probed v5 or v6 deposit has a deposit row. That includes all 50 validators still on v5 and every sampled ERC20 direct deposit.
  • The v5/v6 stakes that do appear are StakingRegistry erc20StakedWithProvider rows, which come from a different contract.

Cause

A bug in Ponder 0.15.7, fixed in 0.17.2 by ponder-sh/ponder#2347:

  • When a factory feeds several handlers, a child it discovers during live indexing is never written to ponder_sync.factory_addresses, yet the blocks are marked synced. Our Rollup factory feeds five handlers.
  • The process keeps indexing the child from memory. After the next restart or rebuild the child is gone, and nothing refetches its events.
  • v5 went canonical on 2026-07-14, the day after the box started, and v6 came later, so both were discovered live.
  • The ATP factory feeds two handlers, so ATPs created since launch are likely affected too. I haven't verified this.

Change

  • ponder ^0.17.12. This needs viem ^2.35, typescript ^5.4 and Node 22, so the Dockerfile, the engines field and the indexer CI jobs are updated.
  • The Rollup contract now starts one block before the Registry deployment. This changes the factory id, so Ponder refetches the Registry and Rollup logs instead of trusting the incomplete cache. Only those are refetched, not the ATP or Staker data.
  • Tests (40) and typecheck pass. I haven't run the new image against mainnet.

Deploy

The build fingerprint changes, so this needs a fresh schema:
deploy-indexer.yaml for prod, new_schema=atp-indexer-si-v5.

The rebuild will take longer than the usual ~7 minutes because the Rollup logs come from RPC. The previous schema stays serving until the flip.

Afterwards, deposit should contain rows for rollups 0x91ff…8e34 (v5) and 0xe37a…402f (v6). The summary's exiting and zombie counts should then include v5/v6 exits.

…e kept

The indexer has no Rollup events at all from v5 or v6: no Deposit, FailedDeposit,
WithdrawInitiated, WithdrawFinalized or Slashed. Checking the prod API against chain shows
v4 and v4.x deposits as real deposit rows, including ones synced live after the box
launched, while every v5 and v6 deposit is missing. That includes the 50 validators still
on v5. The v5/v6 stakes that do show up come from StakingRegistry delegation rows, a
different contract.

The cause is a bug in Ponder 0.15.7, fixed upstream in 0.17.2 (ponder-sh/ponder#2347). When
a factory feeds several handlers, as the Rollup factory feeds five, a child found during
live indexing is added to the in-memory set but then dropped from what gets saved to
ponder_sync.factory_addresses. The blocks are still marked synced. Events keep indexing
until the next restart. After that the rollup is gone, and no rebuild from the cache
fetches it again. v5 went canonical on 2026-07-14, the day after the single-instance
indexer started, and v6 later, so both were found live. v4 and v4.x were found during the
initial historical sync and are unaffected. This also explains the event-derived exit and
failed-deposit numbers being off. The ATP factory feeds two handlers, so ATPs created since
launch are probably missing their ATP events too.

The upgrade alone would not recover anything: the cache still lists only v4 and v4.x as
children and treats the whole range as synced. The Rollup contract now starts one block
before the Registry's deployment. The Registry has no earlier events, so nothing is lost,
but the factory gets a new id and Ponder refetches the Registry and Rollup logs instead of
reusing the broken cache. Only those two sources are refetched, not the ATP and Staker data.

Ponder 0.17 needs Node 22, viem 2.35 and TypeScript 5.4, so the image, the engines field and
the indexer CI jobs move to Node 22. 0.16's 45-character limit on table and schema names
doesn't affect us: the longest table name is 33 characters, and the si-vN schema names are
shorter still.
@aminsammara
aminsammara requested a review from a team as a code owner November 5, 2026 13:58

This branch has not been deployed

No deployments
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