-
Notifications
You must be signed in to change notification settings - Fork 117
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
Send crawled transaction IDs to downloader #2801
Send crawled transaction IDs to downloader #2801
Conversation
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, I just have a question about error handling.
9ad2e55
to
9cb7499
Compare
I updated the PR to include a test to ensure the crawler survives forwarding errors. This was a bit harder than I expected, and I ended up refactoring the tests a bit to try to make it readable. Hopefully it's not too complicated 😅 You can see only the changes here. |
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 need to shut down the task if the mempool shuts down or has a fatal error.
But I don't think any of the other errors are particularly serious.
Thanks again for the comprehensive tests here, I think they'll really help us get the error handling right. |
Replace the single letter with a proper name.
The type names will conflict with the ones for the mempool service.
Add a field to the `Crawler` type to store a way to access the `Mempool` service.
The crawled transactions are now sent to the transaction downloader and verifier, to be included in the mempool.
Make it simpler to use the `MockService::expect_request` method.
Create some dummy crawled transactions, and let the crawler discover them. Then check if they are forwarded to the mempool to be downloaded and verified.
Ignore response from peers that don't provide any crawled transactions.
Calling the Mempool service should not fail, so if an error happens it should be visible. However, errors when downloading individual transactions can happen from time to time, so there's no need for them to be very visible.
Provide some depth as to what the test expect from the crawler's behavior.
Make it easier to reuse the common test setup code.
Now that `zebra_network::Request` implement `Eq`, the call can be simplified into `expect_request`.
A helper function that checks for a network crawl request and responds with the given list of crawled transaction IDs.
A function to intercept and respond to the fanned-out requests sent during a single crawl iteration.
Reduce the repeated code necessary to intercept and reply to a request for queuing transactions to be downloaded.
Intercepts a mempool request to queue transactions to be downloaded, and responds with an error, simulating an internal problem in the mempool service implementation.
This is required for deriving `Arbitrary` for some error types.
Allow random transaction errors to be generated for property tests.
Allow random Mempool errors to be generated for property tests.
The crawler should be robust enough to continue operating even if the mempool service fails to download transactions or even fails to handle requests to enqueue transactions.
They should happen regularly, so there's no need to have them with a high visibility level. Co-authored-by: teor <[email protected]>
If `Mempool::poll_ready` returns an error, it's because the mempool service has stopped and can't handle any requests, so the crawler should stop as well.
f668cde
to
ddad6d1
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.
Looks good!
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.
Thanks for these changes, let's merge!
Motivation
The mempool crawler currently only logs crawled transaction IDs, but doesn't forward them so that the transactions can be downloaded and stored in the mempool.
This closes #2650.
Solution
The
mempool::Crawler
was updated to receive a handle to the mempool service, and after it receives crawled transactions it just forwards them to be queued in the mempool's transaction downloader.Review
Anyone working on the mempool can review this PR.
Reviewer Checklist
Follow Up Work