Commit Graph

4081 Commits

Author SHA1 Message Date
Tamás Kálcza
6f1d2211d6
Add filterA to Prelude (#5809)
* CHANGELOG_BEGIN

Added filterA to Prelude.

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

Co-authored-by: Shayne Fletcher <shayne@shaynefletcher.org>

* Removed not so useful comment.

* Moved filterA from Prelude to Action.

* filterA is a one-liner now.

* Provided more meaningful example to filterA.

* Added test for filterA.

* Removed failing doctest.
CHANGELOG_END

Co-authored-by: Shayne Fletcher <shayne@shaynefletcher.org>
2020-05-04 19:03:43 +02:00
nickchapman-da
572b21e882
Speedy: run() dont step() (#5814)
Speedy: run() dont step()

- Running the Speedy machine with  `run()` instead of `step()`
- Remove: `SResultContinue`
- Add: `SResultFinalValue(_)`

We change the top level control of Speedy: from machine.step() to machine.run, with the control of stepping while the machine returns SResultContinue moved into speedy itself. (And so SResultContinue is removed in favour of SResultFinalValue.) The main advantage of this approach is that the tight while loop can be moved inside the exception handler, rather than having to wrap the handler every step.

changelog_begin
changelog_end
2020-05-04 16:57:47 +01:00
Stefano Baghino
89eb6c64d2
Integrate PostCommitValidation with JdbcLedgerDao and SqlLedger (#5781)
* Integrate PostCommitValidation with JdbcLedgerDao and SqlLedger

Closes #5035
Closes #5663

changelog_begin
[Sandbox] Skip unnecessary double post-commit validation inherited by sandbox-classic, expect performance improvement
changelog_end

* Ensure SqlLedger recovers from failures and logs them when publishing a transaction

* Remove unused import

* Remove tests for ledger entries

* Fix completions test to make them compile

* Fix compilation errors in tests, address self-review items, apply necessary fixes

- address https://github.com/digital-asset/daml/pull/5781#pullrequestreview-403293667
- address https://github.com/digital-asset/daml/pull/5781#pullrequestreview-403378192

* Pass TransactionTimeModelComplianceIT

* Minor tweaks to variable naming

* Fix failing tests

* Stop deduplicating commands on failures

* Attempt at making sandbox-classic allocate parties implicitly

* Remove implicit party allocation test (without full server) for SQL backed sandbox-classic

* Removing ImplicitPartyAdditionIT (covered in conformance tests)

* Add migrations

* Fix test for ledger DAO with post-commit validation against PostgreSQL

* Update PostgresIT

* Fix missing/wrong items from previous commits

* Don't perform batch processing of enqueued persistence entries

* Rebase against master
2020-05-04 15:28:18 +00:00
Gary Verhaegen
49b4a8dad8
tweak release process for more reliable labeling (#5823)
Currently, there are quite a few releases that are lacking the
Standard-Change label, even though they did publish artifacts. This
makes our SOC2-compliance tracking a bit harder. For the past two
months, I have manually added the label after-the-fact while preparing
the monthly compliance report, but that doesn't seem like a great
solution.

This PR changes the release process to be more optimistic: assume the
release is going to succeed by putting in the label immediately, and
then (optionally) removing it if the release fails.

Note that the label should only be removed in the rare case where the
release was merged into master but somehow did not produce any artifact.
This can only happen if the Linux build fails quite early, which as far
as I know only happened once over the past two months when we had the
release notes race condition.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-04 15:35:58 +02:00
Gerolf Seitz
0a7575de85
Sandbox: expose back pressure config in CLI (#5820)
* Sandbox: expose back pressure config in CLI

CHANGELOG_BEGIN
[Sandbox]: Added ``--max-commands-in-flight`` as CLI configs. See ``daml sandbox --help``.
[Sandbox Classic]: Added ``--max-commands-in-flight`` and
``--max-parallel-submissions`` as CLI configs. See ``daml sandbox-classic --help``.
CHANGELOG_END

* Bumping the default maxParallelSubmissions to 512 for sandbox classic
We used to use `maxCommandsInFlight * 2` in SqlServer, but it makes more
sense to use `maxParallelSubmissions` there. Since the lower default value of 128
would result in the conformance tests to fail, I'm bumping it to 512

* Use maxCommandsInFlight to configure the parallel submissions for CommandService
2020-05-04 15:24:49 +02:00
simonmaxen-da
a8d97c9ec0
Add a reason text field to RejectReason.Inconsistent (#5180) (#5815)
* Add a reason text field to RejectReason.Inconsistent (#5180)

CHANGELOG_BEGIN

	- Add a reason text field to RejectReason.Inconsistent.
  See `#5810 <https://github.com/digital-asset/daml/issues/5810>`__.

CHANGELOG_END

* Change wording in contributing instructions to reflect best practice (#5820)

* Also make add reason text to other reject reasons that don't have it (#5820)

* Update with review comments (#5820)

* Update with review comments (#5820)

* Update with review comments (#5820)
2020-05-04 12:54:17 +01:00
Robert Autenrieth
9252515f4a
Increase wait time in deduplication tests (#5813)
Deduplication is unreliable around the end
of the deduplication window.

CHANGELOG_BEGIN
CHENGELOG_END
2020-05-04 13:13:08 +02:00
Moritz Kiefer
8f9cdeed95
Fix handling of packages in damlc visual (#5789)
* Fix handling of packages in damlc visual

Previously we just ran the analysis on the modules of the main
package. This failed for obvious reasons as soon as you reference a
template from another package which happens pretty
frequently (e.g. for anything that uses finlib).

This PR fixes this to run the analysis on the whole World which is
self-contained. This required a bunch of reshuffling to make sure that
we always reference fully qualified identifiers but most of it is
very mechanical.

Note that currently you cannot distinguish between templates with
identical names in the resulting graph (they will be separate but you
have no idea which one is which). This was already an issue
before if you have the same template name in different modules so I
consider this an orthogonal issue.

This fixes the expected failure we already had and I added another
test that checks that colliding template names do at least show up as
separate nodes in the graph. I also manually tested this against
ex-bond-issuance.

Disclaimier: I’m aware that the code is very messy but I tried to
resist the urge to rewrite it completely and only change what was
necessary.

fixes #5776

changelog_begin

- [DAML Compiler] ``damlc visual`` now works properly in projects
  consisting of multiple packages.

changelog_end

* Rename templateChoiceId to templateId

changelog_begin
changelog_end
2020-05-04 11:34:33 +02:00
Andreas Herrmann
4c99f67814
Publish Bazel logs (#5821)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-05-04 11:14:40 +02:00
Martin Huschenbett
bea3f76750
Remove spurious first argument from SHIFT_NUMERIC in DAML-LF spec (#5812)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-01 23:24:22 +00:00
Martin Huschenbett
b6299834e0
Fix the DAML-LF spec regarding text/codepoints conversion (#5818)
The two functions to convert between text and a list of codepoints
were documented the wrong way around. This PR fixes the issue. We
also sprinkle in a few plural "s" where needed.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-01 22:08:56 +00:00
Martin Huschenbett
0657080bae
Make the type argument order in DA.Numeric explicit (#5817)
All functions in `DA.Numeric` take the scale of the result as their
first type argument. IMO, this is a nice API since you usually only
want to specify the scale of the result since the scale of the
term arguments is most of the times inferred.

However, the current type signatures in `DA.Numeric` bear quite some
risk of being confusing. For instance, in
```haskell
mul : NumericScale n3 => Numeric n1 -> Numeric n2 -> Numeric n3
```
the naming of the type variables suggests that the order of the
type parameters is `n1 n2 n3` when it actually is `n3 n1 n2`.

I consider the knowledge of implicit `forall`s are filled in quite
expert and hence think we should make the order of these type arguments
explicit.

There is also a related mistake in the docs of `shift`. Running a
scenario confirmed that
```haskell
shift @1 @2 1.0 == 10.0
```
Hence, `shift` has multiplied its argument by `10^(2-1)`, which is
`10^(n1 - n2)`.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-01 22:32:47 +02:00
Rohan Jacob-Rao
5a09a75859
Trigger service: Use tagged Party type instead of String (#5816)
changelog_begin
changelog_end
2020-05-01 18:08:06 +00:00
Rohan Jacob-Rao
947e6e5ebc
trigger service: Move request params to separate file (#5808)
* Move request types to new file
* Rename TriggerParams to StartParams and a bit more formatting
changelog_begin
changelog_end
2020-05-01 13:00:54 -04:00
Leonid Shlyapnikov
51d96a7d2e
Upgrading to scalac/runtime v2.12.11, we have been on v2.12.6 for too long (#5807)
https://github.com/scala/scala/releases/tag/v2.12.11

Fixing scalac deprecation and unused variable warnings

`/:` is deprecated, using foldLeft
`:\` is deprecated, using foldRight

Removing unused deps reported by bazel buildozer + scalafmt

changelog_begin
Upgraded Scala compiler and Scala runtime to v2.12.11.
See https://github.com/scala/scala/releases/tag/v2.12.11
changelog_end
2020-05-01 11:37:07 -04:00
Shayne Fletcher
e7741dd850
handle stop message received before acs query complete (#5801)
changelog_begin
changelog_end
2020-05-01 11:24:58 -04:00
Stephen Compall
57c08d4819
reduce GenMap key depth and container element size in random testing (#5788)
* resize elements of containers by 1/3 in TypedValueGenerators

- no explosions in 2m samples

* use Order.apply

* resize key types of GenMaps more vigorously

- At max 100, the default, max size of a key *type* is 10, key size 33

* revert most of "reduce test count for Ordering tests (#5741)" 00025a5337

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 15:40:28 -04:00
Shayne Fletcher
1510d8ccd9
Rewrite acsQuery as a for-comprehension (#5803)
changelog_begin
changelog_end
2020-04-30 13:08:47 -04:00
Gerolf Seitz
e821168909
Reset service improvements for sadbonx (#5728)
- Only upload packages during the initial startup.
- Avoid loading packages during subsequent resets
- Share an engine between Ledger API Server and Committer

* Use a randomized H2 URL to simular in-memory

The reset service test assumes to get a completely new ledger for each
test case. But because we use H2 in-memory with db_close_delay=1 and the
same H2 database name, the second test case gets the remnants of the
first test case.

Since we know that sandbox in-memory uses an H2 in-memory URL, we can
simply use SandboxBackend.H2Database for ResetServiceInMemoryIT.

CHANGELOG_BEGIN
[Sandbox] Drastically lower the time needed to do a reset via the
ResetService.
CHANGELOG_END
2020-04-30 17:06:21 +02:00
Remy
9fc1ceae10
Engine: revisit freshness of cid discrimator (#5361)
CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 16:44:34 +02:00
Gary Verhaegen
0d65065e60
fix typo in vscode cron (#5800)
CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 14:40:08 +00:00
Robin Krom
85224e0ca6
snapshot release (#5796) 2020-04-30 16:31:24 +02:00
Moritz Kiefer
288f9479df
Fix warning in DAML-LF test DAR (#5798)
I finally got sufficiently annoyed seeing the warning scroll by in
build logs that I fixed it.

changelog_begin
changelog_end
2020-04-30 15:57:13 +02:00
Gary Verhaegen
ed13afc56a
fix overeager docs cron (#5797)
Currently the docs cron _always_ decides it has something new to
publish. This PR fixes that.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 15:31:38 +02:00
Gary Verhaegen
681c862d88
fix daml extension upload (#5780)
With the current setup, we always push whatever version GitHub considers
as the latest, which is defined by date. This means that at the moment a
patch release could overwrite a less recent but higher-version release,
essentially downgrading the SDK to a previous, presumably less good user
experience.

This patches the upload process to choose the highest-numbered release
instead of the most recent one by date.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 15:10:30 +02:00
Moritz Kiefer
8c25bc4de5
Fix find: ./local-spawn-runner not found issue (#5793)
CWD will be set to the same execroot for all targets on Windows. While
this will contain the things we are searching for it contains a whole
bunch of other stuff and in particular it can also change during the
execution of `find`. This resulted in errors with temporary files such
as the local-spawn-runner-* stuff that appear and disappear while
find is running.

This PR switches it to a tmp dir which works around this issue and
makes more sense anyway since we clearly don’t want to search in the
whole execroot.

changelog_begin
changelog_end
2020-04-30 15:09:04 +02:00
Gary Verhaegen
32fbf040aa
fail collect_build_data for windows_compat (#5779)
At the moment, collect_build_data will wait for the Windows
compatibility test to have "finished", but doesn't check its return
status. This means two things:

1. Should the compatibility test end without a success or error (e.g.
   communication broken between Azure and the node), the option to rerun
   failed jobs will not appear, as there will be no failed job.
2. The subsequent notify_user step will ignore failures in the
   compatibility_windows job when reporting to Slack, making for
   confusing reports.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 15:03:03 +02:00
Gary Verhaegen
f044dcebca
fix sitemap generation (#5775)
With the change in release model (VERSION to LATEST), I forgot to change
the workspace_status script. The result is that our sitemap will forever
indicate all the pages in the docs have been last modified on Feb 25,
discouraging search engines from indexing them again at any point since.

This PR fixes that by updating the workspace_status script, which
hopefully should result in search engines indexing us again.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 15:02:08 +02:00
Gary Verhaegen
dd37430c40
fix typo in link in docs (#5787)
CHANGELOG_BEGIN
CHANGELOG_END
2020-04-30 15:00:38 +02:00
Gary Verhaegen
ecb7636c2a
nuke the Bazel cache (#5782)
* nuke the Bazel cache

This is a bit of a nuclear option as we cannot figure out how to repair
the cache in place. It seems (somewhat) clear that the cache is
corrupted for Windows builds, but we're out of ideas on either how to
test it to fully confirm or how to repair it.

This PR will consist of two commits: one with the Bazel cache definition
commented out (this one), and then one that reverts it. This will result
in a no-change commit when squashed on master, but should serve as an
audit trail for the accompanying Standard Change (as I consider dropping
the entire cache outside of routine maintenance).

CHANGELOG_BEGIN
CHANGELOG_END

* run Windows build with no Linux node

Normally our Windows builds only start after a Linux node has run the
`check_for_release` step. This commit bypâsses that so this PR can run
while all the other ones are stuck in the Linux queue.

* Revert "nuke the Bazel cache"

This reverts commit f7cd68e080, recreating
the Bazel cache.

* populate macos cache and test Windows one

* revert all changes in this PR
2020-04-30 14:44:10 +02:00
Rohan Jacob-Rao
af8895b487
Trigger service: endpoint to list running triggers for a party (#5770)
* Endpoint to list all triggers (not yet by party)

* Clean up test code a little

changelog_begin
changelog_end

* Test for listing running triggers

* Respond with JSON list instead of random text

* List triggers by party

Pass party name in request body.
Store another map of party name to set of trigger ids.
Also store party names in the values of the original trigger id map, so
we can update the party map when stopping a trigger.
2020-04-29 14:43:56 -04:00
Samir Talwar
0ae62b50e4
sandbox: Mark the ResetService tests as flaky. (#5778) 2020-04-29 15:17:45 +02:00
Stefano Baghino
c709f91a73
Adjust PostCommitValidation (#5774)
* Adjust PostCommitValidation

- do not require a party for validation (to validate divulged contracts)
- stop validation after first error and don't accumulate rejection reasons
- address 01da7393b3 (r416719399)

changelog_begin
changelog_end

* Use participant state rejection reasons, drop unused submitter parameter from validation
2020-04-29 12:55:16 +00:00
Martin Huschenbett
cebc26af88
Make DAML execution benchmarks more flexible (#5771)
Instead of always benchmarking the hardcoded scenarios, we can now
pass a DAR and a scenario to the benchmark as well.

This is part of https://github.com/digital-asset/daml/issues/5746.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-29 12:41:43 +02:00
Stephen Compall
067f3c987d
require https reverse proxy (#5660)
* new --leak-passwords-firesheep-style option; functions to check forwarded protocol

* enforce https reverse-proxy in all JWT-accepting endpoints

* make HttpService.start take config record

* test that X-Forwarded-Proto or Forwarded is enforced

* use new start signature in daml-script tests

* use insecure http mode for ts codegen tests

* note on regex

* use insecure option in daml assistant integration tests

* log allowNonHttps setting

* add non-https option to more places in daml-assistant tests

* add non-https option to getting started guide

* rename --leak-passwords-firesheep-style to --allow-insecure-tokens

- per suggestion by @garyverhaegen-da, @hurryabit

CHANGELOG_BEGIN
- [JSON API] By default, checks that connections are made through a reverse-proxy
  providing HTTPS, ensuring that JWT tokens don't leak.  To disable this check,
  such as for development, pass ``--allow-insecure-tokens``.
  See `issue #5572 <https://github.com/digital-asset/daml/issues/5572>`_.
CHANGELOG_END

* daml start includes --allow-insecure-tokens by default

- as indicated by @cocreature
2020-04-28 14:33:38 -04:00
Moritz Kiefer
3787a23948
Refactor damlc visualize tests (#5761)
This moves the code from the Shake testing module to a separate
module. This is required since the Shake test setup is not really
intended to test multiple packages. I’ve added a new test suite that
makes use of this and has an expected failure for the issue with
multiple packages. The issue is not actually fixed in this PR, I just
wanted to keep the refactoring separate since it is quite large and
noisy.

changelog_begin
changelog_end
2020-04-28 19:29:14 +02:00
Leonid Rozenberg
95f10f1afb
Fix typo of extra d (#5762)
changelog_begin
changelog_end
2020-04-28 19:21:40 +02:00
Stefano Baghino
f71ab92ea5
Implement replacement for post-commit validation (#5737)
* Implement replacement for post-commit validation

PostCommitValidation is meant as a replacement for ActiveLedgerState and
ActiveLedgerStateManager for JdbcLedgerDao so that the old table can eventually
be retired and post-commit validation can happen on the new participant schema.

This commit simply introduces the implementation and tests it in isolation.

Integration with the existing system will come in a separate contribution.

changelog_begin
changelog_end

* Address https://github.com/digital-asset/daml/pull/5737#discussion_r415918949

* Address https://github.com/digital-asset/daml/pull/5737#discussion_r415921207

* Add tests for the empty ledger scenario and introduce necessary fixes

* Add more tests for fetch and using some prior history

* Add tests for divulged contracts
2020-04-28 18:53:52 +02:00
Leonid Shlyapnikov
102f6b3888
Use a custom Gen instead of Arbitrary, to generate nonempty Vec[Int], (#5763)
* Use a custom Gen instead of Arbitrary, to generate nonempty Vec[Int],

the test could fail on empty input, it expects at least one input message

changelog_begin
changelog_end

* Address code review comments
2020-04-28 16:25:09 +00:00
Samir Talwar
c1e1ee4d4b
Sandbox: Split LedgerApiServer up a little. (#5758)
* sandbox: Split up LedgerApiServer.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox: Extract out API service construction from LedgerApiServer.

* sandbox: Pull out a case class for GrpcServerOwner event loop params.

* sandbox: Split ownership of `ApiServices` from the object.
2020-04-28 15:44:31 +00:00
Robin Krom
7e070d6d16
language:docs: fix link in README of generated ts. (#5745)
While it's replaced already in the shipped docs together with the npm
package, it wasn't fixed on docs.daml.com.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-28 16:10:13 +02:00
Moritz Kiefer
49e19ebed1
Make compat tests work on windows (#5732)
* Make compat tests work on windows

This required some changes to the daml_sdk rule since the read-only
installation by the assistant breaks Bazel completely. We could only
apply those changes on Windows but I think I prefer the consistency
across platforms here over trying to stay close to how the SDK is
installed on user machines given that the SDK installation is not
something we’ve had issues with.

I’ve excluded the postgresql tests for now. I don’t expect them to be
particularly hard to fix but I’ve already spent almost 2 days on this
and having some tests run on Windows seems like a clear improvement
over running no tests on Windows :)

changelog_begin
changelog_end

* Remove todo

changelog_begin
changelog_end
2020-04-28 16:06:36 +02:00
Miklos
d6c5a2532d
Add counting future metrics (#5743)
* Added counting metrics.

* Code tidying.
CHANGELOG_BEGIN
CHANGELOG_END

* Rename based on review suggestion.
2020-04-28 13:58:15 +00:00
Martin Huschenbett
ea50c329f2
DAML Exec Perf: Add simple benchmark for scenario interpreter (#5747)
We add a benchmark for running a sufficiently big scenario. This PR is
more about setting up the benchmarking infrastructure rather than the
actual benchmark itself.

This is part of https://github.com/digital-asset/daml/issues/5746.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-28 14:44:29 +02:00
Gary Verhaegen
cfae3df7fa
report compat status every day (#5744)
I believe the compatibility check is important enough, and should fail
rarely enough, that it is worth reporting even on success. This will
mean (once we support Windows) 3 messages a day, sent while presumably
nobody is working, so the disruption should be minimal.

The issue with reporting only on failures is that, if we don't
proactively check (which we do for the state of master for different
reasons, but would likely not keep doing for a job that doesn't block
PRs), we may get into a state where it is so broken that it doesn't even
report.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-28 12:30:45 +02:00
Gary Verhaegen
54d6782be3
drop v from release titles (#5742)
This is a minor, cosmetic change. Note that all our references to
releases are based on tags, and do not depend on the release title. This
is evidenced by the fairly random titles we used to have before the
title was set by CI, see e.g.
[0.13.35](https://github.com/digital-asset/daml/releases/tag/v0.13.53).

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-28 11:51:16 +02:00
mziolekda
bbd21605f5
add readme that details the usage of integrity check tool (#5685)
* add readme that details the usage of integrity check tool

* Apply suggestions from code review

Addressing review comments

Co-Authored-By: Samir Talwar <samir.talwar@digitalasset.com>

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-04-28 09:18:35 +02:00
Remy
bb111ea3cc
Engine: fix value transaltion. (#5716)
In the call back of `SBUFetch` when asking the ledger for a contract the translateValue may raise an exception.
However it is not safe as the engine cannot recover such error.

We create a new Control for the speedy machine, that handle safely the translation.

CHANGELOG_BEGIN
CANGELOG_END
2020-04-27 21:56:53 +02:00
Stephen Compall
00025a5337
reduce test count for Ordering tests (#5741)
* reduce test count for Ordering tests

CHANGELOG_BEGIN
CHANGELOG_END

* changed the wrong one in ValueSpec; preserves base order is redundant for primitives
2020-04-27 14:31:37 -04:00
Gary Verhaegen
b2fc953250
extend visual for exerciseByKey (#5739)
* extend visual for exerciseByKey

Fair warning: I have no idea what I'm doing here. Please review
carefully.

This commit extends the `daml damlc visual` command to draw a line for
exerciseByKey choices. This fixes #5726.

I have not been able to find any existing test for the visualizer. If
non exist, I think we should at least turn #5726 into a test case,
checking that the expected dot file gets generated. I suggest doing that
as a separate PR though.

If there is already a suite of tests, please point me to it and I'll
happily add one for this.

CHANGELOG_BEGIN
[Visualization] Fix a bug where `exerciseByKey` was not properly
recognized. See #5726.
CHANGELOG_END

* add test
2020-04-27 18:51:40 +02:00