Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Constructor explicit casting address to IEntryPoint interface

Summary

The constructor in the smart contract introduces a subtle vulnerability due to the lack of direct type safety when initializing the i_entryPoint state variable. This vulnerability arises from the explicit casting of an address to an IEntryPoint interface within the constructor, which can lead to runtime errors if the address does not correctly implement the expected interface.

Vulnerability Details

The vulnerability lies in the constructor's acceptance of an address for the entryPoint parameter and the subsequent casting of this address to an IEntryPoint interface. This approach does not enforce at compile time that the provided address points to a contract that correctly implements the IEntryPoint interface. As a result, if the address does not implement the interface as expected, the contract may encounter runtime errors when attempting to interact with the i_entryPoint through the interface methods.

Impact

The primary impact of this vulnerability is the potential for runtime errors, which can lead to failed transactions, increased gas costs, and a compromised user experience. Developers and users relying on this contract may face difficulties in identifying and resolving the issue, as the error messages may not clearly indicate the root cause of the problem. Furthermore, this vulnerability could be exploited by malicious actors to deploy contracts that appear to implement the IEntryPoint interface but do not, leading to unexpected behavior and potential security breaches.

Tools Used

Hardhat

Recommendations

Direct Interface Acceptance: Modify the constructor to directly accept an IEntryPoint instance as the entryPoint parameter. This change enhances type safety by ensuring that the contract only accepts instances that correctly implement the IEntryPoint interface, reducing the risk of runtime errors.

constructor(IEntryPoint entryPoint) Ownable(msg.sender) ERC721("MondrianWallet", "MW") {
i_entryPoint = entryPoint;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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