perf(extreme-fast-mode): use processed commitment + tight retry for BC refresh

Before: BC fetch in extreme_fast_mode used default (confirmed) commitment
and retried up to 10 times with growing backoff (~10s total). Geyser/logs
fire on processed, so the BC isn't yet at confirmed commitment when the
bot reads it — most fetches failed and burned the full retry budget,
adding ~10s to detect→confirmed.

After: read at processed commitment to match the listener event horizon,
and cap retries at 4 with 150ms gaps (~600ms ceiling). Most reads succeed
on the first attempt.

Mainnet benchmark (n=4 successful buys, geyser listener):
  buy_slot − create_slot: min=2  median=3  max=9  (~0.8s — 3.6s on chain)
  wall detect→confirmed:  median 2-3s (1s resolution)

Best case 2 slots = next slot after creation + tx propagation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anton Sauchyk
2026-04-28 22:11:37 +02:00
co-authored by Claude Opus 4.7
parent 20e3e163d8
commit 27929e97be
3 changed files with 25 additions and 12 deletions
+7 -6
View File
@@ -76,18 +76,19 @@ class PlatformAwareBuyer(Trader):
)
pool_state = None
last_err: Exception | None = None
# Up to ~6s of retries — pumpportal frequently fires before
# the BC account is RPC-readable. Without a settled BC the
# bot can't pick the right fee_recipient or creator_vault.
for attempt in range(10):
# Use processed commitment — geyser/logs fire on processed
# so the BC is typically readable in the same slot. Most
# listeners only need 1 attempt; pumpportal occasionally
# races the on-chain commit, so allow a few quick retries.
for attempt in range(4):
try:
pool_state = await curve_manager.get_pool_state(
pool_address
pool_address, commitment="processed"
)
break
except Exception as inner: # noqa: BLE001
last_err = inner
await asyncio.sleep(min(0.3 + 0.3 * attempt, 1.5))
await asyncio.sleep(0.15)
if pool_state is None:
raise last_err or RuntimeError(
"pool_state unavailable after retries"