Skip to content

feat: add indexer lag guard to prevent broken UX during testnet insta…#537

Merged
Cedarich merged 1 commit into
Pulsefy:mainfrom
fadee26:feat/be-indexer-lag-guard
Jun 1, 2026
Merged

feat: add indexer lag guard to prevent broken UX during testnet insta…#537
Cedarich merged 1 commit into
Pulsefy:mainfrom
fadee26:feat/be-indexer-lag-guard

Conversation

@fadee26
Copy link
Copy Markdown
Contributor

@fadee26 fadee26 commented Jun 1, 2026

Indexer Lag Guard

Prevent broken UX during testnet instability by detecting Soroban indexer lag and automatically disabling risky write flows when the system is too far behind.

Features:

  • Define "lag" based on latest indexed ledger vs current network ledger with configurable thresholds (via INDEXER_LAG_THRESHOLD_LEDGERS env var, default: 100)
  • Add decorator @RequiresIndexerLagCheck() to mark endpoints that should be blocked when lag is too high
  • Add global guard that blocks selected endpoints when lag exceeds threshold
  • Surface stable error code INDEXER_LAGGING telling clients to retry later
  • Add metrics (indexer lag in ledgers, blocked requests, guard status) and audit logs for blocked requests
  • Add admin override (via INDEXER_LAG_GUARD_OVERRIDE=true env var)
  • Read‑only endpoints remain available

Acceptance Criteria:

✅ When lag exceeds threshold, risky flows are blocked consistently
✅ Read‑only endpoints remain available
✅ Operators can observe lag and overrides via metrics/logs

closes #534

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@fadee26 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich Cedarich merged commit 1ea3b56 into Pulsefy:main Jun 1, 2026
2 checks passed
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.

BE-57: Indexer Lag Guard (Auto-Disable Risky Flows When Behind)

2 participants