Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion crates/core/src/rpc/surfnet_cheatcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,14 @@ impl SurfnetCheatcodes for SurfnetCheatcodesRpc {
config: Option<TimeTravelConfig>,
) -> Result<EpochInfo> {
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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather be clear in the docs + erroring that the timestamp should be in ms, rather than play this guessing game of should we/should we not convert. Thoughts @lgalabru?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather be clear in the docs + erroring that the timestamp should be in ms, rather than play this guessing game of should we/should we not convert. Thoughts @lgalabru?

Ideally fixing the source of the bug would be best I'm just not sure where to find the timeTravel ui i think that may be where it is

*ts *= 1000;
}
}
let simnet_command_tx = meta.get_surfnet_command_tx()?;
let svm_locker = meta.get_svm_locker()?;

Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it doesn't really make sense to me for the default time to be now - why would the user time travel to now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it doesn't really make sense to me for the default time to be now - why would the user time travel to now?

when time traveling it to say x time it ends up (x time + 1hour) so seems like default value is still being applied when entering your own value

}
}

Expand Down