Skip to content

reduce barter debounce, remove verbose logging#88

Merged
owen-eth merged 10 commits intomainfrom
polling-optimization
Mar 30, 2026
Merged

reduce barter debounce, remove verbose logging#88
owen-eth merged 10 commits intomainfrom
polling-optimization

Conversation

@owen-eth
Copy link
Copy Markdown
Contributor

No description provided.

owen-eth and others added 10 commits March 25, 2026 14:11
… detection

Phase 1 now only polls the two fast sources (commitment status + RPC receipt)
that hit FastRPC directly. The slow mctransactions DB call (via StarRocks)
runs independently on a 2s interval for failure detection only, never blocking
the fast path.

Previously Promise.all waited for all three sources including the slow DB query,
meaning each poll cycle was bottlenecked by StarRocks latency (~1-2s) even though
the RPC returns in ~50-100ms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tatus

Wagmi's useWaitForTransactionReceipt treated FastRPC's simulated preconf
receipt as a real on-chain receipt, causing the toast to jump straight to
"Tokens Available" (confirmed) and skip the "Preconfirmed" state entirely.

Now passes receipt: undefined to useWaitForTxConfirmation so only our
custom polling detects status transitions. Also adds console logging
for preconf/confirmed/error events for debugging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shows elapsed seconds from submit and gap between preconf/confirmed.
Example: [SwapToast] PRECONFIRMED | +1.23s from submit
         [SwapToast] CONFIRMED | +13.45s from submit | +12.22s from preconf

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allows comparison with commitment dispatch_timestamp from RPC
to measure exact UI detection delay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…irmed

Phase 1 (preconfirmation): fast polling of commitment status + RPC receipt
against FastRPC directly, with DB failure detection on independent 2s interval.
No Promise.all bottleneck from slow StarRocks queries.

Phase 2 (confirmation): wagmi watches for real L1 on-chain receipt.
Previously Phase 2 used FastRPC's eth_getTransactionReceipt which returns
a simulated receipt for preconfirmed txs, causing premature "confirmed" status.
Wagmi correctly distinguishes real L1 receipts from simulated ones.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

Logs each poll cycle result (commit status + rpc receipt status) for
the first 10 polls and every 10th after that. Will show exactly what
the frontend sees during the delay window.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously JSON-RPC errors (like "failed to get transaction commitments")
were silently swallowed — the catch blocks returned null indistinguishable
from "not found yet". Now logs warn-level messages so we can see exactly
what FastRPC returns during the polling window.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fastprotocolapp Ready Ready Preview, Comment Mar 30, 2026 11:14pm

Request Review

@owen-eth owen-eth merged commit 63315f2 into main Mar 30, 2026
2 of 3 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.

1 participant