Commit Graph

144 Commits

Author SHA1 Message Date
Remy
6ed21247a3
LF: clean up useless version tests. (#10833)
Since SDK 1.0.0 the min LF version is 1.6.
We drop some checks that are now redundant.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-10 11:43:49 +00:00
Remy
e42cd3a1c6
LF: add interface to scala AST and decoder (#10830)
this is part of #10810

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-10 08:46:19 +02:00
Remy
c4e0a755d4
LF: drop ad-hoc ImmArray builders (#10763)
Since we switch to scala 2.13, ImmArray companion object extends
`Factory`. Hence:

- the `apply` methods of `ImmArray` override the one from `Factory`

- we can use the notation `.to(ImmArray)` to convert an `Iterable` to
  `ImmArray`

This PR drops those `apply` ImmArray. Conversion from Iterable to
`ImmArray` should use the `.to(ImmArray)`.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-04 16:10:07 +02:00
Oliver Seeliger
e807f4a918
Upgrade to a newer canton version (post 0.27.0 snapshot version) (#10632)
* Upgrade to a newer canton version (post 0.27.0 snapshot version)

with canton-community configuration that supports higher throughput.

changelog_begin
changelog_end

* Disable flaky reject DeeplyNestedValueIT:Reject tests that time out half the time
2021-08-20 06:10:54 +00:00
Andreas Herrmann
5cc78f5254
Handle missing template instances in Daml ledger export (#10526)
* LF 1.6 ledger export integration test

Test that Daml ledger export script handles DALF packages in LF version
1.6. These packages don't contain metadata, meanint `--package` flags
have to use the hash rather than the package name, and they contain no
type class instances, meaning the export script needs to contain newly
defined instances for type classes required to issue ledger commands in
Daml script.

changelog_begin
changelog_end

* Expose unconstrained Daml script commands

This will be used in Daml ledger exports of contracts defined in Daml LF
versions before 1.8. These versions did not include typeclass instances,
meaning that instances such as HasTemplateTypeRep need to be recreated
in the export Script. Not all instances required in the `Template t`
constraint can be recreated at the use-site. E.g. `HasSignatory`. By
avoiding these kinds of constraints it is possible to handle these cases
in Daml ledger exports anyway.

changelog_begin
changelog_end

* Identify all templates with missing instances

changelog_begin
changelog_end

* Use internal*Cmd on templates missing instances

changelog_begin
- [Daml export] Daml ledger export now handles templates in packages
  using LF versions 1.7 or older. These package versions don't include
  type class instances and Daml ledger export needs to generate
  replacement instances in the generated script. The generated script
  uses less type-safe versions of Daml script ledger commands.
changelog_end

* Add encodeType to encode Ast.Type in ledger export

This will be required to encode HasContractKey instances.

changelog_begin
changelog_end

* Simplify newline handling in encodeExport

* Encode missing template type class instances

* ZIP entries must use forward slash as path separator

* Throw error on encode of Any

Addressing
https://github.com/digital-asset/daml/pull/10526#discussion_r685807454

* Qualify choice using argument type

Addresses review comment
https://github.com/digital-asset/daml/pull/10526#discussion_r685817745

* Use lf.language.Util

Addresses
https://github.com/digital-asset/daml/pull/10526#discussion_r685827150

* Factor out header comment in tests

Addressing review comment
https://github.com/digital-asset/daml/pull/10526#discussion_r685830832

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-10 16:44:11 +00:00
Andreas Herrmann
7c6d3c5bc7
Handle package dependencies without metadata in Daml export (#10481)
* Expose set of stable-packages package-ids

Needed in Daml ledger export to decide whether to depend on a package
without metadata or not.

changelog_begin
changelog_end

* Handle package dependencies without metadata in Daml export

This addresses the immediate issue reported in
https://github.com/digital-asset/daml/issues/10435.

DALF before LF version 1.8 don't contain metadata such as the package
name and version. However, Daml ledger export assumed that metadata was
available to generate `--package` flags for data-dependencies.

This change generates `--package=<hash>` flags for such dependencies on
packages that don't have metadata available.

This change requires additional care when checking if a package is a
stable-package. As the package name is not available without metadata we
cannot just check against names such as `daml-stdlib`. Instead this
change uses the list of stable-package package-ids exposed by
`com.daml.lf.language.StablePackages.Ids`, which was introduced in
0da814d250 (diff-208c6948c7c7f2b582faa8e4792bfe78b231188881947ad0cdd5046e0b9a40e7)

Note that this does not fully resolve #10435. Building a generated Daml
ledger export script will fail on missing instances of standard classes
such as `HasTemplate` because packages prior to LF version 1.8 don't
contain type-class instances. This will be addressed in a separate PR.

changelog_begin
changelog_end

* Fix Scala 2.12

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-04 18:11:17 +02:00
Remy
dc47b105de
LF: Log internal errors (#10471)
part of #9974

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-04 12:31:58 +02:00
Remy
1971274893
Reactive canton conformance test aginst LF 1.13 (#10458)
Now we compile the conformance test for 1.13, we can run conton
against 1.13.

follow up of #10456

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-02 19:43:37 +02:00
Moritz Kiefer
4cf5641678
Build & releases 1.13 Ledger API test tool (#10456)
Temporary hack to unblock Canton until they finish their exception support.

changelog_begin
changelog_end
2021-08-02 13:27:45 +00:00
Remy
73290c29d5
LF: Add context in missing package errors (#10418)
explaining the origining of missing package.

This is part of #9974

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-28 12:17:07 +02:00
Remy
41009f79cc
Compiler: Make LF 1.14 the default output (#10394)
CHANGELOG_BEGIN

- [Compiler] Default compiler output LF version is now 1.14

CHANGELOG_END
2021-07-28 12:14:56 +02:00
Sofia Faro
0da814d250
Let stable packages bypass LF version restrictions. (#10377)
* Stable packages bypass version restrictions.

Part of #10029

changelog_begin
changelog_end

* Add missing bypass

* scalafmt

* Fix tests

* fix script runner

* Fix scenario service

* Dont make stable packages configurable

* unused import

* revert unnecessary formatting changes

* Added a StableOnly engine mode and a conformance test that uses it

* buildifier-fix

* Inline LanguageVersions.StableOnly

* scalafmt

* Remove EngineMode in favor of representing the version range directly

* Add -unsafe to flag name

* Apply suggestions from code review
2021-07-27 18:51:00 +00:00
Remy
85af078085
LF: parser for LF versions (#10424)
* LF: Simpler parser for LF version

CHANGELOG_BEGIN
CHANGELOG_END

* add a test
2021-07-27 15:46:47 +00:00
Remy
72cf2f36d3
LF: replace bazel keyword stable by default (#10410)
to refer to the compiler default LF output.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-27 09:27:03 +02:00
Remy
faf479e8c8
LF: add context in LookupError (#10314)
This is part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-21 19:03:53 +02:00
Remy
159728d716
LF: use Either by default in all archive reader API (#10295)
This is a follow up of #10277.
This is part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-19 19:48:37 +02:00
Remy
6e8ec1d618
LF: Drop old depreated code (#10251)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-13 13:10:00 +00:00
Remy
f745f10394
LF: Realease LF 1.14 (#10077)
CHANGELOG_BEGIN
- [LF] Add support for Excepction
CHANGELOG_END
2021-06-24 13:44:09 +02:00
Remy
a6b536f3c4
Compiler: Make LF 1.13 the default output (#9907)
* Compiler: Roll LF Version

Fix #8591

CHANGELOG_BEGIN
- [Compiler] Default ouput LF version is now 1.13
CHANGELOG_END
2021-06-24 11:58:50 +02:00
Remy
cbcec32e70
LF: clean up the remaining Exception TODOs (#9913)
CHANGELOG_BEGIN
CHANGELOG_END
2021-06-08 11:49:02 +02:00
Remy
db1453640f
LF: Freeze archive proto for LF 1.14 (#9912)
CHANGELOG_BEGIN
CHANGELOG_END
2021-06-07 12:44:20 +00:00
Remy
512f1fd87d
LF: Preview version of LF 1.14 (#9906)
+ Preview support for Exceptions.
+ byKey flag for transaction nodes.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-03 20:40:53 +02:00
Remy
7bc925e4d2
LF: Factorize the logic for AST lookup (#9871)
Factorize the logic for AST lookup in
 - compiler 
 - type checker 
 - preprocessor
 - script triggers 
 - some tests

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-03 13:32:56 +02:00
Remy
1f021b25c6
LF: Drop Builtin Exceptions completly (#9790)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-26 19:30:44 +02:00
Remy
5855a9941f
LF: Drop CONTRACT_ERROR (#9754)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-21 09:12:29 +00:00
Miklos
f5c84a2aa4
Daml-LF: Damlification of Scala/Haskell files (#9666)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-20 09:52:33 +02:00
Remy
2e9bb21091
Engine: clean conversion builtin names (#9726)
Rename conversion builtins in the engine to follow
archive conventions.

This follows up #9716

CHANGELOG_BEGIN
CHANGELOG_END
2021-05-19 13:02:16 +00:00
Remy
679ce3b7d3
LF: Release LF 1.13 (#9705)
CHANGELOG_BEGIN

- LF: make LF 1.13 stable
   Add support for BigNumeric

- Ledger API: Bump Ledger API version for LF 1.12

CHANGELOG_END
2021-05-18 17:30:34 +02:00
Remy
fc745f2224
LF: clean shifting BigNumeric builtin (#9704)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-17 19:26:14 +02:00
Sofia Faro
22ba5fddd2
Remove builtin exception types from protobuf and ASTs. (#9595)
* Remove builtin exception types from protobuf/AST.

changelog_begin
changelog_end

* Remove builtin exxceptions from protobuf/ast.

* remove unecessary s"

* scalafmt

* syntax error

* Add TODOs

* Apply suggestions from code review

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Add AnyException builtins in typing spec.

* Update protobuf "Next id" comment.

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-05-06 21:26:12 +00:00
Moritz Kiefer
dce6a16649
Add Ledger API test tool tests for exceptions (#9400)
* Add Ledger API test tool tests for exceptions

changelog_begin
changelog_end

* Update daml-lf/language/daml-lf.bzl

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

* Address review comments

changelog_begin
changelog_end

* Shuffle around test

changelog_begin
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-05-03 18:40:52 +02:00
Moritz Kiefer
4aca199bbd
Upgrade to Scala 2.13.5 (#9528)
changelog_begin
changelog_end
2021-04-29 13:05:57 +00:00
Samir Talwar
e1af564bcc
Switch from @silent to @nowarn. (#9498)
* Switch from `@silent` to `@nowarn`.

This annotation is native to Scala 2.12.13+ and 2.13.2+. It replaces
most usages of `@silent`.

I had to get creative about a couple of use cases that didn't work.
Specifically:

  1.  Suppressing deprecation warnings works, but Scala 2.12 erroneously
      complains that the `@nowarn` is unnecessary.  I had to suppress
      this warning too with `-Ywarn-unused:-nowarn`.
  2.  I can't seem to suppress the warning, "The outer reference in this
      type test cannot be checked at run time." Instead, I have
      refactored the code to remove the warning.

We still need to use the silencer plugin to suppress some warnings about
unused imports (because of compatibility between Scala 2.12 and 2.13),
but this means we no longer need the library, and therefore it is not a
transitive dependency that downstream consumers need to worry about.

CHANGELOG_BEGIN
CHANGELOG_END

* Add some comments around `@nowarn` support.

* language-support/scala: Fix a warning suppression.

* Revert to the default warnings.

Compatibility was complaining.
2021-04-26 19:46:14 +00:00
Remy
35759fc83a
LF: Freeze archive proto for LF 1.13 (#9345)
CHANGELOG_BEGIN
CHANGELOG_END
2021-04-07 15:25:17 +02:00
Remy
568a8528a8
LF: release preview of LF 1.13 (#9329)
CHANGELOG_BEGIN
- Daml: (Early access) add support for BigNumeric
CHANGELOG_END
2021-04-07 12:42:54 +02:00
Remy
6c1f404c7d
LF: Add TO_TEXT_BIGNUMERIC (#9276)
This is part of #8719.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-30 13:31:42 +02:00
Remy
51c5eac66e
LF: Add BigNumeric to archive proto (#9210)
CHANGELOG_BEGIN
CHANGELOG_END
2021-03-23 13:58:22 +00:00
Remy
2551b2d615
LF: Add BigNumeric and Rounding to Scala AST (#9205)
This advance the state of #8719

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-23 09:16:27 +01:00
Moritz Kiefer
7a41ee6ce0
Cache contract fetches in speedy (#9192)
* Cache contract fetches in speedy

This PR adds a cache to speedy to cache contract fetches and
information only derived from the contract argument, namely,
signatories, observers and keys.

The cache is engine-internal so on the first fetch of a global
contract in a transaction, we recompute that information.

This does not change observable semantics:

Ledgers must be consistent within a transaction so caching is safe. We
still recompute signatories, observers & keys the first time so if
they fail, we still blow u.

We also never compute more than before. While `SBUFetch` itself did
not compute that information, it was immediately folowed by either
`SBUBeginExercise` or `SBUInsertFetchNode` which compute that
information.

We also keep the optimization that we do not have to compute key and
maintainers on by-key operations

On the collect authority benchmark, this is around a ~1.48x
improvement which is pretty decent.

changelog_begin
changelog_end

* Remove dead code

changelog_begin
changelog_end

* Less stupid error handling

changelog_begin
changelog_end

* Add a test for wrongly typed contract ids

changelog_begin
changelog_end

* Check type of cached contracts

changelog_begin
changelog_end

* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SBuiltin.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Add tests for wrongly-typed contract ids to EngineTest

changelog_begin
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-03-22 13:39:02 +01:00
Remy
4d90d02740
LF: drop useless field arity in Ast Builtin (#9194)
CHANGELOG_BEGIN
CHANGELOG_END
2021-03-19 18:53:49 +01:00
Remy
70379d4e85
LF: Experiment Hook for 1.dev (#9051)
This PR adds a hook in the compiler and the engine to allow easy prototyping of new features.

In particular by using this hook, one can add a new feature in 1.dev with modifying:

    compiler
    type checkers (both Haskell and Scala)
    archive Protobuf
    archive decoder

In addition of development speed, this also adds a bit of confidence, as the peaces enumerated above are not touched when adding the feature: The feature can be added by modifying only 1.dev Daml standard library and Speedy.

aa7991f8 shows a use case of this hook.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-11 21:36:49 +01:00
Remy
8a35528514
LF: Make 1.12 default compiler output (#9058)
CHANGELOG_BEGIN
- [Compiler] The compiler produces LF 1.12 by default. LF 1.12 only reduces transaction size.
CHANGELOG_END
2021-03-10 16:44:29 +00:00
Remy
a9b035e92e
LF: release LF 1.12 (#8856)
CHANGELOG_BEGIN

    - [LF] Release LF 1.12. This version reduce the size of transaction

    - [Compiler]: Change the default LF output from 1.8 to 1.11.

CHANGELOG_END
2021-02-24 21:17:33 +01:00
Remy
d17dd7e5f1
Ledger API test tool: test against legacy and preview version. (#8913)
* Ledger API test tool: test against legacy and preview version.

+ use dictionary instead of alias to map version keywords to LF version 

CHANGELOG_BEGIN
CHANGELOG_END
2021-02-23 09:19:17 +01:00
Moritz Kiefer
efe0f4a096
Include --target flags in daml script dumps (#8872)
As evidenced by #8856, daml script dumps currently fail to compile if
we generate a dump including templates which are newer than the
default LF version in the compiler. This PR addresses this by
including a --target flag in the generated daml.yaml.

changelog_begin
changelog_end
2021-02-17 12:07:23 +01:00
Moritz Kiefer
2528998d00
Generate docs for preview LF version (#8712)
changelog_begin
changelog_end
2021-02-02 10:25:30 +01:00
Sofia Faro
69b28d2ef2
Add --target=1.12 support in the compiler. (#8673)
* Add --target=1.12 support in the compiler.

changelog_begin

- [DAML Compiler] Add support for ``--target=1.12`` in the DAML compiler.

changelog_end

* version1_12 not version1_11

* Update codegen tests.

* Update codegen tests again

* Fix data-dependencies test.
2021-01-29 12:41:21 +00:00
Remy
4bde0dcc29
LF: preview of LF 1.12 (#8652)
CHANGELOG_BEGIN

* LF: preview of LF 1.11. Preview versions can be changed only to
include bug fixes. Changes of LF 1.12 include:
 - reduce transaction size by erasing type information in user-defined
   type.

CHANGELOG_END
2021-01-28 17:28:41 +01:00
Remy
ef8264408f
LF: do not serialized type and field in transaction values. (#8062)
CHANGELOG_BEGIN
CHANGELOG_END
2021-01-27 15:45:10 +01:00
Remy
53ab426119
LF: Release LF 1.11 (#8562)
CHANGELOG_BEGIN

- [Daml-LF] Release LF 1.11
  - add suport for Generic Map
  - add support for choice observer
  - add generic comparison
  - add convert of contract ID to string (available only in off-ledger mode)
  - reduce size of dar using type interning

CHANGELOG_END
2021-01-21 14:27:37 +01:00