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

Welcome screen uses GiB values as GB, risking running out of space #821

Open
1 task done
BenWestgate opened this issue May 24, 2024 · 2 comments
Open
1 task done

Comments

@BenWestgate
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

The welcome screen correctly displays "55 GB of space available" while my system has 54322808 bytes available.

But it incorrectly says "... 12 GB of data will be stored in this directory" or "610 GB of data" if I uncheck the 2GB pruning. The values it is adding and comparing do not have the same unit. One is a GUI prune setting and/or space available in GB, the other is actually GiB: https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md#how-to-calculate-m_assumed_blockchain_size-and-m_assumed_chain_state_size

Since the "how to calculate m_assumed ... size" instructions add a 5-10% buffer, what we display when only a 5-7% buffer is added to the values used in our GUI's space calculations will be too small and may lead to the user running out of space without being warned by the red text XXX GB of space available (of XXX GB needed).

Expected behaviour

The Welcome dialog should either use all GB or all GiB for its math. That way it never underestimates the space needed.
Converting the assumed_chain_state and assumed_blockchain_size to GB is a matter of multiplying by 1.073741824 and rounding up to the nearest GB.

That would update the values I was shown to: 13 GB and 655 GB respectively. You can see the gap between GB & GiB has gotten too massive to ignore, especially when estimating -prune=0 space needed.

Alternatively the units could be switched to GiB and my space available reported as 52 GiB and my prune setting bumped up to be 2 GiB (making it easier to predict what the GUI will show because the -prune command takes MiB).

I believe GB was used as it is the more familiar unit and matches what the OS and storage manufacturers tend to display so lets apply the first solution. Or update the https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md#how-to-calculate-assumed-blockchain-and-chain-state-size
doc to require using a 13-19% buffer to allow for the previous 5-10% when they are misused as GB values despite being calculated as GiB.

Steps to reproduce

bitcoin-qt -choosedatadir notice the addition and subtraction of values that have different units as per our docs.

Relevant log output

No response

How did you obtain Bitcoin Core

Pre-built binaries

What version of Bitcoin Core are you using?

master / 27.0

Operating system and version

Debian 12

Machine specifications

No response

@BenWestgate
Copy link
Contributor Author

On further analysis, the code comments in chainparams.h also think these values should be GB so I understand the origin of the gui error. It seems the release-process.md is the odd one out of the 3. This issue can be closed if the doc: PR below is ACK'd.
bitcoin/bitcoin#30171

@hebasto
Copy link
Member

hebasto commented Jul 15, 2024

Also see bitcoin/bitcoin#29678.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants