Omniscia fetchai Audit
PoolStorageBase Manual Review Findings
PoolStorageBase Manual Review Findings
PSB-01M: Manual Deletion of Struct Members
Type | Severity | Location |
---|---|---|
Code Style | Informational | PoolStorageBase.sol:L174, L176, L177 |
Description:
The clearLoan
function manually deletes the variables of the LoanDetails
struct, meaning that in case of a future update some variables may be left unwritten.
Example:
contracts/ALP/PoolStorageBase.sol
174LoanDetails storage details = loans[account][actId];175iSCTotal = iSCTotal.sub(details.iSCAmount);176details.iSCAmount = 0;177details.actAmount = 0;
Recommendation:
We advise the delete
operation to be utilized instead to ensure all members of the LoanDetails
struct current and future will be deleted by the clearLoan
function.
Alleviation:
The delete
operation is now correctly utilized in the context of the function.