-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement validator data process structure (#344)
* reorg code * fix frontend * remove unused logos * fix lint issue
- Loading branch information
1 parent
377f861
commit 6c8abff
Showing
38 changed files
with
406 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,61 @@ | ||
import { Network } from "@stakingbrain/common"; | ||
import { ConsensusClient, ExecutionClient, Network } from "@stakingbrain/common"; | ||
|
||
export function loadEnvs(): { | ||
network: Network; | ||
executionClientSelected: string; | ||
consensusClientSelected: string; | ||
executionClient: ExecutionClient; | ||
consensusClient: ConsensusClient; | ||
isMevBoostSet: boolean; | ||
shareDataWithDappnode: boolean; | ||
} { | ||
const network = process.env.NETWORK; | ||
if (!network) throw Error("NETWORK env is required"); | ||
if (!Object.values(Network).includes(network as Network)) | ||
throw Error(`NETWORK env must be one of ${Object.values(Network).join(", ")}`); | ||
|
||
const executionClientSelected = process.env[`_DAPPNODE_GLOBAL_EXECUTION_CLIENT_${network.toUpperCase()}`]; | ||
if (!executionClientSelected) | ||
throw Error(`_DAPPNODE_GLOBAL_EXECUTION_CLIENT_${network.toUpperCase()} env is required`); | ||
const consensusClientSelected = process.env[`_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_${network.toUpperCase()}`]; | ||
if (!consensusClientSelected) | ||
throw Error(`_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_${network.toUpperCase()} env is required`); | ||
const network = getNetwork(); | ||
|
||
const executionClient = getExecutionClient(network); | ||
const consensusClient = getConsensusClient(network); | ||
|
||
const isMevBoostSet = process.env[`_DAPPNODE_GLOBAL_MEVBOOST_${network.toUpperCase()}`] === "true"; | ||
const shareDataWithDappnode = process.env.SHARE_DATA_WITH_DAPPNODE === "true"; | ||
|
||
return { | ||
network: network as Network, | ||
executionClientSelected, | ||
consensusClientSelected, | ||
executionClient, | ||
consensusClient, | ||
isMevBoostSet, | ||
shareDataWithDappnode | ||
}; | ||
} | ||
|
||
function getNetwork(): Network { | ||
const network = process.env.NETWORK; | ||
if (!network) throw Error("NETWORK env is required"); | ||
|
||
if (network === Network.Mainnet) return Network.Mainnet; | ||
if (network === Network.Prater) return Network.Prater; | ||
if (network === Network.Gnosis) return Network.Gnosis; | ||
if (network === Network.Lukso) return Network.Lukso; | ||
if (network === Network.Holesky) return Network.Holesky; | ||
|
||
throw Error(`NETWORK env must be one of ${Object.values(Network).join(", ")}`); | ||
} | ||
|
||
function getExecutionClient(network: Network): ExecutionClient { | ||
const executionClientStr = process.env[`_DAPPNODE_GLOBAL_EXECUTION_CLIENT_${network.toUpperCase()}`]; | ||
if (!executionClientStr) throw Error(`_DAPPNODE_GLOBAL_EXECUTION_CLIENT_${network.toUpperCase()} env is required`); | ||
|
||
if (executionClientStr.includes(ExecutionClient.Geth)) return ExecutionClient.Geth; | ||
if (executionClientStr.includes(ExecutionClient.Besu)) return ExecutionClient.Besu; | ||
if (executionClientStr.includes(ExecutionClient.Nethermind)) return ExecutionClient.Nethermind; | ||
if (executionClientStr.includes(ExecutionClient.Erigon)) return ExecutionClient.Erigon; | ||
return ExecutionClient.Unknown; | ||
} | ||
|
||
function getConsensusClient(network: Network): ConsensusClient { | ||
const consensusClientStr = process.env[`_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_${network.toUpperCase()}`]; | ||
if (!consensusClientStr) throw Error(`_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_${network.toUpperCase()} env is required`); | ||
|
||
if (consensusClientStr.includes(ConsensusClient.Teku)) return ConsensusClient.Teku; | ||
if (consensusClientStr.includes(ConsensusClient.Prysm)) return ConsensusClient.Prysm; | ||
if (consensusClientStr.includes(ConsensusClient.Lighthouse)) return ConsensusClient.Lighthouse; | ||
if (consensusClientStr.includes(ConsensusClient.Nimbus)) return ConsensusClient.Nimbus; | ||
if (consensusClientStr.includes(ConsensusClient.Lodestar)) return ConsensusClient.Lodestar; | ||
return ConsensusClient.Unknown; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { Network } from "@stakingbrain/common"; | ||
import { ConsensusClient, ExecutionClient, Network } from "@stakingbrain/common"; | ||
import { BrainConfig } from "../types.js"; | ||
import { tlsCert } from "./tlsCert.js"; | ||
import { validatorToken } from "./validatorToken.js"; | ||
|
||
export const gnosisBrainConfig = ( | ||
executionClientSelected: string, | ||
consensusClientSelected: string, | ||
executionClient: ExecutionClient, | ||
consensusClient: ConsensusClient, | ||
isMevBoostSet: boolean, | ||
shareDataWithDappnode: boolean | ||
): BrainConfig => { | ||
return { | ||
network: Network.Gnosis, | ||
executionClientSelected, | ||
consensusClientSelected, | ||
executionClient, | ||
consensusClient, | ||
isMevBoostSet, | ||
executionClientUrl: "http://execution.gnosis.dncore.dappnode:8545", | ||
validatorUrl: "http://validator.gnosis.dncore.dappnode:3500", | ||
beaconchainUrl: "http:/beacon-chain.gnosis.dncore.dappnode:3500", | ||
blockExplorerUrl: "https://gnosischa.in", | ||
signerUrl: "http://web3signer.web3signer-gnosis.dappnode:9000", | ||
token: validatorToken(consensusClientSelected), | ||
token: validatorToken(consensusClient), | ||
host: "brain.web3signer-gnosis.dappnode", | ||
shareDataWithDappnode, | ||
validatorsMonitorUrl: "https://validators-proofs.dappnode.io", | ||
|
@@ -28,6 +28,6 @@ export const gnosisBrainConfig = ( | |
postgresUrl: "postgres://postgres:[email protected]:5432/web3signer-gnosis", | ||
secondsPerSlot: 5, | ||
slotsPerEpoch: 16, | ||
tlsCert: tlsCert(consensusClientSelected) | ||
tlsCert: tlsCert(consensusClient) | ||
}; | ||
}; |
Oops, something went wrong.