Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): breaking bumps #1957

Merged
merged 1 commit into from
Jan 28, 2025
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
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ all = "warn"

[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
missing-const-for-fn = "warn"
missing-const-for-fn = "allow" # TODO: https://github.com/rust-lang/rust-clippy/issues/14020
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been driving me insane for the last two days

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunate that it's very unstable

use-self = "warn"
option-if-let-else = "warn"
redundant-clone = "warn"
Expand Down Expand Up @@ -115,7 +115,7 @@ rustls = { version = "0.23", default-features = false, features = [
"tls12",
] }
tokio-test = "0.4"
tokio-tungstenite = "0.24"
tokio-tungstenite = "0.26"
tower = { version = "0.5", features = ["util"] }

# tracing
Expand All @@ -138,15 +138,14 @@ cfg-if = "1"
derive_more = { version = "1.0.0", default-features = false }
home = "0.5"
http = "1.1.0"
itertools = { version = "0.13", default-features = false }
itertools = { version = ">=0.13, <=0.14", default-features = false }
jsonwebtoken = "9.3.0"
lru = "0.12"
lru = "0.13"
once_cell = { version = "1.19", default-features = false }
parking_lot = "0.12.3"
pin-project = "1.1"
rand = "0.8"
reqwest = { version = "0.12", default-features = false }
schnellru = "0.2.3"
semver = "1.0"
strum = { version = "0.26", default-features = false }
thiserror = { version = "2.0", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion crates/provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ auto_impl.workspace = true
dashmap = "6.0"
futures-utils-wasm.workspace = true
futures.workspace = true
schnellru.workspace = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, no reason to import two lru impls

lru.workspace = true
pin-project.workspace = true
reqwest = { workspace = true, optional = true }
Expand Down
18 changes: 10 additions & 8 deletions crates/provider/src/layers/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use alloy_rpc_types_eth::{
BlockNumberOrTag, BlockTransactionsKind, EIP1186AccountProofResponse, Filter, Log,
};
use alloy_transport::{TransportErrorKind, TransportResult};
use lru::LruCache;
use parking_lot::RwLock;
use schnellru::{ByLength, LruMap};
use serde::{Deserialize, Serialize};
use std::{io::BufReader, marker::PhantomData, path::PathBuf, sync::Arc};
use std::{io::BufReader, marker::PhantomData, num::NonZero, path::PathBuf, sync::Arc};

/// A provider layer that caches RPC responses and serves them on subsequent requests.
///
Expand Down Expand Up @@ -430,28 +430,30 @@ struct FsCacheEntry {
/// Serialized response to the request from which the hash was computed.
value: String,
}

/// Shareable cache.
#[derive(Debug, Clone)]
pub struct SharedCache {
inner: Arc<RwLock<LruMap<B256, String>>>,
max_items: u32,
inner: Arc<RwLock<LruCache<B256, String, alloy_primitives::map::FbBuildHasher<32>>>>,
max_items: NonZero<usize>,
}

impl SharedCache {
/// Instantiate a new shared cache.
pub fn new(max_items: u32) -> Self {
let inner = Arc::new(RwLock::new(LruMap::new(ByLength::new(max_items))));
let max_items = NonZero::new(max_items as usize).unwrap_or(NonZero::<usize>::MIN);
let inner = Arc::new(RwLock::new(LruCache::with_hasher(max_items, Default::default())));
Self { inner, max_items }
}

/// Maximum number of items that can be stored in the cache.
pub const fn max_items(&self) -> u32 {
self.max_items
self.max_items.get() as u32
}

/// Puts a value into the cache, and returns the old value if it existed.
pub fn put(&self, key: B256, value: String) -> TransportResult<bool> {
Ok(self.inner.write().insert(key, value))
Ok(self.inner.write().put(key, value).is_some())
}

/// Gets a value from the cache, if it exists.
Expand Down Expand Up @@ -498,7 +500,7 @@ impl SharedCache {
serde_json::from_reader(file).map_err(TransportErrorKind::custom)?;
let mut cache = self.inner.write();
for entry in entries {
cache.insert(entry.key, entry.value);
cache.put(entry.key, entry.value);
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/signer-gcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ alloy-primitives.workspace = true
alloy-signer.workspace = true

async-trait.workspace = true
gcloud-sdk = { version = "0.25", features = [
gcloud-sdk = { version = "0.26", features = [
"google-cloud-kms-v1",
"google-longrunning",
] }
Expand Down
4 changes: 2 additions & 2 deletions crates/transport-ws/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl WsBackend<TungsteniteStream> {

/// Send a message to the server.
pub async fn send(&mut self, msg: Box<RawValue>) -> Result<(), tungstenite::Error> {
self.socket.send(Message::Text(msg.get().to_owned())).await
self.socket.send(Message::Text(msg.get().to_owned().into())).await
}

/// Spawn a new backend task.
Expand Down Expand Up @@ -155,7 +155,7 @@ impl WsBackend<TungsteniteStream> {
_ = &mut keepalive => {
// Reset the keepalive timer.
keepalive.set(sleep(Duration::from_secs(KEEPALIVE)));
if let Err(err) = self.socket.send(Message::Ping(vec![])).await {
if let Err(err) = self.socket.send(Message::Ping(Default::default())).await {
error!(%err, "WS connection error");
errored = true;
break
Expand Down
Loading