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

Fix for client query subcommands #235

Merged
merged 6 commits into from
Sep 21, 2020
Merged

Fix for client query subcommands #235

merged 6 commits into from
Sep 21, 2020

Conversation

adizere
Copy link
Member

@adizere adizere commented Sep 16, 2020

Closes: #231

Waiting for #233 to get merged to get this to compile... ready for review!


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

@codecov-commenter
Copy link

Codecov Report

Merging #235 into master will increase coverage by 23.7%.
The diff coverage is 53.7%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #235      +/-   ##
=========================================
+ Coverage    13.6%   37.4%   +23.7%     
=========================================
  Files          69      79      +10     
  Lines        3752    5680    +1928     
  Branches     1374    1884     +510     
=========================================
+ Hits          513    2127    +1614     
- Misses       2618    3344     +726     
+ Partials      621     209     -412     
Impacted Files Coverage Δ
modules/src/events.rs 0.0% <ø> (ø)
modules/src/ics02_client/events.rs 0.0% <ø> (ø)
modules/src/ics02_client/raw.rs 0.0% <0.0%> (ø)
modules/src/ics03_connection/error.rs 9.6% <0.0%> (-23.7%) ⬇️
modules/src/ics04_channel/error.rs 23.0% <0.0%> (-2.0%) ⬇️
modules/src/ics04_channel/packet.rs 0.0% <0.0%> (ø)
modules/src/ics07_tendermint/client_def.rs 0.0% <0.0%> (ø)
modules/src/ics07_tendermint/error.rs 30.0% <0.0%> (+30.0%) ⬆️
modules/src/ics07_tendermint/msgs/update_client.rs 0.0% <0.0%> (ø)
modules/src/mock_client/header.rs 0.0% <0.0%> (ø)
... and 133 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 9f2f0df...106c459. Read the comment docs.

@adizere adizere marked this pull request as ready for review September 17, 2020 15:47
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 great! Added a few comments and questions.

Comment on lines 125 to 132
impl TryFromRaw for AnyClientState {
type RawType = prost_types::Any;
type Error = Error;

fn try_from(value: Self::RawType) -> Result<Self, Self::Error> {
match value.type_url.as_str() {
"ibc.tendermint.ClientState" => {
let raw = RawTendermintClientState::decode(any.value.as_ref())
let raw = RawTendermintClientState::decode(value.value.as_ref())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious on why you changed from_any that transforms from a prost type to the try_from for TryFromRaw impl. I liked the old version a bit better.
Also value.value.as_ref() doesn't ready very well :)

Copy link
Member Author

@adizere adizere Sep 18, 2020

Choose a reason for hiding this comment

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

It was necessary for AnyClientState to implement the TryFromRaw trait, otherwise the call below would fail:

https://github.com/informalsystems/ibc-rs/blob/106c459cab6cc1a6359759c7bfc2d0d62e004686/relayer-cli/src/commands/query/client.rs#L80-L81

The failure would occur because the function chain.query::<T> requires the trait bound: T: TryFromRaw.

Also value.value.as_ref() doesn't ready very well :)

Agree! Didn't notice that, will fix.

modules/src/ics07_tendermint/consensus_state.rs Outdated Show resolved Hide resolved
modules/src/ics24_host/path.rs Show resolved Hide resolved
modules/src/ics02_client/client_def.rs Outdated Show resolved Hide resolved
@adizere adizere added this to the v0.0.4 milestone Sep 18, 2020
@ancazamfir
Copy link
Collaborator

Opened issue #245 to track updating the mock consensus state in the proto file.

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 great! Thanks Adi!

@adizere adizere merged commit 8b96008 into master Sep 21, 2020
@adizere adizere deleted the adi/231_client_query branch September 21, 2020 08:36
@adizere adizere removed this from the v0.0.4 milestone Sep 30, 2020
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Adapted client query subcommands to new query infrastructure (does not compile yet).

* Fixes for ClientState -> AnyClientState

* Fix for ConsensusState -> AnyConsensusState up to deserialization.

* Added impl TryFromRaw for AnyClientState; fixes for Anca's review
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.

Uncomment and fix client query commands
3 participants