#37202 [SC-Insight] some checks can be removed since its not required(best practice report, not an issue)
Was this helpful?
Was this helpful?
Submitted on Nov 28th 2024 at 18:19:54 UTC by @zeroK for
Report ID: #37202
Report Type: Smart Contract
Report severity: Insight
Target: https://github.com/Hydrogen-Labs/fluid-protocol/tree/main/contracts/trove-manager-contract/src/main.sw
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
in the function liquidate, there is a check that make sure the borrower trove is in active statue, however this check is not necessary since this check executes in require_all_troves_are_active when the internal_batch_liquidate_troves
executed, this is not an issue and can be accepted as best practice or closed by the team( we let the judgment to the teams).
the function liquidate implemented as below:
as it shown above, it checks if the borrower trove is active and then call to internal_batch_liquidate_troves invoked which checks for the same thing for each borrower(or one borrower in case of one borrower liquidated):
the check in liquidate can be removed since the check will be executed in the internal function anyway.
double checking for active borrower is not necessary when liquidating users.
remove the check in the liquidate function(optional)
there is no POC to be created to show best practice reports in this case.