Split pool-indexer bootstrap from serve via --bootstrap-only flag#4559
Split pool-indexer bootstrap from serve via --bootstrap-only flag#4559AryanGodara wants to merge 1 commit into
Conversation
|
Claude finished @AryanGodara's task in 2m 24s —— View job PR Review: Split pool-indexer bootstrap from serve
This is a clean, well-scoped change. The two-phase split is sound and the idempotency claim holds up under inspection: One non-blocking finding (posted inline on
Nothing here blocks merge. |
There was a problem hiding this comment.
Code Review
This pull request introduces a "--bootstrap-only" CLI flag to the pool-indexer, splitting its startup into a separate bootstrap phase (initial seed and catch-up) and a serve phase. This allows running the bootstrap phase as an idempotent Kubernetes initContainer. The changes include adding the new CLI argument, implementing the "bootstrap" execution path, updating documentation, and adding integration and unit tests to verify the idempotent behavior. No critical issues were found, and there is no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
c628569 to
a1aa54b
Compare
Description
The pool-indexer does bootstrap-then-serve in one process:
pool-indexer --config <toml>runs the initial subgraph seed plus catch-up to the finalized head, then serves the HTTP API. On a large chain the bootstrap phase can take minutes, which forces the K8s pod's startupProbe to wait that long before it can declare failure, hiding genuine startup bugs in the serve path.This adds a
--bootstrap-onlymode so the two phases can run in separate containers: an idempotent initContainer does the bootstrap, and the serve container then comes up with a tight startupProbe because the DB is already seeded.Changes
--bootstrap-onlyflag. With it,startruns the newbootstrapentrypoint, which connects the DB, validates the RPC chain_id, runs the existing per-factory bootstrap (seed + catch-up to the finalized head), and exits 0. It binds no HTTP ports. It is idempotent: a factory with an existing checkpoint is skipped, so re-running on an already-seeded DB is a fast no-op that never contacts the subgraph.pool-indexer --config <toml>is unchanged: it bootstraps when the DB has no checkpoint, then serves. Existing single-container deploys keep working as-is.build_provider_checkedhelper (provider build plus chain_id assertion) shared by the serve and bootstrap paths, so the misconfigured-RPC guard runs in both.How to test
Unit and e2e tests:
cargo nextest run -p pool-indexer— includesbootstrap_only_flag_parses.cargo nextest run -p e2e local_node_pool_indexer --run-ignored ignored-only --test-threads 1— includeslocal_node_pool_indexer_bootstrap_idempotent, which pre-seeds a checkpoint and assertsbootstrapreturns immediately (no ports bound, subgraph untouched, checkpoint unchanged), alongside the existing serve-path tests.Locally tested on ink subgraph:
Simulated the init-container flow (fresh
ink_pool_indexerDBpool-indexer --bootstrap-only --config <ink.toml>seeded 1718 pools / 8266 ticks, caught up to the finalized head, and exited 0 in ~21s without binding any ports.--bootstrap-onlyexited 0 immediately, logging "existing checkpoint found, skipping bootstrap" and never contacting the subgraph.pool-indexer --config <ink.toml>then flipped/startupto 200 within about a second of binding (bootstrap already done),/healthreturned 200, and/poolsserved real Ink pool data.eth_getLogs.