Commit Graph

23 Commits

Author SHA1 Message Date
Moritz Kiefer
fbf97d1432
Change Canton synchronization to use the healthcheck endpoint (#13463)
changelog_begin
changelog_end
2022-03-30 16:31:13 +02:00
Sofia Faro
53edac1fd7
Move some daml-script compat tests to sandbox-on-x (#12595)
* Move some daml-script compat tests to sandbox-on-x

The new sandbox doesn't accept LF < 1.14, so move those cases to
sandbox-on-x.

changelog_begin
changelog_end

* add comment

* buildifier
2022-01-26 17:43:34 +00:00
Moritz Kiefer
5bfe4ed589
Wait for server process in client_server_test (#12551)
withCreateProcess kills the server process but it doesn’t wait for it
to finish. The `typed-process` version does things properly here which
is also why we switched to it in other places.

changelog_begin
changelog_end
2022-01-24 20:21:23 +00:00
Sofia Faro
a5f56e0671
Use canton sandbox in script+trigger compat tests (#12514)
Part of #11831. This kills another two uses of sandbox-kv.

Also fixes a daml-helper issue where we weren't passing "localhost" to the
ledger flags, so it was complaining about starting outside of a project.

changelog_begin
changelog_end
2022-01-20 17:10:11 +00:00
Sofia Faro
09013eb501
Add eager timeouts to the polling functions used in daml start and assistant integration tests. (#12361)
* Add timeouts to polling funcs in daml start.

This PR adds timeouts to some polling functions used in daml start and
the assistant integration tests, and also early exits based on a process
exit status. E.g. waitForHttpServer will make sure some process is
still running, instead of waiting to timeout.

The effect of this is that now whenever there is some error in a
subprocess, daml start and the integration tests will finish early
instead of running forever (or timing out in bazel).

changelog_begin
changelog_end

* missing a readPortFile instance
2022-01-12 10:01:56 +00:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
pbatko-da
bd01a211f4
[DPP-418] Protect Participant TLS keys (#10629)
Adding support for accepting server's private key as an encrypted file (since storing unencrypted private key in a file system might be a risk).

Encrypted private key is assumed to be encrypted using AES or similar algorithm. The details necessary to decrypt it are be obtained from a secrets server over HTTP as JSON document. The URL to secret's server is supplied through the new `--secrets-url` CLI parameter.

One can supply private in either plaintext (old behavior) or ciphertext: if a private key's file ends with .enc suffix it is assumed to be ciphertext. Otherwise it is assumed to be plain text.

CHANGELOG_BEGIN
- [DPP-418] [Participant] Add support for supplying server's private key as an encrypted file and then decrypting it with the help of a secrets server.
CHANGELOG_END
2021-08-30 09:24:52 +02:00
Samir Talwar
8dd136fc7d
bazel-tools: Replace runner with either runner_with_port_check or runner_with_port_file. (#10615)
* Use `extra` in the port file runner, rather than `temporary`.

* ledger-api-test-tool-on-canton: Use the port check runner.

Much simpler than the port file runner for our purposes.

* Replace `runner` with `runner_with_port_file`.

Rather than expecting a particular set of command-line-arguments, we use
templating.

CHANGELOG_BEGIN
CHANGELOG_END

* Rename the `runner_with_port_check` target to the default.
2021-08-18 15:23:45 +00:00
Samir Talwar
3227e860e0
Use the port file and dynamic port generation in client/server tests. (#10604)
* Use the port file and dynamic port generation in client/server tests.

This creates a runner named `runner_with_port_file` which knows how to
interpolate two variables, `%PORT_FILE%` and `%PORT%`. This allows us to
use the `port-file` argument to the kvutils runner rather than
hard-coding a port for conformance tests.

For now, we only use this for generating the kvutils reference ledger
export.

CHANGELOG_BEGIN
CHANGELOG_END

* Simplify the runner_with_port_file considerably.

It doesn't need to check if the port is open; we trust that the process
will do it.

This also makes sure the port file will be cleaned up, and reduces the
number of dependencies by making use of more functions in `extra`.

* Simplify port file generation in the new client-server runner.

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

* Simplify the runner_with_port_file further.

This doesn't need to work if the server doesn't take a port file.

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-08-18 13:25:58 +00:00
Andreas Herrmann
10177d239e
Add golden test for example Daml ledger export (#9732)
* client_server_build - user defined outputs

Let the user define a list of output files on client_server_build.

changelog_begin
changelog_end

* daml-script runner expose main(config)

changelog_begin
changelog_end

* Add an example Daml ledger export to the docs

* Build Daml ledger export

changelog_begin
changelog_end

* sh_inline_test

Support toolchain arguments to sh_inline_test. Usefuly for make variable
expansion, e.g. for the POSIX toolchain.

* Add a golden test for Daml ledger export

* Test args files as well

* Use sed from POSIX toolchain

* Add normalization comment to top-level comment

* Ignore trailing CR on Windows

The JSON formatting of the args file uses Windows line endings on
Windows. Therefore, the args.json output technically differs from the
expected output. We're happy to ignore the difference in CRLF here.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-05-19 12:02:14 +00:00
Andreas Herrmann
010e2b1b27
Fix client_server_build/test with port file (#9701)
* client_server runner - use temp dir for port file

The sandbox will not overwrite an already existing port file but instead
fail, or worse, silently ignore the error and leave the port-file empty.

changelog_begin
changelog_end

* sandbox: Fail if writing the port file fails

So far this was being silently ignored, leaving a pre-existing port-file
untouched.

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-05-17 11:36:25 +00:00
Moritz Kiefer
777749539c
Draw the rest of the Scala 2.13 owl (#8852)
* Draw the rest of the Scala 2.13 owl

Not quite but pretty close and this switches us over from inclusions
to exclusions which makes it much easier to track.

Ledger API test tool should be fixed by #8821. Non-repudiation needs a
tiny bit of work since unwrapArray doesn’t work the same on 2.13 but
shouldn’t be hard to fix.

changelog_begin
changelog_end

* Fix ScriptService tests

Those tests were all dumb. They asserted on a fixed order while the
function to sort the things was broken so we ended up with the random
Map order which is unsurprisingly not the same.

This is easily fixed by fixing the sort function.

There is also a second issue with query not sorting.

changelog_begin
changelog_end

* Turns out if you fix one test the next one breaks

And clearly nobody ever tested this or give this a second thought.

changelog_begin
changelog_end
2021-02-15 19:20:24 +00:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Andreas Herrmann
4b1438276c
Update Bazel 2.1.0 --> 3.3.1 (#6761)
* Upgrade nixpkgs revision

* Remove unused minio

It used to be used as a gateway to push the Nix cache to GCS, but has
since been replaced by nix-store-gcs-proxy.

* Update Bazel on Windows

changelog_begin
changelog_end

* Fix hlint warnings

The nixpkgs update implied an hlint update which enabled new warnings.

* Fix "Error applying patch"

Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files
and applying patches has been reversed. The allows users to define
patches to these files that will not be immediately overwritten.
However, it also means that patches on another repository's original
`WORKSPACE` file will likely become invalid.

* a948eb7255
* https://github.com/bazelbuild/bazel/issues/10681

Hint: If you're generating a patch with `git` then you can use the
following command to exclude the `WORKSPACE` file.

```
git diff ':(exclude)WORKSPACE'
```

* Update rules_nixpkgs

* nixpkgs location expansion escaping

* Drop --noincompatible_windows_native_test_wrapper

* client_server_test using sh_inline_test

client_server_test used to produce an executable shell script in form of
a text file output. However, since the removal of
`--noincompatible_windows_native_test_wrapper` this no longer works on
Windows since `.sh` files are not directly executable on Windows.

This change fixes the issue by producing the script file in a dedicated
rule and then wrapping it in a `sh_test` rule which also works on
Windows.

* daml_test using sh_inline_test

* daml_doc_test using sh_inline_test

* _daml_validate_test using sh_inline_test

* damlc_compile_test using sh_inline_test

* client_server_test find .exe on Windows

* Bump Windows cache for Bazel update

Remove `clean --expunge` after merge.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 09:46:04 +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
Gerolf Seitz
a2d785e3ee
Use com.daml as root package (#5343)
Packages com.digitalasset.daml and com.daml have been unified under com.daml

Ledger API and DAML-LF DEV protos have also been moved from `com/digitalasset`
to `com/daml` on the file system.
Protos for already released DAML LF versions (1.6, 1.7, 1.8) stay in the
package `com.digitalasset`.

CHANGELOG_BEGIN
[SDK] All Java and Scala packages starting with
``com.digitalasset.daml`` and ``com.digitalasset`` are now consolidated
under ``com.daml``. Simply changing imports should be enough to
migrate your code.
CHANGELOG_END
2020-04-05 19:49:57 +02: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
Gerolf Seitz
d617922618
Remove InMemoryKVParticipantState (#4674)
This removes the sample/reference implementation of kvutils
InMemoryKVParticipantState.
This used to be the only implementation of kvutils, but now with the
simplified kvutils api we have ledger-on-memory and ledger-on-sql.

InMemoryKVParticipantState was also used for the ledger dump utility,
which now uses ledger-on-memory.

* Runner now supports a multi participant configuration
This change removes the "extra participants" config and goes for consistent
participant setup with --participant.

* Run all conformance tests in the repository in verbose mode.

This means we'll print stack traces on error, which should make it
easier to figure out what's going on with flaky tests on CI.

This doesn't change the default for other users of the
ledger-api-test-tool; we just add the flag for:

  - ledger-api-test-tool-on-canton
  - ledger-on-memory
  - ledger-on-sql
  - sandbox




Fixes #4225.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-26 15:45:35 +01: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
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
Gary Verhaegen
878429e3bf
update copyright notices to 2020 (#3939)
copyright update 2020

* update template
* run script: `dade-copyright-headers update .`
* update script
* manual adjustments
* exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files)
2020-01-02 21:21:13 +01:00
Andreas Herrmann
10031a614c Remove all instances of use_default_shell_env = True (#3597)
* use_default_shell_env = False in proto_gen

* use_default_shell_env = False in scala_source_jar

* use_default_shell_env = False in scaladoc_jar

* use_default_shell_env = False in dar_to_scala

* use_default_shell_env = False in _real_pkg_tar

* use_default_shell_env = False in client_server_build

* use_default_shell_env = False in npm_package
2019-11-25 09:15:00 +00:00
Jussi Mäki
ca7bbacd6c Build rules for producing and verifying ledger dumps (#3290)
* Add client_server_build and integrity_test rules

And use them to implement ledger dump of the reference
server and to check it.

* Only build and test ledger dump on Linux. Only run tests relevant to dump.

* Make client_server_build quiet in happy path

* Reformat

* Remove unnecessary runfiles for client_server_build
2019-11-07 09:41:54 +00:00