Skip to content

Add negative regression tests for MARKET / CONDITIONAL / TPSL order validation #86

@vikions

Description

@vikions

Hi,

while looking through the current starknet branch, I noticed that the tests under tests/perpetual/order_object/ seem to cover the happy-path construction/serialization cases, but not the invalid-input validation branches in x10/perpetual/order_object.py.

A few examples of rules that are currently enforced in code:

  • MARKET orders must use time_in_force=IOC
  • MARKET orders must not be post-only
  • CONDITIONAL orders must include trigger
  • TPSL orders must be reduce-only
  • TPSL orders must not be post-only
  • POSITION TPSL orders must use synthetic_amount=0
  • TPSL orders must use price=0
  • tp_sl_type is required when take_profit or stop_loss is provided

It looks like a small tests-only PR could add pytest.raises(...) coverage for these existing checks without changing behavior.

If this direction makes sense, I can put together a narrow regression-test PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions