Skip to content

fix(client): split rejected RPC batches#134

Open
cesarenaldi wants to merge 1 commit into
mainfrom
fix/rpc-batch-split-retry
Open

fix(client): split rejected RPC batches#134
cesarenaldi wants to merge 1 commit into
mainfrom
fix/rpc-batch-split-retry

Conversation

@cesarenaldi

@cesarenaldi cesarenaldi commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Retry rejected JSON-RPC eth_call batches by recursively splitting them into parallel half-size batches.
  • Fall back to a normal single ethCall when splitting reaches one request.
  • Preserve result ordering across split retries.

Verification

  • pnpm vitest --project client packages/client/src/rpc.test.ts --run
  • pnpm vitest --project client-integration packages/client/tests/integration/approvals.test.ts --run -t "submits a combined trading-setup approval workflow"
  • pnpm lint
  • pnpm typecheck

Also attempted the full client integration suite; it did not complete cleanly because live services returned rate limits, geoblock responses, and request timeouts unrelated to this change.


Note

Medium Risk
Changes batch RPC failure handling for all multi-call reads (e.g. large approval checks), increasing request volume on 5xx but only for transport/server errors.

Overview
ethCallBatch now retries when the JSON-RPC batch POST fails with a 5xx RequestRejectedError, instead of failing the whole batch immediately.

On those server errors it recursively splits the call list in half, runs both halves in parallel, and concatenates results so output order still matches the input. A single remaining call uses the existing ethCall path. 4xx, JSON-RPC execution errors, and other non-5xx failures are unchanged (still thrown).

A new unit test simulates 500 on array batch bodies and asserts four results in order after split retries (seven HTTP posts total).

Reviewed by Cursor Bugbot for commit b15a8fb. Bugbot is set up for automated code reviews on this repo. Configure here.

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