Commit Graph

3678 Commits

Author SHA1 Message Date
nickchapman-da
aa53c30de1
New command: daml ledger fetch-dar (#5225)
* New comamnd: daml ledger fetch-dar

`daml ledger fetch-dar [PID] [PATH]`

Download a `Package` and it's dependencies from a ledger, given a root `packageId`, and re-construct a valid `.dar` file. Addresses issue #5037.

The original package names are not reconstructed.

CHANGELOG_BEGIN
CHANGELOG_END

* address some comments

* fix spello

* attempt: recoverPackageName

* recover main package name & version

* Try to fix integration tests on Windows

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-03-27 18:04:14 +00:00
Moritz Kiefer
e42111b31f
Fix template name in multiparty agreement docs (#5255)
fixes #5239

changelog_begin
changelog_end
2020-03-27 16:34:57 +00:00
Samir Talwar
7ef0972856
sandbox: On reset, wait for the API server to start before replacing it. (#5251)
* sandbox: On reset, wait for the API server to start before replacing it.

Hopefully this addresses the flickering behavior we're seeing in CI.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox: Scale the retries in ResetServiceIT along with everything else.
2020-03-27 16:29:56 +00:00
Moritz Kiefer
53994c807a
Disable tuple-section and lambda-case hints (#5229)
Adding more syntax is just confusing for beginners so these are not
particularly helpful and I would argue that they aren’t that useful in
general even once you move past the beginner stage.

changelog_begin
changelog_end
2020-03-27 17:16:25 +01:00
Stefano Baghino
9522c6e4b2
Allow to have both verbose and succinct row parsers (#5248)
* Allow to have both verbose and succinct row parsers

This will be used when we need to stream transactions and not individual
events.

changelog_begin
changelog_end

* Succinct parser should have verbose = false
2020-03-27 17:00:36 +01:00
Martin Huschenbett
454bd127a0
daml2ts: Don't use HashMap Text Text anywhere (#5252)
As I said previously, all instances of the dreaded `HashMap Text Text`
can go away if write our code more direct. Here we go.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 15:51:42 +00:00
Martin Huschenbett
b1e6298ec6
JSON API: Slightly improve the docs for the streaming endpoints (#5234)
Semicolons at the end of every line seem to be good style. Logging to
the console does not help with the example. The `WebSocket` class is
built-in in the browser and you only need a package like `ws` on
Node.js.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 15:17:55 +00:00
Remy
20218e4175
DAML-LF: restrict length of parties (#5237)
CHANGELOG_BEGIN
* [DAML-LF]. *Breaking* Restrict length of parties
CHANGELOG_END
2020-03-27 14:52:43 +01:00
mziolekda
ce62bfb596
Support for large grpc messages in ledger-on-memory (#5230)
* Support for large grpc messages in ledger-on-memory

* adress review comments

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 14:00:24 +01:00
Stefano Baghino
4543917f8b
Refactor query preparation for flat events (#5241)
* Refactor query preparation for flat events

This will allow to share code with the stream endpoints.

changelog_begin
changelog_end

* Allow for multiple requesting parties

* Safer approach to build queries

Thanks @SamirTalwar-DA

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

* Fix compilation errors

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-03-27 12:41:08 +00:00
Moritz Kiefer
9a1ddc8fa4
Remove no assistant tests from integration tests (#5240)
There was a brief period of time where `daml build` did not work
outside of the assistant. When we fixed that we added it to the
integration tests since there was no other test suite that used damlc
as a binary (as opposed to using it as a library which runs through
different codepaths). However, in the meantime we have tons of tests
all over the place (e.g. the packaging tests) that call `damlc build`
outside of the assistant so these tests serve no purpose.
Also they are somewhat confusing since the point of the integration
tests is to test an installed SDK whereas these tests do not need an
installed SDK (that’s the whole point of those tests).

changelog_begin
changelog_end
2020-03-27 13:11:10 +01:00
Martin Huschenbett
b398272fee
daml2ts: Don't reinvent assertInfixOf in tests (#5245)
Instead use the version from `DA.Test.Util`.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 11:58:53 +00:00
Martin Huschenbett
98f37dbe48
daml2ts: Make tests more concise (#5243)
We do not need to have templates in the `.daml` files we generate
during these templates, any serializable type is good enough. Thus,
let's make the tests shorter by using a simple serializable type
instead of templates.

Also make the tests easier to debug when expected failures of `daml2ts`
do not happen in the anticipated way.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 11:06:41 +00:00
Moritz Kiefer
0c5166dd8c
Support running DAML script over the JSON API (#5211)
* Support running DAML script over the JSON API

This is still in a somewhat messy state and some things don’t
work (documented in a comment) so I deliberately didn’t add this to
the documentation. However, there are tests and the PR is already
pretty large so I’d like to move the rest to separate PRs to not turn
this into more of a review nightmare than it already is.

changelog_begin
changelog_end

* Address review comments
2020-03-27 11:04:40 +00:00
Moritz Kiefer
3a7da97825
Move SDK installation to a tasty resource (#5238)
This ensures that -l and -p work properly in the integration tests
since they no longer depend on the order.

There is lots of other crap to cleanup in those tests but I’m trying
to keep it to small steps.

changelog_begin
changelog_end
2020-03-27 11:59:41 +01:00
Martin Huschenbett
d48698e43b
daml2ts: Fix the A:X vs A.B bug (#5226)
* daml2ts: Fix the A:X vs A.B bug

Currently, the TypeScript generated by `daml2ts` does not compile when
there are a modules `A` and `A.B` which both contain serializable types.
(Note: there can't be a type called `B` in `A` due to the name collision
check.)

Since fixing this within the current layout using TypeScript
namespaces would be very challenging since we would need to inject
subnamespaces into existing namespaces. Thus, we switch the code
generation to use ES2015 modules. Since TypeScript namespaces are
considered (somewhat) deprecated, this is a good move anyway.

As a result of this change to ES2015 we need to write `index.ts` files
at each node of the module hierarchy. These `index.ts` files reexport
the module at the current node (if present) and all child modules.

At the same time we also remove the default export of the top-level
`index.ts` file. It is not clear if they are actually useful and to
add them to the new scheme requires a technique that feels like a hack.

To give an example, assume we have modules `A` and `A.B.C`. We now write
the following directory structure:
```
src/
+- index.ts             <- reexports A
+- A/
   +- index.ts          <- reexports module.ts and B
   +- module.ts
   +- B/
      +- index.ts       <- reexport C
      +- C/
         +- index.ts    <- reexports module.ts
         +- module.ts
```
If you import the package like
```typescript
import * as foo from '@daml.js/foo-1.0.0';
```
you can acces the `A` and `A.B.C` modules as `foo.A` and `foo.A.B.C`.

CHANGELOG_BEGIN
CHANGELOG_END

* Adapt build-and-lint-test

CHANGELOG_BEGIN
CHANGELOG_END

* Add new test

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 10:27:18 +01:00
Gerolf Seitz
050f049e16
Add docs for the ledger time model to the app arch guide. (#5118)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 09:46:28 +01:00
Rohan Jacob-Rao
9d73aec229
GSG: update code samples (#5224)
* Update code in before section

* Update code in 'after' section, i.e. for messaging

changelog_begin
changelog_end

* Typo with END taggit st
2020-03-27 09:16:15 +01:00
Gary Verhaegen
1872c668a5
replace DAML Authors with DA in copyright headers (#5228)
Change requested by Manoj.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 01:26:10 +01:00
Gary Verhaegen
9f3900d870
pin copyright headers (#5227)
When files should be immutable, they should also be protected from the
copyright headers script.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 23:30:23 +01:00
Stephen Compall
332d35a347
stop filtering "phantom archives" when it won't work; reenable it on request (#5003)
* ContractKeyStreamRequest with different types for whether offset-preceded or not

- should replace EnrichedContractKey as the WS StreamQuery type

* add the ContractKeyStreamRequest layer everywhere

* split StreamQuery parse from the other steps

* make StreamQuery type depend on the input JsValue

* only StreamQueryReader is a typeclass now

* scalafmt

* wrong type arg

* letting the request data and phantom archive removal choice flow

- from work with @leo-da

* finish threading request-derived phantom state to removal flow

- from work with @leo-da

* make it clear that hints are contract IDs in StreamQuery

- from work with @leo-da

* treat StreamQueryReader's type parameter fully as a phantom

- from work with @leo-da

* remove unused type alias

- from work with @leo-da

* test fetch resume, with and without various offsetHints

* document offsetHints

* missing ` in rst

- thanks @hurryabit

* rename offsetHint to contractIdAtOffset

CHANGELOG_BEGIN
- [JSON API - Experimental] New field ``contractIdAtOffset`` for fetch-by-key streams
  to restore proper archive filtering.
  See `issue #4511 <https://github.com/digital-asset/daml/issues/4511>`_.
CHANGELOG_END

* we never unify the two ContractKeyStreamRequest types

* doc update for contractIdAtOffset
2020-03-26 15:31:27 -04:00
Moritz Kiefer
b950692db1
Attempt to fix packaging tests on Windows (#5222)
I don’t really understand why they might fail but exceptions are weird
so maybe printing to stderr explicitly helps.

changelog_begin
changelog_end
2020-03-26 19:47:36 +01:00
Shayne Fletcher
8bb9f4b5c7
Don't write .eslintrc.json files (#5218)
* Factor out daml2ts utilities

changelog_begin
changelog_end

* Stop writing .eslintrc.json files into daml2ts packages

changelog_begin
changelog_end
2020-03-26 14:42:59 -04:00
Samir Talwar
5c913106fc
sandbox: Report JVM metrics. (#5217)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 18:31:59 +00:00
Moritz Kiefer
17d82bf076
Make name collision check more strict (#5219)
* Make name collision check more strict

This PR extends the name collision check to catch collisions between
A:B (type B in module A) and module A.B.C. For now this is just a
warning and not an error. Once we turn it into an error, we also need
to add this to the Scala collision checker.

There is a fair bit of plumbing required to make warnings work but on
the plus side we get multiple errors at once now instead of erroring
out on the first one.

changelog_begin

- [DAML Compiler] The name collision check has been extended to also
  count the case as a collision where you have a type B in module A and a module
  A.B.C (but no module A.B). This is a warning in this SDK release but
  will become an error in a future release. The typescript codegen is
  not usable on packages that don’t uphold this restriction.

changelog_end

* Address review comments
2020-03-26 19:24:34 +01:00
Andreas Herrmann
40e439ad15
Remove unused //compiler/daml-licenses and //:notices-gen (#5221)
* Remove unused da_doc_package

The only use-site was `//compiler/daml-licenses:daml-licenses`, which
itself was unused.

* Remove unused notices-gen

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-26 17:33:11 +00:00
Andreas Herrmann
f0929f2d04
Consistently replace zip by bazel_tools zipper (#5215)
* sdk-release-tarball: zip is unused

* daml-lf/archive: Use bazel_tools zipper

@bazel_tools//tools/zip:zipper avoids timestamps and sources of
indeterminism when creating an archive, so that the result is
reproducible.

CHANGELOG_BEGIN
CHANGELOG_END

* Remove unused @zip_dev_env

zip is fully replaced by @bazel_tools//tools/zip:zipper.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-26 17:38:03 +01:00
Jussi Mäki
e64777c1a6
Introduce DamlSubmissionBatch and the BatchingLedgerWriter (#4964)
* Introduce DamlSubmissionBatch and the BatchingLedgerWriter

This introduces the DamlSubmissionBatch message to group
submissions into a single message and extends Envelope to
carry the batch. We're using the envelope wrapping for consistency
and compatibility.

We're adding this to kvutils version 3 as it has not yet been released
into the wild and as this is not backwards incompatible change.

Support for batching is implemented with the BatchingLedgerWriter
that wraps a LedgerWriter and groups submissions into a batch based
on size and time duration.

For implementing the validation of a batch we will require some rework
in the SubmissionValidator to be able to produce multiple "LogResult"s,
e.g. commit on the in-memory ledger results in an "Index" which is used
to signal new head to dispatcher. With a batch we'd need to pick max index.

CHANGELOG_BEGIN
CHANGELOG_END

* Add missing copyright header

* Address code reviews

* Post rebase fixes

* Rename BATCH -> SUBMISSION_BATCH

* Address code reviews, add further tests and cleanup.

* Add test for DefaultBatchingQueue.close

* Use generous timeouts

* Renamed BatchMessage => SubmissionBatchMessage. Added default boolean parameter value. Added simple test case.

* Removed unused include.

* Address final code review

Co-authored-by: Miklos Erdelyi <miklos.erdelyi@digitalasset.com>
2020-03-26 16:37:52 +00:00
Andreas Herrmann
5d7981f84d
Reproducible SDK release tarball (#5213)
* Make SDK release tarball reproducible

Without these changes multiple factors contribute to a different SDK
release tarball on each rebuild:
* Without `--sort=name` the order of files in the archive is determined
  by the OS and essentially random.
* Without the `--owner/group/mtime` flags the archive contains metadata
  that depends on the environment.
* Without `-n` `gzip` would write a timestamp into the produced
  artifact.

CHANGELOG_BEGIN
CHANGELOG_END

* sdk-release-tarball: zip is unused

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-26 17:37:36 +01:00
Shayne Fletcher
180838eb12
Follow up on earlier PR (#5206)
changelog_begin
changelog_end
2020-03-26 16:57:01 +01:00
Martin Huschenbett
d82d47a275
daml2ts: Write module A.B.C into file src/A/B/C/module.ts (#5209)
Instead of writing the TypeScript for DAML module `A.B.C` into the file
`src/A/B/C.ts` we now write it into `src/A/B/C/module.ts`. This is in
preparation for also writing a file `src/A/B/C/index.ts`, which
re-exports `src/A/B/C/module` but also `src/A/B/C/D` for each `D`.

We also make sure to use the correct path separator on Windows.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 16:38:12 +01:00
Samir Talwar
1ce67fbd2f
kvutils: Metrics on the write path. (#5212)
* kvutils: Add metrics to SubmissionValidator.

* kvutils: Add metrics to KeyValueSubmission.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 15:17:42 +00:00
Samir Talwar
b4e2f2d4a2
release: Clarifications to the release process. (#5189)
* release: Reformat Markdown to fit 80 characters, and adding punctuation.

CHANGELOG_BEGIN
CHANGELOG_END

* release: Formatting, an extra test step, and a bit of clarification.
2020-03-26 13:30:55 +00:00
Ognjen Maric
f7aa2a3db0
Add keys with maintainers to Fetch nodes (#5186)
Add keys with maintainers to Fetch nodes

The new field is populated by the interpreter whenever the fetched
contract has a key. Used for contract key reinterpretation in Canton.

CHANGELOG_BEGIN

- [DAML-LF] Add keys with maintainers to Fetch nodes in transactions.

CHANGELOG_END
2020-03-26 14:07:17 +01:00
Moritz Kiefer
c004c90fcb
Remove skydoc (#5208)
Nobody uses it, it’s deprecated anyway.

changelog_begin
changelog_end
2020-03-26 11:14:34 +00:00
Moritz Kiefer
cacbb3a269
Publish docker images for snapshot releases as well (#5205)
* Publish docker images for snapshot releases as well

We got a couple of requests for this and given the current release
process this seems very reasonable. Snapshot releases are clearly
marked as such so I think there this is fine.

We could think about differentiating between a stable release version
marked as a prerelease and not publish the docker image for that but
given our current release process where the stable version is based on
an already existing snapshot and therefore testing is very unlikely to
fail when we mark it as stable, that doesn’t seem worth the complexity
here.

changelog_begin
changelog_end

* Update azure-cron.yml

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

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-03-26 10:51:15 +01:00
Remy
9880f3d7c2
Engine: Change type of ExerciseCommand contractId (#5182)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 10:44:24 +01:00
Andreas Herrmann
9e5dff4109
Ship daml-script and daml-trigger libraries in multiple LF versions (#5192)
* Depend on LF version specific daml-libs

* daml-script.dar build multiple LF versions

CHANGELOG_BEGIN
[DAML Script] The `daml-script` library is now available in multiple LF
  versions, namely 1.7, 1.8, and 1.dev.
CHANGELOG_END

* daml-trigger.dar build multiple LF versions

[DAML Triggers] The `daml-trigger` library is now available in multiple
  LF versions, namely 1.7, 1.8, and 1.dev.

* Keep daml-script.dar available for tests

* Keep daml-trigger.dar available for tests

* daml-libs LF versions integration test

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-26 10:17:19 +01:00
Shayne Fletcher
24cbeddd35
Follow up to earlier PR (#5201)
changelog_begin
changelog_end
2020-03-26 05:16:16 -04:00
Stefano Baghino
c19a20669f
Add CODEOWNERS for libs-scala (#5204)
changelog_begin
changelog_end
2020-03-26 08:56:40 +00:00
Samir Talwar
1e13b8679e
postgresql-testing: On failure, logs are no longer an Option. (#5190)
`logs` used to be an `Option[Seq[String]]`. They were changed to
`Seq[String]` with a default of `Seq.empty`, but the code to print them
still assumed an `Option`, which means they were printing as
"ArrayBuffer(line 1, line 2, line 3)" instead of, well, nicely.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 08:09:24 +00:00
Martin Huschenbett
c9e2f7929b
daml2ts: Import external dependencies via their index module (#5203)
Instead of reaching into to the internals of external dependencies,
we no import these package via their root `index.ts` file. This gives
us the possibility of the changing the internal structure without
having to think about this kind of import as long as we keep the
interface the same. This is exactly what I plan to do in the next PR
which will fix the `A` vs `A.B` bug.

More precisely, instead of writing two imports like
```typescript
import * as pkgXYZ_A_B from '@daml.js/foo-0.0.1/lib/A/B';
import * as pkgXYZ_C from '@daml.js/foo-0.0.1/lib/C';
```
we only write one import
```typescript
import pkgXYZ from '@daml.js/foo-0.0.1';
```
and replace use sites of `pkgXYZ_A_B` and `pkgXYZ_C` with `pkgXYZ.A.B`
and `pkgXYZ.C`, resp.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-25 22:52:43 +00:00
Martin Huschenbett
95f5d6822b
daml2ts: Emphasize differences between internal and external imports (#5197)
This prepares a followup change in which I want to import external
dependecies entirely through their `index.ts` file. This will become easier
once the differences between internal and external imports are more
apparent.

Importing external dependencies through their `index.ts` files is part
of a restructuring the file layout in order to solve the bug where we
cannot have modules `A` and `A.B` at the same time.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-25 21:11:15 +00:00
Leonid Shlyapnikov
24e414cba0
Remove ledgerEffectiveTime, maximumRecordTime and default TTL config. (#5200)
changelog_begin

[JSON API - Experimental]
Remove ``ledgerEffectiveTime`` and ``maximumRecordTime`` fields from command ``meta``. Remove ``--default-ttl`` command line argument. The ledger time and TTL are automatically computed by the submission service now. See #5090.

changelog_end
2020-03-25 17:06:12 -04:00
Stefano Baghino
e2bcd23b15
Add groupContiguous method (#5193)
This will later be used to group together events from the database, sorted by transaction identifier, into transactions.

changelog_begin
changelog_end
2020-03-25 19:41:17 +00:00
Martin Huschenbett
5460379d37
daml2ts: Write package id directly into index.ts (#5195)
There's no more reason to have the package id in a separate file
`packageId.ts`. This was different before we had an `index.ts`.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-25 19:24:43 +00:00
Martin Huschenbett
b1913e6d38
TS libs: Remove deprecated methods/hooks (#5168)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-25 20:05:27 +01:00
Samir Talwar
93e9dd9663
CODEOWNERS: Add owners for the LATEST file, used to manage releases. (#5191)
Namely @bame-da, @gerolf-da, and @hurryabit.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-25 20:05:11 +01:00
Shayne Fletcher
9351b7a7b9
Build js packages at code-generation time (#5171)
changelog_begin
changelog_end
2020-03-25 14:13:37 -04:00
Stefano Baghino
1a229ebb7b
Refactor response preparation for flat transactions (#5187)
* Refactor response preparation for flat transactions

This will allow to share code across endpoints

changelog_begin
changelog_end

* Address https://github.com/digital-asset/daml/pull/5187#discussion_r397996322
2020-03-25 17:53:25 +00:00