15,000 USDC
View results
Submission Details
Severity: gas

Gas Inefficiency due to Redundant Address Parameters in Private Functions

Summary

Two separate functions (_burnDsc and _redeemCollateral) were identified where redundant parameters were used, resulting in potential gas inefficiencies.

Vulnerability Details

  1. In the _burnDsc function, the parameters onBehalfOf and dscFrom represent the same address, leading to unnecessary redundancy. Using two separate variables for the same address increases gas costs slightly.

  2. In the _redeemCollateral function, the parameters from and to also represent the same address, resulting in similar redundancy. Using two separate variables for the same address in this case also increases gas costs slightly.

Impact

The impact of these issues is relatively minor, as the redundant variables do not introduce critical vulnerabilities or security risks. However, they can lead to slightly higher gas consumption, potentially impacting the cost-effectiveness of transactions and overall contract performance.

Tools Used

Manual Review

Recommendations

To optimize gas consumption and improve code readability, the following recommendations are suggested:

  1. In the _burnDsc function, use a single variable to represent the address, and then pass it as an argument to both functions. This eliminates the need for redundant assignments and reduces gas costs slightly.

  2. Similarly, in the _redeemCollateral function, use a single variable to represent the address and pass it as an argument to both functions to avoid redundancy and save gas.

While the gas savings from these optimizations might not be significant, adhering to best coding practices for efficiency and readability is beneficial in the long run.

Support

FAQs

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