Sablier

Sablier
DeFiFoundry
53,440 USDC
View results
Submission Details
Severity: low
Invalid

Duplicate Event Declaration

[L-4] Duplicate Event Declaration
Description:
The Solidity compiler error indicates that the TransferAdmin event is declared twice with the same name and parameter types in different files: IAdminable.sol and Events.sol. This redundancy causes a compilation failure.

Impact:
The duplicate event declaration can lead to compilation errors, making the contract non-deployable and interrupting the development process.

Proof of Concept:
The error message during compilation:

Error (5883): Event with same name and parameter types defined twice.
--> src/interfaces/IAdminable.sol:16:5:
|
16 | event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: Other declaration is here:
--> test/utils/Events.sol:29:5:
|
29 | event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Recommended Mitigation:
Remove the duplicate event declaration to resolve the compilation issue. Ensure the event is declared only in one appropriate location, typically within the main contract or its interface.

Mitigation Code:

Option 1: Remove the duplicate from IAdminable.sol if it's defined in a common utility file for test purposes:

- event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);
Option 2: Ensure the event is defined only in IAdminable.sol if the test file is unnecessary:
// Remove the duplicate declaration from test/utils/Events.sol
- event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);

Corrected Code in IAdminable.sol:
Ensure the event is declared only here if this is the primary contract or interface:

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22;
interface IAdminable {
/// @notice Emitted when the admin role is transferred.
/// @param oldAdmin The address of the previous admin.
/// @param newAdmin The address of the new admin.
event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);
/// @notice Transfers the admin role to a new address.
/// @param newAdmin The address of the new admin.
function transferAdmin(address newAdmin) external;
}

Corrected Code in Events.sol:
Remove the duplicate event declaration if it's redundant:

// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22 <0.9.0;
contract Events {
// Other event declarations
- event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);
}

By ensuring the event is declared only once in the appropriate file, the compilation error will be resolved, allowing the project to build and deploy successfully.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Info/Gas/Invalid as per Docs

https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity

Support

FAQs

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