Commit Graph

228 Commits

Author SHA1 Message Date
Samir Talwar
4b8b67a1b5
Upgrade Scalatest to v3.2.9. (#10576)
* Upgrade Scalatest to v3.2.9.

Because of some coupling we also have to upgrade Scalaz to the latest
v7.2 point release, v7.2.33.

The Scalatest changes are quite involved because the JAR has been broken
up into several smaller JARs. Because Bazel expects us to specify all
dependencies and doesn't allow transitive dependencies to be used
directly, this means that we need to specify the explicit Scalatest
components that we use.

As you can imagine, this results in quite a big set of changes. They
are, however, constrained to dependency management; all the code remains
the same.

CHANGELOG_BEGIN
CHANGELOG_END

* http-json-oracle: Fix a Scalatest dependency.

* ledger-api-client: Fix a Scalatest dependency.
2021-08-12 23:19:35 +00:00
nicu-da
35641b7f62
Add submission id to the GRPC api [KVL-999] (#10467)
* Add optional submission id to commands.proto

This allows to propagate a submission id. If no id is submitted (the submission id is empty) then we generate a new submission id

CHANGELOG_BEGIN
Add optional submission_id to the commands.proto.
CHANGELOG_END

* Update haskell bindings to include the submission id

* Code review - rename submission id extractor

* Code review - update comment and remove braces from if block

* Fix braces
2021-08-06 08:54:54 +02:00
Samir Talwar
12599e7f06
Disable configuration management until the ledger has a configuration. [KVL-1058] (#10478)
* participant-integration-api: Move test constants to a companion object.

TelemetrySpecBase doesn't need to expose those through inheritance.

* Avoid mocks in the configuration management service test.

* Add tests for `ConfigManagementService.GetTimeModel`.

* Add tests for `ConfigManagementService.SetTimeModel`.

* Disable configuration management until the ledger has a configuration.

CHANGELOG_BEGIN
- [API Server] The configuration management service previously returned
  the participant-specified default configuration if none was found on
  the ledger. This can be misleading, and so the ``GetTimeModel``
  endpoint now returns a gRPC ``NOT_FOUND`` error if no configuration
  has been found yet. Similarly, the ``SetTimeModel`` endpoint returns a
  gRPC ``UNAVAILABLE`` error.

  This should only happen if the participant gives up waiting for the
  ledger to provide a configuration, which is very unlikely in a
  production setting. In this case, the ledger will also not respond to
  command submissions.
CHANGELOG_END

* participant-integration-api: Extract some test variables for clarity.

In ApiConfigManagementServiceSpec.

* sandbox: Improve some variable and parameter names in tests for clarity.

* Improve the error message in case of a missing ledger configuration.

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

* ledger-api-common: Improve an error status constructor name.

Co-authored-by: fabiotudone-da <fabio.tudone@digitalasset.com>

Co-authored-by: Robert Autenrieth <31539813+rautenrieth-da@users.noreply.github.com>
Co-authored-by: fabiotudone-da <fabio.tudone@digitalasset.com>
2021-08-04 20:34:22 +00:00
Samir Talwar
d666f76fbb
participant-integration-api: Switch to the v2 participant state API. [KVL-1002] (#10398)
* participant-state: Give `ChangeId` its own file.

* participant-state: Introduce `v1.CompletionInfo` for a while.

`CompletionInfo` is identical to `SubmitterInfo`. Its purpose is to make
the migration to v2 easier. It should not make it into the final
version.

* participant-integration-api: Switch to the v2 participant state API.

This means that:

  - the API server and indexer expect v2 API traits
    - adapters are provided if you need to elevate your v1 API usage
  - the indexer internally uses v2 Updates
  - rejections are switched over to use the v2 format
  - Sandbox Classic uses v2 as the internal representation too (because
    it interacts directly with the underlying indexer representation,
    and is therefore tightly coupled)

_kvutils_ and other users of the `StandaloneApiServer` and
`StandaloneIndexerServer` use the adapters.

CHANGELOG_BEGIN
- [Integration Kit] The API server and indexer have switched over to v2
  of the participant-state API. You can continue to use the v1 API, but
  you will need to wrap your ``ReadService`` and ``WriteService``
  objects in the ``AdaptedV1ReadService`` and ``AdaptedV1WriteSerivce``
  classes.
CHANGELOG_END

* participant-state: Remove v1.CompletionInfo.

It's served its purpose.

* kvutils: Remove an unnecessary line from `Runner`.

* ledger-api-common: Delete a TODO; we'll track it elsewhere.

* participant-integration-api: Use full words in `JdbcLedgerDao`.

Just a little bit of cleanup.

* ledger-api-common: Extract out the random submission ID generator.

And introduce a trait, because, well, this is still the JVM.
2021-07-28 14:59:23 +00:00
Samir Talwar
9e05f38f51
ledger-api-domain: Store the deduplication duration in Commands. [KVL-1002] (#10403)
* ledger-api-domain: Store the deduplication duration in `Commands`.

We can compute the max deduplication time from this later.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-api-domain: Refactor out `Commands#deduplicateUntil`.
2021-07-26 11:49:17 +00:00
Samir Talwar
c3bc26fd1c
daml-lf/data: Move ID aliases to Ref from _ledger-api-common_. [KVL-1002] (#10323)
* daml-lf/data: Move ID aliases to `Ref` from _ledger-api-common_.

This allows us to remove a lot of dependencies on _ledger-api-common_,
and use these aliases in other places where that module is not used.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Remove an unused import.

* http-json-oracle: Remove `ledger-api-common` as a dependency.

* bindings-rxjava: Remove a now-unused dependency.
2021-07-20 11:01:19 +00:00
Miklos
0eba812109
Remove trace_context field from Ledger API [KVL-1021] (#10256)
CHANGELOG_BEGIN
* [Integration Kit] Removed trace_context field from Ledger API and its bindings as we now have trace context propagation support via gRPC metadata. If you are constructing or consuming Ledger API requests or responses directly, you may need to update your code.
CHANGELOG_END
2021-07-15 19:06:25 +02:00
Samir Talwar
888f02aa4d
ledger-api-common: There's only one way to order absolute offsets. (#10153)
Let's not mess around with injectable orderings.

This has the pleasant side effect of removing dependencies.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-30 14:17:59 +00:00
Samir Talwar
c929a14486
logging-entries: Split from contextualized-logging. [KVL-996] (#10149)
* logging-entries: Split from contextualized-logging.

This allows us to introduce it to Daml-LF without bringing in the
Logback, Logstash, and gRPC dependencies.

CHANGELOG_BEGIN
CHANGELOG_END

* logging-entries: Fix dependencies for 2.12.

* logging-entries: Missed one more Scala 2.12 dependency.

* release: Publish logging-entries.
2021-06-30 12:08:33 +00:00
Samir Talwar
c764fbe573
contextualized-logging: Introduce different logging types for more structure. [KVL-996] (#10134)
* contextualized-logging: Automatically convert logging values to strings.

For now, this has almost the same behavior, but it allows us to
customize the output in the future.

The main change is that the log format has gone from:

    context: {a=b, x=1, foo=bar}

to:

    context: {a: "b", x: "1", foo: "bar"}

* contextualized-logging: Move `writeTo` inside `LoggingValue`.

* contextualized-logging: Allow for more than just strings.

`null`, numbers, and sequences are now correctly logged.

The log format has gone from:

    context: {a: "b", x: "1", foo: "bar", parties: "[alice, bob]"}

to:

    context: {a: "b", x: 1, foo: "bar", parties: ["alice", "bob"]}

CHANGELOG_BEGIN
- The log output of Daml components has changed so that the structured
  part is closer to JSON. This allows us to distinguish and parse
  numbers and lists. If you are parsing this log output, you may need to
  change your parser.

  The log output has changed from:

  .. code-block::

     context: {a=b, x=1, foo=bar, parties=[alice, bob]}

  to:

  .. code-block::

     context: {a: "b", x: 1, foo: "bar", parties: ["alice", "bob"]}

CHANGELOG_END

* contextualized-logging: Extract the string serializer.

* Use non-string logging where possible.

* contextualized-logging: Split logging values from serialization.

So that callers don't have to know about Jackson.

* contextualized-logging: `SeqView` is `Iterable`. Don't need both.

* contextualized-logging: Make `ToStringToLoggingValue` a `val`.

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

* contextualized-logging: Add a transient dependency for 2.12 only.

This required more infrastructure than I thought it would.

* kvutils: Make it explicit that we're logging the hashes of archives.

The implicit was found to be a little confusing.

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2021-06-29 09:16:26 +00:00
mziolekda
db60d15b5e
Log ledger api validation failures at info level (#10080)
* CHANGELOG_BEGIN
Log ledger api validation failures at info level
CHANGELOG_END

* log validation failures in Api*Service family of classes

* address review comments
2021-06-23 13:31:48 +00:00
daravep
6caa61c9d4
participant-state: rejection reason abstractions (#9764)
Before this change, any write-service was restricted to the predefined
set of rejection reasons which couldn't capture the complex canton
rejection reasons.
In order to open up the path for a redesign, I've migrated the current
rejection reasons into a V0 version and opened the abstract class for
customized implementations. I've also added a temporary method to tunnel
synchronous rejections through the ledger api server.

CHANGELOG_BEGIN
- Participant-state: Introduced versioned form of rejection reason
CHANGELOG_END
2021-05-27 19:06:36 +02:00
Samir Talwar
63c471fa79
Upgrade protobuf-java and scalapb. [KVL-938] (#9713)
* Upgrade protobuf-java and scalapb.

CHANGELOG_BEGIN
CHANGELOG_END

* Bazel: Generate ScalaPB classes without `unknownFields`.

This is very annoying because it means that extractors need an extra
`_` for no good reason. It also breaks Circe's automatic derivation.

Including unknown fields is the default behavior in Protocol Buffers for
Java now, and we'll probably have to reckon with it at some point, but
let's kick that can down the road a little.

* Upgrade protobuf-java to 3.17.1.

This is identical to 3.17.0, but let's track it anyway.

* Bazel: Move ScalaPB versions into their own file.

They don't need to go into the generated one.
2021-05-27 13:41:28 +00:00
Miklos
b1ca310866
ledger: Damlification of Scala files (#9667)
* Damlification of Scala files (primarily comments and strings).

* Corrected a typo.
CHANGELOG_BEGIN
CHANGELOG_END

* Fixed build.

* Fixed test case for acronyms.

* Reformatted.
2021-05-20 10:21:04 +00:00
Miklos
f5c84a2aa4
Daml-LF: Damlification of Scala/Haskell files (#9666)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-20 09:52:33 +02:00
Hubert Slojewski
927242be40
KVL-914 Add and rework unit tests for tracing (#9686)
* Add and rework unit tests for tracing
CHANGELOG_BEGIN
CHANGELOG_END

* Add assertion

* Minor cleanup

* Add missing header

* Remove an empty line
2021-05-14 16:36:29 +02:00
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
Remy
871279f3a6
LF: extends LF command with Fetch and Lookup (#9587)
This PR includes  :

- Adding ApiCommand to distinguish between generic command (that are
  accepted by the engine) and command that are accepted by the ledger
  API.

- Reimplement Canton's reinterpret method using commands instead of
  node.

CHANGELOG_BEGIN
CHANGELOG_END
2021-05-07 19:19:25 +02:00
Moritz Kiefer
a27b2c56bc
Address more exception todos (#9582)
* Address more exception todos

A bit of a kitchen sink PR to address a bunch of the trivial todos
that didn’t seem worth splitting out into separate PRs.

changelog_begin
changelog_end

* Revert changes to TransactionSpec

changelog_begin
changelog_end
2021-05-05 16:00:08 +02:00
Moritz Kiefer
de80a6dc60
Drop ValueBuiltinException (#9576)
As discussed, we don’t want to expose this via serializable values at
least for now (and it’s not exposed on the ledger API anyway) so this
PR drops the type.

changelog_begin
changelog_end
2021-05-05 12:32:58 +02:00
Moritz Kiefer
4aca199bbd
Upgrade to Scala 2.13.5 (#9528)
changelog_begin
changelog_end
2021-04-29 13:05:57 +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
9706d9fe2a
KVL-874 Change the TelemetryContext to use SpanAttributes instead of raw AttributeKeys and remove an unused object (#9474)
* Change the TelemetryContext to use SpanAttributes instead of raw AttributeKeys
and remove an unused object along with its dependencies

CHANGELOG_BEGIN
CHANGELOG_END

* Change the Tracer name and the instrumentation name from participant to com.daml.telemetry
2021-04-26 15:31:46 +02:00
Hubert Slojewski
f4316bddf3
KVL-874 Add telemetry classes from the oem integration kit and use it for command submissions (#9436)
* Add telemetry classes from the oem integration kit and use it for command submissions

* Change submitTransaction to submitTransactionWithTelemetry and add a deprecation

* Fix tests

* Revert "Change submitTransaction to submitTransactionWithTelemetry and add a deprecation"

CHANGELOG_BEGIN

- [Integration Kit] TelemetryContext has been introduced to the WriteService.submitTransaction method to support distributed tracing

CHANGELOG_END
2021-04-23 13:00:39 +02:00
Hubert Slojewski
cb5f1f650b
KVL-874 Move telemetry-related classes to a separate package (#9467)
* Move telemetry-related classes to a separate package

CHANGELOG_BEGIN
CHANGELOG_END

* Add missing headers
2021-04-21 15:06:17 +02:00
nickchapman-da
9b2158508b
Add new variant to Value.scala for builtin-exceptions. (#9084)
* Add new variant to Value.scala for builtin-exceptions.

final case class ValueBuiltinException[+Cid](tag: String, value: Value[Cid]) extends Value[Cid]

And push through the code consequences.
Most places fixed up.
A couple more things to do in this PR (marked NICK)
A couple of things which can be left for later (marked 8020)

fix build

fix another scala match

changelog_begin
changelog_end

* fix any match

* add marker of code which needs attending to in the PR

* extend ledger-api value.proto & fix LfEngineToApi

* undo/comment-out the change to value.proto

* add tests in HashSpec for BuiltinException

* code but dont yet enable value-gen for builtin exceptions

* address comments which suggest we crash in various places

* support BuiltinException in scenario_service.proto

* one more TODO 8020 tag
2021-03-16 13:15:33 +00:00
Luc Bourlier
09c46cf666
Upgrades opentelemetry to 0.16.0 (#8862)
CHANGELOG_BEGIN

- [Dependencies] Upgrade io.opentelemetry:opentelemetry-api to 0.16.0

- [Dependencies] New dependency: io.opentelemetry:opentelemetry-context:0.16.0

CHANGELOG_END
2021-02-23 18:21:36 +01:00
Robert Autenrieth
f13c96bdde
Retrofit types in verbose mode [DPP-154] (#8656)
* Factor out package loding deduplication

* Remove unused LfValueTranslation

* Fill in missing type information

changelog_begin
changelog_end
2021-02-02 11:45:00 +01:00
Stefano Baghino
a3f3ec1d44
Add test to verify that TLSv1.2 and TLSv1.3 work (#8638)
* Add test to verify that TLSv1.2 and TLSv1.3 work

As raised here: https://discuss.daml.com/t/what-version-of-tls-is-supported-by-the-ledger-api/1982

This has been effectively fixed by upgrading Netty here: https://github.com/digital-asset/daml/pull/8558

Note that this is an integration test for sandbox-classic only, but the
infrastructure used is shared with other Ledger API server
implementations, so this should be enough.

changelog_begin
changelog_end

* Fix Scala 2.13 compatibility issue

* Fix warning by adding type annotation to public field
2021-01-26 19:59:06 +00:00
Stefano Baghino
fc69db02b4
Add a library that defines Resource factory methods for gRPC servers and channels (#8604)
* Add a library that defines Resource factory methods for gRPC servers and channels

This is the first of four PRs in which 6ea70c4b45
has been broken up to facilitate review.

The endgame is to have the non-repudiation prototype merged. These
factory methods have been used to make resource management easier,
specifically as part of testing.

changelog_begin
changelog_end

* Let warning log output in tests

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

* Address https://github.com/digital-asset/daml/pull/8604#discussion_r562634032

* Address https://github.com/digital-asset/daml/pull/8604#discussion_r562634865

* Address https://github.com/digital-asset/daml/pull/8604#discussion_r562635148

* Address https://github.com/digital-asset/daml/pull/8604#discussion_r562635684

* Add resources-grpc to release/artifacts.yaml

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-01-25 10:32:36 +01:00
Moritz Kiefer
6b2ac0e0c6
Port parts of //ledger/... to Scala 2.13 (#8470)
* Port parts of //ledger/... to Scala 2.13

Fairly random choice of directories, I just went through them in
alphabetical order. The one thing that I had to disable for now are
the conformance tests since the ledger API test tool has a dependency
not compatible with Scala 2.13.

changelog_begin
changelog_end

* Remove accidentally included //ledger/ledger-api-client/...

doesn’t actually work yet

changelog_begin
changelog_end
2021-01-12 10:55:00 +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
Samir Talwar
c68ba11080
participant-integration-api: Dedicated execution context for requests. (#7945)
* participant-integration-api: Dedicated execution context for requests.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Construct the services executor outside.

* participant-integration-api: Share the services EC with the GRPC stack.

* participant-integration-api: Use the new EC wherever possible.

And stop using DirectExecutionContext.

* sandbox-classic: Fix DevModeIT to use the right configuration.

I have no idea why this breaks now, but it was always technically
broken, so I'm fixing it.

* participant-integration-api: Push the services EC up one more level.

* Update newly added ApiParticipantPruning service accordingly

see https://github.com/digital-asset/daml/pull/7988#discussion_r525319097

* participant-integration-api: Ensure the LedgerConfigProvider is ready.

Somehow this slipped through.

* sandbox-classic: Fix `DefaultConfig` in tests.

* language-support/java: Disable seeding in tests again.

Co-authored-by: Oliver Seeliger <oliver.seeliger@digitalasset.com>
2021-01-05 18:11:54 +00:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Robert Autenrieth
f3d8f05070
Enable multi-party submissions [KVL-708] (#8266)
* Remove single-party check

CHANGELOG_BEGIN
- [Ledger API] The ledger API now supports multi-party submissions.
  In order to use multi-party submissions, use the new act_as and
  read_as fields in submission requests.
CHANGELOG_END

* Remove usage of temporary SubmitterInfo methods

* Fix validator tests

* Fix auth test

* Add multi-party tests to the ledger API

* Fix compile errors

* Improve tests

* Remove temporary single-party method from SubmitterInfo

* Remove temporary single-party method from SubmitterInfo companion object

* Remove temporary single-party method from TxEntry

* Run multi-party submission ITs for ledger-on-memory and ledger-on-sql

* Minor improvement

Co-authored-by: Kamil Bozek <kamil.bozek@digitalasset.com>
2020-12-17 13:42:39 +01:00
Remy
7d31135645
LF: retire VersionTimeline (#8273)
CHANGELOG_BEGIN
CHANGELOG_END
2020-12-14 16:56:47 +01:00
Moritz Kiefer
76b6fd86fb
Upgrade Scala dependencies for 2.13 compatibility (#8268)
* Upgrade Scala dependencies for 2.13 compatibility

This upgrades a bunch of Scala libraries to versions that have 2.13
support. There are two libraries that are still missing:

- diffson, this has a new version but with significant breaking
  changes and it is only used in Naigator console which I hope to kill
  before I have to worry about this.

- ai.x:diff, this is used in the ledger API test tool. The library is
  abondened but there are a few alternatives.

changelog_begin
changelog_end

* Fix pureconfig

changelog_begin
changelog_end

* Fix Navigator

changelog_begin
changelog_end
2020-12-14 09:59:00 +01:00
Gary Verhaegen
acf654ca55
replace new Prim with Prim.valueOf (#8270)
Creating new primitives has always been a bad idea.

Stolen from #8267 which stole it from #975.

CHANGELOG_BEGIN
CHANGELOG_END
2020-12-11 18:50:37 +01:00
Remy
44c5b8a777
LF: remove version from value nested in GenNode. (#8217)
CHANGELOG_BEGIN
CHANGELOG_END
2020-12-11 17:12:14 +01:00
Kamil Bożek
5db4ca687b
Multi-party command submission [KVL-699] (#8152)
Changes:
- replaced submitter: Party with actAs: Set[Party] and readAs: Set[Party] in com.daml.ledger.api.domain.Commands
- adapted contract and key lookups for multi-party submissions

* Changed single Commands to accept multiple submitters

* Removed submitter field from Commands

* Replaced submitters with actAs and readAs in Commands

* Moved actAs and readAs to com.daml.ledger.api.Commands

* Contract lookup tests

* Key lookup tests

CHANGELOG_BEGIN
CHANGELOG_END

* Formatted code changes

* Remove unused method

* Formatting fixes

* Simplified logical condition for active contracts visibility

* Removed unused temporary method in Commands

* Unified contract key lookup query for different type of db types

* Simplified ContractReader class structure

* Improved dao unit tests

* Unit tests for lookups as a divulgee

* Reduced code duplication in unit tests

* Minor improvement

* Formatted code

* Fixed a ContractsReader's query

* Improved unit tests

* Explanation for engine's command authorizers and contract readers

* Minor fixes

* Adapted SpannedIndexService for the multi-party submission
2020-12-11 10:04:15 +01:00
curiousleo-da
f4fa88c977
Trace index DB -> Ledger API read path [LPF-223] (#8233)
CHANGELOG_BEGIN
- [Integration Kit] Emit OpenTelemetry events for transactions streamed
  to the client from the Ledger API
CHANGELOG_END
2020-12-10 15:06:17 +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
012ae55d65
Engine API - multi-party submissions [KVL-703] (#8081)
* Multiple submitters field for Command

* Multiple submitters field for Engine API

* Tests for multi-party submissions in Engine

* Make use of multi-party Engine capabilities in the engine benchmark

* Enable multi-party submission in Engine's API
CHANGELOG_BEGIN
CHANGELOG_END

* Separate unit tests for multi-party engine

* Unit tests for multi-party submission transaction replay
2020-11-30 15:04:30 +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
Oliver Seeliger
83f11aa784
Participant pruning ledger api server support ported from Canton (#7988)
* Participant pruning ledger api server support ported from Canton

CHANGELOG_BEGIN
- [Ledger API]: The preview of `ParticipantPruningService` enables ledger participants to prune the "front" of ledger state at the participant including the ledger api server index.
CHANGELOG_END

* Review feedback from Stefano

* Add pruning tests plus missed command completions change

* Review feedback from Robert

* Improved test readability by having populate helper return offsets

* Review feedback

* Ledger api changes to pruning api and disable canton pruning test

- Change return result to PruneResponse
- Change type of PruneRequest.prune_up_to to string

* Review feedback: Use ApiOffsetSConverter for logged offsets
2020-11-23 15:28:04 +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