fix: correct bundler JSON-RPC error mapping and getUserOperationByHash types - #219
Conversation
Only blockNumber was converted; the returned userOperation kept the bundler's wire-format hex strings in fields the declared type promises as bigint (nonce, gas limits, fees), so comparisons like nonce === 0n were silently always false and bigint arithmetic threw. Convert the numeric fields like getUserOperationReceipt and estimateUserOperationGas already do. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The BundlerErrorCodeDict translated -32601 to INVALID_USEROPERATION_HASH, but nothing assigns it that meaning: ERC-7769 defines no error code for invalid hashes on the lookup methods, and Voltaire returns -32602 (InvalidFields) with 'Missing/invalid userOpHash' — its only -32601 is the standard JSON-RPC method-not-found, which this mapping was shadowing and misdirecting debugging toward hash issues. -32601 now always translates to METHOD_NOT_FOUND; the INVALID_USEROPERATION_HASH code remains in the BundlerErrorCode union for compatibility but is marked deprecated and never produced. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…RROR BundlerErrorCodeDict covered ERC-7769 codes -32500..-32507 but omitted -32508 (paymaster balance insufficient for all mempool UserOperations), which Voltaire's mempool manager actively raises — it surfaced as inner UNKNOWN_ERROR. Bundler-side -32603 internal errors (raised by Voltaire's execution endpoint) likewise fell to UNKNOWN_ERROR because translateBundlerError only consulted the bundler dict; it now falls through to the standard INTERNAL_ERROR name, matching the -32601 METHOD_NOT_FOUND handling. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesBundler normalization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
| } | ||
| return { | ||
| ...jsonRpcResult, | ||
| userOperation: userOperation as unknown as UserOperationV6 | UserOperationV7, |
There was a problem hiding this comment.
getUserOperationByHash() declares and casts its result as only V6/V7. See the types file as ell. should e include UserOperationV8 and UserOperationV9 in the result type?
The SDK submits EntryPoint v0.8/v0.9 operations, but the eth_getUserOperationByHash result typed userOperation as only V6 | V7, forcing an unsafe cast to reach fields like eip7702Auth. Widen the declared type and the internal cast to the full V6-V9 union, matching sendUserOperation and estimateUserOperationGas. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Three fixes to how
Bundlertranslates JSON-RPC responses.-32601no longer misreported asINVALID_USEROPERATION_HASH: nothing assigns it that meaning — ERC-7769 defines no error code for invalid hashes, and Voltaire returns-32602for a missing/invaliduserOpHash. The mapping was shadowing the standard method-not-found error and misdirecting debugging toward hash issues.-32601now always translates toMETHOD_NOT_FOUND;INVALID_USEROPERATION_HASHstays in theBundlerErrorCodeunion for compatibility but is deprecated and never produced.-32508and-32603mapped:-32508(paymaster deposit/balance insufficient, actively raised by Voltaire's mempool manager) now maps toPAYMASTER_DEPOSIT_TOO_LOW, and bundler-side-32603falls through to the standardINTERNAL_ERRORinstead ofUNKNOWN_ERROR.getUserOperationByHashreturned hex strings in bigint fields: onlyblockNumberwas converted; nonce, gas limits, and fees kept wire-format hex strings despite the declared type, sononce === 0nwas silently always false and bigint arithmetic threw. Numeric fields are now converted, matchinggetUserOperationReceiptandestimateUserOperationGas.Tests added in
test/transport/Bundler.error-mapping.test.jsandtest/transport/Bundler.getUserOperationByHash.test.js; full offline suite passes.Summary by CodeRabbit
BigIntrepresentation, including for pending operations.getUserOperationByHashresult.