QA Report #153
Labels
bug
Something isn't working
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Table of Contents:
approve
should be replaced withsafeApprove
orsafeIncreaseAllowance() / safeDecreaseAllowance()
DemandMinerV2.setFeeConfig()
should be upper-bounded[L-01]
approve
should be replaced withsafeApprove
orsafeIncreaseAllowance() / safeDecreaseAllowance()
approve
is subject to a known front-running attack. Consider usingsafeApprove
instead:Keep in mind though that it would be actually better to replace safeApprove() with safeIncreaseAllowance() or safeDecreaseAllowance().
See this discussion: SafeERC20.safeApprove() Has unnecessary and unsecure added behavior
[L-02] Add constructor initializers
As per OpenZeppelin’s (OZ) recommendation, “The guidelines are now to make it impossible for anyone to run
initialize
on an implementation contract, by adding an empty constructor with theinitializer
modifier. So the implementation contract gets initialized automatically upon deployment.”Note that this behaviour is also incorporated the OZ Wizard since the UUPS vulnerability discovery: “Additionally, we modified the code generated by the Wizard 19 to include a constructor that automatically initializes the implementation when deployed.”
Furthermore, this thwarts any attempts to frontrun the initialization tx of these contracts:
[L-03] Missing address(0) checks
According to Slither:
[L-04] Add a timelock to critical functions
It is a good practice to give time for users to react and adjust to critical changes. A timelock provides more guarantees and reduces the level of trust required, thus decreasing risk for users. It also indicates that the project is legitimate (less risk of a malicious Manager making a frontrunning/sandwich attack on the fees).
Consider adding a timelock to:
[L-05] Fee in
DemandMinerV2.setFeeConfig()
should be upper-bounded[N-01] Unused named returns
Using both named returns and a return statement isn't necessary. Removing one of those can improve code clarity:
[N-02] Useless import: SafeMath
[N-03] The visibility for constructor is ignored
The text was updated successfully, but these errors were encountered: