Commit Graph

5446 Commits

Author SHA1 Message Date
Martin Huschenbett
44db5de726
Damlc ITs fix pretty range (#7707)
The new version of `ghcide` fixes a bug in the pretty printer for
diagnostics. So far, the column number for an error/warning you would
be shown by `daml build` was always be one smaller than in DAML
Studio. Now, we show the same locations across the command line tools
and the IDE.

We also bring our test files in sync with the ranges the command line
tools print now.

CHANGELOG_BEGIN
[DAML Compiler] Show the correct column numbers in error locations
produced by command line tools like `daml build`.
CHANGELOG_END
2020-10-16 09:06:37 +02:00
Kamil Bożek
a2782813e4
Use party identifier for prefix when generating party allocation submission id (#7697)
Use submission IDs with meaningful prefixes when allocating parties.

changelog_begin
changelog_end
2020-10-15 19:41:15 +02:00
Martin Huschenbett
fb33decf09
Warn on potentially un-upgradable language extensions (#7662)
* Warn on potentially un-upgradable language extensions

We issue a warning whenever a module is compiled with a language
extension enabled for which we are not certain that it works with
data-dependencies. Currently, we consider all extensions except for
the ones enables by default, `ApplicativeDo` and
`PartialTypeSignatures` problematic in this regard. The list of
extensions that work fine with data-dependencies might extend over
time but we need to do further research and add further tests before we
add any extensions.

The warning is always put at the location of the module name regardless
of where the `{-# LANGUAGE ... #-}` pragma is actually used. This is due
to the fact that the `ParsedModule` we get from GHC does not contain
the location information of these pragmas. We should probably improve
this over time but I think it is acceptable for now.

CHANGELOG_BEGIN
[DAML Compiler] Warn when a module uses a language extension that
might not work with data-dependencies.
CHANGELOG_END

* Make the warning less polite :)

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-10-15 17:40:13 +00:00
Martin Huschenbett
ac4fef2d44
Bump the version of ghcide we use (#7694)
* Bump the version of ghcide we use

The new version gives access to the `ParsedModule` instead of only the
`ParsedSource` in the preprocessor. See
https://github.com/digital-asset/daml-ghcide/pull/3
for details.

We also need to fix a few things in `bazel-haskell-deps.bzl` to reflect
that we use our fork of `ghcide`, which lives in
`digital-asset/daml-ghcide`, instead of the old
`digital-asset/ghcide`, which we handed ove to the community, now.

CHANGELOG_BEGIN
CHANGELOG_END

* Update to use fixed ghcide version

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-15 15:11:15 +00:00
Sofia Faro
807a6a3f94
Add a representation of functional dependencies during LF conversion. (#7698)
* Add functional dependency metadata in LF.

This PR adds a new value definition during LF conversion, for type classes with functional dependencies. The binding is a representation of the functional dependency, so we can later pick it up in data-dependencies.

For example, given a typeclass `Foo a b c` with the functional dependency `a -> b, c -> a b` will give rise to a new value definition `$fdFoo` (`$$fdFoo` after name mangling) of type:

```
forall (a : *) (b : *) (c : *).
  { _1: {_1: a} -> {_1: b}
  , _2: {_1: c} -> {_1: a, _2: b}
  }
```

where the `{ ... }` are LF structs. This is a simple encoding of the underlying representations for functional dependencies (which is `[([TyVar], [TyVar])]`).

The PR also adds a test to make sure the functional dependency metadata is exposed, and handles kinds other than kind star correctly. The use of this metadata in data-dependencies is left to a separate PR.

changelog_begin
changelog_end

* Add comment
2020-10-15 14:42:01 +00:00
Moritz Kiefer
886d3ec358
Clarify recommended backend for JSON API (#7699)
changelog_begin
changelog_end
2020-10-15 16:37:10 +02:00
Moritz Kiefer
9c339f3c1c
Address review feedback from #7682 (#7691)
changelog_begin
changelog_end
2020-10-15 16:35:27 +02:00
azure-pipelines[bot]
396f498efb
update compat versions for 1.6.0 (#7695)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Azure Pipelines DAML Build <support@digitalasset.com>
2020-10-15 16:28:49 +02:00
Gary Verhaegen
305a097a93
ci/cron: move concurrency from Bash to Haskell (#7696)
One small step further in removing the Bash.

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-15 14:00:55 +02:00
Remy
9b2a7d59e8
LF: enforce non-empty maintainers in contract key in fetchByKey (#7649)
This fixes a bug in the Speedy interpreter. With this change, the
interpreter crashes if it attempts to fetch using a contract key that
has an empty set of maintainers. This propagates to exerciseByKey as
this command is compiled using fetchByKey speedy built-in.

This is a breaking change approved by @bame-da .

CHANGELOG_BEGIN
    [LF] (Bug fix) enforce non-empty maintainers in contract key during fetchByKey and exericiseByKey.
CHANGELOG_END
2020-10-15 12:22:56 +02:00
Gary Verhaegen
ad79acdb65
ci/cron: ability to run check locally (#7690)
This PR allows the script to run without GCP credentials. It will
obviously then skip the bits that require GCP credentials, but that
still leaves it with plenty of things to do.

Because checking all releases can still be quite long (around an hour on
CI, and my personal connection is a bit slower), this also introduces a
new parameter that restricts the number of releases to test.

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-15 12:18:45 +02:00
Moritz Kiefer
76919ff33a
Remove deprecated variant syntax from Java codegen example (#7693)
changelog_begin
changelog_end
2020-10-15 12:02:49 +02:00
Martin Huschenbett
1f0eece7bb
@daml/types: Improve Unit type (#7687)
* @daml/types: Improve Unit type

tl;dr: If we ever want to fix the `Query<T>` type from `@daml/ledger`,
we need a better definition of `Unit`.

TypeScript's type system may not be particularly sound, but the type
`{}` still sticks out as being a very special mess. I _think_ it is
something along the lines of
```typescript
type {} = Exclude<object, null> | string | number | boolean;
```
It is definitely not the type of all records or the type of only the
empty record.

I think it is reasonable to expect that the type relation defined by
```typescrupt
type Equiv<T, U> = T extends U ? U extends T ? true : false : false;
```
is extensional equality of types. Unfortunately, it isn't. For
instance, we have
```typescript
Equiv<{}, {[key: string]: string}> == true
```
but the value `{x: 1}` is assignable to type `{}` but not to type
`{[key: string]: string}`.

The type defined by the interface
```typescript
interface Unit {}
```
is a similarly hot mess as the type `{}`. Although they might seem to
be the same, particularly since we have
```typescript
Equiv<{}, Unit> == true    and    Equiv<Unit, {}> == true
```
here's a way to tell them apart:
```typescript
Equiv<Unit, {[key: string]: string}> == false
```
Thus, I would say the `Unit` type is mildly saner than the `{}` type.

Why does this matter? If we ever want to fix the query `Query<T>` type,
we need to be able to tell the unit type and `TextMap<_>` apart on the
type level. As demonstrated above, this seems impossible if we use `{}`
as the unit type but it is possible if we use the `Unit` type defined
above as the unit type.

Since I couldn't find a single value that is assignable to only one of
`{}` and `Unit` but not the other, this change should not break
anything at all. That said, I'll refrain from a changelog entry.

CHANGELOG_BEGIN
CHANGELOG_END

* Make eslint happy

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-15 09:08:15 +00:00
azure-pipelines[bot]
cc670ea656
update compat versions for 1.7.0-snapshot.20201013.5418.0.bda13392 (#7681)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Azure Pipelines DAML Build <support@digitalasset.com>
2020-10-15 10:51:36 +02:00
Moritz Kiefer
a47bd9eef0
Release SDK 1.6.0 (#7692)
changelog_begin
changelog_end
2020-10-15 10:47:32 +02:00
Martin Huschenbett
840fabbea2
Spell out bazel directories in .gitignore (#7688)
* Spell out bazel directories in .gitignore

With the old `/bazel-*` pattern in there, `rg` also ignores files like
`bazel-haskell-deps.bzl`, which is quite inconvenient.

I obtained the list of what should be hidden by uncommenting the
`/bazel-*` line and adding evering `git status` showed as new files.
Thus, the list is hopefully complete.

We have a similar issue with `/compatibility/bazel-haskell-deps.bzl`.
Since I could figure out what exactly we want to ignore there, I just
added an un-ignore for that single file.

CHANGELOG_BEGIN
CHANGELOG_END

* Go with the unignore approach everywhere

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-15 08:25:57 +00:00
Moritz Kiefer
40335c5ccd
Support specifying the jdbc URL for the JSON API in an env var (#7686)
This PR shuffles things around a bit to make it easier to test and
adds `--query-store-jdbc-config-env` which specifies the name of an
environment variable containing the jdbc URL. The UX for this is
modeled after #7660.

Added a test for the different formats.

fixes #7667

changelog_begin

- [JSON API] The JDBC url can now also be specified via
`--query-store-jdbc-config-env` which reads it from the given
environment variable.

changelog_end
2020-10-14 20:19:35 +02:00
azure-pipelines[bot]
338f42f050
rotate release duty after 1.7.0-snapshot.20201013.5418.0.bda13392 (#7677)
@robin-da is taking care of 1.7.0-snapshot.20201013.5418.0.bda13392 (#7676), so they get pushed back to the end of the line.

Please do not merge this before #7676.

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Azure Pipelines DAML Build <support@digitalasset.com>
2020-10-14 18:29:04 +02:00
Stephen Compall
6d39ac6984
allow updating user state from high-level trigger rule (#7674)
* allow updating user state from high-level trigger rule

* fix tests and examples for new rule signature

* fix doc for new rule signature

* add changelog

CHANGELOG_BEGIN
- [Triggers] ``rule`` can now ``get`` and ``put`` the user-defined state just
  like ``updateState`` does.  It no longer accepts the state as an argument.
  You can port your rule function types by replacing ``s -> TriggerA`` with
  ``TriggerA s``, removing the last argument from the function, and using
  ``get`` to retrieve the state at the beginning of the ``rule``'s ``do`` block,
  if needed.
  See `issue #7674 <https://github.com/digital-asset/daml/pull/7674>`__.
CHANGELOG_END

* test that rule userState changes propagate all the way out

* adapt compatibility filtering to #7681
2020-10-14 14:51:25 +00:00
Moritz Kiefer
598698abb7
Support multi-party queries in daml script (#7682)
Small comment: This is technically not completely backwards compatible
since it messes with type inference. But to hit that you are doing
something sufficiently advanced that you should be able to add the
type annotation that is required

fixes #7635

changelog_begin

- [DAML Script] `query`, `queryContractId` and `queryContractKey` now
  accepts multiple parties using the `IsParties` abstraction used by
  `signatory`, `observer` and other fields. They will return all
  contracts for which any of the given parties is a stakeholder. Since
  `Party` is an instance of `IsParties`, this is fully backwards
  compatible.

changelog_end
2020-10-14 16:03:48 +02:00
mzagorski-da
ef4e822573
Print identifierSuffix in ledger-api-test-tool report (#7680)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-14 15:56:54 +02:00
Kamil Bożek
f21142b1bb
UTC date format in ledger-api-test-tool logs [KVL-626] (#7683)
* UTC date format in ledger-api-test-tool logs

* Changed timestamp millis separator to dot for ledger-api-test-tool
2020-10-14 15:56:08 +02:00
anthonylusardi-da
2007c92393
Remove refs to #public Slack channel and some general Slack refs (#7684)
* Remove references to #public Slack channel and some general Slack references

* CHANGELOG_BEGIN
CHANGELOG_END
2020-10-14 09:47:17 -04:00
azure-pipelines[bot]
c6c889a114
release 1.7.0-snapshot.20201013.5418.0.bda13392 (#7676)
snapshot release

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Azure Pipelines DAML Build <support@digitalasset.com>
2020-10-14 13:40:11 +02:00
Moritz Kiefer
80a25bf54a
Bump perf sha (#7679)
The change from #7666 is benign so we can simply bump this.

changelog_begin
changelog_end
2020-10-14 11:38:49 +00:00
Moritz Kiefer
cd4f085e92
Support multiple parties in scenario’s ParticipantView (#7666)
As part of multi-party read/write on command submissions we also need
to be able to support multi-party queries in DAML Script. Since the
queries in DAML Studio go via ParticipantView, this PR extends this as
a prerequisite to making use of this in DAML Script.

This does not yet relax any restrictions on command submissions. Those
still require a single committer.

For consistency with the surrounding code, I went for a simple Set
rather than a non-empty Set.

changelog_begin
changelog_end
2020-10-14 12:51:02 +02:00
Remy
0bb378690d
LF: Add ExerciseByKey Update (#7663)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-14 12:06:36 +02:00
Martin Huschenbett
5efc68d1e8
Add more tests for data-dependencies (#7670)
This PR adds a tests to check that the following DAML features,
possibly hidden behind language extensions, work with
`data-dependencies`:

* data constructor operators
* type operators
* partial type signatures
* ambiguous types
* instance signatures
* undecidable instances

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-14 09:43:55 +02:00
Stephen Compall
bda13392fd
replace getContracts with query Action, usable in initialize, updateState, rule (#7632)
* add ACS reader to TriggerA and TriggerStateA

* propagate changes in TriggerA, TriggerStateA structure

* allow query to be used in updateState and rule

* remove getTemplates

* remove ACS argument from updateState and rule

* fix type parameter order on query

* use query function in all tests and examples

* replace getContracts with query in documentation

* use wildcards instead of otherwise

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* rename TriggerStateA to TriggerUpdateA

- suggested by @cocreature; thanks

* missed renamings of TriggerStateA to TriggerUpdateA

- suggested by @cocreature; thanks

* make the meaning of the rlift functions clearer

* make initialize a TriggerInitializeA instead of a function; remove getContracts

* update tests and examples for new initialize signature

CHANGELOG_BEGIN
- [Triggers] Trigger ``updateState``, ``rule``, and ``initialize`` functions no
  longer accept an ``ACS`` argument; instead, they must use the ``query`` action
  to query the ACS, similar to the same function in DAML Script.
  See `issue #7632 <https://github.com/digital-asset/daml/pull/7632>`__.
CHANGELOG_END

* disable older compatibility trigger builds

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-10-13 13:20:43 -04:00
Stephen Compall
bafde51752
add silent_annotations option to da_scala bazel functions (#7668)
* add silent_annotations option to da scala bazel functions

* use silent_annotations for several scala targets

* use silencer_plugin instead when the lib isn't used

* use silent_annotations for several more scala targets

* use silencer_lib for strange indirect requirement for running tests

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* silent_annotations support for scaladoc
2020-10-13 15:44:16 +00:00
Stephen Compall
1a2afd5266
upgrade to Scala 2.12.12 from 2.12.11 (#7661)
* upgrade bazel settings to scala 2.12.12

* upgrade nix scala tool to scala 2.12.12

* upgrade silencer references to scala 2.12.12

* repin for scala 2.12, silencer, wartremover upgrades

* remove numerous occurrences of unused silencer now spotted

* update Scala version in our bazel notes

CHANGELOG_BEGIN
CHANGELOG_END

* update compatibility maven_install.json to match compatibility WORKSPACE
2020-10-13 08:42:14 -04:00
Martin Huschenbett
71d32810ec
Improve the naming of things in data-dependencies tests (#7665)
`P1` and `P2` are not particularly descriptive module names. Neither
are `type` and `main` good project names.

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-13 11:56:01 +00:00
Martin Huschenbett
a1bb5c6b6a
Refactor packaging test for data-dependencies (#7664)
We have plenty of tests that check that a certain feature can be used
with data-dependencies. Most of these tests have exactly the same
structure and have most likely been copied and pasted. Let's put an end
to this and use a function abstracting this test pattern instead. I'll
add quite a few more tests of this kind, so the gains will be even
bigger than shown here.

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-13 11:26:52 +00:00
azure-pipelines[bot]
dc827d656c
update compat versions for 1.6.0-snapshot.20201012.5316.0.d21cb496 (#7658)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Azure Pipelines DAML Build <support@digitalasset.com>
2020-10-13 13:01:43 +02:00
Remy
8a9e59d99e
LF: mark nodes if they correspond to a "by key" operation. (#7617)
Currently the list of node that correspond to a "by key" operations 
is tracked in the Transaction metadata. this PR move this information 
into the nodes themself.

This is a preparatory work to include this information in the serialization 
format for  transactions

This advances the state of  #7622

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-13 12:44:03 +02:00
Remy
dc34d4f637
LF: add PackageInterface a lightweigh Package (#7577)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-13 12:41:22 +02:00
Miklos
3956fe7925
Input & output keys available for LedgerWriter [KVL-455] (#7584) 2020-10-13 12:24:36 +02:00
mziolekda
22fb8d4706
Supply jdbc string through an env variable (#7660)
* Supply jdbc string through an env variable

* address review comments
2020-10-13 10:02:25 +02:00
Remy
60efe06cfe
kvutils: fix bug in the PackageCommitter introduced in #7460 (#7659)
This PR fixes a bug in the PackageCommitter introduced recently.
Dependencies not decoded are assumed to be already preloaded and
should not bee looked for.

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-13 09:08:59 +02:00
Moritz Kiefer
dc6c697339
Release 1.7 snapshot (#7653)
Includes the fix from #7651 so hopefully this one will work.

changelog_begin
changelog_end
2020-10-12 17:56:15 +02:00
Moritz Kiefer
a66b57cb06
Release RC3 for SDK 1.6.0 (#7650)
This includes the backport of a bug in the postgresql migrations for
Sandbox classic: d21cb496b7

changelog_begin
changelog_end
2020-10-12 14:53:54 +00:00
Moritz Kiefer
af92198d26
Unbreak pom_template.xml (#7651)
Somehow I didn’t realize that this section was actually important and
removed due to the sdk mention and because it seemed a bit
useless. This has now resulted in Maven rejecting our
packages. Apologies for the mess.

changelog_begin
changelog_end
2020-10-12 14:36:57 +00:00
tudor-da
cecf8e997a
Snapshot release DAML SDK for 1.7.0 (#7644)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-12 15:56:11 +02:00
Stefano Baghino
c56685839a
Set custom patienceConfig in TrackerImplTest [KVL-609] (#7646)
TrackerImplTests caused a few flaky test failures due to a low timeout configuration.

changelog_begin
changelog_end
2020-10-12 13:20:28 +00:00
Sofia Faro
bda44fb084
Add default method support in data-dependencies. (#7645)
This PR adds default method support in data-dependencies,
including default method signatures (the DefaultSignatures
extension). This adds tests for simple default methods,
and for default methods with signatures.

changelog_begin

- [DAML Compiler] `data-dependencies` now support default
  methods in typeclasses, including default method
  type signatures.

changelog_end
2020-10-12 13:49:54 +01:00
Remy
bebbbc14cd
LF: enforce non-empty maintainers in contract key lookup (#7610)
* LF: enforce non-empty maintainer in contracts key lookup

This fixes a bug in the Speedy interpreter.  With this change, the
interpreter crashes if it attempts to lookup using a contract key that
has an empty set of maintainers.

This is a breaking change approved by Bernhard Elsner.

CHANGELOG_BEGIN
- [LF] (Bug fix) enforce non-empty maintainers in contract key during
  lookupByKey.
CHANGELOG_END

* Apply suggestions from code review

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Address Moritz's  review.

* Address Martin's review

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-10-12 14:32:46 +02:00
Stefano Baghino
1571a0a829
Fix broken migration (#7643)
The existing version of the migration replaced null values with
empty arrays. The presence of null values is used by the queries
to discriminate create and exercise events. This caused an
illegal state exception when reading active contracts for the API
(which are represented by their create events on the events table)
as the reader was mistakenly reading exercise events and create
events.

changelog_begin
changelog_end
2020-10-12 12:32:31 +00:00
Sofia Faro
703c86d4fd
Hide RelTime's constructor from the docs. (#7638)
changelog_begin
changelog_end
2020-10-12 11:43:22 +01:00
Remy
ea2a637a11
LF: decouple template from record in the Scala Ast. (#7631)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-12 11:28:30 +02:00
Moritz Kiefer
01fd1ef9f3
Undamlify README (#7615)
As part of the great renaming, this removes the mention of DAML SDK in
favor of SDK.

changelog_begin
changelog_end
2020-10-12 10:53:55 +02:00