Skip to content

Commit

Permalink
imp(core): remove State::Uninitialized check while parsing `Connect…
Browse files Browse the repository at this point in the history
…ionEnd` (#1126)

* rm check for uninitialized connection end state

* add changelog

* Update .changelog/unreleased/improvements/1123-remove-check-for-unitialized-connection-end-state.md

Co-authored-by: Farhad Shabani <[email protected]>
Signed-off-by: Rano | Ranadeep <[email protected]>

* md fmt

---------

Signed-off-by: Rano | Ranadeep <[email protected]>
Co-authored-by: Farhad Shabani <[email protected]>
  • Loading branch information
rnbguy and Farhad-Shabani authored Mar 15, 2024
1 parent 3b11b12 commit bef3683
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ibc-core-connection] Remove `State::Uninitialized` check while parsing
`ConnectionEnd` from Protobuf
([\#1123](https://github.com/cosmos/ibc-rs/issues/1123))
16 changes: 0 additions & 16 deletions ibc-core/ics03-connection/types/src/connection.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
//! Defines the types that define a connection

use core::fmt::{Display, Error as FmtError, Formatter};
use core::str::FromStr;
use core::time::Duration;
use core::u64;

use ibc_core_client_types::error::ClientError;
use ibc_core_commitment_types::commitment::CommitmentPrefix;
use ibc_core_host_types::identifiers::{ClientId, ConnectionId};
use ibc_primitives::prelude::*;
use ibc_primitives::ZERO_DURATION;
use ibc_proto::ibc::core::connection::v1::{
ConnectionEnd as RawConnectionEnd, Counterparty as RawCounterparty,
IdentifiedConnection as RawIdentifiedConnection,
Expand Down Expand Up @@ -208,20 +206,6 @@ impl TryFrom<RawConnectionEnd> for ConnectionEnd {
fn try_from(value: RawConnectionEnd) -> Result<Self, Self::Error> {
let state = value.state.try_into()?;

if state == State::Uninitialized {
return ConnectionEnd::new(
State::Uninitialized,
ClientId::from_str("07-tendermint-0").expect("should not fail"),
Counterparty::new(
ClientId::from_str("07-tendermint-0").expect("should not fail"),
None,
CommitmentPrefix::empty(),
),
Vec::new(),
ZERO_DURATION,
);
}

if value.client_id.is_empty() {
return Err(ConnectionError::EmptyProtoConnectionEnd);
}
Expand Down

0 comments on commit bef3683

Please sign in to comment.