Skip to content

Reject invalid liquidity bounds and reserve inputs - #34

Merged
Code-Kaybee merged 2 commits into
HyperDevTools:mainfrom
Deemexlyon:fix/liquidity-input-validation
Nov 6, 2026
Merged

Code-Kaybee merged 2 commits into
HyperDevTools:mainfrom
Deemexlyon:fix/liquidity-input-validation

Conversation

@Deemexlyon

Copy link
Copy Markdown
Contributor

Summary

Validate liquidity estimates and deposits before calculation or transaction construction so non-finite, zero, negative, or inconsistent inputs cannot influence transaction decisions or reach Horizon.

Changes

  • Require finite positive deposit amounts and estimate amounts, with field-specific errors.
  • Require optional reserveA, reserveB, and totalShares as a complete tuple; validate each as finite and positive.
  • Reject non-finite or non-positive LP share estimates.
  • Validate finite positive spot prices and price bounds, including inverted bounds, using strict numeric parsing.
  • Add regression coverage for valid calculations, invalid amounts and reserves, incomplete reserve tuples, invalid prices, and ensuring rejected deposits are never submitted.

Validation

  • npm run lint passed.
  • npm test -- --runInBand passed (70 tests).
  • npm run build passed.
  • npx tsc --noEmit passed.
  • npm audit --audit-level=low reports 7 low-severity advisories in the existing Jest/deepmerge dependency chain. The suggested forced fix would downgrade Jest to a breaking version; dependency changes are outside this issue's scope.

Fixes #33

@Code-Kaybee
Code-Kaybee merged commit 861a818 into HyperDevTools:main Nov 6, 2026
4 checks passed
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.

Reject non-finite liquidity bounds and invalid reserve inputs

2 participants