Skip to content

fix(blockrun): safely retry stale Solana blockhash - #720

Merged
jjcc123312 merged 1 commit into
mainfrom
codex/blockrun-solana-payment
Aug 14, 2026
Merged

fix(blockrun): safely retry stale Solana blockhash#720
jjcc123312 merged 1 commit into
mainfrom
codex/blockrun-solana-payment

Conversation

@jjcc123312

Copy link
Copy Markdown

Problem

Solana x402 signatures include a server-provided recent blockhash. A signed retry can be rejected with PAYMENT_INVALID / expired_signature or stale blockhash errors. The previous adapter treated every second 402 as terminal, so recoverable stale challenges failed; blindly retrying every 402 would risk duplicate settlement.

Scope and design

  • Add a Solana-only retry state machine in relay/channel/blockrun.
  • Retry only explicit verification-phase stale/blockhash errors.
  • Fetch a fresh unsigned 402 challenge and sign a new payload for each retry.
  • Bound retries to two attempts with 500ms and 2s backoff.
  • Never retry SETTLEMENT_FAILED, insufficient_funds, ordinary 402 responses, or poll/settlement failures.
  • Leave Base payment behavior and video channels unchanged.

Validation

  • go test ./relay/channel/blockrun passes.
  • Targeted BlockRun regression tests pass, including current OpenAI, nested Anthropic, legacy stale-blockhash, settlement, insufficient-funds, body restoration, and 64KB limits.
  • go test ./relay/... reaches unrelated pre-existing failures in Claude/Codex packages; BlockRun packages pass.

Deployment

This changes shared relay request handling for BlockRun Solana and therefore requires router deployment after review. No staging or production deployment was performed by this change.

@jjcc123312
jjcc123312 merged commit caa5bfb into main Aug 14, 2026
1 check 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