Inconsistent update of lastDefaultInterestUpdate
in TroveManager.sol:_resetState
The TroveManager contract contains a function named _resetState
that includes the statement lastDefaultInterestUpdate = block.timestamp;
. However, further down in the same function, the variable lastDefaultInterestUpdate
is updated to zero (lastDefaultInterestUpdate = 0;
).
As a result, the initial assignment to block.timestamp
does not have any practical effect on the contract's behavior. As the value of defaultedDebt
is set to 0, the last default interest is updated at block.timestamp
; therefore, the statement lastDefaultInterestUpdate = 0;
should be removed from the function.
function _resetState() private {
if (TroveOwners.length == 0) {
activeInterestIndex = INTEREST_PRECISION;
lastActiveIndexUpdate = block.timestamp;
lastDefaultInterestUpdate = block.timestamp;
totalStakes = 0;
totalStakesSnapshot = 0;
totalCollateralSnapshot = 0;
L_collateral = 0;
L_debt = 0;
lastDefaultInterestUpdate = 0;
lastCollateralError_Redistribution = 0;
lastDebtError_Redistribution = 0;
totalActiveCollateral = 0;
totalActiveDebt = 0;
defaultedCollateral = 0;
defaultedDebt = 0;
}
}