Assessment reports>StaFi>Threat Models>checkAndWithdrawRewards

Function: checkAndWithdrawRewards(uint256 _validators)

Allows the stake manager to withdraw rewards.

Inputs

  • _validators

    • Control: Fully controlled by the stake manager.

    • Constraints: None.

    • Impact: The validators to withdraw rewards from.

Branches and code coverage (including function calls)

Intended branches

  • Allow withdrawing the rewards from the given validators.

  • Verify that the validators are legitimate.

Negative behavior

  • Should not be callable by anyone other than the stake manager. Ensured through onlyStakeManager.

  • Should not allow calling the same validator twice --- in other words, assumed that the validator's contract will return a different liquid reward if called multiple times.

  • Should not allow calling it with illegitimate parameters. Not specifically checked --- it also depends on the ValidatorShare's implementation.

Function call analysis

  • govStakeManager.getValidatorContract(_validators[j])

    • What is controllable? _validators[j].

    • If return value controllable, how is it used and how can it go wrong? N/A; returns the validator contract address.

    • What happens if it reverts, reenters, or does other unusual control flow? Assumed it will revert if the validator is not valid.

  • IValidatorShare(valAddress).getLiquidRewards(address(this))

    • What is controllable? valAddress partly.

    • If return value controllable, how is it used and how can it go wrong? N/A; returns the liquid rewards.

    • What happens if it reverts, reenters, or does other unusual control flow? Assumed it will revert if the validator is not valid.

  • IValidatorShare(valAddress).buyVoucher(0, 0)

    • What is controllable? valAddress partly.

    • If return value controllable, how is it used and how can it go wrong? Returns the amountToDeposit, which is currently not checked.

    • What happens if it reverts, reenters, or does other unusual control flow? None.

Zellic © 2024Back to top ↑