diff --git a/crates/storage/errors/src/lockfile.rs b/crates/storage/errors/src/lockfile.rs index 7c04869e9771..ec276cdce5e4 100644 --- a/crates/storage/errors/src/lockfile.rs +++ b/crates/storage/errors/src/lockfile.rs @@ -1,4 +1,4 @@ -use alloc::string::String; +use alloc::string::{String, ToString}; use reth_fs_util::FsPathError; /// Storage lock error. diff --git a/crates/storage/errors/src/provider.rs b/crates/storage/errors/src/provider.rs index 7076984405d3..c5ba48575ebd 100644 --- a/crates/storage/errors/src/provider.rs +++ b/crates/storage/errors/src/provider.rs @@ -1,5 +1,3 @@ -use std::path::PathBuf; - use crate::{db::DatabaseError, lockfile::StorageLockError, writer::UnifiedStorageWriterError}; use alloc::{boxed::Box, string::String}; use alloy_eips::{BlockHashOrNumber, HashOrNumber}; @@ -19,18 +17,18 @@ pub enum ProviderError { Database(#[from] DatabaseError), /// RLP error. - #[error(transparent)] + #[error("{_0}")] Rlp(alloy_rlp::Error), /// Filesystem path error. - #[error("{0}")] + #[error("{_0}")] FsPathError(String), /// Nippy jar error. - #[error("nippy jar error: {0}")] + #[error("nippy jar error: {_0}")] NippyJar(String), /// Trie witness error. - #[error("trie witness error: {0}")] + #[error("trie witness error: {_0}")] TrieWitnessError(String), /// Error when recovering the sender for a transaction @@ -38,11 +36,11 @@ pub enum ProviderError { SenderRecoveryError, /// The header number was not found for the given block hash. - #[error("block hash {0} does not exist in Headers table")] + #[error("block hash {_0} does not exist in Headers table")] BlockHashNotFound(BlockHash), /// A block body is missing. - #[error("block meta not found for block #{0}")] + #[error("block meta not found for block #{_0}")] BlockBodyIndicesNotFound(BlockNumber), /// The transition ID was found for the given address and storage key, but the changeset was @@ -67,19 +65,19 @@ pub enum ProviderError { }, /// The total difficulty for a block is missing. - #[error("total difficulty not found for block #{0}")] + #[error("total difficulty not found for block #{_0}")] TotalDifficultyNotFound(BlockNumber), /// When required header related data was not found but was required. - #[error("no header found for {0:?}")] + #[error("no header found for {_0:?}")] HeaderNotFound(BlockHashOrNumber), /// The specific transaction identified by hash or id is missing. - #[error("no transaction found for {0:?}")] + #[error("no transaction found for {_0:?}")] TransactionNotFound(HashOrNumber), /// The specific receipt for a transaction identified by hash or id is missing - #[error("no receipt found for {0:?}")] + #[error("no receipt found for {_0:?}")] ReceiptNotFound(HashOrNumber), /// Unable to find the best block. @@ -99,15 +97,15 @@ pub enum ProviderError { CacheServiceUnavailable, /// Thrown when we failed to lookup a block for the pending state. - #[error("unknown block {0}")] + #[error("unknown block {_0}")] UnknownBlockHash(B256), /// Thrown when we were unable to find a state for a block hash. - #[error("no state found for block {0}")] + #[error("no state found for block {_0}")] StateForHashNotFound(B256), /// Thrown when we were unable to find a state for a block number. - #[error("no state found for block number {0}")] + #[error("no state found for block number {_0}")] StateForNumberNotFound(u64), /// Unable to find the block number for a given transaction index. @@ -115,15 +113,15 @@ pub enum ProviderError { BlockNumberForTransactionIndexNotFound, /// Root mismatch. - #[error("merkle trie {0}")] + #[error("merkle trie {_0}")] StateRootMismatch(Box), /// Root mismatch during unwind - #[error("unwind merkle trie {0}")] + #[error("unwind merkle trie {_0}")] UnwindStateRootMismatch(Box), /// State is not available for the given block number because it is pruned. - #[error("state at block #{0} is pruned")] + #[error("state at block #{_0} is pruned")] StateAtBlockPruned(BlockNumber), /// Provider does not support this particular request. @@ -132,27 +130,27 @@ pub enum ProviderError { /// Static File is not found at specified path. #[cfg(feature = "std")] - #[error("not able to find {0} static file at {1:?}")] - MissingStaticFilePath(StaticFileSegment, PathBuf), + #[error("not able to find {_0} static file at {_1:?}")] + MissingStaticFilePath(StaticFileSegment, std::path::PathBuf), /// Static File is not found for requested block. - #[error("not able to find {0} static file for block number {1}")] + #[error("not able to find {_0} static file for block number {_1}")] MissingStaticFileBlock(StaticFileSegment, BlockNumber), /// Static File is not found for requested transaction. - #[error("unable to find {0} static file for transaction id {1}")] + #[error("unable to find {_0} static file for transaction id {_1}")] MissingStaticFileTx(StaticFileSegment, TxNumber), /// Static File is finalized and cannot be written to. - #[error("unable to write block #{1} to finalized static file {0}")] + #[error("unable to write block #{_1} to finalized static file {_0}")] FinalizedStaticFile(StaticFileSegment, BlockNumber), /// Trying to insert data from an unexpected block number. - #[error("trying to append data to {0} as block #{1} but expected block #{2}")] + #[error("trying to append data to {_0} as block #{_1} but expected block #{_2}")] UnexpectedStaticFileBlockNumber(StaticFileSegment, BlockNumber, BlockNumber), /// Trying to insert data from an unexpected block number. - #[error("trying to append row to {0} at index #{1} but expected index #{2}")] + #[error("trying to append row to {_0} at index #{_1} but expected index #{_2}")] UnexpectedStaticFileTxNumber(StaticFileSegment, TxNumber, TxNumber), /// Static File Provider was initialized as read-only. @@ -160,7 +158,7 @@ pub enum ProviderError { ReadOnlyStaticFileAccess, /// Consistent view error. - #[error("failed to initialize consistent view: {0}")] + #[error("failed to initialize consistent view: {_0}")] ConsistentView(Box), /// Storage lock error.