in the getActiveDeposits
function in the FjordStaking contract:
The function returns all epochs where a user has deposits, including those that may no longer be active (i.e., fully unstaked or past the lock period).
There's no mechanism to remove epochs from _activeDeposits
when a deposit becomes inactive.
This could lead to misleading results if users or other contracts rely on this function to determine truly "active" deposits.
The _activeDeposits
set is only updated when deposits are added or fully removed, not when they become unstakable.
The unstake
function doesn't remove epochs from _activeDeposits
if there's still a vested stake, even if the regular stake is fully withdrawn.
The unstakeAll
function correctly updates _activeDeposits
, but individual unstake
calls might leave stale epochs.
Users or external contracts relying on getActiveDeposits
might misinterpret the state of deposits.
This could lead to incorrect calculations or decisions based on presumed "active" deposits.
User stakes in epoch 1.
6 epochs pass.
User unstakes all non-vested tokens.
getActiveDeposits
still shows epoch 1 as active, even though it's fully unstakable.
Manual review
To fix this, the contract should update _activeDeposits
when deposits become inactive, either through full unstaking or when the lock period ends.
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.