Skip to content

Commit

Permalink
fix: remove unnecessary map_err(PacketError::Channel)
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhad-Shabani committed Aug 22, 2024
1 parent f8e70f1 commit 115969c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions ibc-clients/ics07-tendermint/src/client_state/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub fn verify_consensus_state(
let tm_consensus_state = TmConsensusState::try_from(consensus_state)?;

if tm_consensus_state.root().is_empty() {
return Err(CommitmentError::EmptyCommitmentRoot)?;
Err(CommitmentError::EmptyCommitmentRoot)?;

Check warning on line 165 in ibc-clients/ics07-tendermint/src/client_state/common.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/src/client_state/common.rs#L165

Added line #L165 was not covered by tests
};

if consensus_state_status(&tm_consensus_state, host_timestamp, trusting_period)?.is_expired() {
Expand Down Expand Up @@ -297,7 +297,7 @@ pub fn verify_membership<H: HostFunctionsProvider>(
value: Vec<u8>,
) -> Result<(), ClientError> {
if prefix.is_empty() {
return Err(CommitmentError::EmptyCommitmentPrefix)?;
Err(CommitmentError::EmptyCommitmentPrefix)?;

Check warning on line 300 in ibc-clients/ics07-tendermint/src/client_state/common.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/ics07-tendermint/src/client_state/common.rs#L300

Added line #L300 was not covered by tests
}

let merkle_path = MerklePath::new(vec![prefix.as_bytes().to_vec().into(), path]);
Expand Down
3 changes: 1 addition & 2 deletions ibc-core/ics04-channel/src/handler/acknowledgement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ where
Path::Ack(ack_path_on_b),
ack_commitment.into_vec(),
)
.map_err(ChannelError::FailedProofVerification)
.map_err(PacketError::Channel)?;
.map_err(ChannelError::FailedProofVerification)?;
}

Ok(())
Expand Down
3 changes: 1 addition & 2 deletions ibc-core/ics04-channel/src/handler/recv_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ where
Path::Commitment(commitment_path_on_a),
expected_commitment_on_a.into_vec(),
)
.map_err(ChannelError::FailedProofVerification)
.map_err(PacketError::Channel)?;
.map_err(ChannelError::FailedProofVerification)?;
}

match chan_end_on_b.ordering {
Expand Down
10 changes: 4 additions & 6 deletions ibc-core/ics04-channel/src/handler/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,10 @@ where
}
};

next_seq_recv_verification_result
.map_err(|e| ChannelError::FailedPacketVerification {
sequence: msg.next_seq_recv_on_b,
client_error: e,
})
.map_err(PacketError::Channel)?;
next_seq_recv_verification_result.map_err(|e| ChannelError::FailedPacketVerification {
sequence: msg.next_seq_recv_on_b,
client_error: e,

Check warning on line 259 in ibc-core/ics04-channel/src/handler/timeout.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/timeout.rs#L258-L259

Added lines #L258 - L259 were not covered by tests
})?;
}

Ok(())
Expand Down
13 changes: 5 additions & 8 deletions ibc-core/ics04-channel/src/handler/timeout_on_close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ where
Path::ChannelEnd(chan_end_path_on_b),
expected_chan_end_on_b.encode_vec(),
)
.map_err(ChannelError::FailedProofVerification)
.map_err(PacketError::Channel)?;
.map_err(ChannelError::FailedProofVerification)?;

verify_conn_delay_passed(ctx_a, msg.proof_height_on_b, &conn_end_on_a)?;

Expand Down Expand Up @@ -163,12 +162,10 @@ where
}
};

next_seq_recv_verification_result
.map_err(|e| ChannelError::FailedPacketVerification {
sequence: msg.next_seq_recv_on_b,
client_error: e,
})
.map_err(PacketError::Channel)?;
next_seq_recv_verification_result.map_err(|e| ChannelError::FailedPacketVerification {
sequence: msg.next_seq_recv_on_b,
client_error: e,

Check warning on line 167 in ibc-core/ics04-channel/src/handler/timeout_on_close.rs

View check run for this annotation

Codecov / codecov/patch

ibc-core/ics04-channel/src/handler/timeout_on_close.rs#L166-L167

Added lines #L166 - L167 were not covered by tests
})?;
};

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion ibc-testkit/src/testapp/ibc/core/core_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ where
Ok(self
.conn_counter
.get(StoreHeight::Pending, &NextConnectionSequencePath)
.ok_or(ConnectionError::MissingHostHeight)?)
.ok_or(ConnectionError::MissingConnectionCounter)?)
}

fn channel_end(&self, channel_end_path: &ChannelEndPath) -> Result<ChannelEnd, ContextError> {
Expand Down

0 comments on commit 115969c

Please sign in to comment.