osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

[x/gamm][stableswap]: Ensure rounding is properly handled for all scaling operations

Open AlpinYukseloglu opened this issue 3 years ago • 0 comments

Background

Given how we scale/descale both pool reserves and token inputs/output, there isn't a single way to handle scaling-related rounding that works for all core functions (mainly pool joins, pool exits and swaps). We need to ensure that all of these operations are handled properly + have tests that help us build confidence that they are correct.

Suggested Design

  • See scaling factor rounding section here: https://hackmd.io/n3OpsedfSMWGNkPsqZlvrA
  • At a bare minimum, we should test that mirrored operations with zero swap fee yield the same output (e.g. for swaps: swap foo to bar and then back to foo (expect same amount of foo) and for pool joins: join and exit a pool (expect same amount of assets)

Acceptance Criteria

  • All new and existing tests pass

AlpinYukseloglu avatar Sep 29 '22 18:09 AlpinYukseloglu