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

Add the Ability for Prysm To Handle Trusted Peers #12492

Merged
merged 10 commits into from
Jun 12, 2023
Merged

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented Jun 5, 2023

What type of PR is this?

Feature

What does this PR do? Why is it needed?

  • Add the ability for Prysm to correctly handle trusted peers in its peer store. This prevents trusted peers from being
    banned or disconnected due to our pruning routines/peer scorer.
  • Unit tests for feature.

Which issues(s) does this PR fix?

N.A

Other notes for review

@nisdas nisdas added the Networking P2P related items label Jun 5, 2023
@nisdas nisdas marked this pull request as ready for review June 9, 2023 06:15
@nisdas nisdas requested a review from a team as a code owner June 9, 2023 06:15
@nisdas nisdas requested review from saolyn, potuz and james-prysm June 9, 2023 06:15
for _, a := range addrs {
info, err := peer.AddrInfoFromP2pAddr(a)
if err != nil {
log.WithError(err).Error("Could not derive peer info from multiaddress")
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to add a.String() in the log to know which address failed

// Set trusted peers for those that are provided as static addresses.
pids := peerIdsFromMultiAddrs(addrs)
s.peers.SetTrustedPeers(pids)
peersToWatch = append(peersToWatch, s.cfg.StaticPeers...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we currently watch static peers?

Copy link
Member Author

Choose a reason for hiding this comment

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

it was a bug, which is why its being fixed here

@prylabs-bulldozer prylabs-bulldozer bot merged commit d5057cf into develop Jun 12, 2023
@prylabs-bulldozer prylabs-bulldozer bot deleted the trustedPeers branch June 12, 2023 14:47
terencechain pushed a commit that referenced this pull request Jun 12, 2023
* add all changes

* add to peers to watch

* add tests

* Update beacon-chain/p2p/peers/peerdata/store_test.go

* radek's review

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
terencechain pushed a commit that referenced this pull request Jun 12, 2023
* add all changes

* add to peers to watch

* add tests

* Update beacon-chain/p2p/peers/peerdata/store_test.go

* radek's review

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Networking P2P related items
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants