alloy
alloy copied to clipboard
refactor: Refactor ChainStreamPoller
Fixes #1053
This PR turned out a bit larger than I wanted it to be, but I don't think it makes much sense to split it into several ones. Here's what changed:
-
TransportErrorKind::recoverable
marked as deprecated, because there already is a more advancedis_retry_err
method. The deprecation message suggests using it, orRetryBackoffLayer
for HTTP. - Retries were removed from
PollerBuilder
andChainStreamPoller
. The logic there was pretty basic and it wouldn't solve most problems that can realistically occur. IMHO, recovering belongs to the transport domain; otherwise, there will be one recovery implementation per client user, and a good solution is already present in the project -RetryBackoffLayer
. I guess something like this is needed for WebSocket as well. -
ChainPollerStream
was split into two parts. One handles initialization (works like a tiny builder), and one actually stores the stream state. It allowed us to get rid ofNO_BLOCK_NUMBER
used as a placeholder. - Dedicated error type was added to simplify implementation.
- Finally, batches are now requested via JSON RPC batch request instead of sequential single requests.