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

doc: Change GiB to GB in release-process.md #30171

Closed
wants to merge 1 commit into from

Conversation

BenWestgate
Copy link
Contributor

@BenWestgate BenWestgate commented May 24, 2024

This will make it consistent with the Welcome GUI and code comments which use "GB" for the m_assumed_blockchain_size and m_assumed_chain_state_size values.

Since they are used as GB values to calculate disk space in GB needed in the GUI, measuring size in GiB here will cause users to run out of space without a graphical warning. The error between units is over 45 GB for the full chain.

This doc is the only place we say they are GiB, and while an 8-10% overhead can account for the unit conversion, we say the overhead was for growth between releases, not abusing the units without conversion.

/** Minimum free space (in GB) needed for data directory */
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
/** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }

image

Here is a 3rd spot where the GiB value is presented to the user as GB:

bitcoin/src/init.cpp

Lines 1696 to 1713 in 4c387cb

// On first startup, warn on low block storage space
if (!chainman.m_blockman.m_reindexing && !fReindexChainState && chain_active_height <= 1) {
uint64_t assumed_chain_bytes{chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024};
uint64_t additional_bytes_needed{
chainman.m_blockman.IsPruneMode() ?
std::min(chainman.m_blockman.GetPruneTarget(), assumed_chain_bytes) :
assumed_chain_bytes};
if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
InitWarning(strprintf(_(
"Disk space for %s may not accommodate the block files. " \
"Approximately %u GB of data will be stored in this directory."
),
fs::quoted(fs::PathToString(args.GetBlocksDirPath())),
chainparams.AssumedBlockchainSize()
));
}
}

However, it comes right after using the value correctly as GiB (unlike in GUI which uses it as GB). So that may need to be patched to calculate bytes from GB instead of GiB.

This will make it consistent with the Welcome gui and code comments.
I noticed the Welcome GUI was using these values as if they were GB, not
GiB. Then I read the comments in chainparams.h:
/** Minimum free space (in GB) needed for data directory */
/** Minimum free space (in GB) needed for data directory when pruned;
Does not include prune target*/

This doc is the only place that says to use GiB, and while an 8-10%
overhead can account for the unit conversion, we say the overhead is for
growth between releases, not misusing the units (in the GUI it could
lead to running out of space without a warning).
@DrahtBot
Copy link
Contributor

DrahtBot commented May 24, 2024

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

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK epiccurious

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@epiccurious
Copy link
Contributor

Concept ACK c04edce.

This assumes the value should be displayed in GB. Is there a benefit to doing the calculation and displaying in GiB instead?

@BenWestgate
Copy link
Contributor Author

Concept ACK c04edce.

This assumes the value should be displayed in GB. Is there a benefit to doing the calculation and displaying in GiB instead?

Software usually displays large sizes in GB because that's what the operating system and storage manufacturers use.

@sipa
Copy link
Member

sipa commented May 24, 2024

Software usually displays large sizes in GB because that's what the operating system and storage manufacturers use.

I don't think that's universally true. I believe Apple generally uses GB (meaning 109), Microsoft generally uses GB (meaning 230), and open-source systems use a mix (sometimes using GiB to mean 230).

showtime73

This comment was marked as spam.

@BenWestgate
Copy link
Contributor Author

I don't think that's universally true. I believe Apple generally uses GB (meaning 109), Microsoft generally uses GB (meaning 230), and open-source systems use a mix (sometimes using GiB to mean 230).

Good to know. Should the value we display depend on platform then? At the very least I think we should be consistent within the repository or within a file. Currently we do math that adds and subtracts GiB from GB in the GUI welcome screen which will cause issues. bitcoin-core/gui#821

In response to litigation over whether the makers of electronic storage devices must conform to Microsoft Windows' use of a binary definition of "GB" instead of the metric/decimal definition, the United States District Court for the Northern District of California rejected that argument, ruling that "the U.S. Congress has deemed the decimal definition of gigabyte to be the 'preferred' one for the purposes of 'U.S. trade and commerce.'"

To resolve this difficulty, IEC 80000-13 clarifies that a gigabyte (GB) is 10^9 bytes and specifies the term gibibyte (GiB) to denote 2^30 bytes.

@epiccurious
Copy link
Contributor

epiccurious commented May 24, 2024

Should the value we display depend on platform then?

This makes sense to me for the UI, since the average user will be able to compare values to their local environments in the macOS Finder and Windows Explorer applications.

@luke-jr
Copy link
Member

luke-jr commented May 28, 2024

This is a duplicate of #29678 (without the accompanying code fixes)

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

Successfully merging this pull request may close these issues.

6 participants