feat(net): update peer records in the network peerset
Closes #1415
To Do
- [x] Keep more descriptive records of discovered peers in
Discoverypeerset - [x] Add heartbeat to
Discoveryfor checking bond durations - [x] Add commands to discv4 to poll peer for updates (just calls discv4
Ping) - [ ] Add events to notify of discovery changes
- [ ] Add event handlers to
PeersManagerto manage these events - [ ] Tests
Questions
- Since we essentially mimic the bond expiration functionality in
Discovery, should we remove it fromDiscv4?
Codecov Report
Merging #3076 (2ed3016) into main (e4c1789) will decrease coverage by
0.07%. The diff coverage is14.03%.
@@ Coverage Diff @@
## main #3076 +/- ##
==========================================
- Coverage 70.76% 70.70% -0.07%
==========================================
Files 523 523
Lines 68491 68543 +52
==========================================
- Hits 48468 48462 -6
- Misses 20023 20081 +58
| Flag | Coverage Δ | |
|---|---|---|
| integration-tests | 16.98% <12.28%> (-0.02%) |
:arrow_down: |
| unit-tests | 65.69% <14.03%> (-0.05%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| crates/net/discv4/src/lib.rs | 64.39% <0.00%> (-0.37%) |
:arrow_down: |
| crates/net/network/src/discovery.rs | 47.48% <17.02%> (-9.56%) |
:arrow_down: |
@mattsse for point 1, this should be fine as the ping checks should go through wether the node is in the table or not. If it wasn't in the table, we notify with an Expired event
For point 2, you're right. Will take a look at how geth does it.
@jonasbostoen hey - any plans / next steps for this PR? How can we help?
@gakonst I quickly checked how geth does it and it looks like they only run checks for peers in the kademlia DHT as well (same as reth). I'll double check with someone from the geth team if I can reach them. The only difference is that they have a peer DB, whereas reth stores everything in memory. Currently working on some other stuff but will circle back to this.
gm - just circling back, did you have a chance to compare w/ geth behavior?
taking this on thx @jonasbostoen