Setting block timestamp not reflecting timestamp inside Fuel VM

I’m running into the same problem @buddy-brontosaurus had here:

I can use the SDK to set block timestamps, and this works normally if I query from Rust using provider.get_blocks.

However, when I call the following code in my Sway contract:

    fn get_time() -> u64 {

…it returns the current time, (4611686020106380522), not the custom time that I tried to specify.


FWIW I never found a resolution. I just created a helper timestamp method on Sway and called those from the rust sdk.
The other option is mocking your own timestamps


Would be highly appreciated if sb could clarify whether setting a custom timestamp is now possible or not.


yes , its slow respond website

Hey, sorry this passed our radar. There was a problem with the way fuel-core handled block production, that was fixed here.
Progress on integrating this upstream change in the SDK is tracked here, it should be out soon.

1 Like

The fix was part of, and you can find a proper example since docs: show example of block time travel by iqdecay · Pull Request #985 · FuelLabs/fuels-rs · GitHub.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.