Commit Graph

4326 Commits

Author SHA1 Message Date
nickchapman-da
c2c396467e
Special case atomic expressions in the functional-position of application (#6104)
* Special case atomic expressions in the functional-position of applications.

We regard builtins, values and variables as atomic. The special case detection is done at compile time; at run time, the atomic case avoids one push/pop on the continuation stack.

For the bench example, about 2/3 of the applications performed at run-time, fall into the special case, leading to an overall reduction in about 15% of the steps taken by the Speedy CEK machine.

This change gives a 3% to 4% performance improvement.

changelog_begin
changelog_end

* address review comments
2020-06-01 11:09:59 +00:00
Moritz Kiefer
405f3ad6ee
Sort files when calculating CACHE_KEY (#6173)
* Sort files when calculating CACHE_KEY

The order returned by `find` is unspecified and seems to have changed
for whatever reason in some cases. This changed the cache key which is
obviously not intended. It looks like the one we currently have in our
scoop manifest is the one that we get by sorting. Reversing the sort
produces the one CI currently calculates.

changelog_begin
changelog_end

* update manifest to match CI output

Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
2020-05-31 22:02:13 +02:00
Leonid Shlyapnikov
e097cf410b
Making PaginatingAsyncStream.streamFrom more generic (#6170)
* Making `PaginatingAsyncStream.streamFrom` more generic

so it does not specify what exactly `Offset` is.

changelog_begin
changelog_end

* Addressing code review comments + cleanup
2020-05-29 19:57:04 +00:00
Gerolf Seitz
e71e8e862d
Add LF value translation cache to Sandbox Classic (#6164)
* Add LF value translation cache to Sandbox Classic

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-29 19:00:58 +02:00
Moritz Kiefer
1c8691250d
Handle contract key failures due to visiblity in scenarios (#6165)
Previously, we just crashed the scenario service instead of throwing a
proper scenario error. This meant that you had to look at the
debugging output to figure out what is going wrong. This is both a
shitty UX and also inconsistent with how we handle this for fetch and
exercise on contract ids that are not visible. This PR adds a new
error type that matches the one for invisible contract ids.

changelog_begin

- [DAML Studio] Fetches and exercises of contract keys associated with
  contracts not visible to the submitter are now handled properly
  instead of showing a low-level error.

changelog_end

fixes #5903
2020-05-29 18:35:53 +02:00
Remy
5df8ac65ea
Engine: remove unnecessary pattern matching (#6167)
forgotten in #5991.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-29 18:22:17 +02:00
Gerolf Seitz
070bd18951
More detailed store transaction metrics (#6163)
* Add additional metrics when storing transactions

Since event witnesses will soon be denormalized into the participant_events
table, I did not include metrics right now.

CHANGELOG_BEGIN
[DAML Ledger Integration Kit] Add additional metrics for storing transactions. The overall time is measured by ``daml.index.db.store_ledger_entry``.
- Timer ``daml.index.db.store_ledger_entry.prepare_batches``: measures the time for preparing batch insert/delete statements
- Timer ``daml.index.db.store_ledger_entry.events_batch``: measures the time for inserting events
- Timer ``daml.index.db.store_ledger_entry.delete_contract_witnesses_batch``:  measures the time for deleting contract witnesses
- Timer ``daml.index.db.store_ledger_entry.delete_contracts_batch``: measures the time for deleting contracts
- Timer ``daml.index.db.store_ledger_entry.insert_contracts_batch``: measures the time for inserting contracts
- Timer ``daml.index.db.store_ledger_entry.insert_contract_witnesses_batch``: measures the time for inserting contract witnesses
- Timer ``daml.index.db.store_ledger_entry.insert_completion``: measures the time for inserting the completion
- Timer ``daml.index.db.store_ledger_entry.update_ledger_end``: measures the time for updating the ledger end
[Sandbox Classic] Added Timer ``daml.index.db.store_ledger_entry.commit_validation``: measure the time for commit validation in Sandbox Classic

CHANGELOG_END

* Refactoring: rename metrics *dao to *DbMetrics
2020-05-29 18:19:54 +02:00
Leonid Shlyapnikov
12c05c408a
Experiment: replacing row OFFSET with ledger offset (#6083)
* Experiment: replacing row OFFSET with ledger offset in the flat transactions query for one party.

if this improves the perf numbers, the rest of the queries can be updated.

* Flat transaction query optimization:

replacing row offset with ledger offset

* Flat transaction query optimization:

replacing row offset with ledger offset

* transaction tree query optimization

changelog_begin

[Sandbox-next/Postgres]
Flat Transaction Stream, Transaction Tree Stream SQL query optimizations.
Pagination based on Ledger Offset instead of SQL Row Offset.

changelog_end

* Addressing code review comments
2020-05-29 11:49:46 -04:00
Miklos
655c0a5425
Fix flaky tests for ledger-on-memory (#6160) 2020-05-29 15:33:10 +02:00
Martin Huschenbett
9d955d7039
Expose the DAML profiler in Sandbox Classic (#6151)
* Expose the DAML profiler in Sandbox Classic

This PR adds an option `--profile-dir` to Sandbox Classic which takes
a directory as its argument. When this option is used, all command
submissions to the Sandbox are run in profiling more and the resulting
profiling information is written to the directory specified via
`--profile-dir`. See `/ledger/sandbox/README.md#Profiling` for further
details on this.

CHANGELOG_BEGIN
CHANGELOG_END

* Adapt DAML-LF REPL

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-29 15:00:40 +02:00
Gerolf Seitz
c423f58f39
Collect active contract lookup time per execution (#6161)
CHANGELOG_BEGIN
[DAML Ledger Integration Kit]: Added 4 new metrics for more detailed execution time statistics:
- Timer ``daml.execution.lookup_active_contract_per_execution``: measures the accumulated time spent for looking up active contracts per execution
- Histogram ``daml.execution.lookup_active_contract_count_per_execution``: measures the number of active contract lookups per execution
- Timer ``daml.execution.lookup_contract_key_per_execution``: measures the accumulated time spent for looking up contract keys per execution
- Histogram ``daml.execution.lookup_contract_key_count_per_execution``: measures the number of contract key lookups per execution
CHANGELOG_END
2020-05-29 14:34:07 +02:00
Stephen Compall
3ad9f2b52f
declare http-json Streaming API as stable (#6152)
CHANGELOG_BEGIN
- [JSON API] The WebSocket endpoints ``/v1/stream/query`` and ``/v1/stream/fetch`` are now
  stable; these endpoints in SDK v1.0.0 are fully compatible with this first officially
  stable version.
  See `issue #6152 <https://github.com/digital-asset/daml/pull/6152>`_.
CHANGELOG_END
2020-05-29 08:33:11 -04:00
Miklos
404d043b22
Fix metrics for parallel validator (#6145) 2020-05-29 12:29:52 +02:00
Stefano Baghino
070e39d4df
Improve error message for unsuccessful key lookups (#6148)
changelog_begin
[Runtime] Improved error messages on unsuccessful key lookups
changelog_end
2020-05-29 09:57:13 +00:00
Moritz Kiefer
3cce4b7098
Include the transaction service in sandbox migration tests (#6158)
This PR extends the existing sandbox migration tests with a query to
the transaction service before and after running each step and
corresponding validations for that in the migration runner.

changelog_begin
changelog_end
2020-05-29 11:43:01 +02:00
Moritz Kiefer
94664db5ee
Release new snapshot (#6154)
New snapshot to include the `module-prefixes` feature. Hopefully this
is everything we need in 1.2.

changelog_begin
changelog_end
2020-05-29 10:58:24 +02:00
Moritz Kiefer
d2d3af165a
Mark build-and-lint codegen tests as flaky (#6156)
changelog_begin
changelog_end
2020-05-29 10:05:37 +02:00
Shayne Fletcher
f619dea380
Test trigger won't start when ledger connection not viable (#6150)
changelog_begin
changelog_end
2020-05-28 19:05:14 -04:00
Stephen Compall
ae9e3e2ec1
clean up Node map function (#6149)
* remove boilerplate from GenNode.map3

- There is no need to enumerate the unchanged fields, because if you
  miss one, you get a type error.  Unfortunately foreach3 cannot benefit
  from the same typechecking.

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-28 16:28:01 -04:00
Moritz Kiefer
fc366478f0
Upgrade puppeteer (#6142)
* Upgrade puppeteer

We’ve seen a couple of issues in the compatibility tests of the form

```
Error: Protocol error (Runtime.callFunctionOn): Target closed.
```

Looking at the issue tracker in puppeteer this might be fixed in newer
versions and I don’t see why we should stick to a fairly old version
anyway.

changelog_begin
changelog_end

* Upgrade nodejs

changelog_begin
changelog_end

* temporary add a step to kill node_modules

changelog_begin
changelog_end

* Kill live server and try to fix Windows

changelog_begin
changelog_end

* Undo rm

changelog_begin
changelog_end
2020-05-28 21:58:52 +02:00
Rohan Jacob-Rao
cc5d5d3fd8
Trigger service: refactor in prep for DB writes (#6134)
* Pass JdbcConfig object to TriggerDao apply

* No need to return TriggerDao from init db

* Refactor introducing RunningTrigger type

* Rename triggerId -> triggerInstance and triggerOrigId -> triggerName
Note this also changes the start request parameter name to triggerName.
However I have not yet renamed triggerId in the response messages. We
should probably make it triggerInstance there too but in a later PR.

changelog_begin
changelog_end
2020-05-28 13:47:24 -04:00
Nemanja
1fa70e7e4a
Small wording fixes for the GSG basedon user feedback (#6136)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-28 17:32:09 +00:00
Stephen Compall
15350a7bc2
disable warts.Any and remove most suppressions (#6132)
* disable Any wart

* first pass removal of Any suppressions for false positives

* second pass removal of Any suppressions for false positives

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* third pass removal of Any suppressions for false positives

* fourth pass removal of Any suppressions for false positives

* reformat newly single-suppressions into single lines

- suggested by @SamirTalwar-DA; thanks
2020-05-28 16:53:41 +00:00
Shayne Fletcher
4fb13734ad
Extend proxy into test functions and gentle refactor (#6147)
changelog_begin
changelog_end
2020-05-28 12:39:34 -04:00
Stephen Compall
265cfe6cdf
split http-json tests into tests and integration-tests targets (#6135)
* move integration-type tests in http-json to separate integration-tests target

* remove unused library deps from split tests

* remove resources from unit tests, set to medium size

* move resources to it subtree

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-28 11:46:25 -04:00
Robert Autenrieth
28251ba296
Don't store archived divulged contracts (#6139)
* Don't store archived divulged contracts

Specifically, don't keep contracts that
have been divulged AND archived
in the same transaction.

Even if the archival of a divulged contract
might not be visible to all locally hosted
parties, the ledger would reject all
commands that try to use archived
contracts anyway.

CHANGELOG_BEGIN
CHANGELOG_END

* Add test

* Fix compile error
2020-05-28 15:10:08 +02:00
Moritz Kiefer
c5ce6ed4c8
Use a custom Scala binary for the sandbox migration tests (#6140)
This is preparatory work for hitting the transaction service (and
others but that one is the most important) which isn’t possible via
DAML Script. To ease review, this PR only switches from a DAML Script
to a custom Scala binary. It does not yet change what is tested.

changelog_begin
changelog_end
2020-05-28 15:02:54 +02:00
Edward Newman
9a073cebd9
Macos fix nix installer for build agent servers (#6133)
* Fix issue with xz dependency missing for Nix installer

CHANGELOG_BEGIN
- MacOS - fix Nix installer dependency for xz
CHANGELOG_END

* - additional changes for new Nix installer for Catalina depdencies
2020-05-28 14:04:01 +02:00
Miklos
39daca8b82
Dropped 'Batched' infix from all ledger-on-memory class names. (#6141) 2020-05-28 13:51:46 +02:00
Moritz Kiefer
2ccbd7f865
Add a module-prefixes field to rename all modules in a pkg (#6105)
* Add a module-prefixes field to rename all modules in a pkg

This PR adds a `module-prefixes` field to `daml.yaml` a a shorthand
for specifying a `--package` flag that renames all modules in a
package to have the same prefix.

The docs are updated to describe how you can use this field and there
is a test case that makes sure it works.

fixes #4948

changelog_begin

- [DAML Compiler] You can now use the new ``module-prefixes`` field in
  ``daml.yaml`` to add a prefix to all modules from a dependency. This
  is particularly useful for handling colliding module names during
  upgrades. See
  https://docs.daml.com/daml/reference/packages.html#handling-module-name-collisions
  for more information.

changelog_end

* Update compiler/damlc/daml-opts/daml-opts-types/DA/Daml/Options/Packaging/Metadata.hs

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

* Improve docs and fix broken suggestion

changelog_begin
changelog_end

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-05-28 10:57:00 +00:00
Miklos
6108c922c6
Support parallel validation for ledger-on-memory (#6111) 2020-05-28 11:11:47 +02:00
Moritz Kiefer
db8c091467
Upgrade 7zip (#6138)
changelog_begin
changelog_end
2020-05-28 10:49:07 +02:00
Stefano Baghino
0f2b45f8d7
Remove unused zlib patch (#6137)
Leftover from #6063

Should have been removed along with
114ba4ecfb

changelog_begin
changelog_end
2020-05-28 08:43:13 +00:00
Stephen Compall
56cc3ab55d
add law checking for SValue Ordering (#6038)
* add law checking for SValue Ordering

CHANGELOG_BEGIN
CHANGELOG_END

* nested example for randomComparableValues

* match comparableAbsCoidsGen -> comparableCoidsGen renaming
2020-05-27 23:38:24 +00:00
Stephen Compall
78205afa0d
use 2.13-style collections library syntax in json-api (#6075)
* register scala-collection-compat with java deps list

* add scala-collection-compat to http-json deps

* remove breakOut throughout http-json, replaced with view/to or iterator/to

* use scala 2.13-style `to` calls in http-json

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* use 2.13-style to in lf-value-json

* some fused size comparisons

* remove low-hanging breakOuts in daml-lf

* regenerate maven_install.json for scala-collection-compat

* regenerate maven_install.json for scala-collection-compat

* regenerate maven_install.json for scala-collection-compat
2020-05-27 22:27:25 +00:00
Gary Verhaegen
b005b988e1
tweak release process (#6054)
The `gawk`-based method currently referenced does not work in a
multi-line `LATEST` world. I don't want to scare people with the command
that would work here.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-28 00:24:00 +02:00
Gary Verhaegen
90547e6ab4
build old docs with their release notes (#6128)
In light of #6127, I kept wondering why rebuilding 1.1.1 would fail. The
problem addressed by #6127 is that we tried to rebuild it, which we
shouldn't, but the reason I noticed it is because the build failed, and
there is no good reason for the 1.1.1 docs to not build anymore. Looking
at the logs confused me even more as it failed with (elided):

```
docs/source/support/new-assistant.rst:
WARNING: document isn't included in any toctree
```

and that change happened _after_ 1.1.1. So I went back to the code, and
discovered I somehow had gotten confused as I changed the approach
mid-way through editing the file. If we're overwriting the
`release-notes.html` file post-build, which we are now doing (and is the
reason for ignoring it when checking checksums), then we should not be
touching the `release-notes.rst` file pre-build.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 22:19:18 +00:00
Stephen Compall
1be6b3640f
equalz Scalatest matcher in new daml-lf/scalatest-tools library (#1200)
* equalz Scalatest matcher in new daml-lf/scalatest-tools library

* equalz typing tests

* a 'should' replacing design

* a 'MatcherFactory1' design

- this fails because the TC parameter should be a type member to avoid
  scala/bug#5075 but it is not

* MatcherFactory1 with chained Lub+Equal typeclass

- requires partial-unification at point of use, which is not great

* LubEqual's extra tparam is probably unneeded

* better LtEqual

* demonstrate that HK LubEqual's resolve with DMT should + MatcherFactory

* remove unneeded 3rd param from LubEqual, again

* update dependency specs and license headers

* allow use with should, shouldNot in some cases, preserving the shouldx/shouldNotx alternatives

* move Equalz to libs-scala/scalatest-utils

* rename bzl targets and place in com.daml.scalatest package

* add scalatest-utils to release

* move *SpecCheckLaws, Unnatural to scalatest-utils

* missed scalacheck dep in scalatest-utils

* downstreams of *SpecCheckLaws now get them from scalatest-utils

* test equal-types case as well

* update LF documentation

CHANGELOG_BEGIN
CHANGELOG_END

* whitespace error
2020-05-27 17:25:43 -04:00
Brian Healey
d162a4a14e
Update Jackson library version to latest published 2.11.0 (#6115)
* Update Jackson library version to latest published to resolve several reported vulnerabilities

CHANGELOG_BEGIN
Upgrade jackson version to 2.11.0 from 2.9.9.3
CHANGELOG_END

* regenerate updated jackson dependencies
2020-05-27 17:22:33 -04:00
Brian Healey
cfab7dab63
Update netty and iogrpc version (#6063)
* io.grpc:grpc-xxxx to 1.29.0 (from 1.22.1)
io.netty:netty-xxxx to .1.50.Final (from 4.1.37.Final)
io.nett.netty-tcp-native-boringssl-static to 2.0.30.Final (from 2.0.25.Final)

To resolve open vulnerabilities with these versions
netty-4.1.37.Final vulnerabilities
 BDSA-2018-4022 (Medium)
 BDSA-2019-2610 (Medium)
 BDSA-2019-3119 (CVE-2019-16869) (Medium)
 BDSA-2020-0130 (Medium)
 BDSA BDSA-2019-4230 (CVE-2019-20445) (Low)
 BDSA BDSA-2019-4231 (CVE-2019-20444) (Low)
 BDSA BDSA-2020-0666 (CVE-2020-11612) (Low)
 BDSA BDSA-2019-2642 (Low)
 BDSA BDSA-2019-2649 (Low)
 BDSA BDSA-2019-2643 (Low)

CHANGELOG_BEGIN
Upgrade io.grpc:grpc-xxxxx and io.netty:netty-xxx version to latest
released to avoid exposure to reported security vulnerabilities in
currently used versions
CHANGELOG_END
–

* Update spray versions to address vulnerabilities
CVE-2018-18853 and CVE-2018-18854

CHANGELOG_BEGIN
Upgrade io.grpc:grpc-xxxxx and io.netty:netty-xxx version to latest
released to avoid exposure to reported security vulnerabilities in
currently used versions
CHANGELOG_END

* do not change io.grpc version since reflection seems to be misbehaving

* Clarify how to bump grpc/netty/protobuf versions

Also "downgrade" netty to 4.1.48, according to
https://github.com/grpc/grpc-java/blob/master/SECURITY.md#netty

CHANGELOG_BEGIN
CHANGELOG_END

* Load protobuf deps after haskell deps to avoid loading an older version of rules_cc

* Upgrade protoc and protobuf-java to 3.11.0

* buildifier reformat

* regen unique int after rebase

* remove commented patch

Co-authored-by: Gerolf Seitz <gerolf.seitz@daml.com>
2020-05-27 13:44:34 -04:00
Gary Verhaegen
ef0c06a47e
add sed to dev-env (#6129)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 17:11:09 +00:00
Gary Verhaegen
e2d416e335
fix docs cron not ignoring release-notes (#6127)
The docs cron is supposed to ignore the release-notes.html page when
checking whether a docs folder is corrupted, because we manually
override it. However, that currently doesn't work, either because the
`sed` version we are using does not support changing the delimiters, or
because no version of `sed` does and I just imagined it.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 18:47:40 +02:00
Shayne Fletcher
576e47f587
Toxify Windows (#6122)
changelog_begin
changelog_end
2020-05-27 12:07:54 -04:00
Remy
3f29ac84f0
DAML-LF: cleanup last refs to Absolute Contract IDs (#6126)
follow up of #5991

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 18:05:48 +02:00
Gary Verhaegen
ccb496ee0d
update perf test sha (#6125)
Changed by #6123, relevant part of the diff is:

```
           ledger.lookupGlobalContract(ParticipantView(committers.head),
effectiveAt, acoid) match {
-            case LookupOk(_, result) =>
+            case LookupOk(_, result, _) =>
               cachedContract = cachedContract + (step -> result)
```

which seems benign enough.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 15:10:11 +00:00
Remy
2a05bb877e
Scenario service: fix visibility of contract keys. (#6123)
fixes #5924

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 16:27:50 +02:00
Gary Verhaegen
1731a47101
remove javadoc_dev_env (#6124)
The comment on it says it should be replaced by `local_jdk//:javadoc`
once [a patch](https://github.com/bazelbuild/bazel/pull/7898) is merged
into Bazel. Not only has that patch been merged, but I could not find
any reference to `javadoc_dev_env` to replace.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 16:27:09 +02:00
Remy
46bb942964
DAML-LF: restrict value versions (#6109)
advances #5164

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 15:51:56 +02:00
Andreas Herrmann
61d181d22c
Setup compatibility tests for DAML Trigger (#6112)
* Build CopyTrigger example in compatibility

* Test DAML trigger with test DAML script

Defines a custom client script that runs the trigger runner in the
background and uses a DAML script in the foreground to test that the
trigger runs and its effects are observable.

CHANGELOG_BEGIN
CHANGELOG_END

* Apply suggestions from code review

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

* Use bazel_tools:versions.bzl%versions.is_at_least

Also align versions.is_at_least|most with skylib

The arguments to the Skylib function are in the opposite order. I've
included a docstring to explain

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-05-27 12:32:37 +00:00
nickchapman-da
06eadd2c47
Disentangle the execution of closures and builtin functions. (#6068)
* Disentangle the execution of closures and builtin functions.

Both closures and builtins take arguments, but only closures have free variables.
Consequently, we split the machine component `frame` into `frame` and `actuals`.
Allowing them to be managed independently, and simplifying lookup for `SELocF` and `SELocA`.

The `KFun` continuation is split into 3 variants: `KFun`, `KBuiltin` and `KPap`.
These handle the execution of three different cases of function application:
- execution of a user function (a closure)
- execution of a builtin
- execution of a partial application (builtin or closure, it doesn't matter)

The choice of which continuation to push is made in the `KArg` continuation when the
function-expression has been evaluated and we have discovered what it is - builtin or
closure - and we know it's arity.

The prior code made some related decisions (for example, is this an over-application) but
left other choices to `KFun` (code was: `enterFullyAppliedFunction`). This required that
the `KFun` continuation had to stash the entire `Prim` (closure/builtin) and `arity`, only
to then re-examine it when the continuation was entered.

Now, all decisions are made within `KArg`, making the structure and execution of the three
new continuations much simpler. In particular, the `machine.frame` is only set when we
enter `KFun`.

All continuations which need to preserve their environment, now save both frame & actuals,
along with the env-stack-size. And `restoreEnv` is adapted accordingly.

changelog_begin
changelog_end

* improve variable name

* with SomeArrayEquals
2020-05-27 12:18:41 +00:00