From 3b1ed9474cddf7a8b55fc8e9fe5df4fb9f5bee43 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Wed, 4 May 2022 05:49:12 +0000 Subject: [PATCH] it works, but this refactor ended up a lot slower --- .gitignore | 5 +++-- data/config/example.toml | 19 ++++++++++++++++--- src/connection.rs | 4 ++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 686bbfe6..631026f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -/target +/data/config/*.toml +/flamegraph.svg /perf.data /perf.data.old -/flamegraph.svg +/target diff --git a/data/config/example.toml b/data/config/example.toml index 1368b9fc..fcf7b891 100644 --- a/data/config/example.toml +++ b/data/config/example.toml @@ -5,12 +5,25 @@ listen_port = 8445 [balanced_rpc_tiers.0] - [balanced_rpc_tiers.0.local_erigon] - url = "ws://127.0.0.1:8545" - soft_limit = 68_000 + [balanced_rpc_tiers.0.geth] + url = "ws://127.0.0.1:8546" + soft_limit = 50_000 + [private_rpcs] + [private_rpcs.eden] + url = "https://api.edennetwork.io/v1/" + soft_limit = 1_805 + [private_rpcs.eden_beta] url = "https://api.edennetwork.io/v1/beta" soft_limit = 5_861 + + [private_rpcs.ethermine] + url = "https://rpc.ethermine.org" + soft_limit = 5_861 + + [private_rpcs.flashbots] + url = "https://rpc.flashbots.net" + soft_limit = 7074 diff --git a/src/connection.rs b/src/connection.rs index f9e069aa..4b9e1b4f 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -135,13 +135,13 @@ impl Web3Connection { match &self.provider { Web3Provider::Http(provider) => { - // TODO: there is a "watch_blocks" function, but a lot of public nodes do not support the necessary rpc endpoints + // there is a "watch_blocks" function, but a lot of public nodes do not support the necessary rpc endpoints // TODO: what should this interval be? probably some fraction of block time // TODO: maybe it would be better to have one interval for all of the http providers, but this works for now let mut interval = interval(Duration::from_secs(2)); loop { - // wait for 2 seconds + // wait for the interval interval.tick().await; let block_number = provider.get_block_number().await.map(|x| x.as_u64())?;