Commit Graph

669 Commits

Author SHA1 Message Date
Stephen Compall
951817aee1
run query-store-independent tests less often (#15201)
* declare the separate kind of duplication

CHANGELOG_BEGIN
CHANGELOG_END

* move completely independent tests

* move many tests to 'QueryStoreIndependent'

* fix metering-report test to work with user tokens

* rename query-store/auth-dependent tests

- to QueryStoreAndAuthDependentIntegrationTest
- from AbstractHttpServiceIntegrationTestTokenIndependent

* security evidence moved
2022-10-11 09:27:07 -04:00
Nicu Reut
2f453a145c
Extract the testing metrics instance [PLEN-4] (#15192) 2022-10-10 18:52:49 +00:00
Stephen Compall
70f118579c
remove some ResolvedQuery cases (#15000)
* introduce ForQuery to overload ActiveContract.fromLedgerApi
* remove booleans from ResolvedQuery.apply
* wrong error string
* use the fact that query is non-empty to hide the Empty case
* we definitely only need a Semigroup, which fixes the law violation
* remove Empty

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Chun Lok Ling <110462561+chunlokling-da@users.noreply.github.com>
2022-10-10 09:33:40 -04:00
atriantafyllos-da
507f18ad20
Dpp 1222 move metric tagging classes to daml sdk (#15067)
Moved canton's tagging metric class [DPP-1222].

CHANGELOG_BEGIN
CHANGELOG_END
2022-10-03 14:23:07 +02:00
Simon Maxen
0654f9978c
Add libs-scala/struct-json (#15090)
changelog_begin
changelog_end
2022-09-29 16:22:01 +01:00
Chun Lok Ling
40e994bd46
Bug fix. template id of archived contracted should be interface id instead (#15117)
* use Consume.syntax

* added exercise in interface "sub query endpoint" test case. checked template id of archive. it is asserting to be template id but not interface id which is wrong. I will change it back to interface id after all CI passed

* test that the archive events have the interface ID; add the template-ID-to-interface-ID mapping to archive events in websocket result stream

* Add change log

CHANGELOG_BEGIM
CHANGELOG_END

* Add change log

CHANGELOG_BEGIN
CHANGELOG_END

* use JSON converter instead of hand-writing JSON

* factor assertions for created records

* combine value assertions

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-09-29 11:52:19 +01:00
Stephen Compall
9f1033a6ec
remove some domain.TemplateId usages (#15097)
* replace several TemplateId with ContractTypeId
* replace several TemplateId with ContractTypeId.Template
* deprecate, even though this misses so many usages
* link to #15098 for followups

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-27 07:53:10 -04:00
Stephen Compall
c1cde096b2
replace OneAnd with NonEmpty for query templateIds (#15088)
CHANGELOG_BEGIN
CHANGELOG_END
2022-09-26 16:06:58 +00:00
mziolekda
41dc32a016
Remove reliance on implicit party allocation in CI tests [DPP-1234] (#15037)
* Remove reliance on implict party allocation in the authorization tests of the sandbox-on-x

CHANGELOG_BEGIN
CHANGELOG_END

* Remove the HOCON and cli config parameters

* Remove implicit party allocation from the Submission Service

* Remove support for implicit parties from the bridge

* Fix codegen reliance on implicit party allocation

* Fix daml script tests

* Fix trigger tests

* format security-evidence.md post rebase

* Fix json-api tests

* One more json-api test

* Fix haskell tests

* Corrections post-review

* Cosmetic improvements

* Fix race condition in party allocation handling
2022-09-22 10:20:53 +02:00
Stephen Compall
77672d2896
better JsNull check for Oracle; test scenarios for nested cases (#15022)
* a couple comparison query scenarios with nested position
* same JSON null test, but different
- 'gt string' (scenario 0) fails without this change
- 'gt int' (scenario 1) succeeds regardless of this change

CHANGELOG_BEGIN
- [JSON API with Oracle] Fix some nested queries that were returning no
  data.  DisableContractPayloadIndexing must be set to true to take
  advantage of this fix.
CHANGELOG_END
2022-09-21 10:21:35 +00:00
Stephen Compall
a9ebecfe5c
retest Oracle with payload indexing (#15041)
* point to #14844 and #15040 for some TODOs
* duplicate the Oracle tests, disable large literals when indexing is on
* split test file for parallelization

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-20 10:32:58 -04:00
Stephen Compall
36e49c737b
factor stream-starting code in websocket JSON API tests (#15008)
CHANGELOG_BEGIN
CHANGELOG_END
2022-09-13 19:26:59 +00:00
Stephen Compall
5bec0ba4d2
remove redundant StatusCode checks from many tests (#15007)
* ensure Status is redundant for every parseResponse user
* make parseResponse test and discard the HTTP status
* use resultContractId more

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-13 09:40:49 -04:00
Chun Lok Ling
419bf9b040
Fire a warning if both config file and cli opts found. (#14981)
* fire a warning if both config file and cli opts found.

* add change log

CHANGELOG_BEGIN
CHANGELOG_END

* fixes test case

* fmt
2022-09-08 21:22:25 +01:00
Chun Lok Ling
9b73243eea
Remove : ResolvedQuery from pattern match (#14972)
Addressed #14966

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-08 09:02:01 +01:00
atriantafyllos-da
2b89f6beea
One leeway config for all autorizers [DPP-1215]. (#14930)
* One leeway config for all autorizers [DPP-1215].

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-07 15:07:42 +02:00
Chun Lok Ling
32583edb7d
v1/stream/query interface subscription support (#14919)
* replace Set[TemplateId.Resolved] with ResolvedQuery in StreamPredicate val resolved
CHANGELOG_BEGIN
CHANGELOG_END

* make it compile first and fix those TODOs iteratively.

* `Unsupported or ResolvedQuery monoid` for collectively combine `ResolvedQuery`s; handle unsupported cases

* cleanup todo

* cleanup

* use resolvedQuery instead and add change log

CHANGELOG_BEGIN
CHANGELOG_END

* compile

CHANGELOG_BEGIN
CHANGELOG_END

* added test cases

CHANGELOG_BEGIN
CHANGELOG_END

* Address Ray's comment

CHANGELOG_BEGIN
Users can now subscribe `v1/stream/query` with queries with single interface id.
CHANGELOG_END

* Address Ray's comment

* Address Ray's comment

* fmt

* fix error message

* fix error message

* Addressed Stephen's comment

* Addressed Stephen's comment

* Addressed Stephen's comment
2022-09-07 09:20:23 +01:00
Raymond Roestenburg
fbe3d94bfe
14818 fetch by contract id with interface (#14917)
* Fallback to in-memory for interface ID.

CHANGELOG_BEGIN
- [JSON API] /v1/fetch by interface ID
CHANGELOG_END

* Added fix: not setting key in ActiveContract in interface case, fix for https://github.com/digital-asset/daml/pull/14841#discussion_r961960344
2022-09-06 11:03:31 +02:00
Raymond Roestenburg
d13695c75e
Draft /v1/query with interface ID, without query store (#14841)
Support /v1/query by interfaceID or a non-empty set of template ID's, fallback to in-memory for an interfaceId query.

Co-authored-by: Stephen Compall <stephen.compall@daml.com>


CHANGELOG_BEGIN
- [JSON API] /v1/query with a non-empty set of template ID’s or one interface ID
CHANGELOG_END
2022-09-02 12:49:06 +02:00
Chun Lok Ling
2a01863c96
Test cases to ensure retroactive implements works in json-api (#14874)
* fixes #14821, added test case to ensure retroactive implements works in json-api

CHANGELOG_BEGIN
CHANGELOG_END

* address Stephen's comment
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-31 07:10:38 +01:00
Stephen Compall
99a48557d3
deprecate interface library names; use new names downstream (#14856)
* new names in daml-script/runner

* new names in json-api

* new names in Scala bindings/codegen

* new names in Java bindings/codegen

* new names in daml-lf interpreter tests

* more new names in daml-script tests

* new names in navigator backend

* deprecate all iface symbols and old method names

CHANGELOG_BEGIN
- [Scala API] ``com.daml.lf.iface`` has been deprecated, as discussed
  further in
  `issue #14783 <https://github.com/digital-asset/daml/pull/14783>`__.
  Use the deprecation warnings as guidance to the new names.
CHANGELOG_END

* prefix cases in OrderingSpec

- suggested by @remyhaemmerle-da; thanks
2022-08-29 20:43:47 +00:00
Stephen Compall
6236c8cc02
propagate template/interface ID distinction throughout JSON API (#14728)
* percolate Resolved/Definite status

* propagate resolution through the queries, DB updates, and domain resolutions

* include Definite in the definition of Resolved, everywhere

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-29 15:41:20 +00:00
Stephen Compall
f43bc5c8d1
use new api-type-signature names in some dependents (#14785)
* use new names in json-api

* use new names in java codegen

* use new names in Scala codegen

* use new names in TypedValueGenerators

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-23 17:52:10 +00:00
Stephen Compall
f85f7816c7
rename interface library to api-type-signature; alias symbols (#14783)
* move interface directory to api-type-signature; change bazel target; move scala files

* rename iface package to typesig; rename EnvironmentInterface to EnvironmentSignature

* rename Interface to PackageSignature

* rename fromReaderInterfaces to fromPackageSignatures

* rename InterfaceReader to SignatureReader

* rename InterfaceReader to SignatureReader in deprecation note

* rename readInterface to readPackageSignature

* rename InterfaceReaderError to Error

* rename InterfaceReaderMain to SignatureReaderMain

* rename InterfaceType to PackageSignature.TypeDecl

* rename astInterfaces to interfaces

* rename astInterfaces to interfaces in PackageSignature

* rename findAstInterface to findInterface

* rename a couple arguments

CHANGELOG_BEGIN
- [Scala API] The "quasi-public" API in ``com.daml.lf.iface`` has moved
  to the new ``com.daml.lf.typesig`` package, with many accompanying
  name changes as documented in `issue #13669
  <https://github.com/digital-asset/daml/issues/13669>`__.

  Daml 2.5.0 or later will remove the old names, and also rename the
  Maven artifact from ``daml-lf-interface`` to
  ``daml-lf-api-type-signature``.  We recommend that users of this API
  use the deprecation guidance in 2.4.0 to port their applications
  before this happens.
CHANGELOG_END
2022-08-23 15:21:45 +00:00
atriantafyllos-da
7ff003a6aa
Rename the leeway options [DPP-1183]. (#14679)
* Rename the leeway options [DPP-1183].

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-23 10:24:41 +02:00
Chun Lok Ling
56a4d6476f
Added logging for time elapsed of ledger client call (#14711)
* Added logging for time elapsed of ledger client call

CHANGELOG_BEGIN
CHANGELOG_END

fixes #14673

* rename logging def

* ADDED TODO

* ADDED TODO

* pass in boolean for determining if it should log based on the log level

* address Ray's comment. Wrong name Ledge -? Ledger

* make isEnable public and use it to determin whether it is debug level

* refactoring. put everything in a inner object LedgerClientRequestTimeLogger

* remove useless line

* address Ray's comment

* address Ray's comment

* log the time used for source as well

* address Stephen's address
2022-08-22 21:14:38 +01:00
Simon Maxen
937f8d1d45
Switch metering report to using Struct [DPP-1135] (#14767)
* Switch metering report to using Struct

changelog_begin
changelog_end
2022-08-22 08:55:06 +01:00
Chun Lok Ling
24c4c058b8
don't use query store at ledger-begin (#14740)
* fixes 11157

```rst
CHANGELOG_BEGIN
CHANGELOG_END
```

* format

* fix it in other caller
2022-08-17 18:58:56 +01:00
Moisés Ackerman
009c3c306b
Add interface instance syntax, including retroactive interface instances (#14715)
* Extract qualifyLocally in LFConversion

* Update ghc rev

* Add parent type argument to interface instance desugaring types

* Check interface instance parent in LFConversion

* Convert interface instances in interface declarations

* Update daml-test-files to use 'interface instance' syntax

* Update other tests to use 'interface instance' syntax

* Update interface reference docs to use 'interface instance' syntax

* Update other files to use 'interface instance' syntax

* Add todo in DA.Daml.LF.Ast.Pretty

* Add daml-test-files for retroactive interface instances

changelog_begin
changelog_end
2022-08-17 12:06:59 +00:00
Stephen Compall
22d2c27c4b
distinguishing template and interface IDs in json-api (#14577)
* prevent subclasses from having different equals behavior
* introduce a nominal, matchable subtype for interface IDs

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-15 11:15:00 -04:00
dylant-da
0d37134bc2
Change placeholder unit viewtypes to empty records (#14656)
* Update views in integration-v1dev to be EmptyInterfaceView instead of ()

* Update expected desugared daml for `EmptyInterfaceView`

* Update compiler Shake / DataDependencies viewtypes to EmptyInterfaceView

* Add record viewtypes to docs, update docs

* Add empty records to daml-lf, language-support, ledger, trigger tests

* Qualify EmptyInterfaceView in ledger semantic Interface tests

* Fix imports for EmptyInterfaceView in IIou / CIou / Transferrable

* empty changelog commit

CHANGELOG_BEGIN
CHANGELOG_END

* Qualify EmptyInterfaceView import

* Fix imports of EmptyInterfaceView in TypeScript codegen tests

* Accept Interface doc changes

* Add EmptyInterfaceView to DataDependencies tests

* Remove missing interface viewtype test - all interfaces must have views

* Replace all EmptyInterfaceView with EmptyInterfaceView {}
2022-08-10 16:45:23 +00:00
dylant-da
8e8e0dabdf
Convert viewtype and view methods to LF (#14456)
* Add DA_Internal_Interface to convertTypeDef exclusion check

* Move desugared types/values for interface views into DA.Internal.Desugar

* Convert viewtype and view method declarations

* Typecheck view types and view declarations

* Add unit viewtypes to InterfaceChoiceCollision tests

* Add unit viewtypes to more compiler/damlc tests

* Modify empty interfaces/implements to have viewtypes/views

* Add unit viewtypes to remaining Interface tests

* Test for error thrown when viewtype not specified

* Fix daml-lf/ interface tests to use new syntax / unit views

* Add placeholder view of type Unit to TestInterfaces

CHANGELOG_BEGIN
CHANGELOG_END

* Fix typescript interface tests with unit viewtype

* Add unit viewtype to Java & Scala codegen

* Add unit viewtype to triggers tests interface

* Add unit viewtypes to ledger/test-common

* Add unit viewtypes to ledger-service/http-json

* Fix some damlc tests

* Use viewtype syntax in InterfaceViewNonSerializable test

* Remove HasInferfaceView instances in convertBind

* Add unit view to QualifiedInterface.daml test

* Generate HasInterfaceView instances in DataDependencies

* Add unit viewtypes and views to compiler/damlc/tests

* Document reconstruction of HasInterfaceView

* Move desugared types/values for interface views into DA.Internal.Desugar

* Add desugarable function view w/ EViewInterface desugaring

* Remove templateName and viewtype from generated EViewInterface

* Update desugared-daml

* Proof of concept: use _view -> EViewInterface prim via HasInterfaceView

* Move view, HasInterfaceView to DA.Internal.Interface

* Update desugared-daml tests

* Stop removing and re-generating HasInterfaceView instances

* Do not generate docs for generated "_view_" methods

* Report errors with interface TypeConNames prettily

* Fix InterfaceViewNotSpecified @ERROR to reflect new error text

* Don't import magic `view` method from Prelude to avoid name clash

* Update shake interface goto definition test locations

* Temp disable view spec tests, will re-implement views in speedy

* Add unit viewtype to Java code snippet docs

* Update Interface syntax docs for views

* Add unit viewtype to Transferrable.daml

* Add back "empty" interface implementation to interfaces.rst

* Re-enable view tests by having _view methods on InterfaceViews.daml file

* Remove deprecated commented-out view desugaring code
2022-08-03 16:23:38 +01:00
Stephen Compall
1a9dc020f9
overloaded choices in json-api (#14410)
CHANGELOG_BEGIN
- [JSON API] For exercise endpoints, when multiple choices with the same
  name are defined, the one directly defined on the ``templateId``,
  which may be a template or interface ID, will be selected; if a
  template ID is specified that only inherits the choices with the same
  name, the new ``choiceInterfaceId`` option must be specified to select
  the source of the choice.
CHANGELOG_END
2022-07-27 15:40:58 +00:00
Stephen Compall
8309cfef1e
group JSON API tests by endpoint, other categories (#14522)
* group query tests
* group remaining abstract integration tests
* group user management tests
* group websocket tests

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-26 11:50:04 -04:00
Sergey Kisel
2e18276b1a
Unify TlsConfiguration between SDK and canton [DPP-1113] (#14349)
* Unify TlsConfiguration between SDK and canton [DPP-1113]

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-14 16:58:59 +02:00
atriantafyllos-da
8cce2c0394
DPP-1047 Added leeway options for JWT-based authorization. (#14375)
* DPP-1047 Added leeway options for JWT-based authorization.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-13 14:57:54 +02:00
Stephen Compall
6e3069d220
add retroImplements to lf/iface DefInterface (#14192)
* add resolveRetroImplements to EnvironmentInterface
* test that resolveRetroImplements does nothing with no data
* resolve retroactive interfaces in Java codegen
* resolve retroactive interfaces in Scala codegen
* resolve retroactive interfaces in json-api

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-29 13:13:02 -04:00
Victor Peter Rouven Müller
8d21d19133
Add support for cmd deduplication & submission id for cmd submissions (#13771)
* Add completion offset to cmd submission responses

changelog_begin
- [HTTP-JSON] there is now a new meta field called deduplicationPeriod for cmd submissions with which one can specify the deduplication period. Moreover there also is another new meta field submissionId for the cmd submissions.
- [HTTP-JSON] Calls to endpoints for command submission now include the completion offset
changelog_end

Co-authored-by: Raymond Roestenburg <98821776+ray-roestenburg-da@users.noreply.github.com>
2022-06-29 16:57:05 +00:00
Stephen Compall
90ca397bc5
replace remaining RNil usages with shapeless.record.Record (#14275)
* deprecate RNil

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-28 19:16:25 +00:00
Sergey Kisel
6a80a1a82f
Removal of sandbox-classic module and binary (#14201)
* Removal of sandbox-classic module and binary

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-21 11:09:51 +02:00
Stephen Compall
707c3e1a52
accept standard hlists as record/variant specs (#14167)
* link to #14189

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Raymond Roestenburg <98821776+ray-roestenburg-da@users.noreply.github.com>
2022-06-16 15:05:50 +00:00
Stephen Compall
19ad1be8f2
use domain.Party instead of String in json-api tests (#14158)
* use domain.Party instead of String for iouCreate{,AndExerciseTransfer}Command

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-15 08:59:23 -04:00
Sergey Kisel
1d8f195438
Sandbox Classic Removal in Tests (#13934)
CHANGELOG_BEGING
CHANGELOG_END
2022-06-07 19:54:52 +00:00
Stephen Compall
7c23420876
use more domain models for json-api response tests (#14101)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-07 08:57:17 -04:00
Stephen Compall
96a6fe62e4
choice name overloading in lf/interface (#13938)
* introduce TemplateChoices to mediate template choice resolution
* if any resolutions fail in EnvironmentInterface, discard the template's resolution
* if any resolutions fail in Interface, discard the remaining unresolved

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-31 08:41:48 -04:00
Sergey Kisel
168f943ff0
Revise the config to use a hierarchical structure [DPP-1029] (#13629)
* Revise the config to use a hierarchical structure [DPP-1029]

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-30 18:02:53 +02:00
Stephen Compall
a716428ebc
replace hand-disassembly of json in tests with domain model values (#13960)
* make postJsonRequestWithMinimumAuth parse, and make all its callers declarative
* make getRequestWithMinimumAuth parse, and make all its callers declarative
* note about further cleanup

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-24 06:31:06 -04:00
Stephen Compall
04c37349fc
refactor contract/party endpoint functions to endpoints package (#13955)
* move fetch, retrieveAll, query to separate module
* move parties endpoints to separate module
* narrow some access as all endpoint functions have moved

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-24 06:29:51 -04:00
Stephen Compall
b307cd8406
remove some contract-ID generality from TypedValueGenerators (#13957)
* move where ContractId arbitrary instance passes into ValueAddend
* adjust ValueAddend users to deal with moved Arbitrary instance

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-24 06:28:34 -04:00
Stephen Compall
97f3f4f956
reduce fixture-passing boilerplate in json-api tests (#13829)
* move the fixture data to a single value, make utilities extend off it
* start unifying the with* functions

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-23 16:16:35 +00:00
Remy
6f6a3052a1
Repurpose templateId in ExerciseCommand and add interfaceId in ExerciseEvent (#13660)
part of #13653

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-16 15:30:07 +00:00
Sergey Kisel
e32a1e680a
Increase public key cache size for Jwks [DPP-681] (#13802)
* Increase public key cache size for Jwks to decrease the risk of DDOS attack.

CHANGELOG_BEGIN
CHANGELOG_END

* Update ledger-service/jwt/src/main/scala/com/digitalasset/jwt/JwksVerifier.scala

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

Co-authored-by: Robert Autenrieth <31539813+rautenrieth-da@users.noreply.github.com>
2022-05-06 11:33:00 +00:00
Sergey Kisel
50c0f233e8
Address review concerns on security test evidence. (#13794)
* Address review concerns on security test evidence.

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-05 14:12:05 +00:00
Victor Peter Rouven Müller
3decea2a95
Use deriveFormat for ErrorDetailsFormat instead of hand written JsonFormat (#13770)
* Use deriveFormat for ErrorDetailsFormat instead of hand written JsonFormat

changelog_begin

- [HTTP-JSON] The field "@type" was renamed to "type" for encoding the ErrorDetails case

changelog_end

* Use moar types! :)

* Use proper tags, not aliases
2022-05-03 13:28:15 +00:00
Victor Peter Rouven Müller
2e6dbefa8c
Add optional ledgerApiError details to responses (#13751)
* Add optional ledgerApiError details to responses

* Finally get some proper error details

* Cleaning up the code

* Less bad words in the code

* Better deserialization error msg

changelog_begin

- [JSON-API] The response of the json api now includes a field ledgerApiError that contains extended information in the case of ledger errors. See issue https://github.com/digital-asset/daml/issues/9834 for more details.

changelog_end

* Reformat!

* Remove debug logging statements

* also update security evidence file

* more cleanup

* Improve Json decoder & encoder

* Add test for json encoder&decoder

* Add test which ensures that the LedgerApiError field in the response is filled with valid information

* Fix failing failure tests
2022-04-29 21:44:37 +02:00
Nicu Reut
a792de39a5
Update scalafmt to 3.5.1. (#13584)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-28 09:57:04 +00:00
Stephen Compall
f4d603757e
split AbstractHttpServiceIntegrationTest into two files (#13685)
* move AbstractHttpServiceIntegrationTestFuns to separate file
* security evidence moved

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-25 15:25:23 -04:00
Stephen Compall
1d1fbb10af
remove small Scala 2.12 artifacts (#13618)
* remove unneeded type-param indirection with proper Scala support
* remove readFile; it is unused

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-20 15:48:54 +00:00
Stephen Compall
7c33a02d44
test and document error when querying with a pruned offset argument (#13633)
* pruning test successful, shows the real error
* document current pruning failure

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-20 10:57:33 -04:00
Stephen Compall
9cafd894c1
nicer party throwaway literals in tests (#13619)
* replace NoCid with Aux
* xmap on ValueAddend, a way to e.g. let users "pun" on scalars
* nicer party specifications
- suggested by @realvictorprm; thanks

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-19 09:54:50 -04:00
Sergey Kisel
2b4b2f2d3e
Add ledger-service/jwt to test evidence generator. (#13579)
* Add ledger-service/jwt to test evidence generator.

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-14 17:39:36 +02:00
Sergey Kisel
ebb80b810a
Security Test Evidence for JwksVerifier (#13538)
* Security Test Evidence for JwksVerifier

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-11 13:18:55 +02:00
Stephen Compall
4bf0de8901
better errors when querying by interface ID (#13406)
- double the resolveTemplateId interface and use the "contract type" for
  exercise-by-id only
- lookup for template ID only
- 400 + error message test
- move query test to also run on PG/oracle

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-31 15:53:39 +00:00
Victor Peter Rouven Müller
cc06073333
Java bindings/interface support (#13366)
* WIP

* First working version of java codegen daml interface support

* Update language-support/java/codegen/BUILD.bazel

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Fix compile errors

* Simplify code massivly, enjoy less duplication

changelog_begin

- The Java codegen now has basic support for daml interface definitions. Converting a contract id of a template implementing an interface to a contract id of the interface is possible and both executing interface choices is possible on the contract id of the interface and implementing template.

changelog_end

* Rename the test file to reflect it is a test file & enhance the inner test name & extend it further

* Fix test

* Refactor parts of TemplateClass.scala into multiple files

* Format that files!

* Minimize duplication further

* Remove unused comment

* Simplify code
Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Update language-support/java/codegen/src/main/scala/com/digitalasset/daml/lf/codegen/CodeGenRunner.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Further refactoring and renaming of the TemplateClassSpec to ContractIdClassBuilderSpec

* Fix formatting

* Add interface docs

* Remove unnecessary code generation of the Contract class for interface types

* Use less bool flags and more good function names :)

* Fix build

Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-03-29 12:38:00 +02:00
Stephen Compall
467b8fbbe7
shorter Value expressions in json-api tests (#13358)
* template ID variables
* remove duplicate function

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-24 15:51:55 +00:00
Stephen Compall
2dd248cd68
move nonempty code to new nonempty library (#13350)
- new nonempty artifact, separate from scala-utils
- com.daml.scalautil.nonempty is now com.daml.nonempty

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-21 17:14:17 +00:00
Victor Peter Rouven Müller
8e6493b02a
Add security evidence about the failure tests from the json api (#13229)
changelog_begin
changelog_end
2022-03-21 15:58:59 +01:00
Victor Peter Rouven Müller
47ca2cb953
Add security evidence annotations to the integration tests of the json api (#13225)
changelog_begin
changelog_end
2022-03-21 15:58:23 +01:00
Victor Peter Rouven Müller
31366b939c
Add test evidence annotation to unit test of the json api (#13219)
changelog_begin
changelog_end
2022-03-21 15:57:59 +01:00
Victor Peter Rouven Müller
bfd69b0bee
Test that we return a 404 when requesting information about non-existing packages (#13346)
changelog_begin

- [HTTP-JSON] If information about a package is requested that doesn't exist on the ledger you will now get a 404 instead of a 500 as response.

changelog_end
2022-03-21 15:57:32 +01:00
Stephen Compall
d37a63f56e
interface choices in json-api (#13301)
This expands the domain of the exercise endpoint to accept interface IDs
instead of template IDs when exercising by contract ID. The argument is
still [compatibly] called templateId; interface IDs are accepted nowhere
else.

CHANGELOG_BEGIN
- [JSON API] Supports interface choices, including exercise by contract
  ID accompanied by an interface ID.
  See `issue #13301 <https://github.com/digital-asset/daml/pull/13301>`__.
CHANGELOG_END
2022-03-18 17:47:30 +00:00
Stephen Compall
0b5ad7a7bd
interface support in the interface library (#13154)
This adds the presence of interface names, as well as lists of choices
and their argument/return types for each interface.

It also changes the semantics of DefTemplate and EnvironmentInterface:
each may contain "unresolved choices", which are the choices inherited
from interfaces for each implementing template;
EnvironmentInterface#resolveChoices will copy the full type information
as a concrete choice for each implementing template, which should be
much simpler for codegen and json-api.

A type generator should take account of the astInterfaces as well as
typeDecls in EnvironmentInterface; interfaces aren't included in
typeDecls because where I is an interface only ContractId I is
serializable.

* Ast.DataInterface is empty, just use the interfaces map directly
* port json-api for interface API changes; does not solve #12689
* port Scala codegen for interface API changes; does not add support
* port Java codegen for interface API changes; does not solve #11350

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 19:34:54 +00:00
Stefano Baghino
739173bf84
Remove references to missing appender (#13294)
changelog_begin
[Trigger Service] Spurious logging warnings will not be printed when running `daml trigger-service`
[Oauth2 Middleware] Spurious logging warnings will not be printed when running `daml oauth2-middleware`
changelog_end

Removed references to a missing `stderr-appender` in several configuration file.

This removes warnings when running `daml trigger-service` and `daml oauth2-middleware`.

This will also remove those same warnings from several tests (HTTP JSON API and Trigger Service).
2022-03-15 18:02:02 +01:00
Stephen Compall
153a5e6bcc
parallelize long-running custom/user token tests (#13290)
Saves about 90 seconds in test wallclock time. Other tests considered
either ran too short to bother splitting, or were Oracle and thus won't
affect the main run at all.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 10:59:36 -04:00
Sergey Kisel
a4f4300502
Naming and logging improvements [DPP-956] (#13270)
* Naming and logging improvements [DPP-956]

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 09:40:39 +01:00
Stephen Compall
2056f0a5cf
nonempty-cats refactoring (#13282)
* move ImplicitPreference to scala-utils
  - test it
  - use it instead of tags for json-api testing
  - fix a somewhat nonsensical type therein
* several new tests for the NonEmpty Foldable instances

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-14 20:48:41 -04:00
Stephen Compall
c9b5750968
NonEmpty utilities, new nonempty-cats library (#13115)
New instances and collection methods, many of which included
as-is from @andreaslochbihler-da's experiments downstream.

* mk, a version of apply with special inference
* new names for the conversion functions suggested by
  @andreaslochbihler-da
* groupBy1, zipWithIndex, reduceLeft, last1, distinct, toVector1
* a derived Semigroup instance
* a more explicit subtyping utility to specify implicit preference than
  what we get with shapeless @@
* from method, alias for unapply
* cats functorial, foldable instances in the new nonempty-cats library
* new NonEmpty utilities

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Lochbihler <36634420+andreaslochbihler-da@users.noreply.github.com>
2022-03-10 16:30:42 +00:00
Sergey Kisel
9a27edd656
Improve MessageDigest and Mac instance creation to solve lock contention [DPP-956] (#13221)
* Improve MessageDigest and Mac instance creation to solve lock contention problem [DPP-956]

changelog_begin
Scalability bottleneck in regard to hashing has been fixed in multiple places.
changelog_end
2022-03-09 22:15:32 +01:00
Stephen Compall
1e562757fe
json-api failure tests with user tokens (#13113)
Refactors a bunch of AbstractHttpServiceIntegrationTestFuns and
elements of #12922's JWT function abstractions into a new
HttpFailureUserFixture, using that split to split the
FailureTests as well.

Fixes #13112.

* restore failure test porting from #12922
This reverts b4942defa4.

* move token-relevant utilities to http-json-testing lib

* replace custom actorsystem setup with AkkaBeforeAndAfter
- suggested by @ray-roestenburg-da; thanks

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Victor Peter Rouven Müller <mueller.vpr@gmail.com>
2022-03-09 18:15:49 +00:00
Stefano Baghino
00b7ad3803
Fix red main (#13224)
changelog_begin
changelog_end

The clash is between:
- https://github.com/digital-asset/daml/pull/13147
- https://github.com/digital-asset/daml/pull/12906

The latter changed the type of `ServerError` to only get `Throwable`s, the former used `ServerError`'s to wrap a string.
2022-03-09 17:09:51 +00:00
Simon Maxen
1d40c55177
Add metering report http endpoint [DPP-855] (#13147)
* Added metering report http endpoint

changelog_begin
Added metering report http endpoint
changelog_end

* Update with review comments
2022-03-09 14:59:08 +00:00
Victor Peter Rouven Müller
6829881302
[JSON-API] Fix duplicate error logging & improve error logs messages (#12906)
* Fix duplicate error logging & improve error logs messages

changelog_begin

- [HTTP-JSON] Fix duplicate logging of errors & improved error messages slightly

changelog_end

* Simplify error handling code

* Use simple functions instead of overloading methods

* minimize diff
2022-03-09 12:43:26 +00:00
Stewart Stewart
0a52e56ca1
Make http.domain a package (Fixes #11151) (#13164)
Use a package instead of object for organization so the namespace
remains open. Note that in Scala 3, the val/type aliases in this diff
can become export statements.

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Stewart Stewart <stewart.stewart@digitalasset.com>
2022-03-07 09:44:31 -05:00
Victor Peter Rouven Müller
fdb5cdae0a
[JSON-API] Normalize token parsing & remove custom parsing code (#13161)
* Normalize token parsing & remove custom parsing code

changelog_begin

- [HTTP-JSON] custom claim tokens without ledger id are now correctly recognized as such and not as user tokens

changelog_end

* Add test to check that tokens without ledger id work correctly

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/endpoints/UserManagement.scala

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

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/EndpointsCompanion.scala

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

* Remove the overload of jwtForParties & change how the wihtoutNamespace JWT is constructed

* Remove unnecessary code line

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2022-03-07 13:35:37 +01:00
Victor Peter Rouven Müller
0dc167fa48
[JSON-API] Remove dependency on user provided tokens for the perf runner & refactor main (#13114)
* Don't error when user tokens are provided for the perf runner

changelog_begin
changelog_end

* Better token parsing error handling & extract user id to allocate the user if so

* make the code prettier

* Fix & simplify token parsing

* fix formatting of bazel file

* Update ledger-service/http-json-perf/src/main/scala/com/daml/http/perf/Main.scala

Co-authored-by: Raymond Roestenburg <98821776+ray-roestenburg-da@users.noreply.github.com>

* correctly handle the response of createUser & don't throw if no LedgerId was found in the token

* Wrap exceptions in Futures

* Refactor Main.scala of the perf runner completely & remove dependency on user provided JWT's

* Minimize diff

* simplify code further

* Update ledger-service/http-json-perf/src/main/scala/com/daml/http/perf/Main.scala

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

* Update ledger-service/http-json-perf/src/main/scala/com/daml/http/perf/Main.scala

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

* Update ledger-service/http-json-perf/src/main/scala/com/daml/http/perf/Main.scala

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

* Fix build

* Don't pass a jwt to the perf runner anymore everywhere it was used & fix ledger id to be right

* Minimize diff

Co-authored-by: Raymond Roestenburg <98821776+ray-roestenburg-da@users.noreply.github.com>
Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2022-03-03 16:12:40 +00:00
Victor Peter Rouven Müller
e1ccc2f4f4
duplicate json-api tests for full-lifecycle user token testing (#12922)
* WIP

* First version that compiles (with debug print statements)

* Revert changes on the failure tests

* Make all tests pass with some major cleanup of the new code

* Remove debug prints & outcommented code

* Make decoding / encoding test also compatible with user token tests

changelog_begin
changelog_end

* Minimize diff

* Fix oracle tests

* leave note for followup

* Update ledger-service/http-json/src/itlib/scala/http/AbstractHttpServiceIntegrationTest.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-03-01 11:05:58 +00:00
mziolekda
d9d8083451
Remove references to pre-canton sandbox from documentation (#12888)
* Remove references to pre-canton sandbox from documentation

CHANGELOG_BEGIN
CHANGELOG_END

* address review comments
2022-02-11 13:57:44 +01:00
Victor Peter Rouven Müller
300bbf86ae
[JSON-API] Fix duplicate calls to the command service while debug logging is enabled (#12699)
* Fix duplicate calls to the command service while debug logging is enabled

changelog_begin

- [HTTP-JSON] Fixed duplicate calls to the command service while debug logging is enabled.
- [HTTP-JSON] Fixed internal server errors which can occur while debug logging is enabled.

changelog_end

* Cleanup the code a bit, test still failing tho :(

* Finally fix the bug for real now

* Address review comments

* don't cast

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-02-11 12:53:31 +00:00
Victor Peter Rouven Müller
9e77b8dbf6
Fix logging of internal server errors for the json api (#12822)
changelog_begin

- [HTTP-JSON] Internal server errors are now properly logged again. See `issue #12887 <https://github.com/digital-asset/daml/issues/12887>`__.

changelog_end
2022-02-11 13:51:44 +01:00
Stephen Compall
dc77d35f97
move endpoint functions to separate package (#12805)
* move user management endpoint functions to separate module

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* move create and exercise endpoints to separate module

* fix copyright headers

* mark the helpers package-private

* more privacy modifiers

* import cleanup

* move Forwarded header test to unit tests

* move decodeAndParseUserIdFromToken to UserManagement

* move package endpoints to separate module
2022-02-09 11:32:31 +01:00
tudor-da
c9dcd1c493
Update kvutils Config with missing flags options from SandboxConfig [DPP-864] (#12629)
* Update kvutils Config and SandboxConfig
* Remove `eager-package-loading` and `scenario` from SandboxConfig
* Add `profile-dir` and `stackTraces` to kvutils Config
* Configurable authService in kvutils

changelog_begin
changelog_end

* Addressed Samir's review comments

* Add back Maximum supported deduplication duration enforcement of 1 hour
2022-02-07 20:13:04 +00:00
Stephen Compall
f63165aa76
chunked HTTP response for /v1/users endpoint (#12777)
Enriches #12766 with a chunked, lazy internal approach to
aggregating pages from the participant server, rather than
aggregating all users directly in memory before returning them.

CHANGELOG_BEGIN
- [JSON API] If ``/v1/users`` fails while retrieving users from the participant,
  it will be reported as a warning, with a partial set of users, rather than
  failing.
  See `issue #12777 <https://github.com/digital-asset/daml/pull/12777>`__.
CHANGELOG_END
2022-02-07 18:20:19 +00:00
tudor-da
14a0459f0a
SandboxNextFixture replaced by SOX-based SandboxFixture (#12654)
* SandboxNextFixture replaced by Sandbox-on-X based SandboxFixture

changelog_begin
changelog_end

* Some fixed tests

* No direct dependencies on //ledger/sandbox:sandbox and //ledger/sandbox:sandbox-scala-tests-lib

* Fix after rebase

* Rename SandboxFixture and add a missing dep

* Generate valid party names if hint is empty

* Smaller maxInboundMessageSize

* Added test for empty display name

* SandboxServer is a ResourceOwner
* Uses execution context passed as an input for resource management
* Fixes flaky FlywayMigrations issue with null Thread.currentThread.currentClassLoader
* SandboxServer simplification returns Port instead of ApiServer

* Dedicated PMAllocateWithoutDisplayName for non-Canton ledgers
* Created since Canton does not return empty display names
2022-02-07 09:25:22 +01:00
Stefano Baghino
9c35fa286e
Return all users from GET /v1/users/, paginating 1k at a time (#12766)
* Return all users from `GET /v1/users/`, paginating 1k at a time

The test runs overall for ~30 seconds, mostly due to the time required to
create 20k users.

changelog_begin
[HTTP-JSON API] Previously, a 10k limit was in place on the number of users returned by
`GET /v1/users/`. This limit has been removed and users are retrieved in chunks from the ledger
changelog_end

As of now, this builds the response in-memory, which is likely not what we want to
support long-term.

* Relax test condition due to interference with other test setups
2022-02-04 17:34:20 +00:00
Sergey Kisel
15caea42c0
Use fetchAndPersistBracket instead of fetchAndPersist (#12672)
* Use fetchAndPersistBracket instead of fetchAndPersist

* add changelog

CHANGELOG_BEGIN
- [JSON API] Under rare conditions, a POST-style multi-template query backed by
  database could have different template IDs appear to be queried at different
  ledger times, if updated concurrently.  This conditions is now checked and
  accounted for.  See `issue #12672
  <https://github.com/digital-asset/daml/pull/12672>`__.
CHANGELOG_END

* add a searchQuery metric event for each fetch trial in sync search

* revert the contract ID and contract key fetches, and explain why

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-02-03 20:16:47 +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
Brian Healey
e70237a673
upgrade scalapb/netty/grpc/protobuf in proven combination (#12628)
* upgrade scalapb/netty/grpc/protobuf in proven combination

CHANGELOG_BEGIN
Upgrade scalapb, netty, grpc, protobuf and guava versions
CHANGELOG_END

* bazel reformat

* match grpc version in deps.bzl

* upgrade akka

* keep grpc version to 1.43 that is used in latest nixpkgs-unstable

* rebase and regen

* update SHA for scalapb tarball

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2022-02-03 08:38:38 -05:00
Adriaan Moors
810554bee5
Use Seq instead of Vector in user mgmt apis (#12725)
For consistency with other APIs in this area.
Note that some pre-existing APIs use `List` instead of `Seq`,
but at least those use the same underlying implementation.

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-03 13:52:53 +01:00
Victor Peter Rouven Müller
aa45f48798
Upgrade to Scala 2.13.8 (#12506)
* Upgrade to Scala 2.13.8

changelog_begin
changelog_end

* Update hash for scala in nixpkgs

* update more hashes for scala upgrade

* Fix most warnings etc.

* Fix remaining errors etc.

* Fix formatting

* Resolve last errors hopefully

* Fix ledger api common build file

* Combine imports & revert accidental change that broke the CI run

* Rename exporting vals to scriptExport & minimize diff

* Remove more wrong changes

* moved warning around
2022-02-03 09:05:31 +00:00
Victor Peter Rouven Müller
8d5d3bdf2f
[JSON-API] User management endpoint adjustments (#12578)
* Return an empty object for deleteUser & createUser

* Make the field rights for creating a user optional & fix the tests

changelog_begin

- [HTTP-JSON] Adjusted the response for the createUser & deleteUser endpoint to an empty object instead of "true". This was done to allow possible future extensions to the return type without applying breaking changes.
- [HTTP-JSON] Made the field rights optional for the request body of the createUser endpoint. Now it is possible to create a user with just the userId (i.e. { "userId": "nice.user" }).

changelog_end
2022-01-31 18:04:42 +01:00
Remy
5cdf9b95fb
Remove some unecessary implictly with Factory (#12559)
CHANGELOG_BEGIN
CHANGELOG_END
2022-01-26 13:28:26 +00:00
Moritz Kiefer
16a4f0626b
Avoid explicitly listing all Oracle tests in build.yml (#12594)
changelog_begin
changelog_end
2022-01-26 11:28:44 +00:00
Marton Nagy
54339ada82
Safeguard Oracle CI tests with lockIdSeed [DPP-802] (#12573)
* Fixes OracleAround so it creates unique oracle users
* Fixes rouge connection pool in JdbcLedgerDaoTransactionsSpec
* Fixes cleanup in OracleAroundAll
* Introduces lockIdSeed for test frameworks
* Adapts usage

changelog_begin
changelog_end
2022-01-26 00:54:17 +01:00
Victor Peter Rouven Müller
5f58698ba6
[JSON-API] Add list-specific-users-rights, grant & revoke user rights endpoints (#12352)
* Add an endpoint used for querying user rights of a specific user

changelog_begin

- [HTTP-JSON] Added endpoint /user/rights that if called with POST will return user rights of the user specified via the payload

changelog_end

* Add grant&revoke user rights endpoint

changelog_begin

- [HTTP-JSON] Added endpoints user/rights/grant & user/rights/revoke which allow granting & revoking user rights for a specific user

changelog_end

* Switch to using the UserRights list instead of a case class with fields

* fix type annotation

* Rename allocateUser func to createUser to comform with the endpoint path

* Response format simplification & cleanup

* Add one last test that ensure that the JSON format of UserRight doesn't change without us noticing

* Apply suggestions from code review

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Remove unnecessary conversations and also just use unwrap for tagged strings

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-01-25 11:21:55 +00: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
Moritz Kiefer
688f1e1e0b
Drop v0 contract ids (#12464)
* Drop v0 contract ids

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2022-01-20 15:28:27 +00:00
Moritz Kiefer
b11f11bde0
Drop support for no seeding in sandbox-classic (#12495)
* Drop support for no seeding in sandbox-classic

Sandbox classic is going away in SDK 2.0 and so is support for v0
contract ids which is the only thing no seeding was used for.

This has been cleared by product.

I’ll drop v0 contract ids completely in #12464 as a follow-up. Just
wanted to factor this out for ease of review.

changelog_begin
changelog_end

* .

* .
2022-01-20 09:15:13 +01:00
Victor Peter Rouven Müller
244389152f
Remove /user/delete GET endpoint (#12486)
changelog_begin

- [HTTP-JSON] Removed the /user/delete GET endpoint. Please use the /user/delete POST endpoint with the own user ID if you need to delete the user associated with the current token

changelog_end
2022-01-19 16:31:14 +00:00
Stefano Baghino
4af48bbccc
Split channel configuration from LedgerClientConfiguration (#12433)
* Split channel configuration from LedgerClientConfiguration

Fixes #12391

The channel configuration now has to be provided separately from the
configuration specific to the ledger client. In this way we avoid
situations where the builder is provided with some configuration
that gets overridden.

changelog_begin
[Scala bindings] The channel configuration has been split from the
LedgerClientConfiguration class. Provide the gRPC channel specific
configuration separately or use a builder. The channel configuration
no longer overrides the builder.
changelog_end

* Fix compilation issues in //ledger-service/...
2022-01-18 10:03:33 +00:00
Simon Meier
82bdfa5222
ledger-api-auth: remove SupportedJWTPayload (#12343)
* ledger-api-auth: make AuthServiceJWTPayload parse both user and custom daml access tokens

changelog_begin
changelog_end
2022-01-13 16:12:13 +00:00
Stephen Compall
e5dcea1084
design guidelines for JSON API endpoints (#12340)
CHANGELOG_BEGIN
CHANGELOG_END

* note about gRPC-to-HTTP error mapping

- suggested by @stefanobaghino-da; thanks

* minor wording
2022-01-11 17:37:17 +00:00
Stephen Compall
606019e4d4
local import cleanup in json-api (#12335)
* combine some scalaz imports and remove unneeded ones

* combine some local spray-json imports

* straightforward relative import

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-11 17:37:03 +00:00
Victor Peter Rouven Müller
4deee3fd19
Add get & delete user endpoints (#12332)
changelog_begin

- [HTTP-JSON] Added endpoints:
    - /user/delete that if called with GET will delete the current user & with POST will delete the user specified via the payload
    - /user that if called with POST will now return user info about the user specified via the payload

changelog_end
2022-01-11 12:01:02 +00:00
Victor Peter Rouven Müller
e4dbde3f18
[JSON-API] Add list users endpoint (#12323)
* Add list users endpoint

changelog_begin

- [HTTP-JSON] Added an endpoint /users which returns the available users on the ledger.

changelog_end

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/domain.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-01-11 11:18:17 +00:00
akshayshirahatti-da
50de6e3639
[JSON-API] HOCON config json api (#12236)
* Change heartBeatPer to more intuitive naming of heartbeatPeriod

CHANGELOG_BEGIN
CHANGELOG_END

* Initial changes to add HOCON config for json_api

CHANGELOG_BEGIN
CHANGELOG_END

* avoid IllegalArgumentException noise

* use named arguments in big config conversion

* Changes include
 - tests for a full http-json-api config file
 - logging config and non-repudiation config is still specified via cli args.
 - config readers for MetricsReporter

* Add defaults to WebsocketConfig case class to allow partially specifying fields on typeconf file

* changes to the JwtVerifierBase config reader and equivalent test

* message already describes the value

* replace manual succeed/fails with scalatest combinators

* use qualified imports for WebsocketConfig defaults

* add back autodeleted empty lines

* collapse two lists of token verifiers into one

* add new line to config files

* rename dbStartupMode to startMode to keep consistent with cli option and for easy documentation

* Changes to daml docs to specify ways to run JSON-API by supplying a HOCON config file.

CHANGELOG_BEGIN
JSON-API can now be started supplying a HOCON application config file using the `--config` option.
All CLI flags except `logging` and `non-repudiation` one's are now deprecated and will be cleaned up in some future releases.
CHANGELOG_END

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-01-10 23:07:07 +00:00
Stefano Baghino
face7d303b
Remove unused line as reported in #12325 (#12331)
Reported by @realvictorprm in b4896c84af (r781264686)

changelog_begin
changelog_end
2022-01-10 12:13:03 -05:00
Victor Peter Rouven Müller
f675f1b4fe
[JSON-API] Add create user endpoint (#12272)
* WIP

* Adjust the format of the CreateUserRequest to be a nicer payload & add a simple test

changelog_begin

- [HTTP-JSON] An endpoint user/create has been added to be able to create a user via the json api

changelog_end

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-01-07 22:22:13 +00:00
akshayshirahatti-da
19fe4266ed
[Trigger Service/Oauth2-Middleware] Hocon config refactor (#12228)
* Changes to add a pureconfig-util module with some shared config readers, and cleanup some code from oauth2-middleware hocon

CHANGELOG_BEGIN
CHANGELOG_END

* Update triggers/service/auth/src/test/scala/com/daml/auth/middleware/oauth2/CliSpec.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-01-07 10:35:31 +00:00
Victor Peter Rouven Müller
bb92c463e7
Fix that tokens without the daml namespace were wrongly interpret as user tokens for some endpoints (#12261)
Changelog entry and commit msg differ here because the bug described in
the changelog was already fixed by adding the user management support
because it caused for the affected endpoints that it will be interpret as
user token while only fetching the ledger id (without actually checking
that it is a user token).

changelog_begin

- [HTTP-JSON] Fixed a bug that caused jwt's without the daml namespace to be rejected for some endpoints (https://github.com/digital-asset/daml/issues/12215)

changelog_end
2022-01-06 10:40:07 +00:00
akshayshirahatti-da
4f4d18829b
[Trigger-Service] Changes to use a typeconfig conf for trigger-service when provided. (#12217)
* Changes to add the option of starting trigger service with typeconf/HOCON config

CHANGELOG_BEGIN
CHANGELOG_END

* add tests for authorization config and fail on both config file and cli args

* refactor and cleanup config loading and tests

* Changes based on code review comments

* Daml doc changes and making sure that we have defaults for most fields to mirror cli args

CHANGELOG_BEGIN
Trigger Service can now be configured with HOCON config file.
 - If a config file is provided we will choose to start the service using that, else we will fallback to cli arguments.
 - If both config file and cli args are provided we will error out.
CHANGELOG_END

* addressing some more code review comments

* use scalatest inside properly
2022-01-06 00:12:47 +00:00
Victor Peter Rouven Müller
dda2115d61
[JSON API] Expose user management service (#12137)
* Expose user management service over the HTTP-JSON API

Fixes #12078

Add user & user/rights endpoint which provide the current user id, primary party and the latter the user rights

Fix new endpoints for ledgers without auth and add test coverage for these

changelog_begin

- [HTTP-JSON] Added GET endpoint:
    - /user which returns the current user id & primary party
    - /user/rights which returns the user rights of the current user

changelog_end

* Update ledger-service/http-json/src/it/scala/http/HttpServiceIntegrationTestUserManagement.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Apply review comments

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/domain.scala

Co-authored-by: akshayshirahatti-da <86774832+akshayshirahatti-da@users.noreply.github.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
Co-authored-by: akshayshirahatti-da <86774832+akshayshirahatti-da@users.noreply.github.com>
2022-01-05 12:34:04 +00:00
Victor Peter Rouven Müller
a8a152bd06
Don't use Alice twice in the test (#12260)
changelog_begin
changelog_end
2022-01-05 11:47:06 +01: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
Victor Peter Rouven Müller
c5de61ae9e
[JSON-API] Also accept user tokens as auth source (#12075)
* WIP

* Remove the dummy implementation and replace it with an actual working implementation

* Make it compile!

* Add working tests for the user management support in the json api

CHANGELOG_BEGIN

- [JSON-API] Added basic support for the new user management feature of the ledger such that user tokens are now accepted instead of the legacy tokens

CHANGELOG_END

* Simplify the create iou test case and adjust the test case name to be correct

* Add additional test that covers that the overwrite of actAs&readAs still works via the meta object

* Make it work with unauthenticated ledgers too

* Fix compile error & wrong behaviour & add test coverage for non auth ledgers

* Clean up the diff

* Address 66312e9940 (r770782884)

* Address 66312e9940 (r770750653)

* Addressing 66312e9940 (r770751958)

* Address 66312e9940 (r770736671)

* Address 66312e9940 (r770734395) and 66312e9940 (r770783237)

Co-authored-by: Stefano Baghino <stefano.baghino@digitalasset.com>
2021-12-18 12:54:12 +00:00
Sergey Kisel
4c8be783b2
use domain.Offset instead of String in ContractsFetch functions (#12160)
* Initial commit

CHANGELOG_BEGIN
CHANGELOG_END

* formatting fix

* fix up graph DSL whitespace

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2021-12-16 18:14:39 +00: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
Stephen Compall
c4d82f724c
new 2.12-removal-enabled features for NonEmpty (#11933)
* replace pour with a new, total, uncurried apply to create NonEmpty's

* use the new NonEmpty apply in place of pour

* non-empty cons, snoc, head, tail

* add map and flatMap for NonEmpty iterables

* remove scala-collection-compat from scalautils

* tests for map, flatMap, cons

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* missing 'extends AnyVal'

* colliding map and flatMap for Maps

* Revert "colliding map and flatMap for Maps"

* more specific Map and Set return types

* type tests for map operations

* add 'to' conversions
2021-12-07 19:38:37 +00:00
Remy
58e69ade1a
LF: replace "dev" LF version by "1.dev" in bazel files (#11894)
the more consistent, as asked by Moritz in review of #11820

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-26 12:23:17 +00:00
Victor Peter Rouven Müller
df373466dc
[JSON-API] Add query store metrics (#11809)
* Add query store metrics

CHANGELOG_BEGIN

- [JSON-API] added metrics to separately track:
    - time taken to update query-store ACS (from ledger)
    - lookup times for the query store

CHANGELOG_END

* Apply review comment
2021-11-25 13:04:28 +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
8e31e8e6a8
[Self-service error codes] Enabled by default [DPP-691] (#11685)
* [Self-service error codes] Enabled by default
* Flag changed to `use-pre-1.18-error-codes` (disabled by default)

CHANGELOG_BEGIN
[Ledger API Specification] The Ledger API returns enriched error codes (see https://docs.daml.com/error-codes/self-service/index.html)
For backwards-compatibility, a new API flag `--use-pre-1.18-error-codes` is introduced for preserving the legacy behavior for
clients that want to migrate incrementally to the changed gRPC status code responses and error details format.
CHANGELOG_END

* Adapted HttpServiceIntegrationTest

* Renamed `Feature Flag` to `Configuration` in docs

* Fix Daml Script tests

changelog_begin
changelog_end

* Fix Repl functests

changelog_begin
changelog_end

* Fix haskell binding tests

changelog_begin
changelog_end

* Fix CommandClientIT test

* Fixed Sandbox and CommandServiceBackpressureIT tests
 Please enter the commit message for your changes. Lines starting

* Adapt //compiler/damlc/tests:repl-functests again

* Fix more tests and address Miklos' comments
* Flag name changed to `grpc-status-codes-compatibility-mode`

* Remove useless flags sandbox-classic

* Sandbox-classic tests fix for ContractKeysIT and ExceptionsIT
* Created 2 deprecated test suites that have the more generic assertions as returned
by the deprecated in-memory backend

* More fixes for CommandServiceIT
* Fixes compilation issue with the deprecated exceptionsIT class for Sandbox-classic in-memory

* Compatibility mode for old test tools

* Change flag name to `use-pre-1.18-error-codes`

* Apply suggestions from code review

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

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
2021-11-22 12:26:48 +00:00
Andreas Herrmann
39a38d3a37
Update to Java 11 (#11512)
* Update to Java 11

changelog_begin
changelog_end

* Fix RoundingMode deprecation warnings

* Fix dep-ann warning

* Integer constructor

* JavaX annotation dependency

* javax.xml.bind was removed in Java 11

Using Guava as a replacement, since it is already a project dependency.

* JDK 11 no longer has a separate JRE tree

* Remove unused jdk_nix import

* remove now redundant jdk11_nix

* Java 8 --> 9 increased Instant.now() precision

See https://bugs.openjdk.java.net/browse/JDK-8068730

The precision of `Instant.now()` increased between Java 8 and Java 9.
On Linux and MacOS this doesn't seem to be a problem, as the precision
still seems to be at micro seconds. However, on Windows this now causes
errors of the following form:
```
java.lang.IllegalArgumentException: Conversion of Instant
2021-11-05T13:58:56.726875100Z to microsecond granularity would result
in loss of precision.
```
Suggesting that it now offers sub-microsecond precision.

`TimestampConversion.instantToMicros` had a check to fail if the
conversion lead to a loss of precision. In the specific failing test
case this is not a concern, so this adds a `roundInstantToMicros`
variant that avoids this kind of error.

* TMP round timestamps

* Revert "TMP round timestamps"

This reverts commit af8e261278.

* Skip versions before 1.6.0 in migration tests

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-11-18 14:48:37 +00:00
Moritz Kiefer
c8ace8b1cf
Factor kind projector target into a variable (#11759)
Seems nicer than trying to format a string everywhere

changelog_begin
changelog_end
2021-11-18 09:51:43 +01: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
akshayshirahatti-da
c77e150f60
[JSON-API] ContractDao JMH benchmarks against PG (#11718)
* Changes to port JMH benchmark tests for contract dao to be be run against postgres db.

CHANGELOG_BEGIN
CHANGELOG_END

* add missing libs-scala/ports depenency to ledger-on-sql test suite

* changes based on codereview comments
2021-11-18 00:32:42 +05:30
Stephen Compall
b5b29fd38a
test_suite for http-json, http-json-oracle integration tests (#11713)
* make http-json:integration-tests into test suites

* make http-json-oracle:integration-tests into test suite

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* remove commented libraries
2021-11-16 11:52:26 -05:00
akshayshirahatti-da
1791a522c9
[TS-Bindings] Changes to re-enable ws multiplexing (#11681)
* Changes to renable ws multiplexing

CHANGELOG_BEGIN
[TS-BINDINGS] Re-enable ws multiplexing for stream queries after resolving the reconnect connection close bug associated with ws state and liveness.
CHANGELOG_END

* websocket is passed as an argument to the onMessage handler

* consistently use 'manager' reference instead of 'this' in the handleQueries change method
2021-11-15 22:57:21 +05:30
Stephen Compall
22d916baed
party-set arguments for JSON API (#11454)
* add actAs, readAs to `meta` for create, exercise, createAndExercise endpoints

* use meta actAs, readAs to control how contract IDs are looked up for exercise

* outdated comments on JwtWritePayload and JwtPayload

* toSet1 operator to clean up some NEL manipulation

* take optional readAs argument for query endpoint

* use readAs for query POST

* check whether readAs is safe in query endpoint

* missed CommandMeta args in tests

* FetchRequest, a domain model to layer on "fetch" endpoint's ContractLocator

- ContractLocator was overloaded as a domain request model *and* a component
  of other domain request models; the addition of new arguments means it can
  no longer exactly meet the former, and adding "readAs" to it would poison it
  for the latter cases.

* take readAs argument from fetch endpoint

* add readAs security check from query to fetch

* move jwt parties functions to util

* testing the party-set/JWT functions

* missing headers

* caught boolean blindness in readAs security checks

* test that meta params are used for commands

* make resolveRefParties do a subset check, too

* Revert "make resolveRefParties do a subset check, too"

This reverts commit 40a66f102c.

* test that the readAs auth check actually applies

* test that command service uses meta readAs, actAs

* note on test coverage

* add changelog

CHANGELOG_BEGIN
- [JSON API] ``actAs`` and ``readAs`` may be specified for create, exercise,
  create-and-exercise, non-WS fetch, and non-WS query.
  See `issue #11454 <https://github.com/digital-asset/daml/pull/11454>`__.
CHANGELOG_END

* no saving mallocs

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

* untabify

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

* move design comment to comment from function name

- suggested by @cocreature; thanks

* remove unneeded variable

* refactor single-key callers of requestJsonReader

- suggested by @cocreature; thanks

* build error in ce

* diagnose Windows failure

* add missed http-json-testing requirement

* use readers as fetch/query party-set name

- suggested by @cocreature and @realvictorprm, thanks

* extra import

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2021-11-12 02:10:15 +00:00
akshayshirahatti-da
e69a871e2f
[JSON-API] Configurable Hikari connection pool props (#11621)
* Changes to make certain hikari cp connection pool properties configurable via jdbc conf string

CHANGELOG_BEGIN
[JSON-API] Make certain Hikari cp connection pool properties configurable via jdbc conf string, the properties are listed below
poolSize -- specifies the max pool size for the database connection pool
minIdle -- specifies the min idle connections for database connection pool
connectionTimeout -- long value, specifies the connection timeout for database connection pool
idleTimeout -- long value, specifies the idle timeout for the database connection pool
CHANGELOG_END

* some missed changes for DbTriggerDao

* remove defaults for poolSize on JdbcConfig

* add constants for test defaults
2021-11-11 05:43:56 +00:00
Stephen Compall
6372d41d13
limit contract insertion/deletion batching on backpressure (#11589)
* move contract insertion/deletion batching to separate function

* limit contract insertion/deletion batching on backpressure

* add changelog

CHANGELOG_BEGIN
- [JSON API] While updating the contract table for a query, if the DB appears to be slow,
  JSON API will slow down its own inserts and deletes at some point rather than construct
  ever-larger INSERT and DELETE batch commands.
  See `issue #11589 <https://github.com/digital-asset/daml/pull/11589>`__.
CHANGELOG_END
2021-11-09 19:03:03 +00:00
akshayshirahatti-da
8d2b1b9ffe
[JSON-API] Port of http-perf-test to sandbox(aka next) (#11543)
* Changes to migrate http-perf-test back to sandbox with more parallelization for single user scenarios.
Increased parallelization is due to the architectural changes in sandbox where it uses
a tick every 100 millis to trigger stuff/data to be available on the read side

CHANGELOG_BEGIN
CHANGELOG_END

* Parallelization fixes for scenarios ExerciseCommand and SyncQueryNewAcs scenarios

* refactor sequential scenario run, make query part of SyncQueryVariableAcs run with single user
2021-11-09 08:44:37 +00:00
Moritz Kiefer
04cc5d7a76
Mark JSON API integration tests as flaky (#11586)
changelog_begin
changelog_end
2021-11-08 18:47:26 +00:00
Remy
3098b70624
pretty print contract IDs properly (#11359)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-29 09:02:33 +02:00
Stephen Compall
bf00956143
replace OneAnd party Sets with NonEmpty Set (#11420)
* add PartySet alias for db-backend

* add PartySet alias for fetch-contracts

* add PartySet alias for http-json

* deprecate old apply

* quick builder for NonEmpty collections

* replace PartySet in db-backend

* replace PartySet in fetch-contracts

* lar.Party is also domain.Party

* add incl1 operator

* replace PartySet in http-json

* port tests

* into with Scala 2.12 needs collection-compat

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* simplify a couple functions that don't need so much data transformation now

* clean up some OneAnds and HKTs

* deal with Scala 2.12 without having warning suppression

* better, more obscure choice for Scala 2.12
2021-10-28 15:23:12 +00:00
pbatko-da
503e39160d
[Short] Typo (#11410)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-27 12:44:13 +02:00
akshayshirahatti-da
e474b2d15a
[JSON-API] Websockets fix for matchedQueries (#11361)
* Changes to ensure matchedQueries are returned correctly when queries contain a mix of offsets and no offsets.

CHANGELOG_BEGIN
[JSON-API] fixes a bug related to the matchedQueries value returned for websocket multiqueries,
this only happens for patterns where the multiqueries contain a mixture of queries with and without
offsets.
CHANGELOG_END

* changes based on code review comments
2021-10-26 23:27:27 +00:00
Stephen Compall
d87d3d490d
deal with deadlocks while fetching contracts in json-api Oracle (#11391)
* clean up some imports

* test case trying to find deadlock situation

* add deadlocks to causes of ContractsFetch retry for Oracle

* Revert "test case trying to find deadlock situation"

This reverts commit 9b19046b18.

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-26 11:03:50 -04:00
Stephen Compall
3bc0db3316
fix contract_tpid_fkey-related race condition (#11330)
* trying to reliably reproduce the template ID constraint error

* tentative fix for template ID constraint error

* sequential simulation

* successfully reproduce the error pre-4633c3137a

- Batch entry 0
        INSERT INTO some_fancy_prefix_contract
        VALUES ('foo', 1, 'null'::jsonb, NULL, '{}'::jsonb, ?, ?, '')
        ON CONFLICT (contract_id) DO NOTHING
       was aborted: ERROR: insert or update on table "some_fancy_prefix_contract" violates foreign key constraint "some_fancy_prefix_contract_tpid_fkey"
  Detail: Key (tpid)=(1) is not present in table "some_fancy_prefix_template_id".

* also reproduced the error pre-4633c3137a on Oracle

- ORA-02291: integrity constraint (UNA3GOHUV7YMSKT0MQXJKLKD9HKKAZ.SYS_C007859)
  violated - parent key not found

* add changelog

CHANGELOG_BEGIN
- [JSON API] Fixed a rare error that manifested as
  ‘violates foreign key constraint "contract_tpid_fkey"
   Detail: Key (tpid)=(...) is not present in table’
  when attempting to run queries and goes away on JSON API restart.
  See `issue #11330 <https://github.com/digital-asset/daml/pull/11330>`__.
CHANGELOG_END

* clean up some now-unneeded printlns
2021-10-22 11:46:26 -04:00
Stephen Compall
f4df1cc4d0
converting server errors to proper client errors (#11184)
* a model for trapping client errors in Scala bindings shim and reporting correctly

* clean up some nesting with an alias

* filter out client-side command service errors

* fix flattening error propagation of CommandService errors in endpoints

* remove todo

* Daml evaluation triggers INVALID_ARGUMENT; handle this for creates/exercises

* clean up lookupResult

* remove stripLeft utility; it is unused

* proper error propagation for /parties endpoint

* map grpc status codes to HTTP error codes

* add a case to pass-through gRPC errors in Endpoints errors

* handle gRPC status in all explicit top-level catches

* pass through gRPC errors in CommandService as well

* treat a gRPC status anywhere in the causal chain as indicating participant-server error

* propagate ContractsService errors without assuming they will always be ServerErrors

* filter ServerErrors' contents when rendering errorful streams

* log errors from websocket output instead of rendering full messages

* hide message in ServerError case

* remove Aborted

* transfer with bad contract ID now returns 409

* mention new error codes

* add changelog

CHANGELOG_BEGIN
- [JSON API] Several kinds of gRPC server errors are now reported with
  associated HTTP statuses; for example, a Daml-LF interpreter error now
  returns a 400 instead of a 500, and an exercise on an archived contract
  returns a 409 Conflict instead of a 500.  Errors internal to JSON API
  (e.g. internal assertion failures) are no longer detailed in the HTTP
  response; their details are only logged.
  See `issue #11184 <https://github.com/digital-asset/daml/pull/11184>`__.
CHANGELOG_END

* remove unused Show and liftErr utility

* adapt daml-script to new error codes

* adapt typescript tests to new error codes

* adapt json-api failure tests to new error codes
2021-10-19 13:54:29 -04: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