reth_era/
lib.rs

1//! Era and Era1 files support for Ethereum history expiry.
2//!
3//! Era1 files use the same e2store foundation but are specialized for
4//! execution layer block history, following the format:
5//! Version | block-tuple* | other-entries* | Accumulator | `BlockIndex`
6//!
7//! Era files are special instances of `.e2s` files with a strict content format
8//! optimized for reading and long-term storage and distribution.
9//!
10//! See also:
11//! - E2store format: <https://github.com/status-im/nimbus-eth2/blob/stable/docs/e2store.md>
12//! - Era format: <https://github.com/eth-clients/e2store-format-specs/blob/main/formats/era.md>
13//! - Era1 format: <https://github.com/eth-clients/e2store-format-specs/blob/main/formats/era1.md>
14
15pub mod consensus_types;
16pub mod e2s_file;
17pub mod e2s_types;
18pub mod era1_file;
19pub mod era1_types;
20pub mod era_file_ops;
21pub mod era_types;
22pub mod execution_types;
23#[cfg(test)]
24pub(crate) mod test_utils;
25
26use crate::e2s_types::E2sError;
27use alloy_rlp::Decodable;
28use ssz::Decode;
29
30/// Extension trait for generic decoding from compressed data
31pub trait DecodeCompressed {
32    /// Decompress and decode the data into the given type
33    fn decode<T: Decodable>(&self) -> Result<T, E2sError>;
34}
35
36/// Extension trait for generic decoding from compressed ssz data
37pub trait DecodeCompressedSsz {
38    /// Decompress and decode the SSZ data into the given type
39    fn decode<T: Decode>(&self) -> Result<T, E2sError>;
40}