Skip to content

Commit

Permalink
fix(core): Batched event processing support for Reth (#2623)
Browse files Browse the repository at this point in the history
## What ❔

Add batching for event processing for a Reth local L1 node.

## Why ❔

Similar to Alchemy and Infura, a Reth local node also has a limit for
the maximum number of results it can handle for event requests.

## Checklist

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
  • Loading branch information
Archethect authored Sep 5, 2024
1 parent 0f2f9bd commit 958dfdc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/node/eth_watch/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub trait EthClient: 'static + fmt::Debug + Send + Sync {
pub const RETRY_LIMIT: usize = 5;
const TOO_MANY_RESULTS_INFURA: &str = "query returned more than";
const TOO_MANY_RESULTS_ALCHEMY: &str = "response size exceeded";
const TOO_MANY_RESULTS_RETH: &str = "query exceeds max block range";

/// Implementation of [`EthClient`] based on HTTP JSON-RPC (encapsulated via [`EthInterface`]).
#[derive(Debug)]
Expand Down Expand Up @@ -178,6 +179,7 @@ impl EthClient for EthHttpQueryClient {
// check whether the error is related to having too many results
if err_message.contains(TOO_MANY_RESULTS_INFURA)
|| err_message.contains(TOO_MANY_RESULTS_ALCHEMY)
|| err_message.contains(TOO_MANY_RESULTS_RETH)
{
// get the numeric block ids
let from_number = match from {
Expand Down

0 comments on commit 958dfdc

Please sign in to comment.