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 Channel worker #924

Merged
merged 65 commits into from
May 26, 2021
Merged

Add Channel worker #924

merged 65 commits into from
May 26, 2021

Conversation

cezarad
Copy link
Contributor

@cezarad cezarad commented May 11, 2021

Closes: #822

Description

  • added a worker for channel
  • added query_connection_channels to the chain handle and runtime
  • redo Return error for uninitialized connection end or channel end query result #923 to return Uninitialized when empty value bytes are returned from the ABCI query for connection and channel. Changed the CLI to return error if connection/ channel does not exist.
  • allow entering the destination channel id in hermes tx raw chan-open-try... and make dst_channel_id and option (used to be ChannelId::default() when not specified but this is a valid channel id.
  • change strategy in config to be either packets(only relay packets) or all (relay from all events, including channel handshake ones)
  • e2e CI changes:
    • added channel worker tests (see below)
    • determine the chain names from config file
    • return the parameters from the test (raw) that creates the clients, connection, channel for the next start test (instead of hardcoding to connection-0, channel-0 etc). This way we can run e2e/run.py multiple times locally without restarting the chains.

To setup for the tests:

  • change strategy in config to all (relay from all events, including channel handshake ones)
  • execute start the chains using ./scripts/dev-env ~/.hermes/config.toml ibc-0 ibc-1 and then
  • create a connection using create a connection : hermes create connection ibc-0 ibc-1

Here are a few tests (also added to e2e CI):

  • case A:
    1. start the relayer hermes start
    2. send hermes tx raw chan-open-init ibc-0 ibc-1 connection-0 transfer transfer
  • Case B:
    1. send hermes tx raw chan-open-init ibc-0 ibc-1 connection-0 transfer transfer
    2. start the relayer hermes start
  • Case C:
    1. send hermes tx raw chan-open-init ibc-0 ibc-1 connection-0 transfer transfer
    2. send hermes tx raw chan-open-try ibc-1 ibc-0 connection-0 transfer transfer -s channel-x , with channel-x being the ID of the channel returned in step 1 above.
    3. start the relayer hermes start
  • Case D:
    1. send hermes tx raw chan-open-init ibc-0 ibc-1 connection-0 transfer transfer
    2. send hermes tx raw chan-open-try ibc-1 ibc-0 connection-0 transfer transfer -s channel-x , with channel-x being the ID of the channel returned in step 1 above
    3. send hermes tx raw chan-open-ack ibc-0 ibc-1 connection-0 transfer transfer -d channel-x -s channel-y , with channel-x being the ID of the channel returned in step 1 and channel-y the ID of the channel returned in step 2 above
    4. start the relayer hermes start

After the last step, wait a couple of seconds for hermes to finish the handshake and verify the channel state on both chains using hermes query channel end ibc-0 transfer channel-x hermes query channel end ibc-0 transfer channel-y. They should both be in open state.

  • TODO before merge:
    • update guide or mark issue with proper tag
    • change CI to packets strategy. Will add a new CI to use a config with all later

For contributor use:

  • Updated the Unreleased section of CHANGELOG.md with the issue.
  • If applicable: Unit tests written, added test to CI.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments.
  • Re-reviewed Files changed in the Github PR explorer.

@cezarad cezarad marked this pull request as draft May 11, 2021 09:46
@cezarad cezarad marked this pull request as ready for review May 12, 2021 15:43
ancazamfir and others added 4 commits May 25, 2021 14:58
 - removed config_example.toml
 - documented the `strategy` field in the default config.toml
 - fix for clippy suspicious_operation_groupings exception
Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

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

Massive work Anca & Cezara!

Had a look over the code and looks good, the tests also run fine. I am still running some further tests with gm but I'm approving already since I consider this done. Mind the "TODO before merge" remark.

Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

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

Wow, amazing work @cezarad and @ancazamfir 💯

Looks all good to me, both the code and the tests I did following the instructions. I only left a few nitpicks etc.

relayer/src/channel.rs Outdated Show resolved Hide resolved
relayer/src/channel.rs Outdated Show resolved Hide resolved
relayer/src/channel.rs Outdated Show resolved Hide resolved
relayer/src/channel.rs Outdated Show resolved Hide resolved
relayer/src/channel.rs Outdated Show resolved Hide resolved
relayer/src/object.rs Outdated Show resolved Hide resolved
relayer/src/object.rs Outdated Show resolved Hide resolved
relayer/src/supervisor.rs Outdated Show resolved Hide resolved
relayer/src/supervisor.rs Show resolved Hide resolved
relayer/src/worker/channel.rs Outdated Show resolved Hide resolved
relayer/src/channel.rs Outdated Show resolved Hide resolved
@ancazamfir ancazamfir requested a review from romac May 26, 2021 10:48
Copy link
Collaborator

@ancazamfir ancazamfir left a comment

Choose a reason for hiding this comment

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

change strategy in CI

@ancazamfir ancazamfir merged commit 26ef2c6 into master May 26, 2021
@ancazamfir ancazamfir deleted the channel822 branch May 26, 2021 13:07
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Added a worker for  channel 

* Added query_connection_channels to the chain handle and runtime

* Redo informalsystems#923 to return `Uninitialized` when empty value bytes are returned

* Changed the CLI to return error if connection/ channel does not exist

* Allow entering the destination channel id in `hermes tx raw chan-open-try...` 

* Change `strategy` in config to be either `packets`(only relay packets) or `all` (relay from all events)

* e2e CI changes

Co-authored-by: Anca Zamfir <zamfiranca@gmail.com>
Co-authored-by: Romain Ruetschi <romain@informal.systems>
Co-authored-by: Adi Seredinschi <adi@informal.systems>
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.

Add channel worker to the reactive relayer
4 participants