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

Test of BIP9 fork activation of mtp, csv, sequence_lock #8

Closed

Conversation

NicolasDorier
Copy link

#6, while adding lots of tests relating to the implementation of each BIP, removed the old tests which were created for testing the SF activation logic.

I'm not comfortable with the new test which is hard to read, so I expected to keep the old one.
I removed code duplication.

As an added bonus, next SF activation test will be easily created.

@morcos
Copy link

morcos commented Mar 19, 2016

@NicolasDorier can you take a look at the test in 7648 again. It was built off of the the original RPC tests in that pull, which I think contain similar tests for the activation logic that you have in this test. Is there anything in particular that you think is missing?

@NicolasDorier
Copy link
Author

I reviewed your test, and it is great. My only complain is that it test more (and thus harder to read) than the narrow case of testing proper activation of a soft fork via BIP9.

Your test is a shotgun testing csv bips, this one is chirurgical and only catch codepaths added by bitcoin#7648, it is not meant to test csv bips which have already their test in their respective PRs.

Moreover, with my test, when we'll want to test segwit activation for example, it is trivial to do it by just adding a line at https://github.com/btcdrak/bitcoin/pull/8/files#diff-98a8abf7f80dbe5eda93bbbbb4348e80R192

Thus I'd like both of them.

@morcos
Copy link

morcos commented Mar 20, 2016

My thought is that it's not necessary to have multiple tests testing the soft fork activation logic. For instance there are 2 bip65 tests, both of which test the ISM logic, which is already well tested, and none which actually test the bip65 logic itself. I think that accident was more likely to happen because people saw there were bip65 rpc tests and didn't notice they were essentially just repeats of the ISM testing.

I do agree it could be nicer to have the bip9 activation logic as its own test , but then it should only be tested once, and not be repeated for future activations. In that case we could slightly simplify the bip68-112-113 rpc test to remove the various tests around activation.

I'd like to avoid having too many unmaintained and repetitive RPC tests which both become a time sink and make it more difficult to figure out what we are actually testing. That's why I wanted to replace the repeated tests of BIP 9 logic which obscured the fact that we weren't testing BIP's 68,112, or 113.

BTW, there is already an RPC test for segwit, but we do need to flush out a bigger P2P one, I think @sdaftuar is working on that.

@NicolasDorier
Copy link
Author

I do agree it could be nicer to have the bip9 activation logic as its own test , but then it should only be tested once, and not be repeated for future activations. In that case we could slightly simplify the bip68-112-113 rpc test to remove the various tests around activation.

I agree, but frankly I don't think it is worth the effort to change the bip68-112-113 rpc tests now. It does not hurt to have redundancy in the tests, those are rarely changed.

Think about the time saved for future soft fork: There would be two kinds of tests, the one which checks that the ScriptVerify flags act as expected on all weird case (like the current tests on segwit) and the other would just test the ISM boundary in 5 lines of code in bip9-softforks.py test file.

I can work on BIP9 segwit activation later this week on top of this test to show how easy it is to check BIP9 activation with it.
Basically segwit is already very much tested already. Adding the BIP9 activation test should be easy and not requiring retesting everything again.

The less important reason I'd like to keep those tests is that I reviewed, wrote, ran and debugged them a lot more (with @btcdrak) than your test.

@morcos
Copy link

morcos commented Mar 20, 2016

The point I'm trying to make is its not necessary to test the activation for each soft fork. (I assume you mean bip9 and not ISM)

This has been a point of irritation for me because I kept pointing out that BIP 112 at least lacked any RPC testing and more and more copies of BIP 9 testing kept showing up.

In any case, I'm tired of arguing about it. As long as it's only one additional test specifically for bip9 soft fork activation, I don't object, even if it is redundant.

Sent from my iPhone

On Mar 20, 2016, at 1:06 PM, Nicolas Dorier notifications@github.com wrote:

I do agree it could be nicer to have the bip9 activation logic as its own test , but then it should only be tested once, and not be repeated for future activations. In that case we could slightly simplify the bip68-112-113 rpc test to remove the various tests around activation.

I agree, but frankly I don't think it is worth the effort to change the bip68-112-113 rpc tests now. It does not hurt to have redundancy in the tests, those are rarely changed.

Think about the time saved for future soft fork: There would be two kinds of tests, the one who try the ScriptVerify flags specifically as current tests on segwit and testing the ISM boundary would only be a matter of adding 5 lines of code in bip9-softforks.py test file.

I can work on BIP9 segwit activation later this week on top of this test to show how easy it is to check ISM testing with it.
Basically segwit is already very much tested already. Adding the BIP9 activation test should be easy and not requiring retesting everything again.

The less important reason I'd like to keep those tests is that I reviewed, wrote, ran and debugged them a lot more (with @btcdrak) than your test.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub

@NicolasDorier
Copy link
Author

This has been a point of irritation for me because I kept pointing out that BIP 112 at least lacked any RPC testing and more and more copies of BIP 9 testing kept showing up.

I'm not trying to irritate you, just trying to understand a bit why it is problematic. BIP112 and BIP68 were extensively tested already on bitcoin#7524 and bitcoin#7184

The test you made, as far as I see, does not go through new code path that were previously untested. (testing the same thing through RPC does not increase the test code coverage)
BIP68_112_113Test bundle at the same time all what was already tested before + BIP9 activation threshold, that the tests we did covered.

I think tests of BIPs and test of activation should be separated into different tests. But removing BIP68_112_113Test, even if there is test duplication with the previous BIP's PR tests, and the bip9-softforks.py is a waste. And it is only a test, there is no need to bikeshed on it.

I'm surprised you are so irritated of having overlapping test, all those tests increase confidence in the code, and most test don't need to be touched at all once done correctly.
I thought what bothered you when you removed the old tests was the code duplication between the 3 bip activation tests, which is why I fixed it and proposed this PR.

It's better to have overlapped test as we test the code through different point of view.
I think, you are overreacting on the maintainance burden.

@morcos
Copy link

morcos commented Mar 20, 2016

I didn't mean that you had been irritating me. I was just trying to explain why I was a bit exhausted by this subject a priori.

Some things aren't tested well with the unit tests. For instance BIP 68 has consensus critical calculation of prevheights that needs to be separately tested in consensus code. I'm not sure BIP 112 or 113 had any RPC/P2P tests at all, and I think they were important for being comfortable with the testing coverage. It's the same logic by which both of us think we should have regression tests for BIP 9 activation even though that is extensively tested in unit tests.

But you are right, my biggest objection was having 3 BIP 9 activation tests. One is good.

@btcdrak
Copy link
Owner

btcdrak commented Mar 21, 2016

Ok guys, I've cherry-picked it.

@btcdrak btcdrak closed this Mar 21, 2016
maflcko pushed a commit to bitcoin/bitcoin that referenced this pull request Apr 5, 2018
…TestFramework]

9c92c8c [tests] Remove Comparison Test Framework (John Newbery)
e80c640 [tests] Remove bip9-softforks.py (John Newbery)

Pull request description:

  Builds on #11772, #11773 and #11817. Please review those PRs first.

  Final step in #10603.

  - First commit removes bip9-softforks.py.  bip9-sofforks.py was intended to be a generic test for versionbits deployments. However, it only tests CSV activation and was not updated to test segwit activation. CSV activation is tested by bip68-112-113-p2p.py, so this test is duplicated effort. Rather than try to update it to use the BitcoinTestFramework, just remove it. (see btcdrak#8 for previous discussion around the redundancy of bip9-softforks.py)
  - Second commit removes the now unused BitcoinComparisonFramework class and the comptool and blockstore modules.

Tree-SHA512: 4bb7196d521048b3b8ba95c87dde73005a1ac73d29ccbb869f11ce9a71089686e7eacd7335337853041dfbd3a5b110172b105adbada58779814d4db22b1376f5
btcdrak pushed a commit that referenced this pull request Aug 14, 2018
6f53edb Acquire cs_main before ATMP call in block_assemble bench (James O'Beirne)

Pull request description:

  Calling `bench_bitcoin` currently fails due to calling ATMP without acquiring cs_main first in the recently added block_assemble bench (bitcoin#13219).

  ```
  $ cat <(uname -a) <(gcc --version)

  Linux james 4.4.0-119-generic bitcoin#143+jamesob SMP Mon Apr 16 21:47:24 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
  gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609

  $ ./src/bench/bench_bitcoin

  WARNING: This is a debug build - may result in slower benchmarks.
  # Benchmark, evals, iterations, total, min, max, median
  Assertion failed: lock cs_main not held in validation.cpp:566; locks held:
  [1]    19323 abort (core dumped)  ./src/bench/bench_bitcoin
  ```

  ```
  (gdb) bt
  #0  0x00007fbdc9cf5428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
  #1  0x00007fbdc9cf702a in __GI_abort () at abort.c:89
  #2  0x0000555a19580dc5 in AssertLockHeldInternal (pszName=pszName@entry=0x555a19834549 "cs_main",
      pszFile=pszFile@entry=0x555a1988a001 "validation.cpp", nLine=nLine@entry=566, cs=cs@entry=0x555a19ba55c0 <cs_main>) at sync.cpp:157
  #3  0x0000555a194b395f in AcceptToMemoryPoolWorker (chainparams=..., pool=..., state=...,
      ptx=std::shared_ptr (count 1, weak 0) 0x555a1bb819b0, pfMissingInputs=pfMissingInputs@entry=0x0, nAcceptTime=1532964079,
      plTxnReplaced=0x0, bypass_limits=false, nAbsurdFee=@0x7ffcbc1719d8: 0, coins_to_uncache=std::vector of length 0, capacity 0,
      test_accept=false) at validation.cpp:566
  #4  0x0000555a194ba661 in AcceptToMemoryPoolWithTime (chainparams=..., pool=..., state=...,
      tx=std::shared_ptr (count 1, weak 0) 0x555a1bb819b0, pfMissingInputs=pfMissingInputs@entry=0x0, nAcceptTime=<optimized out>,
      plTxnReplaced=0x0, bypass_limits=false, nAbsurdFee=0, test_accept=false) at validation.cpp:998
  #5  0x0000555a194ba7ce in AcceptToMemoryPool (pool=..., state=..., tx=std::shared_ptr (count 1, weak 0) 0x555a1bb819b0,
      pfMissingInputs=pfMissingInputs@entry=0x0, plTxnReplaced=plTxnReplaced@entry=0x0, bypass_limits=bypass_limits@entry=false, nAbsurdFee=0,
      test_accept=false) at validation.cpp:1014
  #6  0x0000555a19363fbe in AssembleBlock (state=...) at bench/block_assemble.cpp:102
  #7  0x0000555a193654d3 in std::_Function_handler<void (benchmark::State&), void (*)(benchmark::State&)>::_M_invoke(std::_Any_data const&, benchmark::State&) (__functor=..., __args#0=...) at /usr/include/c++/5/functional:1871
  #8  0x0000555a193501d7 in std::function<void (benchmark::State&)>::operator()(benchmark::State&) const (this=this@entry=0x555a1ba2cda0,
      __args#0=...) at /usr/include/c++/5/functional:2267
  #9  0x0000555a1934ec4c in benchmark::BenchRunner::RunAll (printer=..., num_evals=5, scaling=<optimized out>, filter=..., is_list_only=false)
      at bench/bench.cpp:121
  #10 0x0000555a1934ade9 in main (argc=<optimized out>, argv=<optimized out>) at bench/bench_bitcoin.cpp:92
  ```

Tree-SHA512: fdd7b28ff123ccea7a4f334d53f735d0c0f94aa9cc52520c2dd34dca45d78c691af64efcd32366fc472fedffbd79591d2be2bb3bfc4a5186e8712b6b452d64e3
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 13, 2019
…TestFramework]

Summary:
9c92c8c [tests] Remove Comparison Test Framework (John Newbery)
e80c640 [tests] Remove bip9-softforks.py (John Newbery)

Pull request description:

  Builds on #11772, #11773 and #11817. Please review those PRs first.

  Final step in #10603.

  - First commit removes bip9-softforks.py.  bip9-sofforks.py was intended to be a generic test for versionbits deployments. However, it only tests CSV activation and was not updated to test segwit activation. CSV activation is tested by bip68-112-113-p2p.py, so this test is duplicated effort. Rather than try to update it to use the BitcoinTestFramework, just remove it. (see btcdrak/bitcoin#8 for previous discussion around the redundancy of bip9-softforks.py)
  - Second commit removes the now unused BitcoinComparisonFramework class and the comptool and blockstore modules.

Tree-SHA512: 4bb7196d521048b3b8ba95c87dde73005a1ac73d29ccbb869f11ce9a71089686e7eacd7335337853041dfbd3a5b110172b105adbada58779814d4db22b1376f5

Backport of Core PR11818
https://github.com/bitcoin/bitcoin/pull/11818/files

Completes T669

Test Plan: `test_runner.py`

Reviewers: #bitcoin_abc, deadalnix, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

None yet

3 participants