setTime for Scripts works after all?

Hi,

the documentation for setTime states

This is only supported in static time mode when running over the gRPC API and in Daml Studio.

Also, the documentation for Script states

setTime is not supported and will throw a runtime error

But I have a Script here that uses setTime, and when I run daml test this seems to work just fine. The test output is reporting a ledger time that is equal to what I have configured via setTime.

Can anyone provide an explanation that resolves this apparent contradiction?

Regards,
Alex

2 Likes

daml test runs against a special dummy in-memory ledger (what we used to call the scenario service but that name is a bit silly now that it runs daml scripts) which is always in static time mode. This is the same in memory ledger also used by Daml Studio so the same thing applies there. If you run it against a real ledger over gRPC (daml test-script works for this as well although it looks like it might still default to static time mode), you will get an error if your ledger is not configured in static time mode which for Sandbox means you haven’t passed --static-time.

2 Likes

Should the line in the Script docs be setTime is only supported in static time mode and will throw a runtime error if it's not then?

The line you’re quoting is in the section on running Daml Script over the JSON API. There it is never supported.

1 Like

I think what could be useful is a table that is providing an overview of all the options to run DAML code, scenarios and scripts, the specific features and constraints for each (static time, JSON API, contract IDs, etc.) , the general steps how to do that (DAML Studio, daml start, daml test, daml sandbox, deploy to Sandbox, deploy to DABL, deploy to other ledger, etc), and how those options relate to each other.

Maybe this is something for your cheat sheet, @drak?

Regards,
Alex

2 Likes

Thanks for the fresh ideas! I’ll update the cheat sheet soon.

3 Likes