From 8d36c6875089bb325b5321d9d9dc58c368f5d628 Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Thu, 12 Sep 2024 13:34:23 -0700 Subject: [PATCH] imp: remove redundant path constructions in ibc-testkit (#1338) * imp: remove redundant path constructions * chore: add changelog --- ...ceipt-check-during-recv-packet-validate.md | 3 ++ ibc-testkit/src/testapp/ibc/core/core_ctx.rs | 34 ++++--------------- 2 files changed, 9 insertions(+), 28 deletions(-) create mode 100644 .changelog/unreleased/improvements/1336-remove-faulty-receipt-check-during-recv-packet-validate.md diff --git a/.changelog/unreleased/improvements/1336-remove-faulty-receipt-check-during-recv-packet-validate.md b/.changelog/unreleased/improvements/1336-remove-faulty-receipt-check-during-recv-packet-validate.md new file mode 100644 index 000000000..13c2103a9 --- /dev/null +++ b/.changelog/unreleased/improvements/1336-remove-faulty-receipt-check-during-recv-packet-validate.md @@ -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)). diff --git a/ibc-testkit/src/testapp/ibc/core/core_ctx.rs b/ibc-testkit/src/testapp/ibc/core/core_ctx.rs index e6ee86872..9c5b2fb16 100644 --- a/ibc-testkit/src/testapp/ibc/core/core_ctx.rs +++ b/ibc-testkit/src/testapp/ibc/core/core_ctx.rs @@ -150,10 +150,7 @@ where fn channel_end(&self, channel_end_path: &ChannelEndPath) -> Result { 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)?) } @@ -163,10 +160,7 @@ where ) -> Result { 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)?) } @@ -176,20 +170,14 @@ where ) -> Result { 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 { 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)?) } @@ -199,14 +187,7 @@ where ) -> Result { 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)?) } @@ -227,10 +208,7 @@ where ) -> Result { 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, })?)