You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when an empty batch is executed, some RPC endpoint (mine is Erigon) returns an object specifying the error instead of an array. This breaks the parsing and result in error: AttributeError: 'str' object has no attribute 'get'
The text was updated successfully, but these errors were encountered:
soyccan
changed the title
Batch requests fail to correctly parse responses when an empty batch is requested
Batch requests crash when an empty batch is requested against some Ethereum clients like Erigon
Oct 25, 2024
What happened?
A batch request to an Ethereum RPC endpoint is responded with an array containing the responses to each request in the batch:
So Web3.py assumes the response is an array while parsing it:
web3.py/web3/providers/rpc/rpc.py
Lines 187 to 188 in 3c412f8
However, when an empty batch is executed, some RPC endpoint (mine is Erigon) returns an object specifying the error instead of an array. This breaks the parsing and result in error:
AttributeError: 'str' object has no attribute 'get'
The same happens when the batch size exceeds the limit:
Code that produced the error
Full error output
Fill this section in if you know how this could or should be fixed
Revise the response parsing behavior in
web3/providers/rpc/rpc.py:make_batch_request()
and any other relevant filesweb3 Version
7.4.0
Python Version
3.12.5
Operating System
linux
Output from
pip freeze
The text was updated successfully, but these errors were encountered: