feat: mainnet support (#40)

* feat: mainnet support

* lint
This commit is contained in:
Noah Citron 2022-09-15 17:56:42 -04:00 committed by GitHub
parent 8f3b32d39d
commit c4e222b319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 1 deletions

3
Cargo.lock generated
View File

@ -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",

View File

@ -21,6 +21,7 @@ async fn main() -> Result<()> {
fn get_config() -> Result<Config> {
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<Config> {
#[derive(Parser)]
struct Cli {
#[clap(short, long, default_value = "goerli")]
#[clap(short, long, default_value = "mainnet")]
network: String,
#[clap(short, long)]
port: Option<u16>,

View File

@ -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"

View File

@ -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 {