Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestRelayedV3WithChainSimulator(t *testing.T) {
t.Skip("this is not a short test")
}

t.Run("successful intra shard guarded move balance", testRelayedV3MoveBalance(0, 0, false, true))
t.Run("sender == relayer move balance should consume fee", testRelayedV3RelayedBySenderMoveBalance())
t.Run("receiver == relayer move balance should consume fee", testRelayedV3RelayedByReceiverMoveBalance())
t.Run("successful intra shard move balance", testRelayedV3MoveBalance(0, 0, false, false))
Expand Down Expand Up @@ -104,7 +105,6 @@ func testRelayedV3MoveBalance(
guardedTx bool,
) func(t *testing.T) {
return func(t *testing.T) {

providedActivationEpoch := uint32(1)
alterConfigsFunc := func(cfg *config.Configs) {
cfg.EpochConfig.EnableEpochs.FixRelayedBaseCostEnableEpoch = providedActivationEpoch
Expand Down
2 changes: 1 addition & 1 deletion node/chainSimulator/chainSimulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewChainSimulator(args ArgsChainSimulator) (*simulator, error) {
return NewBaseChainSimulator(ArgsBaseChainSimulator{
ArgsChainSimulator: args,
ConsensusGroupSize: configs.ChainSimulatorConsensusGroupSize,
MetaChainConsensusGroupSize: configs.ChainSimulatorConsensusGroupSize,
MetaChainConsensusGroupSize: args.MetaChainMinNodes,
})
}

Expand Down
19 changes: 15 additions & 4 deletions node/chainSimulator/chainSimulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ func TestNewChainSimulator(t *testing.T) {
NumOfShards: 3,
GenesisTimestamp: startTime,
RoundDurationInMillis: roundDurationInMillis,
RoundsPerEpoch: core.OptionalUint64{},
ApiInterface: api.NewNoApiInterface(),
MinNodesPerShard: 1,
MetaChainMinNodes: 1,
RoundsPerEpoch: core.OptionalUint64{
HasValue: true,
Value: 20,
},
ApiInterface: api.NewNoApiInterface(),
MinNodesPerShard: 3,
MetaChainMinNodes: 3,
})
require.Nil(t, err)
require.NotNil(t, chainSimulator)

for i := 0; i < 8; i++ {
err = chainSimulator.ForceChangeOfEpoch()
require.Nil(t, err)
}

err = chainSimulator.GenerateBlocks(50)
require.Nil(t, err)

time.Sleep(time.Second)

chainSimulator.Close()
Expand Down
4 changes: 0 additions & 4 deletions node/chainSimulator/components/coreComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ func CreateCoreComponents(args ArgsCoreComponentsHolder) (*coreComponentsHolder,
return nil, err
}

if err != nil {
return nil, err
}

argsEconomicsHandler := economics.ArgsNewEconomicsData{
TxVersionChecker: instance.txVersionChecker,
Economics: &args.EconomicsConfig,
Expand Down
13 changes: 6 additions & 7 deletions node/chainSimulator/configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/multiversx/mx-chain-go/common/factory"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/genesis/data"
"github.com/multiversx/mx-chain-go/integrationTests"
"github.com/multiversx/mx-chain-go/node"
"github.com/multiversx/mx-chain-go/node/chainSimulator/dtos"
"github.com/multiversx/mx-chain-go/sharding"
Expand Down Expand Up @@ -117,7 +116,6 @@ func CreateChainSimulatorConfigs(args ArgsChainSimulatorConfigs) (*ArgsConfigsSi

// set compatible trie configs
configs.GeneralConfig.StateTriesConfig.SnapshotsEnabled = false

// enable db lookup extension
configs.GeneralConfig.DbLookupExtensions.Enabled = true

Expand All @@ -138,15 +136,16 @@ func CreateChainSimulatorConfigs(args ArgsChainSimulatorConfigs) (*ArgsConfigsSi
configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].ShardMinNumNodes = args.MinNodesPerShard
configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].MetachainMinNumNodes = args.MetaChainMinNodes
configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].MetachainConsensusGroupSize = args.MetaChainConsensusGroupSize
configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].ShardConsensusGroupSize = args.ConsensusGroupSize
if idx == 1 {
configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].ShardConsensusGroupSize = args.MinNodesPerShard
} else {
configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].ShardConsensusGroupSize = args.ConsensusGroupSize
}

configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].RoundDuration = args.RoundDurationInMillis
configs.GeneralConfig.GeneralSettings.ChainParametersByEpoch[idx].Hysteresis = args.Hysteresis
}

// TODO[Sorin]: remove this once all equivalent messages PRs are merged
configs.EpochConfig.EnableEpochs.EquivalentMessagesEnableEpoch = integrationTests.UnreachableEpoch
configs.EpochConfig.EnableEpochs.FixedOrderInConsensusEnableEpoch = integrationTests.UnreachableEpoch

node.ApplyArchCustomConfigs(configs)

if args.AlterConfigsFunction != nil {
Expand Down
Loading