Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ serde_json = "1.0.149"
futures = "0.3.32"
tokio-stream = "0.1.18"
clap = { version = "4.6.1", features = ["env", "derive"] }
alloy = { version = "2.0.4", features = ["provider-ws", "getrandom", "node-bindings", "sol-types", "contract", "signers", "signer-local"] }
alloy = { version = "2.0.4", features = ["provider-ws", "getrandom", "node-bindings", "sol-types", "contract", "signers", "signer-local", "json-rpc"] }
thiserror = "2.0.18"
anyhow = "1.0.102"
tracing = "0.1.44"
Expand Down
31 changes: 31 additions & 0 deletions src/domain/evm_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,37 @@ impl EvmNetwork {
EvmNetwork::Sepolia => 3, // * 12s = 36s
}
}

/// Blocks one backfill `eth_getLogs` chunk may span for this chain. The
/// binding constraint is the provider's per-response log cap (10k on
/// Alchemy-class nodes, 20k on reth), and Transfer-log volume scales
/// with seconds of chain activity — so the budget is per-chain, not
/// one-size-fits-all. Each value targets roughly half of the 10k budget
/// at the chain's typical log volume.
///
/// Ethereum and Polygon are grounded in the 2026-07-29 range bench
/// (~550 Transfer logs/block on mainnet via OVH reth, ~400 on Polygon
/// via Alchemy); chains without bench data keep their previous
/// heuristic of ~10s of chain activity. The dispatcher bisects a
/// rejected range down to single blocks, so an overestimate degrades
/// gracefully on restrictive fallbacks. Values never exceed
/// `max_block_lag()`: a chunk wider than the backfill cap could never
/// be filled.
pub fn backfill_chunk_blocks(self) -> u64 {
match self {
EvmNetwork::Eth => 2, // ~1.1k logs; covers the 3-block cap in 2 requests
EvmNetwork::Bnb => 13, // ~10s heuristic
EvmNetwork::Gnosis => 2, // ~10s heuristic
EvmNetwork::Polygon => 15, // ~6k logs, p50 ~1.7s — the whole cap in one request
EvmNetwork::Base => 5, // ~10s heuristic
EvmNetwork::Plasma => 10, // ~10s heuristic
EvmNetwork::Arbitrum => 40, // ~10s heuristic
EvmNetwork::Avalanche => 5, // ~10s heuristic
EvmNetwork::Ink => 10, // ~10s heuristic
EvmNetwork::Linea => 2, // ~10s heuristic
EvmNetwork::Sepolia => 1, // ~10s heuristic (12s blocks: block-by-block)
}
}
}

impl TryFrom<u64> for EvmNetwork {
Expand Down
Loading
Loading