stratus/eth/primitives/
point_in_time.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::eth::primitives::BlockNumber;
use crate::infra::metrics::MetricLabelValue;

/// EVM storage point-in-time indicator.
#[derive(Debug, strum::Display, Clone, Copy, Default, strum::EnumIs, serde::Serialize, serde::Deserialize, fake::Dummy, PartialEq)]
pub enum PointInTime {
    /// State of `Account` or `Slot` at the pending block being mined.
    ///
    /// If state did not change, then it is the same as the `Mined` state.
    #[strum(to_string = "pending")]
    Pending,

    /// State of `Account` or `Slot` at the last mined block.
    #[default]
    #[strum(to_string = "mined")]
    Mined,

    /// State of `Account` or `Slot` at some specific mined block in the past.
    #[strum(to_string = "mined-past")]
    MinedPast(BlockNumber),
}

// -----------------------------------------------------------------------------
// Conversions: Self -> Other
// -----------------------------------------------------------------------------
impl From<PointInTime> for MetricLabelValue {
    fn from(value: PointInTime) -> Self {
        Self::Some(value.to_string())
    }
}