-
Notifications
You must be signed in to change notification settings - Fork 107
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
cleanup(state): Refactor subtree read functions to accept ranges and check memory first #7739
Conversation
62aef12
to
5b55813
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.
Thanks for this refactor. It looks great.
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 looks like a good rewrite, and I appreciate how it simplifies the code.
All my comments on the Sapling methods also apply to Orchard.
I'm concerned that this change could lead to unexpected bugs, or significant extra testing. Did Pili approve a scope for this work, or is there a ticket with the scope of the work? In particular, supporting some range types might need extra tests, because the start bound gets special handling.
Since this is a substantial rewrite, do we need to re-do the manual tests with zcashd
from #7450? Which unit tests do we need to add?
A few of your recent PRs have missed documentation updates and test coverage. Would it help if you make a personal checklist that you go through before you submit a PR? Or could we add a checklist for PR authors to the PR template?
(I am working on PR template updates at the moment.)
I was wondering which issue this PR related to... :P We should finish off the rest of the issues in this sprint and merge their associated PRs before doing any more work on this one |
This PR blocks ticket #7463, because they both change the subtree code. We can start work on #7463, but this PR should merge before the PR for that ticket, otherwise there will be a lot of rework to merge them. Since #7463 is a fully scripted change, we can just re-run the script after this PR merges. (Any non-scripted parts of that ticket should be in a separate PR based on this PR.) Conflicts like this are another reason why scheduling work is important! |
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.
Ok, this looks great, pending the minor function doc update.
17c1a71
to
3416c11
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.
Thanks!
Motivation
The
read::{sapling, orchard}_subtrees
functions are reading from disk before checking the non-finalized state and minor cleanup of inconsistent behaviour between theChain
methods for retrieving subtrees from the non-finalized state compared to those ofDiskDb
.Solution
RangeBounds
instead of start/end boundsChain::{sapling, orchard}_subtrees_in_range
to only query for the provided rangestart_index
DiskDb::{sapling, orchard}_subtree_list_by_index_for_rpc()
andChain::{sapling, orchard}_subtrees_in_range
Review
Anyone can review.
Reviewer Checklist