Function: registerValidator()
This allows the registration of a validator for the Modeler contract.
Branches and code coverage
Intended branches
Should add the caller to the
validatorAddressesarray. Currently not performed as theappendis not reachable.Should increase the
currentStakeof the validator byvalidatorStakeAmount. Currently not performed as it is set to the stake amount, rather than increased.Set the
optOutTimeto~uint256(0). Assumes that this is intended for the rest of the contract/system to work properly.Check whether
msg.senderhas already deposited thevalidatorStakeAmountin the contract. Currently not performed.Set
msg.senderas a registered validator.Should decrease the
validatorTokenbalance of the caller byvalidatorStakeAmount.
Negative behavior
Should not allow everyone to register as a validator. Currently not performed due to one of the issues described in the audit report.
Should not allow the addition of a validator if the
validatorAddressesarray's length is overMAX_VALIDATORS.