#36309 [SC-Low] TimeBasedCollateralPool: After _resetPool gets called (internally) a depositor can b
Description
Brief/Intro
Vulnerability Details
ContractState storage contractStateStorage = tokenContractState[_tokenAddress];
uint256 unitsToReset = contractStateStorage.totalUnits;
if (unitsToReset == 0) {
// This already has the state that a reset would achieve, so it's not required.
return;
}
// NB: must be resetNonce++, NOT ++resetNonce
uint256 resetNonce = contractStateStorage.resetNonce++;
uint256 tokensToReset;
{
uint96 reservationId = contractStateStorage.collateralReservationId;
if (reservationId != 0) {
// Unlock all pool tokens so they are releasable.
tokensToReset = collateral.releaseAllCollateral(reservationId);
contractStateStorage.collateralReservationId = 0;
}
}
// Only set an Exit balance if there is one. If all tokens were claimed, then effectively set (0,0).
if (tokensToReset > 0) {
// Create the reset ExitBalance so stakers can exit their tokens (see: _resetAccountTokenStateIfApplicable(...))
tokenResetExitBalances[_tokenAddress][resetNonce] = ExitBalance(unitsToReset, tokensToReset);
}
// Delete all contract-level pending unstake state.
if (contractStateStorage.firstPendingUnstakeEpoch > 0) {
contractStateStorage.firstPendingUnstakeEpoch = 0;
contractStateStorage.firstPendingUnstakeUnits = 0;
if (contractStateStorage.secondPendingUnstakeEpoch > 0) {
contractStateStorage.secondPendingUnstakeEpoch = 0;
contractStateStorage.secondPendingUnstakeUnits = 0;
}
}
contractStateStorage.totalUnits = 0;
emit PoolReset(IERC20(_tokenAddress), resetNonce + 1, tokensToReset, unitsToReset);
}Impact Details
Proof of Concept
Previous#36340 [SC-Insight] TimeBasedCollateralPool::_resetAccountTokenStateIfApplicable does not adjust tokNextAnvil: Letters of Credit
Last updated
Was this helpful?