diff --git a/Cargo.lock b/Cargo.lock index a356870d..5c4f3c8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,6 +61,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -1146,7 +1157,7 @@ name = "deferred-rate-limiter" version = "0.2.0" dependencies = [ "anyhow", - "hashbrown", + "hashbrown 0.13.1", "moka", "redis-rate-limiter", "tokio", @@ -2089,7 +2100,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +dependencies = [ + "ahash 0.8.2", "serde", ] @@ -2108,7 +2128,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d452c155cb93fecdfb02a73dd57b5d8e442c2063bd7aac72f1bc5e4263a43086" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -2363,7 +2383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg 1.1.0", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -4611,7 +4631,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbc16ddba161afc99e14d1713a453747a2b07fc097d2009f4c300ec99286105" dependencies = [ - "ahash", + "ahash 0.7.6", "atoi", "bitflags", "byteorder", @@ -5574,7 +5594,7 @@ dependencies = [ "flume", "futures", "handlebars", - "hashbrown", + "hashbrown 0.13.1", "hdrhistogram", "http", "ipnet", diff --git a/deferred-rate-limiter/Cargo.toml b/deferred-rate-limiter/Cargo.toml index 781f4760..5b2e1ead 100644 --- a/deferred-rate-limiter/Cargo.toml +++ b/deferred-rate-limiter/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" redis-rate-limiter = { path = "../redis-rate-limiter" } anyhow = "1.0.66" -hashbrown = "0.12.3" +hashbrown = "0.13.1" moka = { version = "0.9.6", default-features = false, features = ["future"] } tokio = "1.21.2" tracing = "0.1.37" diff --git a/deferred-rate-limiter/src/lib.rs b/deferred-rate-limiter/src/lib.rs index 943b54cf..3d671585 100644 --- a/deferred-rate-limiter/src/lib.rs +++ b/deferred-rate-limiter/src/lib.rs @@ -46,7 +46,7 @@ where .time_to_live(Duration::from_secs(ttl)) .max_capacity(cache_size) .name(prefix) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); Self { local_cache, diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index 45daab47..e6dc7de1 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -34,7 +34,7 @@ ethers = { version = "1.0.0", features = ["rustls", "ws"] } fdlimit = "0.2.1" flume = "0.10.14" futures = { version = "0.3.25", features = ["thread-pool"] } -hashbrown = { version = "0.12.3", features = ["serde"] } +hashbrown = { version = "0.13.1", features = ["serde"] } hdrhistogram = "7.5.2" http = "0.2.8" ipnet = "2.5.1" diff --git a/web3_proxy/src/app.rs b/web3_proxy/src/app.rs index fe54e8ab..ac7f8c1f 100644 --- a/web3_proxy/src/app.rs +++ b/web3_proxy/src/app.rs @@ -318,7 +318,7 @@ impl Web3ProxyApp { // TODO: ttl on this? or is max_capacity fine? let pending_transactions = Cache::builder() .max_capacity(10_000) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); // keep 1GB of blocks in the cache // TODO: limits from config @@ -330,7 +330,7 @@ impl Web3ProxyApp { // TODO: is this good enough? 1 + v.transactions.len().try_into().unwrap_or(u32::MAX) }) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); // connect to the load balanced rpcs let (balanced_rpcs, balanced_handle) = Web3Connections::spawn( @@ -454,7 +454,7 @@ impl Web3ProxyApp { u32::MAX } }) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); // all the users are the same size, so no need for a weigher // if there is no database of users, there will be no keys and so this will be empty @@ -463,19 +463,19 @@ impl Web3ProxyApp { let rpc_secret_key_cache = Cache::builder() .max_capacity(10_000) .time_to_live(Duration::from_secs(600)) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); // create semaphores for concurrent connection limits // TODO: what should tti be for semaphores? let bearer_token_semaphores = Cache::builder() .time_to_idle(Duration::from_secs(120)) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); let ip_semaphores = Cache::builder() .time_to_idle(Duration::from_secs(120)) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); let rpc_key_semaphores = Cache::builder() .time_to_idle(Duration::from_secs(120)) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); let app = Self { config: top_config.app, diff --git a/web3_proxy/src/rpcs/connections.rs b/web3_proxy/src/rpcs/connections.rs index c725414c..be55825f 100644 --- a/web3_proxy/src/rpcs/connections.rs +++ b/web3_proxy/src/rpcs/connections.rs @@ -198,12 +198,12 @@ impl Web3Connections { let block_hashes = Cache::builder() .time_to_idle(Duration::from_secs(600)) .max_capacity(10_000) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); // all block numbers are the same size, so no need for weigher let block_numbers = Cache::builder() .time_to_idle(Duration::from_secs(600)) .max_capacity(10_000) - .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::new()); + .build_with_hasher(hashbrown::hash_map::DefaultHashBuilder::default()); let connections = Arc::new(Self { conns: connections,