less queries

This commit is contained in:
Bryan Stitt 2022-06-25 02:24:31 +00:00
parent ad59c08543
commit 42c8d33d83
3 changed files with 61 additions and 18 deletions

@ -34,6 +34,8 @@
- [ ] rpc errors propagate too far. one subscription failing ends the app. isolate the providers more
- [ ] if web3 proxy gets an http error back, retry another node
- [ ] endpoint for health checks. if no synced servers, give a 502 error
- [ ] interval for http subscriptions should be based on block time.
- [ ] todo: include private rpcs with regular queries? i don't want to overwhelm them, but they could be good for excess load
## V1

@ -1,27 +1,67 @@
[shared]
chain_id = 1
# in prod, do `rate_limit_redis = "redis://redis:6379/"`
rate_limit_redis = "redis://dev-redis:6379/"
[balanced_rpcs]
[balanced_rpcs.erigon_archive]
url = "http://10.11.12.16:8549"
# TODO: double check soft_limit on erigon
soft_limit = 100_000
[balanced_rpcs.ankr]
url = "https://rpc.ankr.com/eth"
soft_limit = 1_000
[balanced_rpcs.erigon_archive_ws]
url = "ws://10.11.12.16:8549"
# TODO: double check soft_limit on erigon
soft_limit = 100_000
[balanced_rpcs.cloudflare]
url = "https://cloudflare-eth.com"
soft_limit = 1_000
[balanced_rpcs.geth]
url = "http://10.11.12.16:8545"
soft_limit = 200_000
hard_limit = 1_000
[balanced_rpcs.flashbots]
url = "https://rpc.flashbots.net"
soft_limit = 1_000
[balanced_rpcs.geth_ws]
url = "ws://10.11.12.16:8546"
soft_limit = 200_000
[balanced_rpcs.linkpool-light]
url = "https://main-light.eth.linkpool.io"
soft_limit = 1_000
[balanced_rpcs.blastapi]
url = "https://eth-mainnet.public.blastapi.io"
soft_limit = 1_000
#[balanced_rpcs.mycryptoapi]
#url = "https://api.mycryptoapi.com/eth"
#soft_limit = 1_000
[balanced_rpcs.runonflux]
url = "https://ethereumnodelight.app.runonflux.io"
soft_limit = 1_000
[balanced_rpcs.pokt-v1]
url = "https://eth-mainnet.gateway.pokt.network/v1/5f3453978e354ab992c4da79"
soft_limit = 1_000
[balanced_rpcs.pokt]
url = "https://eth-rpc.gateway.pokt.network"
soft_limit = 1_000
[balanced_rpcs.linkpool]
url = "https://main-rpc.linkpool.io"
soft_limit = 1_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
[private_rpcs.securerpc]
url = "https://gibson.securerpc.com/v1"
soft_limit = 4560

@ -41,8 +41,9 @@ impl Web3Provider {
let provider = ethers::providers::Http::new_with_client(url, http_client);
// TODO: dry this up (needs https://github.com/gakonst/ethers-rs/issues/592)
// TODO: i don't think this interval matters, but it should probably come from config
ethers::providers::Provider::new(provider)
.interval(Duration::from_secs(1))
.interval(Duration::from_secs(13))
.into()
} else if url_str.starts_with("ws") {
// TODO: wrapper automatically reconnect
@ -342,7 +343,7 @@ impl Web3Connection {
// TODO: what should this interval be? probably some fraction of block time. set automatically?
// TODO: maybe it would be better to have one interval for all of the http providers, but this works for now
// TODO: if there are some websocket providers, maybe have a longer interval and a channel that tells the https to update when a websocket gets a new head? if they are slow this wouldn't work well though
let mut interval = interval(Duration::from_secs(2));
let mut interval = interval(Duration::from_secs(13));
interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
let mut last_hash = Default::default();