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

e2e with IBC tx and test #1216

Merged
merged 13 commits into from
Apr 8, 2022
Merged

e2e with IBC tx and test #1216

merged 13 commits into from
Apr 8, 2022

Conversation

czarcas7ic
Copy link
Member

Closes: #1201

Description

Please note, a majority of this is the original work of @alexanderbez and this is a simple port over from his work on gaia to osmosis.

  • Added IBC functionality through hermes and added a single IBC test to ensure the tx was received on chainB from chainA
  • Changed from name to id as requested by Dev
  • Commented out TestQueryBalance. This is because we are currently relying on the order of tests for this test to pass. As we develop further understanding of how we want these tests to be ran, we can re-enable this and/or use it elsewhere.

For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@czarcas7ic czarcas7ic requested review from alexanderbez and p0mvn April 7, 2022 16:45
Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

Great work on this. Left some comments, please take a look

Also, noticed that fmt is still complaining. We can run it from the tests/e2e folder to make sure that it's applied

Makefile Outdated Show resolved Hide resolved
tests/e2e/docker/hermes.Dockerfile Outdated Show resolved Hide resolved
tests/e2e/docker/hermes.Dockerfile Outdated Show resolved Hide resolved
s.hermesResource, err = s.dkrPool.RunWithOptions(
&dockertest.RunOptions{
Name: fmt.Sprintf("%s-%s-relayer", s.chainA.id, s.chainB.id),
Repository: "ghcr.io/cosmos/hermes-e2e",
Copy link
Member

Choose a reason for hiding this comment

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

It looks like we are depending on an image that is not under our control. Let's push the image to our own repository and switch to using that

Copy link
Member Author

Choose a reason for hiding this comment

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

@nikever do you know how to add this as an image to our repo? I'm not positive of the process

Copy link
Member

Choose a reason for hiding this comment

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

To avoid blocking this PR, let's create an issue to address this separately?

It should be fine to use the cosmos image temporarily, The main concern about depending on external images, especially with the latest tag, is that whenever they make a change, our tests might get broken

Copy link
Member

Choose a reason for hiding this comment

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

The credentials for the osmobot Docker account are saved as GitHub Secrets. You can use them to build the Image via CI as in https://github.com/osmosis-labs/osmosis/blob/main/.github/workflows/docker.yml#L24-L29

I will also create personal accounts for both of you on our Docker account.

Lets use a new repository osmolabs/osmosis-e2e for all these new images

Makefile Outdated
@@ -238,6 +238,11 @@ benchmark:
docker-build-debug:
@docker build -t osmolabs/osmosisd-e2e --build-arg IMG_TAG=debug -f e2e.Dockerfile .

# TODO: Push this to the Cosmos Dockerhub so we don't have to keep building it
Copy link
Member

Choose a reason for hiding this comment

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

It looks like we are already not building this image in ci. Instead, we grab it from here: https://github.com/orgs/cosmos/packages/container/package/hermes-e2e

I think we should push the image to our own docker hub or github packages and use that instead

Copy link
Member Author

Choose a reason for hiding this comment

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

@nikever can we link on getting this on our docker hub as well?

Copy link
Member

Choose a reason for hiding this comment

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

I would also like to learn about how to get access to our docker hub. Please let me know if it's possible to get permissions for that

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, good idea. It's very easy to push to our org. All you need is a github PAT (personal access token) and then you login with that and just push it. Note, just make sure the package set to public.

tests/e2e/e2e_util_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_util_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_util_test.go Outdated Show resolved Hide resolved
tests/e2e/scripts/hermes_bootstrap.sh Outdated Show resolved Hide resolved
tests/e2e/e2e_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_test.go Outdated Show resolved Hide resolved
Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

Please restore commented-out lines in TestQueryBalances. Other than that LGTM!

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

🎉 🎉 🎉

Makefile Outdated
@@ -238,6 +238,11 @@ benchmark:
docker-build-debug:
@docker build -t osmolabs/osmosisd-e2e --build-arg IMG_TAG=debug -f e2e.Dockerfile .

# TODO: Push this to the Cosmos Dockerhub so we don't have to keep building it
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, good idea. It's very easy to push to our org. All you need is a github PAT (personal access token) and then you login with that and just push it. Note, just make sure the package set to public.

s.Require().NoError(err)

endpoint := fmt.Sprintf("http://%s/state", s.hermesResource.GetHostPort("3031/tcp"))
s.Require().Eventually(
Copy link
Contributor

Choose a reason for hiding this comment

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

Validators? You mean the node containers themselves? I believe we already have a health check for that. Are you suggesting that we implement a test that queries for validators?

tests/e2e/e2e_test.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2022

Codecov Report

Merging #1216 (826bad4) into main (eed3294) will decrease coverage by 0.06%.
The diff coverage is 25.80%.

@@            Coverage Diff             @@
##             main    #1216      +/-   ##
==========================================
- Coverage   21.03%   20.96%   -0.07%     
==========================================
  Files         196      196              
  Lines       25349    25337      -12     
==========================================
- Hits         5332     5312      -20     
- Misses      19054    19066      +12     
+ Partials      963      959       -4     
Impacted Files Coverage Δ
x/gamm/keeper/pool.go 64.91% <0.00%> (ø)
x/gamm/pool-models/balancer/balancer_pool.go 62.06% <ø> (-1.82%) ⬇️
x/gamm/types/pool.go 0.00% <ø> (ø)
x/gamm/keeper/pool_service.go 56.61% <23.07%> (-0.61%) ⬇️
x/gamm/keeper/invariants.go 29.41% <29.41%> (+29.41%) ⬆️
x/gamm/client/cli/query.go 37.09% <0.00%> (-1.59%) ⬇️
x/gamm/types/tx.pb.go 0.66% <0.00%> (ø)
x/gamm/types/query.pb.go 0.85% <0.00%> (ø)
x/gamm/keeper/grpc_query.go 42.20% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9cf9f6...826bad4. Read the comment docs.

@czarcas7ic
Copy link
Member Author

Had a call with @nikever, he was able to get our own hosted hermes image and integrated it into the e2e test. He will now attempt a small modification on the gh action and after he pushes this we can merge this pr

Makefile Outdated Show resolved Hide resolved
tests/e2e/docker/hermes.Dockerfile Outdated Show resolved Hide resolved
tests/e2e/e2e_setup_test.go Show resolved Hide resolved
@niccoloraspa
Copy link
Member

e2e running correctly with the last changes: https://github.com/osmosis-labs/osmosis/runs/5889286653?check_suite_focus=true

🚀🚀

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

🚢

@czarcas7ic czarcas7ic merged commit 20cfa05 into main Apr 8, 2022
@czarcas7ic czarcas7ic deleted the adam/e2e-test-ibc branch April 8, 2022 17:43
@ValarDragon ValarDragon mentioned this pull request Apr 14, 2022
User: "root",
Cmd: []string{
"hermes",
"create",
Copy link

Choose a reason for hiding this comment

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

Note that we plan to change the create channel invocation in Hermes. From

create channel <CHAIN_A> <CHAIN_B> --port-a=transfer --port-b=transfert

to

create channel <CHAIN-A-ID> <CONNECTION-A-ID> --port-a <PORT-ID> --port-b <PORT-ID>.

In other words, you need to (1) create connection and then (2) pass the connection identifier when you invoke create channel. This mean you would need to adapt the CI to add an additional CLI command for creating a new connection, as follows:

create connection s.chainA.id s.chainB.id.

Assuming the chains are newly-spawned, the connection identifier will be connection-0 on both chains. Then you would need to invoke create channel as follows:

create channel s.chainA.id connection-0 --port-a=transfer --port-b=transfer

Copy link

Choose a reason for hiding this comment

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

PS. This change was motivated by relayer operators abusing the command (we got complaints that people create many channels in production with varying client security parameters, ref: informalsystems/hermes#1421).

Would be glad to take your requirements into account and do stuff differently if you have suggestions to change this.

Copy link
Member

Choose a reason for hiding this comment

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

This seems like a great change to me! Thanks for letting us know / good design decision!

Copy link

Choose a reason for hiding this comment

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

Great to hear it won't affect your setup adversely.

The change will land in Hermes v0.14, slated for end of April.

p0mvn added a commit that referenced this pull request Apr 24, 2022
* second chain with tests

* add hermes, comment out balance query for now

* eventually

* Update Makefile

Co-authored-by: Roman <[email protected]>

* remove gas fees and unused functions

* readded check

* Nicco changes to own hermes image

* Remove unused hermes.Dockerfile

* Use a single Dockerfile for both debug and official image

* readd build hermes in makefile

* remove hermes

* Set correct golang image and use correct debug image tag

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Niccolo Raspa <[email protected]>
@p0mvn p0mvn mentioned this pull request Apr 24, 2022
8 tasks
p0mvn added a commit that referenced this pull request Apr 24, 2022
* second chain with tests

* add hermes, comment out balance query for now

* eventually

* Update Makefile

Co-authored-by: Roman <[email protected]>

* remove gas fees and unused functions

* readded check

* Nicco changes to own hermes image

* Remove unused hermes.Dockerfile

* Use a single Dockerfile for both debug and official image

* readd build hermes in makefile

* remove hermes

* Set correct golang image and use correct debug image tag

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Niccolo Raspa <[email protected]>
czarcas7ic added a commit that referenced this pull request Apr 29, 2022
* Setup e2e tests on a single chain; add balances query test (#1193)

* create e2e image and a makefile step to build

* progress

* e2e tests in ci

* use root distroless image and correct volume path

* remove chain b references

* implement query balances

* implement TestQueryBalances

* trigger worflow

* trigger

* test-e2e Makefile step

* fmt and sleep if service unavailable

* README

* restore branches

* add changelog entry

* exclude e2e from regular tests

* -E flag for grep exclusion

* grep

* go mod tidy --compat=1.17

* manually tidy go.mod

* second e2e chain with expanded test (#1206)

* e2e with IBC tx and test (#1216)

* second chain with tests

* add hermes, comment out balance query for now

* eventually

* Update Makefile

Co-authored-by: Roman <[email protected]>

* remove gas fees and unused functions

* readded check

* Nicco changes to own hermes image

* Remove unused hermes.Dockerfile

* Use a single Dockerfile for both debug and official image

* readd build hermes in makefile

* remove hermes

* Set correct golang image and use correct debug image tag

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Niccolo Raspa <[email protected]>

* missing e2e ci job

* cleanup Makefile and ci workflows (#1203)

* cleanup makefile and ci workflows

* update changelog

* fix sim test

* fix makefile and rename docker repo

* fix make test-cover (#1219)

* refactor: begin modularizing e2e tests in preparation for upgrade (#1293)

* begin modularizing e2e test in preparation for upgrade

* rename common package to util

* move chain related constants from util to chain package

* fix genesis.go

* exctract initNodes into the genesis package

* remove genesis package, move all logic to chain

* continue cleaning up chain package and refactoring e2e

* store chains in a slice

* reuse common cdc from util package

* lexicographical reorder of functions in config.go of chain package

* clean up names

* refactor: implement Dockerized chain initialization in e2e tests (#1330)

Closes: #XXX

## What is the purpose of the change

This is a follow-up PR to #1293 and builds upon its work. It is part of the e2e test chain upgrade epic #1235 

This PR introduces the ability to run chain initialization in a Docker container by running the following:
```
docker run -v < path >:/tmp/osmo-test osmosis-e2e-chain-init:debug --data-dir=/tmp/osmo-test
```
All chain data is placed at the given `< path >` that is mounted as a volume on the container. In addition, this PR introduces documentation about the current state of the e2e tests. 

## Brief change log

- [pull chain temp folder creation our of chain to e2e package](c175289)
- [create image and makefile steps to initialize chain state](de89119)
- [allow for running the upgrade initialization in Docker by providing a data dir](dabb683)
- [improve abstractions for chain initialization and add README](cf0d8a3)
- improve README

## Testing and Verifying

- ran e2e tests locally a few times
- `make build-e2e-chain-init`
- `make docker-build-e2e-chain-init`
- `docker run -v /home/roman/cosmos/osmosis/tmp:/tmp/osmo-test osmosis-e2e-chain-init:debug --data-dir=/tmp/osmo-test`

All steps worked as desired

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? no
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no
  - How is the feature or change documented? improved `tests/e2e/README.md`

## Next Steps

The next step is to switch our chain initialization logic in `func (s *IntegrationTestSuite) configureChain(chainId string)` to use Dockertest and the newly introduced container. Then, mount the genesis and configs on the Osmosis containers, against which the e2e tests are executed

* Setup e2e tests on a single chain; add balances query test (#1193)

* create e2e image and a makefile step to build

* progress

* e2e tests in ci

* use root distroless image and correct volume path

* remove chain b references

* implement query balances

* implement TestQueryBalances

* trigger worflow

* trigger

* test-e2e Makefile step

* fmt and sleep if service unavailable

* README

* restore branches

* add changelog entry

* exclude e2e from regular tests

* -E flag for grep exclusion

* grep

* go mod tidy --compat=1.17

* manually tidy go.mod

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Niccolo Raspa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[E2E] add ibc relayer functionality and enable ibc tests
7 participants