@@ -18,12 +18,20 @@ use init4_bin_base::utils::from_env::{
1818use signet_constants:: KnownChains ;
1919use 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.
2225pub const PECORINO_GENESIS_JSON : & str = include_str ! ( "./pecorino.genesis.json" ) ;
2326
2427/// Local genesis file for testing purposes.
2528pub 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.
2836pub 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) ]
5765pub 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