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

test: Add chain upgrade test as gh action #430

Merged
merged 25 commits into from
Aug 23, 2023

Conversation

spoo-bar
Copy link
Contributor

@spoo-bar spoo-bar commented Aug 22, 2023

Using the Interchain test framework, this PR adds a chain upgrade test case as well as a gh workflow which runs the test for every PR targeting main

How it works

There are two hardcoded values for the test. ( 👀 /interchaintest/setup.go)

  1. initialVersion - whose value is expected to be the latest release of the repo/the version that mainnet is running on.
  2. upgradeName - whose value is expected to be the next release upgrade handler name

Steps

  1. The test starts a new archway chain with the initialVersion
  2. Once the chain starts, it creates a software upgrade proposal for the new upgrade at currentHeight + 10 blocks
  3. The test user votes and the prop passes
  4. When upgrade height is reached, the nodes are brought down
  5. The test applies the upgrade upgradeName
  6. The nodes are started again. Any bad upgrade logic will be caught here. (e.g missing upgrade handler, did not add module store key)
  7. Wait for 10 blocks of the post-upgrade chain to ensure upgrade went successfully

e.g. Here is gh workflow where we I tried to push changes but there is no upgrade handler for the new upgrade yet and thus the action fails. https://github.com/archway-network/archway/actions/runs/5939415337/job/16106111680

How to use it

There are two ways to use this:

  1. Test via github workflow
    The Run Interchaintest github workflow automatically runs on every PR targeting main.

  2. Test locally
    This is a bit more complicated. The test does not use the docker builds that our scripts generate. The interchaintest framework integrates with heighliner built images. So to run the test locally, you would need to do the following:

    1. Install Heighliner
    git clone https://github.com/strangelove-ventures/heighliner.git
    cd heighliner
    go install
    1. Build the current branch docker image
    heighliner build --org archway-network --repo archway --dockerfile cosmos --build-target "make build" --build-env "BUILD_TAGS=muslc" --binaries "build/archwayd" --git-ref <local_branch_name> --tag local
    docker image tag acrechain:local archway:local # There is an issue with heighliner where it wrongly names the docker image
    docker rmi acrechain:local
    1. Build the last release docker image
    heighliner build --org archway-network --repo archway --dockerfile cosmos --build-target "make build" --build-env "BUILD_TAGS=muslc" --binaries "build/archwayd" --git-ref v3.0.0 --tag local
    docker image tag acrechain:3.0.0archway:3.0.0
    docker rmi acrechain:3.0.0
    1. Now go to Archway repo root and
    cd interchaintest
    go test -v -race -run TestChainUpgrade

Why we need this

  1. Ensure we dont miss any critical upgrade logic
  2. Peace of mind for spoo_bar as she works on sdk 0.47 upgrade
  3. Now that we have the framework integrated, we can use this to add more ibc-verse tests such as ensuring IBC conformance with important chains (like gaia and osmosis) and that ICA works as expected

Note

The default Interchaintest framework does not work with Archway as it dosent handle Coin precision of 18 very well. There are some hardcoded values for genesis accounts and gentx which amount to too little for archway. So, I have forked the repo and just fixed the hardcoded values to make more sense for Archway.

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (84aeeef) 69.54% compared to head (c2c22ef) 69.54%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #430   +/-   ##
=======================================
  Coverage   69.54%   69.54%           
=======================================
  Files          67       67           
  Lines        4006     4006           
=======================================
  Hits         2786     2786           
  Misses       1124     1124           
  Partials       96       96           
Files Changed Coverage Δ
app/app_upgrades.go 61.90% <ø> (ø)
app/app.go 90.62% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@spoo-bar spoo-bar marked this pull request as ready for review August 23, 2023 09:44
@spoo-bar spoo-bar requested review from a team as code owners August 23, 2023 09:44
@spoo-bar spoo-bar requested a review from loverdos August 23, 2023 09:44
Copy link
Contributor

@zanicar zanicar left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jlehtimaki jlehtimaki left a comment

Choose a reason for hiding this comment

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

lgtm and works! GJ!

@spoo-bar spoo-bar merged commit 0f74dfb into main Aug 23, 2023
9 checks passed
@spoo-bar spoo-bar deleted the spoorthi/adding-chain-upgrade-test branch August 23, 2023 11:41
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