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 verification logic #1878

Merged

Conversation

seanchen1991
Copy link
Contributor

@seanchen1991 seanchen1991 commented Feb 14, 2022

Closes: #1389

Description

Adds checks for ConnectionEnd::versions and Counterparty::prefix fields to the check_destination_connection_state method.


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests: integration (for Hermes) or unit/mock tests (for modules).
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

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.

Looks good, neat work Sean!

@adizere adizere merged commit 563ee70 into informalsystems:master Feb 15, 2022
@@ -1196,10 +1197,17 @@ fn check_destination_connection_state(
|| existing_connection.counterparty().connection_id()
== expected_connection.counterparty().connection_id();

// TODO check versions and store prefix
// https://github.com/informalsystems/ibc-rs/issues/1389
let good_version = existing_connection.versions() == expected_connection.versions();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure about this, it's more like existing_connection.versions() is a subset of the expected_connection.versions(). Also it's not clear that the versions of the expected_connection are properly populated by caller here. Maybe it should get the versions on source and destination, and stuff the intersection in the expected_connection.
This code will work until a second connection version is introduced. It's also the case that we don't have a gRPC endpoint to query connection versions supported by a chain, currently hardcoded. Unless a new gRPC is provided, we will need to put the chain supported versions in the config file (similar story as for store prefix which is not queryable but this one we put it in the config file)

hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Add checks for version and prefix for expected connections.

* Add some doc comments.

* Add changelog file.

* Add more doc comments.

* Remove `to_vec` call.

* Improve changelog entry.
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.

Connection handshake incomplete verification logic
3 participants