fix(client): split rejected RPC batches#117
Open
cesarenaldi wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eth_callchecks through the Python JSON-RPC client.Fixes #116
Verification
uv run ruff format --check src/polymarket/_internal/eoa/rpc.py src/polymarket/_internal/actions/relayer/approvals.py tests/unit/_relayer_helpers.py tests/unit/test_eoa_rpc.py tests/unit/test_eoa_broadcast.pyuv run ruff check src/polymarket/_internal/eoa/rpc.py src/polymarket/_internal/actions/relayer/approvals.py tests/unit/_relayer_helpers.py tests/unit/test_eoa_rpc.py tests/unit/test_eoa_broadcast.pyuv run pyright src/polymarket/_internal/eoa/rpc.py src/polymarket/_internal/actions/relayer/approvals.py tests/unit/_relayer_helpers.py tests/unit/test_eoa_rpc.py tests/unit/test_eoa_broadcast.pyuv run pytest tests/unitNote
Medium Risk
Changes RPC transport and approval-read paths used before submitting on-chain approvals; incorrect batch parsing or ordering could mis-detect missing approvals, though behavior is covered by new unit tests.
Overview
Adds
eth_call_batchon async and sync JSON-RPC clients so multipleeth_calls go out in one HTTP JSON-RPC array, with shared parsing helpers extracted from single-call paths.When a batch POST fails with a 5xx
RequestRejectedError, the client recursively splits the batch (down to single calls) and merges results in original order; client errors below 500 are not retried via splitting.Trading approval resolution (
resolve_missing_trading_approval_calls/ sync) now batches all ERC20 allowance and ERC1155isApprovedForAllreads in one batch instead of awaiting eacheth_callseparately. Unit mocks and tests were updated for batch request bodies; new tests cover split-on-5xx ordering for async and sync clients.Reviewed by Cursor Bugbot for commit 79bb0d2. Bugbot is set up for automated code reviews on this repo. Configure here.