Commit Graph

146 Commits

Author SHA1 Message Date
pbatko-da
a8c0984d9b
[User management] Make use of UM error group in the docs (#13260)
changelog_begin
changelog_end
2022-03-14 12:09:48 +01:00
pbatko-da
a27fa0c95a
[Error codes] Move and test logging value string serializer [DPP-606] (#13261)
changelog_begin
changelog_end
2022-03-14 12:09:10 +01:00
pbatko-da
f210ee933c
Add missing context in PackageServiceError (#13258)
changelog_begin
changelog_end
2022-03-11 13:20:59 +01:00
pbatko-da
d891a9a9c2
[Error codes] Use scala.deprecated instead of a custom annotation [DPP-776] (#13163)
changelog_begin
changelog_end
2022-03-10 14:10:52 +01:00
pbatko-da
2ac30b21f5
Remove conformance mode from com.daml.error.definitions.RejectionGenerators (#13218)
changelog_begin
changelog_end
2022-03-10 12:15:32 +01:00
pbatko-da
fbb3ba55c2
Simplify implementations of BaseError trait [DPP-606] (#13185)
1. Remove `BaseError.Impl`, `LoggingTransactionErrorImpl` and `LoggingPackageServiceError` 
and instead provide more direct `DamlError` and `DamlErrorWithDefiniteAnswer`.


2. Remove custom implementation of `TransactionError.rpcStatus` and instead provide simpler one in `DamlErr.r.rpcStatus` (which works by first calling `code.asGrpcStatus` and then converting the result to `com.google.rpc.status.Status`).

3. Remove `GrpcStatus.toProto` and instead use `DamlError.rpcStatus`.

4. Use `asGrpcStatus` and `asGrpcError`  instead of `asGrpcStatusFromContext` and `asGrpcErrorFromContext` where possible.


changelog_begin
changelog_end
2022-03-10 12:12:14 +01:00
pbatko-da
df2cb4a1fd
[Error codes doc] Put generated source files of error inventories under version control [DPP-606][DPP-777] (#13181)
And add a check (a unit test) that the generated files are up-to-date with what can be generated.
If the check fails then one will need to run `./docs/scripts/gen-error-docs-src.sh` and commit the changes.

changelog_begin
changelog_end
2022-03-10 12:06:58 +01:00
pbatko-da
98fbaae668
[Error codes] Stop using reflective 'BaseError.extractContext' to extract error's context (#13199)
changelog_begin
changelog_end
2022-03-09 10:52:11 +01:00
pbatko-da
877713edd3
Move validation error helpers out of ErrorFactories [DPP-606] (#13180)
changelog_begin
changelog_end
2022-03-08 17:15:26 +01:00
pbatko-da
1c4b767295
Pattern match on each log level when logging errors (#13182)
changelog_begin
changelog_end
2022-03-08 15:01:10 +01:00
pbatko-da
37c645333f
Use an error code when AkkaGrpc services get closed (#13175)
changelog_begin
Ledger API Specification: Streaming endpoints will use error code 'SERVER_IS_SHUTTING_DOWN' when the server
is being shut down, whereas before an exception without an error code was used.
Grpc status code in use remains 'UNAVAILABLE'.
changelog_end
2022-03-08 12:48:22 +01:00
pbatko-da
c7c211e4df
Remove most of ErrorFactories [DPP-606] (#13146)
changelog_begin
changelog_end
2022-03-07 16:15:21 +01:00
pbatko-da
15aa300fba
Use DamlContextualizedErrorLogger.forTesting (#13137)
changelog_begin
changelog_end
2022-03-04 12:24:08 +01:00
pbatko-da
af27f5d926
Make ErrorFactories into an object in preparation for its removal. [DPP-606] (#13143)
changelog_begin
changelog_end
2022-03-04 09:35:38 +01:00
pbatko-da
56306eb387
[User management] More race condition tests. Simplifications in the backend. (#13140)
changelog_begin
changelog_end
2022-03-03 22:48:11 +01:00
pbatko-da
a84c2cd68f
Add tests and use ErrorDetails.matches (#13139)
changelog_begin
changelog_end
2022-03-03 09:33:37 +01:00
pbatko-da
a4f9dd79c6
[User management] Add race conditions test-tool tests for CreateUser and GrantUserRights [DPP-847] (#12983)
changelog_begin
changelog_end
2022-02-22 17:36:06 +01:00
Remy
380dfa3502
LF: Add cause to internal error (#12965)
When an internal error is due to an unexpected exception, we wrap the
exception into the InternalError.

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-16 11:06:10 +00:00
Kamil Bozek
dfd38186fe
Remove pre-1.18 error codes [DPP-773] (#12841)
* Remove legacy error codes

CHANGELOG_BEGIN
CHANGELOG_END

* Remove ValidatorFixture

* Removed redundant helper function

* Remove redundant object

* Rebased.

run-full-compat: true

* Rebased.

run-full-compat: true
2022-02-15 15:28:36 +01:00
tudor-da
dd6dab6e6b
[Sandbox-on-X] Address various TODOs (#12823)
* Removed no-action TODOs

changelog_begin
changelog_end

* Assert self-service error codes in SequenceSpec

* Move InternallyInconsistentKeys and InternallyDuplicateKeys to LedgerApiErrors.WriteServiceRejections

* Restructured ledger bridge metrics
* Buffers before each processing stage

* Do not log the failure stacktrace on ledgerId lookup

* Addressed review comments

* Buffer size before prepare submission is 128
2022-02-11 17:03:41 +00:00
pbatko-da
7137b46543
[User management] Use pagination for listing users [DPP-840] (#12610)
CHANGELOG_BEGIN
Ledger API Specification: UserManagementService.ListUsers is now using pagination
CHANGELOG_END
2022-02-03 20:32:50 +01:00
tudor-da
716cc22ac9
Deduplication offset period errors handled in Sandbox-on-X [DPP-872] (#12652)
* Deduplication offset period errors handled in Sandbox-on-X
* InternalUnsupportedOperation error category

changelog_begin
changelog_end

* Apply suggestions from code review

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

* Addressed review comments

* Apply suggestions from code review

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

Co-authored-by: Simon Meier <meiersi-da@users.noreply.github.com>
2022-02-01 10:32:38 +00:00
nicu-da
c1afabe653
[participant-state] Add earliest_offset metadata to pruned data error [kvl-1270] (#12546) 2022-01-31 16:54:24 +00:00
pbatko-da
c72c27c967
[User management] Terminate ongoing streams when user state has changed [DPP-830] (#12437)
CHANGELOG_BEGIN
Ledger API Specification: When using user management based authorization streams will now get aborted on authenticated user's rights change.
CHANGELOG_END
2022-01-28 16:44:39 +01:00
tudor-da
cfa8d30491
[Sandbox-on-X] Ledger-side in-memory command deduplication [DPP-872] (#12596)
* [Sandbox-on-X] Ledger-side in-memory command deduplication

changelog_begin
changelog_end

* Enirched SequenceSpec test

* Participant-side deduplication compatibility tests exclusions

* Fix LedgerConfigurationServiceIT

* Disable command deduplication tests for SoX without conflict checking

* Remove redundant max-dedup-seconds bridge config

* Default max deduplication time 5 minutes

* Deduplication queue length metrics

* Add back removed ledger config test in SequenceSpec
2022-01-28 11:42:25 +00:00
pbatko-da
4ec336dd6a
[User management] Enforce 1k user rights limit [DPP-833] (#12558)
CHANGELOG_BEGIN
Ledger API Specification: Maximum number of user rights per user is now limited to 1000 and is added to UserManagementFeature in VersionService. getLedgerApiVersion endpoint.
CHANGELOG_END
2022-01-27 22:12:34 +01:00
tudor-da
3e16e5ec98
Handle ledger bridge Queue errors (#12510)
changelog_begin
changelog_end
2022-01-26 18:48:00 +00:00
pbatko-da
42d86acd06
[User management] Disabling user management in auth when user management feature is disabled [DPP-827] (#12503)
CHANGELOG_BEGIN
CHANGELOG_END
2022-01-25 09:55:37 +01:00
Stefano Baghino
aec3390904
Replace silencer plugin with built-in warning configuration (#12543)
Since Scala 2.13.2, Scala introduced built-in support to
manage warnings in a more granular fashion, thus making
the silencer plugin we are currently using no longer
strictly useful. Removing compiler plugins also removes
friction from migrating to Scala 3 in the future. As a
cherry on top, the built-in warning configuration also
allows to check whether a `@nowarn` actually does
anything, allowing us to proactively remove unused
warnings should the need arise.

[Here][1] is s a blog post by the Scala team about it.

Warnings have been either solved or preserved if useful,
trying to minimize the scope (keeping it at the single
expression scope if possible). In particular, all
remaining usages of the Scala Collection API compatibility
module have been removed.

Using the silencer plugin also apparently hid a few
remaining usages of compatibility libraries that were used
as part of the transition from Scala 2.12 to Scala 2.13
that are no longer needed. Removing those warnings
highlighted those.

changelog_begin
changelog_end

[1]: https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
2022-01-24 15:01:35 +00:00
mziolekda
954bc5e0d4
Remove the reset service from sandbox-classic and sandbox [DPP-804] (#12448)
* Remove the reset service from sandbox-classic and sandbox

CHANGELOG_BEGIN
Reset service has been removed from the sandbox-classic, sandbox and daml-on-sql
CHANGELOG_END

* format it
2022-01-19 09:18:14 +01:00
pbatko-da
4fe6e53b9d
[User management] Persistence with caching (#12344)
Adding
 - `PersistentUserManagementStore` and `CachedUserManagementStore`,
 - `UserManagementStorageBackendTemplate` and sql migrations,
 - CLI flags: `--user-management-max-cache-size` and `--user-management-cache-expiry`;
 And wiring `PersistentUserManagementStore` where before we had `InMemoryUserManagementStore`.
2022-01-18 15:59:22 +01:00
Simon Meier
62b61c0d51
ledger api auth: polish error messages (#12350)
* ledger api auth: polish error messages

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-11 18:16:59 +00:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
Andreas Lochbihler
9a931854b2
add docs for command dedup (#11928)
CHANGELOG_BEGIN
Documentation on the new command deduplication mechanism
CHANGELOG_END
2021-12-14 09:36:32 +01:00
Simon Meier
f223528bfb
Implement PoC of user management for Ledger API server (fix #12014) (#12063)
CHANGELOG_BEGIN
- [User Management]: add support for managing participant node users and authenticating
  requests as these users using standard JWT tokens.
CHANGELOG_END

Co-authored-by: Marton Nagy <marton.nagy@digitalasset.com>
Co-authored-by: Adriaan Moors <90182053+adriaanm-da@users.noreply.github.com>
2021-12-13 17:58:30 +01:00
pbatko-da
25ae69eb01
[DPP-657] Make error codes docs nicer (#12079)
Changes:
1. Limit local table of contents depth in HTML view.
2. Move some subsections higher up in the hierarchy.
3. Move error categories inventory right before error codes inventory.

CHANGELOG_BEGIN
CHANGELOG_END
2021-12-10 17:24:27 +01:00
pbatko-da
07274d1b52
[DPP-772] Review error category docs. (#12067)
CHANGELOG_BEGIN
CHANGELOG_END
2021-12-10 10:13:57 +01:00
pbatko-da
f330ace261
[DPP-765] Follow-up to generic gRPC error handler (#12056)
CHANGELOG_BEGIN
CHANGELOG_END
2021-12-10 10:12:14 +01:00
pbatko-da
99091db18c
[DPP-771][Error codes] Add readme.md and supplement docs with a concrete error handling example. (#11990)
CHANGELOG_BEGIN
CHANGELOG_END
2021-12-08 13:09:21 +01:00
pbatko-da
5119829a64
[DPP-765] Intercept unhandled (non-self-service) exceptions from Participant API endpoints (#11965)
CHANGELOG_BEGIN
CHANGELOG_END
2021-12-08 09:58:44 +01:00
pbatko-da
0613a712c9
[DPP-767] Add assertion for logged messages in ErrorFactoriesSpec (#11973)
CHANGELOG_BEGIN
CHANGELOG_END
2021-12-08 09:54:49 +01:00
nicu-da
28e62820ef
[ledger-api] - Rename the error metadata key for invalid deduplication duration (#11966)
changelog_begin
[ledger-api] - rename metadata key max_deduplication_duration to longest_duration for error concerning invalid deduplication durations
changelog_end
2021-12-05 23:55:47 -08:00
Remy
b02ed7765a
LF: Introduce configurable limits on produced transactions (#11948)
This is part of #11691

This PR allows to limits:
- the number of signatories,
- the number of observers,
- the number of controllers,
- the number of inputContracts,

CHANGELOG_BEGIN
CHANGELOG_END
2021-12-02 16:31:09 +01:00
pbatko-da
5641948410
[Docs] Add labels to error codes to support references to them (#11913)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-30 14:30:58 +01:00
nicu-da
61334cff77
kvutils - Add Writer which can handle deduplication periods as offsets [KVL-1172] (#11900)
changelog_begin
changelog_end
2021-11-29 10:28:07 -08:00
Sofia Faro
0b9d57b95e
Add ContractDoesntImplementInterface error. (#11884)
* Add a ContractDoesntImplementInterface error

Part of #10810 and #11703

changelog_begin
changelog_end

* use inside

* rename error
2021-11-29 15:54:31 +00:00
pbatko-da
c27406cdcf
[DPP-762][Self-service error codes] Automate generation of inventory of error categories. #11879
Other changes:
- Fix ErrorCodeDocumentationGeneratorSpec not being in any bazel target.
- (partially) Fix inconsistent usage of deprecated, Deprecation and DeprecatedDocs annotation.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-26 10:22:14 +01:00
pbatko-da
5f3a4d2067
[Self-service error codes] Fix section numbering in pdf for error codes section by moving it a level higher. (#11867)
Also make section header markers consistent docs' reamde.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-25 13:46:12 +01:00
tudor-da
cf3ac011ca
[Self-service error codes] Do not return error code id and definite_answer in metadata for security sensitive errors (#11828)
* [Self-service error codes] Do not return error code id in metadata

CHANGELOG_BEGIN
CHANGELOG_END

* Do not propagate definite_answer
* Additionally, remove redundant context info from error codes

* Fix tests

* Create IndexDbException as a specialization
* Used to globally define error codes returned by the persistence layer
that are logging
2021-11-25 12:42:29 +01:00
Sofia Faro
5c12d757f4
Add a guard when exercising by interface. (#11836)
* Add a guard when exercising by interface.

This fixes part of #11703, when exercising an inherited choice by
interface and you know the template id, via the command preprocessor.

It does this by inserting a "guard" in between the interface fetch and
the exercise body. The guard is a function Interface -> Bool, which
is general enough to check the template id, without complicating too
much in speedy. And can be generalized in the future to check more,
like signatories, etc.

I added the guard as an optional argument to UExerciseByInterface.
This isn't hooked up to the protobuf AST yet (or Haskell side for
that matter) -- but I'll do it in the next PR! For now you can invoke
the guarded exercise via the command preprocessor, so I can enable the
approprate engine tests. (There's still some failing fetch tests left,
but I decided to leave this for later. Fetch can be a lot simpler than
guarded choices, since you always add a fetch node. No need for fancy
continuations.)

changelog_begin
changelog_end

* scalafmt

* Feedback and fix matches

* Update comments, we are always going to abort the transaction

* Raise WronglyTypedContract in SBGuardTemplateId.

* rebase and fix parser

* restore ANF

* scalafmt
2021-11-24 14:22:40 +00:00
nicu-da
59eb0d2eff
kvutils - For duplicate command rejections, add the submission id as metadata [KVL-1175] (#11848)
changelog_begin
kvutils - For duplicate command rejections, the submission id of the already accepted transaction is returning as part of the gRPC metadata. The submission id will be included under the key `existing_submission_id`.
changelog_end
2021-11-24 04:32:34 -08:00
tudor-da
329e609ec4
[Self-service error codes] Group explanations (#11715)
* [Self-service error codes] Error group descriptions

CHANGELOG_BEGIN
CHANGELOG_END

* Apply suggestions from code review

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

Co-authored-by: mziolekda <marcin.ziolek@digitalasset.com>
2021-11-23 20:30:33 +00:00
pbatko-da
55191847cd
[DPP-673][Self-service error-codes] Generate error code directory compatible with both pdf and html docs (#11794)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-23 15:30:48 +01:00
tudor-da
1bfcbc978b
Refactoring for Canton compatibility on PackageServiceErrors (#11812)
* Refactoring for Canton compatibility on PackageServiceErrors
* ErrorResource.all is public for accessibility from Canton

CHANGELOG_BEGIN
CHANGELOG_END

* Keep PackageServiceError object
2021-11-22 19:14:03 +00:00
Moritz Kiefer
addb2edc03
Drop Scala 2.13 version guards from Bazel definitions (#11819)
changelog_begin
changelog_end
2021-11-22 17:37:49 +00:00
tudor-da
b0a1bf79df
More missing error codes (#11749)
* Missing error codes in Sandbox classic

CHANGELOG_BEGIN
CHANGELOG_END

* Covering more errors above the persistence layer

* Fix wrong contextualizedErrorLoggers

* Compilation fixes
2021-11-18 10:00:43 +00:00
Moritz Kiefer
fa7663148a
Drop 2.12 versioned_scala_deps (#11748)
I’ve kept the infrastructure for versioned_scala_deps around because
I’m optimistic and hope that eventually we’ll do another Scala upgrade.

changelog_begin
changelog_end
2021-11-17 22:13:08 +00:00
tudor-da
a05a40aeec
[Self-service error codes] Adapt ResetService in Sandbox classic (#11731)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-17 11:11:54 +01:00
tudor-da
fbc436d70a
[DPP-739][Self-service error codes] Adapt QueueBackedTracker error codes (#11719)
* [Self-service error codes] Adapt QueueBasedTracker

CHANGELOG_BEGIN
CHANGELOG_END

* Added changed error codes to migration guide

* Fixed ErrorFactoriesSpec

* Update ledger/error/src/main/scala/com/daml/error/definitions/LedgerApiErrors.scala

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

Co-authored-by: Pawel Batko <pawel.batko@digitalasset.com>
Co-authored-by: mziolekda <marcin.ziolek@digitalasset.com>
2021-11-16 22:21:29 +00:00
pbatko-da
07cff7cdb7
[DPP-417][Self-service error-codes] Document error categories. (#11727)
* [Self-service error-codes] Docs intro WIP

* CHANGELOG_BEGIN
CHANGELOG_END

* 1

* Fix rst

CHANGELOG_BEGIN
CHANGELOG_END

* [DPP-417][Self-service error-codes] Document error categories.

CHANGELOG_BEGIN
CHANGELOG_END

* 1

* Fix
2021-11-16 22:55:35 +01:00
tudor-da
05f604d672
[Self-service error codes] Enrich migration guide [DPP-755] (#11711)
* Adapted migration guide to include changes from https://github.com/digital-asset/daml/pull/11686

CHANGELOG_BEGIN
CHANGELOG_END

* Enriched migration guide with Sandbox-classic changed gRPC error codes

* Added migration guide for error codes changed in KV committer

* Extract the KV and Sandbox-classic migration guides

* Hierarchical order of error codes docs

* Added back full grpc error code description to columns
* Using "gRPC status code" instead of "gRPC error code"
* Addressed review comments from Hubert

* Apply suggestions from code review

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>

* Addressed review comments
* Use 'Error codes' instead of 'Self-service error codes'

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
2021-11-16 14:25:53 +00:00
tudor-da
ec6d7cc3db
[Self-service error codes] Error code definitions revisiting [DPP-675] (#11686)
* Error definitions revisiting and hierarchical grouping refactoring

CHANGELOG_BEGIN
CHANGELOG_END

* Full hierarchical path for error grouping

* Addressed Pawel's review comments

* Apply suggestions from code review

Co-authored-by: mziolekda <marcin.ziolek@digitalasset.com>
Co-authored-by: pbatko-da <pawel.batko@digitalasset.com>

* Do not strip margin in error code explanations

* Revert changing LEDGER_ID_MISMATCH from NOT_FOUND to FAILED_PRECONDITION

Co-authored-by: mziolekda <marcin.ziolek@digitalasset.com>
Co-authored-by: pbatko-da <pawel.batko@digitalasset.com>
2021-11-15 21:28:13 +00:00
tudor-da
8e08450220
[Self-service error codes] No redundant logging in Ledger API (#11649)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-15 09:13:50 +01:00
tudor-da
d6ca68dc23
[Self-service error codes] Adapt Sandbox classic rejection error codes (#11622)
* [Self-service error codes] Adapt Sandbox classic rejection error codes
* Unify common rejection error codes with KV
* Adapt conformance tests

CHANGELOG_BEGIN
CHANGELOG_END

* Fix JdbcLedgerDaoPostCommitValidationSpec

* Addressed first round of review comments

* Addressed Miklos' comments

* Revert camelCasing invalidLedgerTime arguments

* Moves DuplicateCommand to CommandRejections

* Addressed Gerolf's comments
2021-11-12 16:33:02 +00:00
tudor-da
c5a1f0bb61
Republish error codes generator lib (#11633)
* Republish error codes generator libraries
* Additionally, add kvutils to classpath for generating KVErrors docs

CHANGELOG_BEGIN
CHANGELOG_END

* Use a new annotation (DeprecatedDocs) instead of @deprecated

* Needed for adding descriptions to the error groups docs. Needed for allowing cross-compilation
to 2.12 and 2.13, not possible due to the reflections machinery of extracting
the message from @deprecated
2021-11-10 19:08:33 +01:00
tudor-da
92dfcdeb24
[Self-service error codes] Use error validators in ApiPackageManagementService (#11575)
* Use error validators in ApiPackageManagementService

CHANGELOG_BEGIN
CHANGELOG_END

* Exclude PackageManagementServiceIT from compatibility tests after 1.17

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-09 21:54:26 +01:00
nicu-da
9b94fa9769
[ledger-api] - metadata for invalid deduplication period [KVL-1170] (#11534)
CHANGELOG_BEGIN
[ledger-api] - Return max_deduplication_duration as part of the metadata sent with the gRPC status for commands rejected because of invalid deduplication periods
CHANGELOG_END
2021-11-08 14:45:35 +00:00
tudor-da
21c97453bd
[Self-service error codes] ValueSwitch parameterized method (#11567)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-08 12:11:56 +00:00
fabiotudone-da
08236012af
Self-service errors: generate error deprecation docs [KVL-1187] (#11539)
* Render error deprecation in generated docs

CHANGELOG_BEGIN
CHANGELOG_END

* Build export-error-codes-json-app with Scala 2.13 only

* Generate docs only with Scala 2.13

* Generate daml-on-sql docs only with Scala 2.13

* Split the error codes JSON generator off from the error lib

* Build all docs only with Scala 2.13
2021-11-05 01:23:38 +01:00
fabiotudone-da
214c7ab445
Self-service errors: generate groups documentation [KVL-1186] (#11526)
* Add groups information to JSON

CHANGELOG_BEGIN
CHANGELOG_END

* Code cleanup

* Fix docs generation

* Fix KVErrors group explanation string

* Render error group explanations in generated docs

* Fix ErrorCodeDocumentationGeneratorSpec
2021-11-04 12:07:29 +01:00
nicu-da
9bb1d6443c
[ledger-api] - Return FAILED_PRECONDITION gRPC status code for invalid deduplication duration [KVL-1170] (#11483)
CHANGELOG_BEGIN
[ledger-api] - Return FAILED_PRECONDITION gRPC status code, instead of INVALID_ARGUMENT, for an invalid command deduplication duration
CHANGELOG_END
2021-11-03 13:34:31 +00:00
pbatko-da
8a9f15b8de
[DPP-686][Self-service error codes] Removing default error factories (#11403)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-03 09:40:19 +01:00
tudor-da
17c2fa9122
ErrorCodeDocumentationGenerator uses multiple prefixes for scanning classpaths (#11504)
* Removed ProtoDeserializationErrors (not needed at the moment)

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-02 17:09:08 +00:00
tudor-da
78735a8d27
Less logging on //docs:generate-error-codes-json (#11486)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-01 16:33:27 +00:00
tudor-da
a79cc08687
DbDispatcher handles SQL exceptions with self-service error codes [DPP-690] (#11435)
* DbDispatcher handles transient and non-transient SQL exceptions with specific error codes

CHANGELOG_BEGIN
CHANGELOG_END

* Handle retries when verifying ledger id

* Addressed Pawel's comments

* Logging clean-up and small refactoring

* Exhaustive match against Oracle and PSQL exceptions
2021-11-01 13:35:33 +01:00
fabiotudone-da
e91ced54f3
KV: generate self-service error docs [KVL-1148] (#11431)
* Differentiate committer deduplication error code

* Let error docs generator tolerate `deprecated`

* Generate error documentation for KV

CHANGELOG_BEGIN
- [Integration Kit] Document KV-specific self-service errors
CHANGELOG_END

* Cleanup ErrorCodeDocumentationGenerator

* Add test case for deprecated errors

* Improve ErrorCodeDocumentationGenerator.getAnnotations

* Fix test

* Factor annotationTypeName

* Fix formatting

* Use case class for annotations and deal with missing ones in convertToDocItem

* Improve cause wording for KV duplicate command self-service error

* Simplify error message

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

Co-authored-by: tudor-da <tudor.voicu@digitalasset.com>
2021-11-01 10:13:06 +00:00
tudor-da
6c88e55509
Pass submission id as correlation id to error codes in Ledger API (#11381)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-27 19:26:53 +00:00
fabiotudone-da
4a34b68500
KV: port V2 errors to self-service errors framework [KVL-1143] (#11326)
* KV: port V2 errors to self-service errors framework

CHANGELOG_BEGIN
CHANGELOG_END

* Fix ConversionsSpec compiling

* Use a valid ID for ValidationFailure

* Fix error details in Conversions

* Relax and simplify checks in KeyValueConsumptionSpec

* Fix formatting

* Fix definite answer in deduplication v2

* Try and make Scala 2.12 happy

* Fix typos in comments

* Use NOT_FOUND for unknown parties and provide them as resources

* Race (group) -> SubmissionRaces

* Don't deprecate resource exhausted (ABORTED) error

* Rename KVCompletionErrors group into KVErrors (ResourceExhausted can be synchronous)

* Remove unneeded braces

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

* Move toJsonString to where it's used

* Deprecate InvalidLedgerTime

* Embed deprecation comments into annotation

* Change deprecation messages so that they make more sense in the docs

* Move deprecated errors to a dedicated group as proposed by @tudor-da

Co-authored-by: Hubert Slojewski <hubert.slojewski@digitalasset.com>
2021-10-26 21:17:18 +00:00
tudor-da
ba6c2be1b5
Add missing TransactionId to com.daml.error.ErrorResource (#11396)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-26 09:32:15 +00:00
tudor-da
03cfd1237c
Configurable assertions in Ledger API test tool by feature descriptors (#11328)
* ApiVersionService propagates self-service error codes flag.
* ParticipantTestContext is enriched with feature descriptors
* ContractIdIT adapted with assertions for self-service error codes

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-25 14:13:44 +02:00
pbatko-da
79037c8855
[DPP-646][Self-service error codes] Adopt ApiPackageManagementService (#11314)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-25 12:11:15 +02:00
pbatko-da
c60c94b13f
[DPP-645][Self-service error codes] Adapt ApiConfigManagementService (#11312)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-22 12:28:15 +02:00
pbatko-da
443b64dffc
[DPP-621][Self-service error codes] Adopt error codes in ApiVersionService (#11302)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-21 14:03:10 +02:00
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
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
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
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
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
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
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
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
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
tudor-da
b6a6bf7aac
[Ledger API error codes] Extracted common errors and groups [DPP-607] (#10890)
* Extracted common error implementations
* ErrorGroups
* TransactionError hierarchy
* LedgerApiErrors
* PackageServiceError
* ProtoDeserializationError
* PruningServiceError
* SubmissionErrors

CHANGELOG_BEGIN
CHANGELOG_END

* Adapt extracted error groups and definitions to adhere to local tech stack:
* Use //ledger/error:error core API
* Use DAML SDK logging stack
* Manual rebase to latest changes from Canton

* Extracted RejectionGenerator from Canton

* Adapted RejectionGenerator
* Added //ledger/error:error to artifacts

* Pass correlationId to errors
* Pass parameters as implicits to shave some lines and improve readability

* Workaround for encountered Scala/JDK8 bug

* Addressed Ratko's review comments
2021-09-16 17:19:03 +02:00
tudor-da
38227a8ed7
[Ledger API error codes] ErrorCode enrichments [DPP-591] (#10874)
* [Daml error codes API] Further implementations
* Implements ErrorCode.asGrpcError (and test)
* Error code logging now accepts correlation id and an extra context map
* Full error context is included into enriched logging context

CHANGELOG_BEGIN
CHANGELOG_END

* Fixed Scala 2.12 compilation issues
2021-09-15 07:43:32 +02:00
tudor-da
97e14de644
[Ledger API error codes] ErrorCode interfaces and generator [DPP-591] (#10836)
* [Ledger API error codes] ErrorCode interfaces and generator
* Implementation of annotation processor
* Implementation of DocItem generator
* Unit testing of the generator and error code logging

CHANGELOG_BEGIN
CHANGELOG_END

* Addressed review comments
2021-09-14 13:50:00 +02:00