Implement the update_accumulator instruction. This is the public crank instruction that advances tick_cumulative in the Observation Account
ring buffer based on the current pool tick, applying per-block tick-delta truncation.
delta = current_tick - last_recorded_tick
clamped_delta = clamp(delta, -MAX_TICK_DELTA, +MAX_TICK_DELTA)
tick_cumulative += clamped_delta * elapsed_seconds
MAX_TICK_DELTA defaults to 9,116 ticks per block (~2.39x price move, matching the Uniswap v4 reference) and is governable per pool.
- Callable by anyone — no authority check
- Uses block timestamp, not caller-supplied, so elapsed time cannot be manipulated
- Calling twice in the same block is safe — zero elapsed time contributes nothing to tick_cumulative
- last_recorded_tick is updated to current_tick (not the clamped value) after each update
Implement the update_accumulator instruction. This is the public crank instruction that advances tick_cumulative in the Observation Account
ring buffer based on the current pool tick, applying per-block tick-delta truncation.
MAX_TICK_DELTA defaults to 9,116 ticks per block (~2.39x price move, matching the Uniswap v4 reference) and is governable per pool.