Commit Graph

1736 Commits

Author SHA1 Message Date
Moritz Kiefer
d233bfa4b4
Add missing activeness check when reading from globalKeyInputs (#14080)
* Add missing activeness check when reading from globalKeyInputs

changelog_begin

- Engine. Fix lookup by key. See issue Lookup archived contracts may succeed when combined with rollback exceptions #14107 for more details.

changelog_end
2022-06-13 19:27:08 +00:00
Moisés Ackerman
3255dccfc9
Qualify interface name in _requires_ markers (#14054)
* Add failing test
* update ghc patch
* Update *.EXPECTED.desugared-daml daml-test-files
2022-06-07 10:00:36 +00:00
Moisés Ackerman
ee394702b8
Add CoImplements to DefInterface in protobuf (#14053)
* Update docstring for TemplateImplements.tpiMethods
    * The change happend on https://github.com/digital-asset/daml/pull/13142

* Add CoImplements to DefInterface in protobuf
    * Also adds encoding/decoding logic in the haskell side

* Part of https://github.com/digital-asset/daml/issues/14047

changelog_begin
changelog_end
2022-06-03 16:05:18 +00:00
Remy
ae8f50dbb8
LF: drop inheretedChoices from Implements (#14068)
part of #13653

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 18:48:54 +00:00
Remy
09034a265d
ScenarioRunner: move the building of the speedy machine (#14024)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 16:40:48 +02:00
Remy
7638e086ae
Script: infer the typeId of Choice in daml (#13971)
part of #13653

goes with digital-asset/ghc#122

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 14:02:12 +00:00
Moisés Ackerman
25b342240e
Fix data-dependencies leaking dependency internals (#13981)
* Add failing test

* Do not overwrite existing dalfs when installing a dar dependency

changelog_begin
* data-dependencies: fixed an issue with the handling of transitive dependencies through a data-dependency (#13981)
changelog_end
2022-05-30 13:19:59 +00:00
Moisés Ackerman
cc41d0ce3a
Replace 'fetchByKey' with 'lookupByKey' in 'LookupKeyed' choice in KeyNotVisibleStakeholders (#14011)
changelog_begin
changelog_end

Co-authored-by: Danilo Faria <danilo@digitalasset.com>
2022-05-30 08:39:47 +00:00
Moisés Ackerman
789d9a44b1
Integration test fixes (#13982)
* Add integration test for runtime check of contract id in contract key

* Replace 'LookupKeyed' with 'FetchKeyed' in 'blindFetch' scenario

changelog_begin
changelog_end

* Replace 'FetchKeyed' with 'LookupKeyed' in 'divulgeeLookup' scenario
2022-05-25 14:48:09 +02:00
Remy
d3264236ba
Interface: drop collision check between inherited choice name (#13939)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-24 17:53:18 +02:00
Remy
a3cccbc6eb
Update GHC (#13917)
with digital-asset/ghc#120

fixes #13915

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-19 12:52:46 +00:00
Moisés Ackerman
fedfd5ad4a
data-dependencies: Constraint synonym context on class (#13916)
* Add failing test case

* Use convTypeLiftingConstraintTuples for superclasses

changelog_begin
* data-dependencies: fixed an issue with the handling of constraint synonyms in superclasses (#13916)"
changelog_end
2022-05-18 18:04:37 +02:00
Moritz Kiefer
13b69b3004
Fix locations for LF errors (#13895)
* Fix locations for LF errors

fixes #13837

changelog_begin

- [Daml Compiler] Fix locations of certain types of error messages, e.g., missing interface methods.

changelog_end
2022-05-17 13:45:58 +02:00
Remy
ea0d101913
Interface: Rename fixedChoice to choice (#13883)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-17 12:03:53 +02:00
Moisés Ackerman
ad123f9b22
Add da-hls helper (#13853)
* Add haskell-language-server executable

* Add da-hls alias

* strip prefixes in da_haskell_libraries

* Remove dev-env-provided ghcide

* Update mentions of 'ghcide' to 'hls'

changelog_begin
changelog_end
2022-05-12 10:53:10 +02:00
Moisés Ackerman
05960c6edf
Preserve fixity information in data-dependencies (#13774) 2022-05-05 18:50:51 +02:00
Moisés Ackerman
61cb257225
Make disclosure explicit in Daml Studio tree view (#13735)
changelog_begin
* Daml Studio: transaction tree view now differentiates between disclosed and divulged contracts
changelog_end
2022-05-02 09:18:46 +02:00
Moisés Ackerman
9fb7f11316
Replace more instances of 'scenario' with 'script' (#13651)
* Replace more instances of 'scenario' with 'script'

changelog_begin
* Remove Daml Studio 'scenario' snippet
* Add Daml Studio 'script' snippet
* Update documentation for 'daml test' command
changelog_end

* remove 'test' snippet

changelog_begin
* Remove Daml Studio 'test' snippet
changelog_end
2022-04-27 17:49:32 +02:00
Moisés Ackerman
9af86bcc2c
Update reference and docstrings for fromInterfaceContractId and fetchFromInterface (#13712)
changelog_begin
changelog_end
2022-04-27 14:10:17 +02:00
Remy
3e2edfe5e2
Drop wrong comment in GHC.Err (#13664)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-22 13:28:25 +00:00
Robin Krom
c15c5a42a4
daml test: print test summary at end of test suite. (#13648)
This changes the output of `daml test`, such that at the end of the test
suite a summary is printed, indicating which tests failed and which
passed.

Fixes #13535.

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-22 12:30:30 +02:00
Moisés Ackerman
611cce8c8c
Add parens in desugared code (#13603)
* Add parens around 'fromAnyException' view pattern in '_tryCatch' desugaring

* Add parens around desugared 'setField' calls and around its first argument.

* Update desugaring golden files

* Add golden test for parens around 'setField' in renamed daml

changelog_begin
changelog_end
2022-04-20 17:05:16 +00:00
Robin Krom
e0ddfef89c
damlc: add option to filter which scenarios to run (#13600)
This adds an option to specify a pattern such that only tests containing
the given pattern in their name will be executed.

Fixes #13534.

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-20 14:43:14 +02:00
Moisés Ackerman
2e22929cd0
Desugared Daml golden tests (#13591)
* Add daml-desugar library

* Add desugar command to damlc

* Add daml-desugar golden tests

* Add EXPECTED.desugared-daml files for Interface tests

* Add EXPECTED.desugared-daml files for Exception tests

* drop manually generated {Exception,Interface}Desugared files

changelog_begin
changelog_end
2022-04-14 13:14:37 +00:00
Stefano Baghino
d105db2ece
Mention that we do not publish docs for snapshots in the release guide (#13587)
changelog_begin
changelog_end
2022-04-14 10:37:49 +02:00
Robin Krom
fcd3b6622b
ifaces:support exercising by required interface (#13554)
* ifaces:support exercising by required interface

This adds support to exercise an interface choice on a contract ID,
where the interface is required by one of the implemented interfaces of
the contract template.

Fixes #13434.

CHANGELOG_BEGIN
CHANGELOG_END

* some improvements based on review

* added a test plus a bugfix

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

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

* 2 more interface tests for the command preprocessor

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-04-12 18:15:29 +00:00
Moisés Ackerman
d85ced7b79
Cross-module interface tests (#13560)
* Add test case 'require interface from data-dependency'

* Add test case 'data-dependency interface hierarchy'

changelog_begin
changelog_end
2022-04-12 10:23:31 +02:00
Moisés Ackerman
606896e17f
Add partial ContractId-in-template-key check (#13541)
* Add Keyability check in DA.Daml.LF.TypeChecker

* Update expected errors in daml-test-files/ContractIdInContractKey.daml

* Update no-contract-ids-in-keys daml-lf scenario test to circumvent new check

changelog_begin
[Daml Compiler] Implemented compile-time check disallowing ContractId types in contract key types. This check looks for potential problems with the contract key type only within the template's module.
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-04-11 18:05:49 +02:00
Robin Krom
8c046c7776
ghc-lib:remove unused let bindings (#13525)
* ghc-lib:remove unused let bindings

This updates ghc-lib, such that no unused let bindings are created in
Archive choices.

Fixes #13431.

CHANGELOG_BEGIN
CHANGELOG_END

* update ghc-lib hash

* Update of InterfaceDesugared.daml
2022-04-11 12:34:17 +00:00
Moritz Kiefer
7da8d54613
Add unionWith to DA.Map (#13532)
changelog_begin

- [Daml Stdlib] Add `unionWith` function. `unionWith` is a more
  flexible version of `union` that accepts a function to combine
  values found in both maps.

changelog_end
2022-04-08 09:51:47 +00:00
Remy
d94aa137f1
Remove by_interface from scenario transaction Nodes (#13509)
part of #13491

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-06 11:09:52 +00:00
Moisés Ackerman
b08fcfada3
Property test buildLfPackageGraph (#13481)
* Generalize buildLfPackageGraph to arbitrary payload type

* Reinstate 'data-dependencies + exposed-modules' test without quickcheck

* Add property-based test on the graph resulting from buildLfPackageGraph'

changelog_begin
changelog_end
2022-04-06 10:00:58 +02:00
Moisés Ackerman
6402b2e95c
Handle scenario service errors (#13479)
* Add ChoiceGuardFailed and ContractDoesNotImplementInterface errors to scenario-service protocol

* Update daml-test-file InterfaceErrors.daml 

* Add daml-test-files for ChoiceGuardFailed and ContractDoesNotImplementInterface errors

changelog_begin
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-04-05 09:26:08 +00:00
Moisés Ackerman
f59d1cd0b4
Convert experimental primitive TYPEREP_TYCON_NAME into proper LF builtin (#13465)
* Convert experimental primitive TYPEREP_TYCON_NAME into proper LF builtin

* Add entry for TYPEREP_TYCON_NAME in daml-lf spec

* disable quickcheck test in DA.Test.Packaging

changelog_begin
changelog_end
2022-03-31 14:35:46 +02:00
Sofia Faro
7000875e62
interfaces: Make fromInterfaceContractId pure, add fetchFromInterface (#13453)
* interfaces: Make fromInterfaceContractId pure.

This PR changes `fromInterfaceContractId` to make it pure. This means
it cannot verify the contract id coercion, and should only be used
with care. To balance this, this PR also adds `fetchFromInterface` which
combines a `fetch` with a `fromInterface` and `fromInterfaceContractId`,
to serve as a safer alternative to `fromInterfaceContractId`, and is more
useful than the old `fromInterfaceContractId` since it also returns the
fetched & converted contract payload.

changelog_begin
changelog_end

* fix integration tests

* add submitMustFail tests for fromInterfaceContractId
2022-03-30 16:42:03 +00:00
Moisés Ackerman
da812e4c8b
Drop duplicate packages in dependency graph (#13442)
* Drop duplicate packages in dependency graph

* Add double data-dependency test

changelog_begin
changelog_end
2022-03-30 14:54:26 +02:00
Moisés Ackerman
f9f1611d46
Unsafe interface conversion primitives (#13391)
* Add unsafeFromInterface method to HasFromInterface class

* Use unsafeFromInterface instead of fromInterface + experimental primitive

* Drop THROW_WRONGLY_TYPED_CONTRACT experimental primitive

* Add UnsafeFrom{,Required}Interface LF primitives

* Add convertPrim cases for UnsafeFrom{,Required}Interface

* Add InterfaceGuarded tests for WronglyTypedContract cases

changelog_begin
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-03-25 10:07:14 +00:00
Moisés Ackerman
1185eb32bc
Preserve inherited choice info in daml test coverage report (#13354)
* Preserve inherited choice info in 'daml test' coverage report

changelog_begin
changelog_end
2022-03-23 12:28:04 +01:00
Stefano Baghino
50fd93c250
Address remaining issues about CVE-2021-44906 (#13382)
Addresses https://github.com/digital-asset/daml/security/dependabot/28
Addresses https://github.com/digital-asset/daml/security/dependabot/24

changelog_begin
changelog_end
2022-03-23 11:06:31 +00:00
Robin Krom
d10f678518
ifaces: tests for by_interface in transactions (#13365)
We add tests to check that by_interface fields are set for interface
transactions. We also extend the scenario service to show the
by_interface fields in the pretty printed transactions.

Fixes #13333

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-22 19:53:49 +00:00
Moisés Ackerman
b800fdc99a
expand buildLfPackageGraph docstring (#13343)
changelog_begin
changelog_end
2022-03-21 13:29:59 +01:00
Moisés Ackerman
2971949913
Allow dependencies that depend on data-deps (#13205)
Previously, all dependencies were installed first in a single step, and then
the data-dependencies were installed according to the dependency graph. 
This failed for dependencies with data-dependencies since those are processed later.

This was achieved by installing _all_ dependencies and data-dependencies according to the
dependency graph. Additionally, to ensure that the instance-rewriting behavior is preserved, 
the dependency graph is extended with edges from each data-dependency to the subset of 
dependencies without data-dependencies.

[instance rewriting behaviour: the class instances from data-dependencies are rewritten 
to refer to a matching class definition from a dependency when such a class definition exists.
]

* Add edges from each data-dependency to all dependencies without data-dependencies

* Generate stub sources inside for loop

* Update PackageMap manually

* Make PackageNode a sum type

* Add TODO for replacing recachePkgDb

* Tests

    * Generalize 'data-dependencies + exposed-modules' test with QuickCheck

    * Add test for building a project where a dependency has a data-dependency

    * Add test for building a project where a dependency has a data-dependency which is a plain dependency of the main project

    * Add test for building a project where a dependency has a data-dependency which is not a dependency of any kind of the main project

changelog_begin
changelog_end
2022-03-18 16:10:29 +01:00
Sofia Faro
79715ad32d
interfaces: Drop the typerep, raise WronglyTypedContract (#13314)
* Drop the typerep in interface desugaring.

GHC PR: https://github.com/digital-asset/ghc/pull/110

Fixes https://github.com/digital-asset/daml/issues/13275 and https://github.com/digital-asset/daml/issues/13283

changelog_begin
changelog_end

* compile ghc-lib

* update bazel-haskell-deps

* update InterfaceTypeRepCheck test

* scalafmt

* update compile.yml

* update bazel-haskell-deps last time
2022-03-17 16:12:46 +00:00
Sofia Faro
1feb4d25eb
Drop typerep argument from ExerciseInterface. (#13284)
* ifaces: Remove typerep arg from UExerciseInterface

changelog_begin
changelog_end

* Drop typerep argument in protobuf and haskell ast

changelog_begin
changelog_end

* scalafmt

* fix ExprParser

* fix PhaseOneTest

* fix validation test

* update evidencing security
2022-03-15 13:53:06 +00:00
Sofia Faro
83bdd983da
interfaces: Mark interface functions as 1.dev only in docs (#13268)
* iface: Mark functions as 1.dev only in docs

changelog_begin
changelog_end

* Update compiler/damlc/daml-stdlib-src/DA/Internal/Interface.daml

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-03-14 11:47:14 +00:00
Moritz Kiefer
a8057a5741
Handle absence of table view in Daml Studio (#13245)
We encounter that when there are no transactions which can happen
legitimately if you’re testing pure functions.

fixes #11244

changelog_begin

- [Daml Studio] Fix an issue where script views failed to display if
  there were no transactions. Now you can see trace messages even in
  those cases.

changelog_end
2022-03-10 11:56:06 +01:00
Remy
851fb53083
add milli/micro-seconds to RelTime and fix doc (#13217)
CHANGELOG_BEGIN
CHANGELOG_END
2022-03-09 19:09:10 +00:00
Moritz Kiefer
4e004e0a88
Replace scenario messages with script (#13207)
* Replace scenario messages with script

In theory we could try to be clever and print the "right" thing. In
practice, scenarios are almost dead so the complexity for that doesn’t
seem worth it.

fixes #13178

changelog_begin
changelog_end

* .
2022-03-09 11:35:37 +01:00
Moritz Kiefer
af855e5675
Speed up Daml repl startup (#13172)
* Speed up Daml repl startup

Daml repl startup is stupidly slow to the point where starting up and
executing 1+1 takes ~7s (piped to stdin so no typing included).

This PR speeds this up to ~4.5s. In addition to that, we also display
the repl process sooner and complete the last bit of setup while the
user is typing.

Specifically, we do the following:

1. Startup the JVM process in parallel with initializing our package
   db and only block on it once it’s started (and remove a stupid 1s
   sleep which doesn’t actually matter).
2. Load all packages in one go instead of one by one. This (roughly)
   matches how the script service works.
3. Only block on packages being loaded once we start running the
   script. Users can type before and we even typecheck their stuff
   before.

We could take this further and do even more in parallel with users
typing but this seems to strike a good balance between implementation
complexity, UX (if startup actually fails you get somewhat sensible
errors) & performance.

changelog_begin
changelog_end

* handle tls logs

changelog_begin
changelog_end

* Update compiler/damlc/daml-compiler/src/DA/Daml/Compiler/Repl.hs

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* s/terminateBarrier/exitBarrier/

changelog_begin
changelog_end

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-03-09 08:22:42 +00:00
Gary Verhaegen
dfa648f585
hunt down DAML better (#13195)
Process:

- `git ls-files -z | xargs -0 -n 100 sed -i --follow-symlinks 's/DAML/Daml/g'`
- `git add -p`
- `git restore -p`
- Check there is no unstaged change left.

To review:

- Check for false positives by carefully reviewing the diff in this PR.
- Check for false negatives with `git grep DAML`.
- Quicker check for fals positives:

```
git grep DAML | grep -v migration | grep -v DAML_
```

Fixes #13190

Note: This is the "second half" of #13191, which failed to cover all the
remaining DAMLs because of:

```
$ git ls-files | grep "'"
compiler/damlc/tests/daml-test-files/MangledScenario'.daml
```

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-08 17:04:58 +01:00