Skip to content

Commit

Permalink
Added LlamaNodes ChunkedEncodingError
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Oct 6, 2023
1 parent 62b3dbf commit b5f1d77
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion eth_defi/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ConnectionError,
HTTPError,
Timeout,
TooManyRedirects,
TooManyRedirects, ChunkedEncodingError,
)
from web3._utils.transactions import get_buffered_gas_estimate
from eth_utils.toolz import assoc
Expand All @@ -47,6 +47,14 @@
# but we'll add it here just to work around this crappy provider
# by default.
BlockNotFound,

# Spit out by LlamaNodes.
#
# Their server give invalid HTTP reply.
#
# requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
#
ChunkedEncodingError,
)

#: List of HTTP status codes we know we might want to retry after a timeout
Expand Down
8 changes: 7 additions & 1 deletion eth_defi/provider/broken_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ def get_block_tip_latency(web3: Web3) -> int:
- Defaults to zero
- We have some built-in rules to work around broken providers like Ankr
- If using :py:class:`eth_defi.provider.fallback.FallbackProvider`
we use 4 blocks latency as multiple providers are unlikely
to agree on a chain tip (blocks have not propagated yet).
- We have some built-in rules to work out specific providers
- You can override this by setting the latency sa ``web3.block_tip_latency`` attribute
See the source code of :py:func:`get_default_block_tip_latency` for other rules.
Example:
.. code-block:: python
Expand Down

0 comments on commit b5f1d77

Please sign in to comment.