maflcko
commented at 12:36 pm on February 2, 2026:
member
Iterating over fuzz inputs will usually be done in the same process. As the mocktime is global, it can theoretically leak from one fuzz input run into the next run, making it less deterministic.
Fix this issue, by adding and using a context manager to handle the mocktime and reset it before the end.
This refactor should not change any behavior.
DrahtBot renamed this:
fuzz: Add and use NodeClockContext
fuzz: Add and use NodeClockContext
on Feb 2, 2026
DrahtBot added the label
Fuzzing
on Feb 2, 2026
DrahtBot
commented at 12:36 pm on February 2, 2026:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviews
See the guideline for information on the review process.
A summary of reviews will appear here.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#33421 (node: add BlockTemplateCache by ismaelsadeeq)
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.
brunoerg
commented at 11:52 pm on February 3, 2026:
contributor
Wouldn’t it need to change the warning (replacing SetMockTime to NodeClockContext) in CheckGlobalsImpl for when the target accesses system time?
test: Add NodeClockContext
This makes it easier to use mock-time in tests. Also, it resets the
global mocktime, so that no state is leaked between test cases.
fa0db768e5
fuzz: Use NodeClockContext
This refactor does not change any behavior.
However, it is nice to know that no global mocktime leaks from the fuzz
init step to the first fuzz input, or from one fuzz input execution to
the next.
With the clock context, the global is re-set at the end of the context.
fa89e8de0c
test: Fixup docs for NodeClockContext and SteadyClockContext666643be8f
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: 2026-02-10 21:13 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me