The user's can get removed unintentionally from the holders
array and will not receive their rewards generated from liquidation or from interest gained on their staked TST token.
If the user has staked their tokens inside LiquidationPool must be present in the holders
array, but due to a mishandling inside the LiquidationPool::decreasePosition
function, a user can get removed from the mentioned array.
The vulnerability lies inside the LiquidationPool
contract inside the decreasePosition
function at line 161, where the user is removed from holders
array when their position of both token is 0.
But consider the case where no doubt the user's position of both token became 0, but they still have position inside the pendingStakes
and when their position is consolidated they are not added inside the holders
array leading to isolating the stakers from earning rewards and EUROs gain on their staked TST.
Stakers will not be able to receive rewards and EUROs gain based on their staked TST as they were unintentionally removed from the holders
array.
The likelihood of this happening is kind of medium as it may happen that user first staked some amount of EUROs and after 24 hrs they staked TST and removed their EUROs, but when they removed whole of their EUROs they are removed from the holders
array but still they have position inside the pendingStake
and again after 24 hrs when their TST will be consolidated they are not added to the holders
array.
Add the below test inside test/liquidationPool.js
Run the test:
Manual Review
1 Before deleting the user inside the decreasePosition
function, consider checking if they have pending stake inside the pendingStakes
array and if they have pending stake then don't delete them from holders
array.
Alternatively,
2 Add the user by calling the addUniqueHolder
function when a user's pending stake is consolidated.
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.