crates/lint/docs/non-reentrant-not-first.md
Severity: Med
ID: non-reentrant-not-first
Flags functions where an OpenZeppelin-style nonReentrant modifier is present but is not the first
modifier in the modifier list.
Reports a function, fallback, or receive function when nonReentrant appears after another
modifier, for example onlyOwner nonReentrant.
The lint is intentionally narrow: it only checks modifier ordering and only matches a modifier named
nonReentrant.
Solidity applies modifiers in the order they are written. If another modifier runs before
nonReentrant, that modifier's pre-body logic executes before the reentrancy guard is entered. For
guarded external entry points, placing nonReentrant first keeps the reentrancy lock as the first
piece of modifier logic.
function withdraw(uint256 amount) external onlyOwner nonReentrant {
_withdraw(amount);
}
function withdraw(uint256 amount) external nonReentrant onlyOwner {
_withdraw(amount);
}