-
Notifications
You must be signed in to change notification settings - Fork 38.8k
test: msg_mempool, fRelay, and other bloomfilter tests #19083
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
jnewbery
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK. I think you can probably merge all the tests for bloom filters enabled and disabled into a single test file.
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
jnewbery
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few comments inline.
|
nit: commit f78730d582c605882e5a3bf554aefb1a92942b0e can be done as a scripted diff, but no big deal |
|
Resolves #18473 . Ready for Review again! |
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 1e64440490 looks like an improvement, but I have some nits to consider 🍬
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK 1e64440490 looks like an improvement, but I have some nits to consider 🍬
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUiqqQv9HPT78+tE2ecU5neOV9/iItDomZZ3+dJ/+1clX3pZNzJ7k0Qh/Cr3DBU+
Eh4zIS0D1ooVyxknFMhGziukNAmlzYAFW1lSytCwEMCxZhJ4Nujlq3dp/aaQ5FoH
j1D2zvTe4QEKvysqTqHafJQ0iuxYoXzO2TXs5io6923GpxLHwndOiozkNUkLd9TA
2W2XwhO/k7Uu0r0SCBFmSyZmb93Jus8h118q0Dskg7uM8FBJ/FuPS6xvIUWpn21h
3etYU0+9E8ncRJ6SXTU4bKcPsHbJrpjo3hzGghhJLlz1+ywJzSiF2TVumFilgMyU
+MwS/Yvm+vwuTQwFOzIzAQfQYdm1Dh0JOcy52Uob1keytZV/K3opDS3MrlvlPxIC
4ZKMuT/JclX9UkKzIu/ppQ6O57PbhJAcZyXBs4JrQ896rLccsYSGO3K1jQgijrEA
lZQhSVPm2Y0/cHMrgr9/QcZKk+Ffyvz89HgThyrvmNJNdGCLhuPnoWlQMwjhpviq
akjJhYf+
=Pmtq
-----END PGP SIGNATURE-----
Timestamp of file with hash 88b89b80c24192ef59fea53c027a40ed6e6fe7c8d6795036ca7991f3fb4d7971 -
f709a14 to
b758749
Compare
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK b758749173
-msg_mempool is currently only tested with bloomfilter disabled (node is disconnected) in p2p_mempool.py -msg_mempool should get mempool txns in response when bloomfilter is enabled -edit test that doesn't test msg_mempool as intended
A node with fRelay=False should not receive any invs until filter is set using filterload; all other behavior should be identical.
…nect -A node with bloomfilters disabled should disconnect peers that send msg_mempool, msg_filterload, or msg_filteradd. -Renamed the test because it now has a wider scope and msg_mempool's actual functionality makes more sense for p2p_filter.py.
-grab mininode_lock for every access to mininode attributes, otherwise there are race conditions
-BEGIN VERIFY SCRIPT- sed -i 's/FilterNode/P2PBloomFilter/g' test/functional/p2p_filter.py; sed -i 's/filter_node/filter_peer/g' test/functional/p2p_filter.py; -END VERIFY SCRIPT-
|
ACK dca7394 only changes is restoring accidentally deleted test 🍮 Show signature and timestampSignature: Timestamp of file with hash |
|
Thanks for the thorough review @MarcoFalke 🙏 , greatly appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK dca7394 modulo a few nits if you retouch, happy to re-ACK if you take any of them but don't feel obliged to.
| self.test_filter(filter_peer) | ||
| self.nodes[0].disconnect_p2ps() | ||
|
|
||
| self.log.info('Test BIP 37 for a node with fRelay = False') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
497a619 perhaps put the BIP37 tests into their own function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're mostly in their own function test_filter, so I left this one as is.
|
With two ACKs, this test change seems ready to merge. @gzhao408 Let me know if you want to address the feedback or want to leave it as is for now (for potential follow-ups) and have the pull request merged. |
|
Thank you for the review @jonatack 🙏 ! |
… tests dca7394 scripted-diff: rename node to peer for mininodes (gzhao408) 0474ea2 [test] fix race conditions and test in p2p_filter (gzhao408) 4ef80f0 [test] sending invalid msgs to node with bloomfilters=0 causes disconnect (gzhao408) 497a619 [test] add BIP 37 test for node with fRelay=false (gzhao408) e8acc60 [test] add mempool msg test for node with bloomfilter enabled (gzhao408) Pull request description: This PR adds a few tests that are bloomfilter-related, including behavior for when bloomfilters are turned _off_: 1. Tests p2p message `msg_mempool`: a node that has `peerbloomfilters` enabled should send its mempool (disabled behavior already tested [here](https://github.com/bitcoin/bitcoin/blob/master/test/functional/p2p_mempool.py)). 2. Tests that bloomfilter peers with [`fRelay=False`](https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki#extensions-to-existing-messages) in the `version` message should not receive any invs until they set the filter. The rest is the same as what’s already tested in `p2p_filter.py`. 3. Tests that peers get disconnected if they send `filterload` or `filteradd` p2p messages to a node with bloom filters disabled. 4. Refactor: renames p2p_mempool.py to p2p_nobloomfilter_messages.py. 5. Fixes race conditions in p2p_filter.py ACKs for top commit: MarcoFalke: ACK dca7394 only changes is restoring accidentally deleted test 🍮 jonatack: ACK dca7394 modulo a few nits if you retouch, happy to re-ACK if you take any of them but don't feel obliged to. Tree-SHA512: 442aeab0755cb8b830251ea170d1d5e6da8ac9029b3276d407a20ee3d588cc61b77b8842368de18c244056316b8c63b911776d6e106bc7c023439ab915b27ad3
…ter test followups 9a40cfc [refactor] use waiting inside disconnect_p2ps (gzhao408) aeb9fb4 [test] wait for disconnect_p2ps to be reflected in getpeerinfo (gzhao408) e81942d [test] logging and style followups for bloomfilter tests (gzhao408) Pull request description: Followup to #19083 which adds bloomfilter-related tests. 1. Make test_node `disconnect_p2ps` wait until disconnection is complete to avoid race conditions (and not place the burden on tests) from MarcoFalke's [comment](#19083 (comment)). And clean up any redundant `wait_until`s in the functional tests. 2. Clean up style + logging in p2p_filter.py and p2p_nobloomfilter_messages.py and jonatack's other [comments](#19083 (review)) ACKs for top commit: jonatack: Code review ACK 9a40cfc from re-reviewing the diff and `git range-diff 5cafb46 8386ad5 9a40cfc` MarcoFalke: ACK 9a40cfc 🐂 Tree-SHA512: 2e14b1c12fc08a355bd5ccad7a2a734a4ccda4bc7dc7bac171cb57359819fc1599d764290729af74832fac3e2be258c5d406c701e78ab6d7262835859b9a7d87
Summary: dca73941eb0f0a4c9b68efed3870b536f7dd6cfe scripted-diff: rename node to peer for mininodes (gzhao408) 0474ea25afc65546cbfe5f822c0212bf3e211023 [test] fix race conditions and test in p2p_filter (gzhao408) 4ef80f0827392a1310ca5a29cc1f8f5ca5d16f95 [test] sending invalid msgs to node with bloomfilters=0 causes disconnect (gzhao408) 497a619386008dfaec0db15ecaebcdfaf75f5011 [test] add BIP 37 test for node with fRelay=false (gzhao408) e8acc6015695c8439fc971a12709468995b96dcf [test] add mempool msg test for node with bloomfilter enabled (gzhao408) Pull request description: This PR adds a few tests that are bloomfilter-related, including behavior for when bloomfilters are turned _off_: 1. Tests p2p message `msg_mempool`: a node that has `peerbloomfilters` enabled should send its mempool (disabled behavior already tested [here](https://github.com/bitcoin/bitcoin/blob/master/test/functional/p2p_mempool.py)). 2. Tests that bloomfilter peers with [`fRelay=False`](https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki#extensions-to-existing-messages) in the `version` message should not receive any invs until they set the filter. The rest is the same as what’s already tested in `p2p_filter.py`. 3. Tests that peers get disconnected if they send `filterload` or `filteradd` p2p messages to a node with bloom filters disabled. 4. Refactor: renames p2p_mempool.py to p2p_nobloomfilter_messages.py. 5. Fixes race conditions in p2p_filter.py --- Backport of [[bitcoin/bitcoin#19083 | core#19083]] Test Plan: ninja all ./test/test_runner.py p2p_filter p2p_nobloomfilter_messages Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9511
…filter test followups Summary: 9a40cfc558b3f7fa4fff1270f969582af17479a5 [refactor] use waiting inside disconnect_p2ps (gzhao408) aeb9fb414e2d000830287d9dd3fed7fc2eb570d2 [test] wait for disconnect_p2ps to be reflected in getpeerinfo (gzhao408) e81942d2e1288367e8da94adb2b2a88be99e4751 [test] logging and style followups for bloomfilter tests (gzhao408) Pull request description: Followup to #19083 which adds bloomfilter-related tests. 1. Make test_node `disconnect_p2ps` wait until disconnection is complete to avoid race conditions (and not place the burden on tests) from MarcoFalke's [comment](bitcoin/bitcoin#19083 (comment)). And clean up any redundant `wait_until`s in the functional tests. 2. Clean up style + logging in p2p_filter.py and p2p_nobloomfilter_messages.py and jonatack's other [comments](bitcoin/bitcoin#19083 (review)) --- Backport of [[bitcoin/bitcoin#19252 | core#19252]] Depends on D9512 Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9513
This PR adds a few tests that are bloomfilter-related, including behavior for when bloomfilters are turned off:
msg_mempool: a node that haspeerbloomfiltersenabled should send its mempool (disabled behavior already tested here).fRelay=Falsein theversionmessage should not receive any invs until they set the filter. The rest is the same as what’s already tested inp2p_filter.py.filterloadorfilteraddp2p messages to a node with bloom filters disabled.