-
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
Fix 729 #732
Fix 729 #732
Conversation
…hain_id from a raw string slice to a chain identifier type in several code locations.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #732 +/- ##
==========================================
- Coverage 72.35% 72.34% -0.02%
==========================================
Files 116 116
Lines 15526 15532 +6
==========================================
+ Hits 11234 11236 +2
- Misses 4292 4296 +4
☔ View full report in Codecov by Sentry. |
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.
Thanks for taking care of this. Left a few comments.
Plus, it needs a changelog entry.
Would you also include a changelog for #731 along with this PR?
@@ -329,7 +329,9 @@ mod tests { | |||
let client_state = { | |||
#[allow(deprecated)] | |||
let raw_client_state = RawTmClientState { | |||
chain_id: ChainId::from(tm_block.header().chain_id.clone()).to_string(), | |||
chain_id: ChainId::from_str(tm_block.header().chain_id.to_string().as_str()) |
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.
Here we can go away with: ChainId::from(tm_block.header().chain_id.to_string()).to_string()
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!
impl From<ChainId> for String { | ||
fn from(id: ChainId) -> Self { | ||
tendermint::chain::Id::from_str(id.as_str()).unwrap() | ||
} | ||
} | ||
|
||
impl From<tendermint::chain::Id> for ChainId { | ||
fn from(id: tendermint::chain::Id) -> Self { | ||
ChainId::from(id.to_string()) | ||
id.to_string() | ||
} | ||
} |
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.
This conversation looks redundant imo. to_string()
is straightforward enough if anyone needs it.
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 removed
@@ -1127,7 +1127,7 @@ pub mod test_util { | |||
|
|||
pub fn new_dummy_from_header(tm_header: Header) -> ClientState { | |||
ClientState::new( | |||
tm_header.chain_id.clone().into(), | |||
tm_header.chain_id.to_string().try_into().unwrap(), |
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.
Likewise, we can use .to_string().into()
instead
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!
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).
Closes: #729
Description
PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.