Skip to content

Conversation

TheCharlatan
Copy link
Contributor

The extra bilingual_str argument of the fatal error notifications and node::AbortNode() is often unused and when used usually contains the same string as the message argument. It also seems to be confusing, since it is not consistently used for errors requiring user action. For example some assumeutxo fatal errors require the user to do something, but are not translated.

So simplify the fatal error and abort node interfaces by only passing a translated string. This slightly changes the fatal errors displayed to the user.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 18, 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 stickies-v, hebasto, maflcko, achow101
Concept ACK BrandonOdiwuor

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:

  • #29700 (kernel, refactor: return error status on all fatal errors by ryanofsky)
  • #29641 (scripted-diff: Use LogInfo/LogDebug over LogPrintf/LogPrint by maflcko)
  • #28280 (Don't empty dbcache on prune flushes: >30% faster IBD by andrewtoth)
  • #28233 (validation: don't clear cache on periodic flush by andrewtoth)

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.

@hebasto
Copy link
Member

hebasto commented Mar 18, 2024

Concept ACK.

Copy link
Contributor

@stickies-v stickies-v 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 75ffa4f

@@ -4299,7 +4299,7 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr<const CBlock>& pblock,
}
ReceivedBlockTransactions(block, pindex, blockPos);
} catch (const std::runtime_error& e) {
return FatalError(GetNotifications(), state, std::string("System error: ") + e.what());
return FatalError(GetNotifications(), state, strprintf(_("System error: %s"), e.what()));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: while touching, would be useful to consistently add context (+here)

Suggested change
return FatalError(GetNotifications(), state, strprintf(_("System error: %s"), e.what()));
return FatalError(GetNotifications(), state, strprintf(_("System error while writing block to history file: %s"), e.what()));

@TheCharlatan
Copy link
Contributor Author

Thank you for the review @stickies-v,

75ffa4f -> 9a32540 (fatallogtranslate_0 -> fatallogtranslate_1, compare)

Copy link
Contributor

@stickies-v stickies-v left a comment

Choose a reason for hiding this comment

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

ACK 9a32540

@DrahtBot DrahtBot requested a review from hebasto March 19, 2024 18:08
@TheCharlatan
Copy link
Contributor Author

Updated 9a32540 -> 918efe6 (fatallogtranslate_1 -> fatallogtranslate_2, compare)

@stickies-v
Copy link
Contributor

re-ACK 918efe6

@TheCharlatan
Copy link
Contributor Author

@stickies-v
Copy link
Contributor

re-ACK 98d0dd9 - no differences but to resolve merge conflict with #27039

Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor 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

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 98d0dd9.

@DrahtBot DrahtBot requested a review from BrandonOdiwuor March 21, 2024 12:15
The extra `bilingual_str` argument of the fatal error notifications and
`node::AbortNode()` is often unused and when used usually contains the
same string as the message argument. It also seems to be confusing,
since it is not consistently used for errors requiring user action. For
example some assumeutxo fatal errors require the user to do something,
but are not translated.

So simplify the fatal error and abort node interfaces by only passing a
translated string. This slightly changes the fatal errors displayed to
the user.

Also de-duplicate the abort error log since it is repeated in noui.cpp.
@TheCharlatan
Copy link
Contributor Author

Sorry for invalidating those ACKs, but I feel like this is easy enough to look at again.

98d0dd9 -> 824f472 (fatallogtranslate_3 -> fatallogtranslate_4, compare)

  • Addressed @hebasto's comment, removing duplicate line.
  • Added another commit using the new log functions in noui_ThreadSafeMessageBox. Added this because it seemed weird to go back to the old style of logging the error after the previous change.

@stickies-v
Copy link
Contributor

re-ACK 824f472

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.

re-ACK 824f472.

A side note:
After 6 years, it seems worth reconsidering #14655 again.

@maflcko
Copy link
Member

maflcko commented Mar 22, 2024

ACK 824f472 🔎

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: ACK 824f47294a309ba8e58ba8d1da0af15d8d828f43 🔎
/HtPXKA7yWdeOi1vZ7iHZlvCPniJNvpwshDC2/y6X3+cd7VXmisahmSugJEk3y43Euz4FSp5ro/x+dBjvx4HDw==

@achow101
Copy link
Member

ACK 824f472

@achow101 achow101 merged commit c122318 into bitcoin:master Mar 22, 2024
Copy link

@ASISBusiness ASISBusiness left a comment

Choose a reason for hiding this comment

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

Working

@bitcoin bitcoin locked and limited conversation to collaborators Mar 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done or Closed or Rethinking
Development

Successfully merging this pull request may close these issues.

8 participants