-
Notifications
You must be signed in to change notification settings - Fork 0
Description
[N-4] The nonReentrant modifier should occur before all other modifiers
Comments
It is considered a good practice to put it before all other modifiers for the following reasons:
Safety: Putting the nonReentrant modifier before all other modifiers ensures that it is the first modifier to be checked before any other modifier is executed. This can prevent unintended or malicious behavior in the function and can ensure the safety and security of the contract.
Readability: Placing the nonReentrant modifier before all other modifiers can improve the readability and clarity of the code. It makes it clear that the nonReentrant modifier is a critical part of the function's security and functionality, and allows developers to easily understand the purpose and behavior of the function.
Consistency: By placing the nonReentrant modifier before all other modifiers, developers can maintain consistency in their code. This ensures that the nonReentrant modifier is always checked first, regardless of the function or the context in which it is used.
Avoids Unintended Interactions: By placing the nonReentrant modifier before all other modifiers, you can avoid unintended interactions between the nonReentrant modifier and other modifiers. For example, if the nonReentrant modifier is placed after a modifier that modifies the state of the contract, it can cause unexpected behavior and even introduce security vulnerabilities.
Instances
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L164
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L182
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L220
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L248
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L329
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L442
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L456
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L482
https://github.com/code-423n4/2023-04-eigenlayer/blob/5e4872358cd2bda1936c29f460ece2308af4def6/src/contracts/core/StrategyManager.sol#L536