osmosis
osmosis copied to clipboard
[x/gamm][stableswap]: Ensure rounding is properly handled for all scaling operations
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