feat(commerce): wrap @solana/mpp.charge with finalized-blockhash request override#9
Merged
vvillait88 merged 1 commit intomainfrom May 5, 2026
Conversation
…est override @solana/mpp <=0.5.2 fetches getLatestBlockhash with commitment='confirmed' but its broadcast sendTransaction sets skipPreflight:false without an overridden preflightCommitment, so the RPC's default 'finalized' preflight rejects any not-yet-finalized blockhash with "Blockhash not found". This shipped to martin-estate prod and broke every solana/charge smoke during the release cycle. Wrap solanaMpp.charge() so the issued challenge carries a finalized blockhash on first try. Trade-off: agent signing window shrinks ~58s → ~46s, fine for agent flows. Validated end-to-end on devnet against a local martin-estate (sponsor pays gas, buyer-signed SPL authority, $0.11 USDC moved on-chain). Bumps @agent-score/commerce 1.3.0 → 1.3.1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
@solana/mpp.charge()'s Method to overriderequestand fetch the challenge blockhash withcommitment: 'finalized'instead of the library's defaultconfirmed.@agent-score/commerce1.3.0 → 1.3.1.Why
@solana/mpp<= 0.5.2 fetchesgetLatestBlockhashatconfirmedfor its 402 challenge, but the server's broadcastsendTransactionis hardcoded to{ skipPreflight: false }with nopreflightCommitmentoverride. The RPC's default preflight commitment isfinalized(~30 slots / ~12s ahead ofconfirmed), so the preflight simulator rejects every fresh blockhash withBlockhash not found.This shipped to martin-estate prod and broke every Solana smoke during the deploy cycle this morning. Same bug exists in every published
@solana/mppversion 0.1.0 → 0.5.2.We own the wrapper; not pursuing an upstream PR.
What changed
wrapSolanaChargeWithFinalizedBlockhash(baseMethod, rpcUrl)insrc/payment/mppx_server.ts.createMppxServer's solana branch now wrapssolanaMpp.charge(...)through the helper before pushing intomethods[].tests/payment/wrap_solana_charge.test.tscovering: success path, verify-leg passthrough, fetch-throw fallback, missing-blockhash fallback, undefined-orig passthrough.Trade-off: signing window shrinks ~58s → ~46s; fine for agent-driven flows.
Test plan
agentscore-pay --chain solana --network testnetagainst local martin-estate (sponsor-paid gas, buyer-signed SPL authority, 0.11 USDC moved on-chain)🤖 Generated with Claude Code