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

Handle receiving a Pong with changed NodeID - #5452

Merged
gumb0 merged 6 commits into
masterfrom
pong-changed-id
Mar 18, 2019
Merged

gumb0 merged 6 commits into
masterfrom
pong-changed-id

Conversation

@gumb0

@gumb0 gumb0 commented Jan 24, 2019

Copy link
Copy Markdown
Member

Fixes #5431

@gumb0
gumb0 force-pushed the pong-changed-id branch from d6a4c37 to 45f73d3 Compare March 11, 2019 14:29
Comment thread libp2p/NodeTable.h
@gumb0
gumb0 requested review from chfast and halfalicious March 12, 2019 14:38
@gumb0 gumb0 removed the in progress label Mar 12, 2019
@codecov-io

codecov-io commented Mar 12, 2019

Copy link
Copy Markdown

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

gumb0 commented Mar 12, 2019

Copy link
Copy Markdown
Member Author

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

Windows build timed out

@gumb0
gumb0 force-pushed the pong-changed-id branch from fe2eaab to 85952c9 Compare March 14, 2019 15:52
@gumb0

gumb0 commented Mar 14, 2019

Copy link
Copy Markdown
Member Author

Rebased, please review @chfast @halfalicious

Comment thread libp2p/NodeTable.h Outdated
Comment thread libp2p/NodeTable.h Outdated
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
Copy Markdown
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

Comment thread libp2p/NodeTable.cpp Outdated
@@ -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
Copy Markdown
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)

Comment thread libp2p/NodeTable.h Outdated
Comment thread libp2p/NodeTable.h
Comment thread test/unittests/libp2p/net.cpp Outdated
Comment thread test/unittests/libp2p/net.cpp Outdated
Comment thread test/unittests/libp2p/net.cpp

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

@halfalicious halfalicious Mar 15, 2019

Copy link
Copy Markdown
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
Copy Markdown
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

@halfalicious halfalicious Mar 16, 2019

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread test/unittests/libp2p/net.cpp Outdated
@gumb0

gumb0 commented Mar 15, 2019

Copy link
Copy Markdown
Member Author

@halfalicious Thank you for the review, all comments addressed

Comment thread libp2p/NodeTable.h Outdated
// (answers with Pong), then it will be added to the bucket of the node table
uint16_t tcpPort = 0;
// Time we sent Ping - used to handle timeouts
TimePoint pingSendTime;

Copy link
Copy Markdown
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
Copy Markdown
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.

4 participants