From cd9663924b73d2e79d826b93e638a5b8f7ebe224 Mon Sep 17 00:00:00 2001 From: Yuun Lim <38443641+yuunlimm@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:56:33 -0700 Subject: [PATCH] fix a bug not returning entry function id for multisig (#417) --- rust/processor/src/utils/util.rs | 38 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/rust/processor/src/utils/util.rs b/rust/processor/src/utils/util.rs index 2751050ad..4b19fa675 100644 --- a/rust/processor/src/utils/util.rs +++ b/rust/processor/src/utils/util.rs @@ -110,24 +110,26 @@ pub fn ensure_not_negative(val: BigDecimal) -> BigDecimal { pub fn get_entry_function_from_user_request( user_request: &UserTransactionRequest, ) -> Option { - let entry_function_id_str: String = match &user_request.payload.as_ref().unwrap().payload { - Some(PayloadType::EntryFunctionPayload(payload)) => payload.entry_function_id_str.clone(), - Some(PayloadType::MultisigPayload(payload)) => { - if let Some(payload) = payload.transaction_payload.as_ref() { - match payload.payload.as_ref().unwrap() { - MultisigPayloadType::EntryFunctionPayload(payload) => { - Some(payload.entry_function_id_str.clone()) - }, - }; - } - return None; - }, - _ => return None, - }; - Some(truncate_str( - &entry_function_id_str, - MAX_ENTRY_FUNCTION_LENGTH, - )) + let entry_function_id_str: Option = + match &user_request.payload.as_ref().unwrap().payload { + Some(PayloadType::EntryFunctionPayload(payload)) => { + Some(payload.entry_function_id_str.clone()) + }, + Some(PayloadType::MultisigPayload(payload)) => { + if let Some(payload) = payload.transaction_payload.as_ref() { + match payload.payload.as_ref().unwrap() { + MultisigPayloadType::EntryFunctionPayload(payload) => { + Some(payload.entry_function_id_str.clone()) + }, + } + } else { + None + } + }, + _ => return None, + }; + + entry_function_id_str.map(|s| truncate_str(&s, MAX_ENTRY_FUNCTION_LENGTH)) } pub fn get_payload_type(payload: &TransactionPayload) -> String {