Commit Graph

4295 Commits

Author SHA1 Message Date
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
Robert Autenrieth
7e448d810c
Always use the latest ledger config (#5669)
CHANGELOG_BEGIN
- [Sandbox] The ledger API server will now always use the most recent ledger configuration.
  Until a ledger configuration is read from the ledger, command submissions will fail with the UNAVAILABLE error.
CHANGELOG_END

In kvutils, the first ledger configuration change needs
to have a generation one higher than the one returned
by getLedgerInitialConditions().

Remove initial config writing from sandbox as it's now written by the ledger API server
2020-05-06 12:12:23 +02:00
Moritz Kiefer
c21768c616
Make Bearer prefix optional in Haskell ledger bindings (#5858)
* Make Bearer prefix optional in Haskell ledger bindings

This matches the change to the JVM bindings in 1.0.0

changelog_begin

- [DAML Assistant] The ``daml ledger`` commands no longer require the
``Bearer `` prefix in the access token file. This matches the behavior
 of DAML Script and other SDK tools.

changelog_end

* Fix tasty crash

changelog_begin
changelog_end

* Update compatibility/bazel_tools/daml_ledger/Main.hs

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

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-05-06 12:09:34 +02:00
Stefano Baghino
df12c529c8
Fix broken migration v25 with v29 (#5861)
The v25 migration did not read transactions in order, causing #5659.

This PR re-arranges migrations so that ledger_entries can be re-read to fix the issue before dropping it in v30 (which used to be v29).

Fixes #5659.

changelog_begin
[Sandbox Classic] There is a chance that migrating from Sandbox 0.13.55 to Sandbox Classic 1.0.0 could have
introduced contracts falsely reported as active when in fact they are not. Migrating to Sandbox Classic
1.1.0 will fix the issue. For more details, see #5659.
changelog_end
2020-05-06 10:08:32 +00:00
Remy
aed97a5d1f
Engine: Contract IDs collecter for values, transactions… (#5805)
We add a method to collect contract ID for value, transaction ...

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-06 10:52:40 +02:00
Oliver Bunting
e016f2f9f6
Fix spelling mistake (#5840)
CHANGELOG_BEGIN
  CHANGELOG_END
2020-05-06 08:20:47 +02:00
Stephen Compall
59d5446438
disable https check for JWT tokens in JSON API, warn instead (#5856)
CHANGELOG_BEGIN
- [JSON API] The check that connections are made through a reverse-proxy
  providing HTTPS, ensuring that JWT tokens don't leak, only logs a warning
  rather than rejecting the request.
  See `issue #5856 <https://github.com/digital-asset/daml/pull/5856>`_.
CHANGELOG_END
2020-05-05 19:25:24 -04:00
Stephen Compall
91d05b2095
contract IDs' suffixes must match in emptiness, not mismatch (#5850)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-05 17:39:42 -04:00
Andreas Herrmann
150e0366a4
Apply platform_suffix on all Windows pipelines (#5846)
* Apply plotform_suffix on all Windows pipelines

To distinguish action keys between the compatibility and the main
workspace and avoid the "undeclared input(s)" error. We also modify the
main workspace's action cache keys to avoid poisoned cache items.

CHANGELOG_BEGIN
CHANGELOG_END

* Avoid exceeding MAX_PATH on Windows

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-05-05 18:02:39 +00:00
Moritz Kiefer
0c90844184
Update SDK versions in compatibility tests (#5844)
* Update SDK versions in compatibility tests

This adds a Haskell script to generate a versions.bzl file that
contains the list of versions as well as their hashes. This should
make it a bit easier to keep things up2date going forward.

The script is a bit slow since downloading all the SDKs takes quite a
while but for now it should be good enough and is much more pleasant
than having to figure this out manually.

changelog_begin
changelog_end

* Address review comments

changelog_begin
changelog_end

* Fix excluded tests

changelog_begin
changelog_end
2020-05-05 19:40:03 +02:00
Robin Krom
4ede3fc711
docs: publish cheat sheet under docs.daml.com/cheat-sheet (#5841)
* docs: publish daml-cheat-sheet on docs.daml.com

* separate cheat sheet rule

* Fixed `@daml-cheat-sheet`

* Uses `_config.yml` to determine the source directory root.
* Uses `tar h` to resolve symbolic links. Otherwise the tarball just
  contains symbolic links to the execroot.
* Uses flags to make `tar` and `gzip` reproducible, i.e. avoid
  timestamps and the like.

* cleanup

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-05-05 17:35:30 +00:00
Rohan Jacob-Rao
ac5f462f24
Trigger service: Use JSON object in result of upload dar response (#5849)
changelog_begin
changelog_end
2020-05-05 16:33:45 +00:00
Leonid Shlyapnikov
31224e0447
Fixing the text in jwt.io link. (#5848)
changelog_begin
changelog_end
2020-05-05 16:26:18 +00:00