Skip to content

Commit 191e41f

Browse files
authored
adds incomplete mainnet genesis file (#40)
# adds incomplete mainnet genesis file Adds the initial `mainnet`​ genesis file and scaffolding with the deploy height left as `TODO`​for completion once production contracts are deployed.
1 parent e088caf commit 191e41f

File tree

2 files changed

+155
-0
lines changed

2 files changed

+155
-0
lines changed

crates/genesis/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ use init4_bin_base::utils::from_env::{
1818
use signet_constants::KnownChains;
1919
use std::{borrow::Cow, path::PathBuf, str::FromStr, sync::LazyLock};
2020

21+
/// Signet mainnet genesis file.
22+
pub const MAINNET_GENESIS_JSON: &str = include_str!("./mainnet.genesis.json");
23+
2124
/// Pecorino genesis file.
2225
pub const PECORINO_GENESIS_JSON: &str = include_str!("./pecorino.genesis.json");
2326

2427
/// Local genesis file for testing purposes.
2528
pub const TEST_GENESIS_JSON: &str = include_str!("./local.genesis.json");
2629

30+
/// Mainnet genesis for the Signet mainnet.
31+
pub static MAINNET_GENESIS: LazyLock<Genesis> = LazyLock::new(|| {
32+
serde_json::from_str(MAINNET_GENESIS_JSON).expect("Failed to parse mainnet genesis")
33+
});
34+
2735
/// Genesis for the Pecorino testnet.
2836
pub static PECORINO_GENESIS: LazyLock<Genesis> = LazyLock::new(|| {
2937
serde_json::from_str(PECORINO_GENESIS_JSON).expect("Failed to parse pecorino genesis")
@@ -55,6 +63,8 @@ pub enum GenesisError {
5563
#[derive(Debug, Clone, serde::Deserialize)]
5664
#[serde(untagged)]
5765
pub enum GenesisSpec {
66+
/// Signet mainnet.
67+
Mainnet,
5868
/// Pecorino testnet.
5969
Pecorino,
6070
/// Local testnet.
@@ -69,6 +79,7 @@ impl GenesisSpec {
6979
/// This will alwys return a valid string for [`KnownChains`].
7080
pub fn load_raw_genesis(&self) -> Result<Cow<'static, str>> {
7181
match self {
82+
GenesisSpec::Mainnet => Ok(Cow::Borrowed(MAINNET_GENESIS_JSON)),
7283
GenesisSpec::Pecorino => Ok(Cow::Borrowed(PECORINO_GENESIS_JSON)),
7384
GenesisSpec::Test => Ok(Cow::Borrowed(TEST_GENESIS_JSON)),
7485
GenesisSpec::Path(path) => {
@@ -82,6 +93,7 @@ impl GenesisSpec {
8293
/// This will always return a valid genesis for [`KnownChains`].
8394
pub fn load_genesis(&self) -> Result<alloy::genesis::Genesis> {
8495
match self {
96+
GenesisSpec::Mainnet => Ok(MAINNET_GENESIS.clone()),
8597
GenesisSpec::Pecorino => Ok(PECORINO_GENESIS.clone()),
8698
GenesisSpec::Test => Ok(TEST_GENESIS.clone()),
8799
GenesisSpec::Path(_) => self

0 commit comments

Comments
 (0)