Commit Graph

3468 Commits

Author SHA1 Message Date
Moritz Kiefer
ad0336d3a5
Freeze DAML-LF 1.8 proto (#4788)
* Freeze DAML-LF 1.8 proto

This is a copy of the 1.dev proto with the following changes that
overall remove all references to 1.dev:

* Change the versions and the reference to the spec.
* Remove `dev` from version history at the top.
* Remove `GENMAP` and corresponding primitives.
* Remove general equality `EQUAL` and the comments that the
  type-specific equality primitives are only available in < 1.dev
* Remove experimental text primitives.

changelog_begin
changelog_end

* windows is very bad

* bump windows hashes
2020-03-03 14:21:00 +01:00
Moritz Kiefer
3c30073b31
Merge cross-LF tests (#4785)
Given that these two group of tests run for the same combination of LF
versions, I don’t see any reason why we should keep them
separate. Merging them, speeds up the packaging tests by > 50s on my
local machine.

changelog_begin
changelog_end
2020-03-03 09:53:06 +00:00
Moritz Kiefer
cc7f3e7ad0
Avoid decoding package twice in validate-dar (#4780)
Rather than decoding everything twice, we can only rewrite references
which is measurably faster (> 5s out of 60s on the packaging tests).

changelog_begin
changelog_end
2020-03-03 10:28:11 +01:00
Samir Talwar
6711b04a30
sandbox: Standardize logging when initializing the ledger. (#4782)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-03 09:04:32 +00:00
Samir Talwar
a99156252d
libs-scala/ports: Wrap socket ports in a type, Port. (#4784)
* libs-scala/ports: Wrap socket ports in a type, `Port`.

* sandbox: Use `Port` for the API server port, and propagate.

CHANGELOG_BEGIN
CHANGELOG_END

* extractor: Use `Port` for the server port.

* ports: Make Port a compile-time class only.

* ports: Allow port 0; it can be specified by a user.

* ports: Publish to Maven Central.
2020-03-03 08:59:15 +00:00
Moritz Kiefer
ebbe135583
Add singleton to DA.List (#4777)
changelog_begin

- [DAML Standard Library] Add ``singleton`` to ``DA.List``.

changelog_end
2020-03-02 20:49:21 +00:00
Leonid Shlyapnikov
93329ac81d
Add create-and-exercise JSON API endpoint (#4754)
* CreateAndExerciseCommand JSON decoding

* create-and-exercise endpoint WIP

* create-and-exercise endpoint + test, WIP

* create-and-exercise test

* Update docs

CHANGELOG_BEGIN

[JSON API - Experimental]
Add ``/v1/create-and-exercise`` JSON API endpoint. See #4507.

CHANGELOG_END

* Cleaning up domain JSON encoder/decoder, trying to get rid of HasTemplate

* Cleaning up domain JSON encoder/decoder, trying to get rid of HasTemplate

* Addressing code review comments
2020-03-02 20:43:58 +00:00
Samir Talwar
89c23ef85d
Heartbeats for Sandbox-Next, ledger-on-sql, and ledger-on-memory. (#4755)
* kvutils: Make the `KeyValueParticipantStateReader` tests more rigorous.

If the `offset` is specified as `None`, expect it to be `None`, not
just anything.

* kvutils: Simplify `KeyValueParticipantStateReader#stateUpdates`.

Construct the Source with `Source.apply`, not `Source.fromIterator`.

* kvutils: Use multiple entry IDs in `KeyValueParticipantStateReaderSpec`.

* kvutils: Add basic tests to `KeyValueParticipantStateReaderSpec`.

* kvutils: Add heartbeats to `LedgerReader`'s `events` output.

Heartbeats are optional, to be delivered by the ledger if and when it
deems necessary.

* sandbox-next: An observing time service backend using Akka streams.

* sandbox-next: A regular heartbeat based on Akka Streams' `tick`.

* sandbox: Replace `TimeServiceBackend.withObserver` with `.observing`.

More code, but it's more decoupled, so can more easily be sent to the
underlying backend in Sandbox Next.

CHANGELOG_BEGIN
- [Sandbox] Fixed a bug in the command completions stream when running
  Sandbox in static time. Previously, upon updating the time, the old
  time was emitted on the completions stream. The new time is now
  emitted.
CHANGELOG_END

* sandbox: TimeServiceBackend should only emit accepted changes.

* ledger-on-memory: Use `LedgerRecord` directly.

* ledger-on-memory: Stream heartbeats to the log.

* ledger-on-memory: Encapsulate mutations behind locks at all times.

* ledger-on-memory: Differentiate between reading and writing.

* ledger-on-memory: Factor out appending to the log.

* kvutils: Move the heartbeat test into the base from ledger-on-memory.

* kvutils: Log when the submission validation fails unexpectedly.

* ledger-on-sql: Add a script to hash all migrations.

* ledger-on-sql: Publish heartbeats to the log, and stream them out.

* ledger-on-sql: Log if publishing the heartbeat failed.

* ledger-on-sql: Wrap all queries in `Try`.

Just to make sure that we don't throw from a function that returns `Try`
or `Future`.

* ledger-on-sql: Allow `Long` values as the heartbeat timestamp.

`INTEGER` really does mean 32-bit, apparently.

* sandbox-next: Pipe heartbeats to the ledger.

* ledger-on-sql: Make sure we publish the correct head after a heartbeat.

Off-by-one errors are the best errors.

* ledger-on-(memory|sql): Just accept heartbeats, not their owner.

* sandbox: Update CIDs in tests to account for the extra heartbeat.

* ledger-on-memory: Fix a reference to variable in a comment.

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* ledger-on-sql: `flatMap` over `Try` rather than `Future` when possible.

* sandbox: Make sure the heartbeat queues are thread-safe.

* kvutils: Remove `LoggingContext` from the interfaces.

Keep it internally. This means we'll drop any context, but otherwise
things should work as expected.

* sandbox-next: Pull out the heartbeat interval into a constant.

* ledger-on-sql|sandbox: Clarify large levels of nesting.

Co-authored-by: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2020-03-02 19:44:42 +00:00
Oliver Seeliger
95f596ec56
Lower Ledger api server rejected submissions to info (#4773)
Rejected submissions are a user-error and don't indicate a problem with the server not functioning properly. Such user
errors make it hard to spot "real" server-side warnings and errors.
i
Closes #4772

CHANGELOG_BEGIN
- The Ledger API Server now logs rejected submissions at a lower "INFO" level to remove a source of warnings/errors without relation to server health.
CHANGELOG_END
2020-03-02 19:01:47 +00:00
nickchapman-da
8ba9a2647d
Update Upgrade.daml (#4775)
changelog_begin
changelog_end
2020-03-02 18:26:36 +00:00
Moritz Kiefer
6ebf455f62
Remove -j 200 (#4771)
Originally, we introduced this since it made fully cached builds
slightly faster. However, that was a long time ago. Looking at the
numbers now, things actually seem to be significantly faster without
this (possibly due to changes in how Bazel handles this). In
particular on MacOS where I’ve seen a couple of builds with < 20
minutes on CI which I did not see in quite some time without this.

changelog_begin
changelog_end
2020-03-02 18:53:18 +01:00
Moritz Kiefer
d68d3eb74a
Freeze DAML-LF 1.8 (#4770)
* Freeze DAML-LF 1.8

Two minor points that I did not mention in the previous PR:

We also include the renaming of structural records to `struct` and the
renaming of `Map` to `TextMap`.

There are some minor changes around the LF encoder tests which need to
be able to emit package metadata properly so I’ve added it to the
parser. Sorry for not splitting that out.

Following the process used for the DAML-LF 1.7 release, this does not
yet include the frozen proto file.

changelog_begin

- [DAML-LF] Release DAML-LF 1.8:

  * Rename structural records to ``Struct``. Note that
    structural records are not exposed in DAML.
  * Rename ``Map`` to ``TextMap``.
  * Add type synonyms. Note that type synonyms are not serializable.
  * Add package metadata, i.e., package names and versions.

  Note that the default output of ``damlc`` is stil DAML-LF 1.7. You
  can produce DAML-LF 1.8 by passing ``--target=1.8``.

changelog_end

* Update encoder

* Update java codegen tests

* Update comment in scala codegen

* Handle TSynApp in interface reader

* Bump lf_stable_version to 1.7

* Fix kvutils tests
2020-03-02 18:29:26 +01:00
Stefano Baghino
83da2c643b
Clean up ledger-api-common (#4774)
Removes unused classes

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-02 18:16:45 +01:00
Remy
e7ee8143cb
[kvutils] use new contract id scheme (#4741)
* Make kvutils work with the new contract id scheme

CHANGELOG_BEGIN
- [KVUtils] uses random contract id. Contract ids are made of 65 hexa decimal characters.
CHANGELOG_END

Co-authored-by: Jussi Mäki <jussi.maki@digitalasset.com>
2020-03-02 17:50:38 +01:00
Stefano Baghino
00a3a1c2bb
Tighten the loop: backend services to return API responses (#4763)
* Tighten the loop: backend services to return API responses

CHANGELOG_BEGIN
CHANGELOG_END

* Use transaction filter directly

* Remove unnecessary transition through domain objects

* Ensure transient contract remover compares sets of witnesses

* Honor verbosity in request

* Address review https://github.com/digital-asset/daml/pull/4763#pullrequestreview-367012726

- using named parameters when creating the API objects
- renamed EventOps accessors to easily recognizable names
- dropped unnecessary usage of views
- honoring verbosity level in request in all places
- replaced usage of lenses with simple copying where it made sense
2020-03-02 15:06:38 +00:00
Moritz Kiefer
501aa9e89e
Prepare DAML-LF 1.8 release (#4769)
We will only include type synonyms and package metadata (which are
used for Cross-SDK model upgrades). Everything else stays in 1.dev for
now.

changelog_begin
changelog_end
2020-03-02 14:23:07 +00:00
nickchapman-da
47fa9eb0ca
Add validate-dar to the assistant whitelist. (#4766)
changelog_begin
changelog_end
2020-03-02 11:57:24 +00:00
Moritz Kiefer
040d343b8c
Document package metadata in LF spec (#4764)
* Document package metadata in LF spec

changelog_begin
changelog_end

* remove space
2020-03-02 11:32:36 +00:00
Moritz Kiefer
d36bb65df2
Bump zip library (#4768)
This should hopefully fix the failure to delete the temporary zip file
on Windows. See https://github.com/mrkkrp/zip/pull/61

changelog_begin
changelog_end
2020-03-02 12:26:28 +01:00
Moritz Kiefer
1b5140ed50
Add a first version of new upgrade docs (#4750)
This PR adds a first version of update documentation and removes the
existing docs which were talking about `damlc migrate`.
So far the docs focus on the high-level approach to upgrades taken in
DAML and give an example of how to structure upgrade contracts.

What is not covered so far (and I’d like to leave that for a separate
PR) is:

1. Technical details: How are things split up into packages, which
restrictions apply to data-dependencies, …
2. Deployment and Running the upgrade via triggers/daml script/…
3. Common patterns for handling this in UIs (e.g. “locking” old contracts)

changelog_begin
changelog_end
2020-03-02 09:54:39 +01:00
Moritz Kiefer
7a9b9a3ace
Fix data-dependencies for impredicative types (#4744)
I’m not really happy with this “fix” but after having spend way too
much time on this, this was the best I came up with. (The details are
in an inline comment). If anyone has better ideas, I’m all ears.

changelog_begin
changelog_end
2020-03-02 09:37:46 +01:00
nickchapman-da
8af3857c09
Use damlc validate-dar in packaging tests. (#4760)
Replace `daml-lf-repl validate` in packaging tests with `damlc validate-dar`.
Simplify test setup a little by passing tools (damlc,validate, etc) in a record.

changelog_begin
changelog_end
2020-02-28 16:28:04 +00:00
Shayne Fletcher
08fea79833
Fix uninitiated string literal (#4759)
changelog_begin
changelog_end
2020-02-28 09:48:38 -05:00
Rohan Jacob-Rao
a788822f0e
GSG: address some feedback from the workshop (#4757)
* Use yarn installation link instead of homepage

* Indentation of Messages segment

* Update git link to downloads page

* Explain why you see friends of friends in the network

* Tweak wording

* Descibe how to run new app more explicitly

* Make change to ui folder more obvious

* Add next steps

changelog_begin
changelog_end

* Fix title levels
2020-02-28 14:35:25 +00:00
Tim McGilchrist
761efbe085
Add missing dependencies to haskell daml bindings. (#4739)
Fixes #4706

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-28 05:39:10 +00:00
Andreas Herrmann
18c64e7724
Update rules_nixpkgs (#4752)
Includes a change that should reduce the size of runfiles manifest files
and runfiles trees for targets with runtime dependencies on the Python
toolchain.

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-02-27 17:07:49 +00:00
Gary Verhaegen
e91d6a1c2a
first snapshot release, attempt 6 (#4749)
Let's see how far we get with #4745.

It's a bit of a shame I can't retry the same commit multiple times.
Maybe I should have accounted for that in the version format...

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-27 16:58:20 +01:00
nickchapman-da
9b8ad2648d
damlc validate-dar (#4654)
changelog_begin
changelog_end
2020-02-27 14:27:23 +00:00
nickchapman-da
b8124a993f
damlc validate-dar (#4654)
changelog_begin
changelog_end
2020-02-27 14:26:14 +00:00
Gary Verhaegen
3a7dca3286
remove exponential backoff for getting sha (#4748)
This has been running for a few days now and while I have seen a bunch
of these cases, I have not once received a message with a BACKOFF value
different from 512. This means that, likely due to some sort of internal
caching in Azure, retrying in this case is useless and just makes the
build failure take more time, i.e. more time before we can rerun.

Rerunning does usually solve it, though.

I have also noticed that we still get these notifications when the job
has been canceled, which usually means the user has force-pushed (in
which case it makes sense that the commit is no longer available). I'm
not sure we can detect this, but I take this opportunity to print the
JobStatus just in case.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-27 15:14:21 +01:00
Rohan Jacob-Rao
6f578d9f26
GSG: update code and make minor wording tweaks (#4746)
* Update create-daml-app code

* Remove reference to infix elem

* Remove the licenses from the code we tell users to copy

* Tweak conclusion

changelog_begin
changelog_end
2020-02-27 13:48:35 +00:00
Gary Verhaegen
86bce50b9a
fix passing is_release through (#4745)
Somehow, in the current setup, the publish steps do not get executed on
master. This is what Azure reports:

```
Evaluating: and(succeeded(), eq('$(is_release)', 'true'),
eq(variables['Build.SourceBranchName'], 'master'), eq('linux', 'linux'))
Expanded: and(True, eq('$(is_release)', 'true'),
eq(variables['Build.SourceBranchName'], 'master'), eq('linux', 'linux'))
Result: False
```

So it looks like, in the condition, `${{parameters.is_release}}`
evaluates to the literal string `$(is_release)`. If we look at the point
of invocation of the ~function~ template, we can see:

```
      - template: ci/build-unix.yml
        parameters:
          release_tag: $(release_tag)
          name: 'linux'
          is_release: $(is_release)
```

so it does not seem completely crazy. However, according to the
documentation, we should expect that to be replaced by the value of the
corresponding variable, as per:

```
    variables:
      release_sha: $[ dependencies.check_for_release.outputs['out.release_sha'] ]
      release_tag: $[ coalesce(dependencies.check_for_release.outputs['out.release_tag'], '0.0.0') ]
      trigger_sha: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ]
      is_release: $[ dependencies.check_for_release.outputs['out.is_release'] ]
```

What's interesting here is that, within `build-unix.yml`, we are also
using `release_tag` in the exact same way:

```
  - bash: ./build.sh "_$(uname)"
    displayName: 'Build'
    env:
      DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}}
```

and this time output from the build seems to show the value being
correctly substituted:

```
damlc - Compiler and IDE backend for the Digital Asset Modelling
Language
SDK Version: 0.13.55-snapshot.20200226.3266.d58bb459

Usage: <interactive> COMMAND
  Invoke the DAML compiler. Use -h for help.
```

My current guess is that the (undocumented, as far as I can tell)
evaluation order is as follows:

1. In the template, syntactically replace all the parameters.
2. In the job definition, replace the call to the template with the code
of the template. So it is as if we had written the template directly in
the `azure-pipelines.yml` file, with `$(release_tag)` and
`$(is_release)`.
3. Run the build. When we reach the time to run this specific job,
we can evaluate the expressions for the variables and replace them in
the rest of the job.

So what is going wrong? I believe the issue is with the quotes,
preventing the substitution of `is_release`. They came directly from the
[documented
syntax](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml#use-a-template-parameter-as-part-of-a-condition),
but if the above evaluation order is correct, they should not be there.

There are actually two things going wrong here. The first one is that
the syntax `$()` is used to substitute a value in what Azure considers a
string. This is the case for `env` keys. However, the `condition` key
is not a string, it is an Azure "expression". Expressions have their own
evaluation rules and syntax, and in particular, `$()` is not a
substitution rule there, so when it sees `$()` in a string in an
expression (due to the quoptes), it leaves it alone.

Removing the quotes does not directly help, though, as we then end with

```
condition: eq($(is_release), 'true')
```

and `$()` is not valid syntax in an expression. The way to use variables
in an expression is `variables.name` (or `variables["name"]`, because
why have only one?).

So that means we have to pass variables to the template in different
ways depending on how they will be used. So much fun.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-27 14:33:20 +01:00
Rohan Jacob-Rao
520643d1d2
Address some feedback on feature section and a little on the arch (#4743)
changelog_begin
changelog_end
2020-02-27 13:18:57 +01:00
Gary Verhaegen
4062107bfc
try release _again_ (#4742)
Trying out #4738...

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-27 12:31:13 +01:00
Moritz Kiefer
597c3a30f6
Fix unstableDrop (#4740)
We want to start at n not at length - n

changelog_begin
changelog_end
2020-02-27 11:11:57 +01:00
Samir Talwar
cf8cb61327
Sandbox-Next: Wire up missing configuration. (#4728)
* sandbox: Name the arguments to `ApiServices.create` for clarity.

* sandbox: Clarify numbers and types in configuration classes.

* sandbox-next: Log the correct port on startup.

* sandbox-next: Connect up the command configuration.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox-next: Wire up TLS configuration.

* sandbox-next: Wire up the maximum inbound message size.

* sandbox-next: Set the global log level if specified.

And if it's not specified, default to the level in logback.xml, INFO.

* sandbox-next: Connect up the submission configuration.

* sandbox-next: Log the correct ledger ID.

* sandbox-next: Use `TimeProvider.UTC`.
2020-02-27 09:49:26 +00:00
Gary Verhaegen
1c2b921c14
fix tarball generation (#4738)
The existing approach is a historical accident. The reason for the
additional tarball/install jobs was that, in my original attempt, the
build steps would still build the current commit, as opposed to the
target commit.

This is not such an issue on Linux, but setting up the build environment
on Windows and macOS _again_ for no good reason is a pure waste of time
(and effort in getting it right). Now that the build steps build the
target commit (with the env var set), we can go back to the way things
were previously: just take the build products directly from the build
step.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-27 10:48:38 +01:00
Stefano Baghino
c53ba475ef
Make completion service return checkpoints (#4735)
* Make completion service return checkpoints

The new table for #4681 and the query used to retrieve completions
currently does not return checkpoints. These do not have to match
the application_id and submitting_party query since those fields
are not populated.

CHANGELOG_BEGIN
CHANGELOG_END

* Address https://github.com/digital-asset/daml/pull/4735#discussion_r384713277
2020-02-27 09:45:45 +00:00
Stefano Baghino
48241f5753
Backfill completions (#4733)
* Backfill completions

Follow up to #4681

CHANGELOG_BEGIN
CHANGELOG_END

* Add needed newline for migration's sha256
2020-02-27 09:21:39 +00:00
Rohan Jacob-Rao
59b6afaefb
GSG: expand explanation in First Feature section (#4736)
* Tweak feature intro

* Further explain DAML workflow of messaging

* Elaborate on new DAML code and UI components

changelog_begin
changelog_end

* Explain MainView changes and conclude

* Fix indentation warning
2020-02-27 09:53:03 +01:00
Moritz Kiefer
1bab818dea
Prefix release jobs with 'release_' (#4737)
changelog_begin
changelog_end
2020-02-26 20:46:45 +00:00
Leonid Shlyapnikov
d93e4382f6
Extract ErrorOps, use liftErr instead of leftMap (#4730)
* Extract ErrorOps, use liftErr instead of leftMap
JSON error formatting cleanup

CHANGELOG_BEGIN
CHANGELOG_END

* Good we have tests for this stuff

* Apply https://github.com/scala/bug/issues/3664 work-around,

so JsonError can be used instead of JsonError.apply

* error formatting
2020-02-26 20:06:26 +00:00
Gary Verhaegen
9c414f3fed
snapshot release, attempt 4 (#4732)
CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 20:59:14 +01:00
Moritz Kiefer
e3a1f684ca
Remove Azure nix cache (#4734)
This doesn’t seem to bring any benefit anymore on cache hits with the
reduced closure size and on cache misses it’s significantly slower.

changelog_begin
changelog_end
2020-02-26 19:43:50 +00:00
Moritz Kiefer
d455267e58
Reduce the number of GHCs in our nix closure (#4729)
This reduces the number of GHCs to 2 on Linux (regular and DWARF) and
1 on macOS. Given that each derivation is > 1 GB this should hopefully
help a bit.

changelog_begin
changelog_end
2020-02-26 20:00:07 +01:00
Gary Verhaegen
1a1ad793ff
fix tarball steps (#4731)
Turns out there were two required environment variables here.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 19:34:27 +01:00
Shayne Fletcher
66dd112960
Remove pragma 'daml 1.2' (#4702)
changelog_begin
- The pragma 'daml 1.2' is now optional.
changelog_end
2020-02-26 13:17:45 -05:00
Stephen Compall
79c6ee7339
add offset to live events; remove liveness marker (#4593)
* move BeginBookmark to util

* adding offsets to steps

* offsetAfter belongs in Txn, not InsertDeleteStep

* make transaction stream a ContractStreamStep.Txn stream

* add several ContractStreamStep append cases

* rewrite 'render' to emit offset in the right places

* make ContractStreamStep#append total again

* check for offset in a few tests

* revert useless whitespace changes

* missed argument

* simpler mapPreservingIds

* rewrite states for new "live" format

* remove invalidated "events" block structure assertions

* make shutdown in withHttpService deterministic, to try to catch race condition

* exhaustiveness checking somehow disabled; fixed fetch flow and all is well

* documentation and changelog

CHANGELOG_BEGIN
- [JSON API - Experimental] Remove ``{"live": true}`` marker from websocket streams;
  instead, live data is indicated by the presence of an "offset".
  See `issue #4593 <https://github.com/digital-asset/daml/pull/4593>`_.
CHANGELOG_END

* be more specific about what liveness marker may be in docs

* fix daml2ts websocket tests

* mention type rules for all cases in offset documentation
2020-02-26 10:17:21 -08:00
Gary Verhaegen
6685becccc
first snapshot release, attempt 3 (#4727)
Hopefully #4721 and #4723 will let us fail a bit further in the process
this time.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 18:32:57 +01:00
Stephen Compall
37d36e1592
narrow LF codeowners; add ledger-service codeowners (#4704)
* codeown ledger-service

* daml-lf is too broad to be codeowned, narrow to something more sensible

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 09:13:32 -08:00