Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement adversarial eviction bounty schema #576

Open
alnoki opened this issue Oct 27, 2023 · 2 comments
Open

Implement adversarial eviction bounty schema #576

alnoki opened this issue Oct 27, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@alnoki
Copy link
Member

alnoki commented Oct 27, 2023

Related #95

  • Require a deposit for every limit order
  • If a user places a limit order far away from the spread, their deposit becomes a bounty
    • Bounty hunters can then cancel the order far from the spread and claim the bounty
    • This makes it so that people don't place bogus orders and occupy book state
  • Also require deposit for bounty hunter operations
    • If you falsely try to pick someone else off you lose your deposit
    • This makes it so that people aren't locking up the book
  • Have the deposit be equivalent to the minimum order size for the market
@alnoki alnoki added the enhancement New feature or request label Oct 27, 2023
@alnoki alnoki changed the title Implement adversarial bounty schema Implement adversarial eviction bounty schema Nov 28, 2023
@alnoki
Copy link
Member Author

alnoki commented Nov 28, 2023

Per offline discussion with @jarry-xiao, and additional thoughts

  • Eviction could be disabled within an "unevictable price window"
  • Price window could be 20% of reference price to 200% of reference price, for example
  • Reference price could be obtained by inspecting clustering of bid volume
  • For example a legitimate order has a certain amount of volume that is unevictable
  • This could be evaluated only bid side, such that low prices lead to not meeting the threshold
  • There could be a market parameter like BID_VOLUME_FOR_REFERENCE_PRICE, and if it is met, then order book is considered "healthy"
  • Note that this could be potentially gamed by placing a passive order for low size, only slightly more aggressive than bid price
  • Eviction logic should avoid checking too many orders such that it does not query too much state
  • There could be an inverse function on ask price, such that if ask size * mid_price / price is sufficiently low, then order isn't aggressive enough
  • Logic will need to dynamically allow resetting the spread in the case that the book starts empty, then an adversary quotes around a bogus mid price, attempting to establish hysteresis
  • Alternatively, there could be a reference price that can be updated via a governance vote: unlike lot/tick/min size, this can be updated on-the-fly
  • For high-visibility markets, the easiest solution will probably be to just take the mid price, then take a percentage on each side: for bids, price can be as low as 20% of mid price, then for asks, mid_price / price can be as low as 20% of mid price
  • Eviction could in general be defined as "price less than x% or greater than y% of a well-formed midprice" (or relative to best bid/ask to avoid accessing state from other side)

@alnoki
Copy link
Member Author

alnoki commented Jan 25, 2024

For simplicity, eviction could use a few parameters:

  • Only allow orders 1/10 best ask
  • Only allow orders at price 1/10 best bid
  • Evict if more than 1000 orders

Alternatively, reference price could be the price in a liquidity pool if one is available

When inserting, operations could automatically evict an order that lies outside the bound (if the price has moved)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant