Skip to content

Commit

Permalink
fix a bug not returning entry function id for multisig (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuunlimm authored Jun 20, 2024
1 parent 96c2efa commit cd96639
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions rust/processor/src/utils/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,26 @@ pub fn ensure_not_negative(val: BigDecimal) -> BigDecimal {
pub fn get_entry_function_from_user_request(
user_request: &UserTransactionRequest,
) -> Option<String> {
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<String> =
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 {
Expand Down

0 comments on commit cd96639

Please sign in to comment.