Trick or Treat

First Flight #27
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Missing Event Indexing in feeWithdrawal function

Summary

The withdrawFees function is designed to allow the contract owner to withdraw all fees from the contract's balance. However, the associated event FeeWithdrawn lacks indexed parameters, making it difficult to efficiently filter and search for this event in the blockchain logs.

function withdrawFees() public onlyOwner {
uint256 balance = address(this).balance;
payable(owner()).transfer(balance);
emit FeeWithdrawn(owner(), balance);
}

Vulnerability Details

The event FeeWithdrawn(address owner, uint256 amount) does not include an indexed parameter, making it harder for external tools to efficiently query and filter events based on the owner's address or the amount withdrawn.

Events without indexed parameters are less useful for off-chain applications that rely on event data.

Indexing parameters allows external users or applications to filter specific events efficiently on the blockchain

Line Highlight:

event FeeWithdrawn(address owner, uint256 amount); // No indexed parameters

Impact

Reduced Query Efficiency: The absence of indexed parameters makes it harder for off-chain systems (such as block explorers or dApps) to search and filter events by specific criteria (e.g., owner’s address).

Missed Opportunities for Filtering: Indexed parameters enable more efficient event filtering, which is especially important for tracking ownership and transaction amounts

Tools Used

Manual Review

Recommendations

  1. Add Indexing to Event Parameters: Add the indexed keyword to the owner parameter to enable efficient searching and filtering by the owner's address.

Corrected Code:

event FeeWithdrawn(address indexed owner, uint256 amount); // Indexed owner for better filtering
function withdrawFees() public onlyOwner {
uint256 balance = address(this).balance;
payable(owner()).transfer(balance);
emit FeeWithdrawn(owner(), balance);
}

By indexing the owner parameter in the event, external systems and users will be able to efficiently search and filter all FeeWithdrawn events based on the owner’s address.

Updates

Appeal created

bube Lead Judge 8 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.