Skip to content

Commit 60a9943

Browse files
committed
refactor(ics24-host): remove From<&str> to avoid panic on host
1 parent 596eccb commit 60a9943

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

ibc-core/ics03-connection/types/src/connection.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Defines the types that define a connection
22
33
use core::fmt::{Display, Error as FmtError, Formatter};
4+
use core::str::FromStr;
45
use core::time::Duration;
56
use core::u64;
67

@@ -210,8 +211,12 @@ impl TryFrom<RawConnectionEnd> for ConnectionEnd {
210211
if state == State::Uninitialized {
211212
return ConnectionEnd::new(
212213
State::Uninitialized,
213-
"07-tendermint-0".into(),
214-
Counterparty::new("07-tendermint-0".into(), None, CommitmentPrefix::empty()),
214+
ClientId::from_str("07-tendermint-0").expect("should not fail"),
215+
Counterparty::new(
216+
ClientId::from_str("07-tendermint-0").expect("should not fail"),
217+
None,
218+
CommitmentPrefix::empty(),
219+
),
215220
Vec::new(),
216221
ZERO_DURATION,
217222
);

ibc-core/ics24-host/types/src/identifiers/client_id.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ impl FromStr for ClientId {
7676
}
7777
}
7878

79-
impl From<&str> for ClientId {
80-
fn from(s: &str) -> Self {
81-
Self::from_str(s).expect("Invalid client id")
82-
}
83-
}
84-
8579
/// Equality check against string literal (satisfies &ClientId == &str).
8680
/// ```
8781
/// use core::str::FromStr;

0 commit comments

Comments
 (0)