mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-30 15:06:31 +00:00
7a83acf46d
* improve validator logging significantly * warn validator not yet assigned to epoch * build added * report validator logs * validator performance logging * all logging improvements * validator attest better logs * improved attester logging * average balances * dont hash useless hashes * Update validator/client/validator_propose.go Co-Authored-By: rauljordan <raul@prysmaticlabs.com> * address some comments * standardize with block root hash32, renamings * gazelle * builds * improve average eth balance * eth net gains/losses * fix tests * spacing * goimports * avg balance * update pbs * addressed preston comments * imports * gazelle
83 lines
1.9 KiB
Go
83 lines
1.9 KiB
Go
// Package beacon-chain defines all the utlities needed for a beacon chain node.
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/node"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/utils"
|
|
"github.com/prysmaticlabs/prysm/shared/cmd"
|
|
"github.com/prysmaticlabs/prysm/shared/debug"
|
|
"github.com/prysmaticlabs/prysm/shared/version"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli"
|
|
prefixed "github.com/x-cray/logrus-prefixed-formatter"
|
|
)
|
|
|
|
func startNode(ctx *cli.Context) error {
|
|
verbosity := ctx.GlobalString(cmd.VerbosityFlag.Name)
|
|
level, err := logrus.ParseLevel(verbosity)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
logrus.SetLevel(level)
|
|
|
|
beacon, err := node.NewBeaconNode(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
beacon.Start()
|
|
return nil
|
|
}
|
|
|
|
func main() {
|
|
customFormatter := new(prefixed.TextFormatter)
|
|
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
|
|
customFormatter.FullTimestamp = true
|
|
logrus.SetFormatter(customFormatter)
|
|
log := logrus.WithField("prefix", "main")
|
|
app := cli.NewApp()
|
|
app.Name = "beacon-chain"
|
|
app.Usage = "this is a beacon chain implementation for Ethereum 2.0"
|
|
app.Action = startNode
|
|
app.Version = version.GetVersion()
|
|
|
|
app.Flags = []cli.Flag{
|
|
utils.NoCustomConfigFlag,
|
|
utils.DepositContractFlag,
|
|
utils.Web3ProviderFlag,
|
|
utils.RPCPort,
|
|
utils.CertFlag,
|
|
utils.KeyFlag,
|
|
utils.EnableDBCleanup,
|
|
cmd.BootstrapNode,
|
|
cmd.RelayNode,
|
|
cmd.P2PPort,
|
|
cmd.DataDirFlag,
|
|
cmd.VerbosityFlag,
|
|
cmd.EnableTracingFlag,
|
|
cmd.TracingEndpointFlag,
|
|
cmd.TraceSampleFractionFlag,
|
|
cmd.MonitoringPortFlag,
|
|
cmd.DisableMonitoringFlag,
|
|
cmd.ClearDBFlag,
|
|
debug.PProfFlag,
|
|
debug.PProfAddrFlag,
|
|
debug.PProfPortFlag,
|
|
debug.MemProfileRateFlag,
|
|
debug.CPUProfileFlag,
|
|
debug.TraceFlag,
|
|
}
|
|
|
|
app.Before = func(ctx *cli.Context) error {
|
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
return debug.Setup(ctx)
|
|
}
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
log.Error(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
}
|