Skip to content

test(solana): pin zero client RPC on a paid GET with a server blockhash - #18

Merged
VickyXAI merged 1 commit into
mainfrom
test/paid-get-zero-rpc
Aug 4, 2026
Merged

test(solana): pin zero client RPC on a paid GET with a server blockhash#18
VickyXAI merged 1 commit into
mainfrom
test/paid-get-zero-rpc

Conversation

@VickyXAI

@VickyXAI VickyXAI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Test-only. No production code changes.

Why

v0.19.3 ships the client half of x402#2693: when the 402 requirement carries extra.recentBlockhash, signing skips getLatestBlockhash entirely. Combined with the hardcoded USDC mint info, a paid Solana GET should now touch zero client RPC.

Nothing tested that.

  • solana_x402_test.go exercises extra.recentBlockhash at the signing-function level and never goes through a paid GET.
  • paid_get_test.go goes through a paid GET but lets the blockhash come from the RPC fallback.

The two files are disjoint, so the exact combination the release is named after was unguarded. The fast path could silently regress to a working-but-slow RPC fetch and the whole suite would stay green — the failure mode is a latency and cost regression, not a broken call, which is precisely the kind that survives review.

This gap only became reachable once #9 and #7 both landed, which is why neither PR could have covered it on its own.

What it asserts

TestPaidGetWithServerBlockhashMakesNoRPC drives a Solana client through a full paid GET whose 402 carries a server-supplied blockhash, then checks:

  • the signed transaction carries that hash, not one from RPC
  • getLatestBlockhash calls == 0
  • getAccountInfo calls == 0

Verification

  • Passes with egress fully blocked, like the rest of the file (RPC and API are both local fakes).
  • Mutation-checked: disabling serverProvidedBlockhash fails this test and only this test.
  • Full suite green with -race -count=2 -shuffle=on, go vet clean.

VERSION/CHANGELOG untouched — test-only, nothing user-visible to note.

0.19.3 ships the client half of x402#2693: when the 402 carries
extra.recentBlockhash, signing skips getLatestBlockhash entirely. Nothing
tested that end to end.

solana_x402_test.go exercises extra.recentBlockhash at the signing-function
level and never goes through a paid GET. paid_get_test.go goes through a
paid GET but lets the blockhash come from the RPC fallback. The two files
are disjoint, so the combination the release is named after was unguarded:
the fast path could regress to a working-but-slow RPC fetch and every test
would stay green.

Assert the signed transaction carries the server's hash and that both
getLatestBlockhash and getAccountInfo see zero calls.

Mutation-checked: disabling serverProvidedBlockhash fails this test and
only this test. Offline, like the rest of the file.
@VickyXAI
VickyXAI merged commit 0b67a0f into main Aug 4, 2026
1 check passed
@VickyXAI
VickyXAI deleted the test/paid-get-zero-rpc branch August 4, 2026 04:40
VickyXAI pushed a commit that referenced this pull request Aug 4, 2026
Ships the paid-GET cache fix from #17 (fixes #10). doGetWithPayment never
consulted bc.cache, so WithCache(true) was a silent no-op on the endpoints
that cost money — /v1/pm/ has a 30-minute TTL yet every repeat call
re-signed and re-paid.

Also on main since 0.19.3, test-only: #18 pins that a paid GET with a
server-provided blockhash makes zero client RPC calls.
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