Add verify-indexer-reorg-anvil smoke script #351

Closed
opened 2026-06-25 20:07:27 +00:00 by PlasticDigits · 6 comments
PlasticDigits commented 2026-06-25 20:07:27 +00:00 (Migrated from gitlab.com)

Parent

Transition Gap Analysis (#342) — P2 #11. Bundles M-I4.

Current codebase

  • Indexer tests call rollback_after directly in integration_stage2.rs — synthetic reorg handling.
  • REORG_STRATEGY.md defines tiers; no Anvil script walks find_common_ancestor + re-ingest end-to-end.
  • Missing: scripts/verify-indexer-reorg-anvil.sh (called out in gap analysis).

Why needed

Live reorg E2E validates transition event rollback (level history, epoch assignment, session summary) under realistic RPC reorder — reduces mainnet reorg risk.

Constraints / guardrails

  • Script follows existing verify-*-anvil.sh patterns (Anvil, native Postgres on :5433, Foundry on PATH).
  • Idempotent; clear PASS/FAIL exit codes for CI/agent use.
  • No Docker required (native Postgres per #287).

Relevant files

  • indexer/src/ingestion.rs (reorg walk)
  • indexer/tests/integration_stage2.rs
  • scripts/verify-wallet-profile-anvil.sh (template)
  • docs/testing/REORG_STRATEGY.md
  • New: scripts/verify-indexer-reorg-anvil.sh
  1. Start Anvil + indexer + seed buys/level-up events.
  2. anvil_reset or shallow reorg to common ancestor.
  3. Re-ingest; assert chain_pointer, level history, and key transition rows consistent.
  4. Document in docs/testing/ci.md or invariants.

Acceptance criteria

  • New verify script exits 0 on happy path.
  • Script documented in gap-analysis verify table / scripts/qa/README.md.
  • Fails loudly on ingest divergence.

Test plan

Path Command
Script bash scripts/verify-indexer-reorg-anvil.sh
Indexer cd indexer && cargo test
Postgres bash scripts/verify-cloud-postgres.sh

Attack / abuse test plan

  • Script must not leave orphan DB state that breaks subsequent verifies.
  • Re-ingest must not duplicate events after rollback.

Verification criteria

  • bash scripts/verify-indexer-reorg-anvil.sh PASS on Cloud VM.
  • Integration-level assertions match on-chain state post-reorg.
## Parent [Transition Gap Analysis (#342)](https://gitlab.com/PlasticDigits/yieldomega/-/issues/342) — P2 #11. Bundles **M-I4**. ## Current codebase - Indexer tests call `rollback_after` directly in `integration_stage2.rs` — synthetic reorg handling. - `REORG_STRATEGY.md` defines tiers; no Anvil script walks `find_common_ancestor` + re-ingest end-to-end. - Missing: `scripts/verify-indexer-reorg-anvil.sh` (called out in gap analysis). ## Why needed Live reorg E2E validates transition event rollback (level history, epoch assignment, session summary) under realistic RPC reorder — reduces mainnet reorg risk. ## Constraints / guardrails - Script follows existing `verify-*-anvil.sh` patterns (Anvil, native Postgres on `:5433`, Foundry on PATH). - Idempotent; clear PASS/FAIL exit codes for CI/agent use. - No Docker required (native Postgres per #287). ## Relevant files - `indexer/src/ingestion.rs` (reorg walk) - `indexer/tests/integration_stage2.rs` - `scripts/verify-wallet-profile-anvil.sh` (template) - `docs/testing/REORG_STRATEGY.md` - New: `scripts/verify-indexer-reorg-anvil.sh` ## Recommended direction 1. Start Anvil + indexer + seed buys/level-up events. 2. `anvil_reset` or shallow reorg to common ancestor. 3. Re-ingest; assert `chain_pointer`, level history, and key transition rows consistent. 4. Document in `docs/testing/ci.md` or invariants. ## Acceptance criteria - [ ] New verify script exits 0 on happy path. - [ ] Script documented in gap-analysis verify table / `scripts/qa/README.md`. - [ ] Fails loudly on ingest divergence. ## Test plan | Path | Command | |------|---------| | Script | `bash scripts/verify-indexer-reorg-anvil.sh` | | Indexer | `cd indexer && cargo test` | | Postgres | `bash scripts/verify-cloud-postgres.sh` | ## Attack / abuse test plan - Script must not leave orphan DB state that breaks subsequent verifies. - Re-ingest must not duplicate events after rollback. ## Verification criteria - `bash scripts/verify-indexer-reorg-anvil.sh` PASS on Cloud VM. - Integration-level assertions match on-chain state post-reorg.
PlasticDigits commented 2026-06-25 20:07:50 +00:00 (Migrated from gitlab.com)

mentioned in issue #342

mentioned in issue #342
PlasticDigits commented 2026-06-26 03:56:27 +00:00 (Migrated from gitlab.com)

mentioned in commit 4907e9dce5

mentioned in commit 4907e9dce5e3b96c6f428022f602b3b53fbe6ca0
PlasticDigits commented 2026-06-26 03:56:53 +00:00 (Migrated from gitlab.com)

mentioned in merge request !525

mentioned in merge request !525
PlasticDigits commented 2026-06-26 04:29:20 +00:00 (Migrated from gitlab.com)

mentioned in commit 1dae16d806

mentioned in commit 1dae16d806d4ff35b45805be63d209928c305284
PlasticDigits commented 2026-06-26 06:43:41 +00:00 (Migrated from gitlab.com)

mentioned in issue #344

mentioned in issue #344
PlasticDigits commented 2026-06-26 08:12:19 +00:00 (Migrated from gitlab.com)

Verification complete — #351

Verified on Cloud VM (main @ origin/main). No repo changes required; closing issue.

Acceptance criteria

Item Result How verified
New verify script exits 0 on happy path PASS bash scripts/verify-indexer-reorg-anvil.sh → exit 0 (~8 min). Output: === verify-indexer-reorg-anvil: OK (buyer=0x7099…, ancestor>=13, buy_count=1) ===
Script documented in gap-analysis verify table / scripts/qa/README.md PASS scripts/qa/README.md § "Indexer Anvil verify scripts (gap #342)" lists verify-indexer-reorg-anvil.sh → #351. Cross-links: docs/testing/invariants-and-business-logic.md (INV-INDEXER-351-REORG-ANVIL), indexer/REORG_STRATEGY.md, docs/testing/e2e-anvil.md, docs/testing/ci.md (optional), skills/script-with-timearena-local/SKILL.md.
Fails loudly on ingest divergence PASS Script assert_no_ingest_divergence / wait_for_reorg_heal call die() (non-zero + log tail). Negative probe: DATABASE_URL=…/nonexistent_db_351 bash scripts/verify-indexer-reorg-anvil.sh → exit 1, verify-indexer-reorg-anvil: indexer /v1/status unavailable + DB error in indexer log. Happy path logs reorg detected + rolled back after reorg.

Test plan (issue body)

Path Command Result
Script bash scripts/verify-indexer-reorg-anvil.sh PASS (exit 0)
Indexer cd indexer && cargo test PASS (82 unit + 7 integration)
Postgres bash scripts/verify-cloud-postgres.sh PASS (psql, pg_isready, CREATEDB probe)

Attack / abuse criteria

Item Result How verified
No orphan DB state for subsequent verifies PASS verify_indexer_stack.sh drops/recreates app DB each run (yieldomega_verify_pg_reset_app_db); verify-cloud-postgres.sh PASS after script run
Re-ingest must not duplicate events after rollback PASS Script asserts COUNT(idx_arena_buy) == COUNT(DISTINCT tx_hash) == 1 and idx_arena_level_up == 0 post-heal; wallet stats buy_count=1, level_history[1].reached_at null

Integration assertions (post-reorg)

  • chain_pointer block/hash matches RPC head
  • On-chain TimeArena.level(buyer) == 1
  • GET /v1/arena/wallet/{address}/stats: buy_count=1, L1 reached_at set, L2 reached_at null

Follow-ups

  • Consider promoting the optional line in docs/testing/ci.md to a documented agent/CI gate once reorg smoke runtime (~8 min deploy+ingest) is acceptable in scheduled jobs.
## Verification complete — #351 Verified on Cloud VM (`main` @ `origin/main`). No repo changes required; closing issue. ### Acceptance criteria | Item | Result | How verified | |------|--------|--------------| | New verify script exits 0 on happy path | **PASS** | `bash scripts/verify-indexer-reorg-anvil.sh` → exit 0 (~8 min). Output: `=== verify-indexer-reorg-anvil: OK (buyer=0x7099…, ancestor>=13, buy_count=1) ===` | | Script documented in gap-analysis verify table / `scripts/qa/README.md` | **PASS** | `scripts/qa/README.md` § "Indexer Anvil verify scripts (gap #342)" lists `verify-indexer-reorg-anvil.sh` → [#351](https://gitlab.com/PlasticDigits/yieldomega/-/issues/351). Cross-links: `docs/testing/invariants-and-business-logic.md` (`INV-INDEXER-351-REORG-ANVIL`), `indexer/REORG_STRATEGY.md`, `docs/testing/e2e-anvil.md`, `docs/testing/ci.md` (optional), `skills/script-with-timearena-local/SKILL.md`. | | Fails loudly on ingest divergence | **PASS** | Script `assert_no_ingest_divergence` / `wait_for_reorg_heal` call `die()` (non-zero + log tail). Negative probe: `DATABASE_URL=…/nonexistent_db_351 bash scripts/verify-indexer-reorg-anvil.sh` → exit 1, `verify-indexer-reorg-anvil: indexer /v1/status unavailable` + DB error in indexer log. Happy path logs `reorg detected` + `rolled back after reorg`. | ### Test plan (issue body) | Path | Command | Result | |------|---------|--------| | Script | `bash scripts/verify-indexer-reorg-anvil.sh` | **PASS** (exit 0) | | Indexer | `cd indexer && cargo test` | **PASS** (82 unit + 7 integration) | | Postgres | `bash scripts/verify-cloud-postgres.sh` | **PASS** (psql, pg_isready, CREATEDB probe) | ### Attack / abuse criteria | Item | Result | How verified | |------|--------|--------------| | No orphan DB state for subsequent verifies | **PASS** | `verify_indexer_stack.sh` drops/recreates app DB each run (`yieldomega_verify_pg_reset_app_db`); `verify-cloud-postgres.sh` PASS after script run | | Re-ingest must not duplicate events after rollback | **PASS** | Script asserts `COUNT(idx_arena_buy) == COUNT(DISTINCT tx_hash) == 1` and `idx_arena_level_up == 0` post-heal; wallet stats `buy_count=1`, `level_history[1].reached_at` null | ### Integration assertions (post-reorg) - `chain_pointer` block/hash matches RPC head - On-chain `TimeArena.level(buyer) == 1` - `GET /v1/arena/wallet/{address}/stats`: `buy_count=1`, L1 `reached_at` set, L2 `reached_at` null ### Follow-ups - Consider promoting the optional line in `docs/testing/ci.md` to a documented agent/CI gate once reorg smoke runtime (~8 min deploy+ingest) is acceptable in scheduled jobs.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-26 08:12:20 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/yieldomega#351
No description provided.