15,000 USDC
View results
Submission Details
Severity: gas
Valid

The nonReentrant modifier should occur before all other modifiers

Summary

Best practice for the re-entry issue is to have non-entrancy come first in the modifier order.

This rule is not applied in the following 4 functions

Vulnerability Details

src/DSCEngine.sol:
148 */
149: function depositCollateral(address tokenCollateralAddress, uint256 amountCollateral)
150: public
151: moreThanZero(amountCollateral)
152: isAllowedToken(tokenCollateralAddress)
153: nonReentrant
154: {
src/DSCEngine.sol:
182 */
183: function redeemCollateral(address tokenCollateralAddress, uint256 amountCollateral)
184: public
185: moreThanZero(amountCollateral)
186: nonReentrant
187: {
src/DSCEngine.sol:
196 */
197: function mintDsc(uint256 amountDscToMint) public moreThanZero(amountDscToMint) nonReentrant {
src/DSCEngine.sol:
228 */
229: function liquidate(address collateral, address user, uint256 debtToCover)
230: external
231: moreThanZero(debtToCover)
232: nonReentrant
233: {

Impact

Tools Used

Manuel Code Review

Recommendations

Put the nonReentrant modifier first, this is best practice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!