Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"] }
Expand Down
21 changes: 16 additions & 5 deletions src/utils/calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed timestamp is correct

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,
Expand All @@ -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,
Expand Down Expand Up @@ -325,9 +334,11 @@ impl FromEnv for SlotCalculator {
impl From<KnownChains> 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(),
}
}
}
Expand Down