Closed drewstone closed 1 year ago
Filtering ALL events will not blow the RPC call because eth_getLogs
allows to inclusion multiple event topics in a single filter. So we will be making only one RPC call.
async fn get_logs(&self, filter: &Filter) -> Result<Vec<Log>, ProviderError> {
self.request("eth_getLogs", [filter]).await
}
We can try configuring a higher cool-down period for fetching events.
Is it possible that we can query over a larger interval of blocks with a single query?
Yes, we have a configuration to fetch larger interval.
/// The maximum number of events to fetch in one request.
#[serde(default = "defaults::max_blocks_per_step")]
pub max_blocks_per_step: u64,
Once the relayer is synced with the latest block it will wait for cool down period and fetch next events as following
// block: last processed block number
// step: max_blocks_per_step (default 500 blocks)
// target_block_number: Latest block number on chain (after cool down)
let dest_block = core::cmp::min(block + step, target_block_number);
In order to have a large interval range we need to have a large cool-down period. Maybe we add dynamic time interval
Overview
We are exhausting our INFURA api each day, quite early every day. We need to continue to optimize the RPC calls we are making. However we are fetching data, we should find new ways of consolidating these calls.
The most common calls are:
Checklist