From e08efba48829e2b36cf96d2e205e92465416c147 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Thu, 2 Nov 2023 18:11:45 +0100 Subject: [PATCH] solana-ibc: better propagate errors (#75) Avoid unwraps. --- .../solana-ibc/programs/solana-ibc/src/execution_context.rs | 4 +++- solana/solana-ibc/programs/solana-ibc/src/lib.rs | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs b/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs index 57856b3a..4a95bee2 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs @@ -357,7 +357,9 @@ impl ExecutionContext for IbcStorage<'_, '_> { let mut store = self.borrow_mut(); let host_height = ibc::Height::new(store.private.height.0, store.private.height.1)?; - let ibc_event = borsh::to_vec(&event).unwrap(); + let ibc_event = borsh::to_vec(&event).map_err(|err| { + ClientError::Other { description: err.to_string() } + })?; let inner_host_height = (host_height.revision_height(), host_height.revision_number()); store diff --git a/solana/solana-ibc/programs/solana-ibc/src/lib.rs b/solana/solana-ibc/programs/solana-ibc/src/lib.rs index 658f1190..b59c092f 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/lib.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/lib.rs @@ -4,7 +4,6 @@ extern crate alloc; use anchor_lang::prelude::*; -use borsh::{BorshDeserialize, BorshSerialize}; use ibc::core::ics24_host::identifier::PortId; use ibc::core::router::{Module, ModuleId, Router};