diff --git a/web3_proxy/src/app/mod.rs b/web3_proxy/src/app/mod.rs index 3dfad6de..537fe621 100644 --- a/web3_proxy/src/app/mod.rs +++ b/web3_proxy/src/app/mod.rs @@ -423,7 +423,7 @@ impl Web3ProxyApp { top_config.app.max_head_block_lag, top_config.app.min_synced_rpcs, top_config.app.min_sum_soft_limit, - "balanced rpcs".to_string(), + "balanced rpcs".into(), Some(watch_consensus_head_sender), ) .await @@ -445,7 +445,7 @@ impl Web3ProxyApp { None, 0, 0, - "protected rpcs".to_string(), + "protected rpcs".into(), // subscribing to new heads here won't work well. if they are fast, they might be ahead of balanced_rpcs // they also often have low rate limits // however, they are well connected to miners/validators. so maybe using them as a safety check would be good @@ -474,7 +474,7 @@ impl Web3ProxyApp { None, 0, 0, - "eip4337 rpcs".to_string(), + "eip4337 rpcs".into(), None, ) .await diff --git a/web3_proxy/src/frontend/authorization.rs b/web3_proxy/src/frontend/authorization.rs index 8300d96b..ffec9528 100644 --- a/web3_proxy/src/frontend/authorization.rs +++ b/web3_proxy/src/frontend/authorization.rs @@ -724,7 +724,6 @@ impl Authorization { ) } - #[allow(clippy::too_many_arguments)] pub fn try_new( authorization_checks: AuthorizationChecks, ip: &IpAddr, diff --git a/web3_proxy/src/rpcs/many.rs b/web3_proxy/src/rpcs/many.rs index 7e8a40b1..b1d66c62 100644 --- a/web3_proxy/src/rpcs/many.rs +++ b/web3_proxy/src/rpcs/many.rs @@ -22,6 +22,7 @@ use moka::future::CacheBuilder; use serde::ser::{SerializeStruct, Serializer}; use serde_json::json; use serde_json::value::RawValue; +use std::borrow::Cow; use std::cmp::min_by_key; use std::fmt::{self, Display}; use std::sync::atomic::Ordering; @@ -34,8 +35,7 @@ use tracing::{debug, error, info, trace, warn}; /// A collection of web3 connections. Sends requests either the current best server or all servers. #[derive(From)] pub struct Web3Rpcs { - /// TODO: this should be a Cow - pub(crate) name: String, + pub(crate) name: Cow<'static, str>, pub(crate) chain_id: u64, /// if watch_consensus_head_sender is some, Web3Rpc inside self will send blocks here when they get them pub(crate) block_sender: mpsc::UnboundedSender<(Option, Arc)>, @@ -67,13 +67,12 @@ pub struct Web3Rpcs { impl Web3Rpcs { /// Spawn durable connections to multiple Web3 providers. - #[allow(clippy::too_many_arguments)] pub async fn spawn( chain_id: u64, max_head_block_lag: Option, min_head_rpcs: usize, min_sum_soft_limit: u32, - name: String, + name: Cow<'static, str>, watch_consensus_head_sender: Option>>, ) -> anyhow::Result<( Arc, @@ -789,7 +788,6 @@ impl Web3Rpcs { } /// Make a request with stat tracking. - #[allow(clippy::too_many_arguments)] pub async fn request_with_metadata( &self, method: &str, @@ -1528,7 +1526,7 @@ mod tests { block_sender: block_sender.clone(), by_name: RwLock::new(by_name), chain_id, - name: "test".to_string(), + name: "test".into(), watch_head_block: Some(watch_consensus_head_sender), watch_ranked_rpcs, blocks_by_hash: CacheBuilder::new(100) @@ -1783,7 +1781,7 @@ mod tests { block_sender, by_name: RwLock::new(by_name), chain_id, - name: "test".to_string(), + name: "test".into(), watch_head_block: Some(watch_consensus_head_sender), watch_ranked_rpcs, blocks_by_hash: CacheBuilder::new(100) @@ -1951,7 +1949,7 @@ mod tests { block_sender, by_name: RwLock::new(by_name), chain_id, - name: "test".to_string(), + name: "test".into(), watch_head_block: Some(watch_consensus_head_sender), watch_ranked_rpcs, blocks_by_hash: Cache::new(10_000), diff --git a/web3_proxy/src/rpcs/one.rs b/web3_proxy/src/rpcs/one.rs index 3b986d11..8fbb88ab 100644 --- a/web3_proxy/src/rpcs/one.rs +++ b/web3_proxy/src/rpcs/one.rs @@ -581,7 +581,6 @@ impl Web3Rpc { } /// TODO: this needs to be a subscribe_with_reconnect that does a retry with jitter and exponential backoff - #[allow(clippy::too_many_arguments)] async fn subscribe_with_reconnect( self: Arc, block_map: BlocksByHashCache,