Cross-SDK compatibility

It’s my understanding that post 1.0.0 SDK release, there is some manner of cross-version compatibility (actually all the way back from 0.13.55 release notes):

Support for cross-SDK DAR Dependencies and Contract Upgrades

What I would like to understand is what this means in terms of running *.dar’s compiled with a different version of the SDK that is on the current ledger (lets forget about data migration for the moment).

I’m thinking specifically of our partners, who won’t always be able to match our release cadence. Furthermore, there will always be a lag between the time that a new SDK version is released, and that version gets implemented in our partner’s ledgers.

What happens in this scenario?

Say I use daml new to create a new project today, so it will have the just-released version 1.1.0. However, my 3rd-party ledger is using an older runtime 1.0.0. Will I be able to upload the 1.1.0 dar onto my ledger?

Conversely, what happens when my old DAML app is several versions behind my shiny new 3rd party ledger? Do I need to update daml.yaml and recompile my project?

Are there some general rules-of-thumb around this? Is the answer specific to every ledger implementation?

2 Likes

There are two important versions in play:

  1. The DAML-LF version, which is the version of the “bytecode” in compiled DARs
  2. The Compiler version, which is the same as the SDK version

Each SDK supports a set of DAML-LF versions, both as compile targets and at runtime in the Sandbox.

So say you have SDK version 0.13.50, which supports LF 1.6 and 1.7, you can compile DARs to those versions, and run them in that sandbox.

Now you start a new project with SDK version 1.1.0, which supports LF 1.6, 1.7, and 1.8, the last of which is the default. The compiled DAR will not run on the 0.13.50 Sandbox as it does not support LF 1.8. However, you can tell the compiler to compile down to 1.7 using the --target=1.7 flag. Your DAR will then run. The other way around, any DARs compiled using SDK 0.13.50 will run on Sandbox 1.1.0, because that does support 1.6 and 1.7.

For cross SDK dependencies using the data-dependencies list in daml.yaml, the referenced DARs simply have to be in the supported LF versions. So any DAR from SDK 0.13.50 can be used in 1.1.0, but only DARs compiled to 1.6 or 1.7 from 1.1.0 can be used in 0.13.50.

3 Likes

Thank Bernhard for that clear answer.

As a follow-up, I’m wondering if there is a way to see current/supported DAML-LF version of either your packages or the ledger, using the daml assistant? I’ve tried using daml navigator console and then the packages command, but that doesn’t give any indication.

You can use daml damlc inspect to see the DAML-LF version of the main DALF in a DAR (there is a lot of output but it’s at the very beginning). You could use daml ledger fetch-dar to download a specific DAR from the ledger and then pass that to daml damlc inspect.

There is no general way to query the supported LF versions in a ledger. Sandbox prints it out on startup.

1 Like