Skip to content

Commit

Permalink
feat(primitives): derive Default for SpecId (bluealloy#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored and fubuloubu committed Apr 11, 2024
1 parent b79eb7e commit c065485
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/primitives/src/specification.rs
Expand Up @@ -7,7 +7,7 @@ pub use SpecId::*;
/// Information was obtained from the [Ethereum Execution Specifications](https://github.com/ethereum/execution-specs)
#[cfg(not(feature = "optimism"))]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, enumn::N)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, enumn::N)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum SpecId {
FRONTIER = 0, // Frontier 0
Expand All @@ -28,6 +28,7 @@ pub enum SpecId {
MERGE = 15, // Paris/Merge 15537394 (TTD: 58750000000000000000000)
SHANGHAI = 16, // Shanghai 17034870 (TS: 1681338455)
CANCUN = 17, // Cancun TBD
#[default]
LATEST = u8::MAX,
}

Expand All @@ -36,7 +37,7 @@ pub enum SpecId {
/// Information was obtained from the [Ethereum Execution Specifications](https://github.com/ethereum/execution-specs)
#[cfg(feature = "optimism")]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, enumn::N)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, enumn::N)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum SpecId {
FRONTIER = 0,
Expand All @@ -61,6 +62,7 @@ pub enum SpecId {
CANYON = 19,
CANCUN = 20,
ECOTONE = 21,
#[default]
LATEST = u8::MAX,
}

Expand Down

0 comments on commit c065485

Please sign in to comment.