The graduateAndUpgrade()
function in LevelOne.sol
fails to enforce several protocol-critical invariants before authorizing a system upgrade. This omission introduces significant risks of protocol corruption, misaligned payment logic, and broken progression rules.
The function unconditionally calls _authorizeUpgrade()
and proceeds with fund distribution — all without verifying:
if the school session has ended (i.e., sessionEnd
is reached),
whether each student received the required 4 weekly reviews,
whether each student has met the cutOffScore
to graduate,
and if payments occur after a valid time period (i.e., every 4 weeks).
These checks are foundational to the protocol’s integrity and were explicitly documented as invariants.
This results in:
Time-based session integrity loss: upgrades can be triggered at any time, even during an active session. The sessionEnd
is declared but never used to enforce session completion.
Invalid graduation: students may be upgraded without completing the required reviews or meeting the cutOffScore
, completely bypassing the educational logic.
Upgrade misuse: Upgrades should be a reward mechanism after a validated session. Without these guards, malicious or negligent principals can skip progression logic and steal funds.
Require that block.timestamp >= sessionEnd
before allowing upgrade.
Validate that all students have exactly 4 reviews.
Enforce cutOffScore
for all students before graduation.
Emit an Upgraded(address)
event to track the upgrade.
Component | Reason |
---|---|
Impact: High | Funds can be misused; logic broken. |
Likelihood: High | All checks are currently missing; easily exploitable by the principal. |
Confidence: High | Code review and invariants documentation confirm the issues. |
Manual Review
All students are graduated when the graduation function is called as the cut-off criteria is not applied.
`graduateAndUpgrade()` can be called successfully even when the school session has not ended
Event not emitted
All students are graduated when the graduation function is called as the cut-off criteria is not applied.
`graduateAndUpgrade()` can be called successfully even when the school session has not ended
Event not emitted
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.