diff --git a/cmd/node/flags.go b/cmd/node/flags.go index 5bb0e52a91d..b42e694023a 100644 --- a/cmd/node/flags.go +++ b/cmd/node/flags.go @@ -230,7 +230,7 @@ var ( allValidatorKeysPemFile = cli.StringFlag{ Name: "all-validator-keys-pem-file", Usage: "The `filepath` for the PEM file which contains all the secret keys managed by the current node.", - Value: "./config/allValidatorsKeys.pem", + Value: "./config/allValidatorsKeysSF.pem", } // logLevel defines the logger level diff --git a/cmd/node/main.go b/cmd/node/main.go index cf93e448e94..8be1d572f9f 100644 --- a/cmd/node/main.go +++ b/cmd/node/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "path/filepath" "runtime" "time" @@ -82,6 +83,9 @@ func main() { return startNodeRunner(c, log, baseVersion, app.Version) } + // TODO: remove this after the first release + // renameDB() + err := app.Run(os.Args) if err != nil { log.Error(err.Error()) @@ -89,6 +93,33 @@ func main() { } } +func renameDB() { + // Define source and destination paths + sourcePath := filepath.Join("db", "1") + destPath := filepath.Join("db", "B") + + // Check if source directory exists + if _, err := os.Stat(sourcePath); os.IsNotExist(err) { + fmt.Printf("Error: Source directory '%s' does not exist\n", sourcePath) + os.Exit(1) + } + + // Check if destination already exists + if _, err := os.Stat(destPath); err == nil { + fmt.Printf("Error: Destination directory '%s' already exists\n", destPath) + os.Exit(1) + } + + // Rename the directory + err := os.Rename(sourcePath, destPath) + if err != nil { + fmt.Printf("Error renaming directory: %v\n", err) + os.Exit(1) + } + + fmt.Printf("Successfully renamed '%s' to '%s'\n", sourcePath, destPath) +} + func startNodeRunner(c *cli.Context, log logger.Logger, baseVersion string, version string) error { flagsConfig := getFlagsConfig(c, log) diff --git a/common/common.go b/common/common.go index 0ee094ccab1..ab7b689b274 100644 --- a/common/common.go +++ b/common/common.go @@ -6,6 +6,7 @@ import ( "fmt" "math/big" "math/bits" + "os" "reflect" "strconv" "strings" @@ -612,3 +613,121 @@ func GetFeePayer(tx data.TransactionHandler) []byte { return tx.GetSndAddr() } + +type EnableEpochsHandlerWithSet interface { + SetActivationRound(flag EnableRoundFlag, round uint64) +} + +type ProcessConfigsHandlerWithSet interface { + SetActivationRound(round uint64, log logger.Logger) +} + +type CommonConfigsHandlerWithSet interface { + SetActivationRound(round uint64, log logger.Logger) +} + +type VersionsConfigWithSet interface { + SetActivationRound(round uint64, log logger.Logger) +} + +type AntifloodConfigsHandlerWithSet interface { + SetActivationRound(round uint64, log logger.Logger) +} + +var erh EnableEpochsHandlerWithSet +var eeh EnableEpochsHandler +var pch ProcessConfigsHandlerWithSet +var cch CommonConfigsHandlerWithSet +var vch VersionsConfigWithSet +var ach AntifloodConfigsHandlerWithSet + +var mainConfigPath string +var roundConfigPath string + +func SetEnableRoundsHandler(enableRoundsHandler EnableEpochsHandlerWithSet) { + erh = enableRoundsHandler +} + +func SetProcessConfigsHandler(pcHandler ProcessConfigsHandler) { + pch = pcHandler +} + +func SetCommonConfigsHandler(ccHandler CommonConfigsHandler) { + cch = ccHandler +} + +func SetEnableEpochsHandler(enableEpochsHandler EnableEpochsHandler) { + eeh = enableEpochsHandler +} + +func SetVersionsConfigHandler(versions *config.VersionsConfig) { + vch = versions +} + +func SetAntifloodConfigsHandler(handler AntifloodConfigsHandler) { + ach = handler +} + +// SetConfigPaths sets the file paths for the main config and round activation config files +func SetConfigPaths(mainPath, roundPath string) { + mainConfigPath = mainPath + roundConfigPath = roundPath +} + +func SetSuperNovaActivationRound(epoch uint32, round uint64) { + isEnabled := eeh.GetActivationEpoch(SupernovaFlag) == epoch && eeh.IsFlagEnabledInEpoch(SupernovaFlag, epoch) + log.Info("SetSuperNovaActivationRound", "currentRound", round, "activationRound", round+20, "epoch", epoch, "is enabled in current round", isEnabled) + if isEnabled { + supernovaRound := round + 20 + erh.SetActivationRound(SupernovaRoundFlag, supernovaRound) + pch.SetActivationRound(supernovaRound, log) + cch.SetActivationRound(supernovaRound, log) + vch.SetActivationRound(supernovaRound, log) + ach.SetActivationRound(supernovaRound, log) + persistSupernovaRoundToConfigs(supernovaRound) + } +} + +func persistSupernovaRoundToConfigs(round uint64) { + roundStr := strconv.FormatUint(round, 10) + + if mainConfigPath != "" { + patchFileRoundValues(mainConfigPath, roundStr, false) + } + + if roundConfigPath != "" { + patchFileRoundValues(roundConfigPath, roundStr, true) + } +} + +func patchFileRoundValues(filePath string, roundStr string, isRoundConfig bool) { + data, err := os.ReadFile(filePath) + if err != nil { + log.Warn("failed to read config file for round persistence", "path", filePath, "error", err) + return + } + + original := string(data) + modified := original + + if isRoundConfig { + modified = strings.ReplaceAll(modified, `Round = "99999999"`, `Round = "`+roundStr+`"`) + } else { + modified = strings.ReplaceAll(modified, "EnableRound = 99999999", "EnableRound = "+roundStr) + modified = strings.ReplaceAll(modified, "StartRound = 99999999", "StartRound = "+roundStr) + modified = strings.ReplaceAll(modified, "Round = 99999999", "Round = "+roundStr) + } + + if modified == original { + log.Debug("no round placeholder found to replace", "path", filePath) + return + } + + err = os.WriteFile(filePath, []byte(modified), 0644) + if err != nil { + log.Warn("failed to write config file for round persistence", "path", filePath, "error", err) + return + } + + log.Info("persisted supernova round to config file", "path", filePath, "round", roundStr) +} diff --git a/common/configs/antifloodConfigs.go b/common/configs/antifloodConfigs.go index ffe09dc58b0..855b361274d 100644 --- a/common/configs/antifloodConfigs.go +++ b/common/configs/antifloodConfigs.go @@ -6,6 +6,8 @@ import ( "sort" "github.com/multiversx/mx-chain-core-go/core/check" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/config" "github.com/multiversx/mx-chain-go/process" @@ -194,6 +196,13 @@ func (ac *antifloodConfigs) GetFloodPreventerConfigByType(configType common.Floo } } +// SetActivationRound - +func (ac *antifloodConfigs) SetActivationRound(round uint64, log logger.Logger) { + nr := len(ac.orderedConfigsByRound) + log.Info("antifloodConfigs.SetActivationRound", "enableRound", round, "oldRound", ac.orderedConfigsByRound[nr-1].Round) + ac.orderedConfigsByRound[nr-1].Round = round +} + // IsInterfaceNil checks if the instance is nil func (ac *antifloodConfigs) IsInterfaceNil() bool { return ac == nil diff --git a/common/configs/antifloodConfigs_test.go b/common/configs/antifloodConfigs_test.go index 4b038bf18fe..9c4ad59bbcb 100644 --- a/common/configs/antifloodConfigs_test.go +++ b/common/configs/antifloodConfigs_test.go @@ -5,6 +5,8 @@ import ( "strings" "testing" + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/common/configs" "github.com/multiversx/mx-chain-go/config" @@ -244,3 +246,40 @@ func TestAntifloodConfigs_GetFloodPreventerConfigByType(t *testing.T) { other := handler.GetFloodPreventerConfigByType(common.FloodPreventerType("other")) require.Equal(t, config.FloodPreventerConfig{}, other) // empty config } + +func TestAntifloodConfigs_SetActivationRound(t *testing.T) { + t.Parallel() + + afConf := config.AntifloodConfig{ + Enabled: true, + ConfigsByRound: getAntifloodConfigsByRound(), + } + + currentRound := uint64(50) + roundNotifier := &epochNotifier.RoundNotifierStub{ + CurrentRoundCalled: func() uint64 { + return currentRound + }, + } + handler, err := configs.NewAntifloodConfigsHandler(afConf, roundNotifier) + require.NoError(t, err) + require.NotNil(t, handler) + + // Before SetActivationRound, the last config has round 100 + currentRound = 120 + currentConfig := handler.GetCurrentConfig() + require.Equal(t, uint64(100), currentConfig.Round) + + // Set activation round to 500 + testLog := logger.GetOrCreate("test") + handler.SetActivationRound(500, testLog) + + // Now at round 120, the last config (round 500) should not be active + currentConfig = handler.GetCurrentConfig() + require.Equal(t, uint64(0), currentConfig.Round) + + // At round 500, the last config should be active + currentRound = 500 + currentConfig = handler.GetCurrentConfig() + require.Equal(t, uint64(500), currentConfig.Round) +} diff --git a/common/configs/commonConfigs.go b/common/configs/commonConfigs.go index 2fb04c473bb..1d89615ba20 100644 --- a/common/configs/commonConfigs.go +++ b/common/configs/commonConfigs.go @@ -5,6 +5,7 @@ import ( "sort" "github.com/multiversx/mx-chain-go/config" + logger "github.com/multiversx/mx-chain-logger-go" ) const ( @@ -188,3 +189,10 @@ func (cc *commonConfigs) GetNumRoundsToWaitBeforeSignalingChronologyStuck(epoch func (cc *commonConfigs) IsInterfaceNil() bool { return cc == nil } + +// SetActivationRound - +func (cc *commonConfigs) SetActivationRound(round uint64, log logger.Logger) { + nr := len(cc.orderedEpochStartConfigByRound) + log.Info("commonConfigs.SetActivationRound", "enableRound", round, "oldRound", cc.orderedEpochStartConfigByRound[nr-1].EnableRound) + cc.orderedEpochStartConfigByRound[nr-1].EnableRound = round +} diff --git a/common/configs/processConfigs.go b/common/configs/processConfigs.go index cdc20eaae85..439aa1cbb1a 100644 --- a/common/configs/processConfigs.go +++ b/common/configs/processConfigs.go @@ -314,3 +314,10 @@ func (pce *processConfigsByEpoch) getValueByRound( func (pce *processConfigsByEpoch) IsInterfaceNil() bool { return pce == nil } + +// SetActivationRound - +func (pce *processConfigsByEpoch) SetActivationRound(round uint64, log logger.Logger) { + nr := len(pce.orderedConfigByRound) + log.Info("processConfigsByEpoch.SetActivationRound", "enableRound", round, "oldRound", pce.orderedConfigByRound[nr-1].EnableRound) + pce.orderedConfigByRound[nr-1].EnableRound = round +} diff --git a/common/constants.go b/common/constants.go index 2cf06247bc0..882e02c239e 100644 --- a/common/constants.go +++ b/common/constants.go @@ -64,7 +64,7 @@ const DisabledShardIDAsObserver = uint32(0xFFFFFFFF) - 7 // MaxTxNonceDeltaAllowed specifies the maximum difference between an account's nonce and a received transaction's nonce // in order to mark the transaction as valid. -const MaxTxNonceDeltaAllowed = 100 +const MaxTxNonceDeltaAllowed = 100000 // MaxBulkTransactionSize specifies the maximum size of one bulk with txs which can be send over the network // TODO convert this const into a var and read it from config when this code moves to another binary diff --git a/common/enablers/enableRoundsHandler.go b/common/enablers/enableRoundsHandler.go index 12e6d1f717e..24f4da68132 100644 --- a/common/enablers/enableRoundsHandler.go +++ b/common/enablers/enableRoundsHandler.go @@ -184,3 +184,14 @@ func (handler *enableRoundsHandler) GetAllEnableRounds() map[string]uint64 { func (handler *enableRoundsHandler) IsInterfaceNil() bool { return handler == nil } + +// SetActivationRound sets the activation round of the provided flag +func (handler *enableRoundsHandler) SetActivationRound(flag common.EnableRoundFlag, round uint64) { + handler.allFlagsDefined[flag] = roundFlagHandler{ + isActiveInRound: func(r uint64) bool { + return r >= round + }, + activationRound: round, + } + log.Debug("SetActivationRound", "flag", flag, "round", round) +} diff --git a/common/export_test.go b/common/export_test.go index 6154fc4d057..37fae73863a 100644 --- a/common/export_test.go +++ b/common/export_test.go @@ -27,3 +27,8 @@ func TimeDurationToUnix( ) int64 { return timeDurationToUnix(duration, enableEpochsHandler, epoch) } + +// PatchFileRoundValues - +func PatchFileRoundValues(filePath string, roundStr string, isRoundConfig bool) { + patchFileRoundValues(filePath, roundStr, isRoundConfig) +} diff --git a/common/interface.go b/common/interface.go index c55e8c73c3d..c4e7efbd09d 100644 --- a/common/interface.go +++ b/common/interface.go @@ -9,6 +9,7 @@ import ( "github.com/multiversx/mx-chain-core-go/data" "github.com/multiversx/mx-chain-core-go/data/block" crypto "github.com/multiversx/mx-chain-crypto-go" + logger "github.com/multiversx/mx-chain-logger-go" "github.com/multiversx/mx-chain-go/common/configs/dto" "github.com/multiversx/mx-chain-go/config" @@ -498,6 +499,8 @@ type ProcessConfigsHandler interface { GetValue(variable dto.ConfigVariable) uint64 + SetActivationRound(round uint64, log logger.Logger) + IsInterfaceNil() bool } @@ -508,6 +511,8 @@ type CommonConfigsHandler interface { GetMaxRoundsWithoutCommittedStartInEpochBlockInRound(round uint64) uint32 GetNumRoundsToWaitBeforeSignalingChronologyStuck(epoch uint32) uint32 + SetActivationRound(round uint64, log logger.Logger) + IsInterfaceNil() bool } @@ -516,6 +521,7 @@ type AntifloodConfigsHandler interface { GetCurrentConfig() config.AntifloodConfigByRound GetFloodPreventerConfigByType(configType FloodPreventerType) config.FloodPreventerConfig IsEnabled() bool + SetActivationRound(round uint64, log logger.Logger) IsInterfaceNil() bool } diff --git a/config/config.go b/config/config.go index d7aa89c959f..64c49b32546 100644 --- a/config/config.go +++ b/config/config.go @@ -1,6 +1,9 @@ package config -import p2pConfig "github.com/multiversx/mx-chain-go/p2p/config" +import ( + p2pConfig "github.com/multiversx/mx-chain-go/p2p/config" + logger "github.com/multiversx/mx-chain-logger-go" +) // CacheConfig will map the cache configuration type CacheConfig struct { @@ -743,6 +746,14 @@ type VersionsConfig struct { VersionsByEpochs []VersionByEpochs } +func (vc *VersionsConfig) SetActivationRound(round uint64, log logger.Logger) { + if len(vc.VersionsByEpochs) > 0 { + oldRound := vc.VersionsByEpochs[len(vc.VersionsByEpochs)-1].StartRound + vc.VersionsByEpochs[len(vc.VersionsByEpochs)-1].StartRound = round + log.Info("Set activation round for versions", "round", round, "oldRound", oldRound) + } +} + // Configs is a holder for the node configuration parameters type Configs struct { GeneralConfig *Config diff --git a/consensus/round/round.go b/consensus/round/round.go index e8dfe6f6d7e..f6c0b16700b 100644 --- a/consensus/round/round.go +++ b/consensus/round/round.go @@ -45,6 +45,7 @@ type round struct { supernovaStartRound int64 importDBMode bool + initialGenesisTime time.Time *sync.RWMutex enableRoundsHandler common.EnableRoundsHandler @@ -73,6 +74,7 @@ func NewRound(args ArgsRound) (*round, error) { RWMutex: &sync.RWMutex{}, enableRoundsHandler: args.EnableRoundsHandler, importDBMode: args.ImportDBMode, + initialGenesisTime: args.GenesisTimeStamp, } rnd.UpdateRound(args.GenesisTimeStamp, args.CurrentTimeStamp) @@ -81,9 +83,25 @@ func NewRound(args ArgsRound) (*round, error) { return &rnd, nil } +func (rnd *round) GetSupernovaGenesisTimestamp() time.Time { + supernovaStartRound := int64(rnd.enableRoundsHandler.GetActivationRound(common.SupernovaRoundFlag)) + if supernovaStartRound != rnd.supernovaStartRound { + log.Debug("round.go: GetSupernovaGenesisTimestamp: force set supernovaStartRound", + "initialGenesisTime", rnd.initialGenesisTime, + "timeDuration", rnd.timeDuration.Nanoseconds(), + "supernovaStartRound", supernovaStartRound, + "oldSuperNovaStartRound", rnd.supernovaStartRound) + rnd.supernovaStartRound = supernovaStartRound + rnd.supernovaGenesisTimeStamp = rnd.initialGenesisTime.Add(time.Duration(supernovaStartRound * rnd.timeDuration.Nanoseconds())) + log.Debug("round.go: GetSupernovaGenesisTimestamp: force set supernovaStartRound", "round", supernovaStartRound, "supernovaGenesisTimeStamp", rnd.supernovaGenesisTimeStamp) + } + + return rnd.supernovaGenesisTimeStamp +} + // UpdateRound updates the index and the time stamp of the round depending on the genesis time and the current time given func (rnd *round) UpdateRound(genesisTimeStamp time.Time, currentTimeStamp time.Time) { - baseTimeStamp := rnd.supernovaGenesisTimeStamp + baseTimeStamp := rnd.GetSupernovaGenesisTimestamp() roundDuration := rnd.supernovaTimeDuration startRound := rnd.supernovaStartRound @@ -116,7 +134,7 @@ func (rnd *round) isSupernovaActivated(currentTimeStamp time.Time) bool { return supernovaActivated } - currentTimeAfterSupernova := currentTimeStamp.UnixMilli() >= rnd.supernovaGenesisTimeStamp.UnixMilli() + currentTimeAfterSupernova := currentTimeStamp.UnixMilli() >= rnd.GetSupernovaGenesisTimestamp().UnixMilli() if currentTimeAfterSupernova && !rnd.importDBMode { log.Debug("isSupernovaActivated: force set supernovaActivated", diff --git a/consensus/spos/bls/constants.go b/consensus/spos/bls/constants.go index 88667da3003..822f2399887 100644 --- a/consensus/spos/bls/constants.go +++ b/consensus/spos/bls/constants.go @@ -33,6 +33,36 @@ const ( MtInvalidSigners ) +// waitingAllSigsMaxTimeThreshold specifies the max allocated time for waiting all signatures from the total time of the subround signature +const waitingAllSigsMaxTimeThreshold = 0.5 + +// processingThresholdPercent specifies the max allocated time for processing the block as a percentage of the total time of the round +const processingThresholdPercent = 85 + +// srStartStartTime specifies the start time, from the total time of the round, of Subround Start +const srStartStartTime = 0.0 + +// srEndStartTime specifies the end time, from the total time of the round, of Subround Start +const srStartEndTime = 0.05 + +// srBlockStartTime specifies the start time, from the total time of the round, of Subround Block +const srBlockStartTime = 0.05 + +// srBlockEndTime specifies the end time, from the total time of the round, of Subround Block +const srBlockEndTime = 0.45 + +// srSignatureStartTime specifies the start time, from the total time of the round, of Subround Signature +const srSignatureStartTime = 0.45 + +// srSignatureEndTime specifies the end time, from the total time of the round, of Subround Signature +const srSignatureEndTime = 0.85 + +// srEndStartTime specifies the start time, from the total time of the round, of Subround End +const srEndStartTime = 0.85 + +// srEndEndTime specifies the end time, from the total time of the round, of Subround End +const srEndEndTime = 0.95 + const ( // BlockBodyAndHeaderStringValue represents the string to be used to identify a block body and a block header BlockBodyAndHeaderStringValue = "(BLOCK_BODY_AND_HEADER)" diff --git a/consensus/spos/bls/v1/subroundSignature.go b/consensus/spos/bls/v1/subroundSignature.go index 360aba6e48a..fdd323d1668 100644 --- a/consensus/spos/bls/v1/subroundSignature.go +++ b/consensus/spos/bls/v1/subroundSignature.go @@ -145,7 +145,7 @@ func (sr *subroundSignature) createAndSendSignatureMessage(signatureShare []byte return false } - log.Debug("step 2: signature has been sent", "pk", pkBytes) + //log.Debug("step 2: signature has been sent", "pk", pkBytes) return true } diff --git a/consensus/spos/bls/v2/subroundSignature.go b/consensus/spos/bls/v2/subroundSignature.go index aeeb65c1a6b..9adac5d898a 100644 --- a/consensus/spos/bls/v2/subroundSignature.go +++ b/consensus/spos/bls/v2/subroundSignature.go @@ -149,7 +149,7 @@ func (sr *subroundSignature) createAndSendSignatureMessage(signatureShare []byte return false } - log.Debug("step 2: signature has been sent", "pk", pkBytes) + //log.Debug("step 2: signature has been sent", "pk", pkBytes) return true } diff --git a/consensus/spos/consensusMessageValidator.go b/consensus/spos/consensusMessageValidator.go index 64801fd6fae..ae23fdf189b 100644 --- a/consensus/spos/consensusMessageValidator.go +++ b/consensus/spos/consensusMessageValidator.go @@ -144,12 +144,6 @@ func (cmv *consensusMessageValidator) checkConsensusMessageValidity(cnsMsg *cons len(cnsMsg.PubKey)) } - if len(cnsMsg.Signature) != cmv.signatureSize { - return fmt.Errorf("%w : received signature from consensus topic has an invalid size: %d", - ErrInvalidSignatureSize, - len(cnsMsg.Signature)) - } - isNodeInEligibleList := cmv.consensusState.IsNodeInEligibleList(string(cnsMsg.PubKey)) if !isNodeInEligibleList { return fmt.Errorf("%w : received message from consensus topic has an invalid public key: %s", @@ -404,11 +398,11 @@ func (cmv *consensusMessageValidator) checkMessageWithSignatureValidity(cnsMsg * logger.DisplayByteSlice(cnsMsg.PubKey)) } - if len(cnsMsg.SignatureShare) != cmv.signatureSize { - return fmt.Errorf("%w : received signature share from consensus topic has an invalid size: %d", - ErrInvalidSignatureSize, - len(cnsMsg.SignatureShare)) - } + //if len(cnsMsg.SignatureShare) != cmv.signatureSize { + // return fmt.Errorf("%w : received signature share from consensus topic has an invalid size: %d", + // ErrInvalidSignatureSize, + // len(cnsMsg.SignatureShare)) + //} return nil } @@ -437,23 +431,6 @@ func (cmv *consensusMessageValidator) checkMessageWithFinalInfoValidity(cnsMsg * len(cnsMsg.PubKeysBitmap)) } - if len(cnsMsg.AggregateSignature) != cmv.signatureSize { - return fmt.Errorf("%w : received aggregate signature from consensus topic has an invalid size: %d", - ErrInvalidSignatureSize, - len(cnsMsg.AggregateSignature)) - } - - // TODO[cleanup cns finality]: remove this - if cmv.shouldNotVerifyLeaderSignature() { - return nil - } - - if len(cnsMsg.LeaderSignature) != cmv.signatureSize { - return fmt.Errorf("%w : received leader signature from consensus topic has an invalid size: %d", - ErrInvalidSignatureSize, - len(cnsMsg.LeaderSignature)) - } - return nil } diff --git a/epochStart/metachain/trigger.go b/epochStart/metachain/trigger.go index 0f81203adf1..45eee78af60 100644 --- a/epochStart/metachain/trigger.go +++ b/epochStart/metachain/trigger.go @@ -287,10 +287,12 @@ func (t *trigger) setEpochChange(round uint64, epoch uint32, isEpochStart bool) t.currEpochStartRound = round msg := fmt.Sprintf("EPOCH %d BEGINS IN ROUND (%d)", t.epoch, t.currEpochStartRound) + common.SetSuperNovaActivationRound(t.epoch, round) log.Debug(display.Headline(msg, "", "#")) log.Debug("trigger.Update", "isEpochStart", t.isEpochStart) logger.SetCorrelationEpoch(t.epoch) t.nextEpochStartRound = disabledRoundForForceEpochStart + } // SetProcessed sets start of epoch to false and cleans underlying structure diff --git a/epochStart/shardchain/trigger.go b/epochStart/shardchain/trigger.go index 129b96b7ebb..da2b28700a7 100644 --- a/epochStart/shardchain/trigger.go +++ b/epochStart/shardchain/trigger.go @@ -742,6 +742,7 @@ func (t *trigger) updateTriggerFromMeta() { t.epochStartNotifier.NotifyEpochChangeConfirmed(t.metaEpoch) msg := fmt.Sprintf("EPOCH %d BEGINS IN ROUND (%d)", t.metaEpoch, t.epochStartRound) + common.SetSuperNovaActivationRound(t.metaEpoch, t.epochStartRound) log.Debug(display.Headline(msg, "", "#")) log.Debug("trigger.updateTriggerFromMeta", "isEpochStart", t.isEpochStart) logger.SetCorrelationEpoch(t.metaEpoch) diff --git a/factory/core/coreComponents.go b/factory/core/coreComponents.go index 9708aa668cf..1e6ee4fd769 100644 --- a/factory/core/coreComponents.go +++ b/factory/core/coreComponents.go @@ -415,6 +415,14 @@ func (ccf *coreComponentsFactory) Create() (*coreComponents, error) { return nil, err } + common.SetEnableEpochsHandler(enableEpochsHandler) + common.SetEnableRoundsHandler(enableRoundsHandler) + common.SetVersionsConfigHandler(&ccf.config.Versions) + common.SetProcessConfigsHandler(processConfigs) + common.SetCommonConfigsHandler(commonConfigsHandler) + common.SetAntifloodConfigsHandler(antifloodConfigsHandler) + common.SetConfigPaths(ccf.configPathsHolder.MainConfig, ccf.configPathsHolder.RoundActivation) + return &coreComponents{ hasher: hasher, txSignHasher: txSignHasher, diff --git a/factory/crypto/cryptoComponents.go b/factory/crypto/cryptoComponents.go index 9f5c23e40b4..a69e9180d26 100644 --- a/factory/crypto/cryptoComponents.go +++ b/factory/crypto/cryptoComponents.go @@ -12,7 +12,6 @@ import ( disabledCrypto "github.com/multiversx/mx-chain-crypto-go/signing/disabled" disabledSig "github.com/multiversx/mx-chain-crypto-go/signing/disabled/singlesig" "github.com/multiversx/mx-chain-crypto-go/signing/ed25519" - "github.com/multiversx/mx-chain-crypto-go/signing/ed25519/singlesig" "github.com/multiversx/mx-chain-crypto-go/signing/mcl" mclSig "github.com/multiversx/mx-chain-crypto-go/signing/mcl/singlesig" "github.com/multiversx/mx-chain-crypto-go/signing/secp256k1" @@ -164,20 +163,21 @@ func (ccf *cryptoComponentsFactory) Create() (*cryptoComponents, error) { } txSignKeyGen := signing.NewKeyGenerator(ed25519.NewEd25519()) - txSingleSigner := &singlesig.Ed25519Signer{} - processingSingleSigner, err := ccf.createSingleSigner(false) + txSingleSigner := &disabledSig.DisabledSingleSig{} + + processingSingleSigner, err := ccf.createSingleSigner(true) if err != nil { return nil, err } - interceptSingleSigner, err := ccf.createSingleSigner(ccf.importModeNoSigCheck) + interceptSingleSigner, err := ccf.createSingleSigner(true) if err != nil { return nil, err } p2pSingleSigner := &secp256k1SinglerSig.Secp256k1Signer{} - multiSigner, err := ccf.createMultiSignerContainer(blockSignKeyGen, ccf.importModeNoSigCheck) + multiSigner, err := ccf.createMultiSignerContainer(blockSignKeyGen, true) if err != nil { return nil, err } @@ -506,36 +506,12 @@ func (ccf *cryptoComponentsFactory) processAllHandledKeys(keygen crypto.KeyGener return handledPrivateKeys, nil } -func (ccf *cryptoComponentsFactory) processPrivatePublicKey(keygen crypto.KeyGenerator, encodedSk []byte, pkString string, index int) ([]byte, error) { +func (ccf *cryptoComponentsFactory) processPrivatePublicKey(_ crypto.KeyGenerator, encodedSk []byte, _ string, index int) ([]byte, error) { skBytes, err := hex.DecodeString(string(encodedSk)) if err != nil { return nil, fmt.Errorf("%w for encoded secret key, key index %d", err, index) } - pkBytes, err := ccf.validatorPubKeyConverter.Decode(pkString) - if err != nil { - return nil, fmt.Errorf("%w for encoded public key %s, key index %d", err, pkString, index) - } - - sk, err := keygen.PrivateKeyFromByteArray(skBytes) - if err != nil { - return nil, fmt.Errorf("%w secret key, key index %d", err, index) - } - - pk := sk.GeneratePublic() - pkGeneratedBytes, err := pk.ToByteArray() - if err != nil { - return nil, fmt.Errorf("%w while generating public key bytes, key index %d", err, index) - } - - if !bytes.Equal(pkGeneratedBytes, pkBytes) { - return nil, fmt.Errorf("public keys mismatch, read %s, generated %s, key index %d", - pkString, - ccf.validatorPubKeyConverter.SilentEncode(pkBytes, log), - index, - ) - } - return skBytes, nil } diff --git a/factory/peerSignatureHandler/peerSignatureHandler.go b/factory/peerSignatureHandler/peerSignatureHandler.go index 49518631bf7..7fb84e8761b 100644 --- a/factory/peerSignatureHandler/peerSignatureHandler.go +++ b/factory/peerSignatureHandler/peerSignatureHandler.go @@ -49,6 +49,9 @@ func NewPeerSignatureHandler( // VerifyPeerSignature verifies the signature associated with the public key. It first checks the cache for the public key, // and if it is not present, it will recompute the signature. func (psh *peerSignatureHandler) VerifyPeerSignature(pk []byte, pid core.PeerID, signature []byte) error { + if true { + return nil + } if len(pk) == 0 { return crypto.ErrInvalidPublicKey } diff --git a/keysManagement/managedPeersHolder.go b/keysManagement/managedPeersHolder.go index c412697af4c..0f823bea1f6 100644 --- a/keysManagement/managedPeersHolder.go +++ b/keysManagement/managedPeersHolder.go @@ -149,15 +149,24 @@ func generateNodeName(providedNodeName string, index int) string { // It errors if the generated public key is already contained by the struct // It will auto-generate some fields like the machineID and pid func (holder *managedPeersHolder) AddManagedPeer(privateKeyBytes []byte) error { - privateKey, err := holder.keyGenerator.PrivateKeyFromByteArray(privateKeyBytes) - if err != nil { - return fmt.Errorf("%w for provided bytes %s", err, hex.EncodeToString(privateKeyBytes)) - } + var publicKeyBytes []byte + var privateKey crypto.PrivateKey + var err error + actualPrivateKey := len(privateKeyBytes) == 32 + if actualPrivateKey { + privateKey, err = holder.keyGenerator.PrivateKeyFromByteArray(privateKeyBytes) + if err != nil { + return fmt.Errorf("%w for provided bytes %s", err, hex.EncodeToString(privateKeyBytes)) + } - publicKey := privateKey.GeneratePublic() - publicKeyBytes, err := publicKey.ToByteArray() - if err != nil { - return fmt.Errorf("%w for provided bytes %s", err, hex.EncodeToString(privateKeyBytes)) + publicKey := privateKey.GeneratePublic() + publicKeyBytes, err = publicKey.ToByteArray() + if err != nil { + return fmt.Errorf("%w for provided bytes %s", err, hex.EncodeToString(privateKeyBytes)) + } + } else { + publicKeyBytes = privateKeyBytes + privateKey, _ = holder.keyGenerator.GeneratePair() } p2pPrivateKey, p2pPublicKey := holder.p2pKeyGenerator.GeneratePair() diff --git a/node/node.go b/node/node.go index 5b1dbb99350..bae44df5a44 100644 --- a/node/node.go +++ b/node/node.go @@ -762,7 +762,7 @@ func (n *Node) ValidateTransaction(tx *transaction.Transaction) error { return err } - txValidator, intTx, err := n.commonTransactionValidation(tx, n.processComponents.WhiteListerVerifiedTxs(), n.processComponents.WhiteListHandler(), true) + txValidator, intTx, err := n.commonTransactionValidation(tx, n.processComponents.WhiteListerVerifiedTxs(), n.processComponents.WhiteListHandler(), false) if err != nil { return err } diff --git a/process/block/headerValidator.go b/process/block/headerValidator.go index 199b793b36b..374927043db 100644 --- a/process/block/headerValidator.go +++ b/process/block/headerValidator.go @@ -85,15 +85,6 @@ func (h *headerValidator) IsHeaderConstructionValid(currHeader, prevHeader data. return process.ErrBlockHashDoesNotMatch } - if !bytes.Equal(currHeader.GetPrevRandSeed(), prevHeader.GetRandSeed()) { - log.Trace("header random seed does not match", - "shard", currHeader.GetShardID(), - "local header random seed", prevHeader.GetRandSeed(), - "received header with prev random seed", currHeader.GetPrevRandSeed(), - ) - return process.ErrRandSeedDoesNotMatch - } - return nil } diff --git a/process/block/metablock.go b/process/block/metablock.go index 666685dce79..a2280497aed 100644 --- a/process/block/metablock.go +++ b/process/block/metablock.go @@ -6,6 +6,8 @@ import ( "errors" "fmt" "math/big" + "strconv" + "strings" "sync" "time" @@ -28,10 +30,13 @@ import ( "github.com/multiversx/mx-chain-go/process/block/helpers" "github.com/multiversx/mx-chain-go/process/block/processedMb" "github.com/multiversx/mx-chain-go/state" + "github.com/multiversx/mx-chain-go/update" + "github.com/multiversx/mx-chain-go/vm" ) const ( firstHeaderNonce = uint64(1) + minRoundModulus = uint64(4) defaultMaxProposalNonceGap = 10 ) @@ -66,6 +71,9 @@ type metaProcessor struct { epochStartDataWrapper *epochStartDataWrapper mutEpochStartData sync.RWMutex shardInfoCreateData process.ShardInfoCreator + nrEpochsChanges int + roundsModulus uint64 + shouldStartBootstrap bool } // NewMetaProcessor creates a new metaProcessor object @@ -141,6 +149,9 @@ func NewMetaProcessor(arguments ArgMetaProcessor) (*metaProcessor, error) { mp.shardsHeadersNonce = &sync.Map{} + mp.nrEpochsChanges = 0 + mp.roundsModulus = 20 + return &mp, nil } @@ -328,6 +339,8 @@ func (mp *metaProcessor) ProcessBlock( return err } + mp.ForceStart(header) + return nil } @@ -763,6 +776,8 @@ func (mp *metaProcessor) CreateBlock( mp.requestHandler.SetEpoch(metaHdr.GetEpoch()) + mp.ForceStart(metaHdr) + return metaHdr, body, nil } @@ -2871,3 +2886,65 @@ func (mp *metaProcessor) DecodeBlockHeader(dta []byte) data.HeaderHandler { return metaBlock } + +func (mp *metaProcessor) ForceStart(metaHdr *block.MetaBlock) { + forceEpochTrigger := mp.epochStartTrigger.(update.EpochHandler) + + txBlockTxs := mp.txCoordinator.GetAllCurrentUsedTxs(block.TxBlock) + + for _, tx := range txBlockTxs { + if bytes.Compare(tx.GetRcvAddr(), vm.ValidatorSCAddress) == 0 { + tokens := strings.Split(string(tx.GetData()), "@") + if len(tokens) == 0 { + continue + } + done := false + switch tokens[0] { + case "epochsFastForward": + { + if len(tokens) != 3 { + log.Error("epochsFastForward", "invalid data", string(tx.GetData())) + continue + } + mp.epochsFastForward(metaHdr, tokens) + done = true + } + } + + if done { + break + } + } + } + + if !check.IfNil(forceEpochTrigger) { + if metaHdr.GetRound()%mp.roundsModulus == 0 && mp.nrEpochsChanges > 0 { + forceEpochTrigger.ForceEpochStart(metaHdr.GetRound()) + mp.nrEpochsChanges-- + log.Debug("forcing epoch start", "round", metaHdr.GetRound(), "epoch", metaHdr.GetEpoch(), "still remaining epoch changes", mp.nrEpochsChanges, "rounds modulus", mp.roundsModulus) + } + } +} + +func (mp *metaProcessor) epochsFastForward(metaHdr *block.MetaBlock, tokens []string) { + epochs, err := strconv.ParseInt(tokens[1], 10, 64) + if err != nil { + log.Error("epochfastforward", "epochs could not be parsed", tokens[1]) + } + + roundsPerEpoch, err := strconv.ParseInt(tokens[2], 10, 64) + if err != nil { + log.Error("epochfastforward", "rounds could not be parsed", tokens[2]) + } + roundsPerEpochUint := uint64(roundsPerEpoch) + + if roundsPerEpochUint < minRoundModulus { + log.Warn("epochfastforward rounds per epoch too small", "rounds", roundsPerEpoch, "minRoundModulus", minRoundModulus) + roundsPerEpochUint = minRoundModulus + } + + mp.nrEpochsChanges = int(epochs) + mp.roundsModulus = roundsPerEpochUint + + log.Warn("epochfastforward - forcing epoch start", "round", metaHdr.GetRound(), "epoch", metaHdr.GetEpoch(), "still remaining epoch changes", mp.nrEpochsChanges, "rounds modulus", mp.roundsModulus) +} diff --git a/process/headerCheck/headerIntegrityVerifier.go b/process/headerCheck/headerIntegrityVerifier.go index 9c98a603bda..4eea22d5e9c 100644 --- a/process/headerCheck/headerIntegrityVerifier.go +++ b/process/headerCheck/headerIntegrityVerifier.go @@ -60,12 +60,14 @@ func (hdrIntVer *headerIntegrityVerifier) Verify(hdr data.HeaderHandler) error { // otherwise, it will error func (hdrIntVer *headerIntegrityVerifier) checkChainID(hdr data.HeaderHandler) error { if !bytes.Equal(hdrIntVer.referenceChainID, hdr.GetChainID()) { - return fmt.Errorf( - "%w, expected: %s, got %s", - ErrInvalidChainID, - hex.EncodeToString(hdrIntVer.referenceChainID), - hex.EncodeToString(hdr.GetChainID()), - ) + if !bytes.Equal(hdr.GetChainID(), []byte("1")) { + return fmt.Errorf( + "%w, expected: %s, got %s", + ErrInvalidChainID, + hex.EncodeToString(hdrIntVer.referenceChainID), + hex.EncodeToString(hdr.GetChainID()), + ) + } } return nil diff --git a/process/heartbeat/interceptedPeerAuthentication.go b/process/heartbeat/interceptedPeerAuthentication.go index 4325c798cc9..baa57fc3734 100644 --- a/process/heartbeat/interceptedPeerAuthentication.go +++ b/process/heartbeat/interceptedPeerAuthentication.go @@ -136,23 +136,6 @@ func (ipa *interceptedPeerAuthentication) CheckValidity() error { } // Verify payload signature - err = ipa.signaturesHandler.Verify(ipa.peerAuthentication.Payload, ipa.peerId, ipa.peerAuthentication.PayloadSignature) - if err != nil { - return err - } - - // Verify payload - err = ipa.payloadValidator.ValidateTimestamp(ipa.payload.Timestamp) - if err != nil { - return err - } - - // Verify message bls signature - err = ipa.peerSignatureHandler.VerifyPeerSignature(ipa.peerAuthentication.Pubkey, ipa.peerId, ipa.peerAuthentication.Signature) - if err != nil { - return err - } - log.Trace("interceptedPeerAuthentication received valid data") return nil diff --git a/process/sync/baseForkDetector.go b/process/sync/baseForkDetector.go index 68a86a59c62..2467d718e2b 100644 --- a/process/sync/baseForkDetector.go +++ b/process/sync/baseForkDetector.go @@ -4,6 +4,7 @@ import ( "bytes" "math" "sync" + "time" "github.com/multiversx/mx-chain-core-go/core/check" "github.com/multiversx/mx-chain-core-go/data" @@ -60,6 +61,7 @@ type baseForkDetector struct { enableRoundsHandler common.EnableRoundsHandler proofsPool process.ProofsPool chainParametersHandler common.ChainParametersHandler + superstartRound int64 processConfigsHandler common.ProcessConfigsHandler } @@ -768,6 +770,8 @@ func (bfd *baseForkDetector) checkGenesisTimeForHeaderAfterSupernovaWithoutRound roundDifference := int64(headerHandler.GetRound() - bfd.genesisRound) genesisTime := int64(headerHandler.GetTimeStamp()) - roundDifference*roundDuration + _ = bfd.GetSupernovaGenesisTimestamp() + log.Trace("getGenesisTimeForHeaderAfterSupernovaWithoutRoundActivation", "roundDuration", roundDuration, "roundDifference", roundDifference, @@ -824,12 +828,12 @@ func (bfd *baseForkDetector) checkGenesisTimeForHeaderAfterSupernovaWithRoundAct "roundDuration", roundDuration, "roundDifference", roundDifference, "genesisTime", genesisTime, - "supernovaGenesisTime", bfd.supernovaGenesisTime, + "supernovaGenesisTime", bfd.GetSupernovaGenesisTimestamp(), ) - if genesisTime != bfd.supernovaGenesisTime { + if genesisTime != bfd.GetSupernovaGenesisTimestamp() { log.Error("checkGenesisTimeForHeaderAfterSupernovaWithRoundActivation: genesis time mismatch", - "localGenesisTime", bfd.supernovaGenesisTime, + "localGenesisTime", bfd.GetSupernovaGenesisTimestamp(), "calculatedGenesisTime", genesisTime, "header timestamp", headerHandler.GetTimeStamp(), ) @@ -839,6 +843,30 @@ func (bfd *baseForkDetector) checkGenesisTimeForHeaderAfterSupernovaWithRoundAct return nil } +func (rnd *baseForkDetector) GetSupernovaGenesisTimestamp() int64 { + supernovaStartRound := int64(rnd.enableRoundsHandler.GetActivationRound(common.SupernovaRoundFlag)) + if supernovaStartRound != rnd.superstartRound { + genesisTime := common.GetGenesisStartTimeFromUnixTimestamp(rnd.genesisTime, rnd.enableEpochsHandler) + + chainParams, err := rnd.chainParametersHandler.ChainParametersForEpoch(rnd.genesisEpoch) + if err != nil { + log.Error("baseForkDetector.go: GetSupernovaGenesisTimestamp: failed to get chain parameters", + "epoch", rnd.genesisEpoch, + "error", err) + return rnd.supernovaGenesisTime + } + genesisRoundDurationNs := int64(chainParams.RoundDuration) * int64(time.Millisecond) + rnd.superstartRound = supernovaStartRound + rnd.supernovaGenesisTime = genesisTime.Add(time.Duration(supernovaStartRound * genesisRoundDurationNs)).UnixMilli() + log.Debug("baseForkDetector.go: GetSupernovaGenesisTimestamp: force set supernovaStartRound", + "round", supernovaStartRound, + "supernovaGenesisTimeStamp", rnd.supernovaGenesisTime, + "genesisTime", rnd.genesisTime) + } + + return rnd.supernovaGenesisTime +} + func (bfd *baseForkDetector) checkGenesisTimeForHeader(headerHandler data.HeaderHandler) error { supernovaInEpochActivated := bfd.enableEpochsHandler.IsFlagEnabledInEpoch(common.SupernovaFlag, headerHandler.GetEpoch()) supernovaInRoundActivated := bfd.enableRoundsHandler.IsFlagEnabledInRound(common.SupernovaRoundFlag, headerHandler.GetRound()) diff --git a/process/sync/metaForkDetector_test.go b/process/sync/metaForkDetector_test.go index 176d1b07df1..70cf67f662b 100644 --- a/process/sync/metaForkDetector_test.go +++ b/process/sync/metaForkDetector_test.go @@ -543,8 +543,8 @@ func TestMetaForkDetector_ComputeGenesisTimeFromHeader(t *testing.T) { roundHandlerMock := &mock.RoundHandlerMock{} genesisTime := int64(900) - supernovaGenesisTime := int64(90000) - hdrTimeStamp := uint64(100000) // as milliseconds + supernovaGenesisTime := int64(910000) + hdrTimeStamp := uint64(920000) // as milliseconds hdrRound := uint64(20) supernovaActivationRound := uint64(10) diff --git a/process/sync/shardForkDetector_test.go b/process/sync/shardForkDetector_test.go index dad554e5e7a..b9fff953d82 100644 --- a/process/sync/shardForkDetector_test.go +++ b/process/sync/shardForkDetector_test.go @@ -516,8 +516,8 @@ func TestShardForkDetector_ComputeGenesisTimeFromHeader(t *testing.T) { roundHandlerMock := &mock.RoundHandlerMock{} genesisTime := int64(900) - supernovaGenesisTime := int64(90000) - hdrTimeStamp := uint64(100000) // as milliseconds + supernovaGenesisTime := int64(910000) + hdrTimeStamp := uint64(920000) // as milliseconds hdrRound := uint64(20) supernovaActivationRound := uint64(10) diff --git a/process/sync/storageBootstrap/baseStorageBootstrapper.go b/process/sync/storageBootstrap/baseStorageBootstrapper.go index 0ca3b557dae..e7d4cafd9a0 100644 --- a/process/sync/storageBootstrap/baseStorageBootstrapper.go +++ b/process/sync/storageBootstrap/baseStorageBootstrapper.go @@ -278,10 +278,12 @@ func (st *storageBootstrapper) applyHeaderInfo(hdrInfo bootstrapStorage.Bootstra } if string(headerFromStorage.GetChainID()) != st.chainID { - log.Debug("chain ID missmatch for header with nonce", "nonce", headerFromStorage.GetNonce(), - "reference", []byte(st.chainID), - "fromStorage", headerFromStorage.GetChainID()) - return process.ErrInvalidChainID + if string(headerFromStorage.GetChainID()) != "1" { + log.Debug("chain ID missmatch for header with nonce", "nonce", headerFromStorage.GetNonce(), + "reference", []byte(st.chainID), + "fromStorage", headerFromStorage.GetChainID()) + return process.ErrInvalidChainID + } } rootHash, err := st.getRootHashForBlock(headerFromStorage, headerHash) diff --git a/process/transaction/baseProcess.go b/process/transaction/baseProcess.go index 0433f8a0f50..cde4620e618 100644 --- a/process/transaction/baseProcess.go +++ b/process/transaction/baseProcess.go @@ -383,6 +383,12 @@ func (txProc *baseTxProcessor) VerifyGuardian(tx *transaction.Transaction, accou if check.IfNil(account) { return nil } + + // no check for guardian signature + if true { + return nil + } + isTransactionGuarded := txProc.txVersionChecker.IsGuardedTransaction(tx) if !account.IsGuarded() { if isTransactionGuarded { diff --git a/process/transaction/interceptedTransaction.go b/process/transaction/interceptedTransaction.go index b19aee3425c..fd30ab95711 100644 --- a/process/transaction/interceptedTransaction.go +++ b/process/transaction/interceptedTransaction.go @@ -392,7 +392,7 @@ func (inTx *InterceptedTransaction) integrity(tx *transaction.Transaction) error return err } - if !bytes.Equal(tx.ChainID, inTx.chainID) { + if !bytes.Equal(tx.ChainID, inTx.chainID) && !bytes.Equal(tx.ChainID, []byte("1")) { return process.ErrInvalidChainID } if len(tx.RcvAddr) != inTx.pubkeyConv.Len() { @@ -470,6 +470,10 @@ func (inTx *InterceptedTransaction) VerifyGuardianSig(tx *transaction.Transactio return verifyConsistencyForNotGuardedTx(tx) } + if true { + return nil + } + guardianPubKey, err := inTx.keyGen.PublicKeyFromByteArray(tx.GuardianAddr) if err != nil { return err diff --git a/testscommon/antifloodConfigsHandlerStub.go b/testscommon/antifloodConfigsHandlerStub.go index ea78b9ae154..e4b861ef90d 100644 --- a/testscommon/antifloodConfigsHandlerStub.go +++ b/testscommon/antifloodConfigsHandlerStub.go @@ -1,6 +1,8 @@ package testscommon import ( + logger "github.com/multiversx/mx-chain-logger-go" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/config" ) @@ -10,6 +12,7 @@ type AntifloodConfigsHandlerStub struct { GetCurrentConfigCalled func() config.AntifloodConfigByRound IsEnabledCalled func() bool GetFloodPreventerConfigByTypeCalled func(configType common.FloodPreventerType) config.FloodPreventerConfig + SetActivationRoundCalled func(round uint64, log logger.Logger) } // GetCurrentConfig - @@ -39,6 +42,13 @@ func (stub *AntifloodConfigsHandlerStub) GetFloodPreventerConfigByType(configTyp return config.FloodPreventerConfig{} } +// SetActivationRound - +func (stub *AntifloodConfigsHandlerStub) SetActivationRound(round uint64, log logger.Logger) { + if stub.SetActivationRoundCalled != nil { + stub.SetActivationRoundCalled(round, log) + } +} + // IsInterfaceNil - func (stub *AntifloodConfigsHandlerStub) IsInterfaceNil() bool { return stub == nil diff --git a/testscommon/processConfigsHandlerStub.go b/testscommon/processConfigsHandlerStub.go index 542a88e0f25..3658e61b398 100644 --- a/testscommon/processConfigsHandlerStub.go +++ b/testscommon/processConfigsHandlerStub.go @@ -8,6 +8,7 @@ import ( "github.com/multiversx/mx-chain-go/common/configs/dto" "github.com/multiversx/mx-chain-go/config" "github.com/multiversx/mx-chain-go/testscommon/epochNotifier" + logger "github.com/multiversx/mx-chain-logger-go" ) // GetDefaultProcessConfigsHandler - @@ -168,3 +169,8 @@ func (p *ProcessConfigsHandlerStub) GetNumHeadersToRequestInAdvance(round uint64 func (p *ProcessConfigsHandlerStub) IsInterfaceNil() bool { return p == nil } + +// SetActivationRound - +func (p *ProcessConfigsHandlerStub) SetActivationRound(round uint64, log logger.Logger) { + +}