Skip to content

Commit 79cd632

Browse files
rswansonprestwich
andauthored
feat: parmigiana (#56)
* feat: parmigiana * fix: Update pragueTime and add osakaTime fields * fix: Add Osaka time and blob schedule configuration * feat: add parmigiana to genesis, deprecate pecorino, refactor genesis spec * fix: doctest * fix: Swap values for orders, passage, and transactor * fix: Update WETH address in parmigiana.genesis.json --------- Co-authored-by: James <james@prestwi.ch>
1 parent a839db8 commit 79cd632

File tree

8 files changed

+1181
-56
lines changed

8 files changed

+1181
-56
lines changed

Cargo.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.14.4"
6+
version = "0.16.0-rc.1"
77
edition = "2024"
88
rust-version = "1.88"
99
authors = ["init4"]
@@ -34,33 +34,33 @@ debug = false
3434
incremental = false
3535

3636
[workspace.dependencies]
37-
signet-blobber = { version = "0.14", path = "crates/blobber" }
38-
signet-block-processor = { version = "0.14", path = "crates/block-processor" }
39-
signet-db = { version = "0.14", path = "crates/db" }
40-
signet-genesis = { version = "0.14", path = "crates/genesis" }
41-
signet-node = { version = "0.14", path = "crates/node" }
42-
signet-node-config = { version = "0.14", path = "crates/node-config" }
43-
signet-node-tests = { version = "0.14", path = "crates/node-tests" }
44-
signet-node-types = { version = "0.14", path = "crates/node-types" }
45-
signet-rpc = { version = "0.14", path = "crates/rpc" }
37+
signet-blobber = { version = "0.16.0-rc.1", path = "crates/blobber" }
38+
signet-block-processor = { version = "0.16.0-rc.1", path = "crates/block-processor" }
39+
signet-db = { version = "0.16.0-rc.1", path = "crates/db" }
40+
signet-genesis = { version = "0.16.0-rc.1", path = "crates/genesis" }
41+
signet-node = { version = "0.16.0-rc.1", path = "crates/node" }
42+
signet-node-config = { version = "0.16.0-rc.1", path = "crates/node-config" }
43+
signet-node-tests = { version = "0.16.0-rc.1", path = "crates/node-tests" }
44+
signet-node-types = { version = "0.16.0-rc.1", path = "crates/node-types" }
45+
signet-rpc = { version = "0.16.0-rc.1", path = "crates/rpc" }
4646

4747
init4-bin-base = { version = "0.17.0", features = ["alloy"] }
4848

49-
signet-bundle = "0.14"
50-
signet-constants = "0.14"
51-
signet-evm = "0.14"
52-
signet-extract = "0.14"
53-
signet-test-utils = "0.14"
54-
signet-tx-cache = "0.14"
55-
signet-types = "0.14"
56-
signet-zenith = "0.14"
57-
signet-journal = "0.14"
49+
signet-bundle = "0.16.0-rc.1"
50+
signet-constants = "0.16.0-rc.1"
51+
signet-evm = "0.16.0-rc.1"
52+
signet-extract = "0.16.0-rc.1"
53+
signet-test-utils = "0.16.0-rc.1"
54+
signet-tx-cache = "0.16.0-rc.1"
55+
signet-types = "0.16.0-rc.1"
56+
signet-zenith = "0.16.0-rc.1"
57+
signet-journal = "0.16.0-rc.1"
5858

5959
# ajj
6060
ajj = { version = "0.3.4" }
6161

6262
# trevm
63-
trevm = { version = "0.31.0", features = ["full_env_cfg"] }
63+
trevm = { version = "0.31.2", features = ["full_env_cfg"] }
6464
revm-inspectors = "0.32.0" # should be 1 more than trevm version, usually
6565

6666
# Alloy periphery crates

crates/genesis/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@ Genesis configuration and utilities for the Signet Node.
44

55
This library contains the following:
66

7-
- `GenesisSpec` - An enum representing different genesis specifications (Mainnet,
8-
Pecorino, Test, or custom file paths), which can be used to load genesis data.
9-
- `NetworkGenesis` - A struct containing both rollup and host genesis configurations.
7+
- `GenesisSpec` - An enum representing different genesis specifications
8+
(Mainnet, Parmigiana, Pecorino, Test, or custom file paths), which can be
9+
used to load genesis data.
10+
- `NetworkGenesis` - A struct containing both rollup and host genesis
11+
configurations.
12+
- `PARMIGIANA_GENESIS` / `PARMIGIANA_HOST_GENESIS` - The Parmigiana genesis
13+
data.
1014
- `PECORINO_GENESIS` / `PECORINO_HOST_GENESIS` - The Pecorino genesis data.
11-
- `TEST_GENESIS` / `TEST_HOST_GENESIS` - Local test genesis for testing purposes.
15+
- `TEST_GENESIS` / `TEST_HOST_GENESIS` - Local test genesis for testing
16+
purposes.
1217
- `GenesisError` - Errors that can occur when loading or parsing genesis data.
1318

1419
## Example
1520

1621
```
1722
# use signet_genesis::GenesisSpec;
23+
# use signet_constants::KnownChains;
1824
# fn _main() -> Result<(), Box<dyn std::error::Error>> {
19-
let genesis = GenesisSpec::Pecorino.load_genesis()?;
25+
let genesis = GenesisSpec::Known(KnownChains::Parmigiana).load_genesis()?;
2026
// Access rollup (L2/Signet) genesis
2127
let rollup = &genesis.rollup;
2228
// Access host (L1/Ethereum) genesis

crates/genesis/src/lib.rs

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ pub static MAINNET_HOST_GENESIS: LazyLock<Genesis> = LazyLock::new(|| {
4646
serde_json::from_str(MAINNET_HOST_GENESIS_JSON).expect("Failed to parse mainnet host genesis")
4747
});
4848

49+
/// Genesis for the Parmigiana testnet.
50+
pub static PARMIGIANA_GENESIS: LazyLock<Genesis> = LazyLock::new(|| {
51+
serde_json::from_str(include_str!("./parmigiana.genesis.json"))
52+
.expect("Failed to parse parmigiana genesis")
53+
});
54+
55+
/// Genesis for the Parmigiana host testnet.
56+
pub static PARMIGIANA_HOST_GENESIS: LazyLock<Genesis> = LazyLock::new(|| {
57+
serde_json::from_str(include_str!("./parmigiana.host.genesis.json"))
58+
.expect("Failed to parse parmigiana host genesis")
59+
});
60+
4961
/// Genesis for the Pecorino testnet.
5062
pub static PECORINO_GENESIS: LazyLock<Genesis> = LazyLock::new(|| {
5163
serde_json::from_str(PECORINO_GENESIS_JSON).expect("Failed to parse pecorino genesis")
@@ -90,9 +102,9 @@ pub enum GenesisError {
90102
#[derive(Debug, Clone)]
91103
pub struct NetworkGenesis {
92104
/// The rollup genesis configuration.
93-
pub rollup: Genesis,
105+
pub rollup: Cow<'static, Genesis>,
94106
/// The host genesis configuration.
95-
pub host: Genesis,
107+
pub host: Cow<'static, Genesis>,
96108
}
97109

98110
/// Raw genesis JSON strings for a network.
@@ -108,12 +120,8 @@ pub struct RawNetworkGenesis {
108120
#[derive(Debug, Clone, serde::Deserialize)]
109121
#[serde(untagged)]
110122
pub enum GenesisSpec {
111-
/// Signet mainnet.
112-
Mainnet,
113-
/// Pecorino testnet.
114-
Pecorino,
115-
/// Local testnet.
116-
Test,
123+
/// Known chain genesis configurations.
124+
Known(#[serde(deserialize_with = "known_from_str")] KnownChains),
117125
/// Custom paths to genesis files.
118126
Custom {
119127
/// Path to the rollup genesis file.
@@ -123,21 +131,34 @@ pub enum GenesisSpec {
123131
},
124132
}
125133

134+
fn known_from_str<'de, D>(deserializer: D) -> std::result::Result<KnownChains, D::Error>
135+
where
136+
D: serde::Deserializer<'de>,
137+
{
138+
let s = <String as serde::Deserialize>::deserialize(deserializer)?;
139+
KnownChains::from_str(&s).map_err(serde::de::Error::custom)
140+
}
141+
126142
impl GenesisSpec {
127143
/// Load the raw genesis JSON strings from the specified source.
128144
///
129145
/// Returns both rollup and host genesis JSON strings.
130146
pub fn load_raw_genesis(&self) -> Result<RawNetworkGenesis> {
131147
match self {
132-
GenesisSpec::Mainnet => Ok(RawNetworkGenesis {
148+
GenesisSpec::Known(KnownChains::Mainnet) => Ok(RawNetworkGenesis {
133149
rollup: Cow::Borrowed(MAINNET_GENESIS_JSON),
134150
host: Cow::Borrowed(MAINNET_HOST_GENESIS_JSON),
135151
}),
136-
GenesisSpec::Pecorino => Ok(RawNetworkGenesis {
152+
GenesisSpec::Known(KnownChains::Parmigiana) => Ok(RawNetworkGenesis {
153+
rollup: Cow::Borrowed(include_str!("./parmigiana.genesis.json")),
154+
host: Cow::Borrowed(include_str!("./parmigiana.host.genesis.json")),
155+
}),
156+
#[allow(deprecated)]
157+
GenesisSpec::Known(KnownChains::Pecorino) => Ok(RawNetworkGenesis {
137158
rollup: Cow::Borrowed(PECORINO_GENESIS_JSON),
138159
host: Cow::Borrowed(PECORINO_HOST_GENESIS_JSON),
139160
}),
140-
GenesisSpec::Test => Ok(RawNetworkGenesis {
161+
GenesisSpec::Known(KnownChains::Test) => Ok(RawNetworkGenesis {
141162
rollup: Cow::Borrowed(TEST_GENESIS_JSON),
142163
host: Cow::Borrowed(TEST_HOST_GENESIS_JSON),
143164
}),
@@ -153,21 +174,27 @@ impl GenesisSpec {
153174
/// Returns both rollup and host genesis configurations.
154175
pub fn load_genesis(&self) -> Result<NetworkGenesis> {
155176
match self {
156-
GenesisSpec::Mainnet => Ok(NetworkGenesis {
157-
rollup: MAINNET_GENESIS.clone(),
158-
host: MAINNET_HOST_GENESIS.clone(),
177+
GenesisSpec::Known(KnownChains::Mainnet) => Ok(NetworkGenesis {
178+
rollup: Cow::Borrowed(&*MAINNET_GENESIS),
179+
host: Cow::Borrowed(&*MAINNET_HOST_GENESIS),
180+
}),
181+
GenesisSpec::Known(KnownChains::Parmigiana) => Ok(NetworkGenesis {
182+
rollup: Cow::Borrowed(&*PARMIGIANA_GENESIS),
183+
host: Cow::Borrowed(&*PARMIGIANA_HOST_GENESIS),
159184
}),
160-
GenesisSpec::Pecorino => Ok(NetworkGenesis {
161-
rollup: PECORINO_GENESIS.clone(),
162-
host: PECORINO_HOST_GENESIS.clone(),
185+
#[allow(deprecated)]
186+
GenesisSpec::Known(KnownChains::Pecorino) => Ok(NetworkGenesis {
187+
rollup: Cow::Borrowed(&*PECORINO_GENESIS),
188+
host: Cow::Borrowed(&*PECORINO_HOST_GENESIS),
189+
}),
190+
GenesisSpec::Known(KnownChains::Test) => Ok(NetworkGenesis {
191+
rollup: Cow::Borrowed(&*TEST_GENESIS),
192+
host: Cow::Borrowed(&*TEST_HOST_GENESIS),
163193
}),
164-
GenesisSpec::Test => {
165-
Ok(NetworkGenesis { rollup: TEST_GENESIS.clone(), host: TEST_HOST_GENESIS.clone() })
166-
}
167194
GenesisSpec::Custom { .. } => self.load_raw_genesis().and_then(|genesis| {
168195
Ok(NetworkGenesis {
169-
rollup: serde_json::from_str(&genesis.rollup)?,
170-
host: serde_json::from_str(&genesis.host)?,
196+
rollup: Cow::Owned(serde_json::from_str(&genesis.rollup)?),
197+
host: Cow::Owned(serde_json::from_str(&genesis.host)?),
171198
})
172199
}),
173200
}
@@ -240,9 +267,6 @@ impl FromEnv for GenesisSpec {
240267

241268
impl From<KnownChains> for GenesisSpec {
242269
fn from(known: KnownChains) -> Self {
243-
match known {
244-
KnownChains::Pecorino => GenesisSpec::Pecorino,
245-
KnownChains::Test => GenesisSpec::Test,
246-
}
270+
Self::Known(known)
247271
}
248272
}

crates/genesis/src/parmigiana.genesis.json

Lines changed: 145 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)