Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add chiado config #5108

Merged
merged 4 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion default.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# To specify a specific network (defaults to mainnet) set this value.
# Allowed values are: mainnet, gnosis, goerli, ropsten and sepolia. Source for currently supported networks: https://github.com/ChainSafe/lodestar/blob/unstable/packages/cli/src/networks/index.ts#L19
# Allowed values are: mainnet, gnosis, goerli, ropsten, sepolia and chiado. Source for currently supported networks: https://github.com/ChainSafe/lodestar/blob/unstable/packages/cli/src/networks/index.ts#L19
LODESTAR_NETWORK=mainnet

# Set a custom admin password to prevent having to signup.
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/applyPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// However this prevents dynamic configuration changes which is exactly what the CLI required before.
// - The dev command can't apply the minimal preset dynamically
// - `--network gnosis` can't apply a different preset dynamically
// - `--network chiado` can't apply a different preset dynamically
//
// Running this file allows us to keep a static export strategy while NOT requiring users to
// set LODESTAR_PRESET manually every time.
Expand All @@ -29,7 +30,7 @@ else if (process.env.LODESTAR_PRESET) {
else if (network) {
if (network === "dev") {
process.env.LODESTAR_PRESET = "minimal";
} else if (network === "gnosis") {
} else if (network === "gnosis" || network === "chiado") {
process.env.LODESTAR_PRESET = "gnosis";
}
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/networks/chiado.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export {chiadoChainConfig as chainConfig} from "@lodestar/config/networks";

// eth1.providerUrls suggestion: https://rpc.chiado.gnosis.gateway.fm
export const depositContractDeployBlock = 155435;
export const genesisFileUrl = "https://raw.githubusercontent.com/gnosischain/configs/main/chiado/genesis.ssz";
export const bootnodesFileUrl = "https://raw.githubusercontent.com/gnosischain/configs/main/chiado/bootnodes.yaml";

export const bootEnrs = [
"enr:-L64QOijsdi9aVIawMb5h5PWueaPM9Ai6P17GNPFlHzz7MGJQ8tFMdYrEx8WQitNKLG924g2Q9cCdzg54M0UtKa3QIKCMxaHYXR0bmV0c4j__________4RldGgykDE2cEMCAABv__________-CaWSCdjSCaXCEi5AaWYlzZWNwMjU2azGhA8CjTkD4m1s8FbKCN18LgqlYcE65jrT148vFtwd9U62SiHN5bmNuZXRzD4N0Y3CCIyiDdWRwgiMo",
"enr:-L64QKYKGQj5ybkfBxyFU5IEVzP7oJkGHJlie4W8BCGAYEi4P0mmMksaasiYF789mVW_AxYVNVFUjg9CyzmdvpyWQ1KCMlmHYXR0bmV0c4j__________4RldGgykDE2cEMCAABv__________-CaWSCdjSCaXCEi5CtNolzZWNwMjU2azGhAuA7BAwIijy1z81AO9nz_MOukA1ER68rGA67PYQ5pF1qiHN5bmNuZXRzD4N0Y3CCIyiDdWRwgiMo",
"enr:-Ly4QJJUnV9BxP_rw2Bv7E9iyw4sYS2b4OQZIf4Mu_cA6FljJvOeSTQiCUpbZhZjR4R0VseBhdTzrLrlHrAuu_OeZqgJh2F0dG5ldHOI__________-EZXRoMpAxNnBDAgAAb___________gmlkgnY0gmlwhIuQGnOJc2VjcDI1NmsxoQPT_u3IjDtB2r-nveH5DhUmlM8F2IgLyxhmwmqW4L5k3ohzeW5jbmV0cw-DdGNwgiMog3VkcIIjKA",
"enr:-MK4QCkOyqOTPX1_-F-5XVFjPclDUc0fj3EeR8FJ5-hZjv6ARuGlFspM0DtioHn1r6YPUXkOg2g3x6EbeeKdsrvVBYmGAYQKrixeh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAxNnBDAgAAb___________gmlkgnY0gmlwhIuQGlWJc2VjcDI1NmsxoQKdW3-DgLExBkpLGMRtuM88wW_gZkC7Yeg0stYDTrlynYhzeW5jbmV0cwCDdGNwgiMog3VkcIIjKA==",
"enr:-Ly4QLYLNqrjvSxD3lpAPBUNlxa6cIbe79JqLZLFcZZjWoCjZcw-85agLUErHiygG2weRSCLnd5V460qTbLbwJQsfZkoh2F0dG5ldHOI__________-EZXRoMpAxNnBDAgAAb___________gmlkgnY0gmlwhKq7mu-Jc2VjcDI1NmsxoQP900YAYa9kdvzlSKGjVo-F3XVzATjOYp3BsjLjSophO4hzeW5jbmV0cw-DdGNwgiMog3VkcIIjKA",
"enr:-Ly4QCGeYvTCNOGKi0mKRUd45rLj96b4pH98qG7B9TCUGXGpHZALtaL2-XfjASQyhbCqENccI4PGXVqYTIehNT9KJMQgh2F0dG5ldHOI__________-EZXRoMpAxNnBDAgAAb___________gmlkgnY0gmlwhIuQrVSJc2VjcDI1NmsxoQP9iDchx2PGl3JyJ29B9fhLCvVMN6n23pPAIIeFV-sHOIhzeW5jbmV0cw-DdGNwgiMog3VkcIIjKA",
"enr:-Ly4QAtr21x5Ps7HYhdZkIBRBgcBkvlIfEel1YNjtFWf4cV3au2LgBGICz9PtEs9-p2HUl_eME8m1WImxTxSB3AkCMwBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAxNnBDAgAAb___________gmlkgnY0gmlwhANHhOeJc2VjcDI1NmsxoQNLp1QPV8-pyMCohOtj6xGtSBM_GtVTqzlbvNsCF4ezkYhzeW5jbmV0cwCDdGNwgiMog3VkcIIjKA",
"enr:-Ly4QLgn8Bx6faigkKUGZQvd1HDToV2FAxZIiENK-lczruzQb90qJK-4E65ADly0s4__dQOW7IkLMW7ZAyJy2vtiLy8Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAxNnBDAgAAb___________gmlkgnY0gmlwhANFIw2Jc2VjcDI1NmsxoQMa-fWEy9UJHfOl_lix3wdY5qust78sHAqZnWwEiyqKgYhzeW5jbmV0cwCDdGNwgiMog3VkcIIjKA",
];
6 changes: 5 additions & 1 deletion packages/cli/src/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ import * as gnosis from "./gnosis.js";
import * as goerli from "./goerli.js";
import * as ropsten from "./ropsten.js";
import * as sepolia from "./sepolia.js";
import * as chiado from "./chiado.js";

export type NetworkName = "mainnet" | "dev" | "gnosis" | "goerli" | "ropsten" | "sepolia";
export type NetworkName = "mainnet" | "dev" | "gnosis" | "goerli" | "ropsten" | "sepolia" | "chiado";
export const networkNames: NetworkName[] = [
"mainnet",
"gnosis",
"goerli",
"ropsten",
"sepolia",
"chiado",

// Leave always as last network. The order matters for the --help printout
"dev",
Expand Down Expand Up @@ -61,6 +63,8 @@ export function getNetworkData(
return ropsten;
case "sepolia":
return sepolia;
case "chiado":
return chiado;
default:
throw Error(`Network not supported: ${network}`);
}
Expand Down
41 changes: 41 additions & 0 deletions packages/config/src/chainConfig/networks/chiado.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {fromHexString as b} from "@chainsafe/ssz";
import {PresetName} from "@lodestar/params";
import {IChainConfig} from "../types.js";
import {chainConfig as mainnet} from "../presets/mainnet.js";

export const chiadoChainConfig: IChainConfig = {
...mainnet,

// NOTE: Only add diff values
PRESET_BASE: PresetName.gnosis,
CONFIG_NAME: "chiado",

// Transition
TERMINAL_TOTAL_DIFFICULTY: BigInt("231707791542740786049188744689299064356246512"),
TERMINAL_BLOCK_HASH: b("0x0000000000000000000000000000000000000000000000000000000000000000"),
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: Infinity,

SECONDS_PER_SLOT: 5,
SECONDS_PER_ETH1_BLOCK: 6,
ETH1_FOLLOW_DISTANCE: 1024,
CHURN_LIMIT_QUOTIENT: 4096,

// Ethereum Goerli testnet
DEPOSIT_CHAIN_ID: 10200,
DEPOSIT_NETWORK_ID: 10200,
DEPOSIT_CONTRACT_ADDRESS: b("0xb97036A26259B7147018913bD58a774cf91acf25"),

// Dec 8, 2021, 13:00 UTC
MIN_GENESIS_TIME: 1665396000,
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 6000,
GENESIS_FORK_VERSION: b("0x0000006f"),
GENESIS_DELAY: 300,

// Forking
ALTAIR_FORK_VERSION: b("0x0100006f"),
ALTAIR_FORK_EPOCH: 90,
// Bellatrix
BELLATRIX_FORK_VERSION: b("0x0200006f"),
BELLATRIX_FORK_EPOCH: 180,
};
17 changes: 15 additions & 2 deletions packages/config/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ import {gnosisChainConfig} from "./chainConfig/networks/gnosis.js";
import {goerliChainConfig} from "./chainConfig/networks/goerli.js";
import {ropstenChainConfig} from "./chainConfig/networks/ropsten.js";
import {sepoliaChainConfig} from "./chainConfig/networks/sepolia.js";
import {chiadoChainConfig} from "./chainConfig/networks/chiado.js";

export {mainnetChainConfig, gnosisChainConfig, goerliChainConfig, ropstenChainConfig, sepoliaChainConfig};
export {
mainnetChainConfig,
gnosisChainConfig,
goerliChainConfig,
ropstenChainConfig,
sepoliaChainConfig,
chiadoChainConfig,
};

export type NetworkName = "mainnet" | "gnosis" | "goerli" | "ropsten" | "sepolia";
export type NetworkName = "mainnet" | "gnosis" | "goerli" | "ropsten" | "sepolia" | "chiado";
export const networksChainConfig: Record<NetworkName, IChainConfig> = {
mainnet: mainnetChainConfig,
gnosis: gnosisChainConfig,
goerli: goerliChainConfig,
ropsten: ropstenChainConfig,
sepolia: sepoliaChainConfig,
chiado: chiadoChainConfig,
};

export type GenesisData = {
Expand Down Expand Up @@ -42,4 +51,8 @@ export const genesisData: Record<NetworkName, GenesisData> = {
genesisTime: 1655733600,
genesisValidatorsRoot: "0xd8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078",
},
chiado: {
genesisTime: 1665396300,
genesisValidatorsRoot: "0x9d642dac73058fbf39c0ae41ab1e34e4d889043cb199851ded7095bc99eb4c1e",
},
};