reth icon indicating copy to clipboard operation
reth copied to clipboard

feat(net): update peer records in the network peerset

Open mempirate opened this issue 2 years ago • 4 comments

Closes #1415

To Do

  • [x] Keep more descriptive records of discovered peers in Discovery peerset
  • [x] Add heartbeat to Discovery for 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 PeersManager to manage these events
  • [ ] Tests

Questions

  • Since we essentially mimic the bond expiration functionality in Discovery, should we remove it from Discv4?

mempirate avatar Jun 09 '23 08:06 mempirate

Codecov Report

Merging #3076 (2ed3016) into main (e4c1789) will decrease coverage by 0.07%. The diff coverage is 14.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:

... and 7 files with indirect coverage changes

codecov[bot] avatar Jun 09 '23 09:06 codecov[bot]

@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.

mempirate avatar Jun 09 '23 11:06 mempirate

@jonasbostoen hey - any plans / next steps for this PR? How can we help?

gakonst avatar Jun 17 '23 03:06 gakonst

@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.

mempirate avatar Jun 20 '23 07:06 mempirate

gm - just circling back, did you have a chance to compare w/ geth behavior?

gakonst avatar Jul 03 '23 12:07 gakonst

taking this on thx @jonasbostoen

mattsse avatar Jul 13 '23 12:07 mattsse