Skip to content

Commit

Permalink
Merge pull request #5816 from multiversx/rc/sirius-patch-2
Browse files Browse the repository at this point in the history
RC/Sirius patch 2
  • Loading branch information
sstanculeanu authored Feb 2, 2024
2 parents 06f147d + b3f8514 commit d5bb384
Show file tree
Hide file tree
Showing 95 changed files with 1,621 additions and 314 deletions.
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
Binary file modified cmd/assessment/testdata/cpucalculate.wasm
100644 → 100755
Binary file not shown.
Binary file modified cmd/assessment/testdata/storage100.wasm
100644 → 100755
Binary file not shown.
11 changes: 7 additions & 4 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@
# 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

[HardwareRequirements]
CPUFlags = ["SSE4", "SSE42"]

[Versions]
DefaultVersion = "default"
Expand Down
2 changes: 1 addition & 1 deletion cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
AutoBalanceDataTriesEnableEpoch = 1

# MigrateDataTrieEnableEpoch represents the epoch when the data tries migration is enabled
MigrateDataTrieEnableEpoch = 999999
MigrateDataTrieEnableEpoch = 2

# KeepExecOrderOnCreatedSCRsEnableEpoch represents the epoch when the execution order of created SCRs is ensured
KeepExecOrderOnCreatedSCRsEnableEpoch = 1
Expand Down
6 changes: 3 additions & 3 deletions cmd/node/config/prefs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# In multikey mode, all bls keys not mentioned in NamedIdentity section will use this one as default
NodeDisplayName = ""

# Identity represents the keybase/GitHub identity when the node does not run in multikey mode
# Identity represents the GitHub identity when the node does not run in multikey mode
# In multikey mode, all bls keys not mentioned in NamedIdentity section will use this one as default
Identity = ""

Expand All @@ -28,7 +28,7 @@
# ]
PreferredConnections = []

# ConnectionWatcherType represents the type of a connection watcher needed.
# ConnectionWatcherType represents the type of the connection watcher needed.
# possible options:
# - "disabled" - no connection watching should be made
# - "print" - new connection found will be printed in the log file
Expand Down Expand Up @@ -71,7 +71,7 @@
# NamedIdentity represents an identity that runs nodes on the multikey
# There can be multiple identities set on the same node, each one of them having different bls keys, just by duplicating the NamedIdentity
[[NamedIdentity]]
# Identity represents the keybase/GitHub identity for the current NamedIdentity
# Identity represents the GitHub identity for the current NamedIdentity
Identity = ""
# NodeName represents the name that will be given to the names of the current identity
NodeName = ""
Expand Down
32 changes: 32 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(cfgs.GeneralConfig.HardwareRequirements)
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,29 @@ func attachFileLogger(log logger.Logger, flagsConfig *config.ContextFlagsConfig)

return fileLogging, nil
}

func checkHardwareRequirements(cfg config.HardwareRequirementsConfig) error {
cpuFlags, err := parseFeatures(cfg.CPUFlags)
if err != nil {
return err
}

if !cpuid.CPU.Supports(cpuFlags...) {
return fmt.Errorf("CPU Flags: Streaming SIMD Extensions 4 required")
}

return nil
}

func parseFeatures(features []string) ([]cpuid.FeatureID, error) {
flags := make([]cpuid.FeatureID, 0)

for _, cpuFlag := range features {
featureID := cpuid.ParseFeature(cpuFlag)
if featureID == cpuid.UNKNOWN {
return nil, fmt.Errorf("CPU Flags: cpu flag %s not found", cpuFlag)
}
}

return flags, nil
}
3 changes: 3 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ const MetricRedundancyLevel = "erd_redundancy_level"
// MetricRedundancyIsMainActive is the metric that specifies data about the redundancy main machine
const MetricRedundancyIsMainActive = "erd_redundancy_is_main_active"

// MetricRedundancyStepInReason is the metric that specifies why the back-up machine stepped in
const MetricRedundancyStepInReason = "erd_redundancy_step_in_reason"

// MetricValueNA represents the value to be used when a metric is not available/applicable
const MetricValueNA = "N/A"

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions common/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ type ManagedPeersHolder interface {
GetNextPeerAuthenticationTime(pkBytes []byte) (time.Time, error)
SetNextPeerAuthenticationTime(pkBytes []byte, nextTime time.Time)
IsMultiKeyMode() bool
GetRedundancyStepInReason() string
IsInterfaceNil() bool
}

Expand Down
24 changes: 15 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,16 @@ type Config struct {
PublicKeyPIDSignature CacheConfig
PeerHonesty CacheConfig

Antiflood AntifloodConfig
WebServerAntiflood WebServerAntifloodConfig
ResourceStats ResourceStatsConfig
HeartbeatV2 HeartbeatV2Config
ValidatorStatistics ValidatorStatisticsConfig
GeneralSettings GeneralSettingsConfig
Consensus ConsensusConfig
StoragePruning StoragePruningConfig
LogsAndEvents LogsAndEventsConfig
Antiflood AntifloodConfig
WebServerAntiflood WebServerAntifloodConfig
ResourceStats ResourceStatsConfig
HeartbeatV2 HeartbeatV2Config
ValidatorStatistics ValidatorStatisticsConfig
GeneralSettings GeneralSettingsConfig
Consensus ConsensusConfig
StoragePruning StoragePruningConfig
LogsAndEvents LogsAndEventsConfig
HardwareRequirements HardwareRequirementsConfig

NTPConfig NTPConfig
HeadersPoolConfig HeadersPoolConfig
Expand Down Expand Up @@ -285,6 +286,11 @@ type GeneralSettingsConfig struct {
SetGuardianEpochsDelay uint32
}

// HardwareRequirementsConfig will hold the hardware requirements config
type HardwareRequirementsConfig struct {
CPUFlags []string
}

// FacadeConfig will hold different configuration option that will be passed to the node facade
type FacadeConfig struct {
RestApiInterface string
Expand Down
1 change: 1 addition & 0 deletions consensus/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@ type KeysHandler interface {
GetAssociatedPid(pkBytes []byte) core.PeerID
IsOriginalPublicKeyOfTheNode(pkBytes []byte) bool
ResetRoundsWithoutReceivedMessages(pkBytes []byte, pid core.PeerID)
GetRedundancyStepInReason() string
IsInterfaceNil() bool
}
2 changes: 1 addition & 1 deletion consensus/spos/bls/blsSubroundsFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func checkNewFactoryParams(
return spos.ErrNilAppStatusHandler
}
if check.IfNil(sentSignaturesTracker) {
return spos.ErrNilSentSignatureTracker
return ErrNilSentSignatureTracker
}
if len(chainID) == 0 {
return spos.ErrInvalidChainID
Expand Down
37 changes: 19 additions & 18 deletions consensus/spos/bls/blsSubroundsFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/multiversx/mx-chain-go/consensus/spos"
"github.com/multiversx/mx-chain-go/consensus/spos/bls"
"github.com/multiversx/mx-chain-go/outport"
"github.com/multiversx/mx-chain-go/testscommon"
testscommonOutport "github.com/multiversx/mx-chain-go/testscommon/outport"
"github.com/multiversx/mx-chain-go/testscommon/statusHandler"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -76,7 +77,7 @@ func initFactoryWithContainer(container *mock.ConsensusCoreMock) bls.Factory {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

return fct
Expand Down Expand Up @@ -125,7 +126,7 @@ func TestFactory_NewFactoryNilContainerShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -145,7 +146,7 @@ func TestFactory_NewFactoryNilConsensusStateShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -167,7 +168,7 @@ func TestFactory_NewFactoryNilBlockchainShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -189,7 +190,7 @@ func TestFactory_NewFactoryNilBlockProcessorShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -211,7 +212,7 @@ func TestFactory_NewFactoryNilBootstrapperShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -233,7 +234,7 @@ func TestFactory_NewFactoryNilChronologyHandlerShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -255,7 +256,7 @@ func TestFactory_NewFactoryNilHasherShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -277,7 +278,7 @@ func TestFactory_NewFactoryNilMarshalizerShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -299,7 +300,7 @@ func TestFactory_NewFactoryNilMultiSignerContainerShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -321,7 +322,7 @@ func TestFactory_NewFactoryNilRoundHandlerShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -343,7 +344,7 @@ func TestFactory_NewFactoryNilShardCoordinatorShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -365,7 +366,7 @@ func TestFactory_NewFactoryNilSyncTimerShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -387,7 +388,7 @@ func TestFactory_NewFactoryNilValidatorGroupSelectorShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -407,7 +408,7 @@ func TestFactory_NewFactoryNilWorkerShouldFail(t *testing.T) {
chainID,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -428,7 +429,7 @@ func TestFactory_NewFactoryNilAppStatusHandlerShouldFail(t *testing.T) {
chainID,
currentPid,
nil,
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand All @@ -453,7 +454,7 @@ func TestFactory_NewFactoryNilSignaturesTrackerShouldFail(t *testing.T) {
)

assert.Nil(t, fct)
assert.Equal(t, spos.ErrNilSentSignatureTracker, err)
assert.Equal(t, bls.ErrNilSentSignatureTracker, err)
}

func TestFactory_NewFactoryShouldWork(t *testing.T) {
Expand All @@ -478,7 +479,7 @@ func TestFactory_NewFactoryEmptyChainIDShouldFail(t *testing.T) {
nil,
currentPid,
&statusHandler.AppStatusHandlerStub{},
&mock.SentSignatureTrackerStub{},
&testscommon.SentSignatureTrackerStub{},
)

assert.Nil(t, fct)
Expand Down
6 changes: 6 additions & 0 deletions consensus/spos/bls/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package bls

import "errors"

// ErrNilSentSignatureTracker defines the error for setting a nil SentSignatureTracker
var ErrNilSentSignatureTracker = errors.New("nil sent signature tracker")
Loading

0 comments on commit d5bb384

Please sign in to comment.