Skip to content

Commit 1bc2250

Browse files
arturbegclaude
andcommitted
test(perps): skip reduce-only-without-position test on external liquidity
`test_perp_reduce_only_rejected_without_position` rests a setup maker SELL at oracle*1.04 to give the reduce-only IOC a counterparty. When the shared devnet book has external liquidity (an MM bot quoting near pool price, ~+16% over oracle), that maker SELL crosses immediately instead of resting, and settling the resulting fill against the external counterparty currently 500s (off-chain settlement-robustness bug, PRO-191) — so the test fails hard instead of skipping. Add the same `skip_if_external_liquidity` guard its siblings already use (e.g. `test_perp_ioc_taker_buy_matches_maker_sell`) so it self-skips on a dirty book. Verified: the test now SKIPS cleanly against the live devnet book. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e5f7446 commit 1bc2250

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/test_perps/test_limit_orders.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,20 @@ async def test_perp_reduce_only_rejected_without_position(
194194
the test exists to catch
195195
"""
196196
market_price = float(await perp_taker_tester.data.current_price(PERP_SYMBOL))
197+
198+
# Skip if an external MM is on the book: the setup maker SELL at oracle*1.04
199+
# below would cross any external bid above that price and fill immediately
200+
# instead of resting, so the reduce-only IOC would settle against external
201+
# liquidity rather than exercise the zero-position on-chain check (and that
202+
# settlement currently 500s). Mirrors `test_perp_ioc_taker_buy_matches_maker_sell`
203+
# and the other controlled-book tests that self-skip on a dirty devnet book.
204+
await skip_if_external_liquidity(
205+
perp_taker_tester.data,
206+
PERP_SYMBOL,
207+
market_price,
208+
reason_prefix="test_perp_reduce_only_rejected_without_position",
209+
)
210+
197211
await perp_taker_tester.check.position_not_open(PERP_SYMBOL)
198212

199213
# Guarantee the IOC has a counterparty so the on-chain check actually

0 commit comments

Comments
 (0)