You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The four contracts use interdependent configuration constants (fee BPS, minimum bet, TTL values, MAX_TOP_PLAYERS, decay parameters, referral bonus multipliers) that interact in ways the individual tests do not cover. There is no invariant test that verifies the combination of all constants produces safe behavior across all contract boundaries simultaneously.
TTL vs. market duration: MarketTTL (30 days) is shorter than max_duration_secs (60 days). A market that runs its full duration and is then claimed will have an expired BetEntry before the claim window closes.
Leaderboard points vs. PULSE minting: reward mints points * REWARD_RATE PULSE per call. If MAX_TOP_PLAYERS is increased without adjusting REWARD_RATE, the leaderboard can exceed the token supply cap in a single distribution round.
Referral depth vs. fee caps: withdraw_fees takes from a global accumulator with per-market fee tracking. If referral chains are deep and fees compound, a single cancel_market reclaim can wipe the accumulator, leaving withdraw_fees with nothing for active markets.
Why it's critical
No single constant is individually unsafe, but the combination creates state-invariant violations that no per-issue patch can address. This is effectively unsolvable without a coordinated cross-contract redesign.
Fix
Add a cross-contract invariant test suite that exercises every constant combination.
Summary
The four contracts use interdependent configuration constants (fee BPS, minimum bet, TTL values, MAX_TOP_PLAYERS, decay parameters, referral bonus multipliers) that interact in ways the individual tests do not cover. There is no invariant test that verifies the combination of all constants produces safe behavior across all contract boundaries simultaneously.
Key interactions at risk
cancel_marketreclaim vs.withdraw_feescap (issue [CRITICAL] cancel_market fee reclaim uses wrong fee rate denominator — reclaims 200 bps but market only holds 150 bps platform fees #87 vs [CRITICAL]withdraw_feeslets fee recipient drain entire accumulator — no cap, no provenance #94):cancel_marketreclaimsfees_in_pool = net_pool * TOTAL_FEE_BPS / (BPS_DENOM - TOTAL_FEE_BPS)from the globalAccumulatedFees, butwithdraw_feesdraws from the same accumulator. If both fire in the same ledger sequence, the order of operations determines whether fees are under- or over-accounted.TTL vs. market duration:
MarketTTL(30 days) is shorter thanmax_duration_secs(60 days). A market that runs its full duration and is then claimed will have an expiredBetEntrybefore the claim window closes.Leaderboard points vs. PULSE minting:
rewardmintspoints * REWARD_RATEPULSE per call. IfMAX_TOP_PLAYERSis increased without adjustingREWARD_RATE, the leaderboard can exceed the token supply cap in a single distribution round.Referral depth vs. fee caps:
withdraw_feestakes from a global accumulator with per-market fee tracking. If referral chains are deep and fees compound, a singlecancel_marketreclaim can wipe the accumulator, leavingwithdraw_feeswith nothing for active markets.Why it's critical
No single constant is individually unsafe, but the combination creates state-invariant violations that no per-issue patch can address. This is effectively unsolvable without a coordinated cross-contract redesign.
Fix