Skip to content

fix(payment): pin real Arbitrum RPC transports so large gas preflights succeed - #203

Merged
Nic-dorman merged 1 commit into
mainfrom
fix/payment-preflight-rpc-limit
Aug 7, 2026
Merged

fix(payment): pin real Arbitrum RPC transports so large gas preflights succeed#203
Nic-dorman merged 1 commit into
mainfrom
fix/payment-preflight-rpc-limit

Conversation

@Nic-dorman

Copy link
Copy Markdown
Member

Problem

On 0.9.6-rc.1, larger uploads fail at payment with Payment failed: Payment would fail on-chain: HTTP request failed. — before any wallet prompt appears (bridge users see no extension popup at all).

Root cause: the new gas preflight (#201) runs eth_estimateGas through the app's wagmi public client. With no explicit transport configured, Reown's WagmiAdapter points that client at its RPC proxy (rpc.walletconnect.org), which returns HTTP 403 for any request body over 16KB (verified empirically: 16,382-byte bodies pass, 16,397-byte bodies fail). A ~460MB merkle upload produces ~100KB of payForMerkleTree calldata, so the estimate is rejected deterministically. The adapter's built-in viem fallback doesn't help because extendCaipNetwork rewrites the chain's default RPC list to the same proxy URL — both fallback legs hit the identical broken endpoint, and arb1.arbitrum.io/rpc (which handles 256KB bodies fine) was never tried.

Small requests (allowance reads, wave-batch estimates for few-chunk uploads) stay under 16KB, which is why light testing passed.

Fix

  • plugins/appkit.client.ts — pass explicit transports to the WagmiAdapter: arb1.arbitrum.io/rpc for Arbitrum One, sepolia-rollup.arbitrum.io/rpc for Sepolia. The adapter's extendWagmiTransports keeps its own proxy as an automatic fallback leg behind the pinned transport, so redundancy is preserved — the real RPC just becomes primary.
  • utils/payment.ts — when every preflight attempt dies at the transport layer (HttpRequestError / TimeoutError in the cause chain), the error now reads Couldn't reach the Arbitrum RPC to estimate gas: … instead of falsely claiming the payment would revert.

Testing

  • Vitest 11/11 including a new regression test for the transport-failure message path.
  • nuxi typecheck clean.
  • Verified live on Windows against mainnet: 462MB (119 chunks, depth 7) merkle upload that reproduced the failure on rc.1 now reaches the browser-extension wallet with a normal fee quote via the loopback bridge.

🤖 Generated with Claude Code

…s succeed

The gas preflight added for explicit payment gas limits routes
eth_estimateGas through the app's own wagmi public client. Without an
explicit transport, Reown's WagmiAdapter points that client at its RPC
proxy (rpc.walletconnect.org), which rejects any request body over 16KB
with an HTTP 403 - and since the adapter also rewrites the chain's
default RPC list to the same proxy URL, the viem fallback transport
retried the identical broken endpoint. Large payForMerkleTree /
payForQuotes estimates (a ~460MB merkle upload is ~100KB of calldata)
therefore failed deterministically before any wallet prompt, surfacing
as "Payment would fail on-chain: HTTP request failed."

Two changes:
- Pin explicit transports (arb1.arbitrum.io/rpc, sepolia-rollup) on the
  WagmiAdapter. The adapter keeps its proxy as an automatic fallback
  leg, so we gain the real RPC as primary without losing redundancy.
- When every preflight attempt dies at the transport layer, say
  "Couldn't reach the Arbitrum RPC to estimate gas" instead of falsely
  claiming the payment would fail on-chain.

Verified live: 462MB (119-chunk, depth-7) merkle upload now reaches the
wallet with a normal fee quote.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Nic-dorman
Nic-dorman merged commit bd1e8ce into main Aug 7, 2026
4 checks 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