Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var StartNodeCmd = &cobra.Command{ Use: "start-node", Short: "Starts an instance of SSV node", Run: func(cmd *cobra.Command, args []string) { logger, err := setupGlobal(cmd) if err != nil { log.Fatal("could not create logger", err) } eth2Network, forkVersion := setupSSVNetwork(logger) cfg.DBOptions.Ctx = cmd.Context() db, err := setupDb(logger, eth2Network) if err != nil { logger.Fatal("could not setup db", zap.Error(err)) } nodeStorage, operatorData := setupOperatorStorage(logger, db) keyManager, err := ekm.NewETHKeyManagerSigner(db, eth2Network, types.GetDefaultDomain(), logger) if err != nil { logger.Fatal("could not create new eth-key-manager signer", zap.Error(err)) } cfg.P2pNetworkConfig.Ctx = cmd.Context() p2pNetwork := setupP2P(forkVersion, operatorData, db, logger) cfg.ETH2Options.Context = cmd.Context() el, cl := setupNodes(logger) ctx := cmd.Context() cfg.SSVOptions.ForkVersion = forkVersion cfg.SSVOptions.Context = ctx cfg.SSVOptions.DB = db cfg.SSVOptions.Beacon = el cfg.SSVOptions.ETHNetwork = eth2Network cfg.SSVOptions.Network = p2pNetwork cfg.SSVOptions.ValidatorOptions.ForkVersion = forkVersion cfg.SSVOptions.ValidatorOptions.ETHNetwork = eth2Network cfg.SSVOptions.ValidatorOptions.Context = ctx cfg.SSVOptions.ValidatorOptions.DB = db cfg.SSVOptions.ValidatorOptions.Network = p2pNetwork cfg.SSVOptions.ValidatorOptions.Beacon = el cfg.SSVOptions.ValidatorOptions.KeyManager = keyManager cfg.SSVOptions.ValidatorOptions.CleanRegistryData = cfg.ETH1Options.CleanRegistryData cfg.SSVOptions.ValidatorOptions.ShareEncryptionKeyProvider = nodeStorage.GetPrivateKey cfg.SSVOptions.ValidatorOptions.OperatorData = operatorData cfg.SSVOptions.ValidatorOptions.RegistryStorage = nodeStorage cfg.SSVOptions.Eth1Client = cl if cfg.WsAPIPort != 0 { ws := api.NewWsServer(cmd.Context(), nil, http.NewServeMux(), cfg.WithPing) cfg.SSVOptions.WS = ws cfg.SSVOptions.WsAPIPort = cfg.WsAPIPort cfg.SSVOptions.ValidatorOptions.NewDecidedHandler = decided.NewStreamPublisher(logger, ws) } cfg.SSVOptions.ValidatorOptions.DutyRoles = []spectypes.BeaconRole{spectypes.BNRoleAttester} validatorCtrl := validator.NewController(logger, cfg.SSVOptions.ValidatorOptions) cfg.SSVOptions.ValidatorController = validatorCtrl operatorNode = operator.New(logger, cfg.SSVOptions) if cfg.MetricsAPIPort > 0 { go startMetricsHandler(cmd.Context(), logger, db, cfg.MetricsAPIPort, cfg.EnableProfile) } metrics.WaitUntilHealthy(logger, cfg.SSVOptions.Eth1Client, "execution client") metrics.WaitUntilHealthy(logger, cfg.SSVOptions.Beacon, "consensus client") metrics.ReportSSVNodeHealthiness(true) if len(cfg.LocalEventsPath) > 0 { if err := validator.LoadLocalEvents( logger, validatorCtrl.Eth1EventHandler(logger, false), cfg.LocalEventsPath, ); err != nil { logger.Fatal("failed to load local events", zap.Error(err)) } } else { if err := operatorNode.StartEth1(logger, eth1.StringToSyncOffset(cfg.ETH1Options.ETH1SyncOffset)); err != nil { logger.Fatal("failed to start eth1", zap.Error(err)) } } cfg.P2pNetworkConfig.GetValidatorStats = func() (uint64, uint64, uint64, error) { return validatorCtrl.GetValidatorStats(logger) } if err := p2pNetwork.Setup(logger); err != nil { logger.Fatal("failed to setup network", zap.Error(err)) } if err := p2pNetwork.Start(logger); err != nil { logger.Fatal("failed to start network", zap.Error(err)) } if err := operatorNode.Start(logger); err != nil { logger.Fatal("failed to start SSV node", zap.Error(err)) } }, }
StartNodeCmd is the command to start SSV node
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.