[Qt] implements concept for different disk sizes on intro #13216

pull marcoagner wants to merge 1 commits into bitcoin:master from marcoagner:fix_testnet_disk_usage_msg changing 7 files +40 −12
  1. marcoagner commented at 1:29 pm on May 11, 2018: contributor

    Fixes #13213. Mostly, I layed out the concept to open the PR for refinement and getting feedback if the approach is okay. Changes are expected.

    Two points:

    • The values for both new consts TESTNET_BLOCK_CHAIN_SIZE and TESTNET_CHAIN_STATE_SIZE is certainly not optimal; I just checked the size of my testnet3 related dirs and set them to little bit higher values. Which values should be used?
    • Should we do something like this to regtest? Or these “niceties” do not matter when on regtest?

    Thanks!

  2. marcoagner renamed this:
    [qt] implements concept for different disk sizes on intro
    [Qt] implements concept for different disk sizes on intro
    on May 11, 2018
  3. fanquake added the label GUI on May 11, 2018
  4. ghost commented at 5:32 pm on May 11, 2018: none
    Tested on Ubuntu 16.04: Image Nano nit: ‘200GB’/‘15GB’ should be ‘200 GB’/‘15 GB’ for the sake of consistency.
  5. sipa commented at 5:33 pm on May 11, 2018: member

    Thanks for addressing this issue.

    We generally try to avoid having explicit branching on the network type. Instead, I would suggest adding a variable to CChainParams (which is initialized differently in the different network versions).

  6. marcoagner commented at 7:37 pm on May 11, 2018: contributor
    Okay, thanks! This will be cleaner. I will update this PR with the CChainParams approach.
  7. MarcoFalke commented at 8:22 pm on May 11, 2018: member

    I will update this PR with the CChainParams approach.

    Don’t forget to update the release process document as well.

  8. promag commented at 4:24 pm on May 12, 2018: member
    Concept ACK.
  9. practicalswift commented at 8:39 pm on May 12, 2018: contributor
    Concept ACK
  10. jonasschnelli commented at 8:07 am on May 14, 2018: contributor
    utACK,… maybe simplify the code according to https://github.com/bitcoin/bitcoin/pull/13229
  11. marcoagner commented at 8:41 am on May 14, 2018: contributor

    @jonasschnelli, if #13229 is acceptable, I prefer dropping this PR in favor of #13229. No need to re-do the work here and your approach seems better.

    Just as a heads up, it seems that #13229 also explicitly branches the network type (see @sipa’s suggestion above). I’m new to the code base and I can’t tell for sure if using CChainParams for this Qt issue will be better for the rest of the code as a whole.

    What do you think?

  12. MarcoFalke commented at 3:40 pm on May 23, 2018: member
    I think it is fine to put it in chainparams, if you call it m_assumed_size (similar to “assumed valid”).
  13. jonasschnelli commented at 8:54 am on May 25, 2018: contributor

    @jonasschnelli, if #13229 is acceptable, I prefer dropping this PR in favor of #13229. No need to re-do the work here and your approach seems better.

    Please continue with this and feel free to grab code from 13229…

    I had the feeling that this would be GUI only and not appropriate to put Into the chainparams holder… but @sipa and @MarcoFalke think its better there which I guess they are right…

  14. in doc/release-process.md:25 in d9ac4a243a outdated
    22@@ -23,6 +23,7 @@ Before every major release:
    23 
    24 * Update hardcoded [seeds](/contrib/seeds/README.md), see [this pull request](https://github.com/bitcoin/bitcoin/pull/7415) for an example.
    25 * Update [`BLOCK_CHAIN_SIZE`](/src/qt/intro.cpp) to the current size plus some overhead.
    


    sipa commented at 6:09 pm on May 28, 2018:
    This line can be removed now.

    marcoagner commented at 6:16 pm on May 28, 2018:
    ooops, okay
  15. in src/chainparams.cpp:324 in d9ac4a243a outdated
    320@@ -317,6 +321,8 @@ class CRegTestParams : public CChainParams {
    321         pchMessageStart[3] = 0xda;
    322         nDefaultPort = 18444;
    323         nPruneAfterHeight = 1000;
    324+        m_assumed_blockchain_size = 200;
    


    sipa commented at 6:10 pm on May 28, 2018:
    This sounds a bit excessive for regtest.

    marcoagner commented at 6:17 pm on May 28, 2018:
    do you have any suggestion for this value? thanks

    sipa commented at 6:21 pm on May 28, 2018:

    0 or 1? :)

    It doesn’t matter, and it’s also unpredictable, as it depends on what blocks are created (regtest is purely for testing purposes, and all blocks are typically explicitly created in the test; there is no real network).

  16. in src/qt/intro.cpp:15 in d9ac4a243a outdated
    11@@ -12,6 +12,7 @@
    12 
    13 #include <qt/guiutil.h>
    14 
    15+#include <chainparams.h>
    


    sipa commented at 6:10 pm on May 28, 2018:
    You can’t include core files directly (this is part of ongoing work to separate the two more cleanly); you’ll need to go through the node interface (see the include below).

    marcoagner commented at 6:19 pm on May 28, 2018:
    I see! Thank you, I will fix this as soon as I get back.
  17. marcoagner commented at 10:27 am on May 29, 2018: contributor
    Updated do address @sipa’s review. My only comment for now is that the intro message is a bit funny warning that you need at least 0GB… even though that’s accurate. :) The message already didn’t totally reflect regtest’s reality anyway but let me know if anybody thinks this should be addressed for some reason I can’t think of.
  18. DrahtBot added the label Needs rebase on Aug 8, 2018
  19. DrahtBot removed the label Needs rebase on Sep 28, 2018
  20. DrahtBot commented at 8:19 pm on September 28, 2018: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #15114 (Qt: Replace remaining 0 with nullptr by Empact)
    • #15112 (build: Optionally enable -Wzero-as-null-pointer-constant by Empact)

    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.

  21. in src/qt/intro.cpp:29 in 82b5faa871 outdated
    28-static const uint64_t CHAIN_STATE_SIZE = 3;
    29+/* Total required space (in GB) depending on user choice (prune, not prune) */
    30+static uint64_t requiredSpace;
    31+
    32+/* Check free space asynchronously to prevent hanging the UI thread.
    33 /* Total required space (in GB) depending on user choice (prune, not prune) */
    


    practicalswift commented at 9:24 am on October 7, 2018:
    Please note that the comment is already opened with /* on the line above :-)
  22. in src/qt/intro.cpp:26 in 82b5faa871 outdated
    21@@ -22,10 +22,10 @@
    22 #include <cmath>
    23 
    24 static const uint64_t GB_BYTES = 1000000000LL;
    25-/* Minimum free space (in GB) needed for data directory */
    26-constexpr uint64_t BLOCK_CHAIN_SIZE = 220;
    27-/* Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */
    28-static const uint64_t CHAIN_STATE_SIZE = 3;
    29+/* Total required space (in GB) depending on user choice (prune, not prune) */
    30+static uint64_t requiredSpace;
    


    practicalswift commented at 9:25 am on October 7, 2018:
    Please note that requiredSpace is redefined four lines below :-)
  23. implements different disk sizes for different networks on intro
    - Creates m_assumed_blockchain_size and m_assumed_chain_state_size on CChainParams.
    - Implements access to CChainParams' m_assumed_blockchain_size and m_assumed_chain_state_size on node interface.
    - Implements m_assumed_blockchain_size and m_assumed_chain_state_size on qt/intro via node interface.
    - Updates release process document with the new CChainParam's values.
    9d0e52834b
  24. in src/qt/intro.cpp:209 in 82b5faa871 outdated
    202@@ -201,8 +203,15 @@ bool Intro::pickDataDirectory(interfaces::Node& node)
    203 
    204     if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || gArgs.GetBoolArg("-resetguisettings", false))
    205     {
    206+        /* Use selectParams here to guarantee Params() can be used by node interface */
    207+        try {
    208+            node.selectParams(gArgs.GetChainName());
    209+        } catch(std::exception) {
    


    practicalswift commented at 9:26 am on October 7, 2018:
    Should catch by reference instead of value. Also missing space before ( :-)

    marcoagner commented at 12:13 pm on October 7, 2018:
    Except this one, other issues were caused by a (obviously bad) merge conflict resolution - bad. I’ll take a lot more care so it doesn’t happen again. Thank you for taking the time to review it.
  25. sipa commented at 2:14 am on October 23, 2018: member
    Concept ACK. Code review ACK for non-Qt code 9d0e52834bbd38e7c7410bcb09ef85d157968b04
  26. jonasschnelli commented at 7:18 am on October 23, 2018: contributor
    Re-utACK 9d0e52834bbd38e7c7410bcb09ef85d157968b04
  27. MarcoFalke commented at 8:20 pm on October 23, 2018: member
    utACK 9d0e52834bbd38e7c7410bcb09ef85d157968b04 non-qt code.
  28. in src/qt/intro.cpp:206 in 9d0e52834b
    198@@ -201,8 +199,15 @@ bool Intro::pickDataDirectory(interfaces::Node& node)
    199 
    200     if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || gArgs.GetBoolArg("-resetguisettings", false))
    201     {
    202+        /* Use selectParams here to guarantee Params() can be used by node interface */
    203+        try {
    204+            node.selectParams(gArgs.GetChainName());
    205+        } catch (const std::exception&) {
    206+            return false;
    


    MarcoFalke commented at 11:59 am on October 24, 2018:
    Note that this will hide all error messages from selectParams
  29. marcoagner commented at 4:56 pm on January 11, 2019: contributor
    Should anything else be done to have this merged?
  30. jonasschnelli commented at 0:32 am on January 12, 2019: contributor
    Tested ACK 9d0e52834bbd38e7c7410bcb09ef85d157968b04
  31. jonasschnelli merged this on Jan 12, 2019
  32. jonasschnelli closed this on Jan 12, 2019

  33. jonasschnelli referenced this in commit 84d0fdce11 on Jan 12, 2019
  34. marcoagner commented at 12:14 pm on January 12, 2019: contributor
    Thank you for testing, @jonasschnelli.
  35. in src/chainparams.cpp:110 in 9d0e52834b
    106@@ -107,6 +107,8 @@ class CMainParams : public CChainParams {
    107         pchMessageStart[3] = 0xd9;
    108         nDefaultPort = 8333;
    109         nPruneAfterHeight = 100000;
    110+        m_assumed_blockchain_size = 200;
    


    MarcoFalke commented at 8:51 pm on January 13, 2019:
    This used to be 220?

    marcoagner commented at 10:16 pm on January 13, 2019:
    Well spotted, thanks! This was 200 when the PR was first made but changed down the line with this maintenance for 0.17: https://github.com/bitcoin/bitcoin/commit/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb. Do you think this should be addressed here or could wait for the next maintenance (since the release process now asks for this to be changed)?

    MarcoFalke commented at 4:25 pm on January 14, 2019:
    Could bump it to 240 before 0.18 is branched, so we don’t forget about it?

    marcoagner commented at 5:45 pm on January 16, 2019:
  36. in src/qt/intro.cpp:210 in 9d0e52834b
    206+            return false;
    207+        }
    208+
    209         /* If current default data directory does not exist, let the user choose one */
    210-        Intro intro;
    211+        Intro intro(0, node.getAssumedBlockchainSize(), node.getAssumedChainStateSize());
    


    MarcoFalke commented at 8:52 pm on January 13, 2019:
    s/0/nullptr/

    marcoagner commented at 5:47 pm on January 16, 2019:
    Is another PR for this okay?
  37. MarcoFalke commented at 8:52 pm on January 13, 2019: member
    Some post-merge observations
  38. MarcoFalke referenced this in commit 38989ab03f on Feb 14, 2019
  39. deadalnix referenced this in commit 64985f922e on Apr 17, 2020
  40. ftrader referenced this in commit b8af70ae81 on Aug 17, 2020
  41. Munkybooty referenced this in commit b0b8e2eacc on Aug 21, 2021
  42. Munkybooty referenced this in commit 78e7aa6878 on Aug 23, 2021
  43. Munkybooty referenced this in commit d21dc24697 on Aug 24, 2021
  44. Munkybooty referenced this in commit 3de3107dd0 on Aug 24, 2021
  45. Munkybooty referenced this in commit 66c547a2dd on Aug 24, 2021
  46. UdjinM6 referenced this in commit d9011ccf0b on Aug 24, 2021
  47. Munkybooty referenced this in commit 583c2ee123 on Aug 24, 2021
  48. DrahtBot locked this on Dec 16, 2021

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: 2024-07-03 10:13 UTC

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