rpc: Use untranslated error strings in loadtxoutset #30395

pull maflcko wants to merge 2 commits into bitcoin:master from maflcko:2407-rpc-loadtxoutset-msgs changing 2 files +12 −12
  1. maflcko commented at 8:17 am on July 5, 2024: member

    Motivation:

    • Some are not translated at all, anyway. See #30267 (review)
    • For others translation is not yet needed, because they are not called by the GUI (yet)
    • For others translations will never be needed, because they are RPC code. See #30267 (review)

    Also, while touching this:

  2. DrahtBot commented at 8:17 am on July 5, 2024: contributor

    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.

  3. DrahtBot renamed this:
    rpc: Use untranslated error strings in loadtxoutset
    rpc: Use untranslated error strings in loadtxoutset
    on Jul 5, 2024
  4. DrahtBot added the label RPC/REST/ZMQ on Jul 5, 2024
  5. TheCharlatan commented at 8:20 am on July 5, 2024: contributor
    Concept ACK
  6. maflcko force-pushed on Jul 5, 2024
  7. bitcoin deleted a comment on Jul 5, 2024
  8. maflcko force-pushed on Jul 5, 2024
  9. DrahtBot added the label CI failed on Jul 5, 2024
  10. DrahtBot commented at 9:00 am on July 5, 2024: contributor

    🚧 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

  11. refactor: Use named arguments to get path arg in loadtxoutset fa45865778
  12. maflcko force-pushed on Jul 5, 2024
  13. DrahtBot removed the label CI failed on Jul 5, 2024
  14. fjahr commented at 1:12 pm on July 5, 2024: contributor
    utACK fa22edc1ef4d4456dcde883acae6f38af142d7bf
  15. DrahtBot requested review from TheCharlatan on Jul 5, 2024
  16. in src/rpc/blockchain.cpp:2836 in fa22edc1ef outdated
    2832@@ -2833,7 +2833,7 @@ static RPCHelpMan loadtxoutset()
    2833 
    2834     auto activation_result{chainman.ActivateSnapshot(afile, metadata, false)};
    2835     if (!activation_result) {
    2836-        throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf(_("Unable to load UTXO snapshot: %s\n"), util::ErrorString(activation_result)).original);
    2837+        throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Unable to load UTXO snapshot: %s. (%s)", util::ErrorString(activation_result).original, path.utf8string()));
    


    tdb3 commented at 3:49 pm on July 5, 2024:

    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.

    0$ src/bitcoin-cli loadtxoutset mytxoutset.dat
    1error code: -32603
    2error message:
    3Unable 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)
    

    maflcko commented at 3:57 pm on July 5, 2024:
    Thx, removed ..
  17. tdb3 commented at 3:49 pm on July 5, 2024: contributor
    Approach ACK
  18. rpc: Use untranslated error strings in loadtxoutset fa5b8920be
  19. maflcko force-pushed on Jul 5, 2024
  20. tdb3 approved
  21. tdb3 commented at 4:12 pm on July 5, 2024: contributor

    ACK fa5b8920be041380fbfa4c7b443918637423d7a0

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

  22. DrahtBot requested review from fjahr on Jul 5, 2024
  23. fjahr commented at 7:04 pm on July 5, 2024: contributor
    re-ACK fa5b8920be041380fbfa4c7b443918637423d7a0
  24. in src/validation.cpp:5735 in fa5b8920be
    5731@@ -5732,7 +5732,7 @@ util::Result<void> ChainstateManager::ActivateSnapshot(
    5732             static_cast<size_t>(current_coinstip_cache_size * SNAPSHOT_CACHE_PERC));
    5733     }
    5734 
    5735-    auto cleanup_bad_snapshot = [&](const char* reason) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
    5736+    auto cleanup_bad_snapshot = [&](bilingual_str&& reason) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
    


    ryanofsky commented at 6:16 pm on July 9, 2024:

    In commit “rpc: Use untranslated error strings in loadtxoutset” (fa5b8920be041380fbfa4c7b443918637423d7a0)

    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.

  25. ryanofsky approved
  26. ryanofsky commented at 6:17 pm on July 9, 2024: contributor
    Code review ACK fa5b8920be041380fbfa4c7b443918637423d7a0
  27. ryanofsky merged this on Jul 9, 2024
  28. ryanofsky closed this on Jul 9, 2024

  29. maflcko deleted the branch on Jul 10, 2024
  30. hebasto commented at 3:35 pm on July 10, 2024: member
    Post-merge ACK fa5b8920be041380fbfa4c7b443918637423d7a0.

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-12-22 06:12 UTC

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