Skip to content

Review Club - fuzz: Abort if system time is called without mock time being set #96

Description

@Prabhat1308

Session Details

Date: 01-01-2025
Time: IST 20:00 (UTC 14:30)
Link: PR #31549
Difficulty: Medium

Motivation:

This PR expands the CheckGlobals utility that was introduced in bitcoin/bitcoin#31486 and should help with fuzz stability (bitcoin/bitcoin#29018).

System time shouldn't be used when running a fuzz test, as it is likely to introduce instability (non-determinism). This PR identifies and fixes the targets that were calling system time without setting mock time at the start of an iteration.

RemovingSetMockTime() from any one of these targets should result in a crash and a message describing the issue.

Questions:

  1. What is fuzzing and Why is it used ?
  2. What is stability in fuzz tests ?
  3. Why replacing Systemtime is important for stability of fuzz tests?
  4. How is SetMockTime() improving the stability of the fuzz tests?
  5. How is the code Identifying the pieces of code using Systemtime in there code ?

Learnings:

tests
fuzz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions