Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Apr 25, 2019

I don't see a reason why regtest should allow non-standard txs, as it makes testing mainnet behaviour such as #15846 unnecessarily hard and unintuitive.

Of course, testnet policy remains unchanged to allow propagation of non-standard txs.

@fanquake fanquake added the Tests label Apr 25, 2019
@gmaxwell
Copy link
Contributor

Sounds good to me.

@harding
Copy link
Contributor

harding commented Apr 25, 2019

Yes, please.

@sdaftuar
Copy link
Member

Concept ACK.

FYI I found the title of the PR and the PR description a bit confusing, because it wasn't clear to me if this was going to make it so that we would be able to configure a regtest node to accept non-standard transactions, or if regtest would be treated the same as mainnet and it would not be allowed at all.

@maflcko maflcko changed the title test: Require standard txs in regtest test: Require standard txs in regtest by default Apr 25, 2019
@maflcko
Copy link
Member Author

maflcko commented Apr 25, 2019

Adjusted title as requested by @sdaftuar

Also, please review commit-by-commit. The first commit is a cleanup of (8d1de43 Remove internal miner), the others are explained in the commit subject line.

@jnewbery
Copy link
Contributor

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 25, 2019

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #16264 (policy: Add experimental -mempoolreplacement=full (off by default) by MarcoFalke)
  • #16060 (Bury bip9 deployments by jnewbery)
  • #15169 (Parallelize CheckInputs() in AcceptToMemoryPool() by sdaftuar)
  • #10102 ([experimental] Multiprocess bitcoin by ryanofsky)

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.

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

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

tACK faac8a2 on macOS 10.14.4 and Ubuntu 18.04

Copy link
Member

Choose a reason for hiding this comment

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

I can confirm this is needed to pass the test, but I'm confused why.

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 spends from anyone-can-spend "padded" scriptPubKeys such as CScript([b'a' * 35])

@luke-jr
Copy link
Member

luke-jr commented May 1, 2019

Concept NACK. Tests affected by policy (other than tests for the policy itself) are broken. Not enforcing policy on such tests helps improve test quality.

@laanwj
Copy link
Member

laanwj commented May 6, 2019

I don't particularly like re-introducing a chain type enumeration. The introduction of the ChainParams structure was supposed to make the entire chain information data-driven (with a possibility to add custom hybrid chain types for specific testing, for example, in the future), and this seems a step back from this by making it easier to match on "chain type" instead of add a bit/parameter to the structure for a specific property.

@luke-jr
Copy link
Member

luke-jr commented May 6, 2019

Perhaps instead it should be toggled in the test framework's default options?

@maflcko
Copy link
Member Author

maflcko commented May 6, 2019

In this case the property really is IsMainnet, which does not have a bit allocated in the struct.

Personally, I don't see why an enumeration can not have an additional type ChainType::CUSTOM_HYBRID if needed. But if I am also happy to use string matching on the chain name (could lead to weird run-time behavior) or add a bit to indicate if the params are the mainnet params.

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

tested ACK faac8a22faa62dcde3ded60063eff8beb042bafb

A few small suggestions inline

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest you just remove this. We don't usually specify config in tests where it's the default.

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 think it is easier to read due to symmetry

Copy link
Contributor

Choose a reason for hiding this comment

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

as above, I suggest you remove "-acceptnonstdtxn=0" from here since it's default config

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 think it is easier to read due to symmetry

@maflcko maflcko force-pushed the 1904-testRequireStandard branch from faac8a2 to faf3ba4 Compare May 22, 2019 18:22
@maflcko
Copy link
Member Author

maflcko commented May 22, 2019

Remove the two intermediate enum class ChainType refactoring commits (thanks for the review @sipa and @laanwj) and fixed up the release notes in the last commit (thanks for the review @practicalswift, @Sjors and @jnewbery)

@maflcko maflcko closed this May 22, 2019
@maflcko maflcko reopened this May 22, 2019
@maflcko maflcko force-pushed the 1904-testRequireStandard branch from faf3ba4 to faa4cba Compare May 22, 2019 21:01
@maflcko
Copy link
Member Author

maflcko commented May 22, 2019

Sorry had to rebase due to silent merge conflicts in the tests

@jnewbery
Copy link
Contributor

utACK cd338016f5663703cd6eb87bd4403a8fcb4f27a9

@maflcko
Copy link
Member Author

maflcko commented May 24, 2019

@jnewbery Looks like you posted this on the wrong repo?

@jnewbery
Copy link
Contributor

Oops. Sorry, I rebased this PR on a later master which is how I got the cd33801.. hash.

utACK faa36e1303773bec382600cb70ccd65eb5bbd33b

@maflcko maflcko force-pushed the 1904-testRequireStandard branch from faa36e1 to fa14bda Compare June 18, 2019 19:41
@maflcko
Copy link
Member Author

maflcko commented Jun 18, 2019

Rebased due to conflict in a test file

@maflcko maflcko force-pushed the 1904-testRequireStandard branch from fa14bda to fa70308 Compare June 19, 2019 22:06
Copy link
Member

Choose a reason for hiding this comment

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

Most tests shouldn't care about tx policy (only policy-specific tests should), so this should be set by default in the test framework.

Copy link
Contributor

Choose a reason for hiding this comment

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

Disagree with the conclusion here -- most tests should be working with std transactions, so there should be an error reported when a non-std tx is accidently used. Having tests that do use non-std txs declare it explicitly seems right to me.

Copy link
Member

Choose a reason for hiding this comment

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

Tests should not begin to fail just because the node policy changes (unless those tests are specifically covering policy code).

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

ACK fa70308485b2b8cca371581966f40dfcb7efd9fb modulo one requested change to the release notes.

@maflcko maflcko force-pushed the 1904-testRequireStandard branch 2 times, most recently from fa2a0ce to fad7722 Compare June 20, 2019 16:56
@jnewbery
Copy link
Contributor

ACK fad77227b2b5df547d59bc226b652663aa8bf185

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

Approach ACK, not keen on "user can change chain params" naming, but the rest looks good to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Disagree with the conclusion here -- most tests should be working with std transactions, so there should be an error reported when a non-std tx is accidently used. Having tests that do use non-std txs declare it explicitly seems right to me.

@maflcko maflcko force-pushed the 1904-testRequireStandard branch from fad7722 to fabf87d Compare June 21, 2019 20:21
@maflcko maflcko force-pushed the 1904-testRequireStandard branch from fabf87d to fa89bad Compare June 21, 2019 20:45
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
/** Whether it is possible to mine blocks on demand (no retargeting) */
bool MineBlocksOnDemand() const { return consensus.fPowNoRetargeting; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why the most newly introduced but redundant one is removed instead of the other way around, but not important.


fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
if (chainparams.RequireStandard() && !fRequireStandard)
if (!chainparams.IsTestChain() && !fRequireStandard) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't even know it was forbidden to use -acceptnonstdtxn=1 on mainchain...
Anyway, I don't like IsTestChain much, it is not descriptive. What about forbid_nonstd?
Or Leave this at RequireStandard and separate another DefaultRequireStandard or DefaultAcceptNonStd like @sipa suggested?

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 am happy to extend the docstring of IsTestChain if it is not descriptive enough, but I'd like to keep it unless others agree that it should go.

I think it is useful to have a single boolean param to indicate whether the chain's purpose is test-only.

@jtimon
Copy link
Contributor

jtimon commented Jun 22, 2019

utACK beyond nits.

@ajtowns
Copy link
Contributor

ajtowns commented Jun 25, 2019

ACK fa89bad

@maflcko
Copy link
Member Author

maflcko commented Jun 27, 2019

This will be merged next week Wednesday, unless there are objections.

@maflcko maflcko merged commit fa89bad into bitcoin:master Jul 16, 2019
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jul 16, 2019
fa89bad test: Require standard txs in regtest (MarcoFalke)
fa9b419 test: Add test that mainnet requires standard txs (MarcoFalke)
fa613ca chainparams: Remove unused fMineBlocksOnDemand (MarcoFalke)

Pull request description:

  I don't see a reason why regtest should allow non-standard txs, as it makes testing mainnet behaviour such as bitcoin#15846 unnecessarily hard and unintuitive.

  Of course, testnet policy remains unchanged to allow propagation of non-standard txs.

ACKs for top commit:
  ajtowns:
    ACK fa89bad

Tree-SHA512: c4c675affb054868850bd2683aa07f4c741a448cbacb2ea8334191e105f426b0790fe6a468be61e9c5880d24154f7bf1c7075051697172dce92180c1bc3a1c90
@maflcko maflcko deleted the 1904-testRequireStandard branch July 16, 2019 20:13
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 29, 2019
fa89bad test: Require standard txs in regtest (MarcoFalke)
fa9b419 test: Add test that mainnet requires standard txs (MarcoFalke)
fa613ca chainparams: Remove unused fMineBlocksOnDemand (MarcoFalke)

Pull request description:

  I don't see a reason why regtest should allow non-standard txs, as it makes testing mainnet behaviour such as bitcoin#15846 unnecessarily hard and unintuitive.

  Of course, testnet policy remains unchanged to allow propagation of non-standard txs.

ACKs for top commit:
  ajtowns:
    ACK fa89bad

Tree-SHA512: c4c675affb054868850bd2683aa07f4c741a448cbacb2ea8334191e105f426b0790fe6a468be61e9c5880d24154f7bf1c7075051697172dce92180c1bc3a1c90
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 20, 2020
Summary:
fa89badf887dcc01e5bdece248b5e7d234fee227 test: Require standard txs in regtest (MarcoFalke)
fa9b4191609c3ef75e69d391eb91e4d5c1e0bcf5 test: Add test that mainnet requires standard txs (MarcoFalke)
fa613ca0a8f99c4771859de9e571878530d3ecb5 chainparams: Remove unused fMineBlocksOnDemand (MarcoFalke)

Pull request description:

  I don't see a reason why regtest should allow non-standard txs, as it makes testing mainnet behaviour such as #15846 unnecessarily hard and unintuitive.

  Of course, testnet policy remains unchanged to allow propagation of non-standard txs.

ACKs for top commit:
  ajtowns:
    ACK fa89badf887dcc01e5bdece248b5e7d234fee227

Tree-SHA512: c4c675affb054868850bd2683aa07f4c741a448cbacb2ea8334191e105f426b0790fe6a468be61e9c5880d24154f7bf1c7075051697172dce92180c1bc3a1c90

---

This is a backport of Core [[bitcoin/bitcoin#15891 | PR15891]], plus changing our own tests to allow for non-standard transactions and prevent them from failing under the new rule.

Test Plan:
  ninja check
  ./test_runner.py --extended

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5764
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
Summary:
fa89badf887dcc01e5bdece248b5e7d234fee227 test: Require standard txs in regtest (MarcoFalke)
fa9b4191609c3ef75e69d391eb91e4d5c1e0bcf5 test: Add test that mainnet requires standard txs (MarcoFalke)
fa613ca0a8f99c4771859de9e571878530d3ecb5 chainparams: Remove unused fMineBlocksOnDemand (MarcoFalke)

Pull request description:

  I don't see a reason why regtest should allow non-standard txs, as it makes testing mainnet behaviour such as #15846 unnecessarily hard and unintuitive.

  Of course, testnet policy remains unchanged to allow propagation of non-standard txs.

ACKs for top commit:
  ajtowns:
    ACK fa89badf887dcc01e5bdece248b5e7d234fee227

Tree-SHA512: c4c675affb054868850bd2683aa07f4c741a448cbacb2ea8334191e105f426b0790fe6a468be61e9c5880d24154f7bf1c7075051697172dce92180c1bc3a1c90

---

This is a backport of Core [[bitcoin/bitcoin#15891 | PR15891]], plus changing our own tests to allow for non-standard transactions and prevent them from failing under the new rule.

Test Plan:
  ninja check
  ./test_runner.py --extended

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5764
@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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.