perf(solana): drop both RPC round-trips from the x402 payment critical path (0.19.1) - #6
Merged
Merged
Conversation
added 2 commits
July 27, 2026 16:01
Marketing numbers here were hand-maintained and had drifted from the catalog. They now regenerate from blockrun.ai/brand/numbers.json via markers, and CI fails offline against a committed snapshot when they disagree. scripts/sync-brand-numbers.mjs is vendored byte-for-byte from BlockRunAI/blockrun:brand/ — a package would mean a dependency bump in every repo, and several consumers have no package manifest at all. blockrun CI compares the copies, so this one cannot quietly fall behind. Frontmatter takes literals rather than markers: an HTML comment there is part of the YAML string, not invisible.
…l path (0.19.1) USDC mint info (token program + decimals=6) is immutable, so getAccountInfo is skipped for USDC; getLatestBlockhash is cached per RPC endpoint with a 10s TTL, bounded to 8 endpoints. No duplicate-transaction guard is needed on blockhash reuse (unlike the TS SDK): every transaction carries a random 16-byte memo nonce, so payments are never byte-identical. Paid benchmark (gpt-4o-mini via sol.blockrun.ai, n=6): median 2.16s -> 1.72s, mean 3.57s -> 1.74s, max 9.68s -> 2.31s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Paid latency benchmark of the Go VIP SDK (gpt-4o-mini, n=6 per chain) showed Solana payments running a median 2.16s vs 1.37s on Base, with a 9.68s worst case. The entire gap traced to two serial JSON-RPC calls on the signing path — `getAccountInfo` (mint info) and `getLatestBlockhash` — each measured at 0.26–4.53s against the default RPC proxy. Base signs EIP-712 purely locally.
What
Mirrors the TS SDK fast path (blockrun-llm-ts `src/x402.ts`):
Results (paid calls via sol.blockrun.ai)
Steady-state signing now does zero RPC. The residual ~0.6s gap vs Base is gateway-side settlement, not SDK.
Tests
TDD: 5 new tests in `solana_fastpath_test.go` (USDC skips mint RPC, non-USDC still fetches, cache hit within TTL, refetch after TTL, cache bounded), all watched red first. Full suite + `-race` + `go vet` clean.