Puppy Raffle

AI First Flight #1
Beginner FriendlyFoundrySolidityNFT
EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

[I-03] Event Naming Convention (Readability + Standardization)

Description

The contract defines several events as follows:

event RaffleEnter(address[] newPlayers);
event RaffleRefunded(address player);
event FeeAddressChanged(address newFeeAddress);

Per Solidity coding standards, it is recommended to name events using the pattern: ContractName__EventName. This convention improves readability, avoids potential naming collisions across contracts, and makes it clear which contract emitted the event when logs are analyzed, especially in multi-contract systems.

Risk

  • Severity: Low

  • Type: Maintainability / Readability

  • Impact: No security vulnerability exists. However, inconsistent event naming may make it harder to track events in logs or during audits, particularly when multiple contracts emit similar events.

Impact

  • Maintainability: Using the ContractName__EventName convention makes logs and event emissions immediately identifiable.

  • Readability: Signals clearly which contract the event belongs to.

  • Best Practices: Aligns with Solidity style guides and improves traceability in off-chain monitoring systems.

Proof of Concept

Current declaration:

event RaffleEnter(address[] newPlayers);
event RaffleRefunded(address player);
event FeeAddressChanged(address newFeeAddress);

Recommended change following the ContractName__EventName convention (Given the contract name is PuppyRaffle):

- event RaffleEnter(address[] newPlayers);
+ event Raffle__Enter(address[] newPlayers);
- event RaffleRefunded(address player);
+ event Raffle__Refunded(address player);
- event FeeAddressChanged(address newFeeAddress);
+ event Raffle__FeeAddressChanged(address newFeeAddress);

Explanation:

  • The - lines show the current event names.

  • The + lines show the recommended event names using the ContractName__EventName pattern.

  • Any off-chain or on-chain code listening for these events should update to reflect the new event names.

This ensures consistency and traceability without changing event semantics or functionality.

Recommended Mitigation

  • Rename all events following the ContractName__EventName convention.

  • Update all references to these events in tests, scripts, or other contracts to prevent inconsistencies.

  • Document the event naming convention in project coding guidelines to ensure consistent usage across the codebase.

  • Consider reviewing other events in the contract or project to enforce consistent naming and improve traceability in multi-contract systems.

Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 4 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!