Commit Graph

4257 Commits

Author SHA1 Message Date
Remy
93a01f7e12
DAML-LF: enforce size limit for Contract ID suffixes. (#5913)
Following the Contract ID Specification, we limit the size of contract ID suffixes to 94.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-11 15:32:17 +02:00
Stefano Baghino
dd6af4e276
Centralize index DB metrics naming (#5927)
* Centralize and review index DB metrics naming

Closes #5922

changelog_begin
changelog_end

* Remove unnecessary factory

* Fix compilation issue
2020-05-11 12:59:02 +00:00
Bernhard Elsner
1615a79aea
Update Contract Key docs (#5923)
* Update Contract Key docs

CHANGELOG_BEGIN
CHANGELOG_END

* Also update the Updates section

CHANGELOG_BEGIN
CHANGELOG_END

* Update docs/source/daml/reference/contract-keys.rst

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

* Incorporate feedback

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-05-11 12:18:19 +00:00
Moritz Kiefer
c3f6d85192
Bump timeout in create-daml-app tests (#5928)
At least with the official azure CI nodes, this seems to run into timeouts.

changelog_begin
changelog_end
2020-05-11 11:40:47 +00:00
nickchapman-da
4823053441
Add instrumentation and lightweight tracing to Speedy CEK machine (#5819)
- Disabled by default.
- Enabled with flags: `enableInstrumentation` and `enableLightweightStepTracing'

The instrumentation:
- tracks #pushes and maximum-depth for the `kont`-stack and the `env`ironment
- counts #steps
- classifies  each step:
    - for `CtrlExpr`, what kind of expression is it?
    - for `CtrlValue`, what kind of continuation is at the head of the `kont`-stack?
- the information is printed when the machine finalizes

The lightweight tracing shows an abbreviated output line per step:
- the control expression / value
- the size of the environment
- the depth of the `kont`-stack

changelog_begin
changelog_end
2020-05-11 11:10:02 +01:00
Andreas Herrmann
35fe61ed06
Update Bazel 2.0.0 --> 2.1.0 (#5651)
* Update Bazel 2.0.0 --> 2.1.0

CHANGELOG_BEGIN
CHANGELOG_END

* Update rules_haskell

For Bazel 2.1.0 compatibility.

* nix: grpc: patch glibc version incompatibility

* Fix hlint warnings

* CcToolchainInfo.compiler

https://docs.bazel.build/versions/2.1.0/skylark/lib/CcToolchainInfo.html#compiler

* CcToolchainInfo.ar_executable

* texlive: add missing transparent package

* Leave a debug note on the docs target

* Ignore FutureWarning in //docs:docs-no-pdf

* Isolate PR

This is to avoid any interference with pipelines prior to the Bazel
update.

* Remove isolation

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-05-11 11:47:54 +02:00
Stefano Baghino
2a8c93a614
Offload value deserialization from DB threadpool and add metrics (#5917)
* Offload value deserialization from DB threadpool and add metrics

Fixes #5909

CHANGELOG_BEGIN
[Ledger Integration Kit] Added new metrics for
``daml.index.db.*.deserialization`` to measure the duration of
the translation of the serialized DAML-LF values when fetched
from the participant index.
CHANGELOG_END

* Address https://github.com/digital-asset/daml/pull/5917#discussion_r422282582

* Address https://github.com/digital-asset/daml/pull/5917#discussion_r422282901

* Address https://github.com/digital-asset/daml/pull/5917#discussion_r422283768

* Address https://github.com/digital-asset/daml/pull/5917#discussion_r422285920

* Address https://github.com/digital-asset/daml/pull/5917#discussion_r422285674
2020-05-11 10:41:49 +02:00
Gary Verhaegen
9b476416b8
switch back to Azure-provided macos nodes (#5920)
This is temporary. It looks like the macOS nodes are dead; @nycnewman is
looking into it, but in case he doesn't fix it in time, at least we
have a backup plan so we're not completely blocked on Monday.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-11 09:28:40 +02:00
Gary Verhaegen
4a6ab84b69
add default machine capability (#5912)
add default machine capability

We semi-regularly need to do work that has the potential to disrupt a
machine's local cache, rendering it broken for other streams of work.
This can include upgrading nix, upgrading Bazel, debugging caching
issues, or anything related to Windows.

Right now we do not have any good solution for these situations. We can
either not do those streams of work, or we can proceed with them and
just accept that all other builds may get affected depending on which
machine they get assigned to. Debugging broken nodes is particularly
tricky as we do not have any way to force a build to run on a given
node.

This PR aims at providing a better alternative by (ab)using an Azure
Pipelines feature called
[capabilities](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#capabilities).
The idea behind capabilities is that you assign a set of tags to a
machine, and then a job can express its
[demands](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/demands?view=azure-devops&tabs=yaml),
i.e. specify a set of tags machines need to have in order to run it.

Support for this is fairly badly documented. We can gather from the
documentation that a job can specify two things about a capability
(through its `demands`): that a given tag exists, and that a given tag
has an exact specified value. In particular, a job cannot specify that a
capability should _not_ be present, meaning we cannot rely on, say,
adding a "broken" tag to broken machines.

Documentation on how to set capabilities for an agent is basically
nonexistent, but [looking at the
code](https://github.com/microsoft/azure-pipelines-agent/blob/master/src/Microsoft.VisualStudio.Services.Agent/Capabilities/UserCapabilitiesProvider.cs)
indicates that they can be set by using a simple `key=value`-formatted
text file, provided we can find the right place to put this file.

This PR adds this file to our Linux, macOS and Windows node init scripts
to define an `assignment` capability and adds a demand for a `default`
value on each job. From then on, when we hit a case where we want a PR
to run on a specific node, and to prevent other PRs from running on that
node, we can manually override the capability from the Azure UI and
update the demand in the relevant YAML file in the PR.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-09 18:21:42 +02:00
mziolekda
e0ab70df64
Convert transaction committer to applicative style (#5901)
* Convert transaction committer to applicative style

* few renames following code review

* Test that `TransactionCommitter` won't overflow when performing many reads

* Remove useless `TransactionCommitterSpec`

* Apply suggestions from code review

Apply suggestions

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>

* address more review comments

Co-authored-by: Fabio Tudone <fabio.tudone@digitalasset.com>
Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
2020-05-09 11:03:05 +02:00
Shayne Fletcher
75ed957c63
Restart triggers that fail (#5916)
changelog_begin
changelog_end
2020-05-08 15:23:54 -04:00
fabiotudone-da
5e4164c12d
LedgerFactory.metricsRegistry -> LedgerFactory.metrics: Metrics (#5914)
* `LedgerFactory.metricsRegistry` -> `LedgerFactory.metrics: Metrics`

CHANGELOG_BEGIN
CHANGELOG_END

* Address review comment
2020-05-08 19:00:58 +02:00
Samir Talwar
208d4a50da
postgresql-testing: Use a new, random database name every time. (#5911)
* postgresql-testing: Store the JDBC URL separately.

* postgresql-testing: Expose the username and password.

* postgresql-testing: Get the caller to create the database.

And make sure it's a random one, not "test".

CHANGELOG_BEGIN
CHANGELOG_END

* postgresql-testing: Only store the JDBC URL for tests.

Less mutable state, innit.

* postgresql-testing: Capture the individual JDBC URL parameters.

* Bazel: Fix PostgreSQL binary paths.

* postgresql-testing: Just recreate the database in PostgresAroundEach.

There's no need to restart the process with a different data directory.
2020-05-08 12:36:42 +00:00
Bernhard Elsner
09c80df272
Document let blocks on templates (#5908)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-08 13:58:22 +02:00
Samir Talwar
ab1c114c74
scala/bindings: Remove the unnecessary @silent annotation. (#5904)
This means we can remove the dependency on `silencer-lib`, which means
that users don't have to upgrade to Scala v2.12.11.

CHANGELOG_BEGIN
- [Scala Bindings]: We no longer require users to upgrade to Scala
  v2.12.11.
CHANGELOG_END
2020-05-08 09:39:02 +00:00
Moritz Kiefer
c787f5546d
Use weak contract id seeding in compatibility tests (#5905)
This should hopefully address the timeouts we have seen occasionally.

changelog_begin
changelog_end
2020-05-08 09:27:06 +00:00
Moritz Kiefer
d4b705c25e
Document Nix cleanup (#5907)
I’m not entirely sure why people end up with poisoned nix
caches (seems harder than poisoning your Bazel cache) but a few people
have managed apparently so this should hopefully help them recover.

changelog_begin
changelog_end
2020-05-08 11:12:43 +02:00
Remy
560525b80a
DAML-LF: LF type checkers reject repeated variables in pattern (#5894)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 20:17:52 +02:00
Remy
1115b3916f
Engine: Add in-execution-order traversal for transactions. (#5867)
We add a new traversels to GenTransaction that visit all the nodes in execution order.
Exercise nodes are visited twice: when execution reaches them and when execution leaves their body.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 20:17:27 +02:00
Gary Verhaegen
2b0c59f8af
detect cancellation in notify-user (#5895)
This PR changes the notify_user job to not run when the job has been
canceled, which happens mostly when we push new code.

Not sure how I failed to see the `canceled` function in the past, but
this does seem to do exactly what we want.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 19:35:45 +02:00
Stefano Baghino
846391ac72
Use a table specifically for transaction trees witnesses (#5897)
* Use a table specifically for transaction trees witnesses

This allows to not re-compute those every time using the flat transaction
witnesses and the complement.

Furthermore, witness tables indexing is redefined to a single primary key
covering both event identifier and witness party instead of two
separated indexes. This has proven to be a relevant improvement for
performance.

Fixes #5883

changelog_begin
[Ledger API Server] Significant improvements in serving transaction trees. See #5883.
changelog_end

* Fix migration SHA
2020-05-07 19:19:28 +02:00
Gary Verhaegen
e582e611af
fix splitOn when sep appears at end (#5872)
Fixes #5786.

CHANGELOG_BEGIN
[DAML Standard Lib] ``DA.Text.splitOn`` will now correctly handle the
case where the separator appears at the end but should not be matched,
as in ``splitOn "aa" "aaa" == ["", "a"]`` (previously this was
erroneously returning ``["", "a", ""]``). See #5786 for more details.
CHANGELOG_END
2020-05-07 15:01:12 +02:00
Samir Talwar
17f4dc2716
ledger-on-sql: Remove the reference to the removed "common" migrations. (#5888)
This is producing a warning.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 12:56:56 +00:00
nickchapman-da
25cb022eed
Simplify how speedy returns its final result. (#5890)
- Have a special continuation `KFinished` which is pushed on the initially empty `kontStack`.
- `KFinished.execute` throws `SpeedyHungry` when it has the `SResultFinalValue`.
- This unifies the behaviour w.r.t other kinds of `SResult`.
- The `kontStack` is never empty during evaluation.
- So we no longer require an`isFinal` test, and so the inner loop is a little tighter.

The performance improvement here is marginal (1% maybe). But the clarity is better. Also, it's a nice invariant that there is always at least one continuation on the stack. An invariant which will be useful in a change planned to improve handling of `KPop` and `KLocation`.

changelog_begin
changelog_end
2020-05-07 13:01:13 +01:00
Gary Verhaegen
11a2fc3c2d
more flexible perf test check (#5891)
This PR separates the "last known valid perf test" commit from the
"baseline speedy implementation" commit. It is important for the perf
test to be meaningful that the changes between those two commits are
benign, say minor API adjustments, so that the perf measurement remains
meaningful.

This also adds a check on merging to master that tells Slack if the perf
test has changed and the `test_sha` file needs updating. The Slack
message is conditional on the current commit to avoid excessive noise.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 13:53:22 +02:00
Samir Talwar
a0635fa397
ledger-on-sql: Use dedicated database execution contexts. (#5869)
* ledger-on-sql: Use dedicated database execution contexts.

This may or may not stop us from monopolizing API server threads.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-on-sql: Name arguments to `Database` and `UninitializedDatabase`.
2020-05-07 11:52:24 +00:00
Shayne Fletcher
3e11122f77
More annotations (#5875)
changelog_begin
changelog_end
2020-05-07 11:30:01 +00:00
Moritz Kiefer
67e33a1659
Move Bazel configuration before formatting (#5893)
bazel configuration does two things:

It modifies .bazelrc.local and it writes a temp file.
I’ve run `git clean` on a PR. This caused the temp file to be
removed. However `.bazelrc.local` stayed since it is in
`.gitignore`. This meant that the next time the formatting check ran
the `.bazelrc.local` pointed to the temp file but the temp file was no
longer there.

changelog_begin
changelog_end
2020-05-07 11:21:02 +00:00
Remy
861724e4fd
Engine: cleanup SEVal (#5859)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 11:44:19 +02:00
nickchapman-da
53b24793f4
Simplify and clarify the public interface to Speedy. (#5881)
* Simplify and clarify the public interface to Speedy.

- Remove `isFinal`. A client just uses `run()`.
- Remove `toSValue`. The value in available in `SResultFinalValue(v: SValue)`.
- A client never directly access the `.ctrl` (or `.returnValue`) components.
- A client may use `setExpressionToEvaluate(expr)` to evaluate a new expression on an existing machine.

changelog_begin
changelog_end

* remove while loop which executes just once

* avoid unnecessary mutation when running speedy
2020-05-07 08:55:16 +00:00
Martin Huschenbett
6642b1fc8b
Report speedup in daily perf report cron job (#5885)
Also track against both targets, 5x and 10x.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 10:52:33 +02:00
Remy
be52a04934
Engine: Drop CidConsumer and make CidContaint foreachX iterator public. (#5865)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 10:42:28 +02:00
Remy
710d10cbc8
Contract ID spec. Address Martin's comments Martin #5784 (#5876)
* Contract ID spec. Address Martin's comments Martin #5784

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 08:27:35 +00:00
Moritz Kiefer
9212069db4
Randomize postgres ports in compatibility tests (#5880)
While the tests are exclusive and I’ve kept them exclusive for
resource usage, the hardcoded port numbers can still cause issues if
for whatever reason you have a postgres instance running outside of
Bazel. This could happen because you simply have a local postgres
instance for testing other things or, what seems to have happened on
CI, due to a leftover postgres instance from a previous test.

While we should do something about the latter, this at least gets us
into a situation where the node isn’t completely broken at this point.

changelog_begin
changelog_end
2020-05-07 09:46:06 +02:00
Moritz Kiefer
3bf2402d2c
Add /etc/nsswitch.conf to our Dockerfile (#5882)
As mentioned in the comment, this is required to get DNS requests to
work. This is more important than one might realize at first:

`daml start` tries to make an HTTP request to localhost:7500 to wait
for Navigator to start up. However, in our docker image, these
requests currently fail completely since they fail to resolve
`localhost`. This stops all following steps, in particular,
`init-script` and the JSON API from starting up.

changelog_begin
changelog_end
2020-05-07 09:44:44 +02:00
Moritz Kiefer
a47c734401
Fix MacOS version linking issues (#5868)
This should fix the following issue that we see constantly on CI:

```
ld: warning: object file _ was built for newer OSX version (10.15) than being linked (10.14)
```

The issue was that the CC toolchain was not fully used in
haskell_cabal_package. --with-gcc (which is really --with-cc) only
applies when Cabal is calling the C compiler. However, in most cases
it is actually GHC itself which calls the C compiler. To make sure
that the right compiler is used in those cases, we have to pass
`-pgmc` and friends to GHC. This matches what rules_haskell does for
non cabal targets.

changelog_begin
changelog_end
2020-05-07 09:36:45 +02:00
daravep
0c8bf80c6d
Added a note on required codegen dependencies (#5853)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-07 07:58:36 +02:00
nickchapman-da
b318cb0299
Optimize Speedy machine.ctrl (#5811)
Remove the `Ctrl` trait and separate `Machine.ctrl: Ctrl` into `Machine.ctrl: SExpr` and `Machine.returnValue: SValue` instead. This allows for avoiding dynamic dispatch on `ctrl` and instead allows for checking a pointer for `null` to decide if we have an expression that needs further break-down or a return value ready to be passed to the next continuation.

To make this check really only a pointer comparison we also needed to remove the abomination of "fully applied partially applied primitives". In order to achieve this, we check whether a PAP will be fully applied afterward when applying the last argument.

On the `collect-authority` benchmark, this increases throughput by around 13%, on another more computation heave benchmark by about 21%.

`collect-authority` benchmark on `master`:
```
Result "com.daml.lf.speedy.perf.CollectAuthority.bench":
  112.361 ±(99.9%) 1.965 ms/op [Average]
  (min, avg, max) = (107.047, 112.361, 120.745), stdev = 3.493
  CI (99.9%): [110.396, 114.326] (assumes normal distribution)
```

`collect-authority` benchmark on this branch:
```
Result "com.daml.lf.speedy.perf.CollectAuthority.bench":
  98.196 ±(99.9%) 1.933 ms/op [Average]
  (min, avg, max) = (91.580, 98.196, 105.478), stdev = 3.436
  CI (99.9%): [96.263, 100.129] (assumes normal distribution)
```

computation heavy benchmark on master
```
Result "com.daml.lf.speedy.perf.CollectAuthority.bench":
  44.030 ±(99.9%) 0.742 ms/op [Average]
  (min, avg, max) = (42.124, 44.030, 46.781), stdev = 1.319
  CI (99.9%): [43.289, 44.772] (assumes normal distribution)
```

computation heavy benchmark on this branch:
```
Result "com.daml.lf.speedy.perf.CollectAuthority.bench":
  36.222 ±(99.9%) 0.580 ms/op [Average]
  (min, avg, max) = (34.897, 36.222, 39.787), stdev = 1.031
  CI (99.9%): [35.643, 36.802] (assumes normal distribution)
```

changelog_begin
changelog_end
2020-05-06 20:44:50 +02:00
Leonid Rozenberg
c229343066
Fix double 'and's in docs and change log. (#5873)
changelog_begin
changelog_end
2020-05-06 13:20:41 -04:00
Remy
b59f024eec
DAML-Script: cleanup to prepare #5811 (#5871)
* DAML-SCRIPT: cleanup to prepare #5811

* a bit more.

CHANGELOG_BEGIN
CHANGELOG_END

* Address Moritz's review

* Update daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/Runner.scala

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-05-06 16:23:59 +00:00
Remy
5d5fddbc0a
DAML-LF: Contract ID allocation scheme specification (#5784)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-06 18:07:41 +02:00
Rohan Jacob-Rao
4797834e1d
Trigger service: use "triggerId" and "triggerIds" fields for response messages (#5854)
* Use triggerId field in trigger start response

* Use triggerId field for stop trigger result

* Fix indentation and make yields consistent

* Use pair constructor for JsObject instead of Map

* Use triggerIds field in list triggers response

changelog_begin
changelog_end
2020-05-06 11:44:07 -04:00
Robert Autenrieth
9ebfd01f83
Add script to dump metrics summary (#5828)
* Add script to dump metrics summary

CHANGELOG_BEGIN
CHANGELOG_END

* Sort results by default

* Address review comments

* Run prettier

* Refactor code

* Make script executable

* Address review comment

* Always take latest data point
2020-05-06 17:13:14 +02:00
Leonid Shlyapnikov
a79377cb2d
Improve DAML LF Party, PackageName, PackageId fromString error messages (#5855)
* Add description to daml.lf.data.StringModule implementations

Make sure DAML LF Party deserialization picks up the added description.

changelog_begin
changelog_end

* addressing code review comments. @S11001001, thanks.
2020-05-06 10:02:49 -04:00
Shayne Fletcher
72fa959307
Mostly annotations. (#5852)
changelog_begin
changelog_end
2020-05-06 10:01:01 -04:00
Moritz Kiefer
e023fdf347
Release 1.1.0 snapshot (#5864)
This is supposed to be the snapshot that will be turned into 1.1.0
proper.

changelog_begin
changelog_end
2020-05-06 14:00:35 +02:00
Gary Verhaegen
204c8b0657
add daily perf report (#5843)
This PR adds a simple daily job that runs the performance test on a
chosen "baseline" commit and then runs the same benchmark on latest
master. This should allow us to track overall performance improvements.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-06 13:50:35 +02:00
Andreas Herrmann
0fdede62b5
Implement version name shortening for Windows (#5863)
* Implement version name shortening for Windows

CHANGELOG_BEGIN
CHANGELOG_END

* Temporarily disable `--quick`.

* Revert "Temporarily disable `--quick`."

This reverts commit 025e6c2ddd.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-05-06 11:48:07 +00:00
Bernhard Elsner
0ccbb06a22
Add DAML Cheat Sheet to ToC (#5862)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-06 13:18:43 +02:00
Moritz Kiefer
8bc00ee8e6
Print the postgres log on failures (#5860)
This changes the code for starting postgres to print the log if
`pg_ctl start` fails.

In addition to that it marks the migration tests exclusive since they
rely on this code which has a hardcoded port number.

I tested this on CI by temporarily disabling --quick.

changelog_begin
changelog_end
2020-05-06 10:22:56 +00:00