From 42f1d0b763fe60da3b3cdd1623273e423daa0635 Mon Sep 17 00:00:00 2001 From: Till Ziegler Date: Sun, 14 Jul 2024 16:07:43 +0200 Subject: [PATCH] fix: ungraceful exit of init_client() --- .../ecall-handler/src/light_client/init_client.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/enclave-modules/ecall-handler/src/light_client/init_client.rs b/enclave-modules/ecall-handler/src/light_client/init_client.rs index 1f15aa26..554b8d2c 100644 --- a/enclave-modules/ecall-handler/src/light_client/init_client.rs +++ b/enclave-modules/ecall-handler/src/light_client/init_client.rs @@ -17,7 +17,10 @@ pub fn init_client( let any_client_state: Any = input.any_client_state.into(); let any_consensus_state: Any = input.any_consensus_state.into(); - let lc = ctx.get_light_client(&any_client_state.type_url).unwrap(); + let lc = match ctx.get_light_client(&any_client_state.type_url) { + Some(lc) => lc, + None => return Err(Error::invalid_argument(any_client_state.type_url.clone())), + }; let ek = ctx.get_enclave_key(); let res = lc.create_client(ctx, any_client_state.clone(), any_consensus_state.clone())?; let client_type = lc.client_type();