-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: use FromStr
in client_type
functions to construct ClientType
#731
feat: use FromStr
in client_type
functions to construct ClientType
#731
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #731 +/- ##
==========================================
+ Coverage 72.32% 72.35% +0.03%
==========================================
Files 116 116
Lines 15524 15526 +2
==========================================
+ Hits 11227 11234 +7
+ Misses 4297 4292 -5
☔ View full report in Codecov by Sentry. |
impl TryFrom<String> for ClientType { | ||
type Error = IdentifierError; | ||
|
||
fn try_from(s: String) -> Result<Self, Self::Error> { | ||
Self::new(s) | ||
} | ||
} |
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.
Can we use FromStr
instead of TryFrom
here? to maintain consistency with the existing conversion methods for ClientId
, ConnectionId
, and ChannelId
. Also, won't have to deal with to_string()
everywhere.
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.
have fixed
…ics02_client`, `ics02_client/events`, `ics03_connection/events` and `mock/client_state`
TryFrom
in client_type
functions to construct ClientType
FromStr
in client_type
functions to construct ClientType
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.
🙏
* Refactor chain_id to avoid cloning to chain_id.to_string(). Convert chain_id from a raw string slice to a chain identifier type in several code locations. * feat(ibc): remove `tendermint::chain::Id` dependency and use `FromStr` to construct `ClientType` in `ics07_tendermint` and `ics02_client` module (#729 and #731).
…pe` (#731) * feat: use `TryFrom` in `client_type` functions to construct `ClientType` * Fix ClientType conversion method in identifier.rs * Refactor client type parsing using `FromStr` in `ics07_tendermint`, `ics02_client`, `ics02_client/events`, `ics03_connection/events` and `mock/client_state` * refactor: use core::str instead of std::str in mod.rs file of ICS07 Tendermint client
* Refactor chain_id to avoid cloning to chain_id.to_string(). Convert chain_id from a raw string slice to a chain identifier type in several code locations. * feat(ibc): remove `tendermint::chain::Id` dependency and use `FromStr` to construct `ClientType` in `ics07_tendermint` and `ics02_client` module (#729 and #731).
Closes: #XXX
Description
PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.