Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

Missing `Graduated` Event Emission in `graduateAndUpgrade`

Summary

This report identifies a minor omission in the graduateAndUpgrade() function of the LevelOne.sol contract. While a Graduated event is defined within the contract, presumably to signify the successful authorization of an upgrade to a new contract version (_levelTwo), this event is not actually emitted by the graduateAndUpgrade() function upon successful execution. Emitting events for such significant actions is crucial for off-chain monitoring, transparency, and enabling dApps or UIs to react to contract state changes.

Vulnerability Details / Issue Description

The LevelOne.sol contract defines the following event:

// From src/LevelOne.sol
event Graduated(address indexed levelTwo);

This event is intended to be emitted when the system is ready to "graduate" to the LevelTwo contract, which is authorized within the graduateAndUpgrade function.

The graduateAndUpgrade function performs payouts and authorizes the contract upgrade:

// From src/LevelOne.sol
function graduateAndUpgrade(address _levelTwo, bytes memory /* _data */) public onlyPrincipal {
// ... (input validation) ...
// ... (payout calculations) ...
_authorizeUpgrade(_levelTwo);
// ... (payout execution) ...
// OMISSION: The Graduated event is not emitted here.
}

After successfully executing payouts and calling _authorizeUpgrade(_levelTwo), the function completes without emitting the Graduated event. This means off-chain services or user interfaces listening for this event will not be notified when the contract has authorized an upgrade to the _levelTwo address.

Tools Used

Manual Code Review

Recommendations

To enhance transparency and facilitate off-chain monitoring, the Graduated event should be emitted at the end of the graduateAndUpgrade function, after all critical operations (like payouts and _authorizeUpgrade) have successfully completed.

Updates

Lead Judging Commences

yeahchibyke Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

no event

Event not emitted

yeahchibyke Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

no event

Event not emitted

Support

FAQs

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