Skip to content

Commit

Permalink
fix: use missing_state everywhere storage call returns None
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhad-Shabani committed Sep 26, 2024
1 parent 4ebacf0 commit 12455e6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions basecoin/modules/src/ibc/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ where
fn connection_end(&self, conn_id: &ConnectionId) -> Result<ConnectionEnd, HostError> {
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(
Expand Down Expand Up @@ -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<Receipt, HostError> {
Expand All @@ -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(
Expand All @@ -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.
Expand Down

0 comments on commit 12455e6

Please sign in to comment.