Assessment reports>Spectral Modelers>Threat Model>registerValidator

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 the append is not reachable.

  • Should increase the currentStake of the validator by validatorStakeAmount. 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 the validatorStakeAmount in the contract. Currently not performed.

  • Set msg.sender as a registered validator.

  • Should decrease the validatorToken balance of the caller by validatorStakeAmount.

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 over MAX_VALIDATORS.

Zellic © 2024Back to top ↑