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

Limit inbound download and verify queue #1622

Merged
merged 2 commits into from
Jan 29, 2021

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Jan 22, 2021

Motivation

The Inbound service's Downloads queue can grow without limit.

See #1618 for some general background.

Solution

Drop new requests when the Inbound downloads queue reaches a fixed limit.

The code in this pull request has:

  • Documentation Comments
  • Manual Tests

Review

This change is a lower priority than #1620, so I'm not going to tag anyone for review.

Follow Up Work

Do the rest of #1618.

@teor2345 teor2345 added C-bug Category: This is a bug A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup labels Jan 22, 2021
@teor2345 teor2345 added this to the 2021 Sprint 1 milestone Jan 22, 2021
@teor2345 teor2345 self-assigned this Jan 22, 2021
Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

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

Looks good.

#[instrument(skip(self, hash), fields(hash = %hash))]
pub fn download_and_verify(&mut self, hash: block::Hash) -> bool {
pub fn download_and_verify(&mut self, hash: block::Hash) -> DownloadAction {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this return value actually get used? I'm surprised to see that changing the return type here didn't end up causing compiler errors in any other part of our code.

Copy link
Contributor

Choose a reason for hiding this comment

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

The return value is not being used https://github.com/ZcashFoundation/zebra/blob/main/zebrad/src/components/inbound.rs#L243

The other side of the connection is not expecting anything in response to the AdvertiseBlock they sent to us.

I was a bit surprised about this as well but i assumed it was fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yaahc currently the Inbound service doesn't act on the DownloadAction.

But in future, we might want to return an error if a peer sends us lots of queued or cached blocks, because it means that they are a long way behind us. (Or for zcashd, it means their idea of our height is wrong.)

@teor2345 teor2345 requested a review from yaahc January 28, 2021 09:07
@teor2345
Copy link
Contributor Author

I think we've dealt with all the concerns here, so I'm going to merge this PR so we can focus on other work.

If there's anything we need to fix, let's open another ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-bug Category: This is a bug C-cleanup Category: This is a cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants