The RAAChousePricing contract incorrectly updates the lastUpdateTimestamp globally whenever the setHousePrice function is called, regardless of which token ID is modified. This results in multiple tokens sharing the same timestamp, leading to outdated or inaccurate price data being returned when querying specific token prices. To ensure accurate tracking, each token should maintain its own update timestamp instead of relying on a global value.
Issue:
The lastUpdateTimestamp is updated for all token IDs whenever any single token’s price is modified. This means that different tokens can appear to have been updated at the same time, even if only one was modified.
When a user queries the price of a token that hasn’t been updated recently, the timestamp from another token’s update is returned, leading to misleading data.
Affected Code:
getLatestPrice Function:
setHousePrice Function:
Root Cause:
The contract lacks a per-token timestamp tracking mechanism. Instead, a single lastUpdateTimestamp applies to all tokens, which can mislead users about the freshness of individual token price updates.
Inaccurate Data Retrieval:
Users might receive outdated price information for a token while believing they are viewing the latest data.
User Misinterpretation:
The shared timestamp can cause confusion, as users may assume all tokens were updated simultaneously, even when only one was modified.
Financial Risks:
If external systems rely on this timestamp for pricing or trading, outdated data could result in poor financial decisions or incorrect valuations.
Manual Code Review
Implement Per-Token Timestamp Storage:
Modify the contract to track a separate lastUpdateTimestamp for each token to ensure accurate individual update records.
Updated setHousePrice function:
Introduce a mapping for per-token timestamps:
Modify getLatestPrice to Return Token-Specific Timestamps:
Ensure the function retrieves the correct timestamp for the requested token ID:
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.