Skip to content

fix(provably-fair): return 1.01 (not 1.0) for instant-crash — respects the advertised payout floor#5

Open
amathxbt wants to merge 1 commit into
canopy-network:mainfrom
amathxbt:fix/crash-point-below-floor
Open

fix(provably-fair): return 1.01 (not 1.0) for instant-crash — respects the advertised payout floor#5
amathxbt wants to merge 1 commit into
canopy-network:mainfrom
amathxbt:fix/crash-point-below-floor

Conversation

@amathxbt

Copy link
Copy Markdown

Bug

When result % 33 === 0, computeCrashPoint() returns 1.0 via an early return:

if (result % 33 === 0) return 1.0;

However, the JSDoc comment and the clamp logic at the bottom of the same function both state the valid output range is [1.01, 100.0]:

// JSDoc: "Result is clamped to [1.01, 100.0]."
if (crashPoint < 1.01) crashPoint = 1.01;

The early return bypasses the clamp and produces a value below the advertised minimum. Players on the losing end of an instant-crash outcome receive a 1.0× multiplier (no winnings) when the published rules imply the worst possible outcome is 1.01×.

Fix

Change the early return to 1.01 so every code path respects the [1.01, 100.0] range stated in the documentation.

// Before
if (result % 33 === 0) return 1.0;

// After
if (result % 33 === 0) return 1.01;

When result % 33 === 0 the function returned 1.0, but the JSDoc and the
clamp at the bottom of the function both state the output range is
[1.01, 100.0]. Returning 1.0 contradicts the advertised minimum and
gives players a payout that is 1% worse than the published house-edge
formula implies for the instant-crash case.

Change the early return to 1.01 so every code path respects the
advertised floor.
@andrewnguyen22 andrewnguyen22 requested a review from ezeike June 27, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant