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

Handshake impls from relayer loop #421

Merged
merged 42 commits into from
Nov 27, 2020
Merged

Handshake impls from relayer loop #421

merged 42 commits into from
Nov 27, 2020

Conversation

ancazamfir
Copy link
Collaborator

@ancazamfir ancazamfir commented Nov 25, 2020

Closes: #376
Closes: #377
Closes: #378

Description

  • Triggered from rrly -c config.toml v-0, added a polling loop for client, connection and channel.
  • Refactored some of the CLI code and signature of the supporting relayer functions.
  • Moved the code from relayer/src/tx in the corresponding relayer modules.

Testing

Currently works with a known issue from the light client:

The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: Error(Context { kind: LightClient, source: Some(Error(Context { kind: NoWitnesses, source: None, backtrace: Some(   0: backtrace::backtrace::libunwind::trace

Also getting some RPC errors in the monitors once in a while, will debug, but in this case the handshake continues fine

Other mentions

  • removed flexible connection Id for connOpenInit as this is being heavily reworked in ICS and will be avail in future cosmos-sdk release. Will pick it up again as part of integration with stargate-? next releases.
  • relayer::config should hold type Ids, code is currently quite verbose to do the Id checks all the time
  • there is overlap between relayer::config and ConnectionConfig, ForeignClientConfig and ChannelConfig. These should be consolidated

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.

andynog and others added 30 commits November 3, 2020 14:37
- Added a new test keyring backend to support adding keys to file system (under home folder)
- Refactored logic to add key to be part of the keystore and not the command
- Switched the keybase on a chain to use the test keyring
- Key seed file is saved in the test keystore default folder (/home/andy/.rrly)
- Clean up remaining key_seed flag for tx cmds
- Refactored keybase to include chain config
- Refactoring keyring methods to use chain config
- Logic to use configured key to sign tx
@ancazamfir ancazamfir self-assigned this Nov 25, 2020
@codecov-io
Copy link

codecov-io commented Nov 25, 2020

Codecov Report

Merging #421 (2bc4d44) into master (b1b37f5) will increase coverage by 23.0%.
The diff coverage is 67.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #421      +/-   ##
=========================================
+ Coverage    13.6%   36.7%   +23.0%     
=========================================
  Files          69     154      +85     
  Lines        3752   11090    +7338     
  Branches     1374    4263    +2889     
=========================================
+ Hits          513    4072    +3559     
- Misses       2618    6382    +3764     
- Partials      621     636      +15     
Impacted Files Coverage Δ
modules/src/events.rs 0.0% <0.0%> (ø)
modules/src/ics02_client/events.rs 0.0% <ø> (ø)
modules/src/ics02_client/msgs.rs 0.0% <0.0%> (ø)
modules/src/ics02_client/raw.rs 0.0% <0.0%> (ø)
modules/src/ics03_connection/error.rs 13.6% <0.0%> (-19.7%) ⬇️
modules/src/ics04_channel/error.rs 75.0% <ø> (+50.0%) ⬆️
modules/src/ics04_channel/msgs/chan_open_try.rs 67.0% <ø> (ø)
modules/src/ics04_channel/msgs/recv_packet.rs 63.5% <ø> (ø)
modules/src/ics04_channel/msgs/timeout.rs 69.2% <ø> (ø)
modules/src/ics04_channel/packet.rs 70.4% <ø> (+70.4%) ⬆️
... and 286 more

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 db44b16...2bc4d44. Read the comment docs.

@romac
Copy link
Member

romac commented Nov 26, 2020

@ancazamfir Can you please expand a bit on what is the problem here?

there is an issue, I believe runtime related, cannot call build_conn_and_send() directly, had to call separately build_conn() and then dst_chain.send_tx(). So currently, in the poll loop for both connection and channel, you will notice these two calls at every step.

@ancazamfir
Copy link
Collaborator Author

@ancazamfir Can you please expand a bit on what is the problem here?

I don't see this anymore, will remove from the list.

@ancazamfir
Copy link
Collaborator Author

ancazamfir commented Nov 26, 2020

No errors with light client verification disabled:

$ rrly -c loop_config.toml v-0
    Finished dev [unoptimized + debuginfo] target(s) in 1.19s
     Running `target/debug/relayer -c loop_config.toml v-0`
Nov 26 17:28:46.732  INFO relayer::event::monitor: running listener chain.id=ibc0
Nov 26 17:28:46.806  INFO relayer::event::monitor: running listener chain.id=ibc1
🍭  Client on ChainId { id: "ibc0", version: 0 } is created ClientId("ibc0client166")

🍭  Client on ChainId { id: "ibc1", version: 0 } is created ClientId("ibc0client166")

🥂  ConnInit ConnectionSideConfig { chain_id: ChainId { id: "ibc0", version: 0 }, connection_id: ConnectionId("ibc0connection166"), client_id: ClientId("ibc0client166") }
elapsed time 4

🥂  ConnTry ConnectionSideConfig { chain_id: ChainId { id: "ibc1", version: 0 }, connection_id: ConnectionId("ibc1connection166"), client_id: ClientId("ibc0client166") }
elapsed time 13

🥂  ConnAck ConnectionSideConfig { chain_id: ChainId { id: "ibc0", version: 0 }, connection_id: ConnectionId("ibc0connection166"), client_id: ClientId("ibc0client166") }
elapsed time 12

🥂  ConnConfirm ConnectionSideConfig { chain_id: ChainId { id: "ibc1", version: 0 }, connection_id: ConnectionId("ibc1connection166"), client_id: ClientId("ibc0client166") }
elapsed time 8

🥂  🥂  🥂  Connection handshake finished for [ConnectionConfig {
    a_config: ConnectionSideConfig {
        chain_id: ChainId {
            id: "ibc0",
            version: 0,
        },
        connection_id: ConnectionId(
            "ibc0connection166",
        ),
        client_id: ClientId(
            "ibc0client166",
        ),
    },
    b_config: ConnectionSideConfig {
        chain_id: ChainId {
            id: "ibc1",
            version: 0,
        },
        connection_id: ConnectionId(
            "ibc1connection166",
        ),
        client_id: ClientId(
            "ibc0client166",
        ),
    },
}]
🥳  ChanInit ChannelConfigSide { chain_id: ChainId { id: "ibc0", version: 0 }, connection_id: ConnectionId("ibc0connection166"), client_id: ClientId("ibc0client166"), port_id: PortId("transfer"), channel_id: ChannelId("ibc0xfer166") }
elapsed time 4

🥳  ChanTry ChannelConfigSide { chain_id: ChainId { id: "ibc1", version: 0 }, connection_id: ConnectionId("ibc1connection166"), client_id: ClientId("ibc0client166"), port_id: PortId("transfer"), channel_id: ChannelId("ibc0xfer166") }
elapsed time 8

🥳  ChanAck ChannelConfigSide { chain_id: ChainId { id: "ibc0", version: 0 }, connection_id: ConnectionId("ibc0connection166"), client_id: ClientId("ibc0client166"), port_id: PortId("transfer"), channel_id: ChannelId("ibc0xfer166") }
elapsed time 6

🥳  ChanConfirm ChannelConfigSide { chain_id: ChainId { id: "ibc1", version: 0 }, connection_id: ConnectionId("ibc1connection166"), client_id: ClientId("ibc0client166"), port_id: PortId("transfer"), channel_id: ChannelId("ibc0xfer166") }
elapsed time 8

🥳  🥳  🥳  Channel handshake finished for ChannelConfig {
    ordering: Unordered,
    a_config: ChannelConfigSide {
        chain_id: ChainId {
            id: "ibc0",
            version: 0,
        },
        connection_id: ConnectionId(
            "ibc0connection166",
        ),
        client_id: ClientId(
            "ibc0client166",
        ),
        port_id: PortId(
            "transfer",
        ),
        channel_id: ChannelId(
            "ibc0xfer166",
        ),
    },
    b_config: ChannelConfigSide {
        chain_id: ChainId {
            id: "ibc1",
            version: 0,
        },
        connection_id: ConnectionId(
            "ibc1connection166",
        ),
        client_id: ClientId(
            "ibc0client166",
        ),
        port_id: PortId(
            "transfer",
        ),
        channel_id: ChannelId(
            "ibc0xfer166",
        ),
    },
}

@adizere adizere merged commit 2aa305b into master Nov 27, 2020
@adizere adizere deleted the anca/relayer_loop branch November 27, 2020 14:52
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Added logic to generate GRPC client from cosmos.auth proto (#337)

* Adding logic to use GRPC client (#337)

* Grpc client connection retrieves account sequence (#337)

* Removed the account sequence flag from the tx raw commands (#337)

* Removed instructions to query and specify account sequence from tx raw command (#337)

* Logic to fetch GRPC endpoint address from config (#337)

* Fixing tests (informalsystems#361)

* Logic to use the address from the key seed (#337)

* Added boilerplate code for a keys add command to the relayer (informalsystems#363)

* Removing key flag from tx cmds

* Adding logic to get key specified in the config

* Logic to get the key specified in the config (informalsystems#363)

* Removed the -k flag from the tx raw commands (informalsystems#363)

* More logic to add key command (informalsystems#363)

* key add command for memory store working (informalsystems#363)

* Added logic to persist key seed in 'home' folder (informalsystems#363)

* Changes implemented (informalsystems#363):
- Added a new test keyring backend to support adding keys to file system (under home folder)
- Refactored logic to add key to be part of the keystore and not the command
- Switched the keybase on a chain to use the test keyring
- Key seed file is saved in the test keystore default folder (/home/andy/.rrly)

* Logic to use the key_name parameter from the config to add key. Removed name parameter from keys add cmd (informalsystems#363)

* Changed the logic to get the key from the test keyring file store (informalsystems#363)

* Implemented changes: (informalsystems#363)
- Clean up remaining key_seed flag for tx cmds
- Refactored keybase to include chain config
- Refactoring keyring methods to use chain config
- Logic to use configured key to sign tx

* Updated the README instructions (informalsystems#363)

* Disable the 'keys restore' command for now (informalsystems#363)

* Added 'keys list' command to show key added on a chain (informalsystems#363)

* Added entry for issue informalsystems#363 (PR informalsystems#408)

* Refactored the bound variables to use the full name per comment suggestion (informalsystems#408)

* Move key retrieval, memo and timeout height inside send_tx

* Add the client creation, connection and channel handshake

* remove sleeps

* More error handling, cleanup

* Macro for channel CLIs

* Macro for connection CLIs

* Where src/dst make no sense rename to a/b, also fix a few bugs after last commits

* cleanup

* cargo fmt

* Use Romain's skip-verif until backwards verification is done

* fix CLI bugs

Co-authored-by: Andy Nogueira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants