diff --git a/docs/node-configuration.md b/docs/node-configuration.md index bbd7d4455..95a389b7c 100644 --- a/docs/node-configuration.md +++ b/docs/node-configuration.md @@ -363,7 +363,7 @@ protocol-related settings described in the table below. | StateRootInHeader | `bool` | `false` | Enables storing state root in block header. | Experimental protocol extension! | | StateSyncInterval | `int` | `40000` | The number of blocks between state heights available for MPT state data synchronization. | `P2PStateExchangeExtensions` should be enabled to use this setting. | | TimePerBlock | `Duration` | `15s` | Minimal (and targeted for) time interval between blocks. Must be an integer number of milliseconds. | -| ValidatorsCount | `int` | `0` | Number of validators set for the whole network lifetime, can't be set if `ValidatorsHistory` setting is used. | +| ValidatorsCount | `uint32` | `0` | Number of validators set for the whole network lifetime, can't be set if `ValidatorsHistory` setting is used. | | ValidatorsHistory | map[uint32]uint32 | none | Number of consensus nodes to use after given height (see `CommitteeHistory` also). Heights where the change occurs must be divisible by the number of committee members at that height. Can't be used with `ValidatorsCount` not equal to zero. | | VerifyBlocks | `bool` | `false` | This setting is deprecated and no longer works, please use `SkipBlockVerification` in the `ApplicationConfiguration`, it will be removed in future node versions. | | VerifyTransactions | `bool` | `false` | Denotes whether to verify transactions in the received blocks. | diff --git a/pkg/config/protocol_config.go b/pkg/config/protocol_config.go index 6dc745504..240d82288 100644 --- a/pkg/config/protocol_config.go +++ b/pkg/config/protocol_config.go @@ -82,7 +82,7 @@ type ( // TimePerBlock is the time interval between blocks that consensus nodes work with. // It must be an integer number of milliseconds. TimePerBlock time.Duration `yaml:"TimePerBlock"` - ValidatorsCount int `yaml:"ValidatorsCount"` + ValidatorsCount uint32 `yaml:"ValidatorsCount"` // Validators stores history of changes to consensus node number (height: number). ValidatorsHistory map[uint32]uint32 `yaml:"ValidatorsHistory"` // Whether to verify received blocks. @@ -125,7 +125,7 @@ func (p *ProtocolConfiguration) Validate() error { if p.ValidatorsCount != 0 && len(p.ValidatorsHistory) != 0 { return errors.New("configuration should either have ValidatorsCount or ValidatorsHistory, not both") } - if len(p.StandbyCommittee) < p.ValidatorsCount { + if len(p.StandbyCommittee) < int(p.ValidatorsCount) { return errors.New("validators count can't exceed the size of StandbyCommittee") } var arr = make([]heightNumber, 0, len(p.CommitteeHistory)) @@ -212,7 +212,7 @@ func getBestFromMap(dict map[uint32]uint32, height uint32) uint32 { // It implies valid configuration file. func (p *ProtocolConfiguration) GetNumOfCNs(height uint32) int { if len(p.ValidatorsHistory) == 0 { - return p.ValidatorsCount + return int(p.ValidatorsCount) } return int(getBestFromMap(p.ValidatorsHistory, height)) }