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

Handler for channel open init #452

Merged
merged 35 commits into from
Jan 15, 2021
Merged

Handler for channel open init #452

merged 35 commits into from
Jan 15, 2021

Conversation

cezarad
Copy link
Contributor

@cezarad cezarad commented Dec 17, 2020

Closes: informalsystems/ibc-rs#97

Description

  1. Main modified files:
  • ics04_channel/handler/chan_open_init.rs contains the definition of the handler and three very basic tests.

ChanOpenInit returns the capability associated with the port's identity and channel's identity in the spec and the go version. Since the ChannelId is no longer visible in the handler probably the keeper should store the capability of the channel then there is no need for the handler to return a capability. Current version just returns the port capability (in the channel result) which respects the prototype in the spec but not the semantics.

  • ics04_channel/context.rs defines the interface for the context under which channels exists

  • ibc-rs/modules/src/mock/context.rs extends the store of MockContext with the stores required by channels: A map to store channels and a Map for the sequence numbers used by packets.

  1. medium changes:
  • ics26_routing/handler.rs added handler for ChanOpenInit and tests for it.
  • ics04_channel/msgs/chan_open_init.rs added an auxiliary function that creates a "wrong" RawMsgChannelOpenInit for the tests in ics26_routing/handler.rs
  1. small modifications
    The only modification in ics03_connection/connection.rs is to create a connection useful for the test on ChanOpenInit

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.

@codecov-io
Copy link

codecov-io commented Dec 17, 2020

Codecov Report

Merging #452 (ea84402) into master (b1b37f5) will increase coverage by 16.6%.
The diff coverage is 57.2%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    informalsystems/hermes#452      +/-   ##
=========================================
+ Coverage    13.6%   30.3%   +16.6%     
=========================================
  Files          69     168      +99     
  Lines        3752   13417    +9665     
  Branches     1374    5327    +3953     
=========================================
+ Hits          513    4071    +3558     
- Misses       2618    9091    +6473     
+ Partials      621     255     -366     
Impacted Files Coverage Δ
...application/ics20_fungible_token_transfer/error.rs 0.0% <0.0%> (ø)
...pplication/ics20_fungible_token_transfer/events.rs 0.0% <ø> (ø)
...ion/ics20_fungible_token_transfer/msgs/transfer.rs 0.0% <0.0%> (ø)
modules/src/events.rs 0.0% <0.0%> (ø)
modules/src/ics02_client/events.rs 0.0% <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 12.5% <0.0%> (-20.9%) ⬇️
modules/src/ics03_connection/events.rs 0.0% <0.0%> (ø)
modules/src/ics04_channel/error.rs 50.0% <0.0%> (+25.0%) ⬆️
... and 293 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 daeb8dc...ea84402. Read the comment docs.

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.

Great stuff, @cezarad :)

I did a first pass over the PR and left some comments which are mostly stylistic, but it all looks very good already!

It looks the build is failing because of the formatting. You can reformat the whole project at once by running cargo fmt in the ibc-rs folder. Instructions for setting it up (assuming you have installed Rust via https://rustup.rs).

cezarad and others added 4 commits December 21, 2020 10:18
Co-authored-by: Romain Ruetschi <romain@informal.systems>
Co-authored-by: Romain Ruetschi <romain@informal.systems>
Co-authored-by: Romain Ruetschi <romain@informal.systems>
@ancazamfir ancazamfir added this to the v0.0.7 milestone Dec 23, 2020
@adizere adizere removed this from the v0.1.0 milestone Jan 7, 2021
@adizere adizere assigned adizere and cezarad and unassigned adizere Jan 7, 2021
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.

Nice work!

I left a bunch of comments, please see inline.

A good practice you can experiment with in future: you can try to give your branches a specific name, to help identify them easily. For instance, instead of Cezara in future you can give the branch the name/id of the issue it is addressing, e.g., adi/68_errors or romac/backward-verif

cezarad and others added 6 commits January 12, 2021 16:49
Co-authored-by: Adi Seredinschi <adi@informal.systems>
Co-authored-by: Adi Seredinschi <adi@informal.systems>
Co-authored-by: Adi Seredinschi <adi@informal.systems>
Co-authored-by: Adi Seredinschi <adi@informal.systems>
Co-authored-by: Adi Seredinschi <adi@informal.systems>
@cezarad cezarad requested a review from adizere January 12, 2021 16:12
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.

Thanks for the patience with these reviewz! We're almost done there.

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.

Looks good! Thanks Cezara!

@romac romac changed the title handler for channel open init Handler for channel open init Jan 15, 2021
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.

lgtm!

@romac romac merged commit 133524a into master Jan 15, 2021
@romac romac deleted the Cezara branch January 15, 2021 17:00
romac added a commit that referenced this pull request Feb 4, 2021
* Initial documentation using mdbook (#542)

* Added README page to the guide with instructions. Fix index page (#542)

* Added more content mostly in the configuration section (#542)

* Some cleaning up and adding some placeholder content to a few pages (#542)

* Added information to the index page (#542)

* Added more content, new sections (most under in transactions), added glossary (#542)

* Added info to light client page, additional theme change and some structure refactor (#542)

* Added content for keys. Updated some commands references. (#542)

* Added tutorial section. Breakdown tutorial (#542)

* More content to tutorial (#542)

* Adding more content to tutorial (#542)

* Update relay_packets.md

* Adding more content, fixing content mostly in local chains file (#542)

* Fixing some content to show hermes (#542)

* Added content to the create-client section (#452)

* Review sections 1-3

* Revew 3.1, remove loop_config, add config_example.toml

* Small layout change

* fix CLI examples

* fixed and clarified ID parameters

* Format bytearrays as hex-encoded strings in various commands

* Formatting

* Added 4.3.1 and 4.5.1

* fix query client doc

* fix query client connections doc

* Add the relayer_loop doc

* Add documentation for tx raw connection commands and change from positional arguments to flags

* Avoid duplicate tag name for ConnectionEnd, ChannelEnd, AnyConsensusState and AnyClientState

* Fix JSON output in `tx raw` connection guide

* Update guide following 1ed6147

* Remove tags on ChannelEnd and ConnectionEnd

* Add documentation for query connection commands

* json for client commands, fix in relayer loop doc

* Add documentation for query channel(s) commands

* Improve output of Python script a bit

* Adding guide build CI workflow (#542)

* tx packet section, changed packet-send to ft-transfer

* Some css changes to better show few things (#542)

* formatting

* Work around gumdrop limitation which cuts off flags help text if too long

* Add documentation for tx raw chan-* commands

* Fix typo in e2e Python script

* Adapt e2e script to new flags of tx conn commands

* Add stub doc for tx raw chan-close-* commands

* Fix typo

* Improve tx raw conn-* doc

* Improve tx raw chan-open-* doc

* Only return a single result from Output type, to avoid unnecessary brackets in JSON output

* Add diagrams to tx channel and tx connection pages

* packet query docs

* starting on feature summary

* Fix typo

* Adapt mermaid theme to mdbook theme

* Add chan-close results to doc and to e2e script (disabled for now)

* Rename events to listen mode and add listen command

* File to support custom domain (#542)

* Fix mermaid theme detection

* Improve conn and chan diagrams

* Adding step to install mdbook-mermaid (#542)

* Adding step to install mdbook-mermaid on CI (#542)

* Removing full path from config example (#542)

* Remove log statement

* Fixing type in guide.yml (#542)

* renamed troubleshoot [test]

* Look for default config in ~/.hermes/config.toml and update guide

* Minor stylistic change

* Added Help

* Split dev-env script into setup-chains and init-clients

* Breakdown of the relay packets into separate sections (#542)

* Fixed links in help.md

* Formatting

* Fixing color for navigation buttons in mobile display (#542)

* Fix gaia version (#542)

* Added pre-requisite (Golang) needed for gaia (#542)

* Adding more content to the local_chains page (#542)

* remove order flag from tx chan clis

* Add high level content in transactions

* add clarification on identifiers and start cleaning 4.1.3 subsections

* restructure tutorial

* add relay path tutorial

* Finish the channel close handshake commands referrence

* remove forgotten wip

* Move chan-close commands to their own section

* Remove duplicate content

* Moved miscellaneous into help. Consolidated the help section.

* review 1-3

* Add section to install hermes via cargo install

* Rename Setup page to Installation

* Patching gaia

* features and matrix

* Add [[connections]] section to config.toml

* Whitespace

* Touch up feature matrix a bit

* small nits

* Uppercase feature descriptions

* typo fix and added link

* merge features in a new column in matrix, fix a few entries

* cleanup

* formatting

* Index nits

* Getting started, prereq

* Fixed hyperlinks to installation.md

* remove the operation instructions

* Fixed tutorial URLS

* Fixed URLS in commands and local_chains.md

* Queries overview

* Relayer CLI readme stripped down to essentials

* changelog

* review up to 5.2

* review  5.3

* review  5.4

* finish 5 review

* Add instructions for running two relayers for bidirectional relaying

* Fix broken links found with mdbook-linkcheck

* Check for broken links on CI

* Revert "Check for broken links on CI"

This reverts commit c4f8509.

* Main readme. Some fixes

* Fix typo

* Hermes <> IBC Relayer CLI

* Fix a couple more typos

* Unify Transactions and Queries index pages

* Remove $ prefix in front of commands for easier copy-paste

* fix concurrent packet relay section

* Update title of two paths page

* Disambiguation Hermes<>CLI

* More explanation re: CLI

* Nit in readme

* Casing and descriptions

* More casing

* Formatting

* Consistent casing in sidebar

* nits

* Unify notes

* Nitpick

* Minor stuff

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
Co-authored-by: Ethan Buchman <ethan@coinculture.info>
Co-authored-by: Anca Zamfir <zamfiranca@gmail.com>
Co-authored-by: Adi Seredinschi <adi@informal.systems>
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* handler for channel open init

* formated

* Update modules/src/ics04_channel/handler/chan_open_init.rs

Co-authored-by: Romain Ruetschi <romain@informal.systems>

* Update modules/src/ics04_channel/handler/chan_open_init.rs

Co-authored-by: Romain Ruetschi <romain@informal.systems>

* Update modules/src/ics04_channel/context.rs

Co-authored-by: Romain Ruetschi <romain@informal.systems>

* chan open init Romains comments

* added port verification

* chan open init

* chan open init

* minor fmt

* chan open init

* Update modules/src/ics04_channel/channel.rs

Co-authored-by: Adi Seredinschi <adi@informal.systems>

* Update modules/src/ics04_channel/channel.rs

Co-authored-by: Adi Seredinschi <adi@informal.systems>

* Update modules/src/ics04_channel/context.rs

Co-authored-by: Adi Seredinschi <adi@informal.systems>

* Update modules/src/ics04_channel/context.rs

Co-authored-by: Adi Seredinschi <adi@informal.systems>

* Update error.rs

* Update modules/src/ics04_channel/error.rs

Co-authored-by: Adi Seredinschi <adi@informal.systems>

* Update modules/src/ics04_channel/channel.rs

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* Update modules/src/ics04_channel/context.rs

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* Update context.rs

* minor

* minor

* test for port

* connetion features

* connetion features

* connetion features

* review comments

* Small refactor to improve readability

* Cleanup ics05_port::capabilities

* Replace panic! with unwrap and avoid some clones in mock context

* Avoid clones in MockContext::add_port

* Only clone the channel id

* Fix a couple comments

Co-authored-by: Romain Ruetschi <romain@informal.systems>
Co-authored-by: Adi Seredinschi <adi@informal.systems>
Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Initial documentation using mdbook (informalsystems#542)

* Added README page to the guide with instructions. Fix index page (informalsystems#542)

* Added more content mostly in the configuration section (informalsystems#542)

* Some cleaning up and adding some placeholder content to a few pages (informalsystems#542)

* Added information to the index page (informalsystems#542)

* Added more content, new sections (most under in transactions), added glossary (informalsystems#542)

* Added info to light client page, additional theme change and some structure refactor (informalsystems#542)

* Added content for keys. Updated some commands references. (informalsystems#542)

* Added tutorial section. Breakdown tutorial (informalsystems#542)

* More content to tutorial (informalsystems#542)

* Adding more content to tutorial (informalsystems#542)

* Update relay_packets.md

* Adding more content, fixing content mostly in local chains file (informalsystems#542)

* Fixing some content to show hermes (informalsystems#542)

* Added content to the create-client section (informalsystems#452)

* Review sections 1-3

* Revew 3.1, remove loop_config, add config_example.toml

* Small layout change

* fix CLI examples

* fixed and clarified ID parameters

* Format bytearrays as hex-encoded strings in various commands

* Formatting

* Added 4.3.1 and 4.5.1

* fix query client doc

* fix query client connections doc

* Add the relayer_loop doc

* Add documentation for tx raw connection commands and change from positional arguments to flags

* Avoid duplicate tag name for ConnectionEnd, ChannelEnd, AnyConsensusState and AnyClientState

* Fix JSON output in `tx raw` connection guide

* Update guide following 1ed6147

* Remove tags on ChannelEnd and ConnectionEnd

* Add documentation for query connection commands

* json for client commands, fix in relayer loop doc

* Add documentation for query channel(s) commands

* Improve output of Python script a bit

* Adding guide build CI workflow (informalsystems#542)

* tx packet section, changed packet-send to ft-transfer

* Some css changes to better show few things (informalsystems#542)

* formatting

* Work around gumdrop limitation which cuts off flags help text if too long

* Add documentation for tx raw chan-* commands

* Fix typo in e2e Python script

* Adapt e2e script to new flags of tx conn commands

* Add stub doc for tx raw chan-close-* commands

* Fix typo

* Improve tx raw conn-* doc

* Improve tx raw chan-open-* doc

* Only return a single result from Output type, to avoid unnecessary brackets in JSON output

* Add diagrams to tx channel and tx connection pages

* packet query docs

* starting on feature summary

* Fix typo

* Adapt mermaid theme to mdbook theme

* Add chan-close results to doc and to e2e script (disabled for now)

* Rename events to listen mode and add listen command

* File to support custom domain (informalsystems#542)

* Fix mermaid theme detection

* Improve conn and chan diagrams

* Adding step to install mdbook-mermaid (informalsystems#542)

* Adding step to install mdbook-mermaid on CI (informalsystems#542)

* Removing full path from config example (informalsystems#542)

* Remove log statement

* Fixing type in guide.yml (informalsystems#542)

* renamed troubleshoot [test]

* Look for default config in ~/.hermes/config.toml and update guide

* Minor stylistic change

* Added Help

* Split dev-env script into setup-chains and init-clients

* Breakdown of the relay packets into separate sections (informalsystems#542)

* Fixed links in help.md

* Formatting

* Fixing color for navigation buttons in mobile display (informalsystems#542)

* Fix gaia version (informalsystems#542)

* Added pre-requisite (Golang) needed for gaia (informalsystems#542)

* Adding more content to the local_chains page (informalsystems#542)

* remove order flag from tx chan clis

* Add high level content in transactions

* add clarification on identifiers and start cleaning 4.1.3 subsections

* restructure tutorial

* add relay path tutorial

* Finish the channel close handshake commands referrence

* remove forgotten wip

* Move chan-close commands to their own section

* Remove duplicate content

* Moved miscellaneous into help. Consolidated the help section.

* review 1-3

* Add section to install hermes via cargo install

* Rename Setup page to Installation

* Patching gaia

* features and matrix

* Add [[connections]] section to config.toml

* Whitespace

* Touch up feature matrix a bit

* small nits

* Uppercase feature descriptions

* typo fix and added link

* merge features in a new column in matrix, fix a few entries

* cleanup

* formatting

* Index nits

* Getting started, prereq

* Fixed hyperlinks to installation.md

* remove the operation instructions

* Fixed tutorial URLS

* Fixed URLS in commands and local_chains.md

* Queries overview

* Relayer CLI readme stripped down to essentials

* changelog

* review up to 5.2

* review  5.3

* review  5.4

* finish 5 review

* Add instructions for running two relayers for bidirectional relaying

* Fix broken links found with mdbook-linkcheck

* Check for broken links on CI

* Revert "Check for broken links on CI"

This reverts commit c4f8509.

* Main readme. Some fixes

* Fix typo

* Hermes <> IBC Relayer CLI

* Fix a couple more typos

* Unify Transactions and Queries index pages

* Remove $ prefix in front of commands for easier copy-paste

* fix concurrent packet relay section

* Update title of two paths page

* Disambiguation Hermes<>CLI

* More explanation re: CLI

* Nit in readme

* Casing and descriptions

* More casing

* Formatting

* Consistent casing in sidebar

* nits

* Unify notes

* Nitpick

* Minor stuff

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
Co-authored-by: Ethan Buchman <ethan@coinculture.info>
Co-authored-by: Anca Zamfir <zamfiranca@gmail.com>
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.

5 participants