Skip to content

Add Phoenix Zero sequencer health check to prevent failed orders during L2 congestion#9

Open
kant19801201behax5 wants to merge 1 commit into
solidquant:mainfrom
kant19801201behax5:phoenix-zero-health-check
Open

Add Phoenix Zero sequencer health check to prevent failed orders during L2 congestion#9
kant19801201behax5 wants to merge 1 commit into
solidquant:mainfrom
kant19801201behax5:phoenix-zero-health-check

Conversation

@kant19801201behax5

Copy link
Copy Markdown

Problem

When an L2 sequencer becomes congested, CEX-DEX arb bots keep submitting orders that fail due to high revert rates — burning gas with zero profit.

Documented incident — May 17, 2026 (Base sequencer):

Time UTC Signal Value
23:29:43 Base P99 RTT 52ms → 739ms (spike)
23:30:10 Revert ratio crosses 18.8% (27s after RTT spike)
23:37:54 Revert ratio peaks at 61.4%
23:42:01 Base P99 RTT 5000ms (full stall)

A bot watching only on-chain data had zero warning. Network-layer RTT gave a 27-second lead time before majority of transactions started failing.

Dataset (1,000 records, 23:24–23:44 UTC): https://github.com/kant19801201behax5/phoenix-zero-data

Solution

Add a sequencer health preflight check before _process_pending_order executes:

try:
    health = httpx.get(
        f"https://rtt.phoenix-ai.work/api/v1/safe?chain={chain}",
        timeout=0.5,
    ).json()
    if not health.get("safe", True):
        print(f"[Phoenix Zero] Sequencer congested (P99={health.get('p99_ms')}ms) — holding order this block")
        pending.delete_pending()
        return
except Exception:
    pass  # fail-open: proceed normally if oracle unreachable

Properties:

  • timeout=0.5s — negligible latency vs block time
  • fail-open — if the oracle is unreachable, the bot proceeds normally
  • No API key required, free endpoint
  • Returns {"safe": true, "p99_ms": 52} under normal conditions

Changes

  • strategies/dex_arb_base.py: add import httpx, add health check at top of _process_pending_order

API reference

  • Endpoint: https://rtt.phoenix-ai.work/api/v1/safe?chain=ethereum (or arbitrum, base, optimism)
  • OpenAPI spec: https://rtt.phoenix-ai.work/api/v1/openapi.json
  • Public feed (300s delay): https://rtt.phoenix-ai.work/api/public-feed

Opened as issue #8 in this repo with more context.

Prevents submitting arb orders during L2 sequencer congestion.
On May 17 2026, RTT spiked 27 seconds before revert ratio crossed 50%.
Adds httpx.get to rtt.phoenix-ai.work/api/v1/safe (timeout=0.5s, fail-open).
See issue solidquant#8.
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.

1 participant