HomePhabricator

Merge #14522: tests: add invalid P2P message tests

Description

Merge #14522: tests: add invalid P2P message tests

Summary:
d20a9fa13d1c13f552e879798c0508be70190e71 tests: add tests for invalid P2P messages (James O'Beirne)
62f94d39f8de88a44bb0a8a2837d864f777aaacc tests: add P2PConnection.send_raw_message (James O'Beirne)
5aa31f6ef26f51ce461c917654dd1cfbbdd1409a tests: add utility to assert node memory usage hasn't increased (James O'Beirne)

Pull request description:

  • Adds p2p_invalid_messages.py: tests based on behavior for dealing with invalid and malformed P2P messages. Includes a test verifying that we can't DoS a node by spamming it with large invalid messages.
  • Adds TestNode.assert_memory_usage_stable: a context manager that allows us to ensure memory usage doesn't significantly increase on a node during some test.
  • Adds P2PConnection.send_raw_message: which allows us to construct and send messages with tweaked headers.

Tree-SHA512: 720a4894c1e6d8f1551b2ae710e5b06c9e4f281524623957cb01599be9afea82671dc26d6152281de0acb87720f0c53b61e2b27d40434d30e525dd9e31fa671f

Merge #14672: tests: Send fewer spam messages in p2p_invalid_messages

3d305e3b89 Send fewer spam messages in p2p_invalid_messages (James O'Beirne)

Pull request description:

Builds on travis are failing because the test node isn't
able to drop all the bad messages sent within the given
timeout. Reduce the number of bad messages we're sending
and increase the timeout to avoid failures on travis.

Tree-SHA512: 11c389619d9590caf7eca74e0efe6d950469415d34220072770689024b350cc08a2d5ec90634237d87ff71ba8b638c1152b8a45ffbb2815a48bde6a88fbb8fc6

Backport of Core PR14522 and PR14672 (to reduce flakiness)

Test Plan: ninja check-functional

Reviewers: #bitcoin_abc, Fabien, deadalnix

Reviewed By: #bitcoin_abc, Fabien, deadalnix

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6178

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Nov 6 2018, 10:08
jasonbcoxCommitted on May 21 2020, 16:40
jasonbcoxPushed on May 21 2020, 16:40
Reviewer
Restricted Project
Differential Revision
D6178: Merge #14522: tests: add invalid P2P message tests
Parents
rABCcfb493b7a1a7: [land-bot] Improve error reporting when fetching revision status fails
Branches
Unknown
Tags
Unknown