The current implementation doesn't link the house of which price is requested to the requestId. This can lead to setting the house price to a value received from a different requestId.
Owner can call BaseChainlinkFunctionsOracle::sendRequest to request the price of a houseId.
The s_lastRequestId
is set to the Chainlink returned requestId
. The _beforeFulfill
hook sets the lastHouseId
to the houseId for which the price is requested.
When the Chainlink fulfills the request the fulfillRequest is called:
The _processResponse sets the price for the lastHouseId
:
There's no 1:1 link between the requestId and the house of which price is updated.
The lastHouseId
price can be set to the value returned from a different request.
Consider the following example:
-> the price of houseA is requested:
lastHouseId is set to houseA
lastRequestId is set to requestA
-> the price of houseB is requested:
lastHouseId is set to houseB
lastRequestId is set to requestB
The Chainlink FunctionRouter calls fulfillRequest
to fulfill requestB first then the requestA :
the price of lastHouseId == houseB is set to priceB
the price of lastHouseId == houseB is set to priceA
The houseB price is set to the wrong value.
The houseA price is not updated.
According to Chainlink Functions Service docs, the maximum duration of a request is 5 minutes, increasing the chances of this type of scenario happening.
The houses prices may be incorrectly set or even not updated.
Add a new mapping in BaseChainlinkFunctionsOracle
.
mapping(uint256 houseId => bytes32 requestId) public requestToHouseId
Populate this mapping in sendRequest
and use it in fulfillRequest
to set the response
price to the correct houseId.
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.