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

Hardware requirements checks #5852

Merged
merged 8 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/assessment/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-go/cmd/assessment/benchmarks"
"github.com/multiversx/mx-chain-go/cmd/assessment/benchmarks/factory"
"github.com/multiversx/mx-chain-go/cmd/assessment/hostParameters"
"github.com/multiversx/mx-chain-go/common/hostParameters"
logger "github.com/multiversx/mx-chain-logger-go"
"github.com/urfave/cli"
)
Expand Down
8 changes: 4 additions & 4 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
# SyncProcessTimeInMillis is the value in milliseconds used when processing blocks while synchronizing blocks
SyncProcessTimeInMillis = 12000

# SetGuardianEpochsDelay represents the delay in epochs between the execution time of the SetGuardian transaction and
# the activation of the configured guardian.
# Make sure that this is greater than the unbonding period!
SetGuardianEpochsDelay = 2 # TODO: for mainnet should be 20, 2 is just for testing
# SetGuardianEpochsDelay represents the delay in epochs between the execution time of the SetGuardian transaction and
# the activation of the configured guardian.
# Make sure that this is greater than the unbonding period!
SetGuardianEpochsDelay = 2 # TODO: for mainnet should be 20, 2 is just for testing

[Versions]
DefaultVersion = "default"
Expand Down
14 changes: 14 additions & 0 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"runtime"
"time"

"github.com/klauspost/cpuid/v2"
"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-go/cmd/node/factory"
Expand Down Expand Up @@ -129,6 +130,11 @@ func startNodeRunner(c *cli.Context, log logger.Logger, baseVersion string, vers
cfgs.FlagsConfig.BaseVersion = baseVersion
cfgs.FlagsConfig.Version = version

err = checkHardwareRequirements()
if err != nil {
return fmt.Errorf("Hardware Requirements checks failed: %s", err.Error())
}

nodeRunner, errRunner := node.NewNodeRunner(cfgs)
if errRunner != nil {
return errRunner
Expand Down Expand Up @@ -301,3 +307,11 @@ func attachFileLogger(log logger.Logger, flagsConfig *config.ContextFlagsConfig)

return fileLogging, nil
}

func checkHardwareRequirements() error {
if !cpuid.CPU.Supports(cpuid.SSE4, cpuid.SSE42) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like having these hardcoded, can we somehow extract them in config.toml ?

return fmt.Errorf("CPU Flags: Streaming SIMD Extensions 4 required")
}

return nil
}