diff --git a/crates/rpc-client/src/builtin.rs b/crates/rpc-client/src/builtin.rs index 911e115ef86..f04265b91d7 100644 --- a/crates/rpc-client/src/builtin.rs +++ b/crates/rpc-client/src/builtin.rs @@ -1,9 +1,8 @@ -use std::str::FromStr; - use alloy_json_rpc::RpcError; use alloy_transport::{BoxTransport, BoxTransportConnect, TransportError, TransportErrorKind}; +use std::str::FromStr; -#[cfg(feature = "pubsub")] +#[cfg(any(feature = "ws", feature = "ipc"))] use alloy_pubsub::PubSubConnect; /// Connection string for built-in transports. diff --git a/crates/rpc-types-engine/src/jwt.rs b/crates/rpc-types-engine/src/jwt.rs index b9b8e68862e..697b2d3136e 100644 --- a/crates/rpc-types-engine/src/jwt.rs +++ b/crates/rpc-types-engine/src/jwt.rs @@ -1,18 +1,20 @@ //! JWT (JSON Web Token) utilities for the Engine API. -use alloc::{format, string::String}; +use alloc::string::String; use alloy_primitives::hex; use core::{str::FromStr, time::Duration}; -use jsonwebtoken::{ - decode, errors::ErrorKind, get_current_timestamp, Algorithm, DecodingKey, Validation, -}; +use jsonwebtoken::get_current_timestamp; use rand::Rng; + #[cfg(feature = "std")] use std::{ fs, io, path::{Path, PathBuf}, }; +#[cfg(feature = "serde")] +use jsonwebtoken::{errors::ErrorKind, Algorithm, DecodingKey, Validation}; + /// Errors returned by the [`JwtSecret`] #[derive(Debug, derive_more::Display)] pub enum JwtError { @@ -106,6 +108,7 @@ const JWT_SECRET_LEN: usize = 64; const JWT_MAX_IAT_DIFF: Duration = Duration::from_secs(60); /// The execution layer client MUST support at least the following alg HMAC + SHA256 (HS256) +#[cfg(feature = "serde")] const JWT_SIGNATURE_ALGO: Algorithm = Algorithm::HS256; /// Claims in JWT are used to represent a set of information about an entity. @@ -223,7 +226,7 @@ impl JwtSecret { validation.set_required_spec_claims(&["iat"]); let bytes = &self.0; - match decode::(jwt, &DecodingKey::from_secret(bytes), &validation) { + match jsonwebtoken::decode::(jwt, &DecodingKey::from_secret(bytes), &validation) { Ok(token) => { if !token.claims.is_within_time_window() { Err(JwtError::InvalidIssuanceTimestamp)? diff --git a/crates/rpc-types-engine/src/lib.rs b/crates/rpc-types-engine/src/lib.rs index aff1c62d518..3c8ae1b5d2e 100644 --- a/crates/rpc-types-engine/src/lib.rs +++ b/crates/rpc-types-engine/src/lib.rs @@ -7,6 +7,8 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![cfg_attr(not(feature = "std"), no_std)] +#[macro_use] +#[allow(unused_imports)] extern crate alloc; mod cancun; diff --git a/crates/rpc-types-eth/Cargo.toml b/crates/rpc-types-eth/Cargo.toml index 04c53208013..ab2af043485 100644 --- a/crates/rpc-types-eth/Cargo.toml +++ b/crates/rpc-types-eth/Cargo.toml @@ -70,7 +70,7 @@ arbitrary = [ "std", "dep:arbitrary", "alloy-primitives/arbitrary", - "alloy-serde/arbitrary", + "alloy-serde?/arbitrary", "alloy-eips/arbitrary", ] jsonrpsee-types = ["dep:jsonrpsee-types"] diff --git a/crates/rpc-types/Cargo.toml b/crates/rpc-types/Cargo.toml index 80ff9b5ff26..56a85a64d8d 100644 --- a/crates/rpc-types/Cargo.toml +++ b/crates/rpc-types/Cargo.toml @@ -19,7 +19,7 @@ rustdoc-args = ["--cfg", "docsrs"] workspace = true [dependencies] -alloy-primitives.workspace = true +alloy-primitives = { workspace = true, features = ["map"] } alloy-serde.workspace = true alloy-rpc-types-admin = { workspace = true, optional = true } alloy-rpc-types-anvil = { workspace = true, optional = true } diff --git a/crates/signer-local/Cargo.toml b/crates/signer-local/Cargo.toml index f0ff36c73d8..e5d41c93729 100644 --- a/crates/signer-local/Cargo.toml +++ b/crates/signer-local/Cargo.toml @@ -30,7 +30,6 @@ thiserror.workspace = true async-trait.workspace = true # keystore -elliptic-curve = { workspace = true, optional = true } eth-keystore = { version = "0.5.0", default-features = false, optional = true } # mnemonic @@ -40,7 +39,12 @@ coins-bip39 = { version = "0.12", default-features = false, features = [ ], optional = true } # yubi -yubihsm = { version = "0.42", features = ["secp256k1", "http", "usb"], optional = true } +elliptic-curve = { workspace = true, optional = true } +yubihsm = { version = "0.42", features = [ + "secp256k1", + "http", + "usb", +], optional = true } [dev-dependencies] alloy-dyn-abi.workspace = true @@ -57,7 +61,7 @@ tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } yubihsm = { version = "0.42", features = ["mockhsm"] } [features] -keystore = ["dep:eth-keystore", "dep:elliptic-curve"] +keystore = ["dep:eth-keystore"] keystore-geth-compat = ["keystore", "eth-keystore?/geth-compat"] mnemonic = ["dep:coins-bip32", "dep:coins-bip39"] mnemonic-all-languages = ["mnemonic", "coins-bip39?/all-langs"]