Skip to content
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

Merged
merged 4 commits into from
Feb 13, 2018

Conversation

jnewbery
Copy link
Contributor

Next step in #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

@fanquake
Copy link
Member

Needs a rebase.

@jnewbery
Copy link
Contributor Author

rebased

@jnewbery
Copy link
Contributor Author

jnewbery commented Dec 2, 2017

Rebased and made slight improvements to the P2PStub class.

Copy link
Member

@jamesob jamesob left a 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary comment?

Copy link
Contributor Author

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.

@jnewbery
Copy link
Contributor Author

jnewbery commented Dec 2, 2017

Thanks for the review @jamesob . I've removed the errant comment, and improved comments for the P2PStub methods.

@jamesob
Copy link
Member

jamesob commented Dec 3, 2017

utACK e72c94c

@jamesob
Copy link
Member

jamesob commented Dec 3, 2017

...modulo the legitimate-looking test failure:

  File "/home/travis/build/bitcoin/bitcoin/build/bitcoin-x86_64-unknown-linux-gnu/test/functional/invalidtxrequest.py", line 50, in run_test
    node.p2p.send_txs_and_test([tx1], node, False, 16, b'mandatory-script-verify-flag-failed (Invalid OP_IF construction)')
  File "/home/travis/build/bitcoin/bitcoin/build/bitcoin-x86_64-unknown-linux-gnu/test/functional/test_framework/mininode.py", line 540, in send_txs_and_test
    assert_equal(reject_code, self.reject_code_received)
  File "/home/travis/build/bitcoin/bitcoin/build/bitcoin-x86_64-unknown-linux-gnu/test/functional/test_framework/util.py", line 38, in assert_equal
    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
AssertionError: not(16 == None)

@jnewbery
Copy link
Contributor Author

jnewbery commented Dec 4, 2017

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.

@jnewbery jnewbery force-pushed the refactor_invalidtxrequest branch 2 times, most recently from 951a41f to d465d39 Compare December 11, 2017 14:32
@jnewbery
Copy link
Contributor Author

squashed fix and rebased

Copy link
Member

@maflcko maflcko left a 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]))
Copy link
Member

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...

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11771 (comment)

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():

Copy link
Contributor Author

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:
Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Member

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?

Copy link
Contributor Author

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()
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@jnewbery
Copy link
Contributor Author

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.

@maflcko
Copy link
Member

maflcko commented Dec 14, 2017

fixups look good, though a travis failure:

./test/functional/test_framework/mininode.py:26:1: F401 'test_framework.util.assert_equal' imported but unused

^---- failure generated from contrib/devtools/lint-python.sh

Feel free to squash. I am going to review from scratch anyway.

@jnewbery jnewbery force-pushed the refactor_invalidtxrequest branch 2 times, most recently from d855c4b to 1c5aa93 Compare December 15, 2017 22:35
@jnewbery
Copy link
Contributor Author

squashed && rebased

Copy link
Contributor

@ryanofsky ryanofsky left a 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]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11771 (comment)

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:
Copy link
Contributor

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:

Copy link
Contributor Author

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):
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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]

Copy link
Contributor Author

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

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@@ -32,13 +28,10 @@ def run_test(self):
test.run()

def get_tests(self):
if self.tip is None:
Copy link
Contributor

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.

Copy link
Contributor Author

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):
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, changed to P2PDataStore

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)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. That's better

height += 1
yield TestInstance([[block, True]])
node.p2p.send_blocks_and_test([block], node, True)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

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)')
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

jnewbery added a commit to jnewbery/bitcoin that referenced this pull request Feb 14, 2018
[tests] update tests from changes to mininode in bitcoin#11771 - added by @conscott

[tests] trivial update to hex conversion for readability - added by @conscott
Copy link
Member

@maflcko maflcko left a 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)))
Copy link
Member

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:
Copy link
Member

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

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"

maflcko pushed a commit that referenced this pull request Mar 13, 2018
…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
@jnewbery
Copy link
Contributor Author

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]]))
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #12861

HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Jun 29, 2018
[tests] update tests from changes to mininode in bitcoin#11771 - added by @conscott

[tests] trivial update to hex conversion for readability - added by @conscott
codablock pushed a commit to codablock/dash that referenced this pull request Sep 30, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Sep 30, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Sep 30, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Sep 30, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Oct 2, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Oct 2, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Oct 2, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Oct 2, 2019
…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
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Oct 3, 2019
…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
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Oct 3, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Oct 3, 2019
…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
codablock pushed a commit to codablock/dash that referenced this pull request Oct 3, 2019
…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
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
…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
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
…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
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request May 4, 2021
…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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants