This PR attempts to fix the setting of LastTickIndex1To0 values in the derived.tx_price_data table.
Previously an update would be skipped if the price on the specific reserve's side TickIndex (HighestNormalizedTickIndex0 or LowestNormalizedTickIndex1 had not changed) had not changed. This is incorrect behavior.
The original intent of the HighestNormalizedTickIndex0 and LowestNormalizedTickIndex1 values was to create a "indicative price" of the pair where a reserve deposit that was "closer to the middle" than any other deposit or previous trade would indicate that the price had changed to that value. This was supposed to be helpful but is not that helpful. It may also even introduce attack vectors where users can influence the recorded price with small deposits at extreme positions.
It is much simpler to keep the definition of price as the last price that a trade occurred on, without accepting prices from any deposit events.
After removing the previous logic, the previous data columns for tracking HighestNormalizedTickIndex0 and LowestNormalizedTickIndex1 values were removed.
This PR attempts to fix the setting of
LastTickIndex1To0
values in thederived.tx_price_data
table.Previously an update would be skipped if the price on the specific reserve's side TickIndex (
HighestNormalizedTickIndex0
orLowestNormalizedTickIndex1
had not changed) had not changed. This is incorrect behavior.The original intent of the
HighestNormalizedTickIndex0
andLowestNormalizedTickIndex1
values was to create a "indicative price" of the pair where a reserve deposit that was "closer to the middle" than any other deposit or previous trade would indicate that the price had changed to that value. This was supposed to be helpful but is not that helpful. It may also even introduce attack vectors where users can influence the recorded price with small deposits at extreme positions.It is much simpler to keep the definition of price as the last price that a trade occurred on, without accepting prices from any deposit events.
After removing the previous logic, the previous data columns for tracking
HighestNormalizedTickIndex0
andLowestNormalizedTickIndex1
values were removed.