From cfceff177f87f8d11b1cc482eeeb063eae9fc9d0 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Thu, 16 Jun 2022 12:45:11 +0200 Subject: [PATCH] Add Sepolia config --- packages/cli/src/networks/index.ts | 6 +++- packages/cli/src/networks/sepolia.ts | 12 +++++++ .../src/chainConfig/networks/sepolia.ts | 36 +++++++++++++++++++ packages/config/src/networks.ts | 13 +++++-- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 packages/cli/src/networks/sepolia.ts create mode 100644 packages/config/src/chainConfig/networks/sepolia.ts diff --git a/packages/cli/src/networks/index.ts b/packages/cli/src/networks/index.ts index f0b4d051ead..f3fa5f08bd8 100644 --- a/packages/cli/src/networks/index.ts +++ b/packages/cli/src/networks/index.ts @@ -13,14 +13,16 @@ import * as gnosis from "./gnosis.js"; import * as prater from "./prater.js"; import * as kiln from "./kiln.js"; import * as ropsten from "./ropsten.js"; +import * as sepolia from "./sepolia.js"; -export type NetworkName = "mainnet" | "dev" | "gnosis" | "prater" | "kiln" | "ropsten"; +export type NetworkName = "mainnet" | "dev" | "gnosis" | "prater" | "kiln" | "ropsten" | "sepolia"; export const networkNames: NetworkName[] = [ "mainnet", "gnosis", "prater", "kiln", "ropsten", + "sepolia", // Leave always as last network. The order matters for the --help printout "dev", @@ -53,6 +55,8 @@ function getNetworkData( return kiln; case "ropsten": return ropsten; + case "sepolia": + return sepolia; default: throw Error(`Network not supported: ${network}`); } diff --git a/packages/cli/src/networks/sepolia.ts b/packages/cli/src/networks/sepolia.ts new file mode 100644 index 00000000000..28e527c000f --- /dev/null +++ b/packages/cli/src/networks/sepolia.ts @@ -0,0 +1,12 @@ +export {sepoliaChainConfig as chainConfig} from "@chainsafe/lodestar-config/networks"; + +/* eslint-disable max-len */ + +export const depositContractDeployBlock = 1273020; +export const genesisFileUrl = "https://raw.githubusercontent.com/eth-clients/merge-testnets/main/sepolia/genesis.ssz"; +export const bootnodesFileUrl = + "https://raw.githubusercontent.com/eth-clients/merge-testnets/main/sepolia/bootstrap_nodes.txt"; + +export const bootEnrs = [ + "enr:-Iq4QMCTfIMXnow27baRUb35Q8iiFHSIDBJh6hQM5Axohhf4b6Kr_cOCu0htQ5WvVqKvFgY28893DHAg8gnBAXsAVqmGAX53x8JggmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk", +]; diff --git a/packages/config/src/chainConfig/networks/sepolia.ts b/packages/config/src/chainConfig/networks/sepolia.ts new file mode 100644 index 00000000000..5e7c5fb4126 --- /dev/null +++ b/packages/config/src/chainConfig/networks/sepolia.ts @@ -0,0 +1,36 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import {fromHexString as b} from "@chainsafe/ssz"; +import {IChainConfig} from "../types.js"; +import {chainConfig as mainnet} from "../presets/mainnet.js"; + +/* eslint-disable max-len */ + +// Ropsten beacon chain config: +// https://github.com/eth-clients/merge-testnets/blob/main/sepolia-beacon-chain/config.yaml + +export const sepoliaChainConfig: IChainConfig = { + ...mainnet, + + // Genesis + // --------------------------------------------------------------- + MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 1300, + // # Sunday, June 19, 2022 2:00:00 PM +UTC + MIN_GENESIS_TIME: 1655647200, + GENESIS_FORK_VERSION: b("0x90000069"), + + // Forking + // --------------------------------------------------------------- + // # Altair + ALTAIR_FORK_VERSION: b("0x90000070"), + ALTAIR_FORK_EPOCH: 50, + // # Merge + BELLATRIX_FORK_VERSION: b("0x90000071"), + BELLATRIX_FORK_EPOCH: 100, + TERMINAL_TOTAL_DIFFICULTY: BigInt("100000000000000000000000"), + + // Deposit contract + // --------------------------------------------------------------- + DEPOSIT_CHAIN_ID: 11155111, + DEPOSIT_NETWORK_ID: 11155111, + DEPOSIT_CONTRACT_ADDRESS: b("0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D"), +}; diff --git a/packages/config/src/networks.ts b/packages/config/src/networks.ts index 740f28bfd7f..537fa5583e7 100644 --- a/packages/config/src/networks.ts +++ b/packages/config/src/networks.ts @@ -4,14 +4,23 @@ import {gnosisChainConfig} from "./chainConfig/networks/gnosis.js"; import {praterChainConfig} from "./chainConfig/networks/prater.js"; import {kilnChainConfig} from "./chainConfig/networks/kiln.js"; import {ropstenChainConfig} from "./chainConfig/networks/ropsten.js"; +import {sepoliaChainConfig} from "./chainConfig/networks/sepolia.js"; -export {mainnetChainConfig, gnosisChainConfig, praterChainConfig, kilnChainConfig, ropstenChainConfig}; +export { + mainnetChainConfig, + gnosisChainConfig, + praterChainConfig, + kilnChainConfig, + ropstenChainConfig, + sepoliaChainConfig, +}; -export type NetworkName = "mainnet" | "gnosis" | "prater" | "kiln" | "ropsten"; +export type NetworkName = "mainnet" | "gnosis" | "prater" | "kiln" | "ropsten" | "sepolia"; export const networksChainConfig: Record = { mainnet: mainnetChainConfig, gnosis: gnosisChainConfig, prater: praterChainConfig, kiln: kilnChainConfig, ropsten: ropstenChainConfig, + sepolia: sepoliaChainConfig, };