The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Contradictory Use of Override and Virtual Keywords in Function Specifier

Summary

In Solidity, a function cannot have both virtual and override specifiers at the same time. They serve different purposes and are used in different scenarios:
The virtual keyword is used in the base contract to indicate that a function can be overridden by derived contracts. If a function is marked as virtual, it means that the function's behavior can be changed in derived contracts.
The override keyword is used in the derived contract to indicate that the function is intended to override a function in the base contract.

Impact

If a function has both override and virtual specifiers, it implies a contradiction: the function is both overriding a function in a base contract and allowing itself to be overridden by derived contracts. This contradictory behavior is not allowed in Solidity, and the compiler will throw an error.

Tools Used

manual review

Recommendations

Apply the specifiers as intended by the contract logic

Updates

Lead Judging Commences

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

informational/invalid

Support

FAQs

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