-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[x/gamm][Testing] generalize TestCalculateAmountOutAndIn_InverseRelationship #1371
Comments
@xBalbinus would you be interested in working on this? Thanks for offering to help with the tests |
Yo @p0mvn ! Of course! Taking a look. |
From @ValarDragon : Recently, great tests have been added that test certain invariants (in the tests called "inverse relations") that are expected to hold trrue for any pool: https://github.com/osmosis-labs/osmosis/blob/main/x/gamm/pool-models/balancer/amm_test.go#L89-L216 We should make code reuse possible for using the same core logic in stableswap tests. Theres a couple ways this can be done: I suggest we do the following:
There are alternative approaches if for some reason this produces extra overheads though. |
^ Huge shoutout to @mattverse for helping with this PR, I also fixed a small thing to keep the linter running. All tests are passing & ready for merge upon approval. |
Background
The following PRs contributed to
TestCalculateAmountOutAndIn_InverseRelationship
inbalancer
package:From "Gamm Refactor",
CalcInAmtGivenOut
andCalcOutAmtGivenIn
are defined on thePoolI
interface.There are 2 pool implementations for
PoolI
:balancer
andstableswap
. The previously added tests only testbalancer
at the moment. However, since the inverse relationship applies to bothbalancer
andstableswap
, these tests can be generalized to apply to all possible implementations.Suggested Design
x/gamm/pool-models
TestCalculateAmountOutAndIn_InverseRelationship
test fromx/gamm/pool-models/balancer
tox/gamm/pool-models
balancer
andstableswap
pool implementationsAcceptance Criteria
TestCalculateAmountOutAndIn_InverseRelationship
tests both pool implementationsThe text was updated successfully, but these errors were encountered: