kernel: De-globalize static validation variables - #30425
Conversation
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.
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.
These were found while looking for static mutable state in the kernel library.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
maflcko
left a comment
There was a problem hiding this comment.
ACK 51fa262 🍚
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 51fa26239af9bbfd44029aaf595cb4c6a8d4a75d 🍚
aL3wyo63PKckFQ0ghZy3cIXx4jGARGHgX+Z8LGNKlGlYbKt9fqrhMBJdzW63qGSmHLejkehE7rj+yIC2LCi8AA==
| CBlockIndex* m_best_header GUARDED_BY(::cs_main){nullptr}; | ||
|
|
||
| /** The last header for which a headerTip notification was issued. */ | ||
| CBlockIndex* m_last_notified_header GUARDED_BY(::cs_main){nullptr}; |
There was a problem hiding this comment.
39f9b80: 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)?
fa92705 refactor: Make m_last_notified_header private (MarcoFalke) Pull request description: Seems brittle to expose mutable fields public. Fix it by making it private. Fixes #30425 (comment) ACKs for top commit: dergoegge: utACK fa92705 Tree-SHA512: d9841c42571144ced0edeaa4bb1d96a177a011dca37c8342c66513477c37278602a1b88beb93068b94fc4443b1552c8fc9f98bcf0bda7d0fc101e61e90c33944
fae0db0 fuzz: Deglobalize signature cache in sigcache test (TheCharlatan) Pull request description: The body of the fuzz test should ideally be a pure function. If data is persisted in the cache over many iterations, and there is a crash, reproducing it from the input might be difficult. Solve this by getting rid of the global state. This is a follow-up from #30425. ACKs for top commit: dergoegge: utACK fae0db0 ryanofsky: Code review ACK fae0db0 Tree-SHA512: 93dcbb9f2497f13856970469042d6870f04de10fe206827a8db1aae7fc8f3ac7fd900bee7945b5fe4c9e33883268dabb15be7e7bc91cf353ffc0d118cd60e97d
…ivate 3700dd7 refactor: Make m_last_notified_header private (MarcoFalke) Pull request description: Seems brittle to expose mutable fields public. Fix it by making it private. Fixes bitcoin/bitcoin#30425 (comment) ACKs for top commit: dergoegge: utACK 3700dd7 Tree-SHA512: d9841c42571144ced0edeaa4bb1d96a177a011dca37c8342c66513477c37278602a1b88beb93068b94fc4443b1552c8fc9f98bcf0bda7d0fc101e61e90c33944
…ivate b367fab refactor: Make m_last_notified_header private (MarcoFalke) Pull request description: Seems brittle to expose mutable fields public. Fix it by making it private. Fixes bitcoin/bitcoin#30425 (comment) ACKs for top commit: dergoegge: utACK b367fab Tree-SHA512: d9841c42571144ced0edeaa4bb1d96a177a011dca37c8342c66513477c37278602a1b88beb93068b94fc4443b1552c8fc9f98bcf0bda7d0fc101e61e90c33944
…ivate fa927055dd43dda945396574273a210186beec9f refactor: Make m_last_notified_header private (MarcoFalke) Pull request description: Seems brittle to expose mutable fields public. Fix it by making it private. Fixes bitcoin/bitcoin#30425 (comment) ACKs for top commit: dergoegge: utACK fa927055dd43dda945396574273a210186beec9f Tree-SHA512: d9841c42571144ced0edeaa4bb1d96a177a011dca37c8342c66513477c37278602a1b88beb93068b94fc4443b1552c8fc9f98bcf0bda7d0fc101e61e90c33944
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.