perlin-network / noise

A decentralized P2P networking stack written in Go.
https://godoc.org/github.com/perlin-network/noise
MIT License
1.78k stars 213 forks source link

gossip: initial impl of gossip package #272

Closed iwasaki-kenta closed 4 years ago

iwasaki-kenta commented 4 years ago

This implements a naive gossiping protocol on top of Noise.

The communication complexity through unit tests roughly approximates to O(n^2) messages being sent out in total. A random exponential delay before emitting out the next round of gossip further reduces the number of rounds and messages sent.

Initial implementation used bloom filters for caching, which was then switched to dgraph-io/ristretto, which was then switched to VictoriaMetrics/fastcache with an in-memory cache size of 32mb.

codecov[bot] commented 4 years ago

Codecov Report

Merging #272 into master will increase coverage by 0.35%. The diff coverage is 83.6%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #272      +/-   ##
==========================================
+ Coverage   69.87%   70.22%   +0.35%     
==========================================
  Files          19       22       +3     
  Lines        1185     1246      +61     
==========================================
+ Hits          828      875      +47     
- Misses        261      269       +8     
- Partials       96      102       +6
Impacted Files Coverage Δ
kademlia/protocol.go 60% <ø> (ø) :arrow_up:
gossip/msg.go 100% <100%> (ø)
gossip/events.go 100% <100%> (ø)
gossip/protocol.go 81.48% <81.48%> (ø)
client.go 64.45% <0%> (-1.57%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 668f664...575d6d0. Read the comment docs.