Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented May 13, 2019

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

@maflcko maflcko force-pushed the 1905-illegalWitnessP2P branch from fa14c82 to fa2b52a Compare May 14, 2019 12:36
@maflcko maflcko added this to the 0.18.1 milestone May 14, 2019
@maflcko
Copy link
Member Author

maflcko commented May 14, 2019

Marked for backport

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

def serialize_with_bogus_witness(tx):
flags = 1
flags = 3
Copy link
Contributor

Choose a reason for hiding this comment

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

Why's it important that the flag is 3 and not 1? Maybe add a code comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

The test fails if it is set to 1

Choose a reason for hiding this comment

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

yes, I also hate these magic numbers.

Copy link
Member Author

Choose a reason for hiding this comment

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

@thijstriemstra Mind adding a comment to explain the magic number? It should be clear what it does if you try to set it to 0, 1, or 2 and run the test (or review the test case)

Choose a reason for hiding this comment

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

I can try.. also noticed a lot of if statement with parentheses that are not needed, e.g. if (len(tx.wit.vtxinwit) != len(tx.vin)):. Why not if len(tx.wit.vtxinwit) != len(tx.vin):? Or is this preferred coding style for Python in this project?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have a python coding style (except for the ./test/lint/lint-python.sh), but without parens is indeed preferred.

Choose a reason for hiding this comment

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

searched a while for any python linter that can detect this but no luck yet. Possibly needs to have a custom flake8 plugin that can find this.

@maflcko maflcko changed the title p2p: Disallow extended encoding for non-witness transactions (take 3) p2p: Avoid logging transaction decode errors to stderr May 15, 2019
@maflcko
Copy link
Member Author

maflcko commented May 15, 2019

Changed title

@laanwj
Copy link
Member

laanwj commented May 20, 2019

utACK fa2b52a

@laanwj laanwj merged commit fa2b52a into bitcoin:master May 20, 2019
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 maflcko deleted the 1905-illegalWitnessP2P branch May 20, 2019 16:22
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
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 Oct 17, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 22, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 22, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 23, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 26, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 28, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Oct 28, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 12, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 13, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 13, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 14, 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
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 16, 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
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.

6 participants