This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
standalone libp2p-peerbook integration #265
Open
andymck
wants to merge
37
commits into
master
Choose a base branch
from
andymck/use-peerbook-in-libp2p
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andymck
force-pushed
the
andymck/use-peerbook-in-libp2p
branch
from
March 25, 2020 16:02
27c81d8
to
f19d394
Compare
peerbook registration via callback support and tidy up handle removed peers in gossip handle removed peers in relay added support for eligable peers. tidy up tidy up refix sort peers during init fix peerbook sup reg name. Point to latest libp2p peerbook bump libp2p_peerbook
andymck
force-pushed
the
andymck/use-peerbook-in-libp2p
branch
from
March 25, 2020 17:15
a661178
to
6baf501
Compare
Codecov Report
@@ Coverage Diff @@
## master #265 +/- ##
==========================================
- Coverage 73.83% 72.95% -0.88%
==========================================
Files 64 65 +1
Lines 3780 3476 -304
==========================================
- Hits 2791 2536 -255
+ Misses 989 940 -49
Continue to review full report at Codecov.
|
andymck
changed the title
initial pass at libp2p-peerbook integration
standalone libp2p-peerbook integration
Apr 1, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linked PRs:
blockchain_core: helium/blockchain-core#413
libp2p_peerbook: novalabsxyz/libp2p-peerbook#2
Test Miner PR runs which incorporates the erlang-libp2p, libp2p_peerbook and blockchain_core PRs:
helium/miner#357
This replaces the libp2p_peerbook integrated within erlang libp2p with the new standalone libp2p_peerbook library.
Other than updating relevant calls to point to the new library, some points to note:
Standalone libp2p_peerbook will now register its handle as part of its init with erlang-libp2p. As such even if the peerbook crashes and restarts, erlang-libp2p will always have the latest and correct handle
The erlang-libp2p swarm TID is now just the swarm name as the ETS table is now using 'named_table'. This gives more flexibility, basically as long as a process knows the swarm name, it can access the ETS data. Whilst the code does not require a named table and will work without it, it opens up opportunities to cleanup some code which I will address later.
Eligible peer capability is now mostly handled outside of libp2p_peerbook and in erlang-libp2p's
libp2p_peer_add_gossip
module.libp2p_peer_resolution now plays home to various helper modules which used to exist in libp2p_peer such as is_dialable, is_public_ip, is_private_ip and a few others. This module seemed the best place for these...
The peerbook is under its own supervisor which itself is a child of the swarm supervisor. This gives the peerbook the ability to restart within taking down other swarm processes ( unless the peerbook restart strategy is breached )
Only valid listen addrs will reach the peerbook. If the addr is not valid it will not get registered
NOTE: to get all tests passing reliably I have had to tweak various wait_until timings and also play with the notify and peer timer configs. Some of this was surely to counter generally inconsistent and time sensitive tests but I cant rule out something at the code level which I may have missed and which could be leading to a difference in updates from the peerbook.