In PositionStatus.sol, when not finding the next reserve the user an user is borrowing or using as collateral, we return PositionStatus.NOT_FOUND, which is type(uint256).max.
In Spoke:_calculateAndPotentiallyRefreshUserAccountData() and Spoke:_notifyRiskPremiumUpdate(), where we use PositionStatus:next() to find the next reserve, when receiving PositionStatus.NOT_FOUND we exit the loops.
But in the case type(uint256).max would be the latests Reserve listed, and so a valid ReserveId, that an user set as collateral or is borrowing, we'd exit the loop due to next() return value, instead of iterating like expected.
Solution :
Add a new condition in Spoke:addReserve() to prevent that the new listed reserve's id is type(uint256).max.
In PositionStatus.sol, when not finding the next reserve the user an user is borrowing or using as collateral, we return
PositionStatus.NOT_FOUND, which istype(uint256).max.In
Spoke:_calculateAndPotentiallyRefreshUserAccountData()andSpoke:_notifyRiskPremiumUpdate(), where we usePositionStatus:next()to find the next reserve, when receivingPositionStatus.NOT_FOUNDwe exit the loops.But in the case
type(uint256).maxwould be the latests Reserve listed, and so a valid ReserveId, that an user set as collateral or is borrowing, we'd exit the loop due tonext()return value, instead of iterating like expected.Solution :
Add a new condition in
Spoke:addReserve()to prevent that the new listed reserve's id istype(uint256).max.