The _validatePrice function currently assumes that the indexToken and longToken are always the same. This assumption is explicitly mentioned in the comments, stating that
This assumption holds true for now but could lead to incorrect validations in the future if these tokens become different. The issue arises because prices.indexTokenPrice is used for both indexToken and longToken, which may not be correct if they have different values in later implementations.
The getMarketPrices function retrieves prices for indexToken, longToken, and shortToken as follows;
The prices fetched above are then used in _validatePrice as follows;
The _check function is used to validate prices, but prices.indexTokenPrice is used for both indexToken and longToken.Currently, since indexToken and longToken are the same, the function behaves correctly.
In the future, if indexToken and longToken become different, using the same price for both will result in incorrect validation and potential mispricing.
If the assumption breaks, _validatePrice will use the wrong prices for longToken, leading to inaccurate price checks and mispricing.
Manual Review
Modify _validatePrice to ensure that prices.indexTokenPrice is used only for indexToken and prices.longTokenPrice is used for longToken.
Likelihood: None/Very Low, everytime the keeper send a price via run/runNextAction (sent by the Gamma keeper). Impact: Medium/High, does not check the longTokenPrice, it could go out of range. Keep in mind indexToken == longToken, an error from the keeper could be considered informational.
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.