Skip to content

test: add fuzzing suite for i128 amount decoding to ensure BigInt pre…#96

Open
githoboman wants to merge 1 commit into
Miracle656:mainfrom
githoboman:Token-amount-decoder-fuzz-(overflow,-fractional)
Open

test: add fuzzing suite for i128 amount decoding to ensure BigInt pre…#96
githoboman wants to merge 1 commit into
Miracle656:mainfrom
githoboman:Token-amount-decoder-fuzz-(overflow,-fractional)

Conversation

@githoboman
Copy link
Copy Markdown

SDK invariant test — directly calls scValToNative on 9 sentinel values (including I128_MAX, I128_MIN, and values just outside JS safe-integer range) and asserts typeof native === "bigint". If a future SDK version regresses to returning number, this fails immediately.
Closes #78

10k precision fuzz — generates i128 BigInts across the full signed range using a weighted fc.oneof: 2× weight on > Number.MAX_SAFE_INTEGER and < -Number.MAX_SAFE_INTEGER (the dangerous band), plus 1× weight on the full range. For each input it asserts BigInt(result.amount) === original — so any number-path fallback in the decoder would fail the moment a value exceeds ±2⁵³−1.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@githoboman Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Token-amount decoder fuzz (overflow, fractional)

1 participant