feat(indexer): reorg halt alerting and recovery dry-run preview (#362) #889
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!889
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cursor/verify-issue-362-reorg-alerting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
indexer_reorg_haltoperator signal (log targetindexer::reorg_alert) with optionalREORG_ALERT_WEBHOOK_URLPOST on halt.scripts/indexer-reorg-recover.shwith per-table row-impact preview,--cleanup-derived, andmake indexer-reorg-recoverwrapper; fixpostgres-dev.envto respect pre-setDATABASE_URL.Acceptance checklist
tracing::error)indexer/src/indexer/reorg_alert.rs—event=indexer_reorg_halt+ optional webhook; poller callsemit_reorg_halton both halt pathsdocs/runbooks/indexer-reorg-replay-dedup.mdshallow/deep sections; incident template checklistDATABASE_URL=…/dex_indexer_test ./scripts/indexer-reorg-recover.sh --height 100→ per-table counts + cursor SQL;--applyrequired to mutatecargo test --test indexer_ingestion_hardening swap_replay_does_not_duplicate_rowsTest plan
cd indexer && cargo test --libmake test-indexer-integrationindexer_ingestion_hardening)./scripts/indexer-reorg-recover.sh --height 100on migrated Postgrescargo test --test indexer_ingestion_hardening reorg_detectionAttack / abuse
--applyVerification criteria
Follow-ups
REORG_ALERT_WEBHOOK_URLin production deploy manifests / PagerDuty when ops stack is chosen.changed the description
changed the description
Security review — MR !889
Commit reviewed:
f784f944fc0bc4b6c9965d2963f33a330f07a46eScope:
indexer/src/indexer/reorg_alert.rs,poller.rshalt wiring,scripts/indexer-reorg-recover.shdry-run/apply/cleanup-derived,scripts/lib/postgres-dev.env, docs/runbook/Makefile/test additions for #362.Outcome:
FINDINGS: 0medium+ — NONEInline threads: none (no medium+ findings to anchor on the diff).
Review summary
--applygate (unchanged trust model).REORG_ALERT_WEBHOOK_URLoutbound POSTstd::env::var); not chain/user-controlled. Payload is serde JSON of halt metadata; 10s timeout; best-efforttokio::spawn. No attacker path to retarget URL or SSRF via LCD hashes.indexer-reorg-recover.sh)--heightconstrained to^[0-9]+$and>= 1;PREVis arithmetic; table names are a fixed allowlist; cursor SQL interpolates only validated integers.DATABASE_URLhost creds in output; webhook URL is not logged on success; halt fields are block hashes and static runbook pointers.Prior security-review threads on this MR: none found.
Security review: no medium+ findings on this diff.
resolved all threads
added 81 commits
mainaa6f387f- Merge origin/main into cursor/verify-issue-362-reorg-alertingCompare with previous version
Resolved merge conflicts with
mainby taking main's canonical #362 implementation:reorg_alert.rs(ReorgHaltDetails, asyncemit_reorg_halt, stderrINDEXER_REORG_HALTJSON);poller.rsupdated call sites; removed duplicatereorg_alertmod export inmod.rs.indexer-reorg-recover.sh— main'spsql_query/psql_exec, candle cleanup, single-transaction--apply.indexer-reorg-recovertarget; kept main'sCLEANUP=1/APPLY=1wrapper.Preserved branch fix:
postgres-dev.envstill respects a pre-setDATABASE_URL.Sanity:
cargo test --lib reorg_alertpassed;bash -non recovery script.changed the description
Security review — MR !889
Commit reviewed:
aa6f387f9f4570042c3f7ddb6c62df5de1c884fbScope (current diff):
scripts/lib/postgres-dev.env(DATABASE_URL/TEST_DATABASE_URLpreserve pre-set values via${VAR:-default});Makefilehelp text forindexer-reorg-recover.Outcome:
FINDINGS: 0medium+ — NONEInline threads: none (no medium+ findings to anchor on the diff).
Review summary
postgres-dev.envURL overrideDATABASE_URL/TEST_DATABASE_URLare operator-controlled (shell export or repo.envbefore sourcing). No chain/user/API path to influence these values. Aligns with documented override behavior and supports dry-run againstdex_indexer_testwithout clobbering a pre-exported URL.--applygate) is unchanged in this diff; still requires explicit operator invocation. PreservingDATABASE_URLdoes not introduce a new remote abuse path.Prior security review on this MR (
f784f944) covered the broader #362 feature set (reorg alert webhook, recovery script, poller wiring). Those paths are unchanged in this revision.Security review: no medium+ findings on this diff.
mentioned in commit
52748e1f1d