[L-2] CEI pattern not followed in withdrawWinnings
The withdrawWinnings function updates the state after making the external call to msg.sender. This
violates the Checks-Effects-Interactions (CEI) pattern, which is a standard best practice in Solidity to
prevent reentrancy issues and unexpected behavior.
While the function uses nonReentrant, following CEI adds defense-in-depth and makes the code more robust and auditable.
Impact:
1.In general, reentrancy is prevented by nonReentrant, so this is not a direct vulnerability.
2.However, future maintainers may remove the nonReentrant modifier or introduce new logic that becomes vulnerable.
3.Also, it increases the cognitive load of reasoning about state safety during audits or upgrades.
Update the state before the external call:
We only audit the current code in scope. We cannot make speculation with respect to how this codebase will evolve in the future. For now there is a nonReentrant modifier which mitigates any reentrancy. CEI is a good practice, but it's not mandatory. Informational
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.