Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Missing Event Emission

Root + Impact

Description

  • The collectFee() function declares a FeeCollected() event but never emits it, reducing transparency and making it difficult to track when fees are collected.

  • The collectFee() function should emit a FeeCollected() event after successfully collecting fees to provide transparency and enable off-chain monitoring of fee collection activities.

// Root cause in the codebase with @> marks to highlight the relevant section
// @> Event is declared but never emitted
event FeeCollected();
function collectFee() external onlyCollector {
uint256 collection = i_weth.balanceOf(address(this));
i_weth.transfer(s_collector, collection);
(bool collected,) = payable(s_collector).call{value: address(this).balance}("");
require(collected, "Fee collection failed!!!");
// @> Missing: emit FeeCollected();
}

Risk

Likelihood:

  • Occurs every time collectFee() is called successfully

  • Affects all fee collection operations throughout the protocol lifecycle

Impact:

  • Reduced transparency for users and monitoring systems

  • Difficulty in tracking fee collection history and frequency

  • Inconsistent event emission pattern compared to other protocol functions

  • Potential compliance issues for protocols requiring audit trails

Proof of Concept

The below sets up a fee cllection scenario, then tries to collect fees but does not emit an event:

function testMissingEventEmission() public {
// Setup fee collection scenario
vm.deal(address(snow), 1 ether);
// Expect no events to be emitted
vm.recordLogs();
vm.prank(collector);
snow.collectFee();
Vm.Log[] memory logs = vm.getRecordedLogs();
// Verify FeeCollected event was not emitted
bool feeCollectedEmitted = false;
for (uint i = 0; i < logs.length; i++) {
if (logs[i].topics[0] == keccak256("FeeCollected()")) {
feeCollectedEmitted = true;
break;
}
}
assertFalse(feeCollectedEmitted); // Event not emitted despite successful collection
}

Recommended Mitigation

Recommend implementing an event emission in the collectFee() function after successfully collecting fees to provide transparency and enable off-chain monitoring of fee collection activities.

- remove this code
+ add this code
function collectFee() external onlyCollector {
uint256 collection = i_weth.balanceOf(address(this));
i_weth.transfer(s_collector, collection);
(bool collected,) = payable(s_collector).call{value: address(this).balance}("");
require(collected, "Fee collection failed!!!");
+
+ emit FeeCollected();
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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