From d101848e34f427eb3a1fdbf253551e14f6251e0a Mon Sep 17 00:00:00 2001 From: peacanduck Date: Mon, 8 Dec 2025 06:46:37 +0200 Subject: [PATCH] removed default + 1 hr and added hotfix for timetravelconfig conversion to ms --- crates/core/src/rpc/surfnet_cheatcodes.rs | 9 ++++++++- crates/core/src/types.rs | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/core/src/rpc/surfnet_cheatcodes.rs b/crates/core/src/rpc/surfnet_cheatcodes.rs index 16eca302..da917edc 100644 --- a/crates/core/src/rpc/surfnet_cheatcodes.rs +++ b/crates/core/src/rpc/surfnet_cheatcodes.rs @@ -1647,7 +1647,14 @@ impl SurfnetCheatcodes for SurfnetCheatcodesRpc { config: Option, ) -> Result { let key = meta.as_ref().map(|ctx| ctx.id.clone()).unwrap_or_default(); - let time_travel_config = config.unwrap_or_default(); + let mut time_travel_config = config.unwrap_or_default(); + // FIX: Convert timestamp from seconds to milliseconds if needed + if let TimeTravelConfig::AbsoluteTimestamp(ref mut ts) = time_travel_config { + // comment If timestamp is in seconds (< 10 billion), convert to milliseconds + if *ts < 10_000_000_000 { + *ts *= 1000; + } + } let simnet_command_tx = meta.get_surfnet_command_tx()?; let svm_locker = meta.get_svm_locker()?; diff --git a/crates/core/src/types.rs b/crates/core/src/types.rs index c0819b37..c87d5301 100644 --- a/crates/core/src/types.rs +++ b/crates/core/src/types.rs @@ -789,8 +789,8 @@ pub enum TimeTravelConfig { impl Default for TimeTravelConfig { fn default() -> Self { - // chrono timestamp in ms, 1 hour from now - Self::AbsoluteTimestamp(Utc::now().timestamp_millis() as u64 + 3600000) + // chrono timestamp in ms, 1 hour from now + 3600000 removed + Self::AbsoluteTimestamp(Utc::now().timestamp_millis() as u64) } }