-
Notifications
You must be signed in to change notification settings - Fork 251
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
Add queues to track the need for transaction enhancement and/or verification of mined status. #1473
Conversation
zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs
Outdated
Show resolved
Hide resolved
7709120
to
9e22493
Compare
zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs
Outdated
Show resolved
Hide resolved
zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs
Outdated
Show resolved
Hide resolved
ecee800
to
8749d37
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1473 +/- ##
==========================================
+ Coverage 60.82% 61.16% +0.34%
==========================================
Files 140 141 +1
Lines 16472 16650 +178
==========================================
+ Hits 10019 10184 +165
- Misses 6453 6466 +13 ☔ View full report in Codecov by Sentry. |
d3837d4
to
9ffcb8e
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 comments up to 40d94d0 (just before looking at db.rs
).
7994e82
to
cc3c34f
Compare
93d75b0
to
1cbced3
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.
Reviewed 1cbced3.
zcash_client_sqlite/src/wallet/init/migrations/tx_retrieval_queue.rs
Outdated
Show resolved
Hide resolved
1cbced3
to
4741662
Compare
4b12e61
to
590057a
Compare
Co-authored-by: Daira-Emma Hopwood <[email protected]>
590057a
to
366a3e3
Compare
request in `set_transaction_status`. Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
…nsfer`. fixes zcash#1485 Signed-off-by: Daira-Emma Hopwood <[email protected]>
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 171cc3d once my concern about Enhancement
results has been addressed (either by explaining why it's fine, or making a fix).
zcash_client_sqlite/src/wallet.rs
Outdated
// In order to have made a Status request, we must already have had the | ||
// raw transaction (the only callers of `queue_tx_retrieval` are in contexts | ||
// where we must have already called `put_tx_data`). Therefore, it is safe | ||
// to unconditionally delete the request from `tx_retrieval_queue` below | ||
// (both in the expired case and the case where it has been mined), because | ||
// we already have all the data we need about this transaction. |
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 is true for Status requests, but not true for Enhancement requests which subsume Status.
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.
Yes. I noticed that and the first commit of nuttycom#39 (nuttycom@239f7ff) fixes it. The implementation is fine, it's just the comment that is incorrect.
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.
It occurs to me that https://github.com/zcash/librustzcash/pull/1473/files#diff-a1724f7547ecabc613a07520eaf7917d9084d4277219d186698b0c8e352495a4R2425-R2427 is superfluous; we should never have a Status
request for a transaction unless we have the raw data. So one way to fix this would be to remove the query type argument from the queue_tx_retrieval
function, and to set it based upon the presence or absence of raw transaction data.
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 comment change doesn't resolve my concern. GetStatus
is indeed only generated when we have the raw transaction (as I noted), but Enhancement
is generated by definition when we don't have the raw transaction, and its documentation states that when the caller is unable to look up the transaction, it must call this method.
The reason it is okay to delete for Enhancement
requests is that:
- If a transaction can't be enhanced, we assume that the caller calls this method with
TransactionStatus::TxidNotRecognized
(as the other two statuses mean that the chain data source knew about the transaction, and therefore must have observed it and could return its raw data), so we don't need to consider what happens in the other statuses. - We only delete for
TransactionStatus::TxidNotRecognized
if the transaction is expired, at which point we don't necessarily care about enhancement (though the user might still care about the memo), and it is very likely that we will be unable to ever enhance (as the tx will have been dropped from all mempools).
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.
Simplified in 5a1645a
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 is that an Enhancement
request is a Status
request. That's what it means for an Enhancement
request to subsume a Status
request. It's either "get me the status" or "get me the status and the data if it's available".
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.
@daira Enhancement
is getting the status; it subsumes / is a superset of GetStatus
. That's why I raised my initial concern that this method was being written ostensibly assuming it would only be called via GetStatus
, which was false.
As @nuttycom says, the actual implementation does correctly work with both GetStatus
and Enhancement
; the comment was just misleading.
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 now updated this comment again. (b47c7bf)
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 is that an Enhancement request is a Status request.
Not so. Otherwise it wouldn't have to requeue a Status request when queue_status_retrieval
is true. It doesn't directly update the mined height in the case where d_tx.mined_height().is_none()
.
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.
Otherwise it wouldn't have to requeue a Status request when queue_status_retrieval is true.
The re-queueing is so that the wallet continues to monitor for when the transaction is eventually mined. A relevant case here is that store_decrypted_tx
was called with a transaction that was read from the mempool; we have complete transaction data, but we don't know yet whether the transaction will be mined, so we stick the status request back on the queue. For a fully transparent transaction that we get from the mempool we have no other way of detecting that it becomes mined.
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 modulo suggested changes in nuttycom#39 . We can either merge that PR into this one, or merge a copy of it separately. (I have checked that it passes tests locally.)
…o wallet/enrichment_queue
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 b47c7bf
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
No description provided.