Skip to content

Add precision-loss and fractional slippage test scenarios #16

Description

@Code-Paragon

Problem

The CONTRIBUTING.md requires precision-loss checks, but the current test.rs only uses clean, round numbers (1000, 100), completely ignoring integer truncation risks in Soroban's i128 math.

Expected behavior

A new test scenario deposits highly fragmented, prime-number liquidity values, processes a fractional yield harvest, and withdraws to prove that truncation does not result in trapped dust.

Files to update

  • src/test.rs

Project relevance

Guarantees the mathematical integrity of the fractional-reserve exchange rate model, proving that integer division rounding heavily favors the protocol over attackers.

Acceptance criteria

  • Feature works as described
  • Tests are added or updated where needed
  • Documentation is updated where needed
  • The test asserts that the Vault's remaining underlying_balance is >= 0 after all shares are burned
  • No TypeScript, lint, test, or build errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions