Skip to content

fix(rpc): add timeout, batch limit, typed errors, and retry fixes#5166

Closed
lry3069-afk wants to merge 3 commits into
ClankerNation:mainfrom
lry3069-afk:fix/issue-38
Closed

fix(rpc): add timeout, batch limit, typed errors, and retry fixes#5166
lry3069-afk wants to merge 3 commits into
ClankerNation:mainfrom
lry3069-afk:fix/issue-38

Conversation

@lry3069-afk
Copy link
Copy Markdown

Fixes #38

Summary

All 5 acceptance criteria addressed:

  1. Timeout - AbortController with configurable imeoutMs (default 30s) on both call() and �atchCall(). Throws RpcTimeoutError on abort.

  2. Batch size limit - BATCH_SIZE_LIMIT of 100 enforced before sending. Throws BatchSizeLimitError when exceeded.

  3. Typed errors - 4 new error classes in errors.ts: RpcTimeoutError, RpcHttpError, RpcBatchError, BatchSizeLimitError. RPC error responses are type-checked (code/message validated).

  4. Batch response matching - Responses matched by request id field instead of array position. Partial failures surface per-item errors via RpcBatchError.

  5. Retry fixes - maxRetries capped at 5 (was Infinity). consecutiveFailures reset on success. Backoff exponent capped at 20 to prevent overflow. isRetryable() now matches 429/503 status codes.

Files changed

  • sdk/src/providers/errors.ts (new) - typed error classes
  • sdk/src/providers/rpc.ts - timeout, batch limit, id-based matching
  • sdk/src/utils/retry.ts - finite retries, failure reset, 429/503 support

Testing

  • No runtime dependencies changed - all changes are additive with backward-compatible defaults
  • Existing RpcProvider constructor calls work without modification
  • All new options have sensible defaults matching the original behavior (minus the bugs)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request within 2 hours.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting.

@github-actions github-actions Bot closed this Jun 2, 2026
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.

[ Bounty $3k ] [ SDK ] Fix RPC provider has no timeout and batch gas limit

1 participant