compare_pool_profiler

Function compare_pool_profiler 

Source
pub fn compare_pool_profiler(
    profiler: &PoolProfiler,
    snapshot: &PoolSnapshot,
) -> bool
Expand description

Compares a pool profiler’s internal state with on-chain state to verify consistency.

This function validates that the profiler’s tracked state matches the actual on-chain pool state by comparing global pool parameters, tick data, and position data. Any mismatches are logged as errors, while matches are logged as info.

§Arguments

  • profiler - The pool profiler whose state should be compared
  • current_tick - The current active tick from on-chain state
  • price_sqrt_ratio_x96 - The current sqrt price ratio (Q64.96 format) from on-chain state
  • fee_protocol - The protocol fee setting from on-chain state
  • liquidity - The current liquidity from on-chain state
  • ticks - Map of tick indices to their on-chain tick data
  • positions - Vector of on-chain position data

§Panics

Panics if the profiler has not been initialized

§Returns

Returns true if all compared values match, false if any mismatches are detected.