From c784af9312b10657c76177adc110095399dfdeae Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli Date: Tue, 30 Jul 2024 15:41:52 +0200 Subject: [PATCH 1/2] fix client checks on update account --- crates/sdk/src/tx.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/sdk/src/tx.rs b/crates/sdk/src/tx.rs index fbfbd8ca0e..c0446e6e98 100644 --- a/crates/sdk/src/tx.rs +++ b/crates/sdk/src/tx.rs @@ -3548,11 +3548,10 @@ pub async fn build_update_account( let threshold = *threshold; let invalid_threshold = threshold.is_zero(); - let invalid_too_few_pks: bool = (public_keys.is_empty() - && public_keys.len() < threshold as usize) - || (account.get_all_public_keys().len() < threshold as usize); + let invalid_threshold_updated = !public_keys.is_empty() && public_keys.len() < threshold as usize; + let invalid_threshold_current = public_keys.is_empty() && account.get_all_public_keys().len() < threshold as usize; - if invalid_threshold || invalid_too_few_pks { + if invalid_threshold || invalid_threshold_updated || invalid_threshold_current { edisplay_line!( context.io(), "Invalid account threshold: either the provided threshold is \ @@ -3567,10 +3566,7 @@ pub async fn build_update_account( Some(threshold) } else { - let invalid_too_few_pks = (!public_keys.is_empty() - && public_keys.len() < account.threshold as usize) - || (account.get_all_public_keys().len() - < account.threshold as usize); + let invalid_too_few_pks = !public_keys.is_empty() && public_keys.len() < account.threshold as usize; if invalid_too_few_pks { return Err(Error::from(TxSubmitError::InvalidAccountThreshold)); From deb73e33843bd3f7da75b4571dbd767dca6fe6ed Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli Date: Tue, 30 Jul 2024 15:43:29 +0200 Subject: [PATCH 2/2] added changelog --- .../bug-fixes/3566-fix-update-account-client-checks.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/3566-fix-update-account-client-checks.md diff --git a/.changelog/unreleased/bug-fixes/3566-fix-update-account-client-checks.md b/.changelog/unreleased/bug-fixes/3566-fix-update-account-client-checks.md new file mode 100644 index 0000000000..57ed62018a --- /dev/null +++ b/.changelog/unreleased/bug-fixes/3566-fix-update-account-client-checks.md @@ -0,0 +1,2 @@ +- Improve client side checks for update-account transaction. + ([\#3566](https://github.com/anoma/namada/pull/3566)) \ No newline at end of file