Commit Graph

1830 Commits

Author SHA1 Message Date
Marton Nagy
284edfc4cd
Fix FlywayMigrations datasource (#10666)
* Use StorageBackend.createDatasource instead
* remove dependencies
* refactor FlywayMigrations interface for simplicity

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-26 02:22:52 +02:00
nicu-da
7cc698948c
Add multiple ways of specifying deduplication [KVL-1047] (#10601)
CHANGELOG_BEGIN
ledger-api - Command deduplication period can now be specified by setting `deduplication_offset` instead of `deduplication_time` (only valid for v2 WriteService). This change is backwards compatible.
CHANGELOG_END

* Propagate the enriched deduplicationPeriod instead of deduplication duration

* Update the Haskell bindings for the new deduplication period

* Calculate the deduplicateUntil using the new deduplication period for backward compat

* Use consistent naming for deduplication_period

* Cleanup command timeout extraction from deduplication period

* Add the required deduplication_offset to deduplication instead of deduplication_start

* Update haskell bindings to support deduplication_offset

* Add support for deduplication_offset in the ledger-api

* Remove the timestamp-based deduplication from our models to simplify upgrade for users

* Add optional conformance test for offset based deduplication

* Remove buf rule for FIELD_SAME_ONEOF as our change is backwards compatible

* Disable FIELD_SAME_ONEOF buf check for commands file

* Apply suggestions from code review

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>

* Update comment for deduplication period

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2021-08-25 05:58:03 -07:00
Samir Talwar
53be19f86c
participant-integration-api: Ensure that all waiting, failed, and closed trackers are cleaned up. (#10662)
* participant-integration-api: Clean up failed trackers.

Otherwise they can hang around forever.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Ensure that all trackers are closed.

* participant-integration-api: Ensure that waiting trackers are closed.

* participant-integration-api: Store the tracker map future in the state.

* participant-integration-api: Fix a race in `TrackerMap`.

If the supplied `Future` to `AsyncResourceState` is too fast, the state
may not be set. We need to initialize the state immediately.

* participant-integration-api: Add more comments to `TrackerMap`.
2021-08-25 12:53:13 +00:00
Samir Talwar
b27cde6440
participant-integration-api: Move tracker code around, and tidy up tests. (#10663)
* participant-integration-api: Delete `SizeCappedMap`. It's unused.

* participant-integration-api: `TrackerImpl` → `QueueBackedTracker`.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Clean up QueueBackedTrackerSpec.
2021-08-25 10:55:26 +00:00
nickchapman-da
387c68b9eb
Normalize transaction values within the engine (#10648)
Create normalized TXs when a partial TX is finalised.

Except in limited cases! (i.e for scenario-runner, sandbox)

CHANGELOG_BEGIN
CHANGELOG_END

normalize values in the engine as they are converted from speedy-values

fix 2.12 build

backout redundant change

ensure byKey field is correctly normalized when constructed by engine

rename flag: valueNormalization -> transactionNormalization

improve comment

delete commented-out code

rename: toValueNorm --> toNormalizedValue

rename: (SValue.) toValue --> toUnNormalizedValue

revert changes to ptx so that the interface to insertCreate() etc is Value-based (not SValue-based)

improve comments

respell: toUnNormalizedValue --> toUnnormalizedValue

fix build
2021-08-25 09:53:26 +01:00
Samir Talwar
ef239fdd1a
participant-integration-api: Move TrackerMap code around. [KVL-1009] (#10653)
* participant-integration-api: Make `TrackerMap` a `Tracker`.

Mostly by moving parameters around.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Clean up `TrackerMap` a little more.

* participant-integration-api: Make `TrackerMap` generic.

* participant-integration-api: Move `Tracker.WithLastSubmission`.

It's only used by `TrackerMap`, so now it's an internal class there.

* participant-integration-api: Only provide the key to `newTracker`.

* participant-integration-api: Subsume the `TrackerMap` cleanup schedule.

* participant-integration-api: Construct the tracker map outside.

* ledger-api-common: Remove some unnecessary braces.

* participant-integration-api: Prettify `TrackerMap` some more.

* participant-integration-api: Make `TrackerMap.selfCleaning` a class.

* participant-integration-api: Add some tests for TrackerMap.

* participant-integration-api: Convert a method to `Runnable`, 2.12-style.

Apparently underscores aren't good enough.

* ledger-api-client: Delete CompletionSuccess#unapply.

It doesn't work on Scala 2.12.
2021-08-25 06:30:39 +00:00
Marton Nagy
640fb68342
Make Index DB enable multiple party additions [DPP-546] (#10623)
Preparation, small fixes

* Remove unnecessary TODO
* Fix FieldStrategy.idempotentInsert type parameters

Changing the DB-Schema

This change adapts the DB schema for all supported backends. After this change we only populate the party_entries table, and on the query side we reconstruct the state from this.

* Drop the party table
* Add indexing to party_entries

Adapting StorageBackend: ingestion

Since we only ingest party_entries, the party population needs to be removed.

* Drop the party table in ingestion code
* Fixes test

Adapting StorageBackend: queries

Queries needs to be adapted to construct the state from the read side.

* Rewrite queries.
* Fixes reset implementations.

Adapting JdbcLedgerDao

Since underlying storage changed, JdbcLedgerDao can be simplified: no special treatment needed with duplicate errors, since these errors are impossible to happen.
Removing JdbcLedgerDao tests, and adding a new test, testing the behavior of the new event-source party model. Please note: this database refactoring only applies to the append-only schema, so for the mutating schema the test is disabled.
During implementation a bug surfaced: it was not possible anymore to store the is_local information via JdbcLedgerDao.storePartyEntry. Although this bug is a minor issue, since that method is only used from single participant environment, still a fix was also implemented for this, by passing a magic participantId upon non-local party storage.

* Simplify storePartyEntry.
* Fixes bug introduced by append-only.
* adds/adapts tests

Refactoring: remove not used duplicateKeyError from StorageBackend

Changes to JdbcLedgerDao rendered this duplicateKeyError unused.

* Removes unused duplicateKeyError

Adapting sandbox-classic

In sandbox-classic it is not allowed to have updates for parties. Essentially the updates concerning already existent parties were dropped silently with logging without effect.
Here I started by pinning down this behaviour in the SqlLedgerSpec and SqlLedgerSpecAppendOnly. These tests were implemented with the original code in mind.
Then adapted the SqlLedger method: making sure of uniqueness by first trying to lookup the to-be-persisted party.

* Added tests grabbing a hold on original behavior
* Adapted implementation to ensure same behavior

Switching to correct is_local derivation for party queries as per review

* Adapting implementation: switching to aggregated table and a query on that
* Introducing QueryStrategy.booleanOrAggregationFunction to support Oracle
* Moving party related queries to PartyStorageBackendTemplate
* Fixes JdbcLedgerDaoPartiesSpec tests, and add another test case

Also:

* Align Update interface documentation
* Switching to explicit optionality in party query implementation asa per review

Co-authored-by: Simon Meier <meiersi-da@users.noreply.github.com>

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-24 19:24:27 +02:00
Remy
b22de6893b
LF: Contract ID suffix check in Preprocessor (#10642)
This PR makes possible to check for contract IDs suffix during
preprocessing.

This is the first part of the task 3 described in #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-24 18:45:33 +02:00
Miklos
6e4a24c28c
participant-state: Generate correct gRPC error codes by v2 WriteService [KVL-1081] (#10656)
* Corrected returned gRPC error codes.

* Added some tests.
CHANGELOG_BEGIN
CHANGELOG_END

* Reformatted.

* Code tidying.
CHANGELOG_BEGIN
[Integration Kit] Corrected gRPC error codes returned by v2 `WriteService` adaptor.
CHANGELOG_END

* Another try at fixing the changelog.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-24 14:42:27 +00:00
Robert Autenrieth
a471f15aa8
Dpp-558 Fix startexclusive queries on oracle (#10649)
* Add tests for command completions
* Fix offset-greater-than-offset comparisons
* Reformat SQL queries for a more uniform style

changelog_begin
changelog_end
2021-08-24 13:37:40 +02:00
fabiotudone-da
e99254fd3e
Augment completion.proto with deduplication-related info [KVL-1057] (#10619)
* Augment completion.proto with deduplication-related info

CHANGELOG_BEGIN
CHANGELOG_END

* Explicitly specify fields not yet filled in when building Completion

* Time-based deduplication periods are measured in record time of completions

* Add deduplication_offset as a deduplication_period option

* Don't skip proto field numbers

* CompletionFromTransaction: use default Completion constructor

* submission_rank: reserve proto field for future use

* Add comment about reserved proto field
2021-08-24 12:55:03 +02:00
Samir Talwar
a00608c8b3
participant-integration-api: Accommodate changes to max dedup time. (#10650)
Previously, if the max deduplication time was extended, the participant
_might_ retain the old time for certain submissions.

CHANGELOG_BEGIN
- [Ledger API Server] The API server manages a single command tracker
  per (application ID × submitters) pair. This tracker would read the
  current ledger configuration's maximum deduplication time on creation,
  but never updated it, leading to trackers that might inadvertently
  reject a submission when it should have been accepted. The tracker now
  reads the latest ledger configuration.
CHANGELOG_END
2021-08-24 09:28:18 +00:00
tudor-da
29c546c949
[Divulgence pruning] Added prune_all_divulged_contracts to PruneRequest [DPP-534] (#10635)
* Added `prune_all_divulged_contracts` to ParticipantPruningService.Prune
* KeyValueParticipantStateWriter.prune returns UNIMPLEMENTED if called with `pruneAllDivulgedContracts` set

CHANGELOG_BEGIN
CHANGELOG_END

* Addressed review comments

* Apply suggestions from code review

Co-authored-by: mziolekda <marcin.ziolek@digitalasset.com>

Co-authored-by: mziolekda <marcin.ziolek@digitalasset.com>
2021-08-23 20:52:27 +00:00
tudor-da
dea57ca099
In-memory fan-out optimizations (#10558)
* Time conversion duration between buffer event and API domain transaction
* Compute partiesTemplates inversion mapping outside events transformation
* Other small optimizations

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-23 20:31:23 +02:00
Robert Autenrieth
8501832757
DPP-468 StorageBackend tests (#10529)
* Add StorageBackend tests

changelog_begin
changelog_end

* Fix Oracle tests

* Do not use empty byte arrays

* Format

* Fix after rebase

* Substitute type params with type bounded ingest method

* Remove empty line

* Assert on configuration contents

* Fix Oracle build

* Add tests for ingestion initialization

* fmt

* Add test for leftover data after reset

* Add resetAll

* Use resetAll between tests

Co-authored-by: Marton Nagy <marton.nagy@digitalasset.com>
2021-08-23 10:41:25 +02:00
Samir Talwar
733590d591
ledger-api-health: Use the Scala health status values everywhere. (#10640)
The methods are intended to be used by Java code, where Scala
`case object` values can be unidiomatic.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-20 16:50:20 +00:00
Samir Talwar
f77cd0a81c
participant-integration-api: Attempt to fix RecoveringIndexerSpec. (#10639)
* participant-integration-api: Add logging to RecoveringIndexerSpec.

It's flaky, and I would like to know exactly what's going on here.

* participant-integration-api: Attempt to fix RecoveringIndexerSpec.

The checks for the health status are racy. I'm hoping increasing the
timeouts will help a little.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Inline timeouts in RecoveringIndexerSpec.
2021-08-20 15:06:25 +00:00
Samir Talwar
9d7f60f03e
participant-integration-api: Fix a flaky test. (#10637)
The `LedgerConfigurationSubscriptionFromIndexSpec` was flaky due to
stubs not specifying all behavior for `IndexConfigManagementService`.

This fixes the underlying issue by avoiding stubs in favor of fakes,
which means that _all_ behavior must be modelled.

Note: Martin Fowler has an excellent, terse description of [the various
forms of test doubles][TestDouble].

[TestDouble]: https://www.martinfowler.com/bliki/TestDouble.html

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-20 12:53:43 +00:00
Samir Talwar
c0fbad1f6e
participant-integration-api: Remove limitMaxCommandsInFlight. (#10626)
This is always set to `true`, so let's just hard-code it.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-20 07:56:38 +00:00
Oliver Seeliger
b4af6d1155
Canton testing: Mark one more DeeplyNestedValueIT test flaky (#10636)
changelog_begin
changelog_end
2021-08-20 09:22:59 +02:00
Oliver Seeliger
e807f4a918
Upgrade to a newer canton version (post 0.27.0 snapshot version) (#10632)
* Upgrade to a newer canton version (post 0.27.0 snapshot version)

with canton-community configuration that supports higher throughput.

changelog_begin
changelog_end

* Disable flaky reject DeeplyNestedValueIT:Reject tests that time out half the time
2021-08-20 06:10:54 +00:00
Brian Healey
c4513f2eea
Oracle append-only schema: enable contract id index on participant_events_xxxx tables (#10633)
* Enable contract id index on oracle participant_events_xxx tables in append only schema

* update oracle append sqlfile sha

* fixes #10125

* update sha

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-19 21:52:05 +00:00
Remy
3598e0928c
LF: Drop contract ID Freshness check (#10620)
As stated in #10504 the contract ID freshness check cannot be
implemented correctly in general.

This PR drops the support for this (buggy) check.

This corresponds to the fist task of #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-19 18:07:29 +02:00
Samir Talwar
37c999e237
ledger-on-sql: Increase the concurrency for conformance tests. (#10622)
This was limited a while back during the initial development of
_ledger-on-sql_ for reasons I can't remember. Let's stop doing that.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-19 14:04:09 +00:00
Robert Autenrieth
46e8c7d762
DPP-460 Extract constant for event sequential IDs (#10564)
* Extract constant for event sequential IDs

changelog_begin
changelog_end

* Rename zero to beforeBegin

* Replace more occurences of 0L
2021-08-19 13:32:37 +02:00
Robert Autenrieth
121047e0ea
DPP-460 Parameter storage consolidation (#10472)
* Refactor ParameterStorageBackend

- a single method for atomic ledger initialization
- a single method to look up the ledger end

changelog_begin
changelog_end

* Add a test

* Fix reading event sequential ids

* Remove debug statements

* Allow ledgerEnd on an empty database

* Initialization is not safe to call concurrently

* Remove leftovers from isolation level change

* Use unit return type

for initialization methods

* Allow getParticipantId on an empty database

* Use exceptions instead of a return type ADT

* Don't use Try for initialization

* Clean up parameters table

* Simplify parameter storage api

* Address review suggestion

* Address review comment

* Address review comment

* Prefer ledger id over participant id mismatch

* Address review comment

* Move type definition

* Remove useleess new keyword

* Renove unused import

* Inline result mapping

* Fix reporting of mismatching participantId
2021-08-19 10:45:17 +02:00
Samir Talwar
c38703ec84
participant-integration-api: Store a status gRPC protobuf. [KVL-1005] (#10600)
* participant-integration-api: Construct completions in one place.

* sandbox-classic: Inline `CompletionFromTransaction#apply`.

It's only used here; there's no reason to keep it in the
_participant-integration-api_.

* participant-integration-api: Store a status gRPC protobuf.

Instead of storing the status code and message, we store a serialized
`google.rpc.Status` protocol buffers message. This allows us to pass
through any additional information reported by the driver `ReadService`.

The migration is only done for the append-only database, and preserves
old data in the existing columns. New data will only be written to the
new column.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Improve comments in migrations.

Co-authored-by: Fabio Tudone <fabio.tudone@digitalasset.com>

* participant-integration-api: Further improvements to migrations.

* participant-integration-api: Store the rejection status as 3 columns.

Serializing the details but keeping the code and message columns
populated.

* participant-integration-api: Publish the indexer protobuf to Maven.

Co-authored-by: Fabio Tudone <fabio.tudone@digitalasset.com>
2021-08-18 17:59:14 +00:00
Andreas Lochbihler
0af5b49484
make FinalReason a case class (#10614)
CHANGELOG_BEGIN
CHANGELOG_END
2021-08-18 17:33:54 +02:00
Samir Talwar
8dd136fc7d
bazel-tools: Replace runner with either runner_with_port_check or runner_with_port_file. (#10615)
* Use `extra` in the port file runner, rather than `temporary`.

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

Much simpler than the port file runner for our purposes.

* Replace `runner` with `runner_with_port_file`.

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

CHANGELOG_BEGIN
CHANGELOG_END

* Rename the `runner_with_port_check` target to the default.
2021-08-18 15:23:45 +00:00
pbatko-da
19c3d28ebf
Remove GenMissingString class because it is not used (#10608)
CHANGELOG_BEGIN
CHANGELOG_END
2021-08-18 16:08:25 +02:00
Samir Talwar
3227e860e0
Use the port file and dynamic port generation in client/server tests. (#10604)
* Use the port file and dynamic port generation in client/server tests.

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

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

CHANGELOG_BEGIN
CHANGELOG_END

* Simplify the runner_with_port_file considerably.

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

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

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

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

* Simplify the runner_with_port_file further.

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

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-08-18 13:25:58 +00:00
nicu-da
975a5fb32b
Move DeduplicationPeriod to ledger-api-domain [KVL-1047] (#10590)
* Move `DeduplicationPeriod` to ledger-api-domain so that it ca be reused and passed down from the ledger-api-client to into the v2.SubmitterInfo

CHANGELOG_BEGIN
participant-state - move `DeduplicationPeriod` to ledger-api-domain
CHANGELOG_END

* Revert unrelated changes
2021-08-18 13:34:26 +02:00
Samir Talwar
3822a8c886
ledger-api-test-tool: Split TransactionServiceIT into lots of suites. (#10585)
* ledger-api-test-tool: Make IntelliJ happy with TransactionServiceIT.

* ledger-api-test-tool: Collect TransactionServiceIT tests into groups.

* ledger-api-test-tool: Split TransactionServiceIT into lots of suites.

CHANGELOG_BEGIN
- [Ledger API Test Tool] The ``TransactionServiceIT`` test suite has
  been split into many test suites. If you are including or excluding
  it, you will need to use the new test suite names, or you can use
  "TransactionService" as a prefix for all of them.

  If you are including or excluding individual tests, you will need to
  update your arguments with the new test suite. You can find the new
  test suite by running the test tool with the ``--list-all``
  flag and looking for the test's short identifier. The short
  identifiers have not changed, with the exception of
  ``TXNoContractKey``, which has been renamed to ``CKNoContractKey`` and
  is now in the ``ContractKeysIT`` test suite.
 CHANGELOG_END
2021-08-17 14:52:54 +00:00
Samir Talwar
386965c466
Upgrade Flyway to v7. (#10594)
Flyway v6.5 does not officially support the latest versions of
PostgreSQL.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-17 10:29:13 +00:00
Samir Talwar
5c8025269d
ledger-grpc: Fix the directory paths. [KVL-1005] (#10586)
* ledger-grpc: Fix the directory paths.

This brings _ledger-grpc_ in line with other projects. Scala main files
should be under "src/main/scala", and test files should be under
"src/test/suite/scala".

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-grpc: Moar imports.
2021-08-16 16:38:00 +00:00
nickchapman-da
9db5ccfc4e
Normalize transactions & values as a separate pass (#10524)
* Normalize transactions & values as a separate pass. Use for simpler defintiion of isReplayedBy.

CHANGELOG_BEGIN
CHANGELOG_END

normalize transaction version

* remove stray import from bad merge which breaks scala 2_12 build

* change isReplayedBy to only norm its RIGHT (replay) argument

* add forgotton normalization for ValueEmum

* switch to use existing value normalization code (remove my newly coded duplicate code)

* normalize submittedTransaction before calling engine.validate

* dont call normalizeTx from Engine.validate

* *do* call normalizeTx from Engine.validate
2021-08-16 14:54:50 +00:00
tudor-da
99e1d78bb8
[Integrity Checker] Implemented pairwise Update normalizer (#10530)
* [Integrity Checker] Implemented pairwise Update normalizer

CHANGELOG_BEGIN
CHANGELOG_END

* Apply suggestions from code review

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

* Addressed review comments

Co-authored-by: fabiotudone-da <fabio.tudone@digitalasset.com>
2021-08-16 15:46:38 +02:00
nicu-da
cc37bc39cb
Set ErrorInfo metadata flag for definite_answer [KVL-1005] (#10583)
* Set ErrorInfo metadata flag for definite_answer, which is propagated from the completion status

CHANGELOG_BEGIN
ledger-api-client - Propagate definite_answer as metadata in the GRPC response for submit/submitAndWait
CHANGELOG_END

* Keep alphabetical order for bazel build files

* Add test for inclusion of metadata

* Formatting
2021-08-16 13:09:34 +00:00
Marton Nagy
1fc281f07e
ContractStorageBackend consolidation [DPP-462] (#10402)
* Adding CompletionStorageBackendTemplate
* Adding ContractStorageBackendTemplate
* Splitting EventStrategy and creating QueryStrategy
* Adding ComposableQuery for composable anorm string interpolation
* Adapting Backend implementations

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-16 11:56:28 +02:00
nicu-da
933b58e3aa
Extract grpc statuses to separate module [KVL-1005] (#10582)
* Extract grpc statuses to separate module for reuse

CHANGELOG_BEGIN
CHANGELOG_END

* Fix alphabetical order

* Formatting
2021-08-16 08:21:25 +00:00
nicu-da
0ef894447f
Use explicit types to track failures when submitting a request for execution [KVL-1005] (#10567)
* Use explicit types to track failures when submitting a request for execution

To distinguish from execution failures (represented by `CompletionFailure`) which is also exposed as part of the akka-bindings, we introduced `TrackingCompletionFailures` which can also represent the failure to add the request to the execution queue.

CHANGELOG_BEGIN
CHANGELOG_END

* Fix formatting

* Apply suggestions from code review

Co-authored-by: Hubert Slojewski <hubert.slojewski@digitalasset.com>

* Inline handling of errors in the tracker to eliminate the need for the secondary promise and simplify the code

* Update testing for the new error handling

* Remove brackets and make code compatible with 2.12

* Apply suggestions from code review

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

* Review cleanup and use inside for cleaner tests

Co-authored-by: Hubert Slojewski <hubert.slojewski@digitalasset.com>
Co-authored-by: fabiotudone-da <fabio.tudone@digitalasset.com>
2021-08-16 08:22:59 +02:00
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
Samir Talwar
41e60f7302
Upgrade to Scala 2.12.14 and 2.13.6. (#10573)
* Upgrade to Scala 2.12.14.

* Upgrade Scala to 2.13.6.

CHANGELOG_BEGIN
CHANGELOG_END

* compability: Re-pin the Maven dependencies.
2021-08-12 14:25:53 +00:00
Samir Talwar
c69880ccf1
ledger-api-test-tool: Enforce test naming standards. (#10562)
* ledger-api-test-tool: Add some basic unit tests for test names.

* ledger-api-test-tool: Ensure that test names are not prefixes of others.

This makes sure that we can include or exclude any given test, without
affecting others.

* ledger-api-test-tool:Ensure that all tests have different names.

Looks like we had some copy-pasta.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-12 06:44:44 +00:00
nicu-da
ee34d0f80c
Track command - use types for error handling instead of grpc statuses [KVL-1005] (#10503)
* Track command response using an Either instead of passing the completion with the grpc code.

This makes it clearer as to the result of command tracking. We no longer count on the grpc status to determine if there was an error or not, and instead use types for that.

CHANGELOG_BEGIN
akka-bindings: `LedgerClientBinding.commands` now returns a flow of `Either[CompletionFailure, CompletionSuccess]` instead of `Completion` for clearer error handling. For backwards compatiblity the new return type can be turned back into a `Completion` using `CompletionResponse.toCompletion`
CHANGELOG_END

* Fix formatting

* Code review changes

- remove usages of Symbol in tests
- clean curly braces

* Remove change added from another PR

* Fix import

* Fix import

* Fix retry flow and extract one more match case

* Un-nest matches to a single level for simplicity

* fix typo

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

* Be consistent in assertions and prefer `inside` for pattern matching

* Inline CompletionResponse to use the full type

* Use simpler matcher

* Formatting

* Add a way to convert back an `Either[CompletionFailure, CompletionSuccess]` to a `Completion` for backwards compatibility. This simplifies update for systems that are tightly coupled to `Completion`

* Add test for converting to/from CompletionResponse

* Remove unnecessary brackets

* Add missing header

* Use checked exceptions to preserve backwards compatiblity

* Fix unapply

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2021-08-12 08:37:53 +02:00
Andreas Lochbihler
5728bbc14f
add cryptographic hash method to ChangeId and base equality on hash (#10554)
CHANGELOG_BEGIN
CHANGELOG_END
2021-08-11 17:34:44 +02:00
Samir Talwar
2e4f2946fc
kvutils: Improve the test coverage of OffsetBuilder, and support negative numbers. (#10537)
* kvutils: Add property-based tests for the offset builder.

* kvutils: Avoid using `BigInt` in offset parsing.

This also means we can theoretically support negative offsets, even if
in practice it's probably a bad idea.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Further property-based tests for OffsetBuilder.

* kvutils: Improve a comment in OffsetBuilder.

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

Co-authored-by: fabiotudone-da <fabio.tudone@digitalasset.com>
2021-08-11 14:31:26 +00:00
nicu-da
99f59007bf
Add flag to enable/disable command deduplication [KVL-1006] (#10518)
* Add flag to enable/disable command deduplication

* Remove flags for configuration as it should not be exposed externally

* Move deduplicationEnabled flag to the write service.

The deduplication enabled flag is tightly coupled to the WriteService implementation so the flag has been moved to the WriteService trait so that it's explicitly defined.

CHANGELOG_BEGIN
Command deduplication is enabled/disabled based on the write service implementation.
v1 WriteService enables command deduplication while v2 WriteService disabled it
CHANGELOG_END

* Rename deduplication flag
Set sandbox deduplication to true and proxy write service to the delegage
2021-08-11 09:27:25 +02:00
Kamil Bozek
3b1d1ac7ac
IndexerBenchmark: an option for defining minimum update rate [DPP-541] (#10540)
* Changed default metrics reporting interval to 1 second

* Min update rate SLO

* Return exit code 1 on benchmark failure

* CHANGELOG_BEGIN
- [Integration Kit] - indexer-benchmark - added --min-update-rate option for defining required update rate
CHANGELOG_END
2021-08-10 23:08:06 +02:00
Oliver Seeliger
511f27c4d6
H2 Storage backend support for canton jdbc urls with user/password (#10523)
* H2 Storage backend support for canton jdbc urls with user/password

The H2 database's JdbcDataSource does not like seeing user/password
properties in the jdbc url raising errors upon hikari connection pool
initialization:

`org.h2.jdbc.JdbcSQLNonTransientConnectionException: Duplicate property "USER"`

expecting to be able to set user and password separately from passing on
the jdbc url.

As h2 is not supported in production and to get canton integration tests past this
resorting to parsing the jdbc url looking for user/password properties, removing
them from the url and instead setting them explicitly on the data source object.

changelog_begin
changelog_end

* Review feedback
2021-08-10 18:34:21 +00:00