Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jun 6, 2023

Clarify with a test that -datacarriersize applies to the serialized size of the scriptPubKey, not the size of the pushed data. So for example,

  • -datacarriersize=2 will reject a raw(6a01aa), even though only one byte is pushed
  • -datacarriersize=0 (or -datacarrier=0) will reject a raw(6a), even though no byte is pushed
  • -datacarriersize=0 (or -datacarrier=0) will reject a raw(6a00), even though zero bytes are pushed

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 6, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK ajtowns, instagibbs

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28130 (Remove arbitrary restrictions on OP_RETURN by default by petertodd)
  • #26525 (Remove -mempoolfullrbf option by BitcoinErrorLog)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@instagibbs
Copy link
Member

ACK fa4f476

@maflcko maflcko changed the title test: Add -datacarriersize=2 tests doc: Clarify -datacarriersize, add -datacarriersize=2 tests Jun 6, 2023
@maflcko maflcko removed the Tests label Jun 6, 2023
@ajtowns
Copy link
Contributor

ajtowns commented Jun 6, 2023

Concept ACK

strprintf("Relay and mine transactions whose data-carrying raw scriptPubKey "
"is of this size or less (default: %u)",
MAX_OP_RETURN_RELAY),
ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
Copy link
Contributor

Choose a reason for hiding this comment

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

NACK This wording is misleading. OP_Return outputs only contain data if they contain something in addition to the OP_Return opcode.

A better approach here if we are touching this opcode could be to redefine -datacarriersize to be size in-addition-too the OP_Return opcode that is allowed. Thus -datacarriersize=0 would allow 0 bytes in addition to the 1 byte used by the OP_Return opcode.

Copy link
Member Author

Choose a reason for hiding this comment

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

My goal is to document the current behavior and then behavior changes can be done in a follow-up change. Happy to drop this commit or change to a better wording to describe the current behavior, if you have any suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since you are updating this, you should change the doc text to make clear that the current behavior is a mistake that needs fixing rathre than continue to incorrectly call them data carrier scriptPubKey's.

But it'd be less code churn to just fix the behavior in one shot. We have an ACK on #27261, so there is an argument to fix the bare OP_Return case. Rather than merging #27261 as-is I could make a pull-req that simply fixes the -datacarriersize off-by-one error. Fixing that error would also allow -datacarrier to be dropped entirely, as it is redundant: -datacarriersize=0 prohibits data carrying outputs just fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing that error would also allow -datacarrier to be dropped entirely, as it is redundant: -datacarriersize=0 prohibits data carrying outputs just fine.

I think -datacarrier can be dropped regardless of whether the behavior is changed. And this would have been my review comment in #27261 :)

@maflcko
Copy link
Member Author

maflcko commented Jun 9, 2023

Rebased for green CI

@fanquake fanquake requested a review from instagibbs June 12, 2023 15:35
@DrahtBot DrahtBot requested a review from ajtowns June 22, 2023 14:15
@ajtowns
Copy link
Contributor

ajtowns commented Jun 23, 2023

ACK faafc35

@DrahtBot DrahtBot removed the request for review from ajtowns June 23, 2023 06:06
@maflcko maflcko requested review from instagibbs and removed request for instagibbs August 3, 2023 11:40
@instagibbs
Copy link
Member

ACK faafc35

@DrahtBot DrahtBot removed the request for review from instagibbs August 3, 2023 14:25
@fanquake fanquake merged commit da3816e into bitcoin:master Aug 3, 2023
@maflcko maflcko deleted the 2306-test-dc-2- branch August 4, 2023 07:42
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 9, 2023
…ize=2 tests

faafc35 doc: Clarify that -datacarriersize applies to the full raw scriptPubKey, not the data push (MarcoFalke)
55550e7 test: Add -datacarriersize=2 tests (MarcoFalke)

Pull request description:

  Clarify with a test that `-datacarriersize` applies to the serialized size of the scriptPubKey, not the size of the pushed data. So for example,

  * `-datacarriersize=2` will reject a `raw(6a01aa)`, even though only one byte is pushed
  * `-datacarriersize=0` (or `-datacarrier=0`) will reject a `raw(6a)`, even though no byte is pushed
  * `-datacarriersize=0` (or `-datacarrier=0`) will reject a `raw(6a00)`, even though zero bytes are pushed

ACKs for top commit:
  ajtowns:
    ACK faafc35
  instagibbs:
    ACK bitcoin@faafc35

Tree-SHA512: f01ace02798f596ac2a02461e9f2a6ef91b3b37c976ea0b3bc860e2d3efb0ace0fd8b779dd18249cee7f84ebbe5fd21d8506afd3a15edadc00b843ff3b4aacc7
@bitcoin bitcoin locked and limited conversation to collaborators Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants