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 TxIndexFloor = 6,
12 // First written, by unreleased builds only, as the marker of a reconciled
13 // transaction index floor alone. The reconciliation that wrote it corrected
14 // `EarliestBlockNumber` first, so it already stood for both bounds and the value
15 // is kept.
16 HistoryBoundsReconciled = 7,
17}
18
19/// Represents the key for each unique value of the snap state stored in the db
20// Stores the snap state from previous sync cycles. Currently stores the header & state trie download checkpoint
21//, but will later on also include the body download checkpoint and the last pivot used
22#[derive(Debug, Copy, Clone)]
23pub enum SnapStateIndex {
24 // Hash of the last downloaded header in a previous sync cycle that was aborted
25 HeaderDownloadCheckpoint = 0,
26 // Last key fetched from the state trie
27 StateTrieKeyCheckpoint = 1,
28 // Paths from the state trie in need of healing
29 StateHealPaths = 2,
30 // Trie Rebuild Checkpoint (Current State Trie Root, Last Inserted Key Per Segment)
31 StateTrieRebuildCheckpoint = 3,
32 // Storage tries awaiting rebuild (AccountHash, ExpectedRoot)
33 StorageTrieRebuildPending = 4,
34}