osmosis
osmosis copied to clipboard
x/twap: make get arithmetic twap not interpolate geometric parameters
Background
Many osmosis contracts frequently query the arithmetic twap. Right now they are paying a lot in cpu time for interpolating geometric twap records which they are not even using.
We should make arithmetic twap apis not interpolate a geometric twap.
NOTE: this is low priority in terms of optimization, all iavl v1 experimentation should take far more precedence.
Suggested Design
Make an enum for twap strategy (right now it's an interface, make an additional enum)
Thread it to getInterpolatedRecord. Make that only update the relevant entries.
Acceptance Criteria
State machine compatible fix, that makes get arithmetic twap not compute any logs. We can find this out by looking at benchmarks