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

log: Add validation interface logging #16688

Merged
merged 4 commits into from
Jan 9, 2020

Conversation

jkczyz
Copy link
Contributor

@jkczyz jkczyz commented Aug 22, 2019

Add logging of CValidationInterface callbacks using a new VALIDATION log flag (see #12994). A separate flag is desirable as the logging can be noisy and thus may need to be disabled without affecting other logging.

This could help debug issues where there may be race conditions at play, such as #12978.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 23, 2019

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #17562 (WIP: Validation: Remove ConnectTrace and PerBlockConnectTrace by jnewbery)
  • #17477 (Remove the mempool's NotifyEntryAdded and NotifyEntryRemoved signals by jnewbery)
  • #17399 (validation: Templatize ValidationState instead of subclassing by jkczyz)
  • #16365 (Log RPC parameters (arguments) if -debug=rpcparams by LarryRuane)

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.

Copy link
Contributor

@ariard ariard left a comment

Choose a reason for hiding this comment

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

Tested validationinterface log flag with both cli option and logging RPC. Worked as expected.

Nice to have more logging around the validation callbacks, order of events may be so confusing!

src/validationinterface.cpp Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
@jnewbery
Copy link
Contributor

Concept ACK

@jkczyz
Copy link
Contributor Author

jkczyz commented Sep 3, 2019

Addressed all comments and add correct formatting for valid CValidationState in b303865.

Also updated CValidationState accessors in 3ff8755 to return strings by constant reference to avoid copying. Although this means the references are only valid for the lifetime of the object, which should be okay.

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

I've partially reviewed and left a few comments inline. I intend to finish review and test this week.

src/validationinterface.cpp Outdated Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
src/txmempool.cpp Outdated Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
@jnewbery
Copy link
Contributor

jnewbery commented Oct 9, 2019

I did some light testing and this looks good. If you wanted to add automated tests, take a look at assert_debug_log() in the TestNode object. That allows you to test that specific strings have been written to the debug log.

updated CValidationState accessors in 3ff8755 to return strings by constant reference to avoid copying.

Was this required for the PR? Those accessors aren't used very much, so performance isn't critical. I'd suggest not changing them in this PR.

@jkczyz jkczyz force-pushed the 2019-08-validation-logging branch 2 times, most recently from 4b876d7 to 72c6e50 Compare October 17, 2019 18:56
@jkczyz
Copy link
Contributor Author

jkczyz commented Oct 17, 2019

I did some light testing and this looks good. If you wanted to add automated tests, take a look at assert_debug_log() in the TestNode object. That allows you to test that specific strings have been written to the debug log.

I would be hesitant to add a functional test only to check for informational logging. Is there an existing a test where all these events are exercised? Not sure if it is worth adding regardless.

updated CValidationState accessors in 3ff8755 to return strings by constant reference to avoid copying.

Was this required for the PR? Those accessors aren't used very much, so performance isn't critical. I'd suggest not changing them in this PR.

Yeah, commit 72c6e50 calls those methods in such a way that not returning references would have incurred excessive copies. Would it be better if the two commits were merged?

@jkczyz
Copy link
Contributor Author

jkczyz commented Oct 17, 2019

@jnewbery I have some concerns about this additional logging. Since #14209 was merged, all log function arguments are evaluated regardless of whether logging is enabled for the given category. This was not the case prior to that PR since a macro was used for logging.

Given the heavy amount of logging added in this PR, should the function vs macro approach for logging be revisited? Typically, the use of macros in logging libraries is to avoid such argument evaluation if I understand correctly.

@maflcko
Copy link
Member

maflcko commented Oct 18, 2019

Since #14209 was merged, all log function arguments are evaluated regardless of whether logging is enabled for the given category.

Huh? They were passed to strprintf before and after that change, but strprintf was only called when logging was enabled. I don't see how that pull changed anything.

@jkczyz
Copy link
Contributor Author

jkczyz commented Oct 18, 2019

Since #14209 was merged, all log function arguments are evaluated regardless of whether logging is enabled for the given category.

Huh? They were passed to strprintf before and after that change, but strprintf was only called when logging was enabled. I don't see how that pull changed anything.

By evaluation I mean at the call site of LogPrint. While this doesn't make a difference when passing variables, it does matter when the arguments are calls to other functions. Prior to #14209, the latter would be textually included when used and thus not evaluated if logging was not enabled for the given category.

@maflcko
Copy link
Member

maflcko commented Oct 18, 2019

Ah, right

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.

IMO, 6c730c3 commit is outside the original PR goal.
Also string (i.e., basic_string<char>) offers move semantics; so it can be efficiently return by value.

src/txmempool.cpp Outdated Show resolved Hide resolved
src/validationinterface.cpp Outdated Show resolved Hide resolved
@jkczyz jkczyz force-pushed the 2019-08-validation-logging branch 2 times, most recently from 4c89052 to f83a38f Compare October 20, 2019 21:32
@jkczyz
Copy link
Contributor Author

jkczyz commented Oct 20, 2019

IMO, 6c730c3 commit is outside the original PR goal.
Also string (i.e., basic_string<char>) offers move semantics; so it can be efficiently return by value.

I removed the commit. But I don't believe move semantics apply here as the function is returning a member variable.

@jnewbery
Copy link
Contributor

I removed the commit. (6c730c3)

Thanks!

I've tested this and it works great. I think we need to resolve this question: #16688 (comment) before merging this PR. It seems reasonable to me to change logging back to using a macro for the reasons you suggest. Adding a GetHash() call to every validation interface call, even when logging is disabled, seems a shame. I'd be happy to review a PR that does that.

Rename CMainSignals::MempoolEntryRemoved to TransactionRemovedFromMempool and Format CValidationState properly in all cases could be pulled out into their own PR while we're waiting for that, although note that Format CValidationState properly in all cases conflicts with 0053e16.

@jkczyz
Copy link
Contributor Author

jkczyz commented Oct 22, 2019

I've tested this and it works great. I think we need to resolve this question: #16688 (comment) before merging this PR. It seems reasonable to me to change logging back to using a macro for the reasons you suggest. Adding a GetHash() call to every validation interface call, even when logging is disabled, seems a shame. I'd be happy to review a PR that does that.

@jnewbery Will do.

@MarcoFalke I'm not sure I follow the part about "unnecessary branches are not analyzed" in #14209. If I were to make LogPrint (but not LogPrintf) a macro again, will I need to define it conditionally based on USE_COVERAGE as was done in c8914b9?

@maflcko
Copy link
Member

maflcko commented Oct 22, 2019

If you revert #14209, please make it as slim as possible (without the USE_COVERAGE guard, which mostly did only harm)

@jnewbery
Copy link
Contributor

I would be hesitant to add a functional test only to check for informational logging. Is there an existing a test where all these events are exercised? Not sure if it is worth adding regardless.

Yeah, I agree that this isn't necessary.

jkczyz added a commit to jkczyz/bitcoin that referenced this pull request Oct 22, 2019
Calling LogPrint with a category that is not enabled results in
evaluating the remaining function arguments, which may be arbitrarily
complex (and possibly expensive) expressions. Defining LogPrint as a
macro prevents this unnecessary expression evaluation.

This is a partial revert of bitcoin#14209. The decision to revert is discussed
in bitcoin#16688, which adds verbose logging for validation event notification.
jkczyz added a commit to jkczyz/bitcoin that referenced this pull request Oct 22, 2019
Calling LogPrint with a category that is not enabled results in
evaluating the remaining function arguments, which may be arbitrarily
complex (and possibly expensive) expressions. Defining LogPrint as a
macro prevents this unnecessary expression evaluation.

This is a partial revert of bitcoin#14209. The decision to revert is discussed
in bitcoin#16688, which adds verbose logging for validation event notification.
This could help debug issues where there may be race conditions at play,
such as bitcoin#12978.

Fixes bitcoin#12994.
@jkczyz
Copy link
Contributor Author

jkczyz commented Jan 3, 2020

@hebasto @ryanofsky Thanks for the review! I've addressed all comments.

@jnewbery
Copy link
Contributor

jnewbery commented Jan 3, 2020

ACK f9abf4a

1 similar comment
@hebasto
Copy link
Member

hebasto commented Jan 3, 2020

ACK f9abf4a

@ariard
Copy link
Contributor

ariard commented Jan 3, 2020

ACK f9abf4a, only changes since 0cadb12 are replacing log indication VALIDATIONINTERFACE by VALIDATION and avoiding a forward declaration with a new include

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 f9abf4a. Just suggested changes since last review (thanks!)

laanwj added a commit that referenced this pull request Jan 9, 2020
f9abf4a Add logging for CValidationInterface events (Jeffrey Czyz)
6edebac Refactor FormatStateMessage for clarity (Jeffrey Czyz)
72f3227 Format CValidationState properly in all cases (Jeffrey Czyz)
428ac70 Add VALIDATION to BCLog::LogFlags (Jeffrey Czyz)

Pull request description:

  Add logging of `CValidationInterface` callbacks using a new `VALIDATIONINTERFACE` log flag (see #12994). A separate flag is desirable as the logging can be noisy and thus may need to be disabled without affecting other logging.

  This could help debug issues where there may be race conditions at play, such as #12978.

ACKs for top commit:
  jnewbery:
    ACK f9abf4a
  hebasto:
    ACK f9abf4a
  ariard:
    ACK f9abf4a, only changes since 0cadb12 are replacing log indication `VALIDATIONINTERFACE` by `VALIDATION` and avoiding a forward declaration with a new include
  ryanofsky:
    Code review ACK f9abf4a. Just suggested changes since last review (thanks!)

Tree-SHA512: 3e0f6e2c8951cf46fbad3ff440971d95d526df2a52a2e4d6452a82785c63d53accfdabae66b0b30e2fe0b00737f8d5cb717edbad1460b63acb11a72c8f5d4236
@laanwj laanwj merged commit f9abf4a into bitcoin:master Jan 9, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 9, 2020
f9abf4a Add logging for CValidationInterface events (Jeffrey Czyz)
6edebac Refactor FormatStateMessage for clarity (Jeffrey Czyz)
72f3227 Format CValidationState properly in all cases (Jeffrey Czyz)
428ac70 Add VALIDATION to BCLog::LogFlags (Jeffrey Czyz)

Pull request description:

  Add logging of `CValidationInterface` callbacks using a new `VALIDATIONINTERFACE` log flag (see bitcoin#12994). A separate flag is desirable as the logging can be noisy and thus may need to be disabled without affecting other logging.

  This could help debug issues where there may be race conditions at play, such as bitcoin#12978.

ACKs for top commit:
  jnewbery:
    ACK f9abf4a
  hebasto:
    ACK f9abf4a
  ariard:
    ACK f9abf4a, only changes since 0cadb12 are replacing log indication `VALIDATIONINTERFACE` by `VALIDATION` and avoiding a forward declaration with a new include
  ryanofsky:
    Code review ACK f9abf4a. Just suggested changes since last review (thanks!)

Tree-SHA512: 3e0f6e2c8951cf46fbad3ff440971d95d526df2a52a2e4d6452a82785c63d53accfdabae66b0b30e2fe0b00737f8d5cb717edbad1460b63acb11a72c8f5d4236
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

ACK e7f8450 posthumous code review and manual tests.

Usage listed here for visitor convenience (the PR description was not updated from validationinterface to validation):

  • bitcoind -help | grep -B6 ", validation"
  -debug=<category>
       Output debugging information (default: -nodebug, supplying <category> is
       optional). If <category> is not supplied or if <category> = 1,
       output all debugging information. <category> can be: net, tor,
       mempool, http, bench, zmq, walletdb, rpc, estimatefee, addrman,
       selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej,
       libevent, coindb, qt, leveldb, validation.
  • bitcoind -debug=validation (launch bitcoind with validation logging)
  • bitcoin-cli help logging
  • bitcoin-cli logging [] '["validation"]' (toggle validation logging off)
  • bitcoin-cli logging '["validation"]' (toggle validation logging on)

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jan 12, 2020
This flag is for logging from within CValidationInterface (see bitcoin#12994).
A separate flag is desirable as the logging can be noisy and thus may
need to be disabled without affecting other logging.

Github-Pull: bitcoin#16688
Rebased-From: 428ac70
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Feb 9, 2020
This flag is for logging from within CValidationInterface (see bitcoin#12994).
A separate flag is desirable as the logging can be noisy and thus may
need to be disabled without affecting other logging.

Github-Pull: bitcoin#16688
Rebased-From: 428ac70
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 19, 2020
Summary:
f9abf4ab6d3d3e4d4b7e90723020b5422a141a6f Add logging for CValidationInterface events (Jeffrey Czyz)
6edebacb2191373e76d79a4972d6192300976096 Refactor FormatStateMessage for clarity (Jeffrey Czyz)
72f3227c83810936e7a334304e5fd7c6dab8e91b Format CValidationState properly in all cases (Jeffrey Czyz)
428ac70095253225f64462ee15c595644747f376 Add VALIDATION to BCLog::LogFlags (Jeffrey Czyz)

Pull request description:

  Add logging of `CValidationInterface` callbacks using a new `VALIDATIONINTERFACE` log flag (see #12994). A separate flag is desirable as the logging can be noisy and thus may need to be disabled without affecting other logging.

  This could help debug issues where there may be race conditions at play, such as #12978.

ACKs for top commit:
  jnewbery:
    ACK f9abf4ab6d3d3e4d4b7e90723020b5422a141a6f
  hebasto:
    ACK f9abf4ab6d3d3e4d4b7e90723020b5422a141a6f
  ariard:
    ACK f9abf4a, only changes since 0cadb12 are replacing log indication `VALIDATIONINTERFACE` by `VALIDATION` and avoiding a forward declaration with a new include
  ryanofsky:
    Code review ACK f9abf4ab6d3d3e4d4b7e90723020b5422a141a6f. Just suggested changes since last review (thanks!)

Tree-SHA512: 3e0f6e2c8951cf46fbad3ff440971d95d526df2a52a2e4d6452a82785c63d53accfdabae66b0b30e2fe0b00737f8d5cb717edbad1460b63acb11a72c8f5d4236

Partial backport of [[bitcoin/bitcoin#16688 | PR16688]]
The changes to `FormatStateMessage` are completely absent because I did not want to mangle them for the sake
of backporting this change, and that particular change depends on a massive stack that isn't necessary to
take advantage of this patch.

Test Plan: `ninja check check-functional`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6652
jasonbcox added a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 14, 2020
Summary:
This completes the backport of Core [[bitcoin/bitcoin#16688 | PR16688]] (see my note in the summary of D6652).
We diverge slightly due to a not-yet-backported change that will remove the RejectCode.

Depends on D6860

Test Plan: `ninja check check-functional`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6862
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
f9abf4a Add logging for CValidationInterface events (Jeffrey Czyz)
6edebac Refactor FormatStateMessage for clarity (Jeffrey Czyz)
72f3227 Format CValidationState properly in all cases (Jeffrey Czyz)
428ac70 Add VALIDATION to BCLog::LogFlags (Jeffrey Czyz)

Pull request description:

  Add logging of `CValidationInterface` callbacks using a new `VALIDATIONINTERFACE` log flag (see bitcoin#12994). A separate flag is desirable as the logging can be noisy and thus may need to be disabled without affecting other logging.

  This could help debug issues where there may be race conditions at play, such as bitcoin#12978.

ACKs for top commit:
  jnewbery:
    ACK f9abf4a
  hebasto:
    ACK f9abf4a
  ariard:
    ACK f9abf4a, only changes since 0cadb12 are replacing log indication `VALIDATIONINTERFACE` by `VALIDATION` and avoiding a forward declaration with a new include
  ryanofsky:
    Code review ACK f9abf4a. Just suggested changes since last review (thanks!)

Tree-SHA512: 3e0f6e2c8951cf46fbad3ff440971d95d526df2a52a2e4d6452a82785c63d53accfdabae66b0b30e2fe0b00737f8d5cb717edbad1460b63acb11a72c8f5d4236
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 11, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 11, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 12, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 12, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 12, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 14, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 14, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 15, 2021
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz)

Pull request description:

  Calling `LogPrint` with a category that is not enabled results in
  evaluating the remaining function arguments, which may be arbitrarily
  complex (and possibly expensive) expressions. Defining `LogPrint` as a
  macro prevents this unnecessary expression evaluation.

  This is a partial revert of bitcoin#14209. The decision to revert is discussed
  in bitcoin#16688, which adds verbose logging for validation event notification.

ACKs for top commit:
  jnewbery:
    ACK 8734c85

Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
furszy added a commit to PIVX-Project/PIVX that referenced this pull request Sep 23, 2021
d6fe150 Add logging for CValidationInterface events (random-zebra)
d1036c3 Refactor FormatStateMessage for clarity (Jeffrey Czyz)
d19c880 Format CValidationState properly in all cases (Jeffrey Czyz)
888eeac [Build] add util/validation build unit (random-zebra)
dbbf00b Add VALIDATION to BCLog::LogFlags (Jeffrey Czyz)

Pull request description:

  Backports bitcoin#16688 [jkczyz], which should help us debug some intermittent failures on GA (e.g. for `feature_reindex` or `wallet_basic` tests).

  > Add logging of CValidationInterface callbacks using a new VALIDATION log flag (see 12994). A separate flag is desirable as the logging can be noisy and thus may need to be disabled without affecting other logging.
  >
  > This could help debug issues where there may be race conditions at play, such as 12978.

  Based on top of
  - [x] #2547

ACKs for top commit:
  furszy:
    utACK d6fe150 after squash.

Tree-SHA512: affde45bf630d851c4e61b687e3a25cf5d33ae420630bef7c3d42f4632975a8197dccffa748f5bdb4899288232e73ae6c1967cde3e36b765f0d7d20ffdc4501d
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.