-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve progress representation in WalletSummary
#1541
Conversation
76670cf
to
711b4c8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1541 +/- ##
==========================================
+ Coverage 60.46% 60.50% +0.04%
==========================================
Files 147 147
Lines 17115 17313 +198
==========================================
+ Hits 10348 10476 +128
- Misses 6767 6837 +70 ☔ View full report in Codecov by Sentry. |
711b4c8
to
d872202
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My review is not yet complete, but the last comment about the use of last_completed_subtree_index
is blocking.
@@ -839,21 +839,23 @@ fn subtree_scan_progress( | |||
fully_scanned_height: BlockHeight, | |||
chain_tip_height: BlockHeight, | |||
) -> Result<Option<Ratio<u64>>, SqliteClientError> { | |||
let mut stmt_scanned_count_from = conn.prepare_cached(&format!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the things that I "left for later" when I was originally writing this code was the fact that this query seems potentially expensive/wasteful. It's probably not worth changing without benchmarking, but it does feel weird to do a sum over potentially millions of rows as a matter of course.
let mut stmt_start_tree_size = conn.prepare_cached(&format!( | ||
"SELECT MAX({table_prefix}_commitment_tree_size - {output_count_col}) | ||
FROM blocks | ||
WHERE height <= :start_height", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query could potentially be inefficient; it would really be best if we could take advantage of our understanding that the note commitment tree size monotonically increases with block height instead of performing a million subtractions.
// TODO: it would be nice to be able to reliably have the size of the | ||
// commitment tree at the chain tip without having to have scanned that | ||
// block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have wanted this before. It would be possible to use the GetLatestTreeState
data for this, but really it should just be part of the GetLatestBlock
results. That's a simple additive change to the protobuf; we should just do it.
d872202
to
8cc7566
Compare
Force-pushed to address review comments. |
8cc7566
to
d29a9fd
Compare
Force-pushed to address more comments and fix a compilation bug. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of off-by-one errors.
After splitting recover progress out from scan progress, the overestimation of the chain tip tree size became much more noticeable. We now extrapolate from the most recent known "notes per block" rate.
…ests The wrong subtree was being completed, which didn't matter before but does now that scan progress is extrapolated.
d29a9fd
to
b4da98e
Compare
Force-pushed to address remaining comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK with comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK b4da98e
We now split progress into "scan progress" and "recover progress" based on the recover-until height (if set, otherwise recover progress is always 100%).
Part of #1070.