Skip to content

Commit

Permalink
More clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchen1991 committed Sep 20, 2024
1 parent 02f85a9 commit fa7770c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions ibc-apps/ics20-transfer/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ pub fn on_chan_close_init_validate(
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<(), TokenTransferError> {
Err(TokenTransferError::UnsupportedClosedChannel)
Err(TokenTransferError::InvalidClosedChannel)

Check warning on line 136 in ibc-apps/ics20-transfer/src/module.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/src/module.rs#L136

Added line #L136 was not covered by tests
}

pub fn on_chan_close_init_execute(
_ctx: &mut impl TokenTransferExecutionContext,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<ModuleExtras, TokenTransferError> {
Err(TokenTransferError::UnsupportedClosedChannel)
Err(TokenTransferError::InvalidClosedChannel)

Check warning on line 144 in ibc-apps/ics20-transfer/src/module.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics20-transfer/src/module.rs#L144

Added line #L144 was not covered by tests
}

pub fn on_chan_close_confirm_validate(
Expand Down
10 changes: 5 additions & 5 deletions ibc-apps/ics20-transfer/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use ibc_core::primitives::prelude::*;

#[derive(Display, Debug, derive_more::From)]
pub enum TokenTransferError {
/// host error: `{0}`
/// host error: {0}
Host(HostError),
/// decoding error: `{0}`
/// decoding error: {0}
Decoding(DecodingError),
/// channel error: `{0}`
/// channel error: {0}
Channel(ChannelError),
/// missing destination channel `{channel_id}` on port `{port_id}`
MissingDestinationChannel {
Expand All @@ -24,8 +24,8 @@ pub enum TokenTransferError {
MismatchedChannelOrders { expected: Order, actual: Order },
/// mismatched port IDs: expected `{expected}`, actual `{actual}`
MismatchedPortIds { expected: PortId, actual: PortId },
/// channel cannot be closed
UnsupportedClosedChannel,
/// invalid channel state: cannot be closed
InvalidClosedChannel,
/// failed to deserialize packet data
FailedToDeserializePacketData,
/// failed to deserialize acknowledgement
Expand Down
4 changes: 2 additions & 2 deletions ibc-apps/ics721-nft-transfer/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ pub fn on_chan_close_init_validate(
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<(), NftTransferError> {
Err(NftTransferError::UnsupportedClosedChannel)
Err(NftTransferError::InvalidClosedChannel)

Check warning on line 135 in ibc-apps/ics721-nft-transfer/src/module.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/src/module.rs#L135

Added line #L135 was not covered by tests
}

pub fn on_chan_close_init_execute(
_ctx: &mut impl NftTransferExecutionContext,
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<ModuleExtras, NftTransferError> {
Err(NftTransferError::UnsupportedClosedChannel)
Err(NftTransferError::InvalidClosedChannel)

Check warning on line 143 in ibc-apps/ics721-nft-transfer/src/module.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/src/module.rs#L143

Added line #L143 was not covered by tests
}

pub fn on_chan_close_confirm_validate(
Expand Down
14 changes: 7 additions & 7 deletions ibc-apps/ics721-nft-transfer/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ use ibc_core::primitives::prelude::*;

#[derive(Display, Debug, From)]
pub enum NftTransferError {
/// host error: `{0}`
/// host error: {0}
Host(HostError),
/// channel error: `{0}`
/// channel error: {0}
Channel(ChannelError),
/// decoding error: `{0}`
/// decoding error: {0}
Decoding(DecodingError),
/// missing destination channel `{channel_id}` on port `{port_id}`
MissingDestinationChannel {
port_id: PortId,
channel_id: ChannelId,
},
/// empty token ID
EmptyTokenId,
/// missing token ID
MissingTokenId,
/// mismatched number of token IDs: expected `{expected}`, actual `{actual}`
MismatchedNumberOfTokenIds { expected: usize, actual: usize },
/// mismatched channel orders: expected `{expected}`, actual `{actual}`
Expand All @@ -35,8 +35,8 @@ pub enum NftTransferError {
FailedToDeserializeAck,
/// failed to parse account ID
FailedToParseAccount,
/// channel cannot be closed
UnsupportedClosedChannel,
/// invalid channel state: cannot be closed
InvalidClosedChannel,
}

#[cfg(feature = "std")]
Expand Down
2 changes: 1 addition & 1 deletion ibc-apps/ics721-nft-transfer/types/src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl PacketData {
/// Performs the basic validation of the packet data fields.
pub fn validate_basic(&self) -> Result<(), NftTransferError> {
if self.token_ids.0.is_empty() {
return Err(NftTransferError::EmptyTokenId);
return Err(NftTransferError::MissingTokenId);

Check warning on line 95 in ibc-apps/ics721-nft-transfer/types/src/packet.rs

View check run for this annotation

Codecov / codecov/patch

ibc-apps/ics721-nft-transfer/types/src/packet.rs#L95

Added line #L95 was not covered by tests
}
let num = self.token_ids.0.len();
let num_uri = self
Expand Down
2 changes: 1 addition & 1 deletion ibc-clients/ics07-tendermint/src/client_state/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ where
let tm_consensus_state_timestamp = tm_consensus_state.timestamp();
let tm_consensus_state_expiry = (tm_consensus_state_timestamp
+ client_state.trusting_period)
.map_err(|_| TimestampError::TimestampOverflow)?;
.map_err(|_| TimestampError::OverflowedTimestamp)?;

if tm_consensus_state_expiry > host_timestamp {
break;
Expand Down

0 comments on commit fa7770c

Please sign in to comment.