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

QSP-45 Add Check for No Connected Peers BestFinalized #6402

Merged
merged 4 commits into from
Jun 26, 2020

Conversation

rauljordan
Copy link
Contributor

Part of #6327, we were not handling the case with 0 connected peers in the peer status BestFinalized() method. Instead, we were checking for no connected peers around the method but not in the method itself, which could lead to misuse down the line

@rauljordan rauljordan requested a review from a team as a code owner June 25, 2020 16:01
@rauljordan rauljordan self-assigned this Jun 25, 2020
@rauljordan rauljordan added Audit Ready For Review A pull request ready for code review labels Jun 25, 2020
Copy link
Member

@nisdas nisdas left a comment

Choose a reason for hiding this comment

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

It would be good to have @farazdagi to also take a look at this, since this is mostly used in initial sync

Copy link
Contributor

@farazdagi farazdagi left a comment

Choose a reason for hiding this comment

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

@nisdas thanks for summoning, I was going to work on the issue myself (I've marked my intent in #6327, Raul probably just didn't see my comment), so gladly adding my thoughts as a review:

I don't think that unless we re-write the method completely, we should do anything but:

  • add a comment to BestFinalized(), mentioning that client code must check the len(peers) before using extra info
  • review and make sure that current code does this (I suppose it does)

❗ Btw, have you noticed that we don't actually use the targetRoot anywhere (except tests), what we are using is epoch and peers. So, we can throw away the targetRoot and resolve QSP-45 that way.

beacon-chain/p2p/peers/status.go Outdated Show resolved Hide resolved
beacon-chain/sync/initial-sync/blocks_fetcher.go Outdated Show resolved Hide resolved
beacon-chain/sync/initial-sync/blocks_fetcher.go Outdated Show resolved Hide resolved
Copy link
Contributor

@farazdagi farazdagi left a comment

Choose a reason for hiding this comment

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

lgtm

@prylabs-bulldozer prylabs-bulldozer bot merged commit ab89053 into master Jun 26, 2020
@delete-merged-branch delete-merged-branch bot deleted the best-finalized branch June 26, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants