Skip to content
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

Implement suggest_scan_ranges and updated chain validation. #872

Merged
merged 17 commits into from
Jul 19, 2023

Conversation

nuttycom
Copy link
Contributor

@nuttycom nuttycom commented Jul 7, 2023

No description provided.

@nuttycom nuttycom force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch 5 times, most recently from 12e182d to 86a4af7 Compare July 7, 2023 19:22
@nuttycom nuttycom changed the title WIP: Implement suggest_scan_ranges and updated chain validation. Implement suggest_scan_ranges and updated chain validation. Jul 7, 2023
@nuttycom nuttycom marked this pull request as ready for review July 7, 2023 19:22
@nuttycom nuttycom force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch from 86a4af7 to ea5faa0 Compare July 7, 2023 19:40
@codecov
Copy link

codecov bot commented Jul 7, 2023

Codecov Report

Patch coverage: 72.45% and project coverage change: +0.27 🎉

Comparison is base (4d5dc28) 69.85% compared to head (6bddc46) 70.12%.

❗ Current head 6bddc46 differs from pull request most recent head c7b308b. Consider uploading reports for the commit c7b308b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #872      +/-   ##
==========================================
+ Coverage   69.85%   70.12%   +0.27%     
==========================================
  Files         127      129       +2     
  Lines       12006    12480     +474     
==========================================
+ Hits         8387     8752     +365     
- Misses       3619     3728     +109     
Impacted Files Coverage Δ
zcash_client_backend/src/data_api.rs 40.00% <0.00%> (-0.68%) ⬇️
zcash_client_backend/src/data_api/chain.rs 56.62% <ø> (ø)
zcash_client_backend/src/proto/service.rs 0.00% <0.00%> (ø)
zcash_client_backend/src/scanning.rs 42.40% <0.00%> (-2.85%) ⬇️
zcash_client_sqlite/src/wallet/init.rs 53.57% <0.00%> (-0.65%) ⬇️
zcash_primitives/src/sapling/tree.rs 89.13% <0.00%> (-6.22%) ⬇️
zcash_client_sqlite/src/wallet/commitment_tree.rs 93.68% <37.50%> (-1.30%) ⬇️
...te/src/wallet/init/migrations/shardtree_support.rs 55.20% <48.71%> (+1.98%) ⬆️
zcash_client_sqlite/src/chain.rs 52.42% <50.00%> (-0.10%) ⬇️
zcash_client_backend/src/data_api/scanning.rs 82.85% <82.85%> (ø)
... and 5 more

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@nuttycom nuttycom force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch 7 times, most recently from 4d775aa to c5a8609 Compare July 7, 2023 23:51
@nuttycom nuttycom force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch 2 times, most recently from a7b59bb to caea5da Compare July 8, 2023 01:09
);
insert_into_cache(&db_cache, &cb);

for i in 1..=10 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an exclusive end, or the 11th block should either be scanned, or expected not to be scanned (and noted as such somewhere).

This implements a priority queue backed by the wallet database for scan
range ordering. The scan queue is updated on each call to `put_blocks`
or to `update_chain_tip`.
@nuttycom nuttycom force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch from caea5da to 352e1c7 Compare July 8, 2023 02:13
Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flushing my review comments.

@@ -118,6 +118,22 @@ message TreeState {
string orchardTree = 6; // orchard commitment tree state
}

enum ShieldedProtocol {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that this matches the canonical state of service.proto as of zcash/lightwalletd@ab90099.

zcash_client_backend/src/data_api/scanning.rs Outdated Show resolved Hide resolved
zcash_client_backend/src/data_api/scanning.rs Outdated Show resolved Hide resolved
zcash_client_backend/src/data_api/scanning.rs Outdated Show resolved Hide resolved
zcash_client_backend/src/data_api/scanning.rs Show resolved Hide resolved
use super::RangeOrdering::*;
// Equal
assert_eq!(RangeOrdering::cmp(&(0..1), &(0..1)), Equal);

Copy link
Contributor

@daira daira Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert_eq!(RangeOrdering::cmp(&(1..1), &(1..1)), Equal);

This is technically needed to cover all the cases, but it's non-blocking.

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed with blocking comments (the questions about ordering of inputs to ScanRange::from_parts).

LeftFirstOverlap => {
let split_point = left.span().end;
if split_point > to_insert.block_range().start {
Self::from_split(*left, *right, to_insert, split_point)
Copy link
Contributor

@daira daira Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pay attention to the check warnings saying that some of these cases are not covered by tests. If you disagree, I won't block on it.

@str4d str4d force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch from 89d5661 to fa8b135 Compare July 18, 2023 18:54
@str4d str4d force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch from fa8b135 to 1a5bc86 Compare July 18, 2023 19:04
@str4d str4d force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch from 2cb284f to e16aa41 Compare July 19, 2023 14:54
daira
daira previously approved these changes Jul 19, 2023
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@str4d str4d force-pushed the feature/pre_dag_sync-suggest_scan_ranges branch from f679e56 to c7b308b Compare July 19, 2023 16:03
Copy link
Collaborator

@ebfull ebfull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK and tested. I haven't thoroughly reviewed some parts but those appear to have been given plenty of attention by others.

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK; remaining suggestions are non-blocking.

@str4d str4d merged commit f422188 into zcash:main Jul 19, 2023
10 checks passed
@nuttycom nuttycom deleted the feature/pre_dag_sync-suggest_scan_ranges branch July 31, 2023 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants