[N-01] The nonReentrantmodifier should occur before all other modifiers
Summary
This is a best-practice to protect against reentrancy in other modifiers.
Vulnerability Detail
When developing smart contracts in Solidity, prioritizing security is crucial to prevent vulnerabilities like reentrancy attacks. These attacks exploit a contract's recursive behavior to manipulate it and potentially drain funds. To address this, thenonReentrant modifier is commonly employed as a protective measure, acting as a lock to prevent recursive function calls during execution. To ensure its effectiveness, it is essential to place thenonReentrant modifier at the beginning of a function, before any other modifiers, to prevent bypassing of the reentrancy protection.
Impact
While there is no obvious vulnerability currently with nonreentrant not being the first modifier in the list, it is safer to place it in the first.
FaisalAli
medium
[N-01] The
nonReentrant
modifier
should occur before all other modifiersSummary
This is a best-practice to protect against reentrancy in other modifiers.
Vulnerability Detail
When developing smart contracts in Solidity, prioritizing security is crucial to prevent vulnerabilities like reentrancy attacks. These attacks exploit a contract's recursive behavior to manipulate it and potentially drain funds. To address this, the
nonReentrant
modifier is commonly employed as a protective measure, acting as a lock to prevent recursive function calls during execution. To ensure its effectiveness, it is essential to place thenonReentrant
modifier at the beginning of a function, before any other modifiers, to prevent bypassing of the reentrancy protection.Impact
While there is no obvious vulnerability currently with nonreentrant not being the first modifier in the list, it is safer to place it in the first.
Code Snippet
Tool used
Manual Review
Recommendation
It is recommended to place the
nonReentrant
modifier at the beginning of a function, before any other modifiers.