Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Modifier Order: Placing `nonReentrant` at the End of the Modifier List Is Safe

Modifier Order: Placing nonReentrant at the End of the Modifier List Is Safe

Description

  • In Solidity, modifiers are executed in top-to-bottom order, as listed in the function signature.

  • The function claimThrone() uses multiple modifiers in the following order:

function claimThrone() external payable gameNotEnded @>nonReentrant<@ {

Risk

Likelihood:

  • This is a non-issue in this case, but misunderstanding of modifier order is common.

  • Risk increases only if modifiers change state in ways that affect each other — which is not true here.

Impact:

  • To protect against reentrancy in other modifiers, the `nonReentrant` modifier should be the first modifier in the list of modifiers.

Proof of Concept

function claimThrone() external payable gameNotEnded nonReentrant {
...
}
// Execution order:
// 1. gameNotEnded modifier
// 2. nonReentrant modifier (sets mutex)
// 3. Function body (protected by mutex)

Recommended Mitigation

- function claimThrone() external payable gameNotEnded nonReentrant {
+ function claimThrone() external payable nonReentrant gameNotEnded {
Updates

Appeal created

inallhonesty Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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