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

Add integration tests to local net #74

Merged
merged 19 commits into from
Jul 13, 2022
Merged

Add integration tests to local net #74

merged 19 commits into from
Jul 13, 2022

Conversation

asalzmann
Copy link
Contributor

@asalzmann asalzmann commented Jul 11, 2022

Summary
Add integration tests to local net to test the end-to-end liquid staking and redemption flow.

Specifically

  • Add integration tests to local net
    • Add bats files to scripts-local
    • Add tests to scripts-local/tests/integration_tests.bats
  • add BLOCK_SLEEP function
  • Fix bug in transfer ack that causes hermes to crash (only process transfer acks if the transfer was initiated from the stakeibc module account)
  • Add a query to get seconds remaining in an epoch (convenient for testing)
  • Add scripts-local/test-utils/run_any_cli_command.sh to run one off commands that are helpful when testing

Test plan

➜  stride git:(integration-testing) ✗ make test-integration
sh scripts-local/tests/run_all_tests.sh
integration_tests.bats
 ✓ address names are correct
 ✓ ibc transfer updates all balances
 ✓ liquid stake mints stATOM
 ✓ host zone successfully registered
 ✓ tokens were transferred to GAIA after liquid staking
 ✓ tokens on GAIA were staked
 ✓ [NOT-IMPLEMENTED] rewards are being reinvested
 ✓ [NOT-IMPLEMENTED] redemption works
 ✓ [NOT-IMPLEMENTED] claimed tokens are returned to sender
 ✓ [NOT-IMPLEMENTED] exchange rate is updating

10 tests, 0 failures

Up next
These tests have been specced but not yet implemented (we should spec and add more tests too!)

# check that a second liquid staking call kicks off reinvestment
@test "rewards are being reinvested" {
  # check the rewards balance
  # wait a day
  # check the withdrawal account balance
  # wait a day
  # check that 90% of rewards were transferred to the delegation account
  # check that 10% of rewards were transferred to the rev EOA
  # wait a day
  # check that rewards were staked
}

# check that redemptions and claims work
@test "redemption works" {
  # call redeem-stake
  # check for an unbonding record
  # check that a UserRedemptionRecord was created with isClaimabled = false
  # wait for the unbonding period to pass
  # check that the tokens were transferred to the delegation account
  # wait for an epoch to pass
  # check that the tokens were transferred to the redemption account
}

@test "claimed tokens are returned to sender" {
  # check that the UserRedemptionRecord has isClaimable = true
  # claim the record
  # check that UserRedemptionRecord has isClaimable = false
  # check that the tokens were transferred to the sender account
  # check that the 
}

# check that exchange rate is updating
@test "exchange rate is updating" {
  # read the exchange rate
  # wait a day
  # check that the exchange rate has updated
}

Copy link
Contributor

@shellvish shellvish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to merge imo!

scripts-local/tests/ica_redeem.sh Outdated Show resolved Hide resolved
scripts-local/tests/integration_tests.bats Show resolved Hide resolved
utils/utils.go Outdated Show resolved Hide resolved
x/epochs/client/cli/query.go Show resolved Hide resolved
@asalzmann asalzmann merged commit 98dd6ba into main Jul 13, 2022
riley-stride pushed a commit that referenced this pull request Sep 5, 2022
* Add thornode chain registry

* Update seeds info

* Add valid tendermint rcp endpoint
sontrinh16 pushed a commit to notional-labs/stride that referenced this pull request Mar 27, 2023
asalzmann added a commit that referenced this pull request Jan 26, 2024
Co-authored-by: Riley Edmunds <riley@stridelabs.co>
Co-authored-by: riley-stride <104941670+riley-stride@users.noreply.github.com>
Co-authored-by: Aidan Salzmann <aidan@stridelabs.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants