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

phonebook: Persist initial phonebook peers; remove unused ExtendPeerList #5615

Merged

Conversation

Eric-Warehime
Copy link
Contributor

@Eric-Warehime Eric-Warehime commented Jul 27, 2023

Summary

We never actually call ExtendPeerList anywhere. When we refresh the SRV list periodically it just fully replaces the peer list.

Test Plan

grep'ing ExtendPeerList shows nothing. Also existing tests should pass.

Info

Resolves #5545

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #5615 (c54193a) into master (d82691d) will increase coverage by 0.01%.
Report is 22 commits behind head on master.
The diff coverage is 92.30%.

@@            Coverage Diff             @@
##           master    #5615      +/-   ##
==========================================
+ Coverage   54.95%   54.97%   +0.01%     
==========================================
  Files         460      460              
  Lines       64446    64447       +1     
==========================================
+ Hits        35417    35430      +13     
+ Misses      26653    26643      -10     
+ Partials     2376     2374       -2     
Files Changed Coverage Δ
network/wsNetwork.go 72.87% <0.00%> (ø)
network/phonebook.go 91.33% <100.00%> (+0.06%) ⬆️

... and 15 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@algorandskiy
Copy link
Contributor

If I remember right, it does not replace but merges. Otherwise phonebook.json and -p would not work?

@Eric-Warehime
Copy link
Contributor Author

If I remember right, it does not replace but merges. Otherwise phonebook.json and -p would not work?

All occurrences in the repo according to github search:
https://github.com/search?q=repo%3Aalgorand%2Fgo-algorand%20ExtendPeerList&type=code

SRV updates use this to replace peer list on refresh.
https://github.com/algorand/go-algorand/blob/master/network/wsNetwork.go#L1775-L1785C2

Replace peer list on ws network create--which is where the -p overrides get passed in.
https://github.com/algorand/go-algorand/blob/master/network/wsNetwork.go#L2452C12-L2452C27

@algorandskiy
Copy link
Contributor

This sounds like a buggy behavior for me. -p entries must survive and not being replaced.

@iansuvak
Copy link
Contributor

I agree that we probably want clear semantics on the -p and the method naming.This change itself is safe but as @algorandskiy said we want to make sure that DNS refresh never clobbers manual peers provided via -p. Might be outside of the scope of this cleanup PR though.

@algorandskiy
Copy link
Contributor

Might be outside of the scope of this cleanup PR though.

We'll need Extend function for this...

@Eric-Warehime Eric-Warehime force-pushed the remove-unused-phonebook-method branch from 46900ad to afacc28 Compare July 31, 2023 21:45
winder
winder previously approved these changes Aug 1, 2023
Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

Seems fine.

@cce
Copy link
Contributor

cce commented Aug 2, 2023

PR description no longer matches content but otherwise LGTM

network/wsNetwork.go Outdated Show resolved Hide resolved
@algorandskiy algorandskiy changed the title chore: Remove unused phonebook method phonebook: extend pre-set phonebook entries with SRV, not replace them Aug 2, 2023
iansuvak
iansuvak previously approved these changes Aug 2, 2023
@jsgranados jsgranados added the p2p Work related to the p2p project label Aug 3, 2023
winder
winder previously approved these changes Aug 4, 2023
Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

Blocking this, looks like folks think it should use replace logic with preserving seeded entries.

@Eric-Warehime
Copy link
Contributor Author

Blocking this, looks like folks think it should use replace logic with preserving seeded entries.

That sounds like it should be done in a separate PR, but if we can't merge this without it then I can add it here.

@algorandskiy
Copy link
Contributor

That sounds like it should be done in a separate PR, but if we can't merge this without it then I can add it here.

If we merge as is then dead relays could appear be in phonebook, not end of the world but still. This PR is just 5 LoC and the new fix will touch the same code, so I suggest to fix it right here.

@Eric-Warehime Eric-Warehime changed the title phonebook: extend pre-set phonebook entries with SRV, not replace them phonebook: Persist initial phonebook peers; remove unused ExtendPeerList Aug 7, 2023
Copy link
Contributor

@iansuvak iansuvak left a comment

Choose a reason for hiding this comment

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

LGTM -- I like the property based testing

@algorandskiy algorandskiy merged commit 865e0d5 into algorand:master Aug 8, 2023
19 checks passed
@Eric-Warehime Eric-Warehime deleted the remove-unused-phonebook-method branch August 8, 2023 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement p2p Work related to the p2p project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetch bootstrap peers from dnsaddr records
6 participants