-
Notifications
You must be signed in to change notification settings - Fork 326
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
Generic query, channel query and reduce code #152
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
86fb408
ci README fix and added simple_config
greg-szabo 0882154
Added channel query and TryFrom trait to connection query
greg-szabo 1e32302
Implemented generic query for abci queries, converted connection quer…
greg-szabo 2a88624
Revert "ci README fix and added simple_config" - separated into its o…
greg-szabo 53d8f1a
fmt fix
greg-szabo 85a9439
typo fix
greg-szabo 980d039
Fix for handling empty response value.
adizere 53a4d50
Different output for channel and connection query.
greg-szabo c71709e
Merge branch 'greg/query-channel-and-reduce-code' of github.com:infor…
greg-szabo 882902c
Refactored Proto types to Raw types
greg-szabo b584b88
clipyy fix
greg-szabo 7e8dc89
Moved query parameters into the command parameters with Into. (#155)
greg-szabo 35ee937
Implemented better Raw type handling (#156)
greg-szabo 843191f
Renamed trait to TryFromRaw to make it easier to understand its purpose
greg-szabo 1676a52
comment typo fix
greg-szabo 621717c
Comments fix
greg-szabo 8ed3f61
TryFromRaw introduces a function
greg-szabo 988960d
Typo fix
greg-szabo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ pub mod error; | |
pub mod events; | ||
pub mod exported; | ||
pub mod msgs; | ||
pub mod query; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the recent changes in the code, this
if
does not make sense anymore.I think we can now delete this
if
statement and remove the todo. The caller oftry_from
isrelayer/relay/src/query.rs:query()
and this should figure out that the responsevalue
isnull
and consequently return an error that the response is empty (without even reaching the call totry_from
). Relevant code:https://github.com/informalsystems/ibc-rs/blob/85a94394d7cba7beac6b2b305b3c160ef6ed3ecb/relayer/relay/src/query.rs#L74-L77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a commit to capture concretely my suggestion from the comment above. Full commit details here.
Relevant code:
https://github.com/informalsystems/ibc-rs/blob/980d0391e9b2c33f67834a4074c6627046aeb3bd/relayer/relay/src/query.rs#L64-L67
@greg-szabo if this makes sense with what you have in mind, then we can delete the
if
above. Also, according to clippy, we should useabci_response.value.is_empty()
instead of my shady choice ofabci_response.value.len() == 0
so this needs fixing as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks! I submitted a followup that fixes the Clippy warning.
I'm not sure how much we want to manually check different results of the response before we return, but this case seems straightforward.
There's a TODO in the type validation which I think should go into it's own issue. There's a lot to improve on that piece of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
That works, we can leave the TODOs for the moment (also in
Counterparty
), and fix validation, perhaps add also some unit tests in a separate issue.