Skip to content

Conversation

@cryptomilkbeard
Copy link

What

  • Replace the unbounded decrement loop in findY0AndDeltaY with a bounded, formula-based adjustment that preserves the no‑overshoot guarantee.
  • Add a regression test that demonstrates the pathological bid-side case and enforces a 15s max runtime.

Why

  • The previous while (true) loop could run excessively long for certain parameter combinations. This causes hangs in certain cases.
  • We still need the “totalAmountY ≤ amountY” behavior.

Notes

  • The adjustment computes the total-amount coefficient and reduces baseDeltaY in a single step when overshoot occurs.
  • New test: ts-client/src/test/liquidity_strategy_timeout.test.ts.

How to test

  • cd ts-client && npx jest src/test/liquidity_strategy_timeout.test.ts

@cryptomilkbeard cryptomilkbeard force-pushed the fix/bidask-unbounded-loop branch from 11e3163 to 0a4ccab Compare January 1, 2026 15:05
@cryptomilkbeard cryptomilkbeard force-pushed the fix/bidask-unbounded-loop branch from 0a4ccab to 4bbc607 Compare January 1, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant