Omniscia Tren Finance Audit
FixedPriceAggregator Manual Review Findings
FixedPriceAggregator Manual Review Findings
FPA-01M: Improper Round Start Time
Type | Severity | Location |
---|---|---|
Standard Conformity | FixedPriceAggregator.sol:L42, L58 |
Description:
THe FixedPriceAggregator::getRoundData
and FixedPriceAggregator::latestRoundData
functions will yield a started-at timestamp of 0
which is invalid.
Example:
contracts/Pricing/FixedPriceAggregator.sol
29function getRoundData(uint80 _roundId)30 external31 view32 override33 returns (34 uint80 roundId,35 int256 answer,36 uint256 startedAt,37 uint256 updatedAt,38 uint80 answeredInRound39 )40{41 uint256 timestamp = block.timestamp - 5 minutes;42 return (_roundId, PRICE, 0, timestamp, uint80(timestamp));43}44
45function latestRoundData()46 external47 view48 override49 returns (50 uint80 roundId,51 int256 answer,52 uint256 startedAt,53 uint256 updatedAt,54 uint80 answeredInRound55 )56{57 uint256 timestamp = block.timestamp - 2 minutes;58 return (uint80(timestamp), PRICE, 0, timestamp, uint80(timestamp));59}
Recommendation:
We advise both to yield the same timestamp
as the updatedAt
value, mimicking the behaviour of typical Chainlink nodes.
Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):
Both functions have been updated to yield the same non-zero timestamp
as advised, addressing this exhibit.