Skip to content

Commit d8e9c92

Browse files
authored
feat: parmigiana (#98)
1 parent 623dd37 commit d8e9c92

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "init4-bin-base"
33

44
description = "Internal utilities for binaries produced by the init4 team"
55
keywords = ["init4", "bin", "base"]
6-
version = "0.18.1-rc.0"
6+
version = "0.18.0-rc.1"
77
edition = "2021"
88
rust-version = "1.85"
99
authors = ["init4", "James Prestwich", "evalir"]
@@ -15,8 +15,8 @@ repository = "https://github.com/init4tech/bin-base"
1515
init4-from-env-derive = "0.1.0"
1616

1717
# Signet
18-
signet-constants = { version = "0.16.0-rc.0" }
19-
signet-tx-cache = { version = "0.16.0-rc.0", optional = true }
18+
signet-constants = { version = "0.16.0-rc.1" }
19+
signet-tx-cache = { version = "0.16.0-rc.1", optional = true }
2020

2121
# alloy
2222
alloy = { version = "1.0.35", optional = true, default-features = false, features = ["std", "signer-local", "consensus", "network"] }

src/utils/calc.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub struct SlotCalculator {
7171
}
7272

7373
impl SlotCalculator {
74-
/// Creates a new slot calculator.
74+
/// Create a new slot calculator.
7575
pub const fn new(start_timestamp: u64, slot_offset: usize, slot_duration: u64) -> Self {
7676
Self {
7777
start_timestamp,
@@ -80,7 +80,7 @@ impl SlotCalculator {
8080
}
8181
}
8282

83-
/// Creates a new slot calculator for Holesky.
83+
/// Create a new slot calculator for Holesky.
8484
pub const fn holesky() -> Self {
8585
// begin slot calculation for Holesky from block number 1, slot number 2, timestamp 1695902424
8686
// because of a strange 324 second gap between block 0 and 1 which
@@ -92,7 +92,16 @@ impl SlotCalculator {
9292
}
9393
}
9494

95-
/// Creates a new slot calculator for Pecorino host network.
95+
/// Create a new slot calculator for Parmigiana host network.
96+
pub const fn parmigiana_host() -> Self {
97+
Self {
98+
start_timestamp: 1765226348,
99+
slot_offset: 0,
100+
slot_duration: 12,
101+
}
102+
}
103+
104+
/// Create a new slot calculator for Pecorino host network.
96105
pub const fn pecorino_host() -> Self {
97106
Self {
98107
start_timestamp: 1754584265,
@@ -101,7 +110,7 @@ impl SlotCalculator {
101110
}
102111
}
103112

104-
/// Creates a new slot calculator for Ethereum mainnet.
113+
/// Create a new slot calculator for Ethereum mainnet.
105114
pub const fn mainnet() -> Self {
106115
Self {
107116
start_timestamp: 1663224179,
@@ -325,9 +334,11 @@ impl FromEnv for SlotCalculator {
325334
impl From<KnownChains> for SlotCalculator {
326335
fn from(value: KnownChains) -> Self {
327336
match value {
337+
KnownChains::Mainnet => SlotCalculator::mainnet(),
338+
KnownChains::Parmigiana => SlotCalculator::parmigiana_host(),
339+
#[allow(deprecated)]
328340
KnownChains::Pecorino => SlotCalculator::pecorino_host(),
329341
KnownChains::Test => SlotCalculator::new(12, 0, 12),
330-
KnownChains::Mainnet => SlotCalculator::mainnet(),
331342
}
332343
}
333344
}

0 commit comments

Comments
 (0)