@@ -14,7 +14,6 @@ import (
1414 "github.com/multiversx/mx-chain-go/common/factory"
1515 "github.com/multiversx/mx-chain-go/config"
1616 "github.com/multiversx/mx-chain-go/genesis/data"
17- "github.com/multiversx/mx-chain-go/integrationTests"
1817 "github.com/multiversx/mx-chain-go/node"
1918 "github.com/multiversx/mx-chain-go/node/chainSimulator/dtos"
2019 "github.com/multiversx/mx-chain-go/sharding"
@@ -117,7 +116,6 @@ func CreateChainSimulatorConfigs(args ArgsChainSimulatorConfigs) (*ArgsConfigsSi
117116
118117 // set compatible trie configs
119118 configs .GeneralConfig .StateTriesConfig .SnapshotsEnabled = false
120-
121119 // enable db lookup extension
122120 configs .GeneralConfig .DbLookupExtensions .Enabled = true
123121
@@ -134,23 +132,13 @@ func CreateChainSimulatorConfigs(args ArgsChainSimulatorConfigs) (*ArgsConfigsSi
134132 return nil , err
135133 }
136134
137- for idx := 0 ; idx < len (configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch ); idx ++ {
138- configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].ShardMinNumNodes = args .MinNodesPerShard
139- configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].MetachainMinNumNodes = args .MetaChainMinNodes
140- configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].MetachainConsensusGroupSize = args .MetaChainConsensusGroupSize
141- configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].ShardConsensusGroupSize = args .ConsensusGroupSize
142- configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].RoundDuration = args .RoundDurationInMillis
143- configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].Hysteresis = args .Hysteresis
144- }
145-
146- // TODO[Sorin]: remove this once all equivalent messages PRs are merged
147- configs .EpochConfig .EnableEpochs .EquivalentMessagesEnableEpoch = integrationTests .UnreachableEpoch
148- configs .EpochConfig .EnableEpochs .FixedOrderInConsensusEnableEpoch = integrationTests .UnreachableEpoch
149-
135+ updateConfigsChainParameters (args , configs )
150136 node .ApplyArchCustomConfigs (configs )
151137
152138 if args .AlterConfigsFunction != nil {
153139 args .AlterConfigsFunction (configs )
140+ // this is needed to keep in sync EquivalentMessage flag and the second entry from chain parameters
141+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [1 ].EnableEpoch = configs .EpochConfig .EnableEpochs .EquivalentMessagesEnableEpoch
154142 }
155143
156144 return & ArgsConfigsSimulator {
@@ -161,6 +149,21 @@ func CreateChainSimulatorConfigs(args ArgsChainSimulatorConfigs) (*ArgsConfigsSi
161149 }, nil
162150}
163151
152+ func updateConfigsChainParameters (args ArgsChainSimulatorConfigs , configs * config.Configs ) {
153+ for idx := 0 ; idx < len (configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch ); idx ++ {
154+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].ShardMinNumNodes = args .MinNodesPerShard
155+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].MetachainMinNumNodes = args .MetaChainMinNodes
156+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].MetachainConsensusGroupSize = args .MetaChainConsensusGroupSize
157+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].ShardConsensusGroupSize = args .ConsensusGroupSize
158+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].RoundDuration = args .RoundDurationInMillis
159+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [idx ].Hysteresis = args .Hysteresis
160+ }
161+
162+ if len (configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch ) > 1 {
163+ configs .GeneralConfig .GeneralSettings .ChainParametersByEpoch [1 ].ShardConsensusGroupSize = args .MinNodesPerShard
164+ }
165+ }
166+
164167// SetMaxNumberOfNodesInConfigs will correctly set the max number of nodes in configs
165168func SetMaxNumberOfNodesInConfigs (cfg * config.Configs , eligibleNodes uint32 , waitingNodes uint32 , numOfShards uint32 ) {
166169 cfg .SystemSCConfig .StakingSystemSCConfig .MaxNumberOfNodesForStake = uint64 (eligibleNodes + waitingNodes )
0 commit comments