test: mempool compatibility test #19153

pull S3RK wants to merge 1 commits into bitcoin:master from S3RK:feature/mempool_compatibility_test changing 2 files +79 −0
  1. S3RK commented at 9:22 AM on June 3, 2020: member

    Rationale: Verify mempool.dat compatibility between versions

    The format of mempool.dat has been changed in #18038 The tests verifies the fix made in #18807 and ensures that the file format is compatible between current version and v0.19.1 The test verifies both backward and forward compatibility.

    This PR also adds a log when we fail to add a tx loaded from mempool.dat. It was useful when debugging this test and could be potentially useful to debug other scenarios as well.

    Closes #19037

  2. fanquake added the label Tests on Jun 3, 2020
  3. S3RK renamed this:
    Feature/mempool compatibility test
    test: mempool compatibility test
    on Jun 3, 2020
  4. S3RK force-pushed on Jun 3, 2020
  5. in test/functional/mempool_compatibility.py:17 in fe4a271bf6 outdated
      12 | +
      13 | +from test_framework.test_framework import BitcoinTestFramework
      14 | +
      15 | +class MempoolCompatibilityTest(BitcoinTestFramework):
      16 | +    def set_test_params(self):
      17 | +        self.setup_clean_chain = True
    


    MarcoFalke commented at 11:19 AM on June 3, 2020:

    If you remove this line, you can also remove the whole "Generate some coins on both wallets" part


    S3RK commented at 12:20 PM on June 3, 2020:

    It didn't work for me for some reason, though I don't fully understand yet how chain generation works in tests. I'll try this again tomorrow and will get back with an update


    S3RK commented at 8:12 AM on June 4, 2020:

    I figured it out. I forgot to manually import coinbase keys in setup_nodes(), it works now. Thanks for the suggestion.

  6. MarcoFalke approved
  7. MarcoFalke commented at 11:21 AM on June 3, 2020: member

    Nice first contribution! ACK with or without the nit addressed

  8. practicalswift commented at 7:13 PM on June 3, 2020: contributor

    Concept ACK

    What a nice first-time contribution!

    Warm welcome as a contributor @S3RK - I hope to see more great contributions from you in the future :)

  9. S3RK force-pushed on Jun 4, 2020
  10. laanwj commented at 2:59 PM on June 4, 2020: member

    Concept ACK. I don't think we can always guarantee that the mempool file will be backwards compatible, but it's good to have a test to be sure that compatibility at least isn't accidentally broken.

  11. in test/functional/mempool_compatibility.py:8 in cd583385b7 outdated
       0 | @@ -0,0 +1,69 @@
       1 | +#!/usr/bin/env python3
       2 | +# Copyright (c) 2017-2020 The Bitcoin Core developers
       3 | +# Distributed under the MIT software license, see the accompanying
       4 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5 | +"""Test that mempool.dat is compatible between versions
       6 | +
       7 | +Download node binaries:
       8 | +contrib/devtools/previous_release.sh -b v0.19.1
    


    Sjors commented at 11:03 AM on June 8, 2020:

    nit: I prefer to have the same instruction in all test files that require previous releases, because otherwise other tests fail when they have some versions but not all. Try:

    contrib/devtools/previous_release.sh -b v0.19.1 v0.18.1 v0.17.1 v0.16.3 v0.15.2
    
    Only v0.19.1 is required by this test. The rest is used in other backwards compatibility tests.
    
  12. in test/functional/mempool_compatibility.py:25 in cd583385b7 outdated
      20 | +        self.skip_if_no_wallet()
      21 | +        self.skip_if_no_previous_releases()
      22 | +
      23 | +    def setup_nodes(self):
      24 | +        self.add_nodes(self.num_nodes, versions=[
      25 | +            190100,
    


    Sjors commented at 11:05 AM on June 8, 2020:

    Suggest documenting what's interesting about that version, could be a link to Github issue.

  13. in test/functional/mempool_compatibility.py:5 in cd583385b7 outdated
       0 | @@ -0,0 +1,69 @@
       1 | +#!/usr/bin/env python3
       2 | +# Copyright (c) 2017-2020 The Bitcoin Core developers
       3 | +# Distributed under the MIT software license, see the accompanying
       4 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5 | +"""Test that mempool.dat is compatible between versions
    


    Sjors commented at 11:07 AM on June 8, 2020:

    Suggest adding a comment like what @laanwj said:

    I don't think we can always guarantee that the mempool file will be backwards compatible, but it's good to have a test to be sure that compatibility at least isn't accidentally broken.

  14. Sjors commented at 11:13 AM on June 8, 2020: member

    Concept ACK. f0b2579 looks good modulo some comments.

    Suggest making a separate PR for cd58338, ideally with a test.

  15. S3RK commented at 8:10 AM on June 9, 2020: member

    @Sjors thanks for the review. I've pushed a fixup commit to address your suggestions. Once the PR is ready to be merged I will squash it into the original commit.

    Suggest making a separate PR for cd58338, ideally with a test.

    I'm not sure this tiny change deserves a PR and a separate discussion on its own 😄. To clarify the impact to log chattiness, the code path in question is executed only during initial mempool load, so it won't repeatedly produce tons of logs. But maybe I'm failing to consider some other possible negative outcomes.

  16. Sjors commented at 3:00 PM on June 9, 2020: member

    The new changes look good.

    Log chattiness could be one concern, e.g. when loading a 1 GB mempool with broken entries, but also there's no test. Touching validation.cpp generally instills fear :-)

  17. test: mempool.dat compatibility between versions 16d4b3fd6d
  18. S3RK force-pushed on Jun 10, 2020
  19. S3RK commented at 4:06 AM on June 10, 2020: member

    Squashed the changes, removed log commit

  20. in test/functional/mempool_compatibility.py:36 in 16d4b3fd6d
      31 | +    def setup_network(self):
      32 | +        self.add_nodes(self.num_nodes, versions=[
      33 | +            150200, # oldest version supported by the test framework
      34 | +            None,
      35 | +        ])
      36 | +        adjust_bitcoin_conf_for_pre_17(self.nodes[0].bitcoinconf)
    


    adamjonas commented at 2:12 PM on June 11, 2020:

    It looks like other instances of adjust_bitcoin_conf_for_pre_17 have left comments as to why it's used. I think it'd be helpful to include here as well.


    S3RK commented at 1:33 PM on June 12, 2020:

    If you believe the code is unclear, we need to think of a better way to fix it rather than putting the same comment before each function call. For example: give this function a better name. But as for me, I think the function name speaks for itself and it doesn't need any clarifying comment.


    Sjors commented at 10:37 AM on June 16, 2020:

    I think it's fine to call this without comment; it's always necessary for nodes before 0.17. Ideally the test framework (add_nodes) takes care of it automagically.

  21. S3RK requested review from Sjors on Jun 16, 2020
  22. Sjors approved
  23. Sjors commented at 10:46 AM on June 16, 2020: member

    tACK 16d4b3fd6d5aad18ebb731a5006a15180d3661ef

    P.S. for increased glory you could sign your commits

  24. MarcoFalke merged this on Jun 16, 2020
  25. MarcoFalke closed this on Jun 16, 2020

  26. sidhujag referenced this in commit 7dda7c0a8c on Jul 7, 2020
  27. S3RK deleted the branch on Sep 25, 2020
  28. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me