Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

State Change Without Event

Description: There are state variable changes in some functions like EggHuntGame::setEggFindThreshold (i.e., updating the eggFindThreshold) but no event is emitted to reflect these changes. Emitting events when state changes occur is essential for tracking contract interactions off-chain. Events allow external services and dApps to listen for specific changes in contract state, providing better transparency and traceability.

Impact: Lack of event emission makes it harder to track the contract’s state changes, which may lead to difficulties in building frontend applications. It also reduces the ability for external indexers or monitoring systems to track important contract activities.

Recommended Mitigation: Emit events whenever state changes happen. In this case, an event can be added to notify when new egg find threshold will be set:

+ event NewThresholdSet(uint256 newThreshold);
function setEggFindThreshold(uint256 newThreshold) external onlyOwner {
require(newThreshold <= 100, "Threshold must be <= 100");
eggFindThreshold = newThreshold;
+ emit NewThresholdSet(uint256 newThreshold);
}
Updates

Lead Judging Commences

m3dython Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Event Emission

Standard practice for clarifying important contract behaviors

Support

FAQs

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