State Update After External Call – CEI Pattern Not Followed
In the buySnow
function, the contract performs an external call to a token contract (safeTransferFrom
) before updating internal state (s_earnTimer
). This violates the Checks-Effects-Interactions (CEI) pattern — a best practice in Solidity development used to prevent reentrancy attacks and ensure consistent contract state during execution.
Risk
Low in current implementation, as WETH is a safe and non-callback token.
Internal state (s_earnTimer
) is updated after an external call, breaking the CEI pattern.
Proof of Concept
To maintain best security hygiene and prevent future issues:
Always follow the CEI pattern: update state before making external calls.
Refactor the function to move s_earnTimer = block.timestamp;
before the external call:
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.