Commit Graph

1186 Commits

Author SHA1 Message Date
Stephen Compall
d696411509
make focused transaction stream testing easy (#7572)
* use traverseFM for storeSync

CHANGELOG_BEGIN
CHANGELOG_END

* split the transaction seq trial from the selection of random parameters

* sample focused trial

* temporarily enable focused 48% onlyWildcardParties H2 test in CI

- partially reverts b4244036f6 from #7482

* try different PowerShell syntax, reduce trial count to 250

* remove temporary tests
2020-10-06 15:45:05 +00:00
Samir Talwar
aec25d2a49
ledger-on-sql: Use tagged execution contexts and data sources in Database. (#7525)
* metrics: Support tagged Futures when timing.

* ledger-on-sql: Use tagged execution contexts in `Database`.

We have to deal with multiple execution contexts in `Database`. This
makes it possible to use them implicitly, which is much cleaner.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-on-sql: Simplify `Database` a little.

* ledger-on-sql: Make the connection pool implicit.

* ledger-on-sql: Move the execution context into the connection pool.

* ledger-on-sql: Make connection pools more implicit.

* ledger-on-sql: Use the `sc` prefix for `scala.concurrent`.

* ledger-on-sql: Remove an unnecessary import.
2020-10-02 15:16:05 +00:00
Samir Talwar
059ae41095
participant-integration-api: Increase the migration connection timeout. (#7558)
250ms is a bit low for CI when our database might be overloaded.

5 seconds seems like a decent balance between a quick response and
being sympathetic to slow/overloaded machines.

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-02 14:07:23 +00:00
Samir Talwar
5cea224a36
kvutils: Flush export files after each write. (#7527)
This will allow consumers to stream writes as they're written.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-30 10:48:13 +00:00
Samir Talwar
7adaa78696
kvutils: Run the commit strategies in as parallel a fashion as possible. [KVL-558] (#7520)
* kvutils: Document the deterministic nature of commit strategies.

* kvutils: Run the commit strategies in as parallel a fashion as possible.

Trees are faster than lists.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Move `serializeStateKey` into its own class.
2020-09-30 09:43:03 +00:00
Stephen Compall
f8e1431a28
more error logging for random transaction stream testing (#7482)
* add parameter information to "fall back to limit-based query with consistent results" test

* run only one test in CI, and run it a lot more

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* considering a grouped reporter

* never mind that

* clean up the error report

* link to #7521

* remove harder testing
2020-09-30 06:18:16 +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
9fa77b61a2
kvutils: Sort the output state before writing. [KVL-558] (#7515)
* kvutils: Always commit serially.

Committing in parallel will cause the set of writes to be emitted in a
random order.

CHANGELOG_BEGIN
- [Integration Kit] In kvutils, the ``BatchedSubmissionValidator`` no
  longer has a parameter for commit parallelism. Commits are now always
  written serially to preserve order.
CHANGELOG_END

* kvutils: Sort the output state before writing.

We previously wrote the output state in a random order, leading to
writes that could not be easily compared for integrity. Sorting them
allows us to validate not just the values, but the order.

This means that the exporter no longer sorts the write set, and the
integrity checker does not sort before checking.

CHANGELOG_BEGIN
- [Integration Kit] In kvutils, state is now sorted before committing.
  This allows us to provide stronger guarantees with regards to the
  serialized write sets.

  If you have implemented your own ``CommitStrategy``, you should also
  ensure the output state is sorted before committing.
CHANGELOG_END

* ledger-on-sql: Implement SQL typeclasses as values, not functions.

Let's pretend performance is important here.

* kvutils: Allow Iterables in batching ledger state operations.

A `Map[Key, Value]` is an `Iterable[(Key, Value)]`, but not a `Seq`.
This allows us to pass a `Map` straight from the committer.

* kvutils: Construct a `SortedMap` in the commit strategy.

This should be more performant than generating and then sorting a
`Vector`.

* kvutils: Sort state updates when committing after pre-execution.
2020-09-29 17:07:11 +00:00
Sofia Faro
e9cd92f061
Deprecate the "daml 1.2" version header. (#7513)
* changelog_begin

- [DAML] The "daml 1.2" version header is now deprecated.

changelog_end

* fix some line numbers

* fix some more locations
2020-09-29 13:14:59 +00:00
Samir Talwar
5f33c7e741
kvutils: Remove the deprecated v1_4 bridge for ledger state access. (#7500)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-28 17:08:27 +00:00
Samir Talwar
ebcbe2762f
ledger-api-auth: Extract Main in to a separate Bazel target. (#7497)
We don't need to push `Main` (and its dependency on `scopt`) to Maven
Central.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-28 11:27:01 +00:00
Samir Talwar
3f96b9b9db
sandbox + kvutils: Add the "read" component back to the health checks. [KVL-475] [KVL-483] (#7486)
* participant-integration-api: Inject health checks into the API server.

CHANGELOG_BEGIN
- [Integration Kit] The ``StandaloneApiServer`` now takes a
  ``healthChecks`` parameter, which should identify the health checks to
  be exposed over the gRPC Health Checking Protocol. This will
  typically look something like::

    healthChecks = new HealthChecks("read" -> readService, "write" -> writeService)

  Integrators may also wish to expose the health of more components.
  All components wishing to report their health must implement the
  ``ReportsHealth`` trait.
 CHANGELOG_END

* sandbox + kvutils: Add the "read" component back to the health checks.
2020-09-25 11:06:46 +00:00
Samir Talwar
40b893e9bb
ledger-api-test-tool: Retry the participant connection for a minute. (#7475)
This means we can stop writing loops to wait for the ledger to come up
wherever this is used.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-24 08:29:29 +00:00
Remy
f5694ee2ea
LF: Kill ValueStruct (#7457)
Struct is not serializable and therefore should not appear as Value.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-22 13:37:59 +02:00
nickchapman-da
4e32fde001
Cleanup following interleave execution and authorization (#7437)
* remove failedTransactions field from ScenarioLedger.RichTransaction

changelog_begin
changelog_end

* remove Blinding.checkAuthorizationAndBlind; fixup callers to use Blinding.blind when blindningInfo is required

* rename/relocate: ScenarioLedger.CommitError.FailedAuthorizations --> SError.DamlEFailedAuthorization

* fix types to demonstate that at most one FailedAuthorization is detected/reported

* address small review comments
2020-09-18 19:05:19 +01:00
Remy
71c19901fd
Ledger-API: Validate Dar before sending it to the ledger. (#7430)
This PR implements a part of the proposal from #7093.

Here packages are validated in the participant node before to be sent to the ledger.

CHANGELOG_BEGIN

- [Ledger-API] participant node validate Dar before uploading to the ledger.
   This may increase upload time significantly.

CHANGELOG_END
2020-09-18 17:26:22 +02:00
nickchapman-da
96d704b25b
Perform authorization checks during execution and not as a separate post-execution phase. (#7400)
changelog_begin
changelog_end

Adapt test for small error message change. An improvement! Previously an internal message was shown. Make test flexible enough to pass for old & new message.

Adapt expected output file. Only change is the contract-ids for active-contracts when the test ends.

fix small test bugs in testcase where authorization is wrong

temp disabled 3 tests; needs investigation; see TODO markers

temp adapt 1 test for change in error message

temp disable 1 test. needs invesigation

undo accidentally commited change to .bazelrc

add copyright header to new file

remove testcase (badActorCheck2) which is no longer expected behaviour, when authorization occurs during execution

address comments: be mre private & other tiny changes

appease scala formatter

improve expected error message in KeyNotVisibleStakeholders testcase

fix authorization issues and re-enable the 3 failing tests in EngineTest which now pass

fix auth issue and re-enable ledger-test-tool test: WronglyTypedContractIdIT

fix compatibility

re-enable test in KVUtilsTransactionSpec.scala
2020-09-17 17:50:04 +01:00
Moritz Kiefer
86f89d5026
Split ledger-on-memory Main into multiple files (#7428)
I’d like to use this in a test fixture so this PR splits up the main
and exposes an API that gives you back the resource without having to
import Main.

changelog_begin
changelog_end
2020-09-17 17:42:27 +02:00
Remy
23d8451b98
LF: Drop legacy engine configuration for Sandbox Classic. (#7415)
The migration script from #7344 ensures that there are no more values
in Sandbox Classic DB encoded with Value version < 6.  Hence, we do
not need anymore a special EngineConfig to maintain backward
compatibility of Sandbox classic DB.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-16 17:14:53 +02:00
Remy
ddbb334ecb
Engine: add submitter arg to Engine#validate (#7405)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-16 13:47:21 +02:00
Remy
b8ebd1daf1
Sandbox: Migrate Pre SDK 1.0 values (#7344)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-16 13:23:54 +02:00
mziolekda
7a1fd2dbb2
Tame concurrent double spend test [KVL-470] (#7395)
* Tame concurrent double spend test [KVL-470]

* address review commnents
2020-09-15 08:40:52 +02:00
daravep
7ab036bd2a
Added in-place update to var-gauge (#7374)
Before, we could in-place update the value of a var gauge. Now, we can not only set such a value but in-place update it atomically.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-14 15:00:31 +02:00
Miklos
7bab3f1b39
Make sure the gzip input/output streams get closed in case of an exception. (#7384)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-11 13:42:45 +00:00
Miklos
f4f187b0ca
Close GzipInputStream after decompressing message. (#7380)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-11 12:37:43 +00:00
Remy
56fd866180
LF: minor cleanup in SortedLookupList (#7345)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-09 14:57:07 +02:00
Remy
95f17d5239
Speedy: share implementation of GenMap and TextMap. (#7334)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-09 09:12:02 +02:00
Samir Talwar
74e7086662
ledger-api-test-tool: Only create sessions once. (#7328)
* ledger-api-test-tool: Wait for futures when constructing LedgerSession.

* ledger-api-test-tool: Wait for futures on `new ParticipantSession`.

* ledger-api-test-tool: If we create two sessions, close one immediately.

* ledger-api-test-tool: Only create sessions once.

CHANGELOG_BEGIN
- [Ledger API Test Tool] Fix a race condition in which multiple
  connections were created to a single participant, and only one was
  shut down properly. This error was likely benign but may cause
  spurious errors to show up when the test tool finishes and shuts down.
CHANGELOG_END

* ledger-api-test-tool: Let ParticipantSessionManager manage connections.

* ledger-api-test-tool: Shrink the configuration surface area.

* ledger-api-test-tool: Use `Future.traverse` to simplify LedgerSession.

* ledger-api-test-tool: Fix the ParticipantSessionManager logger.

* ledger-api-test-tool: Address issues flagged by @stefanobaghino-da.

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

* ledger-api-test-tool: Make `SessionParts` a real class.

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-09-07 14:15:52 +00:00
Samir Talwar
eb68e680f6
kvutils: Change the export header from "v3" to "v2". (#7330)
The old v2 is no more. Let's pretend it never happened.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-07 13:52:09 +00:00
Brian Healey
e2bff87a0c
Provide configurable clock interval to cater for ledger differences with deduplication tests (#7294)
* Extend wait time for dedupe tests to 2x dedupe window

* default clock tick interval of 10s, make it optionally configurable

CHANGELOG_BEGIN
[ledger-api-test-tool] Include new attribute for configurable clock tick
interval
CHANGELOG_END

Signed-off-by: Brian Healey <brian.healey@digitalasset.com>

* address review comments

* Address code review - use Duration

* Add documentation on --ledger-clock-granularity option

* Update documentation

* address review comments

* address warning: implicit numeric widening

* scalafmt

* ProtobufDuration alias rather than ProtoDuration for consistency with namespacing

* underline in docs
2020-09-04 17:19:07 -04:00
Remy
78e770bf72
LF: Use the new Struct data structure for ValueStruct (#7241)
This PR uses the new data structure introduced in #7220.
Additionnally this fix `Value Equal instance` which was considering
<a: x, b: y> different from <b:y, a:x>.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-04 18:32:39 +02:00
Oliver Seeliger
f2a35ee922
Canton conformance test debug logging and reduced test parallelism (#7322)
* Canton conformance test debug logging and reduced test parallelism

To reign in flakiness of a handful of TransactionServiceIT tests
that had run into timeouts during synchronize

Closes #7316

changelog_begin
changelog_end

* Review feedback from Stefano
2020-09-04 14:25:30 +02:00
Remy
c4e21910ab
disble flaky tests in canton-conformance-test (#7315)
* mark canton-conformance-test as flaky

CHANGELOG_BEGIN
CHANGELOG_END

* Address Moritz's review

* fix

* fix

* Disable a handful of TransactionServiceIT changes that flake

rather than making the entire canton suite as flaky

Related to #7316

changelog_begin
changelog_end

* formatting

Co-authored-by: Oliver Seeliger <oliver.seeliger@digitalasset.com>
2020-09-03 15:07:02 +00:00
Miklos
0bfb4ba1d2
kvutils: Remove deprecated methods [KVL-406] (#7313)
* Removed deprecated signature from WriteService and LedgerWriter.

* CHANGELOG_BEGIN
CHANGELOG_END

* Reverted change.

* Fixed ScalaDoc for KeyValueParticipantState.
2020-09-03 12:12:58 +00:00
Samir Talwar
d4b4e7fe87
ledger-api-test-tool: Actually print the cause of uncaught exceptions. (#7310)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-03 09:26:46 +00:00
Brian Healey
f2707cc54f
Ensure shortIdentifier for ledger api tests do not overlap partially with other shortIdentifiers (#7279)
* uniquely name tests to easily facilitate running them one by one for troubleshooting

CHANGELOG_BEGIN
CHANGELOG_END

Signed-off-by: Brian Healey <brian.healey@digitalasset.com>

* ensure a few further tests do not include a portion of another tests shortIdentifier

* no overlap for CSsubmitAndWaitForTransactionTree
2020-09-02 13:41:07 -04:00
Samir Talwar
fe7d56f099
kvutils/tools: Split the tools by directory. (#7306)
* kvutils/tools: Split the integrity checkers by package.

The two versions of the integrity checker are intertwined when they
really don't rely on each other at all. This splits them into two
separate packages to make the distinction clear.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils/tools: Split the integrity checkers by directory.

This splits the integrity checkers further into separate directories, to
make it clear they do not interact at all.

* kvutils/tools: Rename "integrity-check" to "integrity-check-v1".

* ledger-on-memory: Recommend ledger exports (v3), not ledger dumps (v1).

* kvutils/tools: Split the benchmarks from integrity-check-v2.
2020-09-02 12:45:56 +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
0c99f637a0
[KVL-254] kvutils: Export to protobuf, not a custom serialization format. (#7265)
* kvutils: Implement a basic protocol buffer-based export.

* kvutils: Add a header to the protobuf-based export.

So if we decide to go for a v4, it's easier to figure this stuff out.

* kvutils: Use our own header format for export.

The idea is to be somewhat forward-compatible, so relying on protobuf
to always be the format of the future seems a little odd. We may switch.

* kvutils: Construct the importer up-front during integrity checks.

* kvutils: Move the various importers and exporters to versioned packages.

* kvutils: Move the export version to the package object.

* kvutils: Create helpers to construct importers and exporters from paths.

* kvutils: Process either v2 or v3 exports with the integrity checker.

* kvutils: Sort the write set during export.

* kvutils: Switch to v3 of the export.

The integrity checker will work with either version.

CHANGELOG_BEGIN
- [Integration Kit] kvutils-based ledgers will now export the ledger
  using a new serialization format based on Protocol Buffers, which we
  are referring to as "v3". Existing "v2" exports can still be read and
  verified using the integrity checker, which can read both old and new
  versions.
CHANGELOG_END

* kvutils: Aggregate export data in a sorted map.

We need to sort it anyway; might as well do it on input.

* kvutils: Improve a test string.

* kvutils: Use the v3 importer in the replay test.

* kvutils: Remove v2 of the export format.

We're pretty sure no one is using it.
2020-09-02 07:41:25 +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
aaf70c4add
kvutils: Increase the streaming updates timeout in integration tests. (#7278)
* ledger-on-(memory + sql): Include logback as a test dependency.

Otherwise logs don't show up when we get failures, which makes debugging
a lot harder.

* kvutils: On unit test timeout, show a useful error.

* kvutils: Increase the streaming updates timeout in integration tests.

This is timing out every now and again on CI, and I can reproduce it
easily by running the tests in parallel.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-31 14:40:35 +00:00
Robert Autenrieth
6c3d64a48f
KVL-314 Add test for concurrent double spends (#7260)
* KVL-314 Add test for concurrent double spends

CHANGELOG_BEGIN
CHANGELOG_END

* Address review comment
2020-08-31 10:43:53 +02:00
nickchapman-da
4e80ee62e6
Refactor EnrichedTransaction (#7262)
* Refactor EnrichedTransaction

This PR prepares for work to interleave _authorization_ with _execution_, which has been an open issue for a long time: #132.

- Split computation of `BlindingInfo` and `FailedAuthorizations` into separate modules.

- Fixup callers: `Blinding.scala` and `ScenarioLedger.scala`, to do:

```
    val failedAuthorizations =
      AuthorizingTransaction.checkAuthFailures(authorization, tx)

    val blindingInfo =
      BlindingTransaction.calculateBlindingInfo(tx)
```

- Simplify code to remove `DontAuthorize` and `Authorization` types, which were only needed to restrict the combined _enrichment_ code from doing the authorization check when `blind`ing only is required. Now  `Blinding.blind` calls just `calculateBlindingInfo`.

* address comments from Stefano
2020-08-28 15:16:37 +00:00
Samir Talwar
8dde430499
kvutils: Buffer (im/ex)port streams, and simplify reading a fixed-length ByteString. (#7263)
* kvutils: Buffer (im/ex)porter streams.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Use `ByteStreams.limit` instead of copying byte arrays.
2020-08-28 13:39:55 +00:00
Samir Talwar
445af973cd
kvutils: Generalize the interfaces and tests for the ledger export. (#7258)
* kvutils: Factor out a base class for ledger exporter implementations.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Use piped streams in LedgerDataExporterSpecBase.

* kvutils: Rename "FileBased…" to "SerializationBasedLedgerDataExporter".

* kvutils: Wrap Deserialization in a class for polymorphism purposes.

* kvutils: Pull out submission info variables in the ledger export test.

* kvutils: Inline (De)Serialization into the exporter.

* kvutils: Replace usage of Deserialization with LedgerDataImporter.

* kvutils: Don't synchronize on making an InMemorySubmissionAggregator.

* kvutils: Pass a SubmissionInfo to LedgerDataExporter.

* kvutils: Reflow a long string to make it readable.
2020-08-28 11:39:02 +00:00
Samir Talwar
78d77e77a4
kvutils: Bump integrity check test sizes back to medium. (#7257)
They might take a while when run on CI.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-28 09:40:19 +00:00
Samir Talwar
c34f15d497
participant-integration-api: Create the metrics CSV directory. (#7253)
It turns out that if you give the CSV reporter a non-existent directory,
it crashes. I did not expect this.

This constructs the directory so you don't have to worry about that.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-28 07:48:50 +00:00
Samir Talwar
9374264e6d
metrics: Use Gauge#getValue to avoid registering a metric externally. (#7254)
This is the same technique as `DerivativeGauge` from the metrics
library, but with less code, because Scala is prettier than Java.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-28 07:48:43 +00:00
Robert Autenrieth
50f3ab5afb
KVL-242 Test for OUT_OF_RANGE errors (#7251)
* KVL-242 Test for OUT_OF_RANGE errors

... when subscribing past the ledger end

CHANGELOG_BEGIN
CHANGELOG_END

* Address review comments
2020-08-28 09:45:49 +02:00
Oliver Seeliger
153cde8e75
Upgrade to Canton 0.18.2 (#7255)
This version of canton contains DAML 1.5.0-snapshot.20200825.5071.0.d33e130f

Details at https://github.com/digital-asset/canton/releases/tag/v0.18.2

changelog_begin
changelog_end
2020-08-28 08:51:28 +02:00