Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swarm/network: hive bug: needed shallow peers are not sent to nodes beyond connection's proximity order #19274

Closed
wants to merge 38 commits into from

Conversation

holisticode
Copy link
Contributor

@holisticode holisticode commented Mar 15, 2019

The current swarm hive would in some occasions not connect to peers in shallow bins causing unhealthy connectivity
The reason is that needed shallow peers are not sent to nodes beyond connection's proximity order.
The initial response to subPeersMsg needs to be modified to allow enumeration of peers up to the advertised depth not the connection PO.

This PR introduces a fix to this bug

@holisticode holisticode self-assigned this Mar 15, 2019
@holisticode holisticode requested review from zelig and nolash March 15, 2019 04:05
@frncmx
Copy link
Contributor

frncmx commented Mar 15, 2019

Would it be possible to cover this fix with a test what would fail without the fix?

handleSubPeersMsg has 0% coverage as I see. Also it's used only in Peer.HandleMsg; that's the public interface. So, how hard would it be to test through HandleMsg?

@zelig
Copy link
Contributor

zelig commented Mar 17, 2019

@frncmx I agree we need to improve test coverage. handleSubPeersMsg is only tested through swarm/network/simulations/discovery/ and swarm/network_test

@skylenet skylenet added this to the 1.9.0 milestone Mar 18, 2019
@frncmx
Copy link
Contributor

frncmx commented Mar 18, 2019

@zelig Ideally I would say that unit tests providing "good" coverage should be present in swarm/network/discovery_test.go. So when I navigate to the test file belonging to the file I want to change; I can run tests with coverage in my IDEA and immediately see if I'm operating in a safe area.

I this specific case though, I also run tests in both mentioned packages. However either we don't have coverage or my IDE is not smart enough to backtrack the results.

Anyhow - for now - this was not a blocking comment on my side. Just be aware the danger of changing stuff without tests.

@acud
Copy link
Member

acud commented Mar 20, 2019

I'd be happy to see a coveralls job to see constantly where we go with code coverage.
Alternatively we could add another travis job that creates a cover profile with the according html then pushes it onto swarm and refs the content from the travis job somehow. Just an idea.

@zelig zelig changed the title swarm/network:fix depth 0 bug swarm/network: hive bug: needed shallow peers are not sent to nodes beyond connection's proximity order Mar 20, 2019
@holisticode holisticode force-pushed the suggest-close-peers branch from 348b548 to cf91181 Compare March 20, 2019 22:32
swarm/network/discovery.go Outdated Show resolved Hide resolved
swarm/network/discovery_test.go Outdated Show resolved Hide resolved
swarm/network/discovery_test.go Outdated Show resolved Hide resolved
swarm/network/discovery_test.go Show resolved Hide resolved
rjl493456442 and others added 14 commits March 21, 2019 12:24
* dashboard: fix github alerts

* dashboard: run go generate
* contracts/ens: update public resolver solidity code

* contracts/ens: update public resolver, update go bindings

* update build

* fix ens.sol

* contracts/ens: change contract interface

* contracts/ens: implement public resolver changes

* contracts/ens: added ENSRegistry contract

* contracts/ens: reinstate old contract code

* contracts/ens: update README.md

* contracts/ens: added test coverage for fallback contract

* contracts/ens: added support for fallback contract

* contracts/ens: removed unused contract code

* contracts/ens: add todo and decode multicodec stub

* add encode

* vendor: add ipfs cid libraries

* contracts/ens: cid sanity tests

* contracts/ens: more cid sanity checks

* contracts/ens: wip integration

* wip

* Revert "vendor: add ipfs cid libraries"

This reverts commit 29d9b6b.

* contracts/ens: removed multiformats dependencies

* contracts/ens: added decode tests

* contracts/ens: added eip spec test, minor changes to exiting tests

* contracts/ens: moved cid decoding to own file

* contracts/ens: added unit test to encode hash to content hash

* contracts/ens: removed unused code

* contracts/ens: fix ens tests to use cid decode and encode

* contracts/ens: adjust swarm multicodecs after pr merge

* contracts/ens: fix linter error

* constracts/ens: address PR comments

* cmd, contracts: make peoples lives easier

* contracts/ens: fix linter error

* contracts/ens: address PR comments
* les: fixed peer id format

* les: fixed peer reply error handling
Copy link
Contributor

@zelig zelig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • not sure why you rebased on @nolash PR, this delays
  • Also we said you would change tester to accept overlay so that we can generate hive connection before tester call yet already know the trigger peer overlay
  • we said you make it a repeated test
  • registerBzzAddr calls are still after tester call that makes test flaky

swarm/network/discovery_test.go Outdated Show resolved Hide resolved
swarm/network/discovery_test.go Outdated Show resolved Hide resolved
swarm/network/discovery_test.go Show resolved Hide resolved
func newDiscPeer(bzzAddr *BzzAddr, name string, hive *Hive) *Peer {
p2pPeer := p2p.NewPeer(adapters.RandomNodeConfig().ID, name, nil)
return NewPeer(&BzzPeer{
Peer: protocols.NewPeer(p2pPeer, &dummyMsgRW{}, DiscoverySpec),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add nil for 2nd arg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, that doesn't work, on hive.Stop() this will produce a null pointer dereference

@nolash
Copy link
Contributor

nolash commented Mar 22, 2019

not sure why you rebased on @nolash PR, this delays

That's my fault. Sorry.

@zelig
Copy link
Contributor

zelig commented Mar 22, 2019

That's my fault. Sorry.

no actually your PR will be merged today it seems

@zelig
Copy link
Contributor

zelig commented Apr 2, 2019

obsoleted by #19326

@zelig zelig closed this Apr 2, 2019
@holisticode holisticode deleted the suggest-close-peers branch September 2, 2019 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.