Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

swarm/network: Refactor peer suggestion engine #1073

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ca7c13b
swarm/pss: forwarding function refactoring (#18353)
gluk256 Dec 21, 2018
064e72f
swarm/network: Revised depth calculation with tests
nolash Dec 12, 2018
a1db6ca
swarm/network: WIP remove redundant "full" function
nolash Dec 12, 2018
be6ded9
swarm/network: WIP peerpot refactor
nolash Dec 14, 2018
d3885dd
swarm/network: Make test methods submethod of peerpot and embed kad
nolash Dec 14, 2018
bd70cc7
swarm/network: Remove commented out code
nolash Dec 14, 2018
c332482
swarm/network: Rename health test functions
nolash Dec 14, 2018
2370532
swarm/network: Too many n's
nolash Dec 14, 2018
bdbbb83
swarm/network: Change hive Healthy func to accept addresses
nolash Dec 17, 2018
55bdd3d
swarm/network: Add Healthy proxy method for api in hive
nolash Dec 17, 2018
1f2edfb
swarm/network: Skip failing test out of scope for PR
nolash Dec 17, 2018
ff3dabf
swarm/network: Skip all tests dependent on SuggestPeers
nolash Dec 17, 2018
b7d9e51
swarm/network: Remove commented code and useless kad Pof member
nolash Dec 17, 2018
e28a789
swarm/network: Remove more unused code, add counter on depth test errors
nolash Dec 17, 2018
c735ad3
swarm/network: WIP Create Healthy assertion tests
nolash Dec 17, 2018
306640b
swarm/network: Roll back health related methods receiver change
nolash Dec 17, 2018
8f59376
swarm/network: Hardwire network minproxbinsize in swarm sim
nolash Dec 17, 2018
d309a8d
swarm/network: Rework Health test to strict
nolash Dec 17, 2018
e6da789
swarm/network: Skip discovery tests (dependent on SuggestPeer)
nolash Dec 17, 2018
e60cc34
swarm/network: Remove useless minProxBinSize in stream
nolash Dec 18, 2018
e0b9f40
swarm/network: Remove unnecessary testing.T param to assert health
nolash Dec 19, 2018
ec2d5e3
swarm/network: Implement t.Helper() in checkHealth
nolash Dec 19, 2018
a7531d3
swarm/network: Rename check back to assert now that we have helper magic
nolash Dec 19, 2018
ce8de34
swarm/network: Revert WaitTillHealthy change (deferred to nxt PR)
nolash Dec 20, 2018
22096cc
swarm/network: Kademlia tests GotNN => ConnectNN
nolash Dec 20, 2018
43de85e
swarm/network: Renames and comments
nolash Dec 20, 2018
bd3ad21
swarm/network: Add comments
nolash Dec 21, 2018
f1b143b
swarm/network: Make minproxbinsize constant throughout simulation
nolash Dec 20, 2018
2c35a8f
swarm/network: Add evaluation of potential conncetions in health testing
nolash Dec 18, 2018
200bfdf
swarm/network: Add comment to new connectedPotential function
nolash Dec 18, 2018
de57c00
swarm/network: Rename Got to Connect
nolash Dec 18, 2018
eba2613
swarm/network: Finish basic test cases for potent
nolash Dec 19, 2018
a627947
swarm/network: Cherrypick saturation, potency test adds from wrong br…
nolash Dec 19, 2018
b5cb505
swarm/network: Use assert and t helper on all health tests
nolash Dec 19, 2018
72dae51
swarm/network: Cleanup after rebase on upstream cosmetic changes
nolash Dec 20, 2018
d0d6a41
swarm/network: Add evaluation of potential conncetions in health testing
nolash Dec 18, 2018
c1129ff
swarm/network: Remove reachable, maxpeers + add simple peer verify in…
nolash Dec 20, 2018
d9f81ee
swarm/network: WIP rebase on upstream cosmetics
nolash Dec 20, 2018
7f353d5
swarm/network: Last rebase fix after cosmetics
nolash Dec 20, 2018
5810e65
swarm/network: Add Connected/Known test lost after rebasing
nolash Dec 20, 2018
6c75f1b
swarm/network: WIP connection driver related components from kad to hive
nolash Dec 21, 2018
5ce60da
swarm/network: Factor out peers table, decompose suggest peer parts
nolash Dec 21, 2018
592bb4d
swarm/network: Correct upper iteration abstraction for callable peers
nolash Dec 21, 2018
2f83537
swarm/network: Add topmost aggregator for peer suggestion
nolash Dec 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
swarm/network: Cleanup after rebase on upstream cosmetic changes
  • Loading branch information
nolash committed Dec 21, 2018
commit 72dae514521420a365ee8a24631f1cc9b08dafbb
18 changes: 10 additions & 8 deletions swarm/network/kademlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,8 @@ type Health struct {
ConnectNN bool // whether node is connected to all its neighbours
CountConnectNN int // amount of neighbours connected to
MissingConnectNN [][]byte // which neighbours we should have been connected to but we're not
Saturated bool // whether we are connected to all the peers we would have liked to
Potent bool // whether we are connected a mininum of peers for bins we know of peers
Saturation int // whether we are connected to all the peers we would have liked to
Hive string
}

Expand All @@ -819,20 +820,21 @@ type Health struct {
func (k *Kademlia) Healthy(pp *PeerPot) *Health {
k.lock.RLock()
defer k.lock.RUnlock()
connectnn, countconnectnn, culpritsconnectnn := k.connectedNeighbours(pp.NNSet)
knownn, countknownn, culpritsknownn := k.knowNeighbours(pp.NNSet)
connectnn, countconnectnn, missingconnectnn := k.connectedNeighbours(pp.NNSet)
knownn, countknownn, missingknownn := k.knowNeighbours(pp.NNSet)
impotentBins := k.connectedPotential()
saturation := k.saturation()
log.Trace(fmt.Sprintf("%08x: healthy: knowNNs: %v, connectNNs: %v, saturated: %v\n", k.base, knownn, connectnn, saturation))
potent := countknownn == 0 || len(impotentBins) == 0
return &Health{
KnowNN: knownn,
CountKnowNN: countknownn,
MissingKnowNN: culpritsknownn,
ConnectNN: gotnn,
CountConnectNN: countgotnn,
MissingConnectNN: culpritsgotnn,
Saturated: saturated,
MissingKnowNN: missingknownn,
ConnectNN: connectnn,
CountConnectNN: countconnectnn,
MissingConnectNN: missingconnectnn,
Potent: potent,
Saturation: saturation,
Hive: k.string(),
}
}
2 changes: 1 addition & 1 deletion swarm/network/kademlia_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ func TestKademliaHiveString(t *testing.T) {
Register(k, "10000000", "10000001")
k.MaxProxDisplay = 8
h := k.String()
expH := "\n=========================================================================\nMon Feb 27 12:10:28 UTC 2017 KΛÐΞMLIΛ hive: queen's address: 000000\npopulation: 2 (4), MinProxBinSize: 2, MinBinSize: 1, MaxBinSize: 4\n============ DEPTH: 0 ==========================================\n000 0 | 2 8100 (0) 8000 (0)\n001 1 4000 | 1 4000 (0)\n002 1 2000 | 1 2000 (0)\n003 0 | 0\n004 0 | 0\n005 0 | 0\n006 0 | 0\n007 0 | 0\n========================================================================="
expH := "\n=========================================================================\nMon Feb 27 12:10:28 UTC 2017 KΛÐΞMLIΛ hive: queen's address: 000000\npopulation: 2 (4), MinProxBinSize: 2, MinBinSize: 2, MaxBinSize: 4\n============ DEPTH: 0 ==========================================\n000 0 | 2 8100 (0) 8000 (0)\n001 1 4000 | 1 4000 (0)\n002 1 2000 | 1 2000 (0)\n003 0 | 0\n004 0 | 0\n005 0 | 0\n006 0 | 0\n007 0 | 0\n========================================================================="
if expH[104:] != h[104:] {
t.Fatalf("incorrect hive output. expected %v, got %v", expH, h)
}
Expand Down