Commit Graph

181 Commits

Author SHA1 Message Date
Stefano Baghino
8965c1bf3b
Move TimeServiceDisabledIT to the sandbox integration tests (#3840)
Closes #2859
2019-12-13 11:53:27 +01:00
Samir Talwar
639eba2c17 ledger-api-scala-logging: Fix errors in IntelliJ IDEA. (#3785)
* ledger-api-scala-logging: Fix errors in IntelliJ IDEA.

The Bazel plugin for IntelliJ doesn't seem to be smart enough to be able
to handle a Scala library that is part `src` directory and part
generated code from another Bazel rule. It just ignores the second part.
This means that IntelliJ cannot find the *ServiceLogging classes, as
they're not represented on the Bazel-generated classpath, and so
complains with lots of errors when working on the equivalent Api*Service
files.

To fix this, we can split these in two, compiling the base traits to
`ledger-api-scala-logging-base` and then the generated code separately.

It does result in an extra Bazel dependency for the users of
ledger-api-scala-logging, as Bazel doesn't realise transitive
dependencies for us.

* Release: Add `ledger-api-scala-logging-base` to the Maven list.
2019-12-09 16:02:59 +00:00
Brian Healey
02186ef068 Ledger configuration indexing changes (rebased to master) (#3553)
* Add participant-state configuration protobuf

- Move the "DamlConfiguration" from kvutils into participant-state/protobuf/ledger_configuration.proto.
- Add version number and spec (ala transaction.proto)

This is a preparation for indexing the configuration and having one canonical serialization for it.

* Initial thoughts on indexing the configuration

* Implement indexing of ledger configuration changes

* Add record time to all Updates. Wire through participant id.

and rename V7__Add_configuration to V8.

* Add ledger_configuration_java_proto to release artifacts

* Fix up release of ledger_configuration_java_proto

* Suggestions from review

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

* Apply suggestions from code review

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

* address rebase issues

* Resolve compilation errors after rebase/merge

* happy formatting for scala and bazel and friends

* Drop "openWorld" setting from configuration

And refactor the tests to allocate parties explicitly.

* Fix up migration and tests

* Drop authorizedParticipantIds from configuration

Implement configuration authorization in kvutils using the previous
the participant id of the previous configuration.

* Post-rebase fixes

* Add missing migrations

* Apply suggestions from code review

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

* Add missing mavenUpload to ledger-api-server

* Remove stateUpdateRecordTime

* Address code review

- Address PR review
- Merge TimeModelImpl and the traits. Remove TimeModel from ledger-api-common.
- Throw `Err` from KeyValueConsumption on parse errors instead of assert/sys.error

* Reformat

* Add missing protobuf file

* Fix compilation after TimeModel changes. Add version logs to participant-state{,-kvutils}.

* Fix TestUtil.scala build

* Apply suggestions from code review

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

* Address review

- synchronized access to ledgerConfiguration in InMemoryLedger
- store rejection if configuration generation is wrong

* Update ledger/participant-state/protobuf/ledger_configuration.rst

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2019-11-27 17:41:23 +01:00
Stefano Baghino
4d922e763b Add authentication to Java identity client (#3630)
* Add authentication to Java identity client

Contributes to #3626

No changelog added right now, it will be added with the PR that
effectively closes the ticket.

Moves `LedgerCallCredentials` to a shared package.

Establishes the test framework for other Java clients.

* Address https://github.com/digital-asset/daml/pull/3630#discussion_r350663731

* Address https://github.com/digital-asset/daml/pull/3630#discussion_r350663731

* Rebase and fix compilation errors

* Fix type of jar in artifacts.yaml

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

* Fix more errors emerged after rebase

* Add dependency for DAML assistant ITs

* Add missing dependency

* Fix wrong dependency

* fix release
2019-11-26 18:51:09 +00:00
Stefano Baghino
160da16227
Move AuthorizationIT to sandbox integration tests (#3598)
* Move AuthorizationIT to Sandbox ITs

* Use refactored code in Extractor

* Apply a few improvements, see body

- Run previously ignored tests
- Make token signing private
- Fix stream observer utility comment more accurate
- Add read-only token helper

* Add r/w token split tests

* Fix formatting and imports

* Address https://github.com/digital-asset/daml/pull/3598#discussion_r349769546

* Address https://github.com/digital-asset/daml/pull/3598#discussion_r349769801

* Fix inaccurate test

A test was incorrectly trying to get a token with an invalid signature

* Address reviews
2019-11-26 10:13:36 +01:00
Samir Talwar
1bd2ec5b1a grpc-utils: Simpler extractors. (#3594)
* grpc-utils: Simpler GrpcStatus extractors when you know the code.

And don't care about the description.

* grpc-utils: Simpler GrpcException extractors when you know the code.

And don't care about the description.

* Apply suggestions from code review

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* Add `new` to `SpecificGrpc{Exception,Status}` constructor calls.

Also, don't blindly apply GitHub suggestions.
2019-11-22 21:09:17 +00:00
Stefano Baghino
6d16409699 Move ReflectionIT out of LAPI IT (#3582)
* Move ReflectionIT out of LAPI IT

* Address https://github.com/digital-asset/daml/pull/3582#discussion_r349221189

* Address https://github.com/digital-asset/daml/pull/3582#discussion_r349507268

* Delete previous incarnation of the test
2019-11-22 16:30:56 +00:00
Samir Talwar
0ff716df2a Ledger API: Add healthcheck endpoints. (#3573)
* grpc-definitions: Delete health_service.proto

We can use the version in io.grpc:grpc-services instead.

* ledger: Delete ledger/API.md.

* sandbox: Fix warnings in ApiServices flagged by IntelliJ.

* sandbox: Implement a dummy grpc.health.v1.Health.Check endpoint.

* sandbox: Implement a dummy grpc.health.v1.Health.Watch endpoint.

* sandbox: Drop repeated elements from grpc.health.v1.Health.Watch.

* sandbox: Wrap the HealthService in basic tests.

* sandbox: Stop streaming the server health too.

* ledger-api-test-tool: Health check tests.

* Add a changelog entry for the health check endpoints.

CHANGELOG_BEGIN

- [Ledger API] Add healthcheck endpoints, conforming to the
  `GRPC Health Checking Protocol <https://github.com/grpc/grpc/blob/master/doc/health-checking.md>`_.
  It is always ``SERVING`` for now.

- [DAML Ledger Integration Kit] Add conformance test coverage for the
  ``grpc.health.v1.Health`` service.

CHANGELOG_END

* ledger-api-integration-tests: Increment the number of services.

* Apply suggestions from code review

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* sandbox: Use `AkkaBeforeAndAfterAll` in the HealthServiceSpec.

In an attempt to get it working on CI.

* sandbox: Change `dropRepeated` to `DropRepeated()`.

Keep it in one file.

* test-common: Use `Delayed.by` in `TimeBoundObserver`.

* test-common: Close the source when `TimeBoundObserver` completes.

* ./fmt.sh

That'll teach me not to `--no-verify` just because it's a merge commit.

* sandbox: Inline `HealthService.suppress`.

At some point it was being used twice.

* sandbox: Increase the timeout for HealthServiceSpec.

* sandbox: Reimplement HealthService using the Scala protobuf types.

* sandbox: Generate an Akka-compatible trait for the health service.

And refactor a lot of test code to make it easy to test.

* ledger-api-common: Move the HealthService here.

* rs-grpc-testing-utils: Publish to Maven.

* rs-grpc-testing-utils: Add Maven coordinates.
2019-11-22 14:02:05 +00:00
Robert Autenrieth
87c8f274e1
Split rw claims (#3548)
* Split read and write claims

Fixes #3398

CHANGELOG_BEGIN
- [Sandbox] Added support JWT tokens that only authorize to read data, but not to act on the ledger.
CHANGELOG_END
2019-11-22 11:24:50 +01:00
Stefano Baghino
9f9d2d0458 Move and improve LedgerIdentityService integration tests (#3581) 2019-11-21 17:08:10 +00:00
Stefano Baghino
f2f60d5e4c
Move LedgerConfigurationService out of Ledger API IT (#3576) 2019-11-21 16:02:17 +01:00
Stefano Baghino
e0239a42a1
Remove test already covered (#3572)
This integration test is duplicate of
//ledger/sandbox/src/test/suite/scala/com/digitalasset/platform/sandbox/services/time/StaticTimeIT.scala
2019-11-21 14:30:23 +01:00
Stefano Baghino
c51ecd3c58
Extractor with authentication (#3514)
* Make Extractor work against Ledger API servers protected by authentication

* Update changelog

* Address https://github.com/digital-asset/daml/pull/3514#pullrequestreview-318811500

- https://github.com/digital-asset/daml/pull/3514#discussion_r347753205
- https://github.com/digital-asset/daml/pull/3514#discussion_r347753629
- https://github.com/digital-asset/daml/pull/3514#discussion_r347754462

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347755484

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347752424

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347756328

* Fix docs

* Fix artifacts.yaml
2019-11-19 17:12:25 +01:00
Samir Talwar
bd28808c1a
ledger: Remove redundant PostgreSQL dependencies. (#3465)
* Don't duplicate dependencies on `@postgresql_dev_env` binaries.

If you depend on `@postgresql_dev_env//:all`, you don't need anything
else.

* ledger-api-test-tool: Remove PostgreSQL dep from conformance tests.

It's already a dependency of the server.
2019-11-14 14:36:51 +01:00
Andreas Herrmann
9b9cce05d4 Mark ledger-api-integration-tests as flaky on Windows (#3442)
* Marke ledger-api-integration-tests as flaky

* More seldomly also flaky on Linux

* ledger-api-integration-tests separate flaky tests
2019-11-13 12:39:15 +00:00
Stefano Baghino
550b963eda Clean up IT Logback config, reduce noise in CI logs (#3443) 2019-11-13 09:49:25 +00:00
Stefano Baghino
d494458f1c Add integration tests with LedgerClient (#3435) 2019-11-12 16:36:52 +00:00
Gerolf Seitz
89ac004944
Extend timing for AuthorizationIT (#3422) 2019-11-12 10:11:43 +01:00
Gerolf Seitz
41ae9709d4
Fix potentical race condition in Dispatcher (#3415)
Instead of using the value of the state at the time of subscription,
we need to call getHead explicitly.
Otherwise it could happen that the state gets updated between reading it
and completing the subscription, which means the stream would miss an update
of head.

This also removes the type parameter of SignalDispatcher again, as it is best
that this class doesn't even know the data type involved.
2019-11-11 17:36:50 +01:00
Stefano Baghino
377b43f2d6
Pass token in individual calls, remove default location for client token (#3403)
* Pass token in individual calls, remove default location for client token

* Fix things for AuthorizationIT

* Fix ledger-service usages of LedgerClient

* Fix remaining compilation errors
2019-11-11 16:22:25 +01:00
Samir Talwar
0615166c4d ledger-api-test-tool: Port TransactionBackpressureIT. (#3384)
Closes #2844.

It turns out that this test doesn't really exacerbate any backpressure;
it just fires lots of commands. In the interest of not losing this, I've
ported it to a test in TransactionService.

Without the throttling, we _do_ hit resource exhaustion on Sandbox with
the PostgreSQL server backend. Capping the number of commands at 500,
rather than 1000, seems to solve this.
2019-11-08 09:49:25 +00:00
Gerolf Seitz
d30b6eb94b
Sandbox: fix excessive memory consumption (#3362)
* Implement proper stream pagination

The previous pagination mechanism for streaming ledger entries was implemented
as a recursive method call with manually concatenating akka Sources.
However, this didn't work properly and resulted in all the subsources being
forced immediately, resulting in parallel requests for all pages
(0-100, 100-200, 200-300, ...) instead of the expected mechanism of loading
the first page and on upstream request (i.e. client requests for more data
over grpc) loading the next page of data.

The current mechanism uses Source.unfoldAsync which makes the paging
mechanism work as expected: sequential loading of pages on demand.

* Serialize and deserialize Transactions outside the SQL Executor

This frees up the SQL Executor threads sooner for other work
and the conversion work only happens on a by need basis when
the consumer requests more data.
2019-11-08 10:25:29 +01:00
Andreas Herrmann
6877d5279c
recursively symlink all files in dev_env_tool (#3377)
* dev_env_tool - recursively symlink all files

* dev_env_tool: add prefix attribute

* Replace nodejs by dev_env_tool

* postgresql.exe --> postgres.exe

* Remove unused dev_env_package

And rename dev_env_package --> dev_env_tool

* dev_env_tool macOS compatbility

BSD find does not support `-printf`.

* ReserServiceIT: 4 attempts on Windows
2019-11-08 09:40:26 +01:00
Robert Autenrieth
89d6c7375c
Add a JWT authentication to sandbox (#3283)
Fixes #3363
2019-11-07 23:04:16 +01:00
Stefano Baghino
c8aaffd62c Add GrpcException extractor (#3344)
* Add GrpcException extractor

* Use GrpcStatus in integration test

* Fix compilation error

* Fix compilation error

* Address https://github.com/digital-asset/daml/pull/3344#discussion_r342981204

* Restricting extractor types
2019-11-06 14:44:06 +00:00
Samir Talwar
fddaeb1c4a ledger-api-test-tool: Port LotsOfPartiesIT. (#3328)
* ledger-api-test-tool: Port LotsOfPartiesIT.

* ledger-api-test-tool: Run LotsOfPartiesIT with multiple participants.

Odds of me getting this wrong: 80%. Let's find out!

* ledger-api-test-tool: More underscores, methinks.

* ledger-api-test-tool: Improve the readability of the LotsOfParties test.

Instead of all the functional magic, just do things twice. It's even
shorter in some cases.

* ledger-api-test-tool: Not so many parties. :-(

* sandbox: Extract duplication between conformance test definitions.

* sandbox: Run the LotsOfPartiesIT conformance test separately.

* Revert "ledger-api-test-tool: Not so many parties. :-("

This reverts commit 8039a7cc9b.

* sandbox: Add the copyright header to sandbox_conformance_test.bzl.

* Run `./fmt.sh`.

* ledger-api-test-tool: Generalize `sandbox_conformance_test`.

I want to use it with the DAML-on-X reference v2.

* api-server-damlonx/reference-v2: Use `server_conformance_test`.

* api-server-damlonx/reference-v2: Run LotsOfPartiesIT separately.
2019-11-05 19:54:21 +00:00
Stefano Baghino
edb2d15cec
Port command-related integration tests (#3320)
* Pre-port cleanup of helpers

* Further clean-up

* Remove dead code

* More cleaning and flattening

* Port first tests from CommandClientIT

* More cleanup and more dead code removal

* Port exercise by key test

* Port observer disclosure tests

* Port tests, remove duplicates and dead code

* Fix compilation error and remove more dead code

* Remove unused import

* Spread helpers to single users, remove materializer from helpers

* More test porting and cleanup

* Remove more dead code

* Restore tests deleted by mistake

* Restore final qualifier removed by mistake

* Fix typo

* Optimize imports

* Move timeout from helper to tests

* Remove unused class

* Never gonna give you up

* Address https://github.com/digital-asset/daml/pull/3320#discussion_r342018581

* Address https://github.com/digital-asset/daml/pull/3320#discussion_r342025161

* Remove removed test :)
2019-11-04 17:30:31 +01:00
Stefano Baghino
42051ae037
Add and validate expiration on claims (#3286)
* Add and validate expiration on claims

* Address review comments

* Test existing services for token expiration

* Test expiration mid-stream

* Address https://github.com/digital-asset/daml/pull/3286#pullrequestreview-309710454
2019-10-31 13:14:44 -04:00
Samir Talwar
8baeaf59a1 Delete CommandSubmissionTtlIT. (#3298)
The same behaviour is covered by the LedgerConfigurationService already.

Closes #2839.
2019-10-31 13:32:25 +00:00
Stefano Baghino
d9ae487fec Disallow empty command submission (#3270)
* Disallow empty command submission

Fixes #592
2019-10-31 08:37:58 +01:00
Robert Autenrieth
e887318f4f Move AuthService (#3272)
* Move AuthService and Claims

* Move interceptor and authorization wrappers

* Add artifact

* Address review comments
2019-10-29 15:46:43 +00:00
Stefano Baghino
5fbc9a20aa
Remove duplicate DAR reader (#3267)
Fixes #452
2019-10-28 17:02:47 -04:00
Stefano Baghino
d803768405
Remove duplicates of TestExecutionSequencerFactory (#3264)
Fixes #9
2019-10-28 15:56:33 -04:00
Andreas Herrmann
2bd1db490a
Replace bazel-deps by rules_jvm_external (#3253)
* Update bazel-common to fix javadoc issues

Specifically, to fix the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel:7:1: in javadoc_library rule //ledger-api/rs-grpc-bridge:rs-grpc-bridge_javadoc:
Traceback (most recent call last):
        File "/home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel", line 7
                javadoc_library(name = 'rs-grpc-bridge_javadoc')
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/com_github_google_bazel_common/tools/javadoc/javadoc.bzl", line 27, in _javadoc_library
                dep.java.transitive_deps
object of type 'JavaSkylarkApiProvider' has no field 'transitive_deps'
```

* Define Maven deps using rules_jvm_external

* Pin artifacts

* Remove bazel-deps generated targets

* Remove bazel-deps

* Switch to rules_jvm_external targets

* update bazel documentation

* pom_file: There are no more bazel-deps targets

* BAZEL-JVM.md `maven_install` typo
2019-10-28 13:53:14 +01:00
Robert Autenrieth
d320f93702
Add integration test for ledger API authorization (#3187)
Fixes #3023
2019-10-17 12:09:35 +02:00
Stefano Baghino
83e305b667
Port LedgerConfigurationServiceIT (#3188)
* Port LedgerConfigurationServiceIT

* Remove unused imports

* Fix compilation error

* Port SemanticLedgerTestsIT

* Expect failures for negative cases

* Add meaningful parentheses

* Do not require the ledger configuration test commands to succeed

* Remove unused command tracking

* Address https://github.com/digital-asset/daml/pull/3188#issuecomment-542616799

* Update unreleased.rst
2019-10-16 13:15:37 +02:00
Robert Autenrieth
07b75e0008
Command submission let test (#3153)
* Add CommandSubmissionLet test

* Remove old test

* Fix broken test

* Address review comments
2019-10-15 13:25:38 +02:00
Remy
e45b585307 daml-lf: repackage daml-lf archive proto (daml_lf -> daml_lf_dev) (#3169) 2019-10-15 09:36:11 +00:00
Remy
d64df4b5f7 daml-lf: clean achive bazel build (#3175)
* clean the mess in daml-lf achive bazel build

* add release note

* Address Moritz's comments

* more release notes
2019-10-15 08:36:46 +00:00
Remy
fc1a000090 daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader (#3168)
* daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader

* fix release
2019-10-14 14:53:50 +00:00
Stefano Baghino
cde3797eb2
Finish porting TransactionServiceIT (#3043)
* Finish porting TransactionServiceIT

* Go easy on H2

* Address https://github.com/digital-asset/daml/pull/3043#discussion_r328547578
2019-09-26 14:20:02 +02:00
Robert Autenrieth
afabb584c8
Move PackageServiceIT to the ledger api test tool 2019-09-24 15:17:18 +02:00
Stefano Baghino
aad98b4c9e
More transaction service tests ported to the new test tool (#2961)
* Remove dead code

* Port around 30 more tests, delete dead code

* Remove template comment

* Update unreleased.rst

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r327000163

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326999412

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326998734

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326998278

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326998888

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326997789
2019-09-23 15:33:32 +02:00
Gerolf Seitz
96642d9b19
Port TransactionServiceLargeCommandIT. (#2944)
Fixes #2861.
2019-09-18 13:05:46 +02:00
Gerolf Seitz
00f4ac133f
Port WronglyTypedContractIdIT to new TestTool. (#2907)
Fixes #2862.
2019-09-16 16:11:30 +02:00
Stefano Baghino
c1d3c54f65
Port transaction service tests (#2900)
* Delete dead code

* Add test case for contract identifier retrieval when filtering by template

* Factor out retry strategies, make transaction tests multi-node-aware, add one test case

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324541271

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324543869

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324543999

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324544107

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324544193

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324545838

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324545682

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324545947

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324546075

* Wrap eventual success around exercise exclusively
2019-09-16 14:26:58 +02:00
Stefano Baghino
e452aa2cea
Port semantic tests to the new test tool (#2718) 2019-09-02 14:40:10 +02:00
Stefano Baghino
13607031f5
Start porting the transaction service integration tests (#2713)
* Start porting the transaction service integration tests

Contributes to #1373

* Simplify creation of multiple contract in a single transaction

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319562016

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319562566

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563441

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563617

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563788

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563838

* Fix test case description

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

* Fix test case description for disclosure

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

* Fix test description of parallel requests test case

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

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319883011

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319567251

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319567251

* Run all conformance tests in exclusive mode
2019-09-02 13:45:15 +02:00
Remy
20649cf78e ledger-api: rename decimal field to numeric in value Proto (#2688)
* add Numeric.java

* ledger-api: rename `decimal` field to `numeric` in value protobuf

* Address Gerolf's comment

* ledger-api: add missing renammings

* ledger-api: relax syntax of numbers that can be sent as numerics

* extractor:  fix

* leger-api: change format of number though ledger api

* daml-lf: fix numeric regexp

* ledger: fix tests
2019-08-29 22:51:33 +00:00
Stefano Baghino
6d1d0b80c5
Port package management tests to new test tool (#2638)
* Port package management tests to new test tool

* Address https://github.com/digital-asset/daml/pull/2638#discussion_r317025106
2019-08-23 13:55:50 +02:00