Commit Graph

434 Commits

Author SHA1 Message Date
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
Oliver Seeliger
ad3adbb7aa
Ledger api test tool --load-scale-factor option to test different ledgers (#3586)
CHANGELOG_BEGIN

[DAML Integration Toolkit]
  * Add ledger api test tool `--load-scale-factor` option that allows dialing up
     or down the workload applied by scale tests (such as the
     `TransactionScaleIT` suite). This allows improving the performance of
     different ledger over time.

CHANGELOG_END
2019-11-22 14:51:17 +01:00
Remy
3f8bd0da5e DAML-LF: rename ValueMap to ValueTextMap. (#3584) 2019-11-22 11:35:32 +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
Gerolf Seitz
c43f004e57
Replace MetricsManager with MetricRegistry (#3574)
Instead of passing around MetricsManager just for the timedFuture
method, we pass the underlying MetricRegistry directly and use
the timedFuture function as an actual function (passing in a timer metric).

The Sandbox still starts the JmxReporter, but the integrator of the Indexer
and the Ledger API Server needs to enable the reporting facilities themselves.

CHANGELOG_BEGIN

- [Ledger] Ledger API Server and Indexer now accept an instance of ``MetricRegistry`` as parameters. This gives implementors of ledger integrations the most flexibility to set up metrics reporting that works best for them.

CHANGELOG_END
2019-11-21 16:47:30 +01: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
147676d45c Remove runtime-based coloring from LATT reports (#3566)
CHANGELOG_BEGIN

- [DAML Ledger Integration Kit] The Ledger API Test Tool no longer shows
  individual test duration colored based on how they lasted.

CHANGELOG_END
2019-11-21 12:41:08 +00:00
Oliver Seeliger
55dfe967da
Split out ledger api test tool transaction tests related to scale (#3569)
* Split out ledger api test tool transaction tests related to scale

This enables ledger providers to meet conformance targets first before
tackling the scale / large transactions tests.

* Update ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/tests/TransactionScale.scala

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

* Update ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/tests/TransactionScale.scala

Co-Authored-By: Samir Talwar <samir.talwar@digitalasset.com>
2019-11-21 12:07:09 +01:00
Oliver Seeliger
15a7f72eae
Upgrade to canton 0.4.1 and reenable multi-ledger test (#3565) 2019-11-21 11:17:44 +01:00
Gerolf Seitz
8c78c00c50
Add metrics to Ledger API Server (#3523)
Fixes #3513.

* Add metrics to track commands
- Meter: CommandSubmission.failedCommandInterpretations
- Timer: CommandSubmission.submittedTransactions

* Add metrics to JdbcIndexer
- Gauge: JdbcIndexer.lastReceivedRecordTime
- Gauge: JdbcIndexer.lastReceivedOffset
- Gauge: JdbcIndexer.currentRecordTimeLag
- Timer: JdbcIndexer.processedStateUpdates


* Allow setting a custom JMX domain.
We don't want to use com.digitalasset.platform.sandbox
for the ledger-api server and indexer.

* Add interceptor that automatically meters incoming grpc service calls.

CHANGELOG_BEGIN

- [Ledger] Add various metrics to track gRPC requests, command submissions, and state update processing. See `#3513 <https://github.com/digital-asset/daml/issues/3513>`__.

CHANGELOG_END
2019-11-20 18:26:25 +01:00
mziolekda
a217187b26
add error codes for overloaded and internal error to participant state (#3524)
* add error codes for overloaded and internal error

* change wording in error description strings

* scala formatting

* use string interpolation intead of concatenation

* address issues found in peer review
2019-11-20 14:37:00 +01:00
Oliver Seeliger
917c43a048
Ledger api tool transaction test fixes: (#3542)
- moved comparableTransaction[tree]s helpers to companion object
  as suggested in https://github.com/digital-asset/daml/pull/3475#pullrequestreview-317474464
- applied helpers to two additional tests
- strip offset in addition to command-ids as offsets drift apart over time
  depending on differing heartbeats and different sets of hosted party and thus different
  party-relevant events
- modified two tests to be single-node as look-up by transaction/eventid assumes the events
  are available locally
2019-11-20 10:42:47 +01:00
Jussi Mäki
ff03ed5f3f
Add party to participant mappings as submission inputs (#3456)
* Add InsertOrdSet

A set with deterministic ordering.

* Add party to participant mappings as inputs to kvutils submissions

* Add InsertOrdSetTest, remove fromSet. Sort packages and parties.

* Apply suggestions from code review

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Add AbstractSet and SetLike traits to InsertOrdSet. Remove (Non)EmptyInsertOrdSet.
2019-11-19 18:03:58 +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
Remy
fedc49dd12 leger-api: add GenMap support (#3506)
* leger-api: add GenMap support

* cosmetic

* Address Gerolf's  comment

* add a point in the release notes

* Address Fran's comments
2019-11-18 18:13:25 +00:00
Gerolf Seitz
5f8bf411bd
Upload proto and deploy jars to maven (#3507)
* Add helper to produce an empty zip files.

This is used to generate empty sources and javadoc jars for
deploy jars later on.

* Create empty auxilliary jars.

da_java_binary:
  - empty javadoc jar
  - empty sources jar

da_java_proto_library:
  - empty javadoc jar
  - the sources jar is automatically generated by java_proto_library as a side effect

da_scala_binary:
  - empty javadoc jar
  - empty sources jar

* Support maven upload for jar-deploy and jar-proto

For jar-deploy targets we don't check for internal dependencies,
because these should already be contained in the (fat-)jar itself.

Additionally, the release program now uploads javadocs and sources
for jar-proto and jar-deploy as well to comply with maven central.

* Upload ledger-api-test-tool and kvutils + dependencies to maven central.

This is the diff running the output of the release without and with these changes.
A few artifacts now also get their javadoc and sources uploaded (mostly to bintray,
but now they are ready for a maven central upload).

ledger-api-test-tool has the scala version removed from the artifact as it is a
deploy jar and nobody should care which specific scala version is used.

Only in release/com/daml/ledger/participant-state-kvutils-java-proto/100.13.35: participant-state-kvutils-java-proto-100.13.35-javadoc.jar
Only in release/com/daml/ledger/participant-state-kvutils-java-proto/100.13.35: participant-state-kvutils-java-proto-100.13.35-sources.jar
Only in release/com/daml/ledger/testtool: ledger-api-test-tool
Only in release-before/com/daml/ledger/testtool: ledger-api-test-tool_2.12
Only in release/com/digitalasset/daml/lf/engine/trigger/runner_2.12/100.13.35: runner_2.12-100.13.35-javadoc.jar
Only in release/com/digitalasset/daml/lf/engine/trigger/runner_2.12/100.13.35: runner_2.12-100.13.35-sources.jar
Only in release/com/digitalasset/daml-lf-blindinginfo-java-proto/100.13.35: daml-lf-blindinginfo-java-proto-100.13.35-javadoc.jar
Only in release/com/digitalasset/daml-lf-blindinginfo-java-proto/100.13.35: daml-lf-blindinginfo-java-proto-100.13.35-sources.jar
Only in release/com/digitalasset/daml-lf-transaction-java-proto/100.13.35: daml-lf-transaction-java-proto-100.13.35-javadoc.jar
Only in release/com/digitalasset/daml-lf-transaction-java-proto/100.13.35: daml-lf-transaction-java-proto-100.13.35-sources.jar
Only in release/com/digitalasset/daml-lf-value-java-proto/100.13.35: daml-lf-value-java-proto-100.13.35-javadoc.jar
Only in release/com/digitalasset/daml-lf-value-java-proto/100.13.35: daml-lf-value-java-proto-100.13.35-sources.jar
Only in release/com/digitalasset/damlc/100.13.35: damlc-100.13.35-javadoc.jar
Only in release/com/digitalasset/damlc/100.13.35: damlc-100.13.35-sources.jar
Only in release/com/digitalasset/extractor/100.13.35: extractor-100.13.35-javadoc.jar
Only in release/com/digitalasset/extractor/100.13.35: extractor-100.13.35-sources.jar
Only in release/com/digitalasset/ledger-service/http-json-deploy/100.13.35: http-json-deploy-100.13.35-javadoc.jar
Only in release/com/digitalasset/ledger-service/http-json-deploy/100.13.35: http-json-deploy-100.13.35-sources.jar
Only in release/com/digitalasset/navigator/100.13.35: navigator-100.13.35-javadoc.jar
Only in release/com/digitalasset/navigator/100.13.35: navigator-100.13.35-sources.jar
2019-11-18 14:40:15 +01:00
Samir Talwar
c89d1b654e ledger-api-test-tool-on-canton: Disable tests unless run explicitly. (#3492) 2019-11-15 16:29:12 +00:00
Stefano Baghino
c0e4a50f1e Break up Ledger API Test Tool target to reduce average build time (#3486)
* Break up Ledger API Test Tool target to reduce average build time

* Address https://github.com/digital-asset/daml/pull/3486#discussion_r346836085

* Address https://github.com/digital-asset/daml/pull/3486#discussion_r346861509
2019-11-15 15:28:39 +00:00
Remy
4d36c01682 Daml lf genmap (#3453)
* shortcup for SBMapEmpty

* daml-lf: add GenMap in the interpreter.
2019-11-15 10:36:41 +00:00
Gerolf Seitz
efee9b5e44 Add sync points in flaky TransactinService tests (#3480)
Tests with multiple nodes need to introduce a synchronization
point to avoid flakiness.
2019-11-14 18:48:28 +00:00
Oliver Seeliger
583b683072 Split multi-subscription ledger api tests to local and distributed (#3475) 2019-11-14 17:12:38 +00:00
Samir Talwar
d897b6b55a ledger-api-test-tool-on-canton: Upgrade Canton to v0.4.0. (#3468)
* ledger-api-test-tool-on-canton: Upgrade Canton to v0.4.0.

* workspace: Expose a Java library from the Canton external dependency.`

* workspace: Use double quotes for multiline strings too.
2019-11-14 14:55:38 +00: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
Gerolf Seitz
e760d4749f Check internal dependencies of maven artifacts (#3454)
* Check internal dependencies of maven artifacts

All artifacts that are uploaded to maven need to also have
their dependencies uploaded to maven.

* inline tuple matching

* remove unnecessary parenthesis

* mark missing artifacts for maven upload
2019-11-14 14:18:54 +01:00
Samir Talwar
5b3dfc2614 reference-v2, sandbox: Add the dependency on PostgreSQL where required. (#3452)
And remove it from the tests, as they now pick it up from the binary.
2019-11-13 16:45:37 +00:00
Samir Talwar
c5d9d1014e
ledger-api-test-tool: Run tests on Canton, and fix a few issues. (#3446)
* ledger-api-test-tool-on-canton: Run Canton.

* ledger-api-test-tool-on-canton: Run the SemanticTests against Canton.

This was _so_ much work.

These will probably be flaky, so can't merge them in until we fix the
underlying issues with the tests around multi-participant allocation.

* ledger-api-test-tool: Wait for parties to arrive on all participants.

Thanks to Canton for exacerbating this bug.

Can't turn on all the tests on Canton yet as there are other spurious
failures. Will investigate next.

* ledger-api-test-tool: Move all contract key tests to ContractKeys.

If a ledger doesn't support ContractKeys, they need to be able to turn
these tests off.

* ledger-api-test-tool: If a test name is misspelled, fail immediately.

I keep getting names slightly wrong in the `--exclude` arguments and
wondering why it didn't work.

* client_server: Revert client_server_test.bzl.

Turns out I don't know what I'm doing. ¯\_(ツ)_/¯

* sandbox: Don't call `.toString` on an array. Doesn't do much.

* dev-env: Don't untar netcat automatically.

It needs to be installed with Pacman.
2019-11-13 17:27:28 +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
f55a044312 Remove font coloring (#3448) 2019-11-13 12:38:22 +00:00
Stefano Baghino
550b963eda Clean up IT Logback config, reduce noise in CI logs (#3443) 2019-11-13 09:49:25 +00:00
Brian Healey
f3f6f3b678 correct package path for ReferenceServer (#3439) 2019-11-12 22:39:41 +00:00
Stefano Baghino
d494458f1c Add integration tests with LedgerClient (#3435) 2019-11-12 16:36:52 +00:00
Jussi Mäki
b57ef848aa
Use TreeMap for storing transaction nodes (#3418)
* Use TreeMap for storing transaction nodes

Going forward we require deterministic serialization for transaction nodes.
This PR switches the `Transaction.nodes` to use a TreeMap instead of HashMap,
which gives us deterministic serialization order for the transaction nodes.

An alternative would be to sort the transaction nodes when serializing, but
I feel avoiding HashMap altogether is the safer option as this may bite us
elsewhere as well (e.g. tests, new serialization code, etc.).

* Address review

* Remove unused import
2019-11-12 13:55:03 +01:00
Jussi Mäki
8b5eecb6b1
Fix contract key visibility check in kvutils (#3421)
The contract keys accessed in the context of a `fetchByKey` were not
properly checking that the contract was active and visible.

The checks for contract's visibility and activeness are now done from
one place.
2019-11-12 11:37:02 +01:00
Stefano Baghino
0a3636ec69 Authenticated ledger identifier call in LedgerClient (#3426) 2019-11-12 09:36:54 +00:00
Gerolf Seitz
89ac004944
Extend timing for AuthorizationIT (#3422) 2019-11-12 10:11:43 +01:00
Stefano Baghino
667ffd5c47
Improve LedgerClient (#3419) 2019-11-12 00:09:59 +01:00
Brian Healey
a5320d3173
Hotfix resolve assorted warnings around kvutils participant read/write path (#3417)
* address warning: add type annotations, shortened syntax, optimise imports

* Specify test size to avoid bazel warning
address warning: add type annotation

* make bazel buildifier happier with call order

* no parens for a no side effect pure method
2019-11-11 13:20:39 -05: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
Jussi Mäki
4c932b1f0c Do not re-register loaded-packages metric in PackageCommitter (#3420)
This caused an exception in the preload thread, and presumably
broke the preloading.
2019-11-11 16:29:00 +00: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
Oliver Seeliger
d9319201b8
Ledger api test tool transaction test wrap remote exercises with eventually (#3410)
Two tests issued a create and exercise on different participants without
allowing for a delay publishing the contract. Added two missing eventually
statements to two TransactionService tests.
2019-11-11 13:30:46 +01:00
Oliver Seeliger
16bbcb74d5
Make ledger api multi-party subscription transaction test singlenode (#3395)
As in multi-node Alice and Bob's contracts end up on different
participants not producing true multi-party subscriptions.
2019-11-11 11:23:11 +01:00
Samir Talwar
1484705852 ledger-api-test-tool: Allocate participants and parties declaratively. (#3401)
* ledger-api-test-tool: Allocate participants and parties declaratively.

Part of a solution to #3380.

Rather than allocating participants and parties line by line, instruct
the test to construct a number up-front.

This will make it easier to serve multi-participant ledgers, as we can
make sure we wait for all parties to be available on all participants
before starting the test. Once we can do that, tests will hopefully be
much less flaky on ledgers other than the Sandbox.

* ledger-api-test-tool: Rename `provision` to `allocate` and document it.

* ledger-api-test-tool: Make Allocation functions private where possible.

* ledger-api-test-tool: Fix the comment for `LedgerTestContext::allocate`.

It got the signature wrong.
2019-11-08 13:31:30 +00:00
Samir Talwar
b3cb869b4b ledger-api-test-tool: Clearer timing information. (#3383)
* ledger-api-test-tool: Just use `Duration::toString` for logging.

* ledger-api-test-tool: Fix reporter highlighting.

Previously, the closing parenthesis around the test duration was not
highlighted. Now neither are.
2019-11-08 12:37:00 +00: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