scripted-diff: Rename SteadyClockContext to FakeSteadyClock
What changed, and why it matters
This commit is a simple automated rename of a test-only helper class from SteadyClockContext to FakeSteadyClock. It only changes names in comments and test/fuzz code to make naming consistent. There is no functional change and no security impact.
No security action needed. This is a benign refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
A scripted-diff commit that globally replaces the identifier SteadyClockContext with FakeSteadyClock across five files, all in test/fuzz utilities and headers. The class remains a LimitOne RAII helper for mocking the steady clock in tests. No logic, behavior, or non-test code is modified.
Changed components
src/test/util/time.hsrc/test/fuzz/p2p_headers_presync.cppsrc/test/fuzz/util/check_globals.cppsrc/test/pcp_tests.cppsrc/util/time.h (comment only)Inspect captured patch +9 / −9
diff --git a/src/test/fuzz/p2p_headers_presync.cpp b/src/test/fuzz/p2p_headers_presync.cpp
index d8a748ee..fa041f34 100644
--- a/src/test/fuzz/p2p_headers_presync.cpp
+++ b/src/test/fuzz/p2p_headers_presync.cpp
@@ -164,7 +164,7 @@ FUZZ_TARGET(p2p_headers_presync, .init = initialize)
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
// The steady clock is currently only used for logging, so a constant
// time-point seems acceptable for now.
- SteadyClockContext steady_ctx{};
+ FakeSteadyClock steady_ctx{};
ChainstateManager& chainman = *g_testing_setup->m_node.chainman;
CBlockHeader base{chainman.GetParams().GenesisBlock()};
diff --git a/src/test/fuzz/util/check_globals.cpp b/src/test/fuzz/util/check_globals.cpp
index 1c299069..431519dc 100644
--- a/src/test/fuzz/util/check_globals.cpp
+++ b/src/test/fuzz/util/check_globals.cpp
@@ -44,7 +44,7 @@ struct CheckGlobalsImpl {
"The current fuzz target accessed system time.\n\n"
"This is acceptable, but requires the fuzz target to use \n"
- "a FakeNodeClock, SteadyClockContext or call \n"
+ "a FakeNodeClock, FakeSteadyClock or call \n"
"SetMockTime() at the \n" "beginning of processing the \n"
"fuzz input.\n\n"
diff --git a/src/test/pcp_tests.cpp b/src/test/pcp_tests.cpp
index 8ecbab58..9f69e63e 100644
--- a/src/test/pcp_tests.cpp
+++ b/src/test/pcp_tests.cpp
@@ -222,7 +222,7 @@ private:
const std::vector<TestOp> m_script;
mutable size_t m_script_ptr = 0;
mutable std::chrono::milliseconds m_time_left;
- mutable SteadyClockContext m_clock{};
+ mutable FakeSteadyClock m_clock{};
mutable bool m_connected{false};
mutable CService m_bound;
mutable CNetAddr m_local_ip;
diff --git a/src/test/util/time.h b/src/test/util/time.h
index 2bc2553f..213d7b27 100644
--- a/src/test/util/time.h
+++ b/src/test/util/time.h
@@ -25,19 +25,19 @@ private:
/// Helper to initialize the global MockableSteadyClock, let a duration elapse,
/// and reset it after use in a test.
-class SteadyClockContext : public LimitOne<SteadyClockContext>
+class FakeSteadyClock : public LimitOne<FakeSteadyClock>
{
MockableSteadyClock::mock_time_point::duration t{MockableSteadyClock::INITIAL_MOCK_TIME};
public:
/** Initialize with INITIAL_MOCK_TIME. */
- explicit SteadyClockContext() { (*this) += 0s; }
+ explicit FakeSteadyClock() { (*this) += 0s; }
/** Unset mocktime */
- ~SteadyClockContext() { MockableSteadyClock::ClearMockTime(); }
+ ~FakeSteadyClock() { MockableSteadyClock::ClearMockTime(); }
- SteadyClockContext(const SteadyClockContext&) = delete;
- SteadyClockContext& operator=(const SteadyClockContext&) = delete;
+ FakeSteadyClock(const FakeSteadyClock&) = delete;
+ FakeSteadyClock& operator=(const FakeSteadyClock&) = delete;
/** Change mocktime by the given duration delta */
void operator+=(std::chrono::milliseconds d)
diff --git a/src/util/time.h b/src/util/time.h
index 2e54ff85..7df7c39a 100644
--- a/src/util/time.h
+++ b/src/util/time.h
@@ -42,7 +42,7 @@ using SteadyMicroseconds = std::chrono::time_point<std::chrono::steady_clock, st
using SystemClock = std::chrono::system_clock;
/// Version of SteadyClock that is mockable in the context of tests (via
-/// SteadyClockContext, or Self::SetMockTime), otherwise the system steady
+/// FakeSteadyClock, or Self::SetMockTime), otherwise the system steady
/// clock.
struct MockableSteadyClock : public std::chrono::steady_clock {
using time_point = std::chrono::time_point<MockableSteadyClock>;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.