Skip to main content

ethrex_storage/
utils.rs

1/// Represents the key for each unique value of the chain data stored in the db
2//  Stores chain-specific data such as chain id and latest finalized/pending/safe block number
3#[derive(Debug, Copy, Clone)]
4pub enum ChainDataIndex {
5    ChainConfig = 0,
6    EarliestBlockNumber = 1,
7    FinalizedBlockNumber = 2,
8    SafeBlockNumber = 3,
9    LatestBlockNumber = 4,
10    PendingBlockNumber = 5,
11}
12
13/// Represents the key for each unique value of the snap state stored in the db
14//  Stores the snap state from previous sync cycles. Currently stores the header & state trie download checkpoint
15//, but will later on also include the body download checkpoint and the last pivot used
16#[derive(Debug, Copy, Clone)]
17pub enum SnapStateIndex {
18    // Hash of the last downloaded header in a previous sync cycle that was aborted
19    HeaderDownloadCheckpoint = 0,
20    // Last key fetched from the state trie
21    StateTrieKeyCheckpoint = 1,
22    // Paths from the state trie in need of healing
23    StateHealPaths = 2,
24    // Trie Rebuild Checkpoint (Current State Trie Root, Last Inserted Key Per Segment)
25    StateTrieRebuildCheckpoint = 3,
26    // Storage tries awaiting rebuild (AccountHash, ExpectedRoot)
27    StorageTrieRebuildPending = 4,
28}