Drop log category in SeedStartup #29480

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:240226-log-rand changing 1 files +1 โˆ’1
  1. hebasto commented at 2:42 pm on February 26, 2024: member
    This LogPrint(BCLog::RAND, ...) is never logged because the SeedStartup function is called at a very early stage, such as during the instantiation of the static CSignatureCache object, before any log categories are added. This PR fixes this behavior.
  2. Drop log category in `SeedStartup`
    This `LogPrint(BCLog::RAND, ...)` is never logged because the
    `SeedStartup` function is called at a very early stage, such as during
    the instantiation of the static `CSignatureCache` object, before any log
    categories are added. This change addresses this behavior.
    88468a8afc
  3. DrahtBot commented at 2:42 pm on February 26, 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 hernanmarino, maflcko

    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:

    • #29641 (scripted-diff: Use LogInfo/LogDebug over LogPrintf/LogPrint 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.

  4. luke-jr referenced this in commit 2a48bf5274 on Mar 5, 2024
  5. hernanmarino commented at 10:50 pm on April 12, 2024: contributor
    ACK 88468a8afcd908cd26f4e6ecfb86c80d1c56fe73
  6. maflcko commented at 7:25 am on August 8, 2024: member

    This LogPrint(BCLog::RAND, ...) is never logged because the SeedStartup function is called at a very early stage, such as during the instantiation of the static CSignatureCache object, before any log categories are added. This PR fixes this behavior.

    This is outdated and the steps to reproduce no longer work. Currently, it needs something like:

     0diff --git a/src/init.cpp b/src/init.cpp
     1index faaf3353d0..164f624b4e 100644
     2--- a/src/init.cpp
     3+++ b/src/init.cpp
     4@@ -194,6 +194,11 @@ static void RemovePidFile(const ArgsManager& args)
     5         LogPrintf("Unable to remove PID file (%s): %s\n", fs::PathToString(pid_path), msg);
     6     }
     7 }
     8+static bool once_flag{[] {
     9+    auto v{std::vector<uint8_t>(3)};
    10+    GetStrongRandBytes(v);
    11+    return true;
    12+}()};
    13 
    14 static std::optional<util::SignalInterrupt> g_shutdown;
    15 
    

    and: ./bld/src/qt/bitcoin-qt -datadir=/tmp -regtest -asmap=/tmp/no_file -printtoconsole -debug=rand -logthreadnames=1 -logsourcelocations=1 (or similar).

  7. maflcko commented at 7:38 am on August 8, 2024: member

    review ACK 88468a8afcd908cd26f4e6ecfb86c80d1c56fe73

    but it would be good to update the context here, given my previous reply.

    Also, it may be good to use LogDebug in the only remaining RAND-debug-log call:

    0$ git grep '::RAND'
    1src/logging.cpp:    {"rand", BCLog::RAND},
    2src/random.cpp:    LogPrint(BCLog::RAND, "Feeding %i bytes of dynamic environment data into RNG\n", hasher.Size() - old_size);
    

    This also clarifies that the this is the only remaining call, which seems like useful context for reviewers.

  8. hebasto commented at 4:07 pm on August 12, 2024: member
    I wonโ€™t be working on this PR in the near future. So, closing it and labeling it “Up for grabs”.
  9. hebasto closed this on Aug 12, 2024

  10. hebasto added the label Up for grabs on Aug 12, 2024

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-21 15:12 UTC

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