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

Enable changing the autoprune block space size in intro dialog #125

Merged
merged 5 commits into from
Apr 29, 2021

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Oct 29, 2020

@jonasschnelli
Copy link
Contributor

Concept ACK

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

Concept ACK.

src/qt/bitcoin.cpp Outdated Show resolved Hide resolved
src/qt/intro.cpp Outdated Show resolved Hide resolved
@@ -17,6 +17,7 @@

#include <interfaces/node.h>
#include <util/system.h>
#include <validation.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

77f3f2d

It's unfortunate to include this just because of MIN_DISK_SPACE_FOR_BLOCK_FILES.

src/qt/intro.cpp Outdated Show resolved Hide resolved
src/qt/intro.cpp Outdated Show resolved Hide resolved
@Bosch-0
Copy link

Bosch-0 commented Nov 9, 2020

Testing ACK 7e37329 on Windows 10.0.18363 Build 18363. Articulating how exactly the pruned storage works is a great UX move. Many users seem to think pruning only stores data relevant to them, not that its only storing a recent history of blocks. Can be quite a shock importing an old wallet that you believe has coins only to get a zero balance displayed.

Screenshot 2020-11-09 144538

Just some minor nits that could be fixed along with this PR:

"The wallet will also be stored in this directory" should be changed to "Wallets will also be stored in this directory" in the top dialogue. Users can / may have multiple wallets.

Blockchain size is around ~350GB now, may want to update the 320GB text in the second last paragraph.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 7d40a48

@maflcko maflcko changed the title GUI: Enable changing the autoprune block space size in intro dialog Enable changing the autoprune block space size in intro dialog Nov 12, 2020
Copy link
Contributor

@promag promag 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 7d40a48.

Could fix the following when setting an invalid prune target (big number or empty string):
Screenshot 2020-11-12 at 09 54 10

@Sjors
Copy link
Member

Sjors commented Nov 12, 2020

Concept ACK

@sipa
Copy link
Contributor

sipa commented Nov 14, 2020

@Bosch-0 Does rescanning a wallet with a pruned node that misses relevant blocks result in an incorrect balance? That sounds like a bug - it should just abort with missing blocks or so.

@hebasto
Copy link
Member

hebasto commented Nov 16, 2020

@Bosch-0

Just some minor nits that could be fixed along with this PR:

"The wallet will also be stored in this directory" should be changed to "Wallets will also be stored in this directory" in the top dialogue. Users can / may have multiple wallets.

Usually, we are trying to keep PRs focused :)
A small pull with a label correction could be easy to review.

Blockchain size is around ~350GB now, may want to update the 320GB text in the second last paragraph.

This number update is a part of the release process, e.g., bitcoin/bitcoin#20263.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

Concept ACK 7d40a48.

Master (fb7726e):
DeepinScreenshot_select-area_20201116112204

This PR:
DeepinScreenshot_select-area_20201116112251

The visual distance between two closely related items has been increased (see the screeshots above). This change makes harder for novices to grasp the pruning details. I'd suggest the opposite: to place those items side by side.

src/qt/bitcoin.cpp Outdated Show resolved Hide resolved
src/qt/intro.h Outdated Show resolved Hide resolved
src/qt/intro.cpp Outdated Show resolved Hide resolved
src/qt/forms/intro.ui Show resolved Hide resolved
src/qt/intro.cpp Outdated Show resolved Hide resolved
src/qt/forms/intro.ui Show resolved Hide resolved
src/qt/intro.cpp Outdated Show resolved Hide resolved
@luke-jr
Copy link
Member Author

luke-jr commented Nov 19, 2020

Addressed @hebasto's comments.

Ping @promag @ryanofsky @Bosch-0 for re-ACKing

@Bosch-0
Copy link

Bosch-0 commented Nov 19, 2020

@Bosch-0 Does rescanning a wallet with a pruned node that misses relevant blocks result in an incorrect balance? That sounds like a bug - it should just abort with missing blocks or so.

I haven't actually tested this but I don't think it does - will test this today. The only time an incorrect balance may be shown is when importing a wallet post-prune that has tx history older than the block history stored as far as I'm concerned.

@Bosch-0
Copy link

Bosch-0 commented Nov 19, 2020

ACK ea79265, looks good.

@hebasto
Copy link
Member

hebasto commented Nov 19, 2020

ACK ea79265, looks good.

Which commit did you mean?

@hebasto
Copy link
Member

hebasto commented Nov 19, 2020

@luke-jr

Addressed @hebasto's comments.

Sorry, but I don't think just that marking a comment as resolved means that it is addressed. If the current state of code is preferred that could be stated explicitly, right?

@Bosch-0
Copy link

Bosch-0 commented Nov 19, 2020

Which commit did you mean?

I just re-tested the changes made since my first ACK, I did not review the code

@hebasto
Copy link
Member

hebasto commented Nov 19, 2020

Which commit did you mean?

I just re-tested the changes made since my first ACK, I did not review the code

I mean that ACK should be followed by the top commit of the pr branch, i.e. 7d40a48 for now, not the master branch (that ea79265 is).

@ryanofsky
Copy link
Contributor

Is an update supposed to be pushed? My review was requested but there haven't been any changes since my last review #125 (review)

@luke-jr
Copy link
Member Author

luke-jr commented Nov 19, 2020

Ah, that's the problem: Forgot we have to push to a different repo to get PRs in /gui to update :/

Should be ready now

src/qt/intro.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 415fb2e. Changes since last review: mb/gib suffixes, constexpr QOverload expected_backup_days tweaks, new moveonly layout commit

Copy link
Member

@jarolrod jarolrod 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 415fb2e.
Stress-tested on Ubuntu 20.10 and Arch Linux. Synced a node on each machine with no issues. Ubuntu machine set to 6gb prune target, Arch machine set to 9gb prune target.

@luke-jr
Copy link
Member Author

luke-jr commented Feb 1, 2021

QOverload doesn't work in Qt 5.5 ... reverted that change

@luke-jr
Copy link
Member Author

luke-jr commented Mar 2, 2021

master is bumped to Qt 5.9, so went back to QOverload...

@Talkless
Copy link

Talkless commented Mar 16, 2021

@luke-jr feeling dejavu - I see Intro::getPruneMiB() added here and int #149 :)

Copy link

@Talkless Talkless left a comment

Choose a reason for hiding this comment

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

tACK 415fb2e, tested on Debian Sid with Qt 5.15.2.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

Tested 415fb2e on Linux Mint 20.1 (Qt 5.12.8).
Works great!

I believe the commit "GUI/Intro: Move prune setting below explanation" (415fb2e) should be reordered and squashed into the "GUI/Intro: Rework UI flow to let the user set prune size in GBs" (e2dcd95).

@@ -508,9 +506,9 @@ int GuiMain(int argc, char* argv[])
/// 5. Now that settings and translations are available, ask user for data directory
// User language is set up: pick a data directory
bool did_show_intro = false;
bool prune = false; // Intro dialog prune check box
int64_t prune_MiB = 0; // Intro dialog prune configuration
Copy link
Member

Choose a reason for hiding this comment

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

style piconit: clang-format-diff.py suggests

Suggested change
int64_t prune_MiB = 0; // Intro dialog prune configuration
int64_t prune_MiB = 0; // Intro dialog prune configuration

Comment on lines +237 to +242
<property name="text">
<string>Limit block chain storage to</string>
</property>
<property name="toolTip">
<string>Reverting this setting requires re-downloading the entire blockchain. It is faster to download the full chain first and prune it later. Disables some advanced features.</string>
</property>
Copy link
Member

Choose a reason for hiding this comment

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

Qt Designer insists on changing properties order:

Suggested change
<property name="text">
<string>Limit block chain storage to</string>
</property>
<property name="toolTip">
<string>Reverting this setting requires re-downloading the entire blockchain. It is faster to download the full chain first and prune it later. Disables some advanced features.</string>
</property>
<property name="toolTip">
<string>Reverting this setting requires re-downloading the entire blockchain. It is faster to download the full chain first and prune it later. Disables some advanced features.</string>
</property>
<property name="text">
<string>Limit block chain storage to</string>
</property>

@@ -139,17 +140,26 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
);
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME));

const int min_prune_target_GB = std::ceil(MIN_DISK_SPACE_FOR_BLOCK_FILES / 1e9);
Copy link
Member

Choose a reason for hiding this comment

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

nit: why here and after not use

/* One gigabyte (GB) in bytes */
static constexpr uint64_t GB_BYTES{1000000000};

?

UpdatePruneLabels(ui->prune->isChecked());

connect(ui->prune, &QCheckBox::toggled, [this](bool prune_checked) {
UpdatePruneLabels(prune_checked);
UpdateFreeSpaceLabel();
});
connect(ui->pruneGB, QOverload<int>::of(&QSpinBox::valueChanged), [this](int prune_GB) {
Copy link
Member

Choose a reason for hiding this comment

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

The QOverload helper class is required for C++11 code. Having C++17, the qOverload should be used.

Choose a reason for hiding this comment

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

IIRC qOverload function template does not work with Visual Studio 2017 due to implementation limitations, and I see that compiler mentioned in https://github.com/bitcoin-core/gui/blob/master/build_msvc/README.md .

Copy link
Member

Choose a reason for hiding this comment

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

IIRC qOverload function template does not work with Visual Studio 2017 due to implementation limitations

Oh, I was not aware of it. I'd like to know more about this pitfall. Any proof/link/test is appreciated :)

Copy link

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@Talkless

Thanks! Since bitcoin/bitcoin#21811 is merged, it isn't a problem, is it?

Btw, could you look at #257?

Copy link

Choose a reason for hiding this comment

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

It seem so, yes. Maybe I should try building on some older GCC to make sure other compiler does not have similar limitations (though I doubt it).

I will take a look at 257 at some time.

Comment on lines +200 to +201
case Qt::Unchecked: default:
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
case Qt::Unchecked: default:
return 0;
case Qt::Unchecked:
[[fallthrough]];
default:
return 0;

Comment on lines +385 to +386
static constexpr uint64_t nPowTargetSpacing = 10 * 60; // from chainparams, which we don't have at this stage
static constexpr uint32_t expected_block_data_size = 2250000; // includes undo data
Copy link
Member

Choose a reason for hiding this comment

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

style piconit: clang-format-diff.py suggests

Suggested change
static constexpr uint64_t nPowTargetSpacing = 10 * 60; // from chainparams, which we don't have at this stage
static constexpr uint32_t expected_block_data_size = 2250000; // includes undo data
static constexpr uint64_t nPowTargetSpacing = 10 * 60; // from chainparams, which we don't have at this stage
static constexpr uint32_t expected_block_data_size = 2250000; // includes undo data

@@ -36,6 +36,7 @@ class Intro : public QDialog

QString getDataDirectory();
void setDataDirectory(const QString &dataDir);
int64_t getPruneMiB() const;
Copy link
Member

Choose a reason for hiding this comment

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

Could be private?

src/qt/forms/intro.ui Show resolved Hide resolved
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK 415fb2e, my unresolved comments are not blockers, and they could be resolved in follow ups.

@hebasto hebasto merged commit e1e1e70 into bitcoin-core:master Apr 29, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 30, 2021
@Rspigler
Copy link
Contributor

Post-merge tACK. Great improvement!

hebasto added a commit that referenced this pull request May 27, 2021
8b77133 qt: Replace disambiguation strings with translator comments (Hennadii Stepanov)

Pull request description:

  Since bitcoin/bitcoin#21694 is merged, translator comments is the right way to pass context to translators.

  This PR fixes changes were made:
  - in #220 before bitcoin/bitcoin#21694
  - in bitcoin/bitcoin#21694 on testing purpose
  - in #125

  Closes #288.

ACKs for top commit:
  jarolrod:
    ACK 8b77133

Tree-SHA512: 466ade35f4969a41fbf3196780b1ae9fa810bab5d2f09077f8631604636cc63b24a901c719f6b5797366d2aa307993d0aa419ce35200c8d0a741a3d81cad3e6b
@hebasto
Copy link
Member

hebasto commented Jun 28, 2021

@luke-jr

Could you add release notes into https://github.com/bitcoin-core/bitcoin-devwiki/wiki/22.0-Release-Notes-draft#gui-changes?

See IRC discussion:

04:22:48 <hebasto> also I think that #125 by luke-jr should be included as well
04:27:06 <luke-jr> hebasto: not sure release notes apply to firstrun things? XD

@hebasto hebasto added this to the 22.0 milestone Jun 28, 2021
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.