From 02b6285c1bdd7e4035e65763e983e9d691102688 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 10 Dec 2025 12:13:32 -0500 Subject: [PATCH] feat: parmigiana --- Cargo.toml | 6 +++--- src/utils/calc.rs | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a2ef6ea..0df72c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "init4-bin-base" description = "Internal utilities for binaries produced by the init4 team" keywords = ["init4", "bin", "base"] -version = "0.18.1-rc.0" +version = "0.18.0-rc.1" edition = "2021" rust-version = "1.85" authors = ["init4", "James Prestwich", "evalir"] @@ -15,8 +15,8 @@ repository = "https://github.com/init4tech/bin-base" init4-from-env-derive = "0.1.0" # Signet -signet-constants = { version = "0.16.0-rc.0" } -signet-tx-cache = { version = "0.16.0-rc.0", optional = true } +signet-constants = { version = "0.16.0-rc.1" } +signet-tx-cache = { version = "0.16.0-rc.1", optional = true } # alloy alloy = { version = "1.0.35", optional = true, default-features = false, features = ["std", "signer-local", "consensus", "network"] } diff --git a/src/utils/calc.rs b/src/utils/calc.rs index 97c1ba1..5cb5754 100644 --- a/src/utils/calc.rs +++ b/src/utils/calc.rs @@ -71,7 +71,7 @@ pub struct SlotCalculator { } impl SlotCalculator { - /// Creates a new slot calculator. + /// Create a new slot calculator. pub const fn new(start_timestamp: u64, slot_offset: usize, slot_duration: u64) -> Self { Self { start_timestamp, @@ -80,7 +80,7 @@ impl SlotCalculator { } } - /// Creates a new slot calculator for Holesky. + /// Create a new slot calculator for Holesky. pub const fn holesky() -> Self { // begin slot calculation for Holesky from block number 1, slot number 2, timestamp 1695902424 // because of a strange 324 second gap between block 0 and 1 which @@ -92,7 +92,16 @@ impl SlotCalculator { } } - /// Creates a new slot calculator for Pecorino host network. + /// Create a new slot calculator for Parmigiana host network. + pub const fn parmigiana_host() -> Self { + Self { + start_timestamp: 1765226348, + slot_offset: 0, + slot_duration: 12, + } + } + + /// Create a new slot calculator for Pecorino host network. pub const fn pecorino_host() -> Self { Self { start_timestamp: 1754584265, @@ -101,7 +110,7 @@ impl SlotCalculator { } } - /// Creates a new slot calculator for Ethereum mainnet. + /// Create a new slot calculator for Ethereum mainnet. pub const fn mainnet() -> Self { Self { start_timestamp: 1663224179, @@ -325,9 +334,11 @@ impl FromEnv for SlotCalculator { impl From for SlotCalculator { fn from(value: KnownChains) -> Self { match value { + KnownChains::Mainnet => SlotCalculator::mainnet(), + KnownChains::Parmigiana => SlotCalculator::parmigiana_host(), + #[allow(deprecated)] KnownChains::Pecorino => SlotCalculator::pecorino_host(), KnownChains::Test => SlotCalculator::new(12, 0, 12), - KnownChains::Mainnet => SlotCalculator::mainnet(), } } }