Commit Graph

186 Commits

Author SHA1 Message Date
Stephen Compall
ca9e89b3da
check whether collection.compat is unused when compiling for Scala 2.12 (#9604)
* check whether collection.compat is unused when compiling for Scala 2.12

- Instead of always suppressing warnings for collection.compat._,
  we should only do it for Scala 2.13

- We can also reduce boilerplate by automatically adding this
  option when both silencer_plugin and collection-compat are
  present

CHANGELOG_BEGIN
CHANGELOG_END

* remove unused import

* remove another unused import

* remove even more unused imports

* missed compat dependency

* more missed compat dependencies

* missed compat dependency

* use scala_deps in scaladoc_jar

- #8423 inlined the major version expansion, but this seems to
  have been prior to proper support by scaladoc_jar

* restore custom handling of participant-integration-api

- fixing scaladoc_jar isn't worth it for a single case, as with
  deps vs scala_deps
2021-05-11 21:54:14 +00:00
Samir Talwar
e1af564bcc
Switch from @silent to @nowarn. (#9498)
* Switch from `@silent` to `@nowarn`.

This annotation is native to Scala 2.12.13+ and 2.13.2+. It replaces
most usages of `@silent`.

I had to get creative about a couple of use cases that didn't work.
Specifically:

  1.  Suppressing deprecation warnings works, but Scala 2.12 erroneously
      complains that the `@nowarn` is unnecessary.  I had to suppress
      this warning too with `-Ywarn-unused:-nowarn`.
  2.  I can't seem to suppress the warning, "The outer reference in this
      type test cannot be checked at run time." Instead, I have
      refactored the code to remove the warning.

We still need to use the silencer plugin to suppress some warnings about
unused imports (because of compatibility between Scala 2.12 and 2.13),
but this means we no longer need the library, and therefore it is not a
transitive dependency that downstream consumers need to worry about.

CHANGELOG_BEGIN
CHANGELOG_END

* Add some comments around `@nowarn` support.

* language-support/scala: Fix a warning suppression.

* Revert to the default warnings.

Compatibility was complaining.
2021-04-26 19:46:14 +00:00
Hubert Slojewski
cb422e2f67
KVL-810 Report the correct gRPC error code on failures due to concurrent transactions (#9218)
* Fix gRPC status codes for inconsistency rejections and DamlLf errors
Also, add unit tests and exclude failing compatibility and conformance tests

CHANGELOG_BEGIN

- [Integration Kit] Fix gRPC status codes for inconsistency rejections and DamlLf errors (ContractNotFound, ReplayMismatch) by changing them from INVALID_ARGUMENT to ABORTED

CHANGELOG_END
2021-03-26 15:26:33 +01:00
Gerolf Seitz
695ad072ac
Fix double push in CommandTracker (#9059)
The command tracker detects timeouts outside the regular pull/push
mechanism of the custom akka graph stage. Basically the timeout
detection jumps the line when emitting outputs on `resultOut`. If it
then processes a regular completion, it tries to push to `resultOut`
even though it hasn't been pulled again in the meantime. Using `emit`
instead of `push` when a completion arrives makes akka take care of
handling the signaling properly.

Fixes DPP-285

CHANGELOG_BEGIN
[Integration Kit, Sandbox, Daml on SQL, Scala Ledger Bindings]:
Fixed a bug that caused the CommandTracker used by the synchronous
CommandService to crash in case of a lot of timeouts.
CHANGELOG_END
2021-03-11 13:19:29 +01:00
Remy
d92f2c7003
Ledger: refactor bazel packaging of tedger test tool (#8894)
improve previous generalization from #8695

- use lf version instead keyword (like 'stable', 'latest', 'dev') to
  tag actual target.  This will allow two keywords to map to the same
  versions without doing twice the compilation/test work.

- use alias to map keywords tag target to versioned tag target.

- move package manage dar to test_commong.

CHANGELOG_BEGIN
CHANGELOG_END
2021-02-22 11:41:19 +01:00
Moritz Kiefer
290584a378
Port //ledger/ledger-api-client/... to Scala 2.13 (#8478)
* Port //ledger/ledger-api-client/... to Scala 2.13

This pulls in Sandbox next and kvutils as a dependency so those now
build on 2.13 as well.

changelog_begin
changelog_end

* Upgrade scala-colllection-compat

changelog_begin
changelog_end

* Use toVector.sortBy instead of to(LazyList).sortBy

changelog_begin
changelog_end

* Use a view for passing things to varargs

changelog_begin
changelog_end

* avoid symbol literal in CommandClientIT

changelog_begin
changelog_end
2021-01-13 11:35:46 +01:00
Moritz Kiefer
22ce940954
Upgrade scalafmt and enable trailing commas (#8437)
This PR updates scalafmt and enables trailingCommas =
multiple. Unfortunately, scalafmt broke the version field which means
we cannot fully preserve the rest of the config. I’ve made some
attempts to stay reasonably close to the original config but couldn’t
find an exact equivalent in a lot of cases. I don’t feel strongly
about any of the settings so happy to change them to something else.

As announced, this will be merged on Saturday to avoid too many conflicts.

changelog_begin
changelog_end
2021-01-09 11:37:37 +01:00
Moritz Kiefer
424faa923a
Port damlc dependencies to Scala 2.13 (#8423)
* Port damlc dependencies to Scala 2.13

I got a bit fed up by the fact that going directory by directory
didn’t really work since there are two many interdependencies in
tests (e.g., client tests depend on sandbox, sandbox tests depend on
clients, engine tests depend on DARs which depend on damlc, …).

So before attempting to continue with the per-directory process, this
is a bruteforce approach to break a lot of those cycles by porting all
dependencies of damlc which includes client bindings (for DAML Script)
and Sandbox Classic (also for DAML Script).

If this is too annoying to review let me know and I’ll try to split it
up into a few chunks.

changelog_begin
changelog_end

* Update daml-lf/data/src/main/2.13/com/daml/lf/data/LawlessTraversals.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* fixup lawlesstraversal

changelog_begin
changelog_end

* less iterator more view

changelog_begin
changelog_end

* document safety of unsafeWrapArray

changelog_begin
changelog_end

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2021-01-08 07:22:38 +01:00
Moritz Kiefer
19c66d1a9c
Drop unused Source.empty (#8383)
changelog_begin
changelog_end
2021-01-05 08:30:53 +01: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
Matthias Schmalz
6bdfadd06c
Shutdown the GrpcServer and LedgerClient, even if there are active subscriptions (#8279)
* Shutdown the GrpcServer and LedgerClient, even if there are active subscriptions.
* Shutdown ledger client in navigator integration test.
* When shutting down GrpcServer, await termination for 1 second to give the reset service time to gracefully complete an ongoing reset request.

changelog_begin
changelog_end
2020-12-18 14:02:38 +01:00
Moritz Kiefer
7e05dc7932
Upgrade rules-scala and scalatest (#8187)
This is necessary to at least attempt an upgrade to 2.13 and
generally, I want to keep our rulesets up2date. rules-scala forces the
version of scalatest so we have to bump that at the same time.

This requires changes to basically all Scala test suites since the
import structure has changed and a bunch of things (primarily
scalacheck support) got split out.

Apologies for the giant PR, I don’t see a way to keep it smaller.

changelog_begin
changelog_end
2020-12-08 06:59:23 +01:00
Robert Autenrieth
56f5cf107b
Prepare the ledger API for multi-party submissions [KVL-710] (#8125)
* Add multi-party submissions to the ledger API

CHANGELOG_BEGIN
* [Ledger API] Command submission requests now contain new optional
  fields used for multi-party submissions. Such submissions currently
  return UNIMPLEMENTED errors, they will be enabled in the future.
CHANGELOG_END

* Adapt Haskell bindings

* Handle the new ledger API fields

* Fix SubmitAndWaitDummyCommand

* Remove unused methods

* Redesign multi-party auth tests

* Remove direct access of request party

* Apply review comments

* Improve protobuf comments

* Multi-party tracker map

* Fix validation logic

* Consistent metric naming
2020-12-07 16:17:05 +01:00
Kamil Bożek
ef6fdc2306
Certificate revocation checks using the OCSP [KVL-713] (#7965)
Adds TLS certificates revocation checking in the LedgerApiServer using the OCSP.

The feature is implemented by setting global JVM properties.
Integration tests for the new feature include spinning up a local OCSP responder using the openssl command.

CHANGELOG_BEGIN

- new CLI option --cert-revocation-checking for enabling the TLS certificate revocation checking in the LedgerApiServer
- documentation about the new feature

CHANGELOG_END
2020-11-25 14:28:32 +01:00
Matthias Schmalz
82eaef5402
Updated documentation of CommandClient.trackCommands(Unbounded) (#7998)
* Do not backpressure from the command tracker output to the submission flow.
This is required to meet the contract of CommandClient.trackCommandsUnbounded, which allows for submitting an unbounded number of commands.
This is in turn required to use CommandClient.trackCommandsUnbounded as part of a flow that retries (some of the) failed command submissions.

CHANGELOG_BEGIN
CHANGELOG_END

* Revert "Do not backpressure from the command tracker output to the submission flow. This is required to meet the contract of CommandClient.trackCommandsUnbounded, which allows for submitting an unbounded number of commands. This is in turn required to use CommandClient.trackCommandsUnbounded as part of a flow that retries (some of the) failed command submissions."

This reverts commit 20c0b8e3

* Adding a disclaimer to the CommandClient so that users are not totally surprised about unexpected backpressure.
2020-11-19 16:55:10 +00:00
Kamil Bożek
9a2317cbdb
API version service [KVL-541] (#7792)
This change exposes a new endpoint with information about the ledger API version.
The current approach is to read contents of ledger-api/VERSION and provide it as it is to the user.

CHANGELOG_BEGIN
- ledger API version endpoint
CHANGELOG_END
2020-10-27 17:47:44 +01:00
Samir Talwar
7f679b9896
resources: Customizable contexts. (#7678)
* resources: Move builders into //ledger/ledger-resources.

Keep the actual constructors in a trait, but instantiate it when working
with ledger code.

This allows us to later introduce an extra "context" type parameter to
ResourceOwner.

* resources-akka: Move the builders in to //ledger/ledger-resources.

* resources: Introduce an abstract `Context` parameter for owners.

This replaces the concrete `ExecutionContext`. While it _can_ be an
execution context, it really doesn't matter as long as we can get at one
somehow.

This is being introduced so we can wrap the context in a container,
either for type tagging or to include extra information.

Because our current context _is_ `ExecutionContext`, and an implicit is
provided to extract it, we can end up with two ways to get the same
value. We use shadowing to prevent this. This problem should go away in
the near future when a new context type is added.

CHANGELOG_BEGIN
- [Integration Kit] The `ResourceOwner` type is now parameterized by a
  `Context`, which is filled in by the corresponding `Context` class in
  the _ledger-resources_ dependency. This allows us to pass extra
  information through resource acquisition.
CHANGELOG_END

* ledger-resources: Move `ResourceOwner` here from `resources`.

* ledger-resources: Remove dependencies from outside //ledger.

* ledger-resource: Wrap the acquisition execution context in `Context`.

So we can add a logging context to it.

* resources: Pass the Context, not the ExecutionContext, to Resource.

* Avoid importing `HasExecutionContext`.

* ledger-resources: Publish to Maven Central.

* resources: Make the small changes suggested by @stefanobaghino-da.

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

* ledger-resources: Pull out a trait for test resource contexts.

Saves a few lines of code.

* Restore some imports that were accidentally wildcarded.

* resources: Replace an `implicit def` with a couple of imports.

* participant-integration-api: Simplify the JdbcLedgerDaoBackend tests.

Try and use the right execution context where possible.

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-10-20 09:26:28 +00:00
Stephen Compall
bafde51752
add silent_annotations option to da_scala bazel functions (#7668)
* add silent_annotations option to da scala bazel functions

* use silent_annotations for several scala targets

* use silencer_plugin instead when the lib isn't used

* use silent_annotations for several more scala targets

* use silencer_lib for strange indirect requirement for running tests

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* silent_annotations support for scaladoc
2020-10-13 15:44:16 +00:00
Stephen Compall
1a2afd5266
upgrade to Scala 2.12.12 from 2.12.11 (#7661)
* upgrade bazel settings to scala 2.12.12

* upgrade nix scala tool to scala 2.12.12

* upgrade silencer references to scala 2.12.12

* repin for scala 2.12, silencer, wartremover upgrades

* remove numerous occurrences of unused silencer now spotted

* update Scala version in our bazel notes

CHANGELOG_BEGIN
CHANGELOG_END

* update compatibility maven_install.json to match compatibility WORKSPACE
2020-10-13 08:42:14 -04:00
Stefano Baghino
26263b6999
Instrument command service queues [KVL-519] (#7576)
* [KVL-519] Instrument command service queues

changelog_begin
changelog_end

* Instrument max-in-flight queue

* Document inputBuffer and maxInFlight metrics

changelog_begin
[Sandbox] New metrics tracking the pending submissions and completions on the
CommandService. Check out the Metrics session in the sandbox documentation
for more details. The new metrics are input_buffer_size, input_buffer_saturation,
max_in_flight_size and max_in_flight_saturation.
changelog_end

* Fix compilations issues (1)

* Fix title underline in docs

* Refactoring of InstrumentedSource

- Rename saturation/size to length/capacity to make it more obvious what they are.

- Move the InstrumentedSource to ledger/metrics. Fits there better, with the utilities
  there already for futures. Arguable both should move into libs-scala package at some point though.

- Expand the tests and make the tests less flaky. 200 runs complete fine now.

- Inc/dec the capacity counter within InstrumentedSource.

* Add missing copyright header

* Reformat

* Update ledger/metrics/src/test/scala/com/daml/metrics/InstrumentedSourceSpec.scala

Co-authored-by: hanshoglund-da <67470727+hanshoglund-da@users.noreply.github.com>

* Fix title underline in docs (again)

Co-authored-by: Jussi Maki <jussi.maki@digitalasset.com>
Co-authored-by: hanshoglund-da <67470727+hanshoglund-da@users.noreply.github.com>
2020-10-07 11:54:23 +00:00
Samir Talwar
f0c1eb207c
concurrent: Tag DirectExecutionContext. (#7517)
* concurrent: Tag DirectExecutionContext.

1.  Tag `DirectExecutionContext` as `ExecutionContext[Nothing]`, thereby
    stating that it works for any tagged `Future`.
2.  Move `DirectExecutionContext` to the _libs-scala/concurrent_
    library, as it requires it and it's tiny.

CHANGELOG_BEGIN
CHANGELOG_END

* concurrent: Fix the privacy of `DirectExecutionContextInternal`.

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-09-29 17:23:57 +00:00
Samir Talwar
2b3cf1b3c0
ledger-api-client: Rename maxInboundMessageSize to maxInboundMetadataSize. (#7290)
* ledger-api-client: `maxInboundMessageSize` -> `maxInboundMetadataSize`.

CHANGELOG_BEGIN
- [Scala Bindings] Rename a field in the ``LedgerClientConfiguration``
  to ``maxInboundMetadataSize``, to match the builder Netty channel
  builder. It was incorrectly named ``maxInboundMessageSize``, which is
  a different channel property that configures the maximum message size,
  not the header size.
CHANGELOG_END

* ledger-api-client: Introduce a `maxInboundMessageSize` config property.

We use this a lot; easier if it's in the configuration.

CHANGELOG_BEGIN
- [Scala Bindings] Replace the
  ``LedgerClientConfiguration.maxInboundMessageSize`` property with a
  new one that represents the maximum size of the response body.
CHANGELOG_END
2020-09-02 08:41:34 +00:00
Samir Talwar
19efca8028
ledger-api-client: Do not release resources on a shutdown hook. (#7288)
The executor may no longer be available. Fortunately we can avoid using
resources entirely in this case, and just acquire the channel the
old-fashioned way.

CHANGELOG_BEGIN
- [Scala Bindings] Fixed a bug in the ledger client which meant that the
  client was not closed properly on application shutdown. You may have
  seen some ``RejectedExecutionException`` errors in your logs if this
  has affected you. We encourage all users of the `LedgerClient` to call
  the ``close`` method explicitly to ensure it is closed at an
  appropriate time in your application lifecycle.
CHANGELOG_END
2020-09-01 08:51:15 +00:00
Samir Talwar
30564a7c90
ledger-api-client: Add test cases for LedgerClient. (#7195)
* ledger-api-client: Add integration tests for the simple stuff.

* sandbox-common: Make `SandboxFixtureWithAuth` a mixin.

This makes it useful with `SandboxNextFixture` as well as
`SandboxFixture`.

Also, add types to non-private fields and methods, and make more fields
protected rather than public.

* ledger-api-client: Add tests to make sure the token is passed through.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox-common: Tokens are for auth, not auth.
2020-08-20 15:00:32 +00:00
Samir Talwar
27f76c4386
Use Future.unit instead of Future.successful(()). (#7080)
And in one instance, `Resource.unit`.

I just think it's easier to read. Too many parentheses make Samir a dull
boy.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-11 09:18:50 +00:00
Stephen Compall
96624a7677
use -Ywarn-unused for all Scala code (#6907)
* add -Ywarn-unused to all scalac options

* remove some unused arguments

* remove some unused definitions

* remove some unused variable names

* suppress some unused variable names

* changeExtension doesn't use baseName

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* work around no plugins in scenario interpreter perf tests

* remove many more unused things

* remove more unused things, restore some used things

* remove more unused things, restore a couple signature mistakes

* missed import

* unused argument

* remove more unused loggingContexts

* some unused code in triggers

* some unused code in sandbox and kvutils

* some unused code in repl-service and daml-script

* some unused code in bindings-rxjava tests

* some unused code in triggers runner

* more comments on silent usages

- suggested by @cocreature; thanks

* fix missing reference in TestCommands

* more unused in triggers

* more unused in sandbox

* more unused in daml-script

* more unused in ledger-client tests

* more unused in triggers

* more unused in kvutils

* more unused in daml-script

* more unused in sandbox

* remove unused in ledger-api-test-tool

* suppress final special case for codegen unused warnings

.../com/daml/sample/mymain/ContractIdNT.scala:24: warning: parameter value ev 0 in method ContractIdNT Value is never used
      implicit def `ContractIdNT Value`[a_a1dk](implicit `ev 0`: ` lfdomainapi`.Value[a_a1dk]): ` lfdomainapi`.Value[_root_.com.daml.sample.MyMain.ContractIdNT[a_a1dk]] = {
                                                         ^
.../com/daml/sample/mymain/ContractIdNT.scala:41: warning: parameter value eva_a1dk in method ContractIdNT LfEncodable is never used
      implicit def `ContractIdNT LfEncodable`[a_a1dk](implicit eva_a1dk: ` lfdomainapi`.encoding.LfEncodable[a_a1dk]): ` lfdomainapi`.encoding.LfEncodable[_root_.com.daml.sample.MyMain.ContractIdNT[a_a1dk]] = {
                                                               ^

* one more unused in daml-script

* special scaladoc rules may need silencer, too

* unused in compatibility/sandbox-migration

* more commas, a different way to `find`

- suggested by @remyhaemmerle-da; thanks
2020-08-07 13:16:09 -04:00
Stephen Compall
c3e79878ff
remove unused definitions, params, args from ledger API Scala code (#6985)
* remove unused definitions, params, args from ledger API Scala code

CHANGELOG_BEGIN
- [Ledger API] withTimeProvider removed from CommandClient; this method
  has done nothing since the new ledger time model was introduced in
  1.0.0.  See `issue #6985 <https://github.com/digital-asset/daml/pull/6985>`__.
CHANGELOG_END

* percolate withTimeProvider and label removal elsewhere
2020-08-04 18:02:19 +00:00
Samir Talwar
d6fc2bbb58
ledger-api-client + participant-integration-api: Increase the default maximum inbound error size, and truncate errors well before that. (#6807)
* participant-integration-api: `GrpcServerOwner` -> `GrpcServer.Owner`.

Mostly so I can create a test class named `GrpcServerSpec`.

* ports: Move the free port search from postgresql-testing.

* participant-integration-api: Test the basics of GrpcServer.

This uses the HelloService to make sure the server behaves normally.

* ledger-api-client: Extract out channel configuration from LedgerClient.

So we can test it independently of the LedgerClient itself.

* ledger-api-client: Increase the default maximum inbound header size.

Increased from 8 KB to 1 MB.

* participant-integration-api: Reduce the maximum error message size.

Truncate GRPC error descriptions to 256 KB.

* participant-integration-api: Use `Port.Dynamic` instead of `FreePort`.

In tests.

* participant-integration-api: Explicit null checks when they're shorter.

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

* ledger-api-client: Reduce the max inbound message size back to 8 KB.

And reduce the maximum size of an error description pushed out by the
server accordingly.

CHANGELOG_BEGIN
- [Integration Kit] Truncate GPRC error messages at 4 KB. This ensures
  that we won't trigger a protocol error when sending errors to the
  client.
CHANGELOG_END

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-07-21 15:50:33 +00:00
Robert Autenrieth
7ce9748066
Split sandbox code into separate packages (#6695)
* Move public code into daml-integration-api

CHANGELOG_BEGIN
[DAML Integration Kit]: Removed sandbox specific code from the API intended to be used by ledger integrations. Use the maven coordinates ``com.daml:participant-integration-api:VERSION`` instead of ``com.daml:ledger-api-server`` or ``com.daml:sandbox``.
CHANGELOG_END
2020-07-17 17:06:06 +02:00
Stephen Compall
86148c398b
make @silent annotations narrower (#6570)
* check that all @silent annotations are used

CHANGELOG_BEGIN
CHANGELOG_END

* make all @silent annotations very specific about what they're silencing
2020-07-01 20:53:22 +00:00
Remy
46b68bd92a
ledger test tool: refactor conformance test dars (#6506)
* ledger test tool: refactor conformance test dars

CHANGELOG_BEGIN
CHANGELOG_END
2020-06-26 13:39:00 +02:00
Stephen Compall
a51d0db8ff
set scalac -Xsource:2.13 -Ypartial-unification globally (#6469)
* add -Xsource:2.13, -Ypartial-unification to common_scalacopts

* add now-referenced scalaz-core where needed

* work around bad type signatures in scalatest Aggregating, Containing

* unused Any suppression

* work around bad partial-unification wrought by type alias

* remove unused Conversions import

- not required in 4f68cfc480 either, so unsure how it's survived this long

* work around Future.traverse; remove unused show import

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* remove unused bounds

* remove -Ypartial-unification and -Xsource:2.13 where they were explicitly passed

* longer comment on what the options do

- suggested by @stefanobaghino-da; thanks

* forget Future.traverse, just use scalaz, it knows how to do this
2020-06-24 16:51:24 -04:00
daravep
39c589af7a
Added minor logging to scala command client (#5906)
* Added minor logging to scala command client

Before, the scala command client did not log anything when a command was
leaving the application. Now, we get a small debug message that logs the
command id, which is going to be helpful for debugging and tracing
purposes.

CHANGELOG_BEGIN
CHANGELOG_END

* Addressed reviewer comments

* Fixed formatting
2020-06-16 08:34:12 +00:00
Samir Talwar
5399f3ff44
ledger-api-client: More backwards-compatibility. (#6346)
Let's not break others' code until they've had a chance to migrate.
This changes `LedgerIdRequirement` so that properties don't change
types, and adds `@deprecated` where necessary.

There is one behavior change: `ledgerId` used to return whatever string
was passed in (typically `""`) if the requirement was not enabled. It
now throws an exception.

In the future, we will change the type of `ledgerId` to be
`Option[String]`, and make `optionalLedgerId` an alias for that
property.

CHANGELOG_BEGIN
CHANGELOG_END
2020-06-15 14:26:13 +00:00
Samir Talwar
858dbc67fd
ledger-api-client: Support legacy LedgerApiRequirement#copy behavior. (#6330)
* ledger-api-client: Clarify LedgerIdRequirementTest names.

* ledger-api-client: Re-add the old `LedgerApiRequirement#copy` behavior.

This is used by some users; we don't want to break their code if we can
help it.

CHANGELOG_BEGIN
- [Ledger API Client] The signature of `LedgerApiRequirement` has
  changed slightly. The old signature is now deprecated.
CHANGELOG_END

* ledger-api-client: Test deprecated LedgerApiRequirement behavior.
2020-06-15 07:56:36 +00:00
Simon Maxen
5329a4f97f
Ledger id requirement (#6323)
* Add option based constructor for LedgerIdRequirement

changelog_begin
changelog_end

* Make option based consructor the default, deprecate old constructor

* Update with review comments
2020-06-12 15:00:32 +00:00
Stephen Compall
15350a7bc2
disable warts.Any and remove most suppressions (#6132)
* disable Any wart

* first pass removal of Any suppressions for false positives

* second pass removal of Any suppressions for false positives

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* third pass removal of Any suppressions for false positives

* fourth pass removal of Any suppressions for false positives

* reformat newly single-suppressions into single lines

- suggested by @SamirTalwar-DA; thanks
2020-05-28 16:53:41 +00:00
Stefano Baghino
9af85e56e9
Introduce DAML-LF value caching for transaction service (#6052)
* Introduce DAML-LF value caching for transaction service

Allows to keep the DAML-LF values in the most recently indexed events in memory,
so that they don't have to be deserialized on the client from their Protobuf encoding.

Closes #6044

CHANGELOG_BEGIN
[Sandbox] The --max-lf-value-translation-cache-entries option allows to set a
number of events for which DAML-LF values are cached. Could reduce latency in
serving transactions for consumers that are reasonably fast.
CHANGELOG_END

* Add missing dependency

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428076003

* Update ledger/sandbox/src/main/scala/com/digitalasset/platform/sandboxnext/Runner.scala

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428071324

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428076905

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428081294

* Fix fatal warnings

* //ledger/caching has to be used whenever sandbox is run

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-05-26 08:33:53 +00:00
Samir Talwar
d76c4ec949
ledger-api-client: Make it Closeable. (#6014)
CHANGELOG_BEGIN
- Add `LedgerClient#close`, which will shut down the channel and await
  termination. This is optional; the channel will still be shut down on
  JVM exit if this method is not called.
CHANGELOG_END

This is offered as a compromise for those who would like to ensure
resources are shut down cleanly, while not making the API more
complicated. I originally wanted to make `LedgerClient.fromBuilder`
return a `Resource[LedgerClient]`, but the `Resource` API would lead to
an increased learning curve for users.
2020-05-19 08:09:01 +00: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
Gerolf Seitz
5ddbd5c511
Implement timed command deduplication in kvutils (#5242)
* Implement timed command deduplication in kvutils

This adds a field deduplication_time to DamlCommandDedupValue for
deduplication timeout checking.

* Bump kvutils version to 4

* Fix CommandTracker pulling commandResultIn multiple times
Now that the timeouts are generated out of band, we have 2
"unsynchronized" places that pull on commandResultIn.
Whenever we pull, we need to check that commandResultIn hasn't been
pulled before.

* Add inStaticTimeMode flag to enable command dedup in sandbox-next with static-time

Fixes #4624.

CHANGELOG_BEGIN
[kvutils] KVUtils now respects the command deduplciation time instead of
deduplicating commands forever.
CHANGELOG_END
2020-04-03 10:44:35 +02:00
Gerolf Seitz
329320bad9
Organize maven coordinates (#5272)
* Use com.daml as groupId for all artifacts

CHANGELOG_BEGIN
[SDK] Changed the groupId for Maven artifacts to ``com.daml``.
CHANGELOG_END

* Add 2 additional maven related checks to the release binary

1. Check that all maven upload artifacts use com.daml as the groupId
2. Check that all maven upload artifacts have a unique artifactId

* Address @cocreature's comments in https://github.com/digital-asset/daml/pull/5272#pullrequestreview-385026181
2020-04-01 11:41:18 +02:00
Remy
1b37f6c482
DAML-LF: redesign absolute contract ids (#5207)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 19:07:42 +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
Robert Autenrieth
a3ddde3a9d
Remove MRT and LET (#5172)
Contributes to #4194.
Closes #4231.
Closes #5022.
CHANGELOG_BEGIN
- [Ledger API] The protobuf fields ledger_effective_time and maximum_record_time have been removed from
  command submission. These fields were previously deprecated following the introduction
  of a new ledger time model. See issue `#4194 <https://github.com/digital-asset/daml/issues/4194>`__.
[Java Bindings] removed the usage of ledgerEffectiveTime and
maximumRecordTime, and instead added minLedgerTimeAbsolute and
minLedgerTimeRelative in CommandSubmissionClient and CommandClient
CHANGELOG_END
2020-03-25 16:50:27 +01:00
Robert Autenrieth
3f597aae16
New ledger time (#5100)
* Tighten result type

Command execution can't result in a sequencer error

* New helper method for extracting used contracts

* New error clause

* Add a DAO query for the maximum time of contracts

* Implement algorithm for finding ledger time

CHANGELOG_BEGIN
CHANGELOG_END

* fixup ledgerTimeHelper

* Use new ledger time algorithm

* Mark LET/MRT as deprecated

CHANGELOG_BEGIN
- [Ledger API] DAML ledgers have switched to a new ledger time model.
  The ledger_effective_time and maximum_record_time fields of command submission are deprecated,
  the ledger time of transactions is instead set automatically by the ledger API server.
  Ledger time is no longer strictly monotonically increasing, but only follows causal monotonicity:
  ledger time of transactions is greater than or equal to the ledger time of any used contract.
  See `#4345 <https://github.com/digital-asset/daml/issues/4345>`__.
CHANGELOG_END

* Add ledger time skew check

* Remove command updater

LET/MRT are now deprecated, this class is now useless

* Remove old time model validator

* Switch to new time model check: kvutils

* Switch to new time model check: in-memory ledger

* Switch to new time model check: SqlLedger

* Use initial ledger config

* Ignore user provided LET

* Use TimeProvider in submission services

* Use deduplication_time in daml-script runner

- Also remove unnecessary command completion output of CommandTracker.
- Remove usage of maximum record time in CommandTracker.

* Use arbitrary default value for deduplication time

* Use built-in Instant ordering

* Remove obsolete test

* Remove obsolete test: CommandStaticTimeIT

* Refactor test: TransactionMRTCompliance

* Disable test: CommandTrackerFlow timeout

* thread maxDeduplicationTime through to CommandTracker

* Improve test

* Refactor command client configuration

* Deduplication time should always use UTC

* Add missing method in TimedIndexService after rebase

* Put more details into the deduplication error response.

* Use system time for command dedup submittedAt.

* Use explicit UTC time source in command validator

* Revert CommandTracker[Flow] to previous completion-recovering-behavior

* Adapt scala client command config to new config params

Co-authored-by: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2020-03-25 09:28:56 +01:00
Leonid Shlyapnikov
acb41c5829
Fetch by parties endpoint to use new getParties gRPC call (#5027)
* fetch by parties endpoint to use new getParties gRPC call

changelog_begin
changelog_end

* addressing code review comments, thanks @S11001001 and @SamirTalwar-DA

* Update ledger/ledger-api-client/src/main/scala/com/digitalasset/ledger/client/services/admin/PartyManagementClient.scala

thanks @S11001001

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

* addressing code review comments, thanks @S11001001 and @SamirTalwar-DA

* addressing code review comments, thanks @S11001001 and @SamirTalwar-DA

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-03-16 16:42:01 -04: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
Samir Talwar
a589f4af0b
sandbox: Move more resource acquisition into the owner. (#4501)
* sandbox: Move more resource acquisition into the `owner`.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox: Reimplement SandboxClientResource as a resources.Resource.

* codegen: Use resources in TestUtil.

* sandbox: Manage PostgreSQL in tests with ResourceOwners.
2020-02-14 13:52:45 +00:00
Remy
4137ff510b
[Engine] Adding a specific type for ParticipantId (#4504)
CHANGELOG_BEGIN
CHANGELOG_END
2020-02-13 17:15:34 +01:00
Stefano Baghino
89f0deda7d
Fix command client integration test flakiness (#4050)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-15 10:19:19 +01:00
Andreas Herrmann
f33e79c787
Remove unused dependencies to da_scala_library (#3938)
* Inline all scala_library dependencies

* Run //:buildifier-fix

* TMP scala_library_suite --> scala_library

* da_scala_library: Enable unused dependency checker

* scala_library: Enable unused dependency checker

* //daml-lf/data:data

* //daml-lf/engine:engine

* //ledger-api/rs-grpc-akka:rs-grpc-akka

* //ledger/participant-state:participant-state

* //ledger/ledger-api-client:ledger-api-client

* //scala-protoc-plugins/scala-logging:scala-logging-lib

* //ledger/ledger-api-scala-logging:ledger-api-scala-logging

* //ledger/ledger-api-common:ledger-api-common

* //ledger-service/utils:utils

* //ledger-service/jwt:jwt

* //ledger/ledger-api-auth:ledger-api-auth

* //extractor:extractor

* //daml-assistant/scala-daml-project-config:scala-daml-project-config

* //language-support/codegen-common:codegen-common

* //language-support/scala/codegen:codegen

* //language-support/codegen-main:codegen-main-lib

* //ledger-service/db-backend:db-backend

* //ledger-service/http-json:http-json

* //daml-lf/scenario-interpreter:scenario-interpreter

* //ledger/sandbox:sandbox

* //navigator/backend:navigator-library

* //daml-assistant/daml-sdk:sdk-lib

* //daml-lf/data-scalacheck:data-scalacheck

* //daml-script/test:test-lib

* //ledger/ledger-api-common:ledger-api-common-scala-tests-lib

* //ledger/test-common:test-common

* //ledger/sandbox:sandbox-scala-tests-lib

* //extractor:extractor-scala-tests-lib

* //language-support/java/bindings:bindings-java-tests-lib

* //language-support/java/bindings-rxjava:bindings-java-tests-lib

* //language-support/scala/bindings-akka-testing:bindings-akka-testing

* //language-support/scala/codegen-testing:codegen-testing

* //language-support/scala/codegen-sample-app:daml-lf-codegen-sample-app

* //language-support/scala/codegen-sample-app:daml-lf-codegen-sample-app-testing

* //language-support/scala/codegen-testing:codegen-testing-testing

* //ledger-api/sample-service:sample-service

* //ledger-api/rs-grpc-akka:rs-grpc-akka-tests-lib

* //ledger/ledger-api-test-tool:ledger-api-test-tool-lib

* //ledger/ledger-api-test-tool:ledger-api-test-tool-tests

* //ledger/participant-state/kvutils:kvutils

* //ledger/sandbox:ledger-api-server

* //ledger/sandbox-perf:sandbox-perf-lib

* //navigator/backend:navigator-tests-library

* UNDO scala_library_suite --> scala_library

This reverts commit ab3eb1ae23139e2ec431ab4551fbb0371e0354e1.

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-06 18:14:21 +01:00
Andreas Herrmann
6e25d10fe2
daml test-script (#3918)
* Start on daml test-scripts

* Run all `Script a` as test cases

* LedgerClient: Expose PackageManagementClient

To enable DAR uploads

* Upload the DAR to the ledger

* Start sandbox if no ledger specified

* Format daml test-script

* Fix deprecation warning on ActorMaterializer

* Add test-case //daml-script/tests:test_daml_script_test_runner

* Add daml test-script command

CHANGELOG_BEGIN

- [DAML Script - Experimental] Allow running DAML scripts as test-cases.
  Executing ``daml test-script --dar mydar.dar`` will execute all
  definitions matching the type ``Script a`` as test-cases.
  See `#3687 <https://github.com/digital-asset/daml/issues/3687>`__.

CHANGELOG_END

* daml-test-script enable logging

* Remove outdated TODO comment

* daml script-test More elaborate test-caseo

Compare to expected output and add failing test-case

* daml test-script Don't abort on test-failure

Before the test runner would abort on the first failed test-case. This
occasionally introduce additional test-failures if the sandbox was
torn down half-way through execution.

* ./fmt.sh

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-03 15:01:36 +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
9fbb787062 Remove unused dependencies to da_scala_test(_suite) (#3925)
* Remove unused scala.bzl imports

* override_targets org.scalatest.scalatest_2.12

Otherwise, rules_scala implicitly adds a different version to scala_test
than other packages transitively depending on scalatest. This causes
unused dependency checker to raise an error.

* Handle rules_scala scalatest in pom_file.bzl

* Inline all scala_test dependencies

So that `unused_dependency_checker = "error"` can be applied to them.

* Run //:buildifier-fix

* TMP scala_test_suite --> scala_test

* da_scala_test: Enable unused dependency checker

* //navigator/backend:navigator-scala-tests

* //ledger/sandbox:sandbox-scala-tests

* //ledger/participant-state/kvutils:kvutils-tests

* //ledger/participant-state:participant-state-tests

* //ledger/ledger-api-scala-logging:ledger-api-scala-logging-test

* //ledger/ledger-api-common:ledger-api-common-scala-tests

* //ledger/ledger-api-client:ledger-api-client-tests

* //ledger/ledger-api-auth:ledger-api-auth-scala-tests

* //ledger-service/lf-value-json:tests

* //ledger-service/jwt:tests

* //ledger-service/http-json:tests

* //ledger-api/rs-grpc-akka:rs-grpc-akka-tests

* //language-support/scala/codegen-sample-app:tests

* //language-support/scala/codegen-sample-app:ScalaCodeGenIT

* //language-support/scala/codegen:tests

* //language-support/scala/bindings-akka:tests

* //language-support/java/codegen:test

* //language-support/java/codegen:ledger-tests

* //language-support/java/bindings-rxjava:bindings-java-tests

* //language-support/codegen-common:test

* //extractor:extractor-scala-tests

* //daml-lf/scenario-interpreter:scenario-interpreter_tests

* //daml-lf/language:language-test

* //daml-lf/interface:tests

* //daml-lf/engine:tests

* //daml-lf/encoder:tests

* //daml-lf/archive:daml_lf_archive_reader_tests

* //daml-assistant/scala-daml-project-config:scala-daml-project-config-tests

* UNDO scala_test_suite --> scala_test

This reverts commit 13ed47ba725e944533ca1157a070cb8dc30569ac.

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2019-12-30 13:49:59 +00:00
Stefano Baghino
7020ed3b15
Moves CommandCompletionIT to Ledger API Test Tool (#3901)
* Moves CommandCompletionIT to Ledger API Test Tool

Closes #2841

Also refactors test observers into a single API and unifies the existing implementations of the DirectExecutionContext

* Allow explicit offsets to get checkpoints

* Raise checkpoint test timeout

* Consolidate checkpoint tests in a single test case

* Fix compilation issues

* Exclude command submission/completion tests for rev-v2

* Drop test not relevant for Ledger API implementations

* Fix compilation errors
2019-12-20 15:55:23 +01:00
Brian Healey
9f13a2fb10 Upgrade to Akka 2.6.1, akka-http 10.1.11 and Scala 2.12.10 (#3903)
* Upgrade to Akka 2.6.1, akka-http 10.1.11 and Scala 2.12.10

Akka 2.6.1 Upgrade Changes
- Materializer in place of ActorMaterializer
- Source.future instead of Source.fromFuture
- The Scheduler.schedule method has been deprecated in favor of selecting scheduleWithFixedDelay or scheduleAtFixedRate
- onDownstreamFinish(cause: Throwable)
- ActorAttributes.supervisionStrategy(...) in place of ActorMaterializerSettings.withSupervisionStrategy

See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html

* Akka 2.6.1 Upgrade Changes
- onDownstreamFinish(cause: Throwable)

See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html

* code review: remove unnecessary supervision strategy
2019-12-19 18:00:59 +00:00
Moritz Kiefer
4ad3a22c90
Bump timeout in CommandClientIT (#3879)
This test suite was introduced in #3870 and seems to be extremely
flaky both locally (I get about 16/20 failures) and on CI.

The error is

  - should return completions of commands that are submitted after subscription *** FAILED *** (4 seconds, 945 milliseconds)
    Set() did not contain all elements of List("5104", "5100", "5105", "5109", "5103", "5106", "5107", "5102", "5108", "5101") (CommandClientIT.scala:330)

After bumping the timeout, I don’t get any failures locally.

Happy to choose another timeout, I have no clue what a sensible value
is here.
2019-12-18 09:11:47 +01:00
Stefano Baghino
699fef1f3a
Move Scala Ledger API client integration tests (#3870)
* Move Scala Ledger API client integration tests

Closes #2845

The Scala Ledger API client tests belong to the
//ledger/ledger-api-client package.

* Reduce noise coming from tests
2019-12-17 16:11:27 +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
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
Stefano Baghino
0a3636ec69 Authenticated ledger identifier call in LedgerClient (#3426) 2019-11-12 09:36:54 +00:00
Stefano Baghino
667ffd5c47
Improve LedgerClient (#3419) 2019-11-12 00:09:59 +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
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
Gerolf Seitz
9750ccf716
Navigator properly sets the max incoming message size again. (#3302)
The symptom for receiving messages larger than the configured maxInboundMessageSize is a
gRPC error like:

Oct 31, 2019 1:52:37 PM io.grpc.internal.AbstractClientStream$TransportState inboundDataReceived
INFO: Received data on closed stream

Fixes #3301.
2019-10-31 14:56:48 +01: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
Stefano Baghino
9571e29c7e
Allow Navigator to use authenticated Ledger API (#3138)
* Make Navigator authenticate with the participant

* Solve shadowed import warning

* Fix tests to work with new methods

* Optimize imports

* More imports optimizations

* Ensure plainText channel is used unless explicitly stated

* Work around a lack of APPDATA on CI

* Add docs

* Update release notes

* Update navigator/frontend/src/ui-core/src/session/UI.tsx

Co-Authored-By: Robert Autenrieth <31539813+rautenrieth-da@users.noreply.github.com>

* Address https://github.com/digital-asset/daml/pull/3138#discussion_r336403903

* Address https://github.com/digital-asset/daml/pull/3138#discussion_r336382140

* Address https://github.com/digital-asset/daml/pull/3138#discussion_r336383076

* Address https://github.com/digital-asset/daml/pull/3138#discussion_r336389886

* Address https://github.com/digital-asset/daml/pull/3138#discussion_r336391680
2019-10-18 15:39:42 +02:00
Gerolf Seitz
b70e289303 ActiveContractsService stream ow always returns at least 1 element (#2799)
This removes the need for clients to handle the special case where the
stream might be empty.
Now the clients can always assume that they receive at least one
response element in the stream.
2019-09-18 11:16:56 +00:00
Leonid Shlyapnikov
0960c49cff
LedgerClient JWT pass-through in the HTTP JSON API gateway (#2566)
* The first draft of LedgerClient JWT support

not integrated with HTTP JSON API gateway yet.

* JWT pass-through for create and exercise commands

* JWT pass-through for contracts search and lookup

* Removing unused class

* Readme updates
2019-08-17 06:54:05 -04:00
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
Stefano Baghino
afa4659292
New Ledger API test tool (#2282)
* New acceptance test tool prototype

* Fix transaction filter helper

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r308081386

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r308082432

Moreover, creates specific helpers for test DAML code.

* Move helpers from session to context

Remove a circular dependency between session and context, and limits the
usage of implicits.

* Run tests with ledgers out of process

* Prepare for drop in

* Temporary timeout increase

* Move bulk of the logic to the test runner

* Have a map of tests for CLI integration

* Timeout per-test, runner uses context, renaming

* Allow usage of time service, integrate semantic tests

* Integrate CLI SSL configuration

* Integrate failure expectation CLI option

* Integrate with failure output verbosity CLI option

* Integrate with test listing and picking CLI options

* Integrate with timeout scaling CLI option

* Integrate with command TTL CLI option

* Review CODEOWNERS

* Drop previously unimplemented CLI parameters

* Expand test todo list to encompass latest additions

* Deduplicate some testing infrastructure, swap in new test tool

* Remove unused rule

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311045444

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311051974

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311035287

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311055290

* WIP

* Make gRPC thread factory spawn non-deamon threads

* Remove debug prints, complete divulgence test (missing assertion messages)

* Try to detect assertion failure line number

* Add Sandbox binary that starts an ephemeral postgres instance

This allows us to use the client_server_test bazel macro to run against
the sandbox backed by postgres.

Fixes #1543

* Add Sandbox binary that starts an ephemeral postgres instance

This allows us to use the client_server_test bazel macro to run against
the sandbox backed by postgres.

Fixes #1543

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311400695

* Remove TlsConfiguration duplicate, move original to commons

* Make assertion more readable

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

* Fix build errors introduced in previous commit

- exclude time service tests from reference-v2
- add copyright header to TlsConfiguration

* Complete divulgence test and address review comments

Restores comments from original divulgence tests and strives to be as
close to them as possible.

- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311429169
- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431156
- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431913

* Delete old divulgence tests

* Restore methods to fetch contracts by template identifier

* Run conformance tests on in-memory sandbox

* Run conformance tests on the persistent sandbox

* Remove workflow identifier workaround

* New contract keys test (#2452)

* Set channel type for LedgerSession

* Add ContractKeysIT

* Run tests against reference-server v2

* Removed the old ContractKeysIT. However, ...

... I cannot remove ContractKeysChecks completely, because we have
another test path for DARs created prior to DAML-LF 1.6, which doesn't
have the submitter == maintainer restriction for contract keys.

* Use codegen instead of custom code

* Add missing copyright headers

* Drop sandbox conformance test suite (seems to not work on Windows CI)

* Make time simpler

* Test tool tests to run only semantic tests

* Make CI behave more consistently

* Add missing files to run tests on Postrgres

* Fix flaky divulgence test, introduce readable identifiers

* Increase sandbox conformance tests timeout

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r312363246

* Reintroduce test resource extraction

* Read semantic tests from the classpath rather than Bazel

* Use codegen types for ContractKeys integration test

allocateParty returns Primitive.Party and create and exercise also
accept Primitive.Party. This way we don't have to keep a String and
Primitive.Party representation around.

* Bump timeout for sandbox conformance tests

* Remove dependency on Bazel runfiles
2019-08-09 17:00:37 +02:00
Leonid Shlyapnikov
b940951a76
HTTP JSON API first version (#1994)
* Cleanup

* WIP

* first integration test + fixture

* minor cleanup

* Implementing ContractService.lookup

* Reverting back to endpoints.all (all2 did not work)

* Cleanup

* replace ApiValue ADT with aliases to daml-lf/transaction Value ADT

* porting rest of navigator to LF Value ADT

* Command Service WIP

* CommandService WIP

* porting more of navigator to LF Value ADT

* last error, not first

* rename ApiValueImplicits file

* special conversion features for ImmArray and FrontStack

- just .to[ImmArray] or .to[FrontStack] any random collection

* finish porting most of navigator main code

* use numeric indices for record field name fallback when pretty-printing

* tuples are not serializable

* use numeric indices for label fallback in JSON verbose encoding

* make traverseEitherStrictly more likely to preserve the seq's class

* to shortcut for ImmArraySeq .to[ImmArraySeq]

* compiling, passing navigator backend tests

* test traverseEitherStrictly more, er, strictly

* pass scalacopts through to scaladoc

* deal with unused warning

* remove unneeded function

* simpler error reporting, more private functions in ApiCodecCompressed

* move slowApply to FrontStack, test it so it actually works

* remove unneeded toStrings; better error from impossible ValueTuple case

* scalafmt FrontStackSpec

* support alternative, label-free record JSON encoding

* Adding domain.CreateCommand + corresponding json formats and dummy json format for lav1.value.Record

* CommandService.create should be done... need to test it

* TODO added

* Cleanup

* move ApiCodecCompressed, ApiValueImplicits, and some aliases to new lf-value-json package

* Using tagged TemplateId type instead of Identifier + exercise command WIP

* adapt navigator to moved pieces

* start defining scalacheck extension to ApiCodecCompressedSpec

* CommandService.exercise + introducing CommandMeta

* Adding command endpoints, can't test them yet, need lf value json formats

* fuse some list operations

- suggested by @stefanobaghino-da; thanks

* blue error message

* Minor fixes after merging librify-navigator-json-compressed, #2136

* experiment with an inductive case in TypedValueGenerators

* finish a List case for TypedValueGenerators; it's revealing

* Introducing API value to LF value converter,

CommandsValidator takes IdentifierResolverLike instead of IdentifierResolver

* cleanup

* remove accidentally readded duplicate aliases

* start tying knots in TypedValueGenerators

* verbatim copy ApiCodecCompressedSpec to lf-value-json

* shift some tests from navigator to lf-value-json

* test Optional and Map for ApiCodecCompressed

* heavier random testing of ApiCodecCompressed

* remove unused dependencies from lf-value-json

* adding value json writer

* cleanup

* Revert "cleanup"

This reverts commit 2e4d153f

* fixing the build

* cleanup

* cleaning up imports

* JsValue to API value is done, needs a test

* cleanup

* use scalac -Ypartial-unification in http-json

* simplify some Traverse instances

* factor CreateCommand and ExerciseCommand traverse instances

* Command create integration test WIP

* Command create integration test WIP, got rid of the JsonReader and JsonWriter for the values, converting values explicitly

* Extracting DomainJsonDecoder and DomainJsonEncoder

* LfV refactoring

* Create command serialize/deserialize test works

* cleanup

* resolving conflicts

* More json encode/decode tests

* logging

* command/create passes integration test now

* Adding readme

* grammar

* TODO added

* GetActiveContractsResponse encoding

* ideintifier conversion renaming

* PackageService resolveTemplateId returns domain.TemplateId now

* Resolving LF Identifier instead of Template ID, this should also work for Exercise command decoding

* cleaning up a bit

* daml-lf: show type in TypedValueGenerators-driven errors

* exercise command json encoding/decoding works

* command/exercise IOU_Transfer integration test passes now

* avoid filter for Gens; makes many contract ID gens not fail

* test ApiCodecCompressed against 100 random types, 20 random values each

* Updating README instructions

* improving error handling, failed futures, get logged and reported to the user now as 500

* [ROUTING DSL] Removing routing DSL, it did not work

* getting rid of HttpEntity.Strict match + cleanup

* fixing the merge conflict

* updating README

* use Show.shows instead of new Show

* List(_) isn't checked, but Seq(_) is slightly safer

* improving test assertions

* Adding /contracts/lookup implementation

* http-json: use ImmArraySeq instead of List; use toRightDisjuction

* http-json: .toList.toSet is shorter than fold

* http-json: replace .leftMap.map with .bimap

* http-json: use subst instead of reimplementing JsonFormat

* http-json: remove unused ExceptionHandler

* http-json: safer == comparison

* Adding two test cases for expected errors

* Adding BazelRunfiles.rlocation magic that supposed to handle windows path for bazel dependencies

* http-json: import, not extend
2019-07-29 16:49:57 -04:00
mziolekda
7e3d580768 Connect LedgerAPI party and package management with KVUtils (#1985)
* connenct LedgerAPI party and package management with KVUtils

* formatting

* address review comments

* add participantId parameter to sandbox and indexer

* annotate TODO's with github issue numbers
2019-07-05 15:31:17 +00:00
Gerolf Seitz
ab4c147cdb
Additional tests for ledger api test tool (#1792)
* Run integration tests for sandbox through the IT test suite

We currently don't run sandbox on postgres via ledger-api-test-tool. We
need to first figure out how to best do that before we can switch
sandbox to the test tool again.

* CommandClient#submitSingleCommand also uses commandUpdater

* The test reporter for the test tool now handles ignored tests

* More optional tests for ledger-api-test-tool

- TransactionBackpressureIT
- DivulgenceIT
- CommandTransactionChecksHighLevelIT
- CommandTransactionChecksLowLevelIT

Contributes to #1374.
2019-06-21 13:24:24 +02:00
Robert Autenrieth
c14b909c71 Implement package management API in the sandbox (#1610)
* store archive size in `DarReader`

* rename `SandboxTemplateStore` to `SandboxPackageStore`

* store package info in `SandboxPackageStore`

* introduce package upload / read to write / index services

not tested yet, just a ton of plumbing

* WIP test the package service

* Fix build errors after rebase

* Move packages service to v2

* Ledger API client uses ledger API types

* Fix ReflectionIT

* Correctly handle uploading invalid dar files

* Fix reading DAR entry file sizes

* Improve package management IT

* Improve handling of duplicate packages

* Fix language-support build

* Use unique party and command names

* Rename lfpackage to language

* Rename SandboxPackageStore to InMemoryPackageStore

* Remove getCurrentTime ledger method

* Improve package management IT

* Move InMemoryActiveContracts and InMemoryPackageStore

* Use case object for UploadDarResult.Ok

* Address review comments

* Update release notes

Fixes #1311

* Use BazelRunfiles in test
2019-06-19 12:31:53 +00:00
Robert Autenrieth
80e8ac113d
Add support for party management in the sandbox (#1452)
Fixes #1312

This PR adds support for party management in the sandbox:

Both the in-memory and the SQL backend track a list of known
parties, and implicitly add any party mentioned in a transaction.
New calls were added to the IndexService and the WriteService
for managing parties. These calls are wired to the above mentioned
persistence backends, and to a new API service.
A corresponding client interface was added to the scala API client.
An integration test was added for checking that a call to allocate a
party succeeds.
An integration test for the sandbox was added for checking that the
sandbox implicitly adds all parties mentioned in a transaction.
2019-06-11 08:08:55 +02:00
gleber
a69b4b8c86 Ledger API Tests: use real ledger ID everywhere. (#1400)
This fetches and caches ledger ID inside LedgerContext.SingleChannelContext to
reduce number of calls into the Ledger API under test.
2019-06-03 12:28:36 +02:00
Gabor Aranyossy
ff088efd94
porting API services to used Index Service v2 (#1362)
* moving to index service v2

* damlonx does not depend on v2 index service anymore

* leger -> ledger

* transacion id fix
2019-05-24 19:18:51 +02:00
Remy
4f18b1afa7 DAML-LF internal type safety (#1192)
* Rename Value's ContractId to VContractId

* daml-lf: a bit more about PartyId

* daml-lf: Concatenable MatchingStringModule

* daml-lf make clear type used for Scenarios only

* daml-lf create ContractId, LedgerId, TransactionId

* sandbox-sql conversion util

* LedgerName -> LedgerString

* futher type cleanup in the sandbox

* daml-lf add test for LedgerString

* fixing tests

* a bit more safety in the DB

* Address Stephen's comments

* fix rebase

* More fixes for StringModule

* change length of LedgerString (256 -> 255)
2019-05-24 09:53:29 +00:00
Gerolf Seitz
ecf6ece8c4
CommandService returns useful data for successful submissions (#875)
Submitting a command via the CommandService now returns either the
transaction id (SubmitAndWaitForTransactionId), the flat transaction
(SubmitAndWaitForTransactionResponse), or the transaction tree
(SubmitAndWaitForTransactionTreeResponse).

This means that users don't have to wade through the transaction stream
to retrieve the resulting transaction. This is particularly useful in
combination with #479.

Fixes #406
2019-05-03 16:01:41 +02:00
Gerolf Seitz
f4d8e134e3
Add TransactionService methods for looking up flat transactions (#830)
This change is needed in preparation of #406, where we want to return a
transaction tree and flat transaction after a SubmitAndWaitForTransaction(Tree).
2019-05-03 09:03:12 +02:00
mziolekda
dc17c30d76 implement TLS in reference daml-on-x server (#739)
* implement TLS in reference daml-on-x server

* add tls configuration to LedgerApiTestTool

* add ssl tests to the reference ledger server
2019-04-29 17:01:26 +00:00
gleber
aa70c7f64e
Enforce consistent formatting of BUILD files. (#412)
* Add buildifier targets.

The tool allows to check and format BUILD files in the repo.

To check if files are well formatted, run:

    bazel run //:buildifier

To fix badly-formatted files run:

    bazel run //:buildifier-fix

* Cleanup dade-copyright-headers formatting.

* Fix dade-copyright-headers on files with just the copyright.

* Run buildifier automatically on CI via 'fmt.sh'.

* Reformat all BUILD files with buildifier.

Excludes autogenerated Bazel files.
2019-04-12 13:10:16 +02:00
moritzkiefer-da
fa4067ad1b
Move POM file generation to Bazel rules (#374)
* Move POM file generation to Bazel rules
2019-04-11 11:24:52 +02:00
Digital Asset GmbH
05e691f558 open-sourcing daml 2019-04-04 09:33:38 +01:00