-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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
[tests] Change invalidtxrequest to use BitcoinTestFramework #11771
Conversation
Needs a rebase. |
24d1771
to
40ec44c
Compare
rebased |
40ec44c
to
f4c080f
Compare
Rebased and made slight improvements to the P2PStub class. |
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.
utACK 8c3615f
if len(self.block_store) == 0: | ||
return | ||
current_block_header = self.block_store[next(reversed(self.block_store))] | ||
# current_block_header = super(current_tip) |
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.
Unnecessary 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.
duh. Vestigial garbage. I'll remove.
f4c080f
to
297bf72
Compare
Thanks for the review @jamesob . I've removed the errant comment, and improved comments for the P2PStub methods. |
utACK e72c94c |
...modulo the legitimate-looking test failure:
|
Great. Travis caught a race condition. I wasn't able to reproduce it locally. Should be fixed in the final commit. @jamesob - let me know when you've taken a look and I'll squash into the Add P2PStub class commit. |
951a41f
to
d465d39
Compare
squashed fix and rebased |
d465d39
to
0d5cfa3
Compare
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 0d5cfa3074
Some questions inline
self.send_message(msg_tx(self.tx_store[inv.hash])) | ||
elif inv.type == 2 or inv.type == 2 | MSG_WITNESS_FLAG: | ||
if inv.hash in self.block_store.keys(): | ||
self.send_message(msg_block(self.block_store[inv.hash])) |
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.
Mind to simplify the nested ifs?
elif inv.type & MSG_TX and inv.hash in self.block_store.keys():
self.send...
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.
inv types are not bit flags in general, so inv.type & MSG_TX
evaluates to true for MSG_FILTERED_BLOCK (and inv.type & MSG_BLOCK
also evalutes to true for MSG_FILTERED_BLOCK).
Flattening the nested ifs would give:
if (inv.type == 1 or inv.type == 1 | MSG_WITNESS_FLAG) and inv.hash in self.tx_store.keys():
self.send_message(msg_tx(self.tx_store[inv.hash]))
elif (inv.type == 2 or inv.type == 2 | MSG_WITNESS_FLAG) and inv.hash in self.block_store.keys():
self.send_message(msg_block(self.block_store[inv.hash]))
I'm not sure if that's any clearer due to the length of the if statements, but I'm happy to change it if you think it's an improvement.
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.
Nope, fine to leave as is.
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.
In commit "Add P2PStub class"
I also think this is fine as is, but I would suggest taking constants from the c++ code and writing:
if (inv.type & MSG_TYPE_MASK) == MSG_TX and inv.hash in self.tx_store.keys():
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.
taken @ryanofsky's suggested change
if len(self.block_store) == 0: | ||
return | ||
current_block_header = self.block_store[next(reversed(self.block_store))] | ||
if current_block_header is None: |
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.
nit: Add a comment why this would ever be true and not dead code?
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.
This isn't actually required. Removing.
self.send_message(msg_headers([blocks[-1]])) | ||
|
||
if request_block: | ||
wait_until(lambda: blocks[-1].sha256 in self.getdata_requests) |
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.
Since getdata_requests
is written to with the mininode lock, why is a lock=mininode_lock
not required when reading?
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.
You're right. This is required. Updating.
self.sync_with_ping() | ||
|
||
if success: | ||
assert tx.hash in rpc.getrawmempool() |
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.
The documentation states "whether they are accepted", but you only check one.
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.
fixed
Fixed @MarcoFalke's comments, along with a few variable renamings. I've pushed as a fixup commit. Will squash once Marco confirms he's happy with the fixup. |
fixups look good, though a travis failure:
Feel free to squash. I am going to review from scratch anyway. |
d855c4b
to
1c5aa93
Compare
squashed && rebased |
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.
utACK 1c5aa93034a7ad213727ffdfb1bb71eab20f1f80. I left some suggestions, but they are all minor, and you should feel free to ignore them. Overall, this seems like a very nice addition to the test framework.
self.send_message(msg_tx(self.tx_store[inv.hash])) | ||
elif inv.type == 2 or inv.type == 2 | MSG_WITNESS_FLAG: | ||
if inv.hash in self.block_store.keys(): | ||
self.send_message(msg_block(self.block_store[inv.hash])) |
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.
In commit "Add P2PStub class"
I also think this is fine as is, but I would suggest taking constants from the c++ code and writing:
if (inv.type & MSG_TYPE_MASK) == MSG_TX and inv.hash in self.tx_store.keys():
locator, hash_stop = message.locator, message.hashstop | ||
|
||
# Assume that the most recent block added is the tip | ||
if len(self.block_store) == 0: |
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.
In commit "Add P2PStub class"
If following PEP8 this should be if not self.block_store:
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.
indeed
response = msg_headers() | ||
headers_list = [current_block_header] | ||
maxheaders = 2000 | ||
while (headers_list[0].sha256 not in locator.vHave): |
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.
In commit "Add P2PStub class"
Unnecessary parentheses
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.
removed
prev_block_hash = headers_list[0].hashPrevBlock | ||
if prev_block_hash in self.block_store: | ||
prev_block_header = self.block_store[prev_block_hash] | ||
headers_list.insert(0, prev_block_header) |
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.
In commit "Add P2PStub class"
Usually better to append to end of list than insert at beginning of list. You can get the last maxheaders in reverse order with `header_list[:-maxheaders-1:-1]
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.
changed
self.reject_reason_received = None | ||
|
||
for block in blocks: | ||
self.block_store[block.sha256] = block |
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.
Maybe assert block.sha256 not in block_store
because if this is not true, ordering assumption could be broken and next(reversed(block_store)) might not actually return the last block.
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.
In commit "Add P2PStub class"
Need mininode_lock here?
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.
added mininode_lock. I don't think the assert is necessary - we may wish to send the same block over the same P2P interface more than once.
test/functional/invalidtxrequest.py
Outdated
@@ -32,13 +28,10 @@ def run_test(self): | |||
test.run() | |||
|
|||
def get_tests(self): | |||
if self.tip is None: |
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.
In commit [tests] Fix flake8 warnings in invalidtxrequest
I see you are removing self.tip
variable entirely in next commit, but it seems safer not to drop the None
condition in this commit, which is supposed to only be fixing flake8 warnings.
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.
self.tip
is set to None
in run_test()
and then run()
is called, which calls get_tests()
, so self.tip
has to be None
at this point.
So yes, this isn't strictly fixing a flake8 warning, but it's a safe tidy-up which is removed in the next commit.
@@ -440,3 +454,136 @@ def network_thread_join(timeout=10): | |||
for thread in network_threads: | |||
thread.join(timeout) | |||
assert not thread.is_alive() | |||
|
|||
class P2PStub(P2PInterface): |
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.
In commit "Add P2PStub class"
Name like P2PDataStore
might more suggestive than P2PStub
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.
ok, changed to P2PDataStore
test/functional/invalidtxrequest.py
Outdated
def get_tests(self): | ||
self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0) | ||
self.block_time = int(time.time()) + 1 | ||
tip = int("0x" + self.nodes[0].getbestblockhash(), 0) |
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.
In commit "Change invalidtxrequest to use BitcoinTestFramework"
Could do int(self.nodes[0].getbestblockhash(), 16)
and drop "0x" prefix, I think.
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.
agree. That's better
test/functional/invalidtxrequest.py
Outdated
height += 1 | ||
yield TestInstance([[block, True]]) | ||
node.p2p.send_blocks_and_test([block], node, True) |
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.
In commit "Change invalidtxrequest to use BitcoinTestFramework"
Maybe drop True
since that seems to be the default value, or write success=True
. Plain True
by itself doesn't convey anything and just seems suspicious.
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.
yes
test/functional/invalidtxrequest.py
Outdated
tx1 = create_transaction(self.block1.vtx[0], 0, b'\x64', 50 * COIN - 12000) | ||
yield TestInstance([[tx1, RejectResult(16, b'mandatory-script-verify-flag-failed')]]) | ||
tx1 = create_transaction(block1.vtx[0], 0, b'\x64', 50 * COIN - 12000) | ||
node.p2p.send_txs_and_test([tx1], node, False, 16, b'mandatory-script-verify-flag-failed (Invalid OP_IF construction)') |
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.
In commit "Change invalidtxrequest to use BitcoinTestFramework"
Maybe add success=
, reject_code=
, keywords for future proofing and clarity.
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.
yes
[tests] update tests from changes to mininode in bitcoin#11771 - added by @conscott [tests] trivial update to hex conversion for readability - added by @conscott
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.
utACK 95e2e9a, just some dead code and comment nits.
elif (inv.type & MSG_TYPE_MASK) == MSG_BLOCK and inv.hash in self.block_store.keys(): | ||
self.send_message(msg_block(self.block_store[inv.hash])) | ||
else: | ||
logger.debug('getdata message type {} received.'.format(hex(inv.type))) |
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.
Could be removed. This is already done by P2PConnection._log_message
.
headers_list = headers_list[:-maxheaders - 1:-1] | ||
response = msg_headers(headers_list) | ||
|
||
if response is not None: |
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.
Could be removed per my previous review.
- add all txs to our tx_store | ||
- send tx messages for all txs | ||
- if success is True: assert that the tx is accepted to the mempool | ||
- if success is False: assert that the tx is not accepted to the mempool |
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.
nit: Replace "tx is" with "txs are"
…amework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on #11771. Please review that PR first Next step in #10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
Agree with all of @MarcoFalke's comments, which can be addressed in a future PR. |
self.block_store[block.sha256] = block | ||
self.last_block_hash = block.sha256 | ||
|
||
self.send_message(msg_headers([blocks[-1]])) |
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.
I can't find a reason why you are sending the full block in a headers message instead of just the header? If there is a reason, it should be documented, otherwise I'd suggest sending just the header.
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.
Yes, I agree - this should be changed to just be the header.
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.
Fixed in #12861
[tests] update tests from changes to mininode in bitcoin#11771 - added by @conscott [tests] trivial update to hex conversion for readability - added by @conscott
…stFramework 95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery) 359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery) c32cf9f [tests] Add P2PDataStore class (John Newbery) cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Next step in bitcoin#10603 - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures) - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework` - third commit tidies up `invalidtxrequest.py` - fourth commit removes usage of `ComparisonTestFramework` Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
…nTestFramework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on bitcoin#11771. Please review that PR first Next step in bitcoin#10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
…stFramework 95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery) 359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery) c32cf9f [tests] Add P2PDataStore class (John Newbery) cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Next step in bitcoin#10603 - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures) - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework` - third commit tidies up `invalidtxrequest.py` - fourth commit removes usage of `ComparisonTestFramework` Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
…nTestFramework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on bitcoin#11771. Please review that PR first Next step in bitcoin#10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
…stFramework 95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery) 359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery) c32cf9f [tests] Add P2PDataStore class (John Newbery) cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Next step in bitcoin#10603 - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures) - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework` - third commit tidies up `invalidtxrequest.py` - fourth commit removes usage of `ComparisonTestFramework` Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
…nTestFramework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on bitcoin#11771. Please review that PR first Next step in bitcoin#10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
…stFramework 95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery) 359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery) c32cf9f [tests] Add P2PDataStore class (John Newbery) cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Next step in bitcoin#10603 - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures) - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework` - third commit tidies up `invalidtxrequest.py` - fourth commit removes usage of `ComparisonTestFramework` Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
…nTestFramework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on bitcoin#11771. Please review that PR first Next step in bitcoin#10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
…stFramework 95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery) 359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery) c32cf9f [tests] Add P2PDataStore class (John Newbery) cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Next step in bitcoin#10603 - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures) - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework` - third commit tidies up `invalidtxrequest.py` - fourth commit removes usage of `ComparisonTestFramework` Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
…nTestFramework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on bitcoin#11771. Please review that PR first Next step in bitcoin#10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
…stFramework 95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery) 359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery) c32cf9f [tests] Add P2PDataStore class (John Newbery) cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Next step in bitcoin#10603 - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures) - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework` - third commit tidies up `invalidtxrequest.py` - fourth commit removes usage of `ComparisonTestFramework` Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
…nTestFramework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on bitcoin#11771. Please review that PR first Next step in bitcoin#10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
…stFramework 95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery) 359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery) c32cf9f [tests] Add P2PDataStore class (John Newbery) cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Next step in bitcoin#10603 - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures) - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework` - third commit tidies up `invalidtxrequest.py` - fourth commit removes usage of `ComparisonTestFramework` Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
…nTestFramework e97b113 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery) 2b7064e [tests] Fix flake8 warnings in invalidblockrequest (John Newbery) 54b8c58 [test] Fix nits leftover from 11771 (Conor Scott) Pull request description: Builds on bitcoin#11771. Please review that PR first Next step in bitcoin#10603. - first commit tidies up invalidblockrequest.py - second commit removes usage of ComparisonTestFramework Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
…tx functional tests coverage. 2d994c4 qa: adding test case for output value > input value out of range (furszy) 6165c80 qa: update and enable p2p_invalid_tx.py functional test. (furszy) bb62699 Backport chainparams and validation `fRequireStandard` flags functionality + init 'acceptnonstdtxn' option to skip (most) "non-standard transaction" checks, for testnet/regtest only. (furszy) 0280c39 New regression testing for CVE-2018-17144, CVE-2012-2459, and CVE-2010-5137. (lucash-dev) ec7d0b0 [qa] Test for duplicate inputs within a transaction (Suhas Daftuar) a501fe1 qa: update and enable p2p_invalid_block.py. (furszy) f83d140 qa: Read reject reasons from debug log, not p2p messages (furszy) 8a50165 [tests] Add P2PDataStore class (furszy) ebed910 qa: Correct coinbase input script height. (furszy) cae2d43 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Introduced the `P2PDataStore` class into the functional test suite and updated it up to a point where was able to enable the `p2p_invalid_block.py` and `p2p_invalid_tx.py` functional tests. Plus updated both tests to a much recent version, expanding its testing coverage as well. Now the test suite is covering the primary CVE that btc had in the past. As both tests were simply unusable before and we have a different synchronization process than upstream, plus we didn't have some params and init/global flags, this work isn't following a PR by PR back port path. Had to made my own way up to the complete tests support. Main pilar PRs from upstream from where this work was based: * bitcoin#6329. * bitcoin#11771. * bitcoin#14119 (only `p2p_invalid_tx.py`, `p2p_invalid_block.py` and `mininode.py` changes). * bitcoin#14247 (only 9b4a36e). * bitcoin#14696. ACKs for top commit: random-zebra: ACK 2d994c4 Tree-SHA512: 548830b5fbf8b7f383832a7eea96179d089a4c9c222ef34007846f53736b07c873e37084235f1575eac157b63308c00ab3be78b71d3ed6520f4f73f1c8de81a5
Next step in #10603
P2PStub
class - a subclass ofNodeConnCB
which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used ininvalidtxrequest.py
, but will be used ininvalidblockrequest.py
andp2p-fullblocktest
when those are changed to useBitcoinTestFramework
invalidtxrequest.py
ComparisonTestFramework