Skip to content

Commit

Permalink
imp: remove redundant path constructions in ibc-testkit (#1338)
Browse files Browse the repository at this point in the history
* imp: remove redundant path constructions

* chore: add changelog
  • Loading branch information
Farhad-Shabani committed Sep 12, 2024
1 parent 25f730d commit 8d36c68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [ibc-testkit] Remove redundant path constructions in the implementation of
`ValidationContext` for `MockIbcStore`
([#1338](https://github.com/cosmos/ibc-rs/pull/1338)).
34 changes: 6 additions & 28 deletions ibc-testkit/src/testapp/ibc/core/core_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ where
fn channel_end(&self, channel_end_path: &ChannelEndPath) -> Result<ChannelEnd, ContextError> {
Ok(self
.channel_end_store
.get(
StoreHeight::Pending,
&ChannelEndPath::new(&channel_end_path.0, &channel_end_path.1),
)
.get(StoreHeight::Pending, channel_end_path)
.ok_or(ChannelError::MissingChannel)?)
}

Expand All @@ -163,10 +160,7 @@ where
) -> Result<Sequence, ContextError> {
Ok(self
.send_sequence_store
.get(
StoreHeight::Pending,
&SeqSendPath::new(&seq_send_path.0, &seq_send_path.1),
)
.get(StoreHeight::Pending, seq_send_path)
.ok_or(PacketError::ImplementationSpecific)?)
}

Expand All @@ -176,20 +170,14 @@ where
) -> Result<Sequence, ContextError> {
Ok(self
.recv_sequence_store
.get(
StoreHeight::Pending,
&SeqRecvPath::new(&seq_recv_path.0, &seq_recv_path.1),
)
.get(StoreHeight::Pending, seq_recv_path)
.ok_or(PacketError::ImplementationSpecific)?)
}

fn get_next_sequence_ack(&self, seq_ack_path: &SeqAckPath) -> Result<Sequence, ContextError> {
Ok(self
.ack_sequence_store
.get(
StoreHeight::Pending,
&SeqAckPath::new(&seq_ack_path.0, &seq_ack_path.1),
)
.get(StoreHeight::Pending, seq_ack_path)
.ok_or(PacketError::ImplementationSpecific)?)
}

Expand All @@ -199,14 +187,7 @@ where
) -> Result<PacketCommitment, ContextError> {
Ok(self
.packet_commitment_store
.get(
StoreHeight::Pending,
&CommitmentPath::new(
&commitment_path.port_id,
&commitment_path.channel_id,
commitment_path.sequence,
),
)
.get(StoreHeight::Pending, commitment_path)
.ok_or(PacketError::ImplementationSpecific)?)
}

Expand All @@ -227,10 +208,7 @@ where
) -> Result<AcknowledgementCommitment, ContextError> {
Ok(self
.packet_ack_store
.get(
StoreHeight::Pending,
&AckPath::new(&ack_path.port_id, &ack_path.channel_id, ack_path.sequence),
)
.get(StoreHeight::Pending, ack_path)
.ok_or(PacketError::PacketAcknowledgementNotFound {
sequence: ack_path.sequence,
})?)
Expand Down

0 comments on commit 8d36c68

Please sign in to comment.