Skip to content
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

3. Send notfound when Zebra doesn't have a block or transaction #3466

Merged
merged 15 commits into from
Feb 14, 2022

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Feb 4, 2022

Motivation

Currently, Zebra just ignores block or transaction requests it can't answer.
But we should tell peers we don't have that inventory, so they can try another peer.

Solution

  • send notfound when Zebra doesn't have a block or transaction
  • allow different available and missing types inside ResponseStatus
  • stop sending unsupported missing inventory types to the registry

Related non-feature fixes:

  • move address sanitization into the response future
  • add a block_hash convenience method to InventoryHash
  • improve failure logs for connection tests
  • move module docs to the top of each module

Tests:

  • inbound messages are forwarded to the registry
  • Zebra responds with notfound block messages to peers - single block request
  • Zebra responds with notfound transaction messages to peers (including Tx and Wtx) - multi-transaction request

Closes #2726.

Review

I'd like reviews to focus on the functionality changes.
(I will open another PR to deal with some edge cases around peers not sending notfound, and Zebra cancelling requests.)

@jvff can review this PR.

This PR is based on PR #3465.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Follow Up Work

@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #3466 (6c9994c) into main (499ae89) will increase coverage by 1.95%.
The diff coverage is 77.56%.

@@            Coverage Diff             @@
##             main    #3466      +/-   ##
==========================================
+ Coverage   78.34%   80.29%   +1.95%     
==========================================
  Files         267      275       +8     
  Lines       31526    32054     +528     
==========================================
+ Hits        24698    25738    +1040     
+ Misses       6828     6316     -512     

@teor2345 teor2345 requested a review from jvff February 7, 2022 02:31
@teor2345 teor2345 marked this pull request as ready for review February 7, 2022 03:03
@teor2345 teor2345 force-pushed the notfound-route branch 2 times, most recently from 2e7f394 to e049a17 Compare February 7, 2022 22:25
Base automatically changed from notfound-route to main February 8, 2022 01:16
@teor2345 teor2345 force-pushed the notfound-send branch 4 times, most recently from 45fce08 to 47880aa Compare February 8, 2022 09:00
@teor2345
Copy link
Contributor Author

teor2345 commented Feb 8, 2022

@jvff this should be ready for review now.

I'd like to focus on the functionality changes, because this PR series has taken longer than I expected.
So if we have to leave cleanups and refactors for later, that's ok.

@teor2345
Copy link
Contributor Author

teor2345 commented Feb 8, 2022

jvff
jvff previously approved these changes Feb 10, 2022
Copy link
Contributor

@jvff jvff left a comment

Choose a reason for hiding this comment

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

I left a lot of comments, but I don't think any of them should block merging the PR 🤔

teor2345 and others added 15 commits February 14, 2022 08:41
```sh
fastmod Advertised Available zebra*
fastmod advertised available zebra*
```
… an InventoryStatus

And rename it to ResponseStatus.

Split the methods between ResponseStatus and an InventoryStatus alias.
This makes them more likely to get updated when the module changes.
The code that these tests use hasn't actually changed much,
and they are only failing on some platforms (coverage, macOS).

So it seems like the extra concurrent inbound tests have pushed them
past their time limit.
(Perhaps due to TCP system calls, or extra serialization work.)
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
This prevents `MockService<zebra_state>` timeouts
in the `sync_block_too_high_extend_tips` test,
at the cost of reducing coverage of different execution orders.
@teor2345
Copy link
Contributor Author

@jvff thanks for the reviews.

This PR series took much longer than I expected to write and test, so I'd really like to get it merged.
Are there any major issues with the design, or any bugs you can see?

@mergify mergify bot merged commit 9f2028f into main Feb 14, 2022
@mergify mergify bot deleted the notfound-send branch February 14, 2022 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-network Area: Network protocol updates or fixes C-enhancement Category: This is an improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Zebra send notfound, and use received notfound to finish requests
2 participants