Commit Graph

2030 Commits

Author SHA1 Message Date
pbatko-da
88c607b781
[Self-service error codes] Adapt ApiTransactionService [DPP-613] (#11094)
* [DPP-417][DPP-613] Adopt self-service error codes ApiTransactionService

CHANGELOG_BEGIN
CHANGELOG_END

* TV review

* TV review

* Uses ErrorFactories

* Error loggers use enriched logging contexts

* Deleted ApiTransactionServiceSpec

* Add TODO wrt to CommandValidation.invalidArgument

* Adapt transactionNotFound error assertions in conformance tests

* ErrorFactories.invalidArgumentWasNotFound for handling invalid event ids

* Revert improvement to TransactionNotFound cause message since
Canton still outputs the old message and assertions fail.

Co-authored-by: Tudor Voicu <tudor.voicu@digitalasset.com>
2021-10-20 22:18:26 +00:00
pbatko-da
da27a1e812
[DPP-619][Self-service error codes] Adopt error codes in ApiVersionService (#11303)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-20 16:38:22 +02:00
pbatko-da
5f5af30ce0
[DPP-628][Self-service error codes] Adapt error codes in ApiTimeService (#11295)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-20 15:37:01 +02:00
tudor-da
f9e67adafc
[Self-service error codes] Adapt error responses in ledger-api-auth [DPP-617] (#11223)
* [Self-service error codes] Implement V2 in Authorizer

CHANGELOG_BEGIN
CHANGELOG_END

* Added unit test for authorize (non-streamed)

* Fix after rebase

* Do not expose the error codes switching mechanism to the Java bindings

* Adjust InternalAuthorizationError to be SystemInternalAssumptionViolated

* Parameter names in test

* Testing AuthorizationInterceptor with regard to returned error codes

* Do not use default error code version switchers at instance creation

* Addressed Pawel's review comments

* Using ErrorFactories for error dispatching

* Pass loggingContext to Authorizer where available

* Generic internal authorization error
2021-10-20 13:28:21 +00:00
pbatko-da
3a8b685346
[Short] Fix docs for Dispatcher#startingAt (#11304)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-20 14:02:04 +02:00
pbatko-da
8a3abce47b
[DPP-618][Self-service error codes] Adapt error codes in ApiPackageService (#11284)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-20 13:19:45 +02:00
pbatko-da
2267429ae1
[DPP-656] Assert on self-service error code details in ErrorFactoriesSpec (#11289)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-20 09:18:20 +02:00
pbatko-da
d3dad75d00
[DPP-592] Generate docs for self-service error codes. (#11129)
Adding `Daml Documentation >> Building applications >> "Self-Service Error Codes (Experimental)` section in the HTML documentation. 

The section is populated automatically with error code information retrieved from the classpath.
The process of generating documentation for error codes looks like this:
- first we find error codes information from the classpath,
- then we save it to a json file,
- then the json file is made available to a custom Sphinx extension,
- then the custom Sphinx extension generates documentation wherever we put a new custom Sphinx directive.

Try it out with
`./docs/scripts/live-preview.sh`
or
`./docs/scripts/preview.sh`


CHANGELOG_BEGIN
CHANGELOG_END
2021-10-20 08:47:54 +02:00
fabiotudone-da
2fd200fff8
KV: support contextual logging in KeyValueConsumption [KVL-1143] (#11288)
* Support contextual logging in KeyValueConsumption

CHANGELOG_BEGIN
CHANGELOG_END

* Fix formatting and imports

* Propagate the contextual logging per-readUpdates call

* No need for at-construction logging context in LogAppendingReadServiceFactory

* No need for logging context in CommitStrategySupport.newReadServiceFactory

* Fix JdbcIndexerSpec
2021-10-19 20:16:37 +00:00
pbatko-da
87f1418d91
[Short] Remove unnecessary traits from ApiSubmissionServiceSpec (#11254)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-19 15:49:07 +02:00
Samir Talwar
a9f6afbfde
kvutils: Rename VersionedOffset to KVOffset. (#11286)
There is no longer a non-versioned offset, so this is kind of
meaningless.

I also deleted `VersionedOffsetMutator`, which should not have made it
in.

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-19 09:34:19 +00:00
fabiotudone-da
98cf8d86b3
KV: introduce v2 error codes behind a CLI switch [KVL-1140] (#11224)
* Propagate error version switch to KeyValueConsumption

CHANGELOG_BEGIN
CHANGELOG_END

* Introduce v2 (self-service) KV error codes behind the CLI switch

* Test v2 codes and fix them

* Keep newline separating methods in KeyValueConsumption

* TransactionRejections: don't wrap updates in `Some`

* Factor errorVersionsTable

* Reorder imports

* Split "convert rejection to proto models and back to expected grpc code"

* Remove unneeded Option returned by decodeTransactionRejectionEntry

* Formatting fix

* Fix 7537e93d
2021-10-19 08:32:57 +00:00
Robert Autenrieth
46f6877ee5
Increase time model skew limits (#11273)
* Increase time model skew limits

changelog_begin
changelog_end

* Only override time model for sandbox
2021-10-18 21:27:53 +02:00
Samir Talwar
8f94cffdd1
kvutils: Use VersionedOffsetBuilder where possible, and introduce VersionedOffsetMutator. [KVL-1154] (#11277)
* kvutils: Remove `VersionedOffsetBuilder.apply`.

Doesn't do anything.

* ledger-on-memory: Use `VersionedOffsetBuilder`.

* indexer-benchmark: Use `VersionedOffsetBuilder`.

* ledger-on-sql: Use `VersionedOffsetBuilder`.

* kvutils: Use `VersionedOffsetBuilder` in tests.

* kvutils: Create a case class for `VersionedOffsetBuilder#split`.

* kvutils: Delete unused methods from the offset builders.

* kvutils: Use `Bytes#startWith` to check the offset version.

* kvutils: Move offset splitting into `VersionedOffset`.

* kvutils: Extract out versioned offset generators.

* kvutils: Replace `OffsetBuilder` with `VersionedOffsetMutator`.

This takes care of the last usages of `OffsetBuilder`, which were to
modify the lowest component of the offset.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Randomize the offset version in testing.

To make sure we don't use a hard-coded offset version anywhere.

* kvutils: `Random.between` is not available in Scala 2.12.

* kvutils: Move offset mutation methods to `VersionedOffset`.

* kvutils: Move the versioned offset construction into `VersionedOffset`.

The `VersionedOffsetBuilder` is still useful as it remembers the
version, meaning we only need to specify it once.
2021-10-18 16:50:52 +00:00
tudor-da
2fc7490df2
[Self-service error codes] Adapt error factories [DPP-656] (#11270)
* Moved ErrorCodesVersionSwitcher to //ledger/error

CHANGELOG_BEGIN
CHANGELOG_END

* Rename ErrorCodeLoggingContext to ContextualizedErrorLogger

* Refactored ErrorFactories
* All error factories use ContextualizedErrorLogger for being able to dispatch self-service error codes.
* The ContextualizedErrorLogger is passed down from the dispatching Ledger API services.
* ErrorFactoriesSpec asserts both legacy (V1) and self-service error codes (V2).

* Adapted ApiSubmissionService

* Addressed Marcin's review comments
2021-10-18 16:46:20 +02:00
nicu-da
b1a6b11d47
ledger-api-test-tool: Add static time awareness [KVL-1156] (#11266)
* ledger-api-test-tool: Add command line argument --static-time which makes the test tool aware that the ledger is running in static time

For command deduplication conformance tests this allows us to forward the time so that the tests can run in static time mode as well

CHANGELOG_BEGIN
CHANGELOG_END

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

* Do not run conformance test that cannot run in static time

* Remove hidden from static time flag for ledger api test tool

* ledger-api-test-tool: Clarify parts of the deduplication tests.

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
Co-authored-by: Fabio Tudone <fabio.tudone@digitalasset.com>
2021-10-18 14:16:25 +00:00
nicu-da
38712c0179
sandbox-next - Disable participant command deduplication [KVL-1156] (#11264)
CHANGELOG_BEGIN

sandbox-next - Disable participant command deduplication

CHANGELOG_END
2021-10-15 09:04:36 -07:00
nicu-da
68a93cf70f
kvutils - Use the ledger configured time for command dedup [KVL-1149] (#11239)
CHANGELOG_BEGIN
kvutils - Command deduplication uses the configured time model (static/wall) and not running always using wall-clock
CHANGELOG_END
2021-10-15 05:56:45 -07:00
Robert Autenrieth
0063b1037f
Retry faster during startup (#11255)
changelog_begin
changelog_end
2021-10-15 08:27:48 +02:00
Robert Autenrieth
04feb40a8f
Improve reset service tests (#11240)
* Improve reset service tests

- Increase timeout
- Decrease load
- Improve logging

changelog_begin
changelog_end

* Apply review comments
2021-10-15 02:15:58 +02:00
nicu-da
be899b32a8
Extract rejection_reason.proto from daml_kvutils.proto [KVL-1090] (#11235)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-14 00:22:45 -07:00
Remy
a1d94e10ba
LF: Create special case class for VersionedContractInstance (#11127)
To replace usage of ContractInstance[VersionedValue]

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-14 08:53:26 +02:00
pbatko-da
909a1bf896
[DPP-417][DDP-612] Adapt ApiSubmissionService to support V2 error codes (#11052)
Adapt ApiSubmissionService to support self-service (v2) error codes

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-13 14:19:10 +02:00
nicu-da
514e8b50a3
Extract configuration_rejection.proto from daml_kvutils.proto [KVL-1090] (#11215)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-13 10:34:45 +00:00
nicu-da
e3ae424682
Extract party_allocation.proto from daml_kvutils.proto [KVL-1090] (#11213)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-13 08:15:17 +00:00
Moritz Kiefer
74ef17c176
Bump size of ledger-on-memory tests (#11220)
On CI we’ve seen
//ledger/ledger-on-memory:ledger-on-memory-tests_test_suite_src_test_suite_scala_com_daml_ledger_on_memory_InMemoryLedgerReaderWriterIntegrationSpec.scala
run above the 60s timeout.

Even locally under load, it gets easily between 30s and 60s so CI
timing out is fairly reasonable.

changelog_begin
changelog_end
2021-10-12 17:43:30 +00:00
nicu-da
73d9ebfe0d
Extract transaction.proto from daml_kvutils.proto [KVL-1090] (#11208)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-12 16:02:33 +00:00
fabiotudone-da
652d56999b
ErrorCodesVersionSwitcher -> ValueSwitch and push it down to /ledger/error also for KV to use (#11207)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-12 14:18:23 +00:00
fabiotudone-da
04494136bd
Allow converting an error into a gRPC status [KVL-1142] (#11204)
* Allow converting an error into a gRPC status

CHANGELOG_BEGIN
CHANGELOG_END

* Add missing dependencies
2021-10-12 14:04:01 +00:00
Samir Talwar
fe6acb60fb
kvutils: Add VersionedOffsetBuilder#matchesVersionOf. (#11212)
This allows a caller to test whether an offset matches a specific
version without throwing an exception.

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-12 13:54:57 +00:00
nicu-da
24c6329579
Extract package_upload.proto from daml_kvutils.proto [KVL-1090] (#11209)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-12 13:19:13 +00:00
tudor-da
578fe7f10b
[Self-service error codes] Refactored for Canton compatibility [DPP-614] (#11164)
* [Self-service error codes] Refactored for Canton integration
* Introduces ErrorCodeLoggingContext which is used to abstract away the logging tech stack

CHANGELOG_BEGIN
CHANGELOG_END

* Moved all error definitions in //ledger/error

* Formatting

* Docs and remove of implicit conversion to DamlErrorCodeLoggingContext

* Fix compilation issues

* Fix tests

* Addressed Pawel's review comments

* Addressed Robert's review comments
2021-10-12 11:29:28 +00:00
nicu-da
b6f3f2087a
Extract the log_entry from daml_kvutils.proto [KVL-1090] (#11193)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-12 11:23:11 +00:00
nicu-da
d045ffaf1f
Extract the envelope from daml_kvutils.proto [KVL-1090] (#11192)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-12 02:00:59 -07:00
Robert Autenrieth
66adbc0366
DPP-463 switch conformance tests to append only (#11101)
* Use append-only schema in tests

changelog_begin
changelog_end

* Fix Oracle build

* Update ledger/ledger-on-memory/BUILD.bazel

Co-authored-by: tudor-da <tudor.voicu@digitalasset.com>

* Run more conformance tests on append-only

* Run pruning tests in split-participant mode

* Disable multi-participant test in split participant

* Add missing ContractIdIT test

Co-authored-by: tudor-da <tudor.voicu@digitalasset.com>
2021-10-11 23:31:30 +02:00
Miklos
7a54ca1926
Damlification of metrics prefix (#9665)
* Damlification of metrics prefix.
CHANGELOG_BEGIN
CHANGELOG_END

* Fixed reference to metrics prefix.

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-11 19:00:27 +00:00
nicu-da
d8651fae32
Extract configuration submission from daml_kvutils.proto [KVL-1090] (#11194)
CHANGELOG_BEGIN

CHANGELOG_END
2021-10-11 07:53:44 -07:00
Miklos
06834936bc
Removed InterpretationCostBasedLedgerWriterChooser*. (#11190)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-11 11:31:54 +00:00
Marton Nagy
af883fc109
Cleanup and activate unconditionally participant HA feature [DPP-497] (#10870)
* Removes flag and related configuration
* Removes unnecessary keepAlive approach from indexer

CHANGELOG_BEGIN
Participant HA feature added: Indexer component is guarded by database locks, and executes in a critical section (prevents overlapping indexer activity). Supported by Oracle and Postgresql database backends, and not supported by H2.
CHANGELOG_END
2021-10-11 11:13:15 +02:00
Robert Autenrieth
227a27daaa
DPP-641 Fix EndlessReadService and add tests (#11170)
* Fix EndlessReadService and add tests

changelog_begin
changelog_end

* Fix integrity query for H2
2021-10-11 11:10:12 +02:00
nicu-da
664aedd31b
Extract state.proto from daml_kvutils.proto [KVL-1090] (#11174)
CHANGELOG_BEGIN

CHANGELOG_END
2021-10-11 08:56:16 +00:00
nicu-da
ce24fc8679
Update scalafmt to 3.0.6 (#11178)
* Update scalafmt to 3.0.6

CHANGELOG_BEGIN

CHANGELOG_END

* Disable just docstring wrap for the new scalafmt version
2021-10-08 13:36:36 +00:00
Samir Talwar
e15487422d
kvutils: Add a SubmissionInfo parameter to the replaying read service. [KVL-1082] (#11169)
* kvutils: Tidy up LogAppendingReadServiceFactorySpec.

* kvutils: Add a `SubmissionInfo` parameter to the replaying read service.

Required for other KV ledger implementations.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Rename some constants in LogAppendingReadServiceFactorySpec.
2021-10-08 13:48:24 +02:00
Hubert Slojewski
15712a2a33
Add a missing test and documentation for the gRPC error factory [KVL-1119] (#11106)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-07 11:10:48 +00:00
Robert Autenrieth
cfcdc13c6e
Add deprecation output for sandbox classic (#11119)
changelog_begin
changelog_end
2021-10-06 00:04:18 +02:00
Robert Autenrieth
ac5c52dbe4
DPP-609 Add StorageBackendTestsDeduplication (#11088)
* Add StorageBackendTestsDeduplication

changelog_begin
changelog_end

* Check written deduplication time
2021-10-06 00:03:01 +02:00
tudor-da
31db15d555
Port error code changes (#11113)
* Port changes from Canton PR #7365

CHANGELOG_BEGIN
CHANGELOG_END

* Ported ErrorResource changes

* Ported constant use change

* Fix compilation issues
* Missing dependency on ledger-grpc
* Compilation issue SI-4440 in RejectionGenerators

* Re-review
2021-10-05 16:33:24 +00:00
fabiotudone-da
4df9b7c8f1
Rename command completion dedup time to duration in participant code [KVL-1057] (#10901)
* Rename Completion.deduplication_time to deduplication_duration

CHANGELOG_BEGIN
CHANGELOG_END

* Breaking protobuf change: regenerate `buf` image

Breaking-Proto: true

* Create a new grpc exception for each duplicate result [KVL-1099] (#10887)

* Create a new grpc exception for each duplicate result

The metadata in the exception is not thread safe, and when being converted into server headers netty.Utils.convertServerHeaders, it calls discardAll which mutates the metadata. Because this was reused for all duplicate exceptions then we got corrupted metadata.

CHANGELOG_BEGIN

CHANGELOG_END

* Do not call duplicate command exception twice

* Chore slow migration error removal (#10886)

* Avoid slow-progress timeout StoppedProgressing to avoid flakiness

CHANGELOG_BEGIN
CHANGELOG_END

* Make schema migration retries and backoff configurable

* Review feedback - use RetryStrategy.constant instead

* Remove unused tailrec import

* Simplifications and runF by Marton

* Rename config options from retry to attempt and default to 30 attempts

* Fix Parallel Indexer initialization issue [DPP-542] (#10889)

RCA: if at parallel indexer initialization some error happening, then a promise never completes, which causes an initialization future never complete
Expected: failure should be propagated, and recovering indexer should retry 10 seconds later
Actual: failure not propagated, a zombie future freezes initialization, preventing retries
Impact: this is a corner case - if no problems at indexer initialization, the issues is not surfacing

* Extracts critical logic into helper function initializeHandle
* Adds unit tests for initializeHandle
* Fixes issue by completing the promise in all cases

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-api-test-tool - Add conformance test for parallel command deduplication using CommandSubmissionService [KVL-1099] (#10869)

* Extract deduplication "features" into a configuration to be used around the tests.
Better naming for assertions that support sync and async deduplication

CHANGELOG_BEGIN

CHANGELOG_END

* Fix broken test and use consistency for tests

* ledger-api-test-tool - Add conformance test for parallel command deduplication

CHANGELOG_BEGIN
CHANGELOG_END

* Add import for 2.12 compat

* Add silencer plugin

* Split parallel command deduplication scenario into it's own test suite

* Add the parallel command deduplication test to append only ledgers

* Run parallel command deduplication tests for append only ledgers

* Apply suggestions from code review

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

* Code review renames

* Add compat import

* Run the test concurrently

* Further rename completions' `deduplication_time` to `*_duration` in participant's codebase

CHANGELOG_BEGIN
CHANGELOG_END

* Re-compute sha256s of migrations

* Fix expected error message

* Improve consistency of "deduplication time" Vs. "deduplication duration" references

* Revert Oracle schema whitespace change

Co-authored-by: Gerolf Seitz <gerolf.seitz@daml.com>
Co-authored-by: nicu-da <nicu.reut@digitalasset.com>
Co-authored-by: Oliver Seeliger <46452754+oliverse-da@users.noreply.github.com>
Co-authored-by: Marton Nagy <marton.nagy@digitalasset.com>
2021-10-05 12:04:27 +00:00
fabiotudone-da
d4cb1f945e
KV ledgers: disable participant side command de-duplication [KVL-1083] (#11095)
* Extract common code for command dedup conformance tests

CHANGELOG_BEGIN

CHANGELOG_END

* Revert changes for parallel tests

* Fix compile warnings

* Disable participant deduplication for KV

CHANGELOG_BEGIN
CHANGELOG_END

* Always call submitRequestAndAssertDeduplication with parties

* Fix party in CommandDeduplicationBase

* Don't test KV-based command deduplication with static time as it's broken

* Don't disable participant-side command deduplication for sandbox-next on static time

* Revert "Don't test KV-based command deduplication with static time as it's broken"

This reverts commit 3dac41aa

* Add missing dependency

* Don't cross-test this ledger API test tool with existing versions

* Add the current PR to the list of PRs that resulted in exclusions

* Apply @garyverhaegen-da's suggestion for compatibility exclusions

Co-authored-by: Nicu Reut <nicu.reut@digitalasset.com>
2021-10-05 13:31:53 +02:00
Hubert Slojewski
b9a5a83175
Minor: fix trace logging in TimeBasedWriteSetSelector (#11117)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-05 08:30:22 +02:00