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

Handle receiving a Pong with changed NodeID #5452

Merged
merged 6 commits into from Mar 18, 2019
Merged

Handle receiving a Pong with changed NodeID #5452

merged 6 commits into from Mar 18, 2019

Conversation

gumb0
Copy link
Member

@gumb0 gumb0 commented Jan 24, 2019

Fixes #5431

@codecov-io
Copy link

codecov-io commented Mar 12, 2019

Codecov Report

Merging #5452 into master will increase coverage by 0.04%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5452      +/-   ##
==========================================
+ Coverage   61.83%   61.88%   +0.04%     
==========================================
  Files         345      345              
  Lines       28745    28784      +39     
  Branches     3261     3263       +2     
==========================================
+ Hits        17775    17813      +38     
- Misses       9812     9816       +4     
+ Partials     1158     1155       -3

@gumb0
Copy link
Member Author

gumb0 commented Mar 12, 2019

findNodeIsSentAfterPong test fails intermittently, hopefully that will be fixed by @halfalicious PR #5502

Windows build timed out

@gumb0
Copy link
Member Author

gumb0 commented Mar 14, 2019

Rebased, please review @chfast @halfalicious

libp2p/NodeTable.h Outdated Show resolved Hide resolved
@@ -177,15 +177,25 @@ class NodeTable : UDPSocketEvents
// protected only for derived classes in tests
protected:
/**
* NodeValidation is used to record Pinged node's endpoint, the timepoint of sent PING,
* NodeValidation is used to record Pinged node's ID, the timepoint of sent PING,
Copy link
Contributor

Choose a reason for hiding this comment

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

"the timepoint of sent PING" and "time of sending" is redundant

@@ -322,7 +322,7 @@ void NodeTable::ping(Node const& _node, shared_ptr<NodeEntry> _replacementNodeEn
return;

// Don't sent Ping if one is already sent
Copy link
Contributor

Choose a reason for hiding this comment

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

Not your changes, but minor grammar issue (1st sent should be send)

libp2p/NodeTable.h Outdated Show resolved Hide resolved
libp2p/NodeTable.h Show resolved Hide resolved
test/unittests/libp2p/net.cpp Outdated Show resolved Hide resolved
test/unittests/libp2p/net.cpp Outdated Show resolved Hide resolved
test/unittests/libp2p/net.cpp Show resolved Hide resolved

BOOST_REQUIRE(nodeTable->nodeExists(newNodeKeyPair.pub()));
auto addedNode = nodeTable->nodeEntry(newNodePubKey);
BOOST_CHECK(addedNode->lastPongReceivedTime > 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this (and the rest of the BOOST_CHECKs in this test case) be BOOST_REQUIRE? Or is the reasoning that if the checks failed other tests would fail (in which case is there value in having the checks at all)?

Copy link
Member Author

Choose a reason for hiding this comment

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

The reasoning is that updating the node in the node table, updating m_sentPings and removing the old node are kind of independent pieces of code, and if one fails, we can still get some useful info about whether other ones work

Copy link
Contributor

Choose a reason for hiding this comment

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

The reasoning is that updating the node in the node table, updating m_sentPings and removing the old node are kind of independent pieces of code, and if one fails, we can still get some useful info about whether other ones work

Yes, but I think the checks will only provide value when you do a local run (let me know if I'm wrong here)? The problem is that failed boost_checks don't trigger test failures and boost_require triggers a test failure and ceases test execution and the boost_checks are all after a boost_require, meaning that if the boost_require fails the subsequent boost_checks won't be executed, and if the boost_require passes the boost_checks might fail but won't trigger a test failure (so we won't know to look at the logs)? Also, do boost_check failures show up in CircleCI logs even if the tests themselves passed?

Can we place the boost_checks before the boost_require?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe BOOST_CHECK failures always show up in logs.

test/unittests/libp2p/net.cpp Outdated Show resolved Hide resolved
@gumb0
Copy link
Member Author

gumb0 commented Mar 15, 2019

@halfalicious Thank you for the review, all comments addressed

uint16_t tcpPort = 0;
// Time we sent Ping - used to handle timeouts
TimePoint pingSendTime;
Copy link
Contributor

Choose a reason for hiding this comment

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

(Nit) I think this should be called pingSentTime (since it's referring to a past event)

@halfalicious
Copy link
Contributor

Approved, remaining issues aren't blockers

@gumb0 gumb0 merged commit ae042a3 into master Mar 18, 2019
@gumb0 gumb0 deleted the pong-changed-id branch March 18, 2019 15:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants