chore: reduce size of common types (#5304)

This commit is contained in:
DaniPopes
2023-11-06 13:45:20 +01:00
committed by GitHub
parent 2d315c2f3a
commit f8ceda9ea8
55 changed files with 580 additions and 532 deletions

View File

@@ -1,7 +1,7 @@
/// Result alias for [`RethError`]
/// Result alias for [`RethError`].
pub type RethResult<T> = Result<T, RethError>;
/// Core error variants possible when interacting with the blockchain
/// Core error variants possible when interacting with the blockchain.
#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum RethError {
@@ -38,3 +38,15 @@ impl From<reth_nippy_jar::NippyJarError> for RethError {
RethError::Custom(err.to_string())
}
}
// We don't want these types to be too large because they're used in a lot of places.
const _SIZE_ASSERTIONS: () = {
// Main error.
let _: [(); 64] = [(); std::mem::size_of::<RethError>()];
// Biggest variant.
let _: [(); 64] = [(); std::mem::size_of::<crate::provider::ProviderError>()];
// Other common types.
let _: [(); 16] = [(); std::mem::size_of::<crate::db::DatabaseError>()];
};