diff --git a/lib/dex-invariant/src/internal/invariant-types/src/structs/tickmap.rs b/lib/dex-invariant/src/internal/invariant-types/src/structs/tickmap.rs index 5e6ad78..9e06656 100644 --- a/lib/dex-invariant/src/internal/invariant-types/src/structs/tickmap.rs +++ b/lib/dex-invariant/src/internal/invariant-types/src/structs/tickmap.rs @@ -9,7 +9,7 @@ use crate::{err, function, location, trace}; pub const TICK_LIMIT: i32 = 44_364; // If you change it update length of array as well! pub const TICK_SEARCH_RANGE: i32 = 256; pub const MAX_TICK: i32 = 221_818; // log(1.0001, sqrt(2^64-1)) -pub const TICK_CROSSES_PER_IX: usize = 4; +pub const TICK_CROSSES_PER_IX: usize = 10; pub const TICKS_BACK_COUNT: usize = 1; pub const TICKMAP_SIZE: i32 = 2 * TICK_LIMIT - 1; diff --git a/lib/dex-invariant/src/invariant_edge.rs b/lib/dex-invariant/src/invariant_edge.rs index 0f19c56..212bff2 100644 --- a/lib/dex-invariant/src/invariant_edge.rs +++ b/lib/dex-invariant/src/invariant_edge.rs @@ -223,13 +223,14 @@ impl InvariantEdge { } else { virtual_cross_counter = virtual_cross_counter.checked_add(1).ok_or("add overflow")?; - if InvariantSwapResult::break_swap_loop_early( - used_ticks.len() as u16, - virtual_cross_counter, - )? { - global_insufficient_liquidity = true; - break; - } + } + + if InvariantSwapResult::break_swap_loop_early( + used_ticks.len() as u16, + virtual_cross_counter, + )? { + global_insufficient_liquidity = true; + break; } pool.current_tick_index = if x_to_y && is_enough_amount_to_cross {