mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
Validator client - Improve readability - NO FUNCTIONAL CHANGE (#13468)
* Improve `NewServiceRegistry` documentation. * Improve `README.md`. * Improve readability of `registerValidatorService`. * Move `log` in `main.go`. Since `log` is only used in `main.go`. * Clean Tos. * `DefaultDataDir`: Use `switch` instead of `if/elif`. * `ReadPassword`: Remove unused receiver. * `validator/main.go`: Clean. * `WarnIfPlatformNotSupported`: Add Mac OSX ARM64. * `runner.go`: Use idiomatic `err` handling. * `waitForChainStart`: Avoid `chainStartResponse`mutation. * `WaitForChainStart`: Reduce cognitive complexity. * Logs: `powchain` ==> `execution`.
This commit is contained in:
@@ -103,7 +103,12 @@ func WarnIfPlatformNotSupported(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
if !supported {
|
||||
log.Warn("This platform is not supported. The following platforms are supported: Linux/AMD64," +
|
||||
" Linux/ARM64, Mac OS X/AMD64 (10.14+ only), and Windows/AMD64")
|
||||
log.Warn(`This platform is not supported. The following platforms are supported:
|
||||
- Linux/AMD64
|
||||
- Linux/ARM64
|
||||
- Mac OS X/AMD64 (from 10.14+)
|
||||
- Mac OS X/ARM64 (from 12.5+)
|
||||
- Windows/AMD64`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ type ServiceRegistry struct {
|
||||
serviceTypes []reflect.Type // keep an ordered slice of registered service types.
|
||||
}
|
||||
|
||||
// NewServiceRegistry starts a registry instance for convenience
|
||||
// NewServiceRegistry starts a registry instance for convenience.
|
||||
func NewServiceRegistry() *ServiceRegistry {
|
||||
return &ServiceRegistry{
|
||||
services: make(map[reflect.Type]Service),
|
||||
|
||||
@@ -35,11 +35,13 @@ var (
|
||||
log = logrus.WithField("prefix", "tos")
|
||||
)
|
||||
|
||||
// VerifyTosAcceptedOrPrompt check if Tos was accepted before or asks to accept.
|
||||
// VerifyTosAcceptedOrPrompt checks if Tos was accepted before or asks to accept.
|
||||
func VerifyTosAcceptedOrPrompt(ctx *cli.Context) error {
|
||||
if file.Exists(filepath.Join(ctx.String(cmd.DataDirFlag.Name), acceptTosFilename)) {
|
||||
tosFilePath := filepath.Join(ctx.String(cmd.DataDirFlag.Name), acceptTosFilename)
|
||||
if file.Exists(tosFilePath) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if ctx.Bool(cmd.AcceptTosFlag.Name) {
|
||||
saveTosAccepted(ctx)
|
||||
return nil
|
||||
@@ -49,6 +51,7 @@ func VerifyTosAcceptedOrPrompt(ctx *cli.Context) error {
|
||||
if err != nil {
|
||||
return errors.New(acceptTosPromptErrText)
|
||||
}
|
||||
|
||||
if !strings.EqualFold(input, "accept") {
|
||||
return errors.New("you have to accept Terms and Conditions in order to continue")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user