From 5c902099cca6cb0228ace5a0e40d808f7b631ba8 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 19 Nov 2024 13:22:15 +0000 Subject: [PATCH 1/2] Fix shielded sync scanned progress bar limit --- .../src/masp/shielded_sync/dispatcher.rs | 8 ++++---- .../shielded_token/src/masp/shielded_sync/utils.rs | 13 ++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/shielded_token/src/masp/shielded_sync/dispatcher.rs b/crates/shielded_token/src/masp/shielded_sync/dispatcher.rs index 6a53a6270e..31961048ab 100644 --- a/crates/shielded_token/src/masp/shielded_sync/dispatcher.rs +++ b/crates/shielded_token/src/masp/shielded_sync/dispatcher.rs @@ -557,7 +557,7 @@ where self.config .scanned_tracker - .set_upper_limit(self.cache.fetched.len() as u64); + .set_upper_limit(self.cache.fetched.shielded_outputs() as u64); self.config.applied_tracker.set_upper_limit( self.cache.trial_decrypted.successful_decryptions() as u64, ); @@ -667,9 +667,9 @@ where self.cache.fetched.extend(tx_batch); self.config.fetched_tracker.increment_by(to.0 - from.0 + 1); - self.config - .scanned_tracker - .set_upper_limit(self.cache.fetched.len() as u64); + self.config.scanned_tracker.set_upper_limit( + self.cache.fetched.shielded_outputs() as u64, + ); } Message::FetchTxs(Err(TaskError { error, diff --git a/crates/shielded_token/src/masp/shielded_sync/utils.rs b/crates/shielded_token/src/masp/shielded_sync/utils.rs index 3d2c4e5d47..0131eea5a4 100644 --- a/crates/shielded_token/src/masp/shielded_sync/utils.rs +++ b/crates/shielded_token/src/masp/shielded_sync/utils.rs @@ -134,9 +134,16 @@ impl Fetched { self.txs.is_empty() } - /// Check the length of the fetched cache - pub fn len(&self) -> usize { - self.txs.len() + /// Return the number of shielded outputs in the cache + pub fn shielded_outputs(&self) -> usize { + self.txs + .values() + .map(|shielded| { + shielded + .sapling_bundle() + .map_or(0, |x| x.shielded_outputs.len()) + }) + .sum::() } } From 00904e48eb29c38dfb381099c9153203f022dab6 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 19 Nov 2024 13:26:35 +0000 Subject: [PATCH 2/2] Changelog for #4046 --- .../unreleased/bug-fixes/4046-ss-scanned-tracker-total.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/4046-ss-scanned-tracker-total.md diff --git a/.changelog/unreleased/bug-fixes/4046-ss-scanned-tracker-total.md b/.changelog/unreleased/bug-fixes/4046-ss-scanned-tracker-total.md new file mode 100644 index 0000000000..ef3047c984 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/4046-ss-scanned-tracker-total.md @@ -0,0 +1,2 @@ +- Fix the limit of the scanned progress bar in shielded sync being lower than + the current value. ([\#4046](https://github.com/anoma/namada/pull/4046)) \ No newline at end of file