Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jul 5, 2024

Motivation:

Also, while touching this:

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 5, 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
ACK tdb3, fjahr, ryanofsky
Concept ACK TheCharlatan

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30383 (util: Catch translation string errors at compile time by maflcko)

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.

@DrahtBot DrahtBot changed the title rpc: Use untranslated error strings in loadtxoutset rpc: Use untranslated error strings in loadtxoutset Jul 5, 2024
@TheCharlatan
Copy link
Contributor

Concept ACK

@maflcko maflcko force-pushed the 2407-rpc-loadtxoutset-msgs branch from fa7f58e to fa55ada Compare July 5, 2024 08:23
@bitcoin bitcoin deleted a comment from HerWayBit Jul 5, 2024
@maflcko maflcko force-pushed the 2407-rpc-loadtxoutset-msgs branch from fa55ada to fa79edb Compare July 5, 2024 09:00
@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 5, 2024

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/27074813459

@maflcko maflcko force-pushed the 2407-rpc-loadtxoutset-msgs branch from fa79edb to fa22edc Compare July 5, 2024 09:07
@DrahtBot DrahtBot removed the CI failed label Jul 5, 2024
@fjahr
Copy link
Contributor

fjahr commented Jul 5, 2024

utACK fa22edc

@DrahtBot DrahtBot requested a review from TheCharlatan July 5, 2024 13:12
Copy link
Contributor

@tdb3 tdb3 left a comment

Choose a reason for hiding this comment

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

Approach ACK

@@ -2833,7 +2833,7 @@ static RPCHelpMan loadtxoutset()

auto activation_result{chainman.ActivateSnapshot(afile, metadata, false)};
if (!activation_result) {
throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf(_("Unable to load UTXO snapshot: %s\n"), util::ErrorString(activation_result)).original);
throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Unable to load UTXO snapshot: %s. (%s)", util::ErrorString(activation_result).original, path.utf8string()));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: It looks like there might be an extraneous period for at least some error messages (between the error message and the parenthesis-wrapped path).

Created a snapshot with dumptxoutset.
Modified a byte in the snapshot to induce failure during load.

$ src/bitcoin-cli loadtxoutset mytxoutset.dat
error code: -32603
error message:
Unable to load UTXO snapshot: assumeutxo block hash in snapshot metadata not recognized (hash: 767fccc851802c0180a3ebf1631ab978d4d6a5ae1d452dc26e9c177850708e6c, height: 101). The following snapshot heights are available: 110, 299.. (/home/dev/.bitcoin/regtest/mytxoutset.dat)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thx, removed ..

Copy link
Contributor

@tdb3 tdb3 left a comment

Choose a reason for hiding this comment

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

ACK fa5b892

Re-ran check in #30395 (comment) . No extra period seen.
Ran unit/functional tests locally, including feature_assumeutxo (all passed).

@DrahtBot DrahtBot requested a review from fjahr July 5, 2024 16:12
@fjahr
Copy link
Contributor

fjahr commented Jul 5, 2024

re-ACK fa5b892

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 fa5b892

@@ -5732,7 +5732,7 @@ util::Result<void> ChainstateManager::ActivateSnapshot(
static_cast<size_t>(current_coinstip_cache_size * SNAPSHOT_CACHE_PERC));
}

auto cleanup_bad_snapshot = [&](const char* reason) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
auto cleanup_bad_snapshot = [&](bilingual_str&& reason) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In commit "rpc: Use untranslated error strings in loadtxoutset" (fa5b892)

Not important, but you could change this from bilingual_str&& to just bilingual_str so it is simpler, and function can be called naturally with both lvalues and rvalues, not just rvalues. Rvalues will be moved in any case.

@ryanofsky ryanofsky merged commit c06b376 into bitcoin:master Jul 9, 2024
@maflcko maflcko deleted the 2407-rpc-loadtxoutset-msgs branch July 10, 2024 07:38
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.

Post-merge ACK fa5b892.

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jul 22, 2024
The message is not exposed in the GUI or another translated context, so
translating it is useless for now.

Also, fix a nit from bitcoin#30395 (comment)
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jul 25, 2024
The message is not exposed in the GUI or another translated context, so
translating it is useless for now.

Also, fix a nit from bitcoin#30395 (comment)
janus pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Jan 6, 2025
The message is not exposed in the GUI or another translated context, so
translating it is useless for now.

Also, fix a nit from bitcoin/bitcoin#30395 (comment)
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 7, 2025
Summary:
> rpc: Fix race in loadtxoutset
>
> The tip may have advanced, also if it did not, there is no reason to
> have two variables point to the same block.
bitcoin/bitcoin@fa91089

The potential race just means that tip_hash in the RPC response could be different from "the hash of the base of the snapshot" (as documented in the RPC doc).
Note that this race cannot really happen in the functional test, as there are no blocks coming over the network during the loadtxoutset call (blocks are mined locally). It could have happened in the wild, with very limited impact. The node would keep working fine, but some users may have been confused by the RPC response.

> refactor: Move early loadtxoutset checks into ActiveSnapshot
>
> Also changes the return type of ActiveSnapshot to allow returning the
> error message to the user of the loadtxoutset RPC.

bitcoin/bitcoin@80315c0

> refactor: Use named arguments to get path arg in loadtxoutset
>
> rpc: Use untranslated error strings in loadtxoutset
[[bitcoin/bitcoin#30395 | core#30395]]

This is a partial backport of [[bitcoin/bitcoin#29262 | core#29262]], [[bitcoin/bitcoin#30267 | core#30267]] and [[bitcoin/bitcoin#30395 | core#30395]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18055
@bitcoin bitcoin locked and limited conversation to collaborators Jul 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants