From 12455e6ec508a05c71d90c404bdc2c38f3e14ed9 Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Thu, 26 Sep 2024 11:02:13 -0700 Subject: [PATCH] fix: use missing_state everywhere storage call returns None --- basecoin/modules/src/ibc/impls.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/basecoin/modules/src/ibc/impls.rs b/basecoin/modules/src/ibc/impls.rs index 31d7450..a8a47ad 100644 --- a/basecoin/modules/src/ibc/impls.rs +++ b/basecoin/modules/src/ibc/impls.rs @@ -508,7 +508,7 @@ where fn connection_end(&self, conn_id: &ConnectionId) -> Result { self.connection_end_store .get(Height::Pending, &ConnectionPath::new(conn_id)) - .ok_or_else(|| HostError::failed_to_retrieve(format!("connection end: {}", conn_id))) + .ok_or_else(|| HostError::missing_state(format!("connection end: {}", conn_id))) } fn validate_self_client( @@ -587,7 +587,7 @@ where commitment_path.sequence, ), ) - .ok_or_else(|| HostError::failed_to_retrieve("packet commitment")) + .ok_or_else(|| HostError::missing_state("packet commitment")) } fn get_packet_receipt(&self, receipt_path: &ReceiptPath) -> Result { @@ -601,7 +601,7 @@ where ), ) .then_some(Receipt::Ok) - .ok_or_else(|| HostError::failed_to_retrieve("packet receipt")) + .ok_or_else(|| HostError::missing_state("packet receipt")) } fn get_packet_acknowledgement( @@ -613,9 +613,7 @@ where Height::Pending, &AckPath::new(&ack_path.port_id, &ack_path.channel_id, ack_path.sequence), ) - .ok_or_else(|| { - HostError::failed_to_retrieve(format!("packet ack: {:?}", ack_path.sequence)) - }) + .ok_or_else(|| HostError::missing_state(format!("packet ack: {:?}", ack_path.sequence))) } /// Returns a counter on the number of channel ids have been created thus far.