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

swarm/network, swarm/pss, p2p/simulations: adapt test kademlia params #1022

Closed
wants to merge 8 commits into from

Conversation

acud
Copy link
Member

@acud acud commented Nov 28, 2018

This PR addresses an incorrect node setup on certain simulations, in which the Reachable function in the Kademlia was not called at all. This resulted in tests flaking due to peer dialups not being sanctioned correctly.

Similar tests that use ServiceContext on setup have been amended to correctly reference the correct Reachable function pointer from the ServiceContext.

fixes #994

@zelig
Copy link
Member

zelig commented Nov 28, 2018

@acud acud force-pushed the fix-wait-healthy branch 2 times, most recently from 977f5f9 to 718622b Compare November 28, 2018 17:35
@zelig
Copy link
Member

zelig commented Nov 29, 2018

otherwise LGTM

@acud
Copy link
Member Author

acud commented Nov 30, 2018

@zelig that did it. now, I understand that conceptually this if statement should be in the discovery test (i had a weird feeling seeing it there in the first place). what I don't get is why it was failing.

@zelig
Copy link
Member

zelig commented Nov 30, 2018

@justelad should 'unskipping' those simulation tests that use waitTillHealthy not be part of this PR?

@zelig zelig mentioned this pull request Dec 2, 2018
51 tasks
conn.Up = false
conn.initiated = time.Now().Add(-DialBanTimeout)
conn.wasInitiated = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it now correct to "allow" disconnection of a disconnected node?

if err != nil {
log.Trace("net.InitConn returned an error", "err", err)
r := rand.New(rand.NewSource(time.Now().UnixNano()))
t := time.Duration(time.Duration(r.Intn(200)) * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

I read this as skewing of time offsets in case nodes try to connect simultaneously? Is this actually a solution to the problem?

default:
r := rand.New(rand.NewSource(time.Now().Unix()))
timeToSleep := time.Duration(200 + int64(r.Intn(200)))
time.Sleep(timeToSleep * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a parameter not literal 200?

copy(enode[:], e.BzzAddr.Over())
if !k.Reachable(enode) {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
t := time.Duration(time.Duration(r.Intn(400)) * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about all these literals, amigo...

@acud acud added on hold meta metaissues describing a label and removed ready for review labels Dec 5, 2018
@acud acud closed this Dec 11, 2018
@acud acud deleted the fix-wait-healthy branch January 16, 2019 13:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug meta metaissues describing a label on hold push-sync test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rehabilitate WaitTillHealthy for correct kademlia depth
3 participants