Commit Graph

3251 Commits

Author SHA1 Message Date
associahedron
860477bb1f
Handle generic variant records in data-deps. (#4710)
* Handle generic variant records in data-deps.

Fixes issue #4707.

changelog_begin
changelog_end

* Add usage test of problem constructor
2020-02-26 10:52:44 +00:00
Moritz Kiefer
cde562600c
Bump rules_haskell (#4687)
* Bump rules_haskell

Still checking if that helps with GHC 8.8 but we should upgrade this
either way.

changelog_begin
changelog_end

* disable grpc patch

* shut up buildifier

* delete unused ghci grpc patch

* Fix Cffi library not found issues

* Update deps.bzl

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2020-02-26 10:25:56 +00:00
Rohan Jacob-Rao
70734a6014
GSG: improve description of daml code (#4699)
* Change method of opening DAML files with VSCode

* More explanation of AddFriend choice

changelog_begin
changelog_end

* Contract not contract instance

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Remove 'instance' and explain nonconsuming better

* Fix file navigation and more wording

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-02-26 10:18:58 +00:00
Martin Huschenbett
c7588da274
@daml/react: Remove loading indication from useExercise hook (#4708)
* @daml/react: Remove loading indication from useExercise hook

The indicator was a stupid idea of mine in the first place. Sharing the
loading indicator between potentially concurrent calls to the function
returned by the hooks does not make any sense.

`useExerciseByKey` has the same problem and it's fixed here as well.

CHANGELOG_BEGIN
CHANGELOG_END

* Fix doc comments

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 10:08:46 +00:00
Andreas Herrmann
2dbb5282ca
Add init-script field to daml.yaml (#4685)
* Add init-script daml.yaml field

CHANGELOG_BEGIN
[DAML Script -- Experimental] You can now define an ``init-script`` in
  the ``daml.yaml`` file. If present, that DAML script will be executed
  to initialize the sandbox on ``daml start``. This can be used instead
  of the ``scenario`` field.
CHANGELOG_END

* Add integration test for init-script

* Generate JWT token in tests

Addressing review comment
https://github.com/digital-asset/daml/pull/4685#discussion_r383835050

* Remove unnecessary daml calls

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-02-26 09:30:09 +00:00
Martin Huschenbett
29ffe57c47
@daml/react: Expose the template id type parameter (#4698)
Right now, the `I` type parameter of `CreateEvent` is omitted in all
the hooks and hence set to its default value `string`. This is very
unfortunate in upgrading settings where you end up with multiple
versions of the same template that are basically only distinguishable
by their template id.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 09:09:48 +00:00
fabiotudone-da
b2a79df0d8
Expand Runner's flexibility as a basis for participant servers (#4669)
* Add overridable indexer, api and auth configuration to `LedgerFactory`

CHANGELOG_BEGIN
CHANGELOG_END

* Add overridable indexer and api metrics creation to `LedgerFactory`

CHANGELOG_BEGIN
CHANGELOG_END

* Add overridable api's `TimeServiceBackend` to `LedgerFactory`

* 🎨 Fix formatting

* Port SDK ledgers based on `Runner` (and the sandbox) to `TimeServiceBackend`

* Revert to `TimeProvider` for committer usage and to `None` default for API server.
Also removed now unused `TimeServiceProvider.wallClock()`.

* Move TimeServiceBackend back to the API server.

* 🎨 Remove unneeded argument passed for parameter w/default

* Restore sandbox ledger time support

* Simplify passing a `TimeProvider` to the sandbox ledger

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-02-26 09:31:26 +01:00
Gary Verhaegen
c650ec058b
first ever snapshot release (#4694)
Exercising #4513.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 03:36:42 +01:00
Gary Verhaegen
3a5c777b35
fix checkout release step (#4701)
In the current setup, we expose HEAD as the trigger commit, but that is
the merge commit with master. Since making a release takes a long time,
this merge commit is likely to not exist anymore by the time we want to
try a rerun (assuming a flaky build).

Release PRs are by definition (in the new system) independent of what's
going on on master, so we should instead take the branch commit here
when running on a PR.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-25 21:52:11 +01:00
Gary Verhaegen
01c88138bc
fix release.sh (#4695)
Small things I apparently forgot to change in the latest stages of #4513.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-25 21:51:02 +01:00
Shayne Fletcher
8c36b68a3d
Upgrade to ghc-lib-8.8.1.20200225 (#4692)
- Prelude `daml 1.2` is now optional;
- `HsDumpAst` now comes from `ghc-lib-parser`.

changelog_begin
changelog_end
2020-02-25 14:57:17 -05:00
Shayne Fletcher
b1a3be5950
copyDirectory, mvDirectory - daml-project-config -> da-hs-base (#4697)
changelog_begin
changelog_end
2020-02-25 14:57:06 -05:00
Gary Verhaegen
5a117dc358
introduce new release process (#4513)
Context
=======

After multiple discussions about our current release schedule and
process, we've come to the conclusion that we need to be able to make a
distinction between technical snapshots and marketing releases. In other
words, we need to be able to create a bundle for early adopters to test
without making it an officially-supported version, and without
necessarily implying everyone should go through the trouble of
upgrading. The underlying goal is to have less frequent but more stable
"official" releases.

This PR is a proposal for a new release process designed under the
following constraints:

- Reuse as much as possible of the existing infrastructure, to minimize
  effort but also chances of disruptions.
- Have the ability to create "snapshot"/"nightly"/... releases that are
  not meant for general public consumption, but can still be used by savvy
  users without jumping through too many extra hoops (ideally just
  swapping in a slightly-weirder version string).
- Have the ability to promote an existing snapshot release to "official"
  release status, with as few changes as possible in-between, so we can be
  confident that the official release is what we tested as a prerelease.
- Have as much of the release pipeline shared between the two types of
  releases, to avoid discovering non-transient problems while trying to
  promote a snapshot to an official release.
- Triggerring a release should still be done through a PR, so we can
  keep the same approval process for SOC2 auditability.

The gist of this proposal is to replace the current `VERSION` file with
a `LATEST` file, which would have the following format:

```
ef5d32b7438e481de0235c5538aedab419682388 0.13.53-alpha.20200214.3025.ef5d32b7
```

This file would be maintained with a script to reduce manual labor in
producing the version string. Other than that, the process will be
largely the same, with releases triggered by changes to this `LATEST`
and the release notes files.

Version numbers
===============

Because one of the goals is to reduce the velocity of our published
version numbers, we need a different version scheme for our snapshot
releases. Fortunately, most version schemes have some support for that;
unfortunately, the SDK sits at the intersection of three different
version schemes that have made incompatible choices. Without going into
too much detail:

- Semantic versioning (which we chose as the version format for the SDK
  version number) allows for "prerelease" version numbers as well as
  "metadata"; an example of a complete version string would be
  `1.2.3-nightly.201+server12.43`. The "main" part of the version string
  always has to have 3 numbers separated by dots; the "prerelease"
  (after the `-` but before the `+`) and the "metadata" (after the `+`)
  parts are optional and, if present, must consist of one or more segments
  separated by dots, where a segment can be either a number or an
  alphanumeric string. In terms of ordering, metadata is irrelevant and
  any version with a prerelease string is before the corresponding "main"
  version string alone. Amongst prereleases, segments are compared in
  order with purely numeric ones compared as numbers and mixed ones
  compared lexicographically. So 1.2.3 is more recent than 1.2.3-1,
  which is itself less recent than 1.2.3-2.
- Maven version strings are any number of segments separated by a `.`, a
  `-`, or a transition between a number and a letter. Version strings
  are compared element-wise, with numeric segments being compared as
  numbers. Alphabetic segments are treated specially if they happen to be
  one of a handful of magic words (such as "alpha", "beta" or "snapshot"
  for example) which count as "qualifiers"; a version string with a
  qualifier is "before" its prefix (`1.2.3` is before `1.2.3-alpha.3`,
  which is the same as `1.2.3-alpha3` or `1.2.3-alpha-3`), and there is a
  special ordering amongst qualifiers. Other alphabetic segments are
  compared alphabetically and count as being "after" their prefix
  (`1.2.3-really-final-this-time` counts as being released after `1.2.3`).
- GHC package numbers are comprised of any number of numeric segments
  separated by `.`, plus an optional (though deprecated) alphanumeric
  "version tag" separated by a `-`. I could not find any official
  documentation on ordering for the version tag; numeric segments are
  compared as numbers.
- npm uses semantic versioning so that is covered already.

After much more investigation than I'd care to admit, I have come up
with the following compromise as the least-bad solution. First,
obviously, the version string for stable/marketing versions is going to
be "standard" semver, i.e. major.minor.patch, all numbers, which works,
and sorts as expected, for all three schemes. For snapshot releases, we
shall use the following (semver) format:

```
0.13.53-alpha.20200214.3025.ef5d32b7
```

where the components are, respectively:

- `0.13.53`: the expected version string of the next "stable" release.
- `alpha`: a marker that hopefully scares people enough.
- `20200214`: the date of the release commit, which _MUST_ be on
  master.
- `3025`: the number of commits in master up to the release commit
  (included). Because we have a linear, append-only master branch, this
  uniquely identifies the commit.
- `ef5d32b7ù : the first 8 characters of the release commit sha. This is
  not strictly speaking necessary, but makes it a lot more convenient to
  identify the commit.

The main downsides of this format are:

1. It is not a valid format for GHC packages. We do not publish GHC
  packages from the SDK (so far we have instead opted to release our
  Haskell code as separate packages entirely), so this should not be an
  issue. However, our SDK version currently leaks to `ghc-pkg` as the
  version string for the stdlib (and prim) packages. This PR addresses
  that by tweaking the compiler to remove the offending bits, so `ghc-pkg`
  would see the above version number as `0.13.53.20200214.3025`, which
  should be enough to uniquely identify it. Note that, as far as I could
  find out, this number would never be exposed to users.
2. It is rather long, which I think is good from a human perspective as
  it makes it more scary. However, I have been told that this may be
  long enough to cause issues on Windows by pushing us past the max path
  size limitation of that "OS". I suggest we try it and see what
  happens.

The upsides are:

- It clearly indicates it is an unstable release (`alpha`).
- It clearly indicates how old it is, by including the date.
- To humans, it is immediately obvious which version is "later" even if
  they have the same date, allowing us to release same-day patches if
  needed. (Note: that is, commits that were made on the same day; the
  release date itself is irrelevant here.)
- It contains the git sha so the commit built for that release is
  immediately obvious.
- It sorts correctly under all schemes (modulo the modification for
  GHC).

Alternatives I considered:

- Pander to GHC: 0.13.53-alpha-20200214-3025-ef5d32b7. This format would
  be accepted by all schemes, but will not sort as expected under semantic
  versioning (though Maven will be fine). I have no idea how it will sort
  under GHC.
- Not having any non-numeric component, e.g. `0.13.53.20200214.3025`.
  This is not valid semantic versioning and is therefore rejected by
  npm.
- Not having detailed info: just go with `0.13.53-snapshot`. This is
  what is generally done in the Java world, but we then lose track of what
  version is actually in use and I'm concerned about bug reports. This
  would also not let us publish to the main Maven repo (at least not more
  than once), as artifacts there are supposed to be immutable.
- No having a qualifier: `0.13.53-3025` would be acceptable to all three
  version formats. However, it would not clearly indicate to humans that
  it is not meant as a stable version, and would sort differently under
  semantic versioning (which counts it as a prerelease, i.e. before
  `0.13.53`) than under maven (which counts it as a patch, so after
  `0.13.53`).
- Just counting releases: `0.13.53-alpha.1`, where we just count the
  number of prereleases in-between `0.13.52` and the next. This is
  currently the fallback plan if Windows path length causes issues. It
  would be less convenient to map releases to commits, but it could still
  be done via querying the history of the `LATEST` file.

Release notes
=============

> Note: We have decided not to have release notes for snapshot releases.

Release notes are a bit tricky. Because we want the ability to make
snapshot releases, then later on promote them to stable releases, it
follows that we want to build commits from the past. However, if we
decide post-hoc that a commit is actually a good candidate for a
release, there is no way that commit can have the appropriate release
notes: it cannot know what version number it's getting, and, moreover,
we now track changes in commit messages. And I do not think anyone wants
to go back to the release notes file being a merge bottleneck.

But release notes need to be published to the releases blog upon
releasing a stable version, and the docs website needs to be updated and
include them.

The only sensible solution here is to pick up the release notes as of
the commit that triggers the release. As the docs cron runs
asynchronously, this means walking down the git history to find the
relevant commit.

> Note: We could probably do away with the asynchronicity at this point.
> It was originally included to cover for the possibility of a release
> failing. If we are releasing commits from the past after they have been
> tested, this should not be an issue anymore. If the docs generation were
> part of the synchronous release step, it would have direct access to the
> correct release notes without having to walk down the git history.
>
> However, I think it is more prudent to keep this change as a future step,
> after we're confident the new release scheme does indeed produce much more
> reliable "stable" releases.

New release process
===================

Just like releases are currently controlled mostly by detecting
changes to the `VERSION` file, the new process will be controlled by
detecting changes to the `LATEST` file. The format of that file will
include both the version string and the corresponding SHA.

Upon detecting a change to the `LATEST` file, CI will run the entire
release process, just like it does now with the VERSION file. The main
differences are:

1. Before running the release step, CI will checkout the commit
  specified in the LATEST file. This requires separating the release
  step from the build step, which in my opinion is cleaner anyway.
2. The `//:VERSION` Bazel target is replaced by a repository rule
  that gets the version to build from an environment variable, with a
  default of `0.0.0` to remain consistent with the current `daml-head`
  behaviour.

Some of the manual steps will need to be skipped for a snapshot release.
See amended `release/RELEASE.md` in this commit for details.

The main caveat of this approach is that the official release will be a
different binary from the corresponding snapshot. It will have been
built from the same source, but with a different version string. This is
somewhat mitigated by Bazel caching, meaning any build step that does
not depend on the version string should use the cache and produce
identical results. I do not think this can be avoided when our artifact
includes its own version number.

I must note, though, that while going through the changes required after
removing the `VERSION` file, I have been quite surprised at the sheer number of
things that actually depend on the SDK version number. I believe we should
look into reducing that over time.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-25 17:01:23 +01:00
Samir Talwar
2e8bb47ef5
Sandbox: Fix two race conditions on shutdown in ReadOnlySqlLedger. (#4621)
* sandbox: Make ReadOnlySqlLedger provide a ResourceOwner, not a Resource.

* sandbox: Fix two race conditions on shutdown in ReadOnlySqlLedger.

It appears that there are two race conditions regarding the ledger end
update mechanism.

1.  The dispatcher can keep firing for a little while even after we shut
    down the source, which can cause a spurious connection failure as it
    makes a query on a closed database connection.
2.  We don't wait for the sink to complete, which means, again, we could
    shut down the connection before the last `lookupLedgerEnd` query is
    issued.

This also makes sure we actually construct a new source if the updates
fail. Previously we were re-using the same source, which looked like a
crash-loop waiting to happen.

Tested by constructing `ReadOnlySqlLedger` and closing it in a loop, and
watching for errors.

CHANGELOG_BEGIN
- [Ledger API Server] Fix a race condition on shutdown in which polling
  for the ledger end could continue even after the database connection
  was closed.
CHANGELOG_END
2020-02-25 15:53:23 +00:00
Stefano Baghino
29755b6d5f
Write command completions to a separate table (#4681)
* Write command completions to a separate table

This should improve the read time and offload filtering to the index database

CHANGELOG_BEGIN
[Ledger API Server] New indexing scheme for command completions, improved performance
CHANGELOG_END

* Allow nullable values for checkpoints

* Added necessary newlines for Flyway migrations

* Address https://github.com/digital-asset/daml/pull/4681#discussion_r383713626

* Address https://github.com/digital-asset/daml/pull/4681#discussion_r383714728

* Record offsets ready to be served by the Ledger API (i.e. the offset shifts by one)

* Address https://github.com/digital-asset/daml/pull/4681#discussion_r383859124
2020-02-25 16:53:03 +01:00
Rohan Jacob-Rao
044ccc1280
GSG: Explain Sandbox and JSON API better and improve wording in intro (#4691)
* GSG: Explain Sandbox and JSON API better and improve wording in intro

Also adapt to lack of sign up.

changelog_begin
changelog_end

* Address comments
2020-02-25 15:43:10 +00:00
Rohan Jacob-Rao
f3a72cc6fc
GSG: Update code samples with latest create-daml-app (before and after feature) (#4689)
* Update files after messaging change

* Update daml code

* Update MainView before feature change

changelog_begin
changelog_end
2020-02-25 15:01:16 +01:00
Martin Huschenbett
4614602f92
daml2ts: Don't fest @daml/types from npmjs.com in tests (#4688)
* daml2ts: Don't fest @daml/types from npmjs.com in tests

We now copy the compiled version of `@daml/types` into the yarn
workspace instead of getting it from npmjs.com.

I verified that it works if I change the `VERSION` file to contain
0.13.55. Thus, we're definitely not going to npmjs.com.

CHANGELOG_BEGIN
CHANGELOG_END

* Disable tests on windows

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-02-25 13:56:30 +00:00
Samir Talwar
9bdfbb0534
Avoid opening a server to the world when finding a free port. (#4683)
* Avoid opening a server to the world when finding a free port.

This is very annoying on macOS because we get a focus-stealing popup for
a split second, asking for permission to allow the server through the
firewall. The popup pretty much always disappears before it can even be
read, when the server is closed.

This is almost certainly not an attack vector, because:
  - we only do this in tests,
  - the server is open for only a few milliseconds,
  - nothing is served,
  - and finding the port is tricky, because it's effectively random.

Nevertheless, it's very annoying.

CHANGELOG_BEGIN
CHANGELOG_END

* Extract a Bazel package for finding free ports.

We seem to do it in 4 different places, which I think is enough to
remove the duplication.
2020-02-25 13:09:28 +00:00
Stefano Baghino
e9a318cee2
Split Ledger API Test Tool output (#4686)
* Split Ledger API Test Tool output

Makes failure pop up even without text coloring (e.g. on Azure Pipelines)

CHANGELOG_BEGIN
[DAML Ledger Integration Kit] Ledger API Test Tool now prints errors as a separate section
CHANGELOG_END

* Successes on the right, failures on the left :)

* Add missing newline
2020-02-25 13:00:20 +00:00
Samir Talwar
3df3190122
ledger-api-test-tool-on-canton: Upgrade Canton to v0.9.0. (#4684)
CHANGELOG_BEGIN
CHANGELOG_END
2020-02-25 12:23:42 +00:00
Moritz Kiefer
38b7e65197
Add documentation for DAML repl and advertise it (#4678)
* Add documentation for DAML repl and advertise it

This PR adds some simple docs for ``daml repl`` and adds it to the
release notes.

changelog_begin

- [DAML Repl - Experimental] A new ``daml repl`` command that allows
  you to use the ``DAML Script`` API interactively. Take a look at the
  `documentation <https://docs.daml.com/daml-repl/>`_ for more
  information.

changelog_end

* Update docs/source/daml-repl/index.rst

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* s/Repl/REPL/

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2020-02-25 11:16:31 +00:00
Rohan Jacob-Rao
731b2c56ea
Rework description of using the app with recent changes (#4679)
* Rework description of using the app with recent changes

changelog_begin
changelog_end

* Formatting

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Wording

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Address more comments

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-02-24 19:59:36 +00:00
Shayne Fletcher
825378c880
Add lint steps to tests (#4676)
changelog_begin
changelog_end
2020-02-24 14:52:05 -05:00
Shayne Fletcher
89b09612df
Use PackageName type (#4677)
changelog_begin
changelog_end
2020-02-24 14:28:21 -05:00
Stefano Baghino
0e02690382
Make the completion service return API response directly (#4675)
* Make the completion service return API response directly

Skip intermediate transformation to CompletionEvent and return the API
response directly. This approach will be followed by a new implementation
that directly stores to and retrieves from the index instead of using the
transaction stream and filtering it.

CHANGELOG_BEGIN
CHANGELOG_END

* Fix build errors

* Address https://github.com/digital-asset/daml/pull/4675#discussion_r383405441

* Address https://github.com/digital-asset/daml/pull/4675#discussion_r383406125

* Address https://github.com/digital-asset/daml/pull/4675#discussion_r383405965
2020-02-24 18:40:45 +00:00
Moritz Kiefer
76ae5d15a4
Use package metadata instead of file names to infer unit ids (#4667)
* Use package metadata instead of file names to infer unit ids

This PR adds a function that abstracts over whether we get metadata
from a filename (< 1.dev) or directly from the LF metadata.

There is more work to be done here, in particular, I want to clean up
the hacks around daml-prim/daml-stdlib but I’ll leave that for a
separate PR.

changelog_begin
changelog_end

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Util.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* Refactor getUnitId

Co-authored-by: associahedron <231829+associahedron@users.noreply.github.com>
2020-02-24 18:12:29 +00:00
Moritz Kiefer
2a05611b63
Graceful error handling in daml repl (#4673)
* Graceful error handling in `daml repl`

This PR changes `daml repl` to handle errors (parse errors, type
errors, unsupported statement errors, script errors) gracefully
and just emit an error message instead of tearing down the whole
process.

This gets the repl into a state where I think it’s sufficiently
user-friendly to be released (obviously there are tons of potential
improvements). The only thing missing before I’m comfortable
mentioning this in release notes and uninternalizing it are docs.
If you think there is something crucial that needs to be addressed
before, let me know.

changelog_begin
changelog_end

* why is windows
2020-02-24 18:15:32 +01:00
Moritz Kiefer
500fb9a171
Support shadowing in daml repl (#4668)
changelog_begin
changelog_end
2020-02-24 15:47:00 +01:00
Samir Talwar
3f325c8e96
Sandbox: Fix a bug in the ResetServiceIT timedReset function. (#4665)
* sandbox: Fix a bug in the ResetServiceIT `timedReset` function.

It was computing the start and end times almost simultaneously.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox: Better error messages in ResetServiceIT if resets are slow.

Let the matchers do their magic.
2020-02-24 14:08:20 +00:00
Martin Huschenbett
9b40d98f65
@daml/react: Add tests for useFetchByKey hook (#4663)
CHANGELOG_BEGIN
CHANGELOG_END
2020-02-24 15:07:00 +01:00
Rohan Jacob-Rao
729ba80360
Try to typescript highlighting, still failing for tsx (#4664)
CHANGELOG_BEGIN
CHANGELOG_END
2020-02-24 12:14:22 +00:00
Stefano Baghino
347990ca9c
Relieve Ledger API DB thread pool of unnecessary work (#4657)
Smaller sibling of #4655

CHANGELOG_BEGIN
[Ledger API Server] Better usage of computing resources, should sustain heavier loads
CHANGELOG_END
2020-02-24 11:42:51 +01:00
Martin Huschenbett
c73d90274a
@daml/react: Add rerendering test for useQuery (#4662)
Add a test for `useQuery` that ensure that we don't call the JSON API
if the component calling the hook changes without changing the query.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-24 10:40:51 +00:00
Moritz Kiefer
8d81399c0f
Add an experimental DAML script REPL (#4660)
As mentioned in the title, this is still very experimental and needs
more work before we want to advertise it. However, the code is in a
somewhat reasonable shape, there are tests and I think even in the
current state it is already useful. Also this PR is already getting
very large so I don’t want to hold off much longer before merging this.

It is included in the SDK but hidden from `damlc --help` and `daml
--help` until the most pressing issues are addressed (primarily around
making sure that it doesn’t just shut down if you have a type error
and better error messages in general).

changelog_begin
changelog_end
2020-02-24 11:06:27 +01:00
Martin Huschenbett
b38ec15e3a
Add hlint rule to use whenJust instead of maybe (pure ()) (#4659)
This has come up a few times lately.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-24 10:08:44 +01:00
Gerolf Seitz
8e7a819a38
Extractor: only store contracts if a party is a stakeholder (#4586)
CHANGELOG_BEGIN
- [Extractor (experimental)]: Contracts visible to a party without being a stakeholder are not stored anymore.
- [Extractor (experimental)]: Along with the previous change, the column ``contract.witness_parties`` has been renamed to ``contract.stakeholders``.
CHANGELOG_END

Contributes to #3498.
2020-02-24 08:55:50 +01:00
Shayne Fletcher
6bfee0c854
Add yarn steps to tests (#4658)
changelog_begin
changelog_end
2020-02-21 20:21:18 -05:00
Remy
0321a1bb32
[Engine] push absolute contract ids inside the evaluation (#4652)
* [Engine] push absolute contract inside the evaluation
* Remove discriminator fom relative contract id

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 20:21:35 +01:00
Moritz Kiefer
c68dd19ade
Decode and validate package metadata in Scala (#4653)
This adds the code for decoding and validating package metadata
that is now emitted by damlc.

changelog_begin
changelog_end
2020-02-21 18:20:42 +00:00
Martin Huschenbett
9ff28e51b0
@daml/react: Test that useQuery handles query changes (#4656)
CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 18:16:05 +01:00
Stefano Baghino
1b23be6cc3
Decode DAML-LF retrieved from the database in the server thread pool (#4655)
This relieves the database thread pool from work it's not supposed to
do.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 16:39:18 +00:00
Martin Huschenbett
4a8c5cf24e
@daml/react: Use jest.fn mock functions in test (#4650)
Also mock the constructor of the `Ledger` class and separete out the
test for initializing the `DamlLedger` component.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 15:31:13 +01:00
fabiotudone-da
0fd7bcaadc
Document and comment Resource and ResourceOwner. (#4651)
* Document and comment `Resource` and `ResourceOwner`.

* Apply @SamirTalwar-DA's suggested changes

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 14:56:00 +01:00
Shayne Fletcher
6d6b632b68
daml2ts : Better multi-dar support (#4641)
* Step (1) Add error detection for different names/same package

changelog_begin
changelog_end

* Step (2) : Generate TS for a package once and only once.
2020-02-21 08:33:40 -05:00
Moritz Kiefer
c03ded317b
Produce package metadata in damlc (#4647)
This PR adds the necessary infrastructure to produce package metadata
in `damlc`.

For `damlc build` this works exactly as expected. There are a few edge
cases where we don’t have names and/or versions (namely scenarios,
damlc compile and damlc package). We don’t really care about the
metadata for those anyway, so I’ve just set it some default value.

changelog_begin
changelog_end
2020-02-21 13:47:28 +01:00
Moritz Kiefer
fb30690787
Clarify optionality of pVersion field in PackageConfig (#4648)
changelog_begin
changelog_end
2020-02-21 11:58:32 +00:00
Martin Huschenbett
19e1973b29
Improve documentation of DA.Text.sha256 (#4649)
This was suggested on the public slack. Easy enough to fix it quickly.

changelog_begin
changelog_end
2020-02-21 11:48:52 +00:00
Samir Talwar
d729e5135e
recovering-indexer-integration-tests: Extract from reference-v2. (#4636)
This moves IndexerIT into its own package, and swaps the dependency from
reference-v2 to ledger-on-memory.

This test should ideally live in the sandbox code, but because it
depends on ledger-on-memory, it's easier to keep it separate.

Also rewrites a lot of the code because the API is different. The tests
should now be clearer too.

I've also marked the test as flaky, because, well, it is.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 11:10:32 +00:00
Martin Huschenbett
0284fd04b4
@daml/react: Make the test suite invokable by yarn test (#4646)
Unfortunately, we need to work around some bazel issues which lead to
confliciting versions of react in our tests. This workaround cannot be
used the tests are invoked via `yarn test`. Thus, we only use it when
we the tests from bazel. We use the existence of the environment
variable `TEST_WORKSPACE` as a proxy for whether we run from bazel.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 10:38:27 +00:00