Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

Named parameter mappings

Summary

There is a missed opportunity to use named parameter for public mappings

Vulnerability Details

The projects use Solidity 0.8.21 and miss that from 0.8.18 a new feature allowing named parameters for public mappings was introduced.

See instances below:

contracts/oracles/ChainlinkARBOracle.sol
37: mapping(address => address) public feeds;
39: mapping(address => uint256) public maxDelays;
41: mapping(address => uint256) public maxDeviations;

https://github.com/Cyfrin/2023-10-SteadeFi/blob/main/contracts/oracles/ChainlinkARBOracle.sol#L37

https://github.com/Cyfrin/2023-10-SteadeFi/blob/main/contracts/oracles/ChainlinkARBOracle.sol#L39

https://github.com/Cyfrin/2023-10-SteadeFi/blob/main/contracts/oracles/ChainlinkARBOracle.sol#L41

contracts/strategy/gmx/GMXVault.sol
41: mapping(address => bool) public keepers;
43: mapping(address => bool) public tokens;

https://github.com/Cyfrin/2023-10-SteadeFi/blob/main/contracts/strategy/gmx/GMXVault.sol#L41

https://github.com/Cyfrin/2023-10-SteadeFi/blob/main/contracts/strategy/gmx/GMXVault.sol#L43

Impact

Informational:

  • Improving code readability and maintainability is crucial as it helps to make the codebase more organized and easier to understand, which ultimately leads to better maintainability over time

  • Makes the mappings syntax similar to functions and events that take parameters

  • Allows setting of fields in the ABI for mapping public getter functions

Tools Used

Manual Analysis

Recommendations

Change to specify parameter names for all instances as in the example below:

- mapping(address => address) public feeds;
+ mapping(address token => address feed) public feeds;
Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

INFO: Bad naming

Support

FAQs

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