From 0b1878100ea160d4ff81ecfaa3beda79af32a000 Mon Sep 17 00:00:00 2001 From: amir-blox <83904651+amir-blox@users.noreply.github.com> Date: Sun, 8 Aug 2021 17:34:57 +0300 Subject: [PATCH] Merge fixes for v0.0.12 (#237) * backwards compatibility (#229) * Update OPERATOR_GETTING_STARTED.md * add version to app name in logs (#236) * Handle panic errors (#234) * update code coverage badge --- beacon/goclient/attest.go | 2 +- beacon/goclient/singing.go | 15 ++++++++++++++- cli/operator/node.go | 5 +++-- docs/OPERATOR_GETTING_STARTED.md | 8 ++++++-- docs/resources/cov-badge.svg | 2 +- ibft/ibft_running_instance.go | 4 ++++ 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/beacon/goclient/attest.go b/beacon/goclient/attest.go index 7b84e8a27e..a27a6da30b 100644 --- a/beacon/goclient/attest.go +++ b/beacon/goclient/attest.go @@ -60,7 +60,7 @@ func (gc *goClient) signAtt(data *spec.AttestationData, shareKey *bls.SecretKey) root, err := gc.getSigningRoot(data) if err != nil { return nil, nil, errors.Wrap(err, "failed to get signing root") - } else if len(root[:]) == 0 { + } else if root.IsEmpty() { return nil, nil, errors.New("got an empty signing root") } diff --git a/beacon/goclient/singing.go b/beacon/goclient/singing.go index fa580574d2..b9536f5249 100644 --- a/beacon/goclient/singing.go +++ b/beacon/goclient/singing.go @@ -9,8 +9,21 @@ import ( "github.com/prysmaticlabs/go-ssz" ) +// SigningRoot is a wrapping type for byte array +type SigningRoot [32]byte + +// IsEmpty returns checks if the array was set with some value +func (sr *SigningRoot) IsEmpty() bool { + for i := range sr { + if sr[i] != 0 { + return false + } + } + return true +} + // getSigningRoot returns signing root -func (gc *goClient) getSigningRoot(data *spec.AttestationData) ([32]byte, error) { +func (gc *goClient) getSigningRoot(data *spec.AttestationData) (SigningRoot, error) { epoch := gc.network.EstimatedEpochAtSlot(uint64(data.Slot)) domainType, err := gc.getDomainType(beacon.RoleTypeAttester) if err != nil { diff --git a/cli/operator/node.go b/cli/operator/node.go index 770e60f43c..5fe2062e27 100644 --- a/cli/operator/node.go +++ b/cli/operator/node.go @@ -48,7 +48,8 @@ var StartNodeCmd = &cobra.Command{ Use: "start-node", Short: "Starts an instance of SSV node", Run: func(cmd *cobra.Command, args []string) { - log.Printf("starting %s:%s", cmd.Parent().Short, cmd.Parent().Version) + appName := fmt.Sprintf("%s:%s", cmd.Parent().Short, cmd.Parent().Version) + log.Printf("starting %s", appName) if err := cleanenv.ReadConfig(globalArgs.ConfigPath, &cfg); err != nil { log.Fatal(err) @@ -59,7 +60,7 @@ var StartNodeCmd = &cobra.Command{ } } loggerLevel, errLogLevel := logex.GetLoggerLevelValue(cfg.LogLevel) - Logger := logex.Build(cmd.Parent().Short, loggerLevel, &logex.EncodingConfig{ + Logger := logex.Build(appName, loggerLevel, &logex.EncodingConfig{ Format: cfg.GlobalConfig.LogFormat, LevelEncoder: logex.LevelEncoder([]byte(cfg.LogLevelFormat)), }) diff --git a/docs/OPERATOR_GETTING_STARTED.md b/docs/OPERATOR_GETTING_STARTED.md index 36c7947057..14698a3772 100644 --- a/docs/OPERATOR_GETTING_STARTED.md +++ b/docs/OPERATOR_GETTING_STARTED.md @@ -159,9 +159,13 @@ $ docker run -d --restart unless-stopped --name=ssv_node -e CONFIG_PATH=./config ### 7. Update SSV Node Image -Kill running container and pull the latest image or a specific version (`bloxstaking/ssv-node:`) +The current version is available through logs or a cmd: +```shell +$ docker run --rm -it 'bloxstaking/ssv-node:latest' /go/bin/ssvnode version +``` + +In order to updtae, kill running container and pull the latest image or a specific version (`bloxstaking/ssv-node:`) ```shell -$ sudo su $ docker rm -f ssv_node && docker pull bloxstaking/ssv-node:latest ``` diff --git a/docs/resources/cov-badge.svg b/docs/resources/cov-badge.svg index cc63e6cc6d..fe6a51b7fb 100644 --- a/docs/resources/cov-badge.svg +++ b/docs/resources/cov-badge.svg @@ -1 +1 @@ -coverage: 55.4%coverage55.4% \ No newline at end of file +coverage: 55.3%coverage55.3% \ No newline at end of file diff --git a/ibft/ibft_running_instance.go b/ibft/ibft_running_instance.go index 2f7a255958..b8ade439a4 100644 --- a/ibft/ibft_running_instance.go +++ b/ibft/ibft_running_instance.go @@ -24,6 +24,10 @@ func (i *ibftImpl) startInstanceWithOptions(instanceOpts InstanceOptions, value instanceLoop: for { stage := <-stageChan + if i.currentInstance == nil { + i.logger.Debug("stage channel was invoked but instance is already empty", zap.Any("stage", stage)) + break instanceLoop + } exit, e := i.instanceStageChange(stage) if e != nil { err = e