removeOperators function in the OperatorStakingPool has an issue in the way operators are removed. This can affect the removal process.
Take a look at the removeOperators function of the OperatorStakingPool contract. Especially in the loop that removes operators from the operators array:
https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/linkStaking/OperatorStakingPool.sol#L163-L184
The issue lies in the inner loop. When an operator is found and removed, it's replaced by the last element of the array. But, the loop continues to the next index without rechecking the newly swapped element. This could cause operators to be skipped if they were moved to a position that has already been checked.
This issue could cause incomplete removal of operators. If multiple operators are to be removed, and one of the later operators in the removal list is swapped into a position that has already been checked, it will not be removed. This could result in unauthorized operators retaining their status.
Manual review
The inner loop in the removeOperators function should be modified to recheck the same index after a swap occurs.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.