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
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
When
result % 33 === 0,computeCrashPoint()returns 1.0 via an early return: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]:
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.01so every code path respects the [1.01, 100.0] range stated in the documentation.