-
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
Add transaction downloader and verifier #2679
Conversation
I suggest a single mempool downloader, based on
I don't think there's any reason to have multiple downloaders for different sources of transaction IDs.
This is a good idea, because it helps with de-duplicating block downloads - #862. But our goal is to have a minimal working mempool over the next 3 sprints.
The height of the next block after the best chain tip: zebra/zebra-consensus/src/transaction.rs Lines 82 to 90 in a4b0b46
I'm happy to check back on this ticket occasionally, but I'd like @dconnolly or someone else to take the lead on this review. |
0e8a397
to
c33d1eb
Compare
c33d1eb
to
8cc6eef
Compare
Thanks @teor2345! Current status: I've changed it to be more similar to the inbound downloader. It's now mostly done, and seems to be working. (You can set the What's missing & questions:
Here's what the dashboard looks like |
I think But we can add them in another PR. (I created ticket #2692 for this.) |
Yes, using But this can happen in another PR, because If the syncer isn't near the tip, we should ignore all pushed transactions and transaction IDs. We don't have enough information to get reliable verification results. |
Yes, before we:
we need to check if the transaction ID is in any of:
(I opened #2689 to improve the performance of |
The current values seem fine, but we should document the rationale, just in case there are timeout issues later. |
That error comes from this code, where we need to add a specific case for each downcast: zebra/zebra-consensus/src/error.rs Lines 92 to 94 in 4240950
These errors would be clearer if we mapped each timeout to a specific error variant: zebra/zebra-consensus/src/script.rs Line 44 in 4240950
zebra/zebrad/src/components/inbound.rs Lines 178 to 187 in 8cc6eef
This specific issue looks like a race between the transaction verifier timeout and the UTXO timeout: zebra/zebrad/src/components/sync.rs Line 125 in 8cc6eef
zebra/zebra-consensus/src/script.rs Line 23 in 4240950
Feel free to do some quick fixes here, or to open another ticket. |
👍 But don't worry about it too much in this PR. It might be hard to get all the right context in place for mempool download and verify tests. We ended up testing the syncer and inbound service using |
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.
Looks good so far.
Here are a bunch of details that might be helpful, including minor fixes and comment tweaks.
Co-authored-by: teor <teor@riseup.net>
Co-authored-by: teor <teor@riseup.net>
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've addressed comments.
I'm working on checking for existing txs in mempool/state but that requires passing some stuff around so I'll leave it to a separate a PR to keep this one simple, so I'm moving this out of draft.
I opened or found tickets for all of the follow up work |
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.
Blocker: Zebra panics with:
internal error: entered unreachable code: Invalid transaction version: after Overwinter activation transaction versions 1 and 2 are rejected
It looks like we're not checking that v4 transactions are valid for the requested network upgrade. We'll need to add a check like verify_v5_transaction_network_upgrade
, but for v4 transactions.
It should be the first check we do on v4 transactions.
…contains_coinbase_input() to has_any_coinbase_inputs(); reorder checks
…sighash (for V5 too)
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.
Blocker: Zebra panics with:
internal error: entered unreachable code: Invalid transaction version: after Overwinter activation transaction versions 1 and 2 are rejected
It looks like we're not checking that v4 transactions are valid for the requested network upgrade. We'll need to add a check like
verify_v5_transaction_network_upgrade
, but for v4 transactions.It should be the first check we do on v4 transactions.
I've also added a |
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 a few very minor suggestions, but no blockers any more.
Happy to approve or to let someone else take a look.
Co-authored-by: teor <teor@riseup.net>
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 think we're good to go here.
Motivation
We need to download transactions and verify them in order to implement the mempool.
Closes #2637
Specifications
Designs
Solution
This basically copies
zebrad/src/components/inbound/downloads.rs
and adapts it to work with transactions.Currently any
AdvertiseTransactionIds
(inv
) are downloaded and verified, and the result is just logged.Review
@teor2345 already reviewed the draft so they may want to finish it, otherwise @dconnolly can review it
Reviewer Checklist
Follow Up Work
What's missing and will be done in separate PRs / issues:
Elapsed
error issue I described in Add transaction downloader and verifier #2679 (comment)zebrad
acceptance tests for the mempool #2691 )PushTransaction
s #2692)