Skip to content

Commit

Permalink
Merge fixes for v0.0.12 (#237)
Browse files Browse the repository at this point in the history
* backwards compatibility (#229)

* Update OPERATOR_GETTING_STARTED.md

* add version to app name in logs (#236)

* Handle panic errors (#234)

* update code coverage badge
  • Loading branch information
amirylm authored Aug 8, 2021
1 parent 93f2b85 commit 0b18781
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion beacon/goclient/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
15 changes: 14 additions & 1 deletion beacon/goclient/singing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions cli/operator/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)),
})
Expand Down
8 changes: 6 additions & 2 deletions docs/OPERATOR_GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:<version>`)
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:<version>`)
```shell
$ sudo su
$ docker rm -f ssv_node && docker pull bloxstaking/ssv-node:latest
```

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/cov-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions ibft/ibft_running_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0b18781

Please sign in to comment.