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::recoverablemarked as deprecated, because there already is a more advancedis_retry_errmethod. The deprecation message suggests using it, orRetryBackoffLayerfor HTTP.- Retries were removed from
PollerBuilderandChainStreamPoller. 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. ChainPollerStreamwas 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_NUMBERused 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.
@mattsse could you please take a look?
ah sorry, thanks for the ping, will check in a bit
GM @mattsse Sorry for pinging again; do you think anything else should be done in the scope of this PR?
@mattsse this PR got a bit stale :) If this functionality is not something alloy will benefit from, I can close the PR (though I've promised to ship some currently lacking tests that depend on this functionality), but I would prefer not to leave it hanging.
@DaniPopes @gakonst Sorry for pinging, but I'm unsure how to proceed with this PR.
I'll close this PR as stale. If you think it's worth merging, I'm happy to re-open and resolve merge conflicts.