    pub fn swap(
            &mut self,
            zero_for_one: bool,
            amount: I256,
            mut price_limit: U256,
        ) -> Result<(I256, I256, i32), Revert> {
            assert_or!(self.enabled.get(), Error::PoolDisabled);

            ''' skip '''
            while !state.amount_remaining.is_zero() && state.price != price_limit {
                iters += 1;
                debug_assert!(iters < 500);
                ''' skip '''
            self.sqrt_price.set(state.price);
    pool1 state:
    lower = 1000
    upper = 2000
    amount = 20

    pool2 state:
    lower = 3000
    upper = 4000
    amount = 20
            match zero_for_one {
                true => {
                    if price_limit == U256::MAX {
                        price_limit = tick_math::MIN_SQRT_RATIO + U256::one();
                    }
                    if price_limit >= self.sqrt_price.get() || price_limit <= tick_math::MIN_SQRT_RATIO
                    {
                        Err(Error::PriceLimitTooLow)?;
                    }
                }
                false => {
                    if price_limit == U256::MAX {
                        price_limit = tick_math::MAX_SQRT_RATIO - U256::one();
                    }
                    if price_limit <= self.sqrt_price.get() || price_limit >= tick_math::MAX_SQRT_RATIO
                    {
                        Err(Error::PriceLimitTooHigh)?;
                    }
                }
            };
        pub fn swap(
            &mut self,
            zero_for_one: bool,
            amount: I256,
            mut price_limit: U256,
        ) -> Result<(I256, I256, i32), Revert> {
            assert_or!(self.enabled.get(), Error::PoolDisabled);
            println!("self.sqrt_price: {}", self.sqrt_price.get()); // added
            while !state.amount_remaining.is_zero() && state.price != price_limit {
                iters += 1;
                // debug_assert!(iters < 500);
    cargo test test_poc1 --package seawater --features testing -- --nocapture
    running 1 test
    self.sqrt_price: 792281625142643375935439503360
    self.sqrt_price: 4295128740
    Error: [80, 114, 105, 99, 101, 32, 108, 105, 109, 105, 116, 32, 116, 111, 111, 32, 108, 111, 119]
    test test_poc1 ... FAILED

    failures:

    failures:
        test_poc1

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 16 filtered out; finished in 0.14s

    error: test failed, to rerun pass `-p seawater --test lib`
    @@ -375,9 +375,10 @@ impl StoragePool {
             // continue swapping while there's tokens left to swap
             // and we haven't reached the price limit
             let mut iters = 0;
    +        let mut last_valid_price = state.price;
             while !state.amount_remaining.is_zero() && state.price != price_limit {
                 iters += 1;
    -            debug_assert!(iters < 500);
    +            // debug_assert!(iters < 500);

                 let step_initial_price = state.price;

    @@ -479,6 +480,7 @@ impl StoragePool {
                         };

                         state.liquidity = liquidity_math::add_delta(state.liquidity, liquidity_net)?;
    +                    last_valid_price = state.price;
                     }

                     state.tick = match zero_for_one {
    @@ -493,7 +495,8 @@ impl StoragePool {

             // write state
             // update price and tick
    -        self.sqrt_price.set(state.price);
    +        self.sqrt_price.set(if state.price == price_limit { last_valid_price } else { state.price });
    +
             if state.tick != self.cur_tick.get().sys() {
                 self.cur_tick.set(I32::unchecked_from(state.tick));
             }
         Running tests/lib.rs (target/debug/deps/lib-28fa4ebf2403ec3f)

    running 1 test
    self.sqrt_price: 792281625142643375935439503360
    self.sqrt_price: 560222498985353939371108591955
    test test_poc1 ... ok

    test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 16 filtered out; finished in 0.14s

         Running tests/pools.rs (target/debug/deps/pools-a3343d45185ff606)
