Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heartbeat sender factory #4455

Merged
merged 5 commits into from
Sep 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixes after review
  • Loading branch information
sstanculeanu committed Sep 13, 2022

Unverified

This user has not yet uploaded their public signing key.
commit c52b27f91d578777627bcc416765aadc8ccab93c
9 changes: 5 additions & 4 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
@@ -62,7 +62,8 @@ func main() {
app.Name = "Elrond Node CLI App"
machineID := core.GetAnonymizedMachineID(app.Name)

app.Version = fmt.Sprintf("%s/%s/%s-%s/%s", appVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH, machineID)
baseVersion := fmt.Sprintf("%s/%s/%s-%s", appVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH)
app.Version = fmt.Sprintf("%s/%s", baseVersion, machineID)
app.Usage = "This is the entry point for starting a new Elrond node - the app will start after the genesis timestamp"
app.Flags = getFlags()
app.Authors = []cli.Author{
@@ -73,7 +74,7 @@ func main() {
}

app.Action = func(c *cli.Context) error {
return startNodeRunner(c, log, app.Version)
return startNodeRunner(c, log, baseVersion, app.Version)
}

err := app.Run(os.Args)
@@ -83,7 +84,7 @@ func main() {
}
}

func startNodeRunner(c *cli.Context, log logger.Logger, version string) error {
func startNodeRunner(c *cli.Context, log logger.Logger, baseVersion string, version string) error {
flagsConfig := getFlagsConfig(c, log)

fileLogging, errLogger := attachFileLogger(log, flagsConfig)
@@ -119,7 +120,7 @@ func startNodeRunner(c *cli.Context, log logger.Logger, version string) error {
log.Debug("initialized memory ballast object", "size", core.ConvertBytes(uint64(len(memoryBallastObject))))
}

cfgs.FlagsConfig.BaseVersion = fmt.Sprintf("%s-base", version)
cfgs.FlagsConfig.BaseVersion = baseVersion
cfgs.FlagsConfig.Version = version

nodeRunner, errRunner := node.NewNodeRunner(cfgs)
2 changes: 1 addition & 1 deletion heartbeat/sender/heartbeatSenderFactory.go
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ func isMultikeyMode(privKey crypto.PrivateKey, keysHolder heartbeat.KeysHolder,

_, _, err = nodesCoordinator.GetValidatorWithPublicKey(pkBytes)
if err == nil && isMultikey {
return false, heartbeat.ErrInvalidConfiguration
return false, fmt.Errorf("%w, len(keysMap) = %d, isValidator = %v", heartbeat.ErrInvalidConfiguration, len(keysMap), err == nil)
}

return isMultikey, nil
2 changes: 2 additions & 0 deletions heartbeat/sender/heartbeatSenderFactory_test.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package sender
import (
"errors"
"fmt"
"strings"
"testing"

"github.com/ElrondNetwork/elrond-go-core/core"
@@ -77,6 +78,7 @@ func TestHeartbeatSenderFactory_createHeartbeatSender(t *testing.T) {
}
hbSender, err := createHeartbeatSender(args)
assert.True(t, errors.Is(err, heartbeat.ErrInvalidConfiguration))
assert.True(t, strings.Contains(err.Error(), "isValidator"))
assert.True(t, check.IfNil(hbSender))
})
t.Run("validator should create regular sender", func(t *testing.T) {
2 changes: 1 addition & 1 deletion integrationTests/factory/componentsHelper.go
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ func CreateDefaultConfig() *config.Configs {
configs.FlagsConfig = &config.ContextFlagsConfig{
WorkingDir: "workingDir",
UseLogView: true,
BaseVersion: fmt.Sprintf("%s-base", Version),
BaseVersion: BaseVersion,
Version: Version,
}
configs.ConfigurationPathsHolder = configPathsHolder
1 change: 1 addition & 0 deletions integrationTests/factory/constants.go
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ const (
GenesisPath = "../testdata/genesis.json"
GenesisSmartContracts = "../testdata/genesisSmartContracts.json"
ValidatorKeyPemPath = "../validatorKey.pem"
BaseVersion = "v1.1.6.1-0-gbae61225f/go1.14.2/linux-amd64"
Version = "v1.1.6.1-0-gbae61225f/go1.14.2/linux-amd64/a72b5f2eff"
WorkingDir = "workingDir"
RoundActivationPath = "enableRounds.toml"