diff --git a/crates/app/src/obolapi/error.rs b/crates/app/src/obolapi/error.rs index cb1ffa04..2ead5a29 100644 --- a/crates/app/src/obolapi/error.rs +++ b/crates/app/src/obolapi/error.rs @@ -44,7 +44,7 @@ pub enum Error { /// Hex decoding error. #[error("hex decoding error: {0}")] - HexDecode(#[from] hex::FromHexError), + HexDecode(#[from] pluto_ssz::HexDecodeError), /// Empty hex string. #[error("empty hex string")] diff --git a/crates/cli/src/error.rs b/crates/cli/src/error.rs index c1ce261a..4b49bca0 100644 --- a/crates/cli/src/error.rs +++ b/crates/cli/src/error.rs @@ -305,13 +305,6 @@ pub enum CreateClusterError { #[error("Crypto error: {0}")] CryptoError(#[from] pluto_crypto::types::Error), - /// Value exceeds u8::MAX. - #[error("Value {value} exceeds u8::MAX (255)")] - ValueExceedsU8 { - /// The value that exceeds u8::MAX. - value: u64, - }, - /// Value exceeds usize::MAX. #[error("Value {value} exceeds usize::MAX")] ValueExceedsUsize { diff --git a/crates/cluster/src/definition.rs b/crates/cluster/src/definition.rs index 4bec353c..48d42b0f 100644 --- a/crates/cluster/src/definition.rs +++ b/crates/cluster/src/definition.rs @@ -127,13 +127,13 @@ impl Serialize for Definition { { match self.version.as_str() { V1_0 | V1_1 => DefinitionV1x0or1::try_from(self.clone()) - .map_err(|e| serde::ser::Error::custom(format!("Conversion error: {:?}", e)))? + .map_err(|e| serde::ser::Error::custom(format!("Conversion error: {e}")))? .serialize(serializer), V1_2 | V1_3 => DefinitionV1x2or3::try_from(self.clone()) - .map_err(|e| serde::ser::Error::custom(format!("Conversion error: {:?}", e)))? + .map_err(|e| serde::ser::Error::custom(format!("Conversion error: {e}")))? .serialize(serializer), V1_4 => DefinitionV1x4::try_from(self.clone()) - .map_err(|e| serde::ser::Error::custom(format!("Conversion error: {:?}", e)))? + .map_err(|e| serde::ser::Error::custom(format!("Conversion error: {e}")))? .serialize(serializer), V1_5 | V1_6 | V1_7 => DefinitionV1x5to7::from(self.clone()).serialize(serializer), V1_8 => DefinitionV1x8::from(self.clone()).serialize(serializer), @@ -167,21 +167,21 @@ impl<'de> Deserialize<'de> for Definition { serde_json::from_value(value).map_err(Error::custom)?; definition .try_into() - .map_err(|e| Error::custom(format!("Conversion error: {:?}", e))) + .map_err(|e| Error::custom(format!("Conversion error: {e}"))) } V1_2 | V1_3 => { let definition: DefinitionV1x2or3 = serde_json::from_value(value).map_err(Error::custom)?; definition .try_into() - .map_err(|e| Error::custom(format!("Conversion error: {:?}", e))) + .map_err(|e| Error::custom(format!("Conversion error: {e}"))) } V1_4 => { let definition: DefinitionV1x4 = serde_json::from_value(value).map_err(Error::custom)?; definition .try_into() - .map_err(|e| Error::custom(format!("Conversion error: {:?}", e))) + .map_err(|e| Error::custom(format!("Conversion error: {e}"))) } V1_5 | V1_6 | V1_7 => { let definition: DefinitionV1x5to7 = @@ -268,7 +268,7 @@ pub enum DefinitionError { /// Failed to convert hex string #[error("Failed to convert hex string")] - FailedToConvertHexString(#[from] hex::FromHexError), + FailedToConvertHexString(#[from] pluto_ssz::HexDecodeError), /// Invalid target gas limit #[error("Invalid target gas limit: {0}")] @@ -1773,13 +1773,9 @@ mod tests { result.is_err(), "u64::MAX num_validators must be rejected, not allocated" ); - // The deserialize dispatch renders the TryFrom error via Debug - // ("Conversion error: NumValidatorsTooLarge {{ .. }}"), so assert on - // the variant name and the enforced max, both of which appear - // in the Debug repr. let msg = format!("{}", result.unwrap_err()); assert!( - msg.contains("NumValidatorsTooLarge") && msg.contains("65536"), + msg.contains("exceeds maximum") && msg.contains("65536"), "unexpected error message: {msg}" ); } @@ -1938,7 +1934,7 @@ mod tests { let err = serde_json::from_value::(value).unwrap_err(); assert!( - err.to_string().contains("NonZeroOperatorNonce"), + err.to_string().contains("non-zero operator nonce"), "unexpected error: {err}" ); } diff --git a/crates/cluster/src/helpers.rs b/crates/cluster/src/helpers.rs index 7649aebb..31f4e3aa 100644 --- a/crates/cluster/src/helpers.rs +++ b/crates/cluster/src/helpers.rs @@ -11,7 +11,7 @@ use crate::{ eip712sigs, operator, }; -pub use pluto_ssz::{from_0x_hex_str, left_pad, to_0x_hex}; +pub use pluto_ssz::{HexDecodeError, from_0x_hex_str, left_pad, to_0x_hex}; /// Error type returned by `verify_sig`. #[derive(Debug, thiserror::Error)] diff --git a/crates/cluster/src/ssz.rs b/crates/cluster/src/ssz.rs index 3d6840f6..cd4eb6e1 100644 --- a/crates/cluster/src/ssz.rs +++ b/crates/cluster/src/ssz.rs @@ -84,7 +84,7 @@ pub enum SSZError { /// Failed to convert hex string #[error("Failed to convert hex string: {0}")] - FailedToConvertHexString(#[from] hex::FromHexError), + FailedToConvertHexString(#[from] pluto_ssz::HexDecodeError), /// Failed to convert timestamp #[error("Failed to convert timestamp")] diff --git a/crates/core/src/parsigdb/memory.rs b/crates/core/src/parsigdb/memory.rs index 398b6037..e0067c0a 100644 --- a/crates/core/src/parsigdb/memory.rs +++ b/crates/core/src/parsigdb/memory.rs @@ -360,15 +360,11 @@ impl MemDB { } } - inner - .entries - .entry(k.clone()) - .or_insert_with(Vec::new) - .push(value); + inner.entries.entry(k.clone()).or_default().push(value); inner .keys_by_duty .entry(k.duty.clone()) - .or_insert_with(Vec::new) + .or_default() .push(k.clone()); if k.duty.duty_type == DutyType::Exit { diff --git a/crates/core/src/parsigex_codec.rs b/crates/core/src/parsigex_codec.rs index 0b3090aa..5d258c42 100644 --- a/crates/core/src/parsigex_codec.rs +++ b/crates/core/src/parsigex_codec.rs @@ -37,10 +37,6 @@ pub enum ParSigExCodecError { #[error("invalid unsigned data set fields")] InvalidUnsignedDataSetFields, - /// Invalid partial signed proto. - #[error("invalid partial signed proto")] - InvalidParSignedProto, - /// Invalid duty type. #[error("invalid duty")] InvalidDuty, diff --git a/crates/core/src/qbft/internal_test.rs b/crates/core/src/qbft/internal_test.rs index 54abaf25..d534b723 100644 --- a/crates/core/src/qbft/internal_test.rs +++ b/crates/core/src/qbft/internal_test.rs @@ -2153,12 +2153,9 @@ fn run_parent_cancel_during_compare_does_not_prepare() { } fn buffer_by_source(msgs: &[Msg]) -> HashMap>> { - let mut buffer = HashMap::new(); + let mut buffer: HashMap> = HashMap::new(); for msg in msgs { - buffer - .entry(msg.source()) - .or_insert_with(Vec::new) - .push(msg.clone()); + buffer.entry(msg.source()).or_default().push(msg.clone()); } buffer } diff --git a/crates/core/src/signeddata.rs b/crates/core/src/signeddata.rs index 083dc49b..a661b1a5 100644 --- a/crates/core/src/signeddata.rs +++ b/crates/core/src/signeddata.rs @@ -39,9 +39,6 @@ pub enum SignedDataError { /// Missing attestation payload for the selected fork. #[error("no {0} attestation")] MissingAttestation(versioned::DataVersion), - /// Missing aggregate-and-proof payload for the selected fork. - #[error("no {0} aggregate and proof")] - MissingAggregateAndProof(versioned::DataVersion), /// Missing unblinded proposal payload for the selected fork. #[error("no {0} proposal")] MissingProposal(versioned::DataVersion), diff --git a/crates/dkg/src/exchanger.rs b/crates/dkg/src/exchanger.rs index fdd2f5f5..a342f2ea 100644 --- a/crates/dkg/src/exchanger.rs +++ b/crates/dkg/src/exchanger.rs @@ -298,7 +298,7 @@ async fn push_psigs( { let mut inner = sig_data.inner.lock().await; - let entry = inner.entry(sig_type).or_insert_with(HashMap::new); + let entry = inner.entry(sig_type).or_default(); for (pk, psigs) in set { entry.insert(pk, psigs); } diff --git a/crates/eth2util/src/deposit/errors.rs b/crates/eth2util/src/deposit/errors.rs index 6682ec1e..3eed4cc6 100644 --- a/crates/eth2util/src/deposit/errors.rs +++ b/crates/eth2util/src/deposit/errors.rs @@ -15,7 +15,7 @@ pub enum DepositError { // Amount validation errors /// Amount is below minimum - #[error("Each partial deposit amount must be greater than 1ETH, got {0} Gwei")] + #[error("Each partial deposit amount must be at least 1ETH, got {0} Gwei")] AmountBelowMinimum(Gwei), /// Amount exceeds maximum @@ -36,7 +36,7 @@ pub enum DepositError { AmountSumBelowDefault(Gwei), /// Deposit message minimum amount not met - #[error("Deposit message minimum amount must be >= {MIN_DEPOSIT_AMOUNT} ETH, got {0} Gwei")] + #[error("Deposit message minimum amount must be >= {MIN_DEPOSIT_AMOUNT} Gwei, got {0} Gwei")] MinimumAmountNotMet(Gwei), /// Deposit message maximum amount exceeded @@ -57,10 +57,6 @@ pub enum DepositError { #[error("Crypto error: {0}")] CryptoError(String), - /// Hash tree root computation error - #[error("Hash tree root error: {0}")] - HashTreeRootError(String), - // File operations errors /// IO error #[error("IO error: {0}")] diff --git a/crates/eth2util/src/enr.rs b/crates/eth2util/src/enr.rs index 0040ec55..d3050680 100644 --- a/crates/eth2util/src/enr.rs +++ b/crates/eth2util/src/enr.rs @@ -55,21 +55,17 @@ pub enum RecordError { #[error("Failed to parse the secp256k1 public key: {0}")] Secp256k1Error(#[from] elliptic_curve::Error), - /// Failed to verify the signature. - #[error("Signature verification succeeded, but the signature is invalid")] + /// Signature verification ran and rejected the signature. + #[error("The record signature does not match the public key")] FailedToVerifySignature, - /// The signature is invalid. - #[error("The verification failed: {0}")] + /// Signature verification could not be performed. + #[error("Failed to verify the record signature: {0}")] InvalidSignature(pluto_k1util::K1UtilError), /// Failed to sign the record. #[error("Failed to sign the record: {0}")] FailedToSign(pluto_k1util::K1UtilError), - - /// Failed to convert the signature. - #[error("Failed to convert the signature: {0}")] - FailedToConvertSignature(std::array::TryFromSliceError), } /// InvalidFormatError is an error type for invalid format errors. diff --git a/crates/eth2util/src/helpers.rs b/crates/eth2util/src/helpers.rs index 9519f7a2..c33257f6 100644 --- a/crates/eth2util/src/helpers.rs +++ b/crates/eth2util/src/helpers.rs @@ -19,10 +19,6 @@ pub enum HelperError { #[error("Invalid ethereum address: {0}")] InvalidAddress(String), - /// Hex decoding error - #[error("Invalid ethereum hex address: {0}")] - InvalidHexAddress(String), - /// Invalid HTTP header format #[error("http headers must be comma separated values formatted as header=value")] InvalidHTTPHeader, @@ -31,9 +27,10 @@ pub enum HelperError { #[error("getting spec: {0}")] GettingSpec(String), - /// Failed to fetch a required value from the spec - #[error("fetch slots per epoch")] - FetchSlotsPerEpoch, + /// The beacon node reported a zero slots-per-epoch, so an epoch cannot be + /// derived from a slot. + #[error("beacon node reported slots per epoch as zero")] + ZeroSlotsPerEpoch, /// The slot for a timestamp could not be computed from the genesis time and /// slot duration (out-of-range timestamp, overflow, or a zero slot @@ -167,7 +164,7 @@ pub async fn epoch_from_slot( .map_err(|e| HelperError::GettingSpec(e.to_string()))?; slot.checked_div(slots_per_epoch) - .ok_or(HelperError::FetchSlotsPerEpoch) + .ok_or(HelperError::ZeroSlotsPerEpoch) } #[cfg(test)] diff --git a/crates/eth2util/src/keystore/error.rs b/crates/eth2util/src/keystore/error.rs index 68d51b23..b7cb4d7c 100644 --- a/crates/eth2util/src/keystore/error.rs +++ b/crates/eth2util/src/keystore/error.rs @@ -87,10 +87,6 @@ pub enum KeystoreError { #[error("hex decode error: {0}")] HexDecode(#[from] hex::FromHexError), - /// Unsupported KDF function. - #[error("unsupported KDF: {0}")] - UnsupportedKdf(String), - /// Checksum verification failed. #[error("decrypt keystore: checksum verification failed")] InvalidChecksum, diff --git a/crates/eth2util/src/rlp.rs b/crates/eth2util/src/rlp.rs index a09c6e9c..a1b70043 100644 --- a/crates/eth2util/src/rlp.rs +++ b/crates/eth2util/src/rlp.rs @@ -8,9 +8,6 @@ pub enum RlpError { /// The input is too short. #[error("input too short")] InputTooShort, - /// The length is negative. - #[error("negative length")] - NegativeLength, /// The length is too large. #[error("length overflow")] Overflow, diff --git a/crates/k1util/src/k1util.rs b/crates/k1util/src/k1util.rs index 582e8f31..208e49d7 100644 --- a/crates/k1util/src/k1util.rs +++ b/crates/k1util/src/k1util.rs @@ -84,8 +84,8 @@ pub enum K1UtilError { type Result = std::result::Result; /// Converts a libp2p PublicKey to a secp256k1 PublicKey. -pub fn public_key_from_libp2p(pk: &Libp2pPublicKey) -> Result { - let secp_key = pk.clone().try_into_secp256k1()?; +pub fn public_key_from_libp2p(pk: Libp2pPublicKey) -> Result { + let secp_key = pk.try_into_secp256k1()?; PublicKey::from_sec1_bytes(&secp_key.to_bytes()) .map_err(K1UtilError::FailedToParseSecp256k1PublicKey) } diff --git a/crates/p2p/src/peer.rs b/crates/p2p/src/peer.rs index c5c2c20d..1b752c67 100644 --- a/crates/p2p/src/peer.rs +++ b/crates/p2p/src/peer.rs @@ -168,7 +168,7 @@ impl MutablePeer { /// Only works for secp256k1 keys. pub fn peer_id_to_public_key(peer_id: &PeerId) -> Result { let libp2p_pk = peer_id_to_libp2p_pk(peer_id)?; - pluto_k1util::public_key_from_libp2p(&libp2p_pk).map_err(Into::into) + pluto_k1util::public_key_from_libp2p(libp2p_pk).map_err(Into::into) } /// Extracts the libp2p PublicKey from a PeerId. @@ -197,7 +197,7 @@ pub fn verify_p2p_key(peers: &[Peer], key: &SecretKey) -> Result<()> { for peer in peers { let pub_key = peer_id_to_libp2p_pk(&peer.id)?; - let got = pluto_k1util::public_key_from_libp2p(&pub_key)?; + let got = pluto_k1util::public_key_from_libp2p(pub_key)?; if got == want { return Ok(()); diff --git a/crates/priority/src/component.rs b/crates/priority/src/component.rs index a05fc857..496e2e09 100644 --- a/crates/priority/src/component.rs +++ b/crates/priority/src/component.rs @@ -74,7 +74,7 @@ pub struct ScoredPriority { /// /// Returns the unknown-peer or invalid-signature error rather than a boolean, /// so callers reject messages from unrecognised peers or with bad signatures. -pub type MsgVerifier = Box Result<()> + Send + Sync + 'static>; +pub type MsgVerifier = Arc Result<()> + Send + Sync + 'static>; /// Returns a copy of the message signed by `privkey`. /// @@ -122,7 +122,7 @@ pub(crate) fn new_msg_verifier(peers: &[PeerId]) -> Result { keys.insert(peer.to_string(), pk); } - Ok(Box::new(move |msg: &PriorityMsg| { + Ok(Arc::new(move |msg: &PriorityMsg| { if msg.duty.is_none() { return Err(Error::InvalidMsgProtoFields); } diff --git a/crates/priority/src/prioritiser.rs b/crates/priority/src/prioritiser.rs index d10ce124..83808743 100644 --- a/crates/priority/src/prioritiser.rs +++ b/crates/priority/src/prioritiser.rs @@ -97,7 +97,7 @@ struct Shared { /// Cluster peers participating in the protocol. peers: Vec, /// Validates received messages (peer membership + signature). - msg_validator: Arc, + msg_validator: MsgVerifier, /// Cancelled when the engine shuts down, signalling instances to stop. quit: CancellationToken, /// Deadline scheduler; expired duties drop their request buffers. @@ -177,7 +177,7 @@ impl Shared { return Err(Error::InvalidPeerId); } - (self.msg_validator)(&msg)?; // Arc> auto-derefs for call. + (self.msg_validator)(&msg)?; let proto_duty = msg.duty.as_ref().ok_or(Error::InvalidMsgProtoFields)?; let duty = duty_from_proto(proto_duty); @@ -261,7 +261,7 @@ impl Prioritiser { // feeds the remaining `Inner` fields — no construction cycle. let shared = Arc::new(Shared { peers, - msg_validator: Arc::new(msg_validator), + msg_validator, quit: CancellationToken::new(), deadliner, req_buffers: Mutex::new(HashMap::new()), diff --git a/crates/priority/tests/prioritiser_test.rs b/crates/priority/tests/prioritiser_test.rs index 9703c69a..4025feb6 100644 --- a/crates/priority/tests/prioritiser_test.rs +++ b/crates/priority/tests/prioritiser_test.rs @@ -138,7 +138,7 @@ fn build_host( let keypair = keypair_from_secret_key(key).expect("keypair"); // A permissive verifier returning Ok for every message. - let validator = Box::new(|_: &PriorityMsg| Ok(())); + let validator = Arc::new(|_: &PriorityMsg| Ok(())); let (prioritiser, behaviour) = Prioritiser::new_internal( peer_id, diff --git a/crates/ssz/src/decode.rs b/crates/ssz/src/decode.rs index 7470f2ed..8a212e6c 100644 --- a/crates/ssz/src/decode.rs +++ b/crates/ssz/src/decode.rs @@ -2,17 +2,6 @@ use crate::SszBinaryError; -/// Decodes a `u8` from a single byte. -pub fn decode_u8(bytes: &[u8]) -> Result { - let arr: [u8; 1] = bytes - .try_into() - .map_err(|_| SszBinaryError::InvalidLength { - expected: 1, - actual: bytes.len(), - })?; - Ok(arr[0]) -} - /// Decodes a `u32` from 4 little-endian bytes. pub fn decode_u32(bytes: &[u8]) -> Result { let arr: [u8; 4] = bytes @@ -34,20 +23,3 @@ pub fn decode_u64(bytes: &[u8]) -> Result { })?; Ok(u64::from_le_bytes(arr)) } - -/// Decodes a `bool` from a single SSZ byte. -pub fn decode_bool(bytes: &[u8]) -> Result { - match decode_u8(bytes)? { - 0 => Ok(false), - 1 => Ok(true), - v => Err(SszBinaryError::InvalidBool(v)), - } -} - -/// Decodes a fixed-size byte array from a slice. -pub fn decode_fixed_bytes(bytes: &[u8]) -> Result<[u8; N], SszBinaryError> { - bytes.try_into().map_err(|_| SszBinaryError::InvalidLength { - expected: N, - actual: bytes.len(), - }) -} diff --git a/crates/ssz/src/encode.rs b/crates/ssz/src/encode.rs index 7ae8c3e1..e59b70e7 100644 --- a/crates/ssz/src/encode.rs +++ b/crates/ssz/src/encode.rs @@ -1,10 +1,5 @@ //! Low-level SSZ binary encoding helpers. -/// Encodes a `u8` value as a single byte. -pub fn encode_u8(value: u8) -> [u8; 1] { - [value] -} - /// Encodes a `u32` value as 4 little-endian bytes. pub fn encode_u32(value: u32) -> [u8; 4] { value.to_le_bytes() @@ -14,9 +9,3 @@ pub fn encode_u32(value: u32) -> [u8; 4] { pub fn encode_u64(value: u64) -> [u8; 8] { value.to_le_bytes() } - -/// Encodes a `bool` as a single SSZ byte (`0x01` for `true`, `0x00` for -/// `false`). -pub fn encode_bool(value: bool) -> [u8; 1] { - [u8::from(value)] -} diff --git a/crates/ssz/src/error.rs b/crates/ssz/src/error.rs index 12b4a935..0a40753b 100644 --- a/crates/ssz/src/error.rs +++ b/crates/ssz/src/error.rs @@ -24,7 +24,24 @@ pub enum Error { /// Failed to decode or validate a hex string. #[error("Failed to convert hex string: {0}")] - FailedToConvertHexString(hex::FromHexError), + FailedToConvertHexString(HexDecodeError), +} + +/// Error type returned when decoding a hex string of an expected byte length. +#[derive(Debug, thiserror::Error)] +pub enum HexDecodeError { + /// The string is not valid hex. + #[error("invalid hex string: {0}")] + InvalidHex(#[from] hex::FromHexError), + + /// The string decoded successfully, but to the wrong number of bytes. + #[error("invalid decoded length: expected {expected} bytes, got {actual}")] + InvalidLength { + /// Expected byte count. + expected: usize, + /// Actual byte count. + actual: usize, + }, } /// Result type used by SSZ helper functions. diff --git a/crates/ssz/src/helpers.rs b/crates/ssz/src/helpers.rs index 02bc1c01..2b24a735 100644 --- a/crates/ssz/src/helpers.rs +++ b/crates/ssz/src/helpers.rs @@ -1,9 +1,9 @@ //! Generic SSZ helper functions. -use crate::{Error, HashWalker, Result}; +use crate::{Error, HashWalker, HexDecodeError, Result}; /// Decodes a `0x`-prefixed hex string and enforces an exact byte length. -pub fn from_0x_hex_str(s: &str, len: usize) -> std::result::Result, hex::FromHexError> { +pub fn from_0x_hex_str(s: &str, len: usize) -> std::result::Result, HexDecodeError> { if s.is_empty() { return Ok(vec![]); } @@ -11,7 +11,10 @@ pub fn from_0x_hex_str(s: &str, len: usize) -> std::result::Result, hex: let s = s.strip_prefix("0x").unwrap_or(s); let bytes = hex::decode(s)?; if bytes.len() != len { - return Err(hex::FromHexError::InvalidStringLength); + return Err(HexDecodeError::InvalidLength { + expected: len, + actual: bytes.len(), + }); } Ok(bytes) } @@ -92,6 +95,23 @@ pub fn to_0x_hex(bytes: &[u8]) -> String { mod tests { use super::*; + #[test] + fn from_0x_hex_str_separates_bad_hex_from_bad_length() { + assert_eq!(from_0x_hex_str("0x1234", 2).unwrap(), vec![0x12, 0x34]); + assert!(matches!( + from_0x_hex_str("0xzz", 1), + Err(HexDecodeError::InvalidHex(_)) + )); + // Valid hex, wrong byte count: previously reported as bad hex. + assert!(matches!( + from_0x_hex_str("0x1234", 3), + Err(HexDecodeError::InvalidLength { + expected: 3, + actual: 2 + }) + )); + } + #[test] fn left_pad_works() { assert_eq!(left_pad(&[0x12, 0x34], 4), vec![0x00, 0x00, 0x12, 0x34]); diff --git a/crates/ssz/src/lib.rs b/crates/ssz/src/lib.rs index 3a6a3852..e216592a 100644 --- a/crates/ssz/src/lib.rs +++ b/crates/ssz/src/lib.rs @@ -9,7 +9,7 @@ pub mod serde_utils; mod types; /// Generic SSZ error types. -pub use error::{Error, Result}; +pub use error::{Error, HexDecodeError, Result}; /// SSZ hashing walker and merkleization runtime. pub use hasher::{HashFn, HashWalker, Hasher, HasherError, calculate_limit}; /// Generic SSZ helper utilities. @@ -33,7 +33,4 @@ pub enum SszBinaryError { /// Actual byte count. actual: usize, }, - /// Invalid byte value for a boolean field. - #[error("invalid bool byte: {0}")] - InvalidBool(u8), } diff --git a/crates/tracing/examples/basic.rs b/crates/tracing/examples/basic.rs index 29cb35b7..cd53c41c 100644 --- a/crates/tracing/examples/basic.rs +++ b/crates/tracing/examples/basic.rs @@ -22,7 +22,6 @@ async fn main() { // Initialize tracing with default console config let config = TracingConfig::builder() .with_default_console() - .with_metrics(true) .loki(LokiConfig { loki_url: "http://localhost:3100".to_string(), labels: HashMap::new(), diff --git a/crates/tracing/src/config.rs b/crates/tracing/src/config.rs index 3fde25b2..0517c3be 100644 --- a/crates/tracing/src/config.rs +++ b/crates/tracing/src/config.rs @@ -11,9 +11,6 @@ pub struct TracingConfig { /// console logging is enabled. pub console: Option, - /// Enables metrics logging. If not - no metrics logging is enabled. - pub metrics: bool, - /// Overrides the environment filter. If not - the environment filter is /// used. pub override_env_filter: Option, @@ -178,18 +175,6 @@ impl TracingConfigBuilder { self } - /// Enables metrics logging. - pub fn with_metrics(mut self, enabled: bool) -> Self { - self.tracing_config.metrics = enabled; - self - } - - /// Sets whether metrics logging is enabled. - pub fn metrics(mut self, enabled: bool) -> Self { - self.tracing_config.metrics = enabled; - self - } - /// Sets the environment filter override. pub fn override_env_filter(mut self, filter: impl Into) -> Self { self.tracing_config.override_env_filter = Some(filter.into());