-
Notifications
You must be signed in to change notification settings - Fork 248
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
zcash_client_backend: Add account birthday management to the Data Access API #907
Conversation
Codecov ReportPatch coverage is
📢 Thoughts on this report? Let us know!. |
e04f345
to
c2b1e41
Compare
zcash_client_sqlite/src/wallet/init/migrations/v_sapling_shard_unscanned_ranges.rs
Show resolved
Hide resolved
5811b8c
to
578dc57
Compare
578dc57
to
9163d7d
Compare
3ee4507
to
4f8eab8
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.
From the Android SDK consumer view, it looks good. Thank you! The only question I have is that I see both init_blocks_table
and init_accounts_table
are replaced by create_account
, which expects AccountBirthday
, which is optional. Can you please describe what we should use in case of new or restored wallets for this parameter? Or should we leave it empty?
There are two options: In the Zashi wallet, you will usually want option (2) because the wallet only supports a single account. In the future, though, the SDK may support the creation of multiple accounts, and also we'll have to figure out something for when the wallets add Orchard support; I'm not sure whether we'll want to handle that by creating a new account, or by creating separate per-protocol birthdays. |
588f5c9
to
1c00f75
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.
Flushing my review for the first two commits (up to 12ddc7d).
priority_code(&ScanPriority::Scanned), | ||
), | ||
"CREATE VIEW v_sapling_shard_unscanned_ranges AS | ||
WITH wallet_birthday AS (SELECT MIN(birthday_height) AS height FROM accounts) |
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.
After the change to AccountBirthday
, we are effectively changing the definition of the wallet_birthday
column (to match its semantics for new accounts, i.e. last height we don't need to scan). Check that this works for the view, and adjust if necessary.
zcash_client_sqlite/src/wallet/init/migrations/add_account_birthdays.rs
Outdated
Show resolved
Hide resolved
1c00f75
to
cf9cd72
Compare
…te_account` This also removes the zcash_client_sqlite-specific database initialization procedures in favor of a standardized approach using the methods available via the data access API.
…ble via the data access API
…t in note selection
bc94a63
to
3a1d4a4
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.
Re-utACK 3a1d4a4
Co-authored-by: str4d <[email protected]> Co-authored-by: Daira Emma Hopwood <[email protected]>
727cddd
to
5b3f544
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.
Re-utACK 5b3f544.
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.
Flushing comments.
u32::from( | ||
self.params | ||
.activation_height(NetworkUpgrade::Sapling) | ||
.unwrap() | ||
) |
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 know this is guaranteed to be an integer, nevertheless I would have used a named parameter.
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 did this mostly for the sake of using execute_batch
; as far as I know that is the only mechanism available for executing multiple SQL statements in a single call.
@@ -186,6 +198,15 @@ pub(crate) fn select_spendable_sapling_notes( | |||
anchor_height: BlockHeight, | |||
exclude: &[ReceivedNoteId], | |||
) -> Result<Vec<ReceivedSaplingNote<ReceivedNoteId>>, SqliteClientError> { |
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.
The partially duplicated code between this and get_spendable_sapling_notes
seems like a maintenance hazard. I see that the SQL statement is different and has an extra :target_value
parameter; can the rest of these methods be abstracted out?
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.
The fact that we have two separate such methods is a historical artifact. We should clean it up some day.
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.
Post-hoc ACK with comments.
Address unresovled code review comments from #907
Closes #897.