kona_genesis/system/
kind.rs

1//! Contains the kind of system config update.
2
3use crate::{LogProcessingError, SystemConfigUpdateError};
4
5/// Represents type of update to the system config.
6#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
7#[repr(u64)]
8pub enum SystemConfigUpdateKind {
9    /// Batcher update type
10    Batcher = 0,
11    /// Gas config update type
12    GasConfig = 1,
13    /// Gas limit update type
14    GasLimit = 2,
15    /// Unsafe block signer update type
16    UnsafeBlockSigner = 3,
17    /// EIP-1559 parameters update type
18    Eip1559 = 4,
19    /// Operator fee parameter update
20    OperatorFee = 5,
21}
22
23impl TryFrom<u64> for SystemConfigUpdateKind {
24    type Error = SystemConfigUpdateError;
25
26    fn try_from(value: u64) -> Result<Self, Self::Error> {
27        match value {
28            0 => Ok(Self::Batcher),
29            1 => Ok(Self::GasConfig),
30            2 => Ok(Self::GasLimit),
31            3 => Ok(Self::UnsafeBlockSigner),
32            4 => Ok(Self::Eip1559),
33            5 => Ok(Self::OperatorFee),
34            _ => Err(SystemConfigUpdateError::LogProcessing(
35                LogProcessingError::InvalidSystemConfigUpdateType(value),
36            )),
37        }
38    }
39}