Skip to content

Conversation

ajtowns
Copy link
Contributor

@ajtowns ajtowns commented Apr 10, 2024

This PR changes -acceptnonstdtxn=1 so that it also skips the non-mandatory script checks, allowing txs that (eg) use OP_NOPx or OP_SUCCESS into the mempool. This remains only available on test nets.

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 10, 2024

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/29843.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK benthecarman, glozow, fjahr, 1440000bytes

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:

  • #32998 (Bump SCRIPT_VERIFY flags to 64 bit by ajtowns)
  • #32575 (refactor: Split multithreaded case out of CheckInputScripts by fjahr)
  • #32317 (kernel: Separate UTXO set access from validation functions by TheCharlatan)
  • #31989 (BIP-119 (OP_CHECKTEMPLATEVERIFY) (regtest only) by jamesob)

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.

@ajtowns
Copy link
Contributor Author

ajtowns commented Apr 10, 2024

Previous discussion in #28334.

If you enable this feature as a non-mining node, you risk having txs pinned in your mempool that conflict or double-spend standard txs in the normal mempool, which may cause problems with applications or layer-2 protocols.

If you enable this feature as a mining node, you have a small risk of ending up with invalid txs remaining in your mempool if a non-standard tx is accepted in your mempool and remains in there during a soft-fork activation that renders the tx invalid. At that point if that tx is included in blocks you generate, they will be invalid. (EDIT: Restarting your node after activation occurs will dump the mempool to disk and reload it under the new consensus rules, which will correct such problems, however)

For these reasons this feature continues to only be available on test nets, not mainnet.

Having this be available in mainline bitcoin may make it easier to observe test transactions using proposed new soft-fork features (eg OP_CAT or SIGHASH_APO is enabled via the inquisition client which considers those txs standard, but the mainline client will consider them non-standard and has no option to accept them). discussion link

EDIT 2025/03/25: There are more or less three reasons why things are marked non-standard:

  • some are upgrade hooks (future witness versions, future taproot versions, future tapscript pubkey types, annex usage, NOP and OP_SUCCESS opcodes, tx versions greater than 3, currently unused scriptPubKey types)
  • others are DoS mitigations (p2sh sigop limit, dangerous scriptPubKey types, ...)
  • others are just to make things nicer for users/miners (tx weight/sigop limit to make packing blocks easier, various things to reduce malleability, limit wasteful utxos, etc...)

Prior to this PR, -acceptnonstdtxn enables txs that include features from each of these categories (eg for upgrades, txs with annex data via IsWitnessStandard being disabled, higher tx versions via IsStandardTx being disabled; for DoS, excessive p2sh sigops via IsStandardTx being disabled; for user friendliness, creation of ephemeral dust due to ephemeral checks being disabled). This PR likewise enables features from each category (NOPS, OP_SUCCESS, tapscript pubkey type, new taproot versions are upgrade features; CONST_SCRIPTCODE is a DoS mitigation; LOW_S, MINIMALIF, CLEANSTACK etc are user friendliness).

Separating these into different categories that can be controlled separately might be worthwhile, but doesn't seem necessary for this PR.

@1440000bytes

This comment was marked as abuse.

@benthecarman
Copy link
Contributor

Concept ACK this would be nice for testing soft forks on test networks

@luke-jr
Copy link
Member

luke-jr commented Apr 21, 2024

Seems like this goes beyond the expected behaviour. Maybe make it =2 at least?

@glozow
Copy link
Member

glozow commented Apr 22, 2024

concept ACK fwiw

@instagibbs
Copy link
Member

Seems like this goes beyond the expected behaviour. Maybe make it =2 at least?

Since these are test-network-only changes, are we required to preserve current behavior?

@twosatsmaxi
Copy link

Following.

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/23651574970

@ajtowns ajtowns force-pushed the 202303-acceptnonstdscript branch from 2320ece to affee04 Compare May 16, 2024 15:53
@ajtowns
Copy link
Contributor Author

ajtowns commented May 16, 2024

Bumped past #29086

@luke-jr
Copy link
Member

luke-jr commented Jun 8, 2024

Since these are test-network-only changes, are we required to preserve current behavior?

Whether you are required to or not, it is the correct thing to do. This option originated in Knots where it has always been available on mainnet, and expected to not enable upgradable opcodes/etc.

@achow101 achow101 requested a review from glozow October 15, 2024 15:00
@DrahtBot
Copy link
Contributor

Needs rebase, if still relevant.

@fjahr
Copy link
Contributor

fjahr commented Mar 24, 2025

Concept ACK

@ajtowns ajtowns force-pushed the 202303-acceptnonstdscript branch from 69416ee to 0ab8d4a Compare August 13, 2025 03:08
@ajtowns ajtowns marked this pull request as draft August 14, 2025 22:34
…n=0 node

Prepare for updating -acceptnonstdtxn to allow txns that violate
STANDARD_SCRIPT_VERIFY_FLAGS but not MANDATORY_SCRIPT_VERIFY_FLAGS by
checking the non-mandatory flags with node that enforces standardness.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants