Expand description
Consensus types for Era post-merge history files
§Decoding
This crate handles compression/decompression and, for post-merge blocks, extraction of the
embedded execution block via CompressedSignedBeaconBlock::decode_execution_block. The
decompressed bytes are SSZ-encoded consensus types decoded with alloy_rpc_types_beacon’s
fork-specific beacon block types — no external consensus client is required.
§Example
§Decoding the execution block from a CompressedSignedBeaconBlock
use reth_era::era::types::consensus::CompressedSignedBeaconBlock;
use reth_ethereum_primitives::TransactionSigned;
fn decode_block(
compressed: &CompressedSignedBeaconBlock,
) -> Result<(), Box<dyn std::error::Error>> {
// Post-merge blocks carry an execution payload; pre-merge slots yield `None`.
if let Some(block) = compressed.decode_execution_block::<TransactionSigned>()? {
println!("Execution block number: {}", block.header.number);
}
Ok(())
}Structs§
- Compressed
Beacon State - Compressed beacon state
- Compressed
Signed Beacon Block - Compressed signed beacon block
Constants§
- COMPRESSED_
BEACON_ STATE CompressedBeaconStaterecord type: [0x02, 0x00]- COMPRESSED_
SIGNED_ BEACON_ BLOCK CompressedSignedBeaconBlockrecord type: [0x01, 0x00]