The RAACHousePrices
contract maintains and returns a global lastUpdateTimestamp
for all houses, instead of individual ones. This results in incorrect price freshness data when querying prices for individual houses, as the queried price might be stale.
The RAACHousePrices
contract makes use of the RAACHousePriceOracle
to maintain up to date house price data. House prices are updated by sending a request to the oracle. When the request returns with a response, it ultimately calls RAACHousePriceOracle#_processResponse
, then sets the latest house price in RAACHousePrices#setHousePrice
.
There's what setHousePrice
looks like:
Notice how it sets a global lastUpdateTimestamp
. Whenever setHousePrice
is called, regardless of _tokenId
(in other words, regardless of what house we're dealing with), it always updates the lastUpdateTimestamp
.
This is problematic, because later, the protocol will make use of RAACHousePrices#getLatestPrice
which returns the house price for a given _tokenId
including that global lastUpdateTimestamp
as indicator when the price was last updated.
However, given that the lastUpdateTimestamp
is not tracked for every house (_tokenId
) individually, it will provide incorrect freshness data for houses prices that haven't been updated in a longer time.
The LendingPool
makes use of this in its getNFTPrice
function, which is critical to the protocol to figure out whether or not a debt position is undercollateralized. The function might return a price that's very outdated, possibly higher than what it really is, resulting in risky debt positions.
The calculated health factor could be incorrect, which also ultimately prevents accounts from being liquidated, leading to more overall risk in the protocol for both, lenders and other borrowers.
Manual review.
Ensure data for house price freshness is tracked for every _tokenId
(house) individually, such that freshness checks can be performed on individual properties.
Here's what this could look like:
The following functions are either relevant or directly affected by this bug:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.