Skip to content
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

Make test scaffolding for superfluid #1033

Closed
Tracked by #1030
daniel-farina opened this issue Mar 3, 2022 · 2 comments
Closed
Tracked by #1030

Make test scaffolding for superfluid #1033

daniel-farina opened this issue Mar 3, 2022 · 2 comments
Assignees
Labels
T:task ⚙️ A task belongs to a story

Comments

@daniel-farina
Copy link
Contributor

daniel-farina commented Mar 3, 2022

@ValarDragon to add more details

@mattverse already doing some work on this.

@daniel-farina daniel-farina added the T:task ⚙️ A task belongs to a story label Mar 3, 2022
@ValarDragon
Copy link
Member

ValarDragon commented Mar 4, 2022

I think as a general guide, we want to have re-usable helper methods, where a module like superfluid doesn't have to reason about the deep internals of other modules. Furthermore, we want to use logic as close to the state machines as possible, for instance when we lock tokens, use MsgLockTokens, unless we're trying to deliberately setup ourselves in a weird state. (Similar for CreateValidator w/ staking, or for running an epoch we should use BeginBlock). We already have helper methods for CreateValidator & BeginBlock in the apptesting module.

Concretely, superfluid shouldn't really be directly constructing PoolParams or PoolAssets, or doing swaps to alter spot price. These should be callouts to testing helper methods in the gamm module.

Right now the superfluid tests are complex because they:

  • Don't re-use common helper methods
  • Use methods that should be relatively internal to the module in the re-used setup code. (E.g. Setting the spot price of a pool by overriding the superfluid state entry for it, rather than updating the gamm pool to emit a different spot price)
  • Use a different flow than messages would be using (This could moreso be the lockup modules fault, with the message server not just being a wrapper around the keeper function)

So I think the next steps are:

  • Create a way for being able to define re-usable test helper methods across the codebase
    • Add some helpers for testing to its own package in app #1008 was a first solution for this. I think we should try changing that interface to a struct that we embed in each module's test_suite struct, and see how the API / usability compares.
    • A decision regarding struct vs interface suffices imo for considering this first bullet point done.
    • UPDATE: Decision is struct
  • Make an example balancertesting module that has publicly exposed methods for the suite.
  • Make test helper methods in Gamm that allow setting the spot price of a pool, via minting to a dummy address and doing a swap. Similarly, make it easy to make pool with default fees, 0 fees.
  • Doing similar for lock tokens helper methods going to a lockuptesting rather than being in superfluid
  • Adding RefreshIntermediaryDelegation tests to Superfluid
  • Adding distribution rewards tests with parameterized multi-epoch 'scenarios'. (Bondings to various pool, asset pairs)

@ValarDragon
Copy link
Member

Per discussion on thursday call, last component was RefresHIntermediaryDelegations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:task ⚙️ A task belongs to a story
Projects
Archived in project
Development

No branches or pull requests

3 participants