Eggstravaganza

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

Missing Event for Important State Change in the setEggFindThreshold function in EggHuntGame.sol

Summary

In the EggHuntGame.sol contract, the setEggFindThreshold function changes a critical game parameter but doesn't emit an event.

Vulnerability Details

While startGame and endGame emit events, setEggFindThreshold does not emit an event to log the change. Thus, when the owner changes this important parameter, there is no on-chain record.

Impact

There is a lack of transparency here, potential for unfair advantage, and reduced trust in the protocol and its owner.

Tools Used

Manual code review.

Recommendations

Add a new event at the top of the EggHuntGame.sol contract plus emit the same event within the setEggFindThreshold function:

// Add this event declaration
event EggFindThresholdChanged(uint256 oldThreshold, uint256 newThreshold);
// Modify the function to emit the event
function setEggFindThreshold(uint256 newThreshold) external onlyOwner {
require(newThreshold <= 100, "Threshold must be <= 100");
uint256 oldThreshold = eggFindThreshold;
eggFindThreshold = newThreshold;
emit EggFindThresholdChanged(oldThreshold, newThreshold);
}
Updates

Lead Judging Commences

m3dython Lead Judge 4 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.