kernel: De-globalize static validation variables #30425

pull TheCharlatan wants to merge 3 commits into bitcoin:master from TheCharlatan:kernelRmGlobals changing 4 files +58 −55
  1. TheCharlatan commented at 7:00 pm on July 10, 2024: contributor

    In future, users of the kernel library might run multiple chainstates in parallel, or create and destroy multiple chainstates over the lifetime of a process. Having static, mutable variables could lead to state inconsistencies in these scenarios.


    This pull request is part of the libbitcoinkernel project.

  2. refactor: De-globalize validation benchmark timekeeping
    In future, users of the kernel library might run multiple chainstates in
    parallel, or create and destroy multiple chainstates over the lifetime
    of a process. Having static, mutable variables could lead to state
    inconsistencies in these scenarios.
    3443943f86
  3. refactor: De-globalize last notified header index
    In future, users of the kernel library might run multiple chainstates in
    parallel, or create and destroy multiple chainstates over the lifetime
    of a process. Having static, mutable variables could lead to state
    inconsistencies in these scenarios.
    39f9b80fba
  4. refactor: Mark some static global vars as const
    These were found while looking for static mutable state in the kernel
    library.
    51fa26239a
  5. DrahtBot commented at 7:00 pm on July 10, 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 dergoegge, maflcko, tdb3

    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:

    • #30370 (sync: improve CCoinsViewCache ReallocateCache - 2nd try by fjahr)
    • #30342 (kernel, logging: Pass Logger instances to kernel objects by ryanofsky)
    • #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.

  6. DrahtBot added the label Validation on Jul 10, 2024
  7. dergoegge approved
  8. dergoegge commented at 9:54 am on July 15, 2024: member
    Code review ACK 51fa26239af9bbfd44029aaf595cb4c6a8d4a75d
  9. in src/validation.h:1067 in 39f9b80fba outdated
    1062@@ -1063,6 +1063,9 @@ class ChainstateManager
    1063     /** Best header we've seen so far (used for getheaders queries' starting points). */
    1064     CBlockIndex* m_best_header GUARDED_BY(::cs_main){nullptr};
    1065 
    1066+    /** The last header for which a headerTip notification was issued. */
    1067+    CBlockIndex* m_last_notified_header GUARDED_BY(::cs_main){nullptr};
    


    maflcko commented at 10:45 am on July 15, 2024:
    39f9b80fba85d9818222c4d76e99ea1a804f5dda: Not sure about making this public mutable. Would it not be better to make this a private field (along with making NotifyHeaderTip a private method)?
  10. maflcko commented at 10:49 am on July 15, 2024: member

    ACK 51fa26239af9bbfd44029aaf595cb4c6a8d4a75d 🍚

    Signature:

    0untrusted 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}"
    1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    2trusted comment: ACK 51fa26239af9bbfd44029aaf595cb4c6a8d4a75d 🍚
    3aL3wyo63PKckFQ0ghZy3cIXx4jGARGHgX+Z8LGNKlGlYbKt9fqrhMBJdzW63qGSmHLejkehE7rj+yIC2LCi8AA==
    
  11. tdb3 approved
  12. tdb3 commented at 2:41 am on July 16, 2024: contributor
    code review ACK 51fa26239af9bbfd44029aaf595cb4c6a8d4a75d Nice cleanup/prep.
  13. ryanofsky merged this on Jul 16, 2024
  14. ryanofsky closed this on Jul 16, 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-11-21 09:12 UTC

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