Skip to content

Use strict guards before BigNumber conversions - #2594

Merged
groninge01 merged 3 commits into
mainfrom
fix/strict-bn-input-guards
Jul 29, 2026
Merged

Use strict guards before BigNumber conversions#2594
groninge01 merged 3 commits into
mainfrom
fix/strict-bn-input-guards

Conversation

@groninge01

@groninge01 groninge01 commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • use isBnParseable at API and input boundaries that feed bn()
  • prevent whitespace and other non-parseable values from crashing calculations

Tests

  • pool.utils.spec.ts
  • user-balance.helpers.spec.ts
  • useGetPoolRewards.spec.tsx

Scoped to packages/lib

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mono-analytics-v3 Ready Ready Preview, Comment Jul 29, 2026 1:25pm
mono-beets-test-v3 Ready Ready Preview, Comment Jul 29, 2026 1:25pm
mono-beets-v3 Ready Ready Preview, Comment Jul 29, 2026 1:25pm
mono-frontend-v3 Ready Ready Preview, Comment Jul 29, 2026 1:25pm
mono-test-v3 Ready Ready Preview, Comment Jul 29, 2026 1:25pm

Request Review

…alidation

Replace isValidNumber with isBnParseable in isGreaterThanZeroValidation to prevent throwing errors on whitespace input. Add test coverage for whitespace handling and other edge cases.
Replace !isZero(value) with bn(value).gt(0) to properly validate that amounts are strictly greater than zero, not just non-zero (which would allow negative values).
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