Skip to content

Commit

Permalink
rename and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Jun 10, 2024
1 parent e423508 commit 5577c9d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 53 deletions.
40 changes: 20 additions & 20 deletions node/chainSimulator/chainSimulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ type ArgsChainSimulator struct {

type ArgsBaseChainSimulator struct {
ArgsChainSimulator
ConsensusGroupSize uint32
MetaConsensusGroupSize uint32
ConsensusGroupSize uint32
MetaChainConsensusGroupSize uint32
}

type simulator struct {
Expand All @@ -81,9 +81,9 @@ type simulator struct {
// NewChainSimulator will create a new instance of simulator
func NewChainSimulator(args ArgsChainSimulator) (*simulator, error) {
return NewBaseChainSimulator(ArgsBaseChainSimulator{
ArgsChainSimulator: args,
ConsensusGroupSize: configs.ChainSimulatorConsensusGroupSize,
MetaConsensusGroupSize: configs.ChainSimulatorConsensusGroupSize,
ArgsChainSimulator: args,
ConsensusGroupSize: configs.ChainSimulatorConsensusGroupSize,
MetaChainConsensusGroupSize: configs.ChainSimulatorConsensusGroupSize,
})
}

Expand All @@ -109,20 +109,20 @@ func NewBaseChainSimulator(args ArgsBaseChainSimulator) (*simulator, error) {

func (s *simulator) createChainHandlers(args ArgsBaseChainSimulator) error {
outputConfigs, err := configs.CreateChainSimulatorConfigs(configs.ArgsChainSimulatorConfigs{
NumOfShards: args.NumOfShards,
OriginalConfigsPath: args.PathToInitialConfig,
GenesisTimeStamp: computeStartTimeBaseOnInitialRound(args.ArgsChainSimulator),
RoundDurationInMillis: args.RoundDurationInMillis,
TempDir: args.TempDir,
MinNodesPerShard: args.MinNodesPerShard,
MetaChainMinNodes: args.MetaChainMinNodes,
RoundsPerEpoch: args.RoundsPerEpoch,
InitialEpoch: args.InitialEpoch,
ConsensusGroupSize: args.ConsensusGroupSize,
MetaConsensusGroupSize: args.MetaConsensusGroupSize,
AlterConfigsFunction: args.AlterConfigsFunction,
NumNodesWaitingListShard: args.NumNodesWaitingListShard,
NumNodesWaitingListMeta: args.NumNodesWaitingListMeta,
NumOfShards: args.NumOfShards,
OriginalConfigsPath: args.PathToInitialConfig,
GenesisTimeStamp: computeStartTimeBaseOnInitialRound(args.ArgsChainSimulator),
RoundDurationInMillis: args.RoundDurationInMillis,
TempDir: args.TempDir,
MinNodesPerShard: args.MinNodesPerShard,
ConsensusGroupSize: args.ConsensusGroupSize,
MetaChainMinNodes: args.MetaChainMinNodes,
MetaChainConsensusGroupSize: args.MetaChainConsensusGroupSize,
RoundsPerEpoch: args.RoundsPerEpoch,
InitialEpoch: args.InitialEpoch,
AlterConfigsFunction: args.AlterConfigsFunction,
NumNodesWaitingListShard: args.NumNodesWaitingListShard,
NumNodesWaitingListMeta: args.NumNodesWaitingListMeta,
})
if err != nil {
return err
Expand Down Expand Up @@ -209,7 +209,7 @@ func (s *simulator) createTestNode(
MinNodesPerShard: args.MinNodesPerShard,
ConsensusGroupSize: args.ConsensusGroupSize,
MinNodesMeta: args.MetaChainMinNodes,
MetaChainConsensusGroupSize: args.MetaConsensusGroupSize,
MetaChainConsensusGroupSize: args.MetaChainConsensusGroupSize,
RoundDurationInMillis: args.RoundDurationInMillis,
}

Expand Down
18 changes: 9 additions & 9 deletions node/chainSimulator/components/testOnlyProcessingNode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ var expectedErr = errors.New("expected error")

func createMockArgsTestOnlyProcessingNode(t *testing.T) ArgsTestOnlyProcessingNode {
outputConfigs, err := configs.CreateChainSimulatorConfigs(configs.ArgsChainSimulatorConfigs{
NumOfShards: 3,
OriginalConfigsPath: "../../../cmd/node/config/",
GenesisTimeStamp: 0,
RoundDurationInMillis: 6000,
TempDir: t.TempDir(),
MinNodesPerShard: 1,
MetaChainMinNodes: 1,
ConsensusGroupSize: 1,
MetaConsensusGroupSize: 1,
NumOfShards: 3,
OriginalConfigsPath: "../../../cmd/node/config/",
GenesisTimeStamp: 0,
RoundDurationInMillis: 6000,
TempDir: t.TempDir(),
MinNodesPerShard: 1,
MetaChainMinNodes: 1,
ConsensusGroupSize: 1,
MetaChainConsensusGroupSize: 1,
})
require.Nil(t, err)

Expand Down
30 changes: 15 additions & 15 deletions node/chainSimulator/configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ const (

// ArgsChainSimulatorConfigs holds all the components needed to create the chain simulator configs
type ArgsChainSimulatorConfigs struct {
NumOfShards uint32
OriginalConfigsPath string
GenesisTimeStamp int64
RoundDurationInMillis uint64
TempDir string
MinNodesPerShard uint32
MetaChainMinNodes uint32
InitialEpoch uint32
ConsensusGroupSize uint32
MetaConsensusGroupSize uint32
RoundsPerEpoch core.OptionalUint64
NumNodesWaitingListShard uint32
NumNodesWaitingListMeta uint32
AlterConfigsFunction func(cfg *config.Configs)
NumOfShards uint32
OriginalConfigsPath string
GenesisTimeStamp int64
RoundDurationInMillis uint64
TempDir string
MinNodesPerShard uint32
ConsensusGroupSize uint32
MetaChainMinNodes uint32
MetaChainConsensusGroupSize uint32
InitialEpoch uint32
RoundsPerEpoch core.OptionalUint64
NumNodesWaitingListShard uint32
NumNodesWaitingListMeta uint32
AlterConfigsFunction func(cfg *config.Configs)
}

// ArgsConfigsSimulator holds the configs for the chain simulator
Expand Down Expand Up @@ -281,7 +281,7 @@ func generateValidatorsKeyAndUpdateFiles(
nodes.StartTime = args.GenesisTimeStamp

nodes.ConsensusGroupSize = args.ConsensusGroupSize
nodes.MetaChainConsensusGroupSize = args.MetaConsensusGroupSize
nodes.MetaChainConsensusGroupSize = args.MetaChainConsensusGroupSize
nodes.Hysteresis = 0

nodes.MinNodesPerShard = args.MinNodesPerShard
Expand Down
18 changes: 9 additions & 9 deletions node/chainSimulator/configs/configs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ func TestNewProcessorRunnerChainArguments(t *testing.T) {
}

outputConfig, err := CreateChainSimulatorConfigs(ArgsChainSimulatorConfigs{
NumOfShards: 3,
OriginalConfigsPath: "../../../cmd/node/config",
RoundDurationInMillis: 6000,
GenesisTimeStamp: 0,
TempDir: t.TempDir(),
MetaChainMinNodes: 1,
MinNodesPerShard: 1,
ConsensusGroupSize: 1,
MetaConsensusGroupSize: 1,
NumOfShards: 3,
OriginalConfigsPath: "../../../cmd/node/config",
RoundDurationInMillis: 6000,
GenesisTimeStamp: 0,
TempDir: t.TempDir(),
MetaChainMinNodes: 1,
MinNodesPerShard: 1,
ConsensusGroupSize: 1,
MetaChainConsensusGroupSize: 1,
})
require.Nil(t, err)

Expand Down

0 comments on commit 5577c9d

Please sign in to comment.