AntFleet

Disagreement · c9663187-openai-0

Insufficient balance check happens before trade-size cap in buy_shares, causing false “Insufficient balance” errors

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

GPT-5 finding

Insufficient balance check happens before trade-size cap in buy_shares, causing false “Insufficient balance” errors

mediumbughigh
  • backend/wonderwall/simulations/polymarket/platform.py:128-138
  • backend/wonderwall/simulations/polymarket/platform.py:156-161
The platform rejects trades when balance < requested amount, but the actual executed amount is later capped to min(requested, 2% of pool). A user with balance less than the requested amount but greater than the capped amount is incorrectly blocked.

Recommendation

Compute the effective amount before the balance check, e.g.: - Calculate pool_total and max_trade first. - effective_amount = min(float(requested), max_trade). - If balance < effective_amount, return insufficient balance; otherwise proceed using effective_amount for the trade and all bookkeeping.

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 →