Release of Daml Connect 1.13.0

Note: There is a performance regression in the Daml Driver for Postgres that is now fixed and noted in Daml Connect 1.13.1 release. Daml Connect 1.13.0 is no longer supported.

Daml Connect 1.13.0 has been marked stable on Wednesday May 12th. You can install it using:

daml install latest

Want to know what’s happening more broadly among Daml developers? Check out the latest Daml Developer Monthly.

Summary

Daml Connect 1.13 is primarily a usability and bugfix release, but also introduces several features in Early Access for the first time:

  • Record Dot Updates in Daml provide a much easier way to manipulate deeply nested data structures.
  • BigNumeric, a new Daml data type for arbitrary precision arithmetic is now available in Beta.
  • Daml Script Export is now in Alpha. It’s a tool that allows you to extract data from a live ledger into a Daml Script. Think “SQL Script Exports” for Daml!
  • The Enterprise Edition of Daml Connect now has Alpha Oracle Database support for all runtime components. This goes hand-in-hand with a recent Alpha release for the Daml Driver for Oracle Database.

Impact and Migration

This release is almost entirely additive. Its main purpose is to allow you to benefit from recent fixes and try out upcoming features in Early Access.

The only change for which we recommend action is that the InsertOrdMap type in the Scala bindings is now deprecated. This used to be how the Scala Codegen represented the Daml GenMap type. We recommend using the provided Primitive.GenMap type instead.

Known Issues

  • Windows Defender gives a warning when attempting to install Daml via the installer. We are working on getting the correct certificate in place so that this warning does not occur when using the Windows installer. Existing users already running Daml on Windows and upgrading to 1.13.1 via the command line are unaffected.

What’s New

Record Dot Updates

Background

Daml is designed with safety and usability  in mind, trying to make it as easy as possible to build confidence in written code. One property of the language that is firmly on the safety side is that all data is immutable. With Daml’s record dot syntax, a feature that was ultimately upstreamed into the Glasgow Haskell Compiler, we invested heavily in also providing usability via familiar access patterns. With record dot updates, the same usability is now coming to data manipulation.

Specific Changes

Nested record fields can now be updated in an intuitive way:

data X = X with
  a : Y
data Y = Y with
  b : Int

beforeRecordDotUpdates : X -> X
beforeRecordDotUpdates x = x with
  a = x.a with
    b = 1

withRecordDotUpdates : X -> X
withRecordDotUpdates x = x with a.b = 1

Impact and Migration

This is primarily a usability improvement, but if you are using advanced programming techniques like lenses to accomplish the same thing, we recommend switching. Record dot updates have significantly better performance characteristics.

Early Access Features

BigNumeric and Daml-LF 1.13 in Beta

Background

Daml’s inbuilt Decimal and Numeric data types are fixed point numbers with a fixed precision of 38 decimals. In some numeric applications, they can require careful management of scale, or pre-condition checking to preserve the required precision in calculations.

The new BigNumeric removes this burden from the developer by allowing them to specify an arbitrary precision that is used for any intermediary results. 

Specific Changes

  • Daml-LF 1.13 is available in the compiler, IDE and Sandbox and can be activated using the build option --target=1.13.
  • Daml has a new data type BigNumeric. BigNumeric represents any positive or negative decimal number with up to 2^15 digits before the decimal point, and up to 2^15 digits after the decimal point.
  • BigNumeric is not serializable, it is only intended for intermediate computation. You must round and convert BigNumeric to a fixed-width 128-bit decimal Numeric n in order to store it in a template.
  • BigNumeric is used via conversion functions fromNumeric and fromBigNumeric to convert between BigNumeric and Numeric n, which includes the alias Decimal == Numeric 10.
  • The Standard Library module DA.BigNumeric provides functions for division and rounding.

Impact and Migration

If you have calculations with critical and hard to manage precision, we recommend trying out BigNumeric and preparing your project for the stable release of this feature in an upcoming release.

Daml Script Exports in Alpha

Background

A common task both during development as well as production debugging, support, or maintenance is to extract part of the state or history of a system for further processing or analysis.

With Daml Script, we have a single format that can be imported in the IDE, Sandbox and production ledgers already. It is Daml’s equivalent of SQL scripts.

Daml Script Exports provide the export counterpart, providing a single flexible way to move ledger data between different production and development environments.

Specific Changes

  • A first version of a daml ledger export script, which allows you to extract ledger history for a set of parties into a Daml Script. See documentation for full use and caveats. Sample use:
daml ledger export script --host localhost --port 6865 --party Alice --party Bob --output ../out --sdk-version 1.13.0

Impact and Migration

This is the first alpha version of a new, entirely additive feature. If you try it out, we’d love to hear your feedback and ideas on how to make it as useful as possible, for example via the Daml forum.

Enterprise Edition support for Oracle DB in Alpha

Background

We are working to give users of the Enterprise Editions of Daml Connect and Drivers more choice in the underlying databases they use for local persistence. The addition of Oracle Database support in Daml Connect goes hand in hand with the Daml Driver for Oracle Database, which was also released in Alpha recently.

Specific Changes

  • In Daml Connect Enterprise Edition, the JSON API and Trigger Host now accept Oracle Database JDBC strings.

Impact and Migration

This feature is purely additive and can be tried out. It is not yet ready for production use and should not be relied upon at this point.

Minor Improvements

  • daml build accepts a new flag --access-token-file. It accepts a path to an access token to authenticate against the ledger API. This is needed if the project depends on a remote Daml package hosted on such a ledger with authentication. The path to the token can also be specified in the daml.yaml project file under the ledger.access-token-file field.
  • A new daml packages list command has been added to the Daml Assistant. It lists packages deployed on a remote Daml ledger.
  • The already deprecated Scala Bindings and Codegen have been tidied up to remove the need for the InsertOrdMap type. The type continues working, but we recommend switching to the Primitive.GenMap type instead. 
  • Ledger API client read requests are now logged at the INFO level. This affects the following services
    • Active Contracts Service
    • Command Completion Service
    • Ledger Configuration Service
    • Ledger Identity Service
    • Package Service
    • Time Service
    • Transaction Service
  • The useStreamFetchByKey and useStreamFetchByKeys functions in the JS @daml/react library now correctly expose the closeHandler of the underlying @daml/ledger library. Their docstrings have also been corrected. Thanks to Huw for reporting this issue on the forum.

Bugfixes

  • Fixed a bug in the Daml Engine where it was possible to fetch/lookup/exercise a local contract by key even if the reading parties are only witnesses, not stakeholders. See issue #9454 for details.
  • Fix a bug where transient duplicate keys did not result in an error. See #9478. Thanks to Liam for reporting this issue on the forum.
  • Fix a bug where the ledger returned InconsistentKeys instead of DuplicateKeys. See #9457.
  • Fix a bug that was preventing submissions with interdependent commands to succeed. See #9370 for details. Thanks to Huw for reporting this issue on the forum.
  • Fix a bug in the JSON API with a PostgreSQL backend where range queries within variant data would not return matching data. See #9321.

Integration Kit

  • TelemetryContext has been introduced to the WriteService.submitTransaction method to support distributed tracing.

What’s Next

  • Work on the Early Access features introduced in this and previous releases will continue to bring them to general availability.
    • Daml Profiler (Enterprise Edition only)
    • BigNumeric
    • Daml Script Export
    • Oracle DB Support
  • In addition, we are expecting to land two new language features in Beta with one of the next releases:
    • Exception handling, which provides try/catch functionality with subtransaction rollbacks.
    • Nested record updates, making it easier to change fields in deeply nested records.
  • Work on improving the Performance of all Daml integrations continues under the hood.