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
validatorAddresses
array. Currently not performed as theappend
is not reachable.Should increase the
currentStake
of the validator byvalidatorStakeAmount
. Currently not performed as it is set to the stake amount, rather than increased.Set the
optOutTime
to~uint256(0)
. Assumes that this is intended for the rest of the contract/system to work properly.Check whether
msg.sender
has already deposited thevalidatorStakeAmount
in the contract. Currently not performed.Set
msg.sender
as a registered validator.Should decrease the
validatorToken
balance 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
validatorAddresses
array's length is overMAX_VALIDATORS
.