test(solana): pin zero client RPC on a paid GET with a server blockhash - #18
Merged
Conversation
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
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.
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.
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 skipsgetLatestBlockhashentirely. Combined with the hardcoded USDC mint info, a paid Solana GET should now touch zero client RPC.Nothing tested that.
solana_x402_test.goexercisesextra.recentBlockhashat the signing-function level and never goes through a paid GET.paid_get_test.gogoes 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
TestPaidGetWithServerBlockhashMakesNoRPCdrives a Solana client through a full paid GET whose 402 carries a server-supplied blockhash, then checks:getLatestBlockhashcalls == 0getAccountInfocalls == 0Verification
serverProvidedBlockhashfails this test and only this test.-race -count=2 -shuffle=on,go vetclean.VERSION/CHANGELOG untouched — test-only, nothing user-visible to note.