Skip to content

sdk: restore JSON-RPC batch correctness#5176

Open
0xjc65eth wants to merge 2 commits into
ClankerNation:mainfrom
0xjc65eth:fix-rpc-batch-ordering-161-v7
Open

sdk: restore JSON-RPC batch correctness#5176
0xjc65eth wants to merge 2 commits into
ClankerNation:mainfrom
0xjc65eth:fix-rpc-batch-ordering-161-v7

Conversation

@0xjc65eth
Copy link
Copy Markdown

Fixes #161

/claim #161
Payment: BTC | bc1qjf2t6dc75c6t2948essyrqec0a08l8zl28fcfh | Bitcoin

Summary:

  • Match JSON-RPC batch responses by id instead of response array position.
  • Preserve original request order in the returned array.
  • Return per-item error objects for partial JSON-RPC failures.
  • Return per-item timeout errors for missing response ids.
  • Abort a hung batch request with a configurable timeout and return timeout errors for every request.
  • Add tests for shuffled response order, partial failure, missing response timeout, and whole-batch timeout.
  • Add top-of-file contributor metadata and CONTRIBUTORS.json runtime metadata.

Verification:

  • npx mocha test/SDKRpcBatchOrdering.test.js -> 4 passing
  • npx tsc --noEmit --ignoreConfig --target ES2020 --module commonjs --types node sdk/src/providers/rpc.ts -> clean
  • node --check test/SDKRpcBatchOrdering.test.js -> clean
  • CONTRIBUTORS.json parses as valid JSON
  • git diff --check -> clean

Competing PR review:

  • Reviewed the competing RPC batch implementation and flagged a missing whole-batch timeout path before submitting this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ Bounty $9k ] [ SDK ] Fix rpc.ts doesn't handle JSON-RPC batch response ordering — backwards compat

1 participant