sherlock-audit / 2023-07-kyber-swap-judging

12 stars 8 forks source link

Oxhunter526 - Inaccurate Observations Due to Incorrect `time` and `tick` Parameters in Oracle Library #81

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Oxhunter526

medium

Inaccurate Observations Due to Incorrect time and tick Parameters in Oracle Library

Summary

The Oracle library includes the observe and observeSingle functions that provide historical price data observations. However, these functions assume specific parameters, including the time parameter being the current block timestamp and the tick parameter being the current tick of the pool. Deviating from these assumptions may lead to inaccurate accumulator values for historical observations.

Vulnerability Detail

The issue arises from assumptions made by the Oracle library's observe and observeSingle functions regarding the time and tick parameters. Let's delve into the details:

  1. time Parameter Assumption:
    • The Oracle library assumes that the time parameter passed to these functions corresponds to the current block timestamp.
    • The Oracle.lte function, used internally, requires a and b to be chronologically before the time parameter.
    • If an arbitrary time parameter is used that does not match the current block timestamp, it can lead to incorrect results for the accumulator.
  2. tick Parameter Assumption:

Manual Review

Recommendation

sherlock-admin commented 1 year ago

1 comment(s) were left on this issue during the judging contest.

Trumpero commented:

invalid, spam issue, vague description. Not specify anything. time param is not the current block.timestamp