Why
The existing replayability card states the invariant; this PoC tests whether a production library actually buys it. A fast query layer that leaves stale rows after a reorg is faster at returning the wrong answer.
An indexer owns the rollback and replay rules behind the database state an application treats as truth. And how much rollback it must support is exactly the finality lag of the chain: only the unfinalized window can be orphaned, so that window is where the undo machinery lives — an RPC cache never has to think about this; an indexer is defined by it.
How it works
Index one small contract with Ponder, force a local reorg, and assert that derived rows match a clean replay byte for byte. Measure initial sync, restart recovery, RPC calls, and schema-change rebuild time.
PoC
- Index transfers from one small contract with Ponder.
- Index the same range twice and verify idempotency.
- Replace the final local block with a competing hash.
- Verify stale derived rows disappear and the result matches a clean replay byte for byte.
- Record initial sync, restart recovery, RPC use, and rebuild time after one schema change.
| Measurement | Question |
|---|---|
| Replay equality | Can the database be discarded and rebuilt exactly? |
| Reorg rollback | Do orphaned events leave any derived state? |
| Schema rebuild | Can the product evolve without hand-patching history? |
Reorg bugs live almost exclusively in derived state. Deleting orphaned raw events is easy (DELETE WHERE block > N); an aggregate updated as balance += amount can only be rolled back by inverting it or re-deriving it, which is why the test asserts on derived rows and not on the event log.
Reference: Ponder official documentation.
Review clarification
The indexer is not a choice
An RPC node answers "what is X's balance now"; it cannot answer product questions — "all transfers for this user, sorted," "top holders," "volume per day." Every real application ends up copying chain data into a database, so the question is never whether to run an indexer, only who wrote it: you, or a library. And whoever maintains that database inherits the rollback and replay rules — that inheritance is the card's thesis.
Why each PoC step exists
| Step | What it catches |
|---|---|
| Index the same range twice | Hidden handler state — double-counting is the cheapest determinism smoke test |
| Replace the tip with a competing hash | The reorg itself — evm_snapshot → mine → evm_revert → mine makes one on demand, on a laptop |
| Check derived rows, not raw rows | Where reorg bugs actually live — DELETE WHERE block > N is easy; balance += amount can only be inverted or re-derived |
| Byte-for-byte vs. a clean replay | The gold standard: the DB is a pure function of the chain — no wall-clock timestamps, no order-dependence, no reorg residue |
| Schema rebuild | Whether the DB accidentally became a source of truth — a derived DB evolves by wipe-and-reindex, never by hand-patching history |
The finality boundary
How much rollback machinery an indexer must keep is exactly the finality lag of its chain: only the unfinalized window can be orphaned, so the undo log lives there and can be dropped once a block is final. An RPC cache never has to think about this; an indexer is defined by it.
What the card does not say
It does not say "Ponder is good." The reasoning chain — we cannot avoid an indexer, and the indexer must own reorgs — is the card's setup, but the last step, therefore Ponder, is earned by the test, not assumed. Ponder claims to own the problem (its pitch against The Graph's subgraphs and Subsquid is local-first TypeScript with reorg handling built in); the PoC exists to verify that claim before a database is bet on it. Pass, and the reorg machinery came for free. One stale row, and what remains is a fast query layer that returns wrong answers.
Where it lands in Jayverse
- Devnet: build the reorg PoC (evm_snapshot → mine → evm_revert → mine) as a standard test harness. Reuse it for any indexer Jayverse ships — Verex's order book, Rabbit's session-key events — rather than building the reorg test once and forgetting it.
- Verex: before trusting any indexer as the source of truth for order-book or balance state, add a byte-for-byte replay-vs-rebuild test to CI. Check derived rows (balances, positions), not raw event rows — that's where reorg bugs actually live.
- Devnet/Rabbit: size the reorg rollback window to the chain's actual finality lag. Only the unfinalized window can be orphaned, so that bounds how much undo machinery any Jayverse indexer needs to keep, on both the Anvil fork today and the OP-Stack L2 later.
- gitboard: add "last clean replay passed" as a per-service indexer status row. It's the pass/fail signal this page's PoC produces, and it belongs on the dashboard, not just in a test log.
Key expressions
| Expression | 뜻 · 쓰이는 자리 |
|---|---|
| rollback | 되돌리기·롤백 · 체인 재구성 시 이전 상태로 상태를 되돌리는 처리. "It owns rollback, replay, idempotency" |
| idempotency | 멱등성 · 같은 작업을 여러 번 해도 결과가 같아야 한다는 성질. "verify idempotency" |
| byte for byte | 한 바이트도 틀림없이·완전히 동일하게 · 결과를 정밀 비교할 때 쓰는 표현. "match a clean replay byte for byte" |
| wipe-and-reindex | 싹 지우고 다시 색인하기 · 스키마가 바뀌면 DB를 통째로 재구축하는 방식. "a derived DB evolves by wipe-and-reindex" |
| hand-patch | 손으로 직접 땜질해 고치다 · 이력을 임시방편으로 수작업 수정하는 것을 가리킬 때. "never by hand-patching history" |
| inherit | (책임·규칙을) 이어받다·떠안다 · DB를 유지하는 쪽이 롤백 규칙까지 떠안는다는 뜻. "inherits the rollback and replay rules" |
| come for free | 거저 따라오다·공짜로 딸려오다 · 다른 걸 제대로 하면 자연히 해결되는 문제를 말할 때. "the reorg machinery came for free" |
| smoke test | 기본 동작 확인용 간단 테스트 · 본격 테스트 전에 큰 결함부터 걸러내는 최소 테스트. "the cheapest determinism smoke test" |
| gold standard | 최고 기준·모범 사례 · 비교 대상 중 가장 신뢰할 만한 기준을 가리킬 때. "The gold standard: the DB is a pure function" |
| earned by, not assumed | 당연시된 게 아니라 검증으로 얻어낸 것 · 결론을 증명 없이 전제하지 않았음을 강조. "is earned by the test, not assumed" |
| The Graph | 더 그래프 · 서브그래프로 체인 데이터를 인덱싱하는 대표적 인덱싱 프로토콜, Ponder의 경쟁 상대로 언급. "its pitch against The Graph's subgraphs and Subsquid" |
| Subsquid | 서브스쿼드 · 블록체인 데이터 인덱싱 프레임워크, Ponder와 비교되는 경쟁 제품. "and Subsquid is local-first TypeScript with reorg handling" |