AntFleet

Disagreement · c9663187-openai-1

Missing input validation for non-positive trade sizes in buy_shares/sell_shares can raise unhandled ValueError and crash the loop

solo GPT-5
repo 193af03f·PR #2·reviewed 1 week ago

GPT-5 finding

Missing input validation for non-positive trade sizes in buy_shares/sell_shares can raise unhandled ValueError and crash the loop

highapi-contracthigh
  • backend/wonderwall/simulations/polymarket/amm.py:71-73
  • backend/wonderwall/simulations/polymarket/platform.py:162-165
  • backend/wonderwall/simulations/polymarket/amm.py:126-128
  • backend/wonderwall/simulations/polymarket/platform.py:244-246
quote_buy and quote_sell explicitly raise on non-positive inputs. Platform buy_shares/sell_shares neither validate inputs nor catch these exceptions, and BasePlatform.running does not guard action handlers with try/except. A bad input (0 or negative) can propagate a ValueError and terminate the platform loop.

Recommendation

Add explicit validation in PolymarketPlatform.buy_shares and sell_shares: - If amount_usd <= 0 or num_shares <= 0, return {"success": False, "error": "amount_usd must be positive"} (or similar) without calling the AMM. - Alternatively, wrap the quote_* calls in try/except ValueError and convert to structured error responses.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →