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

acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only #6329

Merged
merged 1 commit into from Jul 3, 2015

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Jun 24, 2015

Inspired by #6255, this makes it possible to enable IsStandard for regtest/testnet (but doesn't allow disabling it on mainnet), while remaining compatible with long-standing options in other node software.

@@ -396,6 +396,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-testnet", _("Use the test network"));

strUsage += HelpMessageGroup(_("Node relay options:"));
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf(_("Relay and mine \"non-standard\" transactions (testing only; default: %u)"), 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is confusing, as it doesn't make clear that the default is true on testnet and regtest.

Copy link
Member Author

Choose a reason for hiding this comment

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

How would you improve it?

Copy link

Choose a reason for hiding this comment

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

One possibility: "Relay and mine \"non-standard\" transactions (testnet/regtest only, default: true)"

Edit: Want to clarify that a bit, I believe petertodd is confused by the default flag displayed ('0') when the actual flag setting code uses !Params().RequireStandard() defaulting true for testnet/regtest

Copy link
Contributor

Choose a reason for hiding this comment

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

@faizkhan00 Yup, that's exactly the issue I'm worried about.

I think your wording is fine, modulo s/true/1/

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@luke-jr luke-jr force-pushed the testnet_nonstdtxn branch 3 times, most recently from 811bff3 to f749607 Compare June 29, 2015 05:39
@petertodd
Copy link
Contributor

Modulo wording nit, tested ACK.

I'll close #6255 if this gets merged.

@luke-jr
Copy link
Member Author

luke-jr commented Jun 30, 2015

Changed...

@luke-jr luke-jr force-pushed the testnet_nonstdtxn branch 3 times, most recently from 953f36e to 35853d9 Compare July 1, 2015 03:09
@@ -396,6 +396,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-testnet", _("Use the test network"));

strUsage += HelpMessageGroup(_("Node relay options:"));
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf(_("Relay and mine \"non-standard\" transactions (%sdefault: %u)"), _("testnet/regtest only; "), !Params(CBaseChainParams::TESTNET).RequireStandard()));
Copy link
Member

Choose a reason for hiding this comment

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

This should be part of the debugging options (if(showDebug)). Consequently, also the message should be left un-translated.

@laanwj
Copy link
Member

laanwj commented Jul 3, 2015

utACK apart rom translation nits

@luke-jr
Copy link
Member Author

luke-jr commented Jul 3, 2015

Removed translation tags.

@@ -396,6 +396,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-testnet", _("Use the test network"));

strUsage += HelpMessageGroup(_("Node relay options:"));
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !Params(CBaseChainParams::TESTNET).RequireStandard()));
Copy link
Member

Choose a reason for hiding this comment

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

Also add if(showDebug)

@luke-jr
Copy link
Member Author

luke-jr commented Jul 3, 2015

showDebug done

@laanwj laanwj merged commit 0c37634 into bitcoin:master Jul 3, 2015
laanwj added a commit that referenced this pull request Jul 3, 2015
0c37634 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only (Luke Dashjr)
@jtimon
Copy link
Contributor

jtimon commented Jul 6, 2015

How did I missed this while being so insistent with @luke-jr and @petertodd about #5180 ...this is the wrong way to expose this...instead of -acceptnonstdtxn you would have just used -policy=test.

@@ -803,6 +805,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(strprintf(_("Invalid amount for -minrelaytxfee=<amount>: '%s'"), mapArgs["-minrelaytxfee"]));
}

fRequireStandard = !GetBoolArg("-acceptnonstdtxn", !Params().RequireStandard());
if (Params().RequireStandard() && !fRequireStandard)
Copy link
Contributor

Choose a reason for hiding this comment

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

The semantics are wrong, why would the user be prevented from overrriding a particular chain's default?
This check is completely unnecessary.
Also, any reason to name the variable amd the option as opposites (instead of both RequireStandard or both acceptnonstdtxn)?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's actually pretty dangerous to override the IsStandard() check on mainnet if you are a miner; you can end up creating blocks that take unreasonable amounts of time to verify, losing money.

Best go force people to edit the source code to so that.

Anyway, this is mainly useful for testing applications, so no need IMO to make this into a complex game of policy stuff when a simple and intuitive flag works.

Copy link
Contributor

Choose a reason for hiding this comment

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

@petertodd Then miners shouldn't use this option and it can be documented. There's more users besides miners who may be interested in accepting non-std transactions and give the choice to the users instead of endlessly discuss the best default or how hard should it be to change it for less and more technical users.
This particularly surprises me because @luke-jr once said "the testing policy is actually a sane policy to run in production", supposedly as an argument in favor of "-acceptnonstdtxn=0/1" over "policy=standard/test".
Actually, prohibiting the option in certain chains adds more code complexity and couples CStandardPolicy to Params() forever.
I'm sure nobody would be in favor of prohibiting the -datacarriersize option for the main chain. master...jtimon:safe-configurable-policy
"Bitcoin core, now with configurable policy that is only configurable for testnet and regtest".

Copy link
Contributor

Choose a reason for hiding this comment

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

@jtimon There's DoS attacks that IsStandard() prevents.

Anyway, without peers that also accept your non-default transactions, changing policy locally is pretty pointless; solve that issue first. One idea would be a hashcash-based relay network, maybe using Bitmessage if you want to get it implemented quickly.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jtimon There's DoS attacks that IsStandard() prevents.

There's DoS attacks that minRelayTxFee prevents, yet still -minrelaytxfee=1 is allowed (and -minrelaytxfee=0 should be allowed as well IMO).

Anyway, without peers that also accept your non-default transactions, changing policy locally is pretty pointless; solve that issue first.

No, I'm fixing this first. Solve that yourself if you want to.
I've been wanting to expose this option as -policy=test for very long (#5180). Then 2 competing PRs appear and one of them gets merged very fast. Nobody asked me for review (even though I had been very insistent demanding review for #5180 myself) and thus I wasn't able to nit the proposals and thus what was merged us wrong, and I can fix some of the mistakes for free in #6068. #5180 couldn't be fairly compared with #6329 without some previous steps (#6068 among them) that are taking forever to review, but whatever, what's done it's done.

Anyway, if "changing policy locally is pretty pointless" then nobody will do it and we don't need to maintain this additional stupid restriction, do we?

Copy link
Contributor

Choose a reason for hiding this comment

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

Anyway, enough discussion. Please ack/nack jtimon@2d71478 in #6068 so that we can move on.

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants