Assessment reports>Oracle>Low findings>Unnecessary parameter usage in ,getRoundData, function
Category: Coding Mistakes

Unnecessary parameter usage in getRoundData function

Low Severity
Low Impact
Low Likelihood

Description

The getRoundData function in the contract includes a parameter _roundId that is not utilized in the function's logic. Instead, the function retrieves the price data without considering the provided _roundId. This creates a potential for misuse, as users might expect the function to return data specific to the given _roundId, which is not the case here.

function getRoundData(
    uint80 _roundId      // [1] param
)
    external
    view
    returns (
        uint80 roundId,
        int256 answer,
        uint256 startedAt,
        uint256 updatedAt,
        uint80 answeredInRound
    )
{
    PythStructs.Price memory price = pyth.getPriceUnsafe(pythID); // [2] not using param
    return (
        _roundId,    // [3] from param (directly)
        int256(price.price),
        price.publishTime,
        price.publishTime,
        _roundId
    );
}

Impact

The inclusion of an unused parameter can cause confusion and may lead to incorrect assumptions about the function's behavior. Users might expect the function to return data relevant to the provided _roundId, leading to potential misuse and unexpected outcomes.

Recommendations

Remove the unused _roundId parameter if it is not required for the function's logic.

Remediation

The Yei Finance Team has decided not to modify the code to maintain function signature compatibility with the Chainlink Oracle.

Zellic © 2024Back to top ↑