From c4e222b319f1d1af2f6a82194e48f488830210b0 Mon Sep 17 00:00:00 2001 From: Noah Citron Date: Thu, 15 Sep 2022 17:56:42 -0400 Subject: [PATCH] feat: mainnet support (#40) * feat: mainnet support * lint --- Cargo.lock | 3 +++ cli/src/main.rs | 3 ++- config/configs/mainnet.toml | 22 ++++++++++++++++++++++ config/src/networks.rs | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 config/configs/mainnet.toml diff --git a/Cargo.lock b/Cargo.lock index 7f351a8..44f76d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -510,6 +510,7 @@ dependencies = [ "ethers", "eyre", "hex", + "openssl", "serde", "ssz-rs", "toml", @@ -544,6 +545,7 @@ dependencies = [ "hex", "jsonrpsee", "log", + "openssl", "reqwest", "revm", "serde", @@ -1021,6 +1023,7 @@ dependencies = [ "futures", "hex", "jsonrpsee", + "openssl", "reqwest", "revm", "serde", diff --git a/cli/src/main.rs b/cli/src/main.rs index e528e1a..49270df 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -21,6 +21,7 @@ async fn main() -> Result<()> { fn get_config() -> Result { let cli = Cli::parse(); let mut config = match cli.network.as_str() { + "mainnet" => networks::mainnet(), "goerli" => networks::goerli(), _ => { let home = home_dir().unwrap(); @@ -50,7 +51,7 @@ fn get_config() -> Result { #[derive(Parser)] struct Cli { - #[clap(short, long, default_value = "goerli")] + #[clap(short, long, default_value = "mainnet")] network: String, #[clap(short, long)] port: Option, diff --git a/config/configs/mainnet.toml b/config/configs/mainnet.toml new file mode 100644 index 0000000..6efde10 --- /dev/null +++ b/config/configs/mainnet.toml @@ -0,0 +1,22 @@ +[general] +chain_id = 1 +genesis_time = 1606824023 +genesis_root = "0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95" +checkpoint = "0x03e315e11b3f88cd63dfb62c74a313c4a65949ce9e37599e0ee66533ceceadfd" +consensus_rpc = "http://testing.mainnet.beacon-api.nimbus.team" +execution_rpc = "https://eth-mainnet.g.alchemy.com/v2/Q0BqQPbTQfSMzrCNl4x80XS_PLLB1RNf" +rpc_port = 8545 + +[forks] + +[forks.genesis] +epoch = 0 +fork_version = "0x00000000" + +[forks.altair] +epoch = 74240 +fork_version = "0x01000000" + +[forks.bellatrix] +epoch = 144896 +fork_version = "0x02000000" diff --git a/config/src/networks.rs b/config/src/networks.rs index d836c3b..765fd30 100644 --- a/config/src/networks.rs +++ b/config/src/networks.rs @@ -2,6 +2,41 @@ use common::utils::hex_str_to_bytes; use crate::{Config, Fork, Forks, General}; +pub fn mainnet() -> Config { + Config { + general: General { + chain_id: 1, + genesis_time: 1606824023, + genesis_root: hex_str_to_bytes( + "0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95", + ) + .unwrap(), + checkpoint: hex_str_to_bytes( + "0x03e315e11b3f88cd63dfb62c74a313c4a65949ce9e37599e0ee66533ceceadfd", + ) + .unwrap(), + consensus_rpc: "http://testing.mainnet.beacon-api.nimbus.team".to_string(), + execution_rpc: "https://eth-mainnet.g.alchemy.com/v2/Q0BqQPbTQfSMzrCNl4x80XS_PLLB1RNf" + .to_string(), + rpc_port: Some(8545), + }, + forks: Forks { + genesis: Fork { + epoch: 0, + fork_version: hex_str_to_bytes("0x00000000").unwrap(), + }, + altair: Fork { + epoch: 74240, + fork_version: hex_str_to_bytes("0x01000000").unwrap(), + }, + bellatrix: Fork { + epoch: 144896, + fork_version: hex_str_to_bytes("0x02000000").unwrap(), + }, + }, + } +} + pub fn goerli() -> Config { Config { general: General {