Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions crates/ibc-types-core-channel/src/events/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@ fn ibc_to_abci_channel_events() {
version: version.clone(),
}
.into(),
expected_keys: expected_keys.clone(),
expected_values: expected_values
.iter()
.enumerate()
// ???
.map(|(i, v)| if i == 3 { "" } else { v })
.collect(),
expected_keys: vec![
"port_id",
"channel_id",
"counterparty_port_id",
"connection_id",
"version",
],
expected_values: vec![
"transfer",
"channel-0",
"transfer",
"connection-0",
"ics20-1",
],
},
Test {
kind: "channel_open_try",
Expand Down
4 changes: 2 additions & 2 deletions crates/ibc-types-core-channel/src/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl ChannelId {
/// accepts a single argument, the `counter`.
///
/// ```
/// # use ibc_types::core::ics24_host::identifier::ChannelId;
/// use ibc_types_core_channel::ChannelId;
/// let chan_id = ChannelId::new(27);
/// assert_eq!(chan_id.to_string(), "channel-27");
/// ```
Expand Down Expand Up @@ -119,7 +119,7 @@ impl Default for ChannelId {
/// Equality check against string literal (satisfies &ChannelId == &str).
/// ```
/// use core::str::FromStr;
/// use ibc_types::core::ics24_host::identifier::ChannelId;
/// use ibc_types_core_channel::ChannelId;
/// let channel_id = ChannelId::from_str("channelId-0");
/// assert!(channel_id.is_ok());
/// channel_id.map(|id| {assert_eq!(&id, "channelId-0")});
Expand Down
3 changes: 3 additions & 0 deletions crates/ibc-types-core-channel/src/msgs/acknowledgement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ impl TryFrom<RawMsgAcknowledgement> for MsgAcknowledgement {
type Error = PacketError;

fn try_from(raw_msg: RawMsgAcknowledgement) -> Result<Self, Self::Error> {
if raw_msg.proof_acked.is_empty() {
return Err(PacketError::InvalidAcknowledgement);
}
Ok(MsgAcknowledgement {
packet: raw_msg
.packet
Expand Down
3 changes: 3 additions & 0 deletions crates/ibc-types-core-channel/src/msgs/chan_open_ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ impl TryFrom<RawMsgChannelOpenAck> for MsgChannelOpenAck {
type Error = ChannelError;

fn try_from(raw_msg: RawMsgChannelOpenAck) -> Result<Self, Self::Error> {
if raw_msg.proof_try.is_empty() {
return Err(ChannelError::InvalidProof);
}
Ok(MsgChannelOpenAck {
port_id_on_a: raw_msg.port_id.parse().map_err(ChannelError::Identifier)?,
chan_id_on_a: raw_msg
Expand Down
3 changes: 3 additions & 0 deletions crates/ibc-types-core-channel/src/msgs/chan_open_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ impl TryFrom<RawMsgChannelOpenConfirm> for MsgChannelOpenConfirm {
type Error = ChannelError;

fn try_from(raw_msg: RawMsgChannelOpenConfirm) -> Result<Self, Self::Error> {
if raw_msg.proof_ack.is_empty() {
return Err(ChannelError::InvalidProof);
}
Ok(MsgChannelOpenConfirm {
port_id_on_b: raw_msg.port_id.parse().map_err(ChannelError::Identifier)?,
chan_id_on_b: raw_msg
Expand Down
3 changes: 3 additions & 0 deletions crates/ibc-types-core-channel/src/msgs/chan_open_try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ impl TryFrom<RawMsgChannelOpenTry> for MsgChannelOpenTry {
type Error = ChannelError;

fn try_from(raw_msg: RawMsgChannelOpenTry) -> Result<Self, Self::Error> {
if raw_msg.proof_init.is_empty() {
return Err(ChannelError::InvalidProof);
}
let chan_end_on_b: ChannelEnd = raw_msg
.channel
.ok_or(ChannelError::MissingChannel)?
Expand Down
3 changes: 3 additions & 0 deletions crates/ibc-types-core-channel/src/msgs/recv_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ impl TryFrom<RawMsgRecvPacket> for MsgRecvPacket {
type Error = PacketError;

fn try_from(raw_msg: RawMsgRecvPacket) -> Result<Self, Self::Error> {
if raw_msg.proof_commitment.is_empty() {
return Err(PacketError::InvalidProof);
}
Ok(MsgRecvPacket {
packet: raw_msg
.packet
Expand Down
3 changes: 3 additions & 0 deletions crates/ibc-types-core-channel/src/msgs/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ impl TryFrom<RawMsgTimeout> for MsgTimeout {

fn try_from(raw_msg: RawMsgTimeout) -> Result<Self, Self::Error> {
// TODO: Domain type verification for the next sequence: this should probably be > 0.
if raw_msg.proof_unreceived.is_empty() {
return Err(PacketError::InvalidProof);
}
Ok(MsgTimeout {
packet: raw_msg
.packet
Expand Down
6 changes: 6 additions & 0 deletions crates/ibc-types-core-channel/src/msgs/timeout_on_close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ impl TryFrom<RawMsgTimeoutOnClose> for MsgTimeoutOnClose {
type Error = PacketError;

fn try_from(raw_msg: RawMsgTimeoutOnClose) -> Result<Self, Self::Error> {
if raw_msg.proof_close.is_empty() {
return Err(PacketError::InvalidProof);
}
if raw_msg.proof_unreceived.is_empty() {
return Err(PacketError::InvalidProof);
}
// TODO: Domain type verification for the next sequence: this should probably be > 0.
Ok(MsgTimeoutOnClose {
packet: raw_msg
Expand Down