Skip to content

Migrations & data storage for pre-DAG-sync#831

Merged
nuttycom merged 27 commits intozcash:mainfrom
nuttycom:feature/pre_dag_sync
Jul 4, 2023
Merged

Migrations & data storage for pre-DAG-sync#831
nuttycom merged 27 commits intozcash:mainfrom
nuttycom:feature/pre_dag_sync

Conversation

@nuttycom
Copy link
Copy Markdown
Collaborator

@nuttycom nuttycom commented May 2, 2023

Based on #857

@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch 5 times, most recently from b9c1782 to 58412a1 Compare May 9, 2023 02:03
@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch 8 times, most recently from 59d712d to cea2917 Compare May 24, 2023 18:47
@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch 2 times, most recently from e7bf6e1 to 785dd37 Compare May 25, 2023 23:45
@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch from 785dd37 to a62a2e0 Compare June 3, 2023 01:28
Copy link
Copy Markdown
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.

Only cursory review so far.

@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch 4 times, most recently from 0a75a07 to e5c1386 Compare June 13, 2023 17:20
@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch from e5c1386 to cfd11f5 Compare June 14, 2023 22:49
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 14, 2023

Codecov Report

Patch coverage: 71.45% and project coverage change: +0.47 🎉

Comparison is base (fa67d9a) 69.75% compared to head (c13c8c6) 70.23%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #831      +/-   ##
==========================================
+ Coverage   69.75%   70.23%   +0.47%     
==========================================
  Files         124      127       +3     
  Lines       11618    11848     +230     
==========================================
+ Hits         8104     8321     +217     
- Misses       3514     3527      +13     
Impacted Files Coverage Δ
zcash_client_backend/src/data_api/chain/error.rs 0.00% <0.00%> (-21.43%) ⬇️
zcash_client_sqlite/src/error.rs 0.00% <0.00%> (ø)
...rc/wallet/init/migrations/add_transaction_views.rs 61.40% <ø> (+2.08%) ⬆️
...llet/init/migrations/received_notes_nullable_nf.rs 71.42% <ø> (+4.76%) ⬆️
...e/src/wallet/init/migrations/v_transactions_net.rs 73.33% <ø> (+4.58%) ⬆️
zcash_client_backend/src/data_api/error.rs 8.77% <16.66%> (+0.92%) ⬆️
zcash_client_sqlite/src/wallet/init.rs 54.21% <25.00%> (-17.72%) ⬇️
zcash_client_backend/src/scanning.rs 42.23% <25.71%> (ø)
zcash_client_sqlite/src/chain.rs 52.52% <33.33%> (+1.04%) ⬆️
...te/src/wallet/init/migrations/shardtree_support.rs 53.22% <53.22%> (ø)
... and 14 more

... and 47 files with indirect coverage changes

☔ 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 branch from cfd11f5 to 5124572 Compare June 15, 2023 20:31
nuttycom added 6 commits June 30, 2023 09:45
Local chain validation will be performed internal to
`scan_cached_blocks`, and as handling of chain reorgs will need to
change to support out-of-order scanning, the `validate_chain` method
will be superfluous. It is removed in advance of other changes in order
to avoid updating it to reflect the forthcoming changes.
@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch from 71ac466 to c4e11e6 Compare July 2, 2023 01:39
@nuttycom
Copy link
Copy Markdown
Collaborator Author

nuttycom commented Jul 2, 2023

force-pushed to address comments from code review.

nuttycom added 3 commits July 3, 2023 10:49
In preparation for out-of-order range-based scanning, it is necessary
to ensure that the size of the Sapling note commitment tree is carried
along through the scan process and that stored blocks are always
persisted with the updated note commitment tree size.
@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch from b2e742d to 42ed6ba Compare July 3, 2023 16:50
@nuttycom
Copy link
Copy Markdown
Collaborator Author

nuttycom commented Jul 3, 2023

force-pushed to fix an off-by-one error and fix cargo fmt errors.

},
)?;
block_source.with_blocks::<_, DbT::Error>(scan_from, limit, |block: CompactBlock| {
add_block_to_runner(params, block, &mut batch_runner);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It occurs to me that we should actually do the continuity check here, because there's no reason to add a block to the runner or continue the scan if the continuity check fails.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've made this change in the forthcoming range-suggestions PR.

pub network: Network,
pub sapling_tree: ShardTree<
MemoryShardStore<sapling::Node, BlockHeight>,
{ SAPLING_SHARD_HEIGHT * 2 },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{ SAPLING_SHARD_HEIGHT * 2 },
{ sapling::NOTE_COMMITMENT_TREE_DEPTH },

Copy link
Copy Markdown
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.

Reviewed as of c363e71.

[patch.crates-io]
incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "082109deacf8611ee7917732e19b56158bda96d5" }
shardtree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "082109deacf8611ee7917732e19b56158bda96d5" }
orchard = { git = "https://github.com/zcash/orchard.git", rev = "5da41a6bbb44290e353ee4b38bcafe37ffe79ce8" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I verified that this is the latest commit in zcash/orchard#398.

Comment on lines +899 to +901
if expected_hash != block_hash {
return Err(SqliteClientError::BlockConflict(block_height));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reminding @daira to write hir comment.

@daira
Copy link
Copy Markdown
Contributor

daira commented Jul 3, 2023

I would like to finish my review before this merges (which I should be able to do tonight).

Edit: had a terrible migraine. It's fine that this merged, I'll finish my review post-hoc anyway though.

@nuttycom nuttycom force-pushed the feature/pre_dag_sync branch from e6676c6 to c13c8c6 Compare July 3, 2023 23:08
Copy link
Copy Markdown
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.

utACK c13c8c6

@str4d
Copy link
Copy Markdown
Contributor

str4d commented Jul 4, 2023

I'm using c13c8c6 in zcash/lightwalletd#440; please do not rebase that commit.

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.

3 participants