The graduateAndUpgrade function in LevelOne distributes 40% of the bursary funds but fails to update the bursary state variable to reflect this distribution. This creates a critical state inconsistency where the bursary value remains at 100% while only 60% of funds actually remain in the contract. This accounting error persists into the LevelTwo contract, potentially causing severe issues with future fund management.
When funds are distributed during the upgrade process, the contract fails to update its internal accounting:
Key issues in this implementation:
Missing Accounting Update: After distributing 35% to teachers and 5% to principal (40% total), the bursary state variable is not decremented to reflect the reduced balance.
Incorrect State Carried Forward: The bursary state variable in LevelTwo inherits this incorrect value:
3.No Reconciliation Mechanism: The empty graduate() function in LevelTwo doesn't correct this inconsistency:
The bursary value is critical as it serves as the source of truth for available funds in the contract. With this discrepancy:
State shows 100% of original funds
Actual balance is only 60% of what's recorded in state
The severity is high because:
It creates a fundamental accounting error that persists across contract upgrades
It breaks the core financial accounting of the system
It could lead to attempted overdistribution of funds in future operations
It violates the invariant that contract state should accurately reflect token balances
The likelihood is high because:
The issue occurs in 100% of upgrade scenarios
There is no conditional path where this wouldn't happen
The upgrade process is a key feature of the system
The issue persists until a new implementation fixes it
Real-world impact scenarios:
If bursary incorrectly shows 1000 USDC when only 600 USDC exists, future functions attempting to distribute based on bursary would fail
Accounting reports based on chain data would show incorrect fund balances
Attempts to implement additional fund distribution logic in LevelTwo would operate with incorrect assumptions
Manual review of fund flow between contracts
Update Bursary State After Distribution:
2.Implement Proper Initialization in LevelTwo:
3.Add Balance Verification Function:
The bursary is not updated after wages have been paid in `graduateAndUpgrade()` function
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.