Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

Lack of Return Value Consistency for viewCountWhitelistedCurrencies

Summary

Inconsistent return value behavior for the function viewCountWhitelistedCurrencies in CurrencyManager.sol, which could lead to confusion or compatibility issues with other contracts or interfaces that depend on this function.

Finding Description

The function viewCountWhitelistedCurrencies is defined and works as intended but may create compatibility issues if other contracts or consumers expect a different function name or signature. While not a critical vulnerability, such discrepancies can lead to errors in interacting with the contract or its interfaces.

This issue does not break security guarantees directly but may lead to misunderstandings about how the contract should be used or interacted with. It can result in misalignment with expectations from other parts of the system or other developers who are interacting with the contract.

Vulnerability Details

  • The function viewCountWhitelistedCurrencies provides the number of whitelisted currencies but could cause issues if the function name or return signature does not match the expectations of interfacing contracts or clients.

  • The absence of a return value consistency check between interfaces and the actual implementation could lead to bugs or failed integrations with other systems.

Impact

This issue can have a medium impact because:

  • It could break compatibility with external contracts or integrations that rely on an exact name and behavior of the function.

  • While not directly causing a vulnerability, it may create unnecessary complexity and confusion for other developers working with the contract.

Proof of Concept

The issue manifests when an interface that expects a different signature for the viewCountWhitelistedCurrencies function tries to interact with the contract, leading to integration errors. For example, if a consumer expects getWhitelistedCurrencyCount() instead of viewCountWhitelistedCurrencies(), the system will not behave as expected.

Recommendations

  • Ensure that the function names and their return values align with the expectations set by interfaces and external consumers.

  • If necessary, rename the function to getWhitelistedCurrencyCount or another consistent name if there is an external interface that requires this.

Example fix:

// Renamed the function for consistency with external contracts or interfaces
function getWhitelistedCurrencyCount() external view override returns (uint256) {
return _whitelistedCurrencies.length();
}

File location: CurrencyManager.sol


This bug report highlights the impact of the inconsistency in function naming and how it could affect compatibility, along with recommendations for a fix.

Updates

Lead Judging Commences

0xbrivan2 Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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