Skip to content

Conversation

@instagibbs
Copy link
Member

Adds coverage for changed behavior in #14039

@instagibbs instagibbs changed the title Add test for superfulous witness record in deserialization Add test for superfluous witness record in deserialization Apr 25, 2019
@maflcko
Copy link
Member

maflcko commented Apr 25, 2019

Tests are failing with

AssertionError: [node 0] Expected message "bad-txns-vin-empty" does not partially match log:
 - 2019-04-25T19:05:50.370758Z received: tx (119 bytes) peer=0
 - 2019-04-25T19:05:50.370863Z 
 - 
 - ************************
 - EXCEPTION: NSt8ios_base7failureB5cxx11E       
 - Superfluous witness record: iostream error       
 - bitcoin in ProcessMessages()       

@DrahtBot DrahtBot added the Tests label Apr 25, 2019
@instagibbs
Copy link
Member Author

wait, what? I didn't touch this test:
64/119 - p2p_invalid_tx.py failed, Duration: 1 s

@maflcko
Copy link
Member

maflcko commented Apr 25, 2019

Could you include the following diff:

diff --git a/test/functional/data/invalid_txs.py b/test/functional/data/invalid_txs.py
index 02deae92f3..80d8d66f24 100644
--- a/test/functional/data/invalid_txs.py
+++ b/test/functional/data/invalid_txs.py
@@ -68,7 +68,7 @@ class OutputMissing(BadTxTemplate):
 
 
 class InputMissing(BadTxTemplate):
-    reject_reason = "bad-txns-vin-empty"
+    reject_reason = "Superfluous witness record"
     expect_disconnect = False
 
     def get_tx(self):

@instagibbs
Copy link
Member Author

@MarcoFalke I tried a slightly different track by using the fact that 0-vin, 0-vout have input sizes checked first, and kept that test case, then also kept my new test for the actual test we're checking for. It seemed weird to me to simply hope that that type of transaction would trigger this case.

Copy link
Member

Choose a reason for hiding this comment

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

Please move this comment to data/invalid_txs.py, as it is not clear why the tx there is completely "empty"

Copy link
Member Author

Choose a reason for hiding this comment

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

I wrote something else in its place. I found the previous text a little baffling to be honest. Willing to take heavy edits on it :)

@maflcko
Copy link
Member

maflcko commented Apr 26, 2019

utACK cc556e4

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Apr 26, 2019
…ialization

cc556e4 Add test for superfluous witness record in deserialization (Gregory Sanders)
25b0786 Fix missing input template by making minimal tx (Gregory Sanders)

Pull request description:

  Adds coverage for changed behavior in bitcoin#14039

ACKs for commit cc556e:
  MarcoFalke:
    utACK cc556e4

Tree-SHA512: 3404c8f75e87503983fac5ae27d877309eb3b902f2ec993762911c71610ca449bef0ed98bd17e029414828025b2713e1bd012e63b2a06497e34f1056acaa6321
@maflcko maflcko merged commit cc556e4 into bitcoin:master Apr 26, 2019
@maflcko maflcko added this to the 0.18.1 milestone Apr 26, 2019
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 27, 2019
…ialization

cc556e4 Add test for superfluous witness record in deserialization (Gregory Sanders)
25b0786 Fix missing input template by making minimal tx (Gregory Sanders)

Pull request description:

  Adds coverage for changed behavior in bitcoin#14039

ACKs for commit cc556e:
  MarcoFalke:
    utACK cc556e4

Tree-SHA512: 3404c8f75e87503983fac5ae27d877309eb3b902f2ec993762911c71610ca449bef0ed98bd17e029414828025b2713e1bd012e63b2a06497e34f1056acaa6321
laanwj added a commit that referenced this pull request May 20, 2019
fa2b52a Disallow extended encoding for non-witness transactions (take 3) (MarcoFalke)

Pull request description:

  (previous title "p2p: Disallow extended encoding for non-witness transactions (take 3)")

  Remote peers can send us illegally encoded txs and thus have us write to stderr. Fix that by not writing to stderr.

  This is a follow up to the previous (incomplete) attempts at this:

  *  Disallow extended encoding for non-witness transactions #14039
  *  Add test for superfluous witness record in deserialization #15893

ACKs for commit fa2b52:
  laanwj:
    utACK fa2b52a
  ryanofsky:
    utACK fa2b52a. Would change title to something like "Avoid logging transaction decode errors to stderr" instead of "Disallow extended encoding for non-witness transactions." The current title is confusing because this PR isn't really allowing or disallowing anything, just logging the condition differently. "Disallow" also seems to contradict the "Allow exceptions from..." comments in the actual code.

Tree-SHA512: c66990e69b432d00dc1c5510bf976a1188664d0890a32d1e5c6459094e7e27da82a5d227627afcbc203676f5540eec74b7d9b1d71d2c62d3b2069e1781824b4d
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request May 20, 2019
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request May 20, 2019
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 20, 2019
…stderr

fa2b52a Disallow extended encoding for non-witness transactions (take 3) (MarcoFalke)

Pull request description:

  (previous title "p2p: Disallow extended encoding for non-witness transactions (take 3)")

  Remote peers can send us illegally encoded txs and thus have us write to stderr. Fix that by not writing to stderr.

  This is a follow up to the previous (incomplete) attempts at this:

  *  Disallow extended encoding for non-witness transactions bitcoin#14039
  *  Add test for superfluous witness record in deserialization bitcoin#15893

ACKs for commit fa2b52:
  laanwj:
    utACK fa2b52a
  ryanofsky:
    utACK fa2b52a. Would change title to something like "Avoid logging transaction decode errors to stderr" instead of "Disallow extended encoding for non-witness transactions." The current title is confusing because this PR isn't really allowing or disallowing anything, just logging the condition differently. "Disallow" also seems to contradict the "Allow exceptions from..." comments in the actual code.

Tree-SHA512: c66990e69b432d00dc1c5510bf976a1188664d0890a32d1e5c6459094e7e27da82a5d227627afcbc203676f5540eec74b7d9b1d71d2c62d3b2069e1781824b4d
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Aug 23, 2019
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Aug 23, 2019
Bushstar pushed a commit to Bushstar/omnicore that referenced this pull request Aug 24, 2019
Bushstar pushed a commit to Bushstar/omnicore that referenced this pull request Aug 24, 2019
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 18, 2021
…stderr

fa2b52a Disallow extended encoding for non-witness transactions (take 3) (MarcoFalke)

Pull request description:

  (previous title "p2p: Disallow extended encoding for non-witness transactions (take 3)")

  Remote peers can send us illegally encoded txs and thus have us write to stderr. Fix that by not writing to stderr.

  This is a follow up to the previous (incomplete) attempts at this:

  *  Disallow extended encoding for non-witness transactions bitcoin#14039
  *  Add test for superfluous witness record in deserialization bitcoin#15893

ACKs for commit fa2b52:
  laanwj:
    utACK fa2b52a
  ryanofsky:
    utACK fa2b52a. Would change title to something like "Avoid logging transaction decode errors to stderr" instead of "Disallow extended encoding for non-witness transactions." The current title is confusing because this PR isn't really allowing or disallowing anything, just logging the condition differently. "Disallow" also seems to contradict the "Allow exceptions from..." comments in the actual code.

Tree-SHA512: c66990e69b432d00dc1c5510bf976a1188664d0890a32d1e5c6459094e7e27da82a5d227627afcbc203676f5540eec74b7d9b1d71d2c62d3b2069e1781824b4d
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 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.

3 participants