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

Migration to ibc_proto v.0.3.0 #227

Merged
merged 13 commits into from
Sep 17, 2020
Merged

Migration to ibc_proto v.0.3.0 #227

merged 13 commits into from
Sep 17, 2020

Conversation

ancazamfir
Copy link
Collaborator

@ancazamfir ancazamfir commented Sep 10, 2020

Closes: #226

Description

Migrate to ibc_proto v0.3.0.

Includes minimal changes such that the code compiles and tests pass. In particular:

  • the client state in the handshake messages is not deserialized and therefore further ignored
  • the epoch in the new type Height is ignored and the deserialization code only extracts the EpochHeight in the current Height type which is u64.

For contributor use:

  • Unit tests written
  • Added test to CI if applicable
  • Updated CHANGELOG_PENDING.md
  • 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

@ancazamfir ancazamfir requested a review from romac as a code owner September 10, 2020 11:59
@ancazamfir ancazamfir requested a review from adizere September 10, 2020 12:22
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.

Looks good, modulo some typos and a couple idioms :) Will leave it to @adizere to approve the PR as I am not super familiar with ICS 03 yet.

modules/src/ics03_connection/error.rs Outdated Show resolved Hide resolved
modules/src/ics03_connection/error.rs Outdated Show resolved Hide resolved
modules/src/ics03_connection/error.rs Outdated Show resolved Hide resolved
modules/src/ics03_connection/handler/verify.rs Outdated Show resolved Hide resolved
modules/src/ics03_connection/msgs.rs Outdated Show resolved Hide resolved
modules/src/ics03_connection/msgs.rs Outdated Show resolved Hide resolved
@adizere
Copy link
Member

adizere commented Sep 10, 2020

Heads-up, once we merge #220 we might get the following error:

$ cargo clippy --all-targets
    Checking ibc v0.0.3 (/Users/adi/Hammers/ibc-rs/modules)
error: large size difference between variants
  --> modules/src/ics03_connection/msgs.rs:51:5
   |
51 |     ConnectionOpenTry(MsgConnectionOpenTry),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this variant is 352 bytes
   |
note: the lint level is defined here
  --> modules/src/lib.rs:2:9
   |
2  | #![deny(clippy::all)]
   |         ^^^^^^^^^^^
   = note: `#[deny(clippy::large_enum_variant)]` implied by `#[deny(clippy::all)]`
note: and the second-largest variant is 144 bytes:
  --> modules/src/ics03_connection/msgs.rs:50:5
   |
50 |     ConnectionOpenInit(MsgConnectionOpenInit),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
help: consider boxing the large fields to reduce the total size of the enum
   |
51 |     ConnectionOpenTry(Box<MsgConnectionOpenTry>),
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: could not compile `ibc`.```

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.

I think clippy will bite us with next commits, so we'll need to address that (see my earlier comment). Otherwise looks good!

modules/src/ics02_client/state.rs Outdated Show resolved Hide resolved
@ancazamfir
Copy link
Collaborator Author

Another need to fix before merge:

When running the Rust relayer query with Gaia and Go Relayer, the connection query fails.

cargo run --bin relayer -- -c simple_config.toml query connection end ibc0 ibconeconnection
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/relayer -c simple_config.toml query connection end ibc0 ibconeconnection`
     Options QueryConnectionOptions { connection_id: ConnectionId("ibconeconnection"), height: 0, proof: true }
[relayer/src/chain/cosmos.rs:67] "Todo: implement proof verification." = "Todo: implement proof verification."
connection query error Could not parse/unmarshall response: failed to decode Protobuf message: ConnectionEnd.state: invalid wire type: LengthDelimited (expected Varint)

The failure is here:
https://github.com/informalsystems/ibc-rs/blob/6f59e2f047777e881fdff79cb8181ed30f76c733/relayer/src/chain/cosmos.rs#L72

The query works on master (with ibc-proto v.0.1.0), the protobuf for ConnectionEnd hasn't changed between the two versions.

The channel query that gets a ChannelEnd with an almost identical proto for Sate works fine.

* Fix Clippy warnings

* Add stub for deserializing ClientState from Protbuf's Any

* Update to latest ibc-proto

* Decode Tendermint client state from raw

* Decode raw client states

* Add FIXME comments to uses of `epoch_height`

* Update ibc-proto to 0.3.0

* Remove local path to ibc-proto dependency

* Stylistic fixes
@ancazamfir ancazamfir changed the title Migration to ibc_proto v.0.2.2 Migration to ibc_proto v.0.3.0 Sep 17, 2020
modules/src/context_mock.rs Show resolved Hide resolved
modules/src/ics03_connection/connection.rs Outdated Show resolved Hide resolved
modules/src/ics03_connection/msgs.rs Show resolved Hide resolved
modules/src/mock_client/state.rs Outdated Show resolved Hide resolved
@adizere adizere added this to the v0.0.4 milestone Sep 17, 2020
@ancazamfir ancazamfir merged commit 9f2f0df into master Sep 17, 2020
@adizere adizere deleted the anca/proto_update branch September 17, 2020 12:09
@adizere adizere removed this from the v0.0.4 milestone Sep 30, 2020
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.

Migrate handlers to newer protobuf definitions
4 participants