Repository navigation
test: Remove unused classes from p2p_leak.py - #19727
Conversation
|
Concept ACK. Thanks @dhruv . I'll review soon. |
Thank you for the warm welcome and review, @adamjonas. I am excited to be here. |
There was a problem hiding this comment.
Concept ACK! Welcome Dhruv :D
I was heavy-handed with the nits because I wanted to give as much feedback as possible (please forgive me). Mostly, I think you should have a clear distinction between nodes and mininodes in your naming and comments.
bitcoind nodes (i.e. TestNodes) = I would call them "nodes"
Mininodes = not bitcoind nodes, they just implement the P2P interface. So I'd prefer to call them "peers"
Also left a few food-for-thought questions about synchronization.
A node is a peer, a peer can be a node, a peer is not a beer 🍻 |
Oops ya that looks wrong out of context. I meant we shouldn't call mininodes nodes, and "peer" is what I recommend as a better name. I edited my comment thank you @promag 🥂 |
jnewbery
left a comment
There was a problem hiding this comment.
Looks good @dhruv . Thanks for your contribution! I've left a couple of comments inline.
You should also make a couple of small changes to the commit logs. The summary line should be in the indicative mood (ie "remove CNodeNoVersionMisbehaving" instead of "removing CNodeNoVersionMisbehaving"), and all lines should be wrapped at 80 chars (see https://chris.beams.io/posts/git-commit/ for some tips on writing commit logs).
|
@jnewbery Comments addressed. I also increased a |
|
The test is now failing on a different architecture but passing on the one it failed at the last time (before raising the timeout) which I think confirms that it's a Travis CI timeout issue. However, I feel uncertain that just continuing to raise the timeout to reduce test fragility is the path forward. I'm looking for guidance from more experienced contributors. |
There was a problem hiding this comment.
concept ACK! welcome! 🎈
- I've figured out the root cause of the sporadic test failure. in order to suggest a fix I want to better understand the intention of the
wait_until...bytesrecv_per_msgassertion.
I'm also hoping to help you figure out the root cause of the failure yourself. Two big hints from my debugging process:
- Running it locally on repeat & seeing that even if I decrease the timeout to 0.1, I wasn't able to get (even a sporadic) failure.
- Reading the failure logs on Travis, and seeing that the node received all the ping messages, disconnected the peer, and then later is failing the
bytesrecv_per_msgcondition. Why could that be?
Incase you haven't seen it, ./combine_logs is a very helpful tool for introspecting on what's going on during tests. You could try comparing the logs from the failure to the logs you see in your ordinary success cases.
other meta notes:
-
no need to refer to review comments in your commit messages. the context is best left for github convo & the commit messages focused on the code changes :) its fine for the message to just be 1 line when the commit seems self explanatory.
-
I think two of these commits (removing C prefix & distinguishing nodes from peers) can probably be done via a scripted diff.
There was a problem hiding this comment.
is there a reason this is a wait_until? won't this peer start with ever_connected as false & here we want to check that it is still false?
There was a problem hiding this comment.
The peer does start with ever_connected set to False. Then, if I understand things correctly, when the tcp connection is established, mininode.py::P2PConnection::connection_made() will invoke p2p_leak.py::LazyPeer::on_open() which will set no_version_disconnect_peer.ever_connected to True. So I think this wait_until is waiting for the transport connection to be established prior to generating a block below. This way it can verify that the peers do not receive leaked information despite an established tcp connection, and not because of connection problems.
Am I missing something?
There was a problem hiding this comment.
oh I'm sorry, I mixed up true and false 😅
yes this makes sense- we want to check that ever_connected has been switched to true, and allow some buffer time for that to occur.
|
Thanks for the great review, @amitiuttarwar. I appreciate you taking the time to teach me with hints rather than giving out the answer. I've removed the assertion and made the changes to the commit messages. I had some trouble running |
b84919a to
54ebddd
Compare
|
Concept ACK Warm welcome as a contributor @dhruv! Hope to see more contributions from you in the future :) |
jnewbery
left a comment
There was a problem hiding this comment.
Looks good. One comment inline.
I think the last two commits can be squashed. No need to rename classes in one commit and then rename them again in a subsequent commit!
|
@jnewbery commits squashed |
jnewbery
left a comment
There was a problem hiding this comment.
Final code looks good, but something's gone askew with the commits. See comment inline.
When you squash or fixup commits, there's no need to rebase on the lastest master. That makes things a bit more difficult for reviewers, because they can't easily compare what's changed.
It's also clearer to have `no_version_disconnect_node` send a message other than version or verack in order to reach the peer discouragement threshold.
…_leak.py Also, remove "C" prefix from class names to match new style
|
tested ACK ed5cd12 |
|
utACK ed5cd12 |
Summary: > test: remove `CNodeNoVersionMisbehavior` from p2p_leak.py > > It's also clearer to have `no_version_disconnect_node` send a message > other than version or verack in order to reach the peer discouragement > threshold. > test: remove `CNodeNoVersionIdle` from p2p_leak.py > test: Distinguish between nodes(bitcoind) and peers(mininodes) in p2p_leak.py > > Also, remove "C" prefix from class names to match new style This is a backport of [[bitcoin/bitcoin#19727 | core#19727]] Test Plan: `ninja check-functional` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10117
CNodeNoVersionMisbehaviorper recommendation at test: Wait until is_connected in add_p2p_connection #19657 (comment)CNodeNoVersionIdlebecause it is similarly unnecessaryno_version_disconnect_nodetries to overwhelm the peer with any message that is not version/verack.