Commit Graph

470 Commits

Author SHA1 Message Date
nickchapman-da
b60a7ef657
belt and braces to ensure no infinite loop (#12770)
* belt and braces

changelog_begin
changelog_end

* comment explaining loop termination for GrpcLedgerClient.listAllUsers

* fix loop termination condition + comment

* update comment
2022-02-08 11:53:10 +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
nickchapman-da
56140569f8
Adapt daml-script to paginated listUsers. (#12710)
* Adapt daml-script to paginated listUsers.

changelog_begin
changelog_end

* adapt testUserListPagination to rename listUsers -> listAllUsers
2022-02-04 11:05:48 +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
nickchapman-da
cd16eb740e
Rename: listUsers --> listAllUsers (within daml-script) (#12734)
* Rename: listUsers --> listAllUsers (within daml-script)

changelog_begin
changelog_end

* fix/rename in newly add def: clearUsers

* improve comment doc
2022-02-03 13:07:09 +00: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
Moritz Kiefer
7a5172c025
Make daml-script docs work with a Canton sandbox (#12695)
* Make daml-script docs work with a Canton sandbox

This addresses a few issues:

1. The `--wallclock-time` option does not work.
2. Display names are garbage so dropped the "solution" for
`listKnownParties`.
3. We cannot allocate fixed parties even with
`allocatePartyWithHint`. Switched to `--output-file` and user mgmt.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* debug windows

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* debug scriptexample

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* Update docs/source/daml-script/index.rst
2022-02-02 21:01:44 +00:00
Moritz Kiefer
0494731928
Adjust response type for script JSON API user mgmt requests (#12683)
This broke due to concurrent merges of #12646 and #12578

changelog_begin
changelog_end
2022-01-31 19:17:00 +00:00
nickchapman-da
54c427f849
Expose documentation for user-management functions in daml-script. (#12674)
changelog_begin
changelog_end
2022-01-31 17:01:22 +00:00
nickchapman-da
3d3d84fa6f
User management in daml-script over json API (#12646)
* WIP

changelog_begin
changelog_end

* small cleanup

* use symbolic names for status codes instead of 404/409

* improve recover methods to have them wrap the success case with Some
2022-01-31 15:28:10 +00:00
nickchapman-da
4a6729eb70
Fix a bug in user management caching (#12605)
* provoke bug using daml-script

* fix bug in user management caching

changelog_begin
changelog_end

* add test case (#12606)

Co-authored-by: pbatko-da <pawel.batko@digitalasset.com>
2022-01-26 20:15:21 +00:00
Stefano Baghino
f1cd4b1c7c
Remove dependencies on compatibility libraries (#12548)
Continues the work started in https://github.com/digital-asset/daml/pull/12543

These libraries were only needed to transition from Scala 2.12 to 2.13
and are no longer useful as all the necessary items are now available
in Scala 2.13.

changelog_begin
changelog_end
2022-01-24 18:04:07 +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
nickchapman-da
ebd3827c4a
Make UserId properly opaque by defining it as a variant (#12476)
* Make UserId properly opaque by defining it as a variant instead of as a record.

changelog_begin
changelog_end

* hand coded Show instance for UserId

* rename: userName --> userIdToText
2022-01-19 17:53:44 +00:00
nickchapman-da
6fbaac467f
Remove user-management error cases from scenario-service proto. (#12460)
* Remove user-management error cases from scenario-service proto.

changelog_begin
changelog_end

* remove Error.UserManagement

* remove UserManagememtError

* simp

* meh... done over by scala's poor excuse for a type system
2022-01-19 10:44:04 +00:00
nickchapman-da
0c13a4f1fd
Error handling for User Management exposed via daml-script (#12416)
* Error handling for User Management exposed via daml-script

changelog_begin
changelog_end

adapt ScriptTest.daml to new user-management interface

adapt create-daml-app Setup.daml to new user-management interface

* Add deriving Ord for UserId

* change example of invalid user-id char to "%" from "." (which is no longer illegal)

* recover/reify ALREADY_EXISTS from GrpcLedgerClient.createuser

* fix testcase expected order of users from daml-script listUsers

* adapt create-saml-app Setup.daml to changed interface of user-management

* reinstate sort lost in merge

* sort user in ScriptService user-management test

* improve comment for error foobar hack

* improve doc comment for validateUserId

* use upper case as test example for invalid user-id
2022-01-18 12:58:51 +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
Moritz Kiefer
b996e5e3fa
Support user tokens in Daml Script over JSON API (#12368)
fixes #12349

changelog_begin
changelog_end
2022-01-17 18:45:31 +01:00
Moritz Kiefer
b21c960232
Make Daml Script user mgmt tests order independent (#12409)
no specific order guaranteed so let’s not assume one.

changelog_begin
changelog_end
2022-01-13 17:51:12 +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
Moritz Kiefer
bb8f455e2d
Add test coverage for validateTokenParties (#12370)
This is pure refactoring & adding some tests in preparation
for #12368

changelog_begin
changelog_end
2022-01-13 14:40:09 +01:00
Samir Talwar
9c77a3c94b
kvutils: Remove the DAR upload parameters from the runner. (#12366)
* kvutils: Remove the DAR upload parameters from the runner.

No production ledger needs to upload DARs on participant startup; this
feature is primarily for users of Sandbox. The feature never worked in
the case of multiple participants and was only ever used in testing.

This also removes the associated functionality from Sandbox-on-X as they
share a configuration object. Hopefully this won't be an issue.

Some tests were using this feature, so I have updated them to upload the
DARs through the PackageManagementService instead.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Remove the `writePackagesService` factory constructor.

We no longer use it.

* daml-lf/engine: Revert an unnecessary change.

* daml-script/test: Shut down the channel after uploading the DAR.
2022-01-12 12:57:02 +01:00
Moritz Kiefer
8bc5ff06a7
Clarify unhandled exception error message (#12353)
* Clarify unhandled exception error message

The previous error doesn’t make it clear that this is an exception in
user code rather than a Scala exception in our code.

Daml-lf exception would technically be more correct but I don’t think
it’s helpful here so I went with Daml exception.

changelog_begin
changelog_end

* adjust ledger api test tool

changelog_begin
changelog_end

* Update test assertions

changelog_begin
changelog_end

* fix another assertion

changelog_begin
changelog_end
2022-01-11 17:57:07 +00:00
Simon Meier
6dd0eb774e
ledger api server: support auth0 usernames (#12308)
* ledger api: support Auth0 user names in user management

See the `IdString.UserId` and `IdString.ApplicationId` comments wrt the
character classes being introduced.

Many thanks to @cocreature for helping with deciding on the exact
restrictions of user-ids.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-10 12:58:43 +00:00
Gary Verhaegen
ea55ea2d14
Further copyright updates (#12249)
Somewhat error-prone, so please review carefully.

Reasons we need this:

- Some file types are not properly handled by the script.
- The only exclusion mechanism we currently have (`NO_AUTO_COPYRIGHT`)
  is overly coarse.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-04 16:32:17 +01:00
Moritz Kiefer
7c011cfb38
Fix tracking of party references (#12253)
We missed keys of generic maps.

Don’t be scared of the diff, I just added some unit tests since there
didn’t seem to be any.

fixes #12234

changelog_begin
changelog_end
2022-01-04 12:11:05 +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
Moritz Kiefer
01364f2863
Enable Daml Script user management tests (#12130)
With #12063 merged, these tests now pass \o/

changelog_begin
changelog_end
2021-12-14 11:57:41 +00:00
Moritz Kiefer
f146bc814b
Escape daml-lf tracelog messages (#12116)
* Escape daml-lf tracelog messages

Currently veracode complains because this allows for clrf
injection (injecting newlines to make user input look like separate
log statements).

With this change
```
debug "abc"
debug "eaiu\neaiu"
debug "def"
debugRaw "abc
```

is logged as

```
[DA.Internal.Prelude:555]: \"abc\"
[DA.Internal.Prelude:555]: \"eaiu\neaiu\"
[DA.Internal.Prelude:555]: \"def\"
[DA.Internal.Prelude:555]: abc
```

You can debate whether we should escape the quotes are necessary but
90% of the reason why people add them is because they call `debug` on
strings when they should be using `debugRaw` so this seems fine to me.

changelog_begin
changelog_end

* fix tests

changelog_begin
changelog_end
2021-12-14 11:20:33 +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
Moritz Kiefer
8011d602c8
Support multiple participant in daml script’s user management (#12091)
part of #11997

No tests for now since we don’t have a multi-participant ledger that
supports this in `main`. The logic for selecting the client for the
participant is the same as for party management and other stuff anyway
so tests don’t add that much.

changelog_begin
changelog_end
2021-12-10 15:08:28 +01:00
Moritz Kiefer
f59760efd8
Wire up Daml Script user management to gRPC API (#12069)
* Wire up Daml Script user management to gRPC API

part of #11997

The tests are disabled for now until #12063 is merged. I did test it
manually against that branch though and they pass happily.

changelog_begin
changelog_end

* fmt

changelog_begin
changelog_end
2021-12-09 10:18:22 +00:00
Moritz Kiefer
f3acd8d852
Wire up user management to ScriptLedgerClient (#11889)
part of #11997

changelog_begin
changelog_end
2021-12-09 08:52:48 +01:00
Moritz Kiefer
e036e2c00a
Implement user management in Daml script service (#12050)
* Implement user management in Daml script service

changelog_begin
changelog_end

* Update compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala

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

* move assertion into replaceInfo

changelog_begin
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-12-08 16:11:09 +00:00
Moritz Kiefer
6c7112cc08
Add the Daml API for exposing user management in Daml Script (#12029)
Spun out from #11899 for ease of review, part of #11997

This PR exposes the user management service from
https://github.com/digital-asset/daml/blob/main/ledger-api/grpc-definitions/com/daml/ledger/api/v1/admin/user_management_service.proto
in the Daml Script Daml API.

It obviously doesn’t actually work without also handling that in the
Daml Script runner. For ease of review I’ll handle that in a separate PR.

changelog_begin
changelog_end
2021-12-08 14:32:45 +01:00
Moritz Kiefer
42a8ccdbef
Extend ScriptLedgerClient trait with user management (#12031)
* Extend ScriptLedgerClient trait with user management

Spun out from #11899, part of #11977

This PR extends the ScriptLedgerClient trait with the methods we need
for user management. All implementations currently fail, I’ll fill
those in separately. I’ve chosen to make them fail in each instance
rather than in the trait since eventually they should all be filled in.

changelog_begin
changelog_end

* fmt

changelog_begin
changelog_end
2021-12-08 08:54:55 +01:00
Moisés Ackerman
8df9a42f29
Interface desugaring cont. (#11964)
* Move toInterfaceContractId and fromInterfaceContractId out of Implements class

* Split Implements class into single-method classes

* Define toInterface outside its class to swap type arguments

This allows users to call 'toInterface @Interface', since the type of the template can usually be inferred

* Move interface classes and functions to DA.Internal.Interface

changelog_begin
changelog_end
2021-12-07 13:56:57 +01:00
Moritz Kiefer
8179c73763
Drop support for Daml-LF party literals from the Scala side (#11922)
* Drop support for Daml-LF party literals from the Scala side

This PR enforces that forbidPartyLiterals is always `true` and drops
the corresponding literals from the AST. Haskell side is in #11930

fixes #11581

changelog_begin
changelog_end

* Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ComparisonSBuiltinTest.scala

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

* Revert "Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ComparisonSBuiltinTest.scala"

This reverts commit 55e542ce4e3a7fd15544ee703de3277ffc309b17.

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-12-01 10:37:42 +00:00
Moritz Kiefer
16135e6f7c
Limit supported input versions in damlc to >= LF 1.8 (#11905)
* Limit supported input versions in damlc to >= LF 1.8

1.8 was the version that introduced type synonyms, we really don’t
gain much by dropping more since data-dependencies mainly depends on
that. and this provides for a very natural upgrade path for users
where pretty much everyone should be able to upgrade directly to SDK
2.0 without having to go through intermediate versions.

changelog_begin

- [Daml Compiler] The supported input LF versions for
  data-dependencies are now limited to LF 1.8 and newer.

changelog_end

* fix some tests

changelog_begin
changelog_end

* Drop export 1.6 tests

changelog_begin
changelog_end

* Drop daml2js support for LF < 1.8

changelog_begin

- [Daml2js] DARs with LF version < 1.8 are no longer supported.

changelog_end

* .

changelog_begin
changelog_end

* bash is bad, stop using it

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-11-30 17:24:08 +01:00
Moritz Kiefer
31cc540cf9
Turn package name & version warnings into an error (#11859)
* Turn package name & version warnings into an error

fixes #11321

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-11-26 18:46:33 +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
Moritz Kiefer
9ff64f7faa
Change daml script’s sleep to sleep for a minimum amount of time (#11886)
* Change daml script’s sleep to sleep for a minimum amount of time

We’ve seen a few flaky test failures where we slept for less than the
expected amount of time which isn’t what we want. We definitely cannot
guarantee an exact sleep time but at least a minimum.

changelog_begin
changelog_end

* Update daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ScriptF.scala

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

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-11-26 11:12:08 +00:00
Moritz Kiefer
5785bbfcfd
Drop LF < 1.14 from supported damlc output versions (#11701)
* Drop LF < 1.14 from supported damlc output versions

fixes #11319

We keep test coverage by depending on the most recent snapshot which
still has 1.14 support.

changelog_begin

- [Daml Compiler] Damlc can only produce Daml-LF 1.14 or
  newer. Passing aynthing older to `--target` is an error. If you
  need to produce older versions, use an older SDK.

changelog_end

* Switch around legacy_compiler_lf_versions

changelog_begin
changelog_end

* drop since-lf

changelog_begin
changelog_end
2021-11-22 16:20:17 +00:00
Sofia Faro
f8933d1f4b
Make lookupTemplateChoice return only choices in the template. (#11808)
This fixes a bug in the typechecker (#11558) and the command
preprocessor, since those were written with this behavior of
lookupTemplateChoice in mind. Enables the engine test that
caught this.

changelog_begin
changelog_end
2021-11-22 13:27:48 +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
Moisés Ackerman
d23d113667
Restructure interface desugaring (#11555)
* Update ghc patch

* Replace Implements proxy datatype with a class

* Expose 'Implements' class in Prelude

* Add DA.Internal.Desugar.HasMethod class

This allows us to get the type of a method of an interface through the functional dependency

* Convert interfaces from new desugaring

* Update Interface daml-test-file to use Interface class functions

* Update InterfaceDesugared daml-test-file

* Replace remaining uses of Is<Interface> methods with Implements

* Document HasMethod, Method and mkMethod

* Ignore _method_ bindings in convertBind

* Ignore interface desugaring types/classes/instances/functions in LF conversion

* update snapshot after pin on windows

changelog_begin
changelog_end
2021-11-19 10:06:49 +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
Moritz Kiefer
2d5b54828b
Use explicit party specifications in Daml Script over JSON API (#11678)
* Use explicit party specifications in Daml Script over JSON API

This uses the new party set arguments from #11454 to allow Daml Script
over the JSON API to `submit p` even if we have a token with more
claims.

changelog_begin

- [Daml Script] When run over the JSON API, Daml Script can now use a
  subset of the claims in the token. E.g., `submit p` works even if you
  have a token with `actAs = [p, p2]`.

changelog_end

* Apply suggestions from code review

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

* Drop opt prefix

changelog_begin
changelog_end

* switch around error & success cases

changelog_begin
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-11-16 12:17:32 +00:00
Remy
7eb22ddf4f
LF: drop forgotten deprecate Node aliases. (#11673)
Because a bug in the scala compiler deprecated pattern matching are
not detected (See https://github.com/scala/bug/issues/12493).
Hence some deprecated usage of Node aliases have been forgotten in

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-12 15:07:22 +00:00
Moritz Kiefer
b0463aaab2
Move script auth tests to postgresql (#11670)
changelog_begin
changelog_end
2021-11-12 13:55:25 +01:00
Moritz Kiefer
d3bb036591
Fix sandbox database config in script & trigger tests (#11655)
* Fix sandbox database config in script & trigger tests

Setting jdbcUrl does absolutely nothing because it later gets
overwritten again.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-11-12 06:18:12 +00:00
nickchapman-da
2dd5289a35
different types for different speedy phases (#11605)
* Refactor speedy to distinuish SExpr types before/after ANF compilation phase

CHANGELOG_BEGIN
CHANGELOG_END

* remove commment/marker left in error

* make SExpr0 private to speedy

* reinstate (non-pp) print of original expression in AnfTest faiure

* avoid use of s./t. prefixes for expressions in SBuiltin; add 3 TODO markers

* inline "runtime" apply methods of SDefinitionRef into sole caller: SBCallInterface

* avoid use of t. prefix in SExpr0

* change s./t. prefix to source./target.

* add comment to summarize differences between SExpr0 and SExpr
2021-11-11 08:21:12 +00:00
Remy
92181161cc
LF: Abstract VersionedValue and VersionedContractInstance (#11533)
* LF: Abstract VersionedValue and VersionedContractInstance

CHANGELOG_BEGIN
CHANGELOG_END

* formatting
2021-11-09 23:22:38 +00:00
Remy
3b61a1b748
LF: allow exercise command by template for inherited choice. (#11584)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-09 13:10:06 +00:00
Moritz Kiefer
ac19c8cff5
Synchronize in multi-participant script tests (#11594)
* Synchronize in multi-participant script tests

This hopefully fixes the flakiness where the party allocation is not
yet propagated to the other participant.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-11-09 09:27:54 +00:00
Moisés Ackerman
7d68e05f7f
Remove virtual choices (#11482)
* Remove virtual choices

* Remove choices without a body in 'interface' definition
* Remove choices in 'template ... implements' section

part of #11372

changelog_begin
changelog_end

* Remove virtual choices cont.

Switch uses of virtual choices to fixed choice with method implementation

* update snapshot after pin on windows

* Disable failing interface tests with TODO #10810
2021-11-08 17:05:23 +01:00
Moritz Kiefer
a3d04cafaf
Migrate matches-docs tests to sandbox on postgres (#11573)
* Migrate matches-docs tests to sandbox on postgres

We’ve seen timeouts on party allocation which are likely caused by the
h2 issues that keep popping up. Switching to postgres should hopefully
solve that.

We need to wrap postgres to set LOCALE_ARCHIVE for this to work in
builds. We already pass it through in tests which is why it works fine there.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* Update nix/bazel.nix

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* disable on Windows

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2021-11-08 13:39:02 +00:00
Moritz Kiefer
6a0b84e3d0
Run Script export tests against BR (#11574)
More h2 garbage

changelog_begin
changelog_end
2021-11-08 10:41:09 +00:00
Stefano Baghino
b84a9142d1
Extractor: replace sandbox-classic-based fixtures with sandbox-based ones (#11489)
* Replace `sandbox-classic`-based fixtures with `sandbox`-based ones

changelog_begin
changelog_end

* Replace Scenarios with Script for BasicPrimitiveTypes

* Adapt ListsSpec

* Adapt TextMapsSpec

* Adapt OptionalSpec

* Adapt more tests

* More tests passing

- removed workflow_id testing (Daml Script doesn't set one)
- reduced failure threshold for VeryLargeArchiveSpec
- solved issu in TransactionSingleTableSpec (wrong parties were used)

* Port EnumMod and make EnumSpec pass

* Port GenMapMod and make GenMapSpec pass

* Shaking things around to make Windows happy -- maybe
2021-11-04 13:08:51 +00:00
Moritz Kiefer
c098d75621
Add a --log-level flag to damlc (#11514)
This also allows us to quite down our builds a bit which is nice.

changelog_begin
changelog_end
2021-11-03 14:22:57 +01:00
Moritz Kiefer
bb37eef156
Switch script & trigger tests to postgres-backed Sadbonx (#11525)
DPP-695 is gift that keeps on giving and seems to also result in
timeouts here. Just marking all of our tests that depend on Sadbonx as
flaky doesn’t seem all that helpful so switch to a postgres-backed
sandbox instead.

changelog_begin
changelog_end
2021-11-03 08:39:46 +00:00
Moritz Kiefer
257d5365c2
Switch from sandbox to sandbox-classic in daml test-script (#11476)
* Switch from sandbox to sandbox-classic in daml test-script

changelog_begin
changelog_end

* apparently sadbonx next also has ce and ee

changelog_begin
changelog_end
2021-11-01 10:42:46 +00:00
Moritz Kiefer
8ffd835f24
Migrate daml script tests to Sandbox next (#11472)
* Migrate daml script tests to Sandbox next

This does not yet drop all dependencies from daml script. In
particular `daml test-script` still depends on Sandbox classic. Will
tackle that in a separate PR.

changelog_begin
changelog_end

* Speedup maxInboundMessageSize tests

changelog_begin
changelog_end
2021-11-01 09:08:32 +00:00
Moritz Kiefer
73718a22fa
Mark script export tests as flaky (#11449)
Not much we can do here until the underlying bug in the indexer is
fixed so marking flaky for now.

changelog_begin
changelog_end
2021-10-28 15:03:45 +02:00
Moritz Kiefer
fcc7e581cf
Make stable packages dependent on supported LF versions (#11382)
* Make stable packages dependent on supported LF versions

Note that this just introduces an API dependency, we are not yet
filtering the list of packages. For that, I’d really like to
autogenerate StablePackages.scala since I don’t want to make that
manually maintained list even more complex. But review seems easier if
we first change the usage sites and then switch to autogenerating than
trying to do both in one go.

changelog_begin
changelog_end

* Fix script export tests

changelog_begin
changelog_end
2021-10-28 11:20:42 +00:00
Moritz Kiefer
8d17882951
Allocate parties sequentially in script export tests (#11389)
* Allocate parties sequentially in script export tests

We’ve seen a few timeouts so this seems at least worth a try.

changelog_begin
changelog_end

* Extend logging to ease debugging

changelog_begin
changelog_end
2021-10-26 08:21:40 +00:00
Robert Autenrieth
1309c2f819
DPP-587 Use Timestamp instead of Instant (#11183)
* Use Timestamp instead of Instant

Time has microsecond resolution in Daml

changelog_begin
changelog_end

* Revert accidental newline changes

* Remove unused conversion modes

* Apply review comments
2021-10-26 08:54:47 +02:00
Remy
5365d68a38
LF: Remove PartialTransaction out from ScenarioRunner/IdeLedgerClient (#11368)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-25 13:07:23 +02:00
Remy
8d5cab5f16
LF: Simplify seeds generation in scenario runnner (#11353)
We just need the new seeds to be:
- fresh during a run,
- deterministic across two runs.

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-25 08:54:42 +02:00
Robert Autenrieth
355352f2d1
DPP-650 Remove the mutating schema (#11211)
* Remove the mutating schema

changelog_begin
- [Participant] All participants now use the new append-only schema. Existing databases will
  automatically upgrade to the new schema the first time a participant/ledger is started.
changelog_end

* Fix post-commit validation test

* Remove append-only flags from CI

* Don't crash when using deprecated flag

* Increase timeout for reset service tests

* Fix typos in parameter names

* Restore removed test

* Restore removed CLI check

* Improve CLI parameter description
2021-10-21 14:40:35 +02: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
Remy
a1d94e10ba
LF: Create special case class for VersionedContractInstance (#11127)
To replace usage of ContractInstance[VersionedValue]

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-14 08:53:26 +02:00
Moritz Kiefer
83d1e3cc0e
Fix daml test-script ordering (#11210)
The issue is that onComplete is not sequenced here. It’s close to
impossible to hit this by default but I added random delays which
triggered it reliably and confirmed that this fixes the issue.

changelog_begin
changelog_end
2021-10-12 13:57:42 +00:00
Robin Krom
3115d104aa
daml script interfaces (#11124)
* interfaces: introduce TemplateOrInterface class in stdlib

The template typeclass is to strong for many applications. The new
constraint `TemplateOrInterface` only contains the methods to convert
contract IDs and choices.

CHANGELOG_BEGIN
CHANGELOG_END

* ghc-lib update, interface script tests

* pinned stackage on unix

* added missing implementation in preprocessor

* added test

* fixing tests

* remove Iface type

* pinned stackage windows

* make sure createAndExercise is not called on interfaces
2021-10-11 18:22:40 +02:00
Hubert Slojewski
b9e8eb81e8
daml-script: Switch integration-tests to the append-only-schema (#11149)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-07 10:18:29 +02:00
Andreas Herrmann
51873ff344
Support empty party display name in scenario service (#11131)
* Add regression test for #11099

https://github.com/digital-asset/daml/issues/11099

* Support empty party display name in scenario service

changelog_begin
- [Daml Studio] Scripts no longer fail when allocating a party with an
  empty display name. See https://github.com/digital-asset/daml/issues/11099.
changelog_end

* fmt

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-10-06 10:28:11 +00:00
John Sullivan
7a4963b43d
add --max-inbound-message-size flag to daml ledger export (#11087)
Add support for `--max-inbound-message-size` flag to the [Ledger Export](https://docs.daml.com/tools/export/index.html) tool.

CHANGELOG_BEGIN

- [Daml Assistant] Add support for `--max-inbound-message-size` flag to the Ledger Export tool.

CHANGELOG_END
2021-09-30 12:17:53 +02:00
Moritz Kiefer
26d10b267d
Drop NodeId type parameter (#10921)
changelog_begin
changelog_end
2021-09-30 09:13:54 +00:00
Remy
5dc15c6911
LF: rename language Interface to PackageInterface (#10938)
To avoid confusion with the new Daml concept of Interface.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-20 19:04:14 +00:00
Moritz Kiefer
8e22bb6b2d
Drop ContractId typeparameter from Value (#10827)
99% of our usecases use Value[ContractId] so this PR just fixes it.

The few other usescases are:

1. Value[Nothing] which we use for keys. This is technically more
precise but we benefit very little from it.
2. Value[String] mostly because in a few places we are lazy.

We don’t have any code which benefits from being polymorphic in the
contract id type.

changelog_begin
changelog_end
2021-09-16 08:46:57 +00:00
pbatko-da
6dcdaa411c
[DPP-589] Add CLI flag to select minimum enabled TLS version (#10854)
- Add support for specifying either 1.2 or 1.3 as minimum TLS versions for ledger api server.
- Log enabled protocols (~TLS versions) and cipher suites at server and client startup.
- Add integration tests against Sandbox-classic and Sandbox

CHANGELOG_BEGIN
Sandbox: Add CLI flag to select minimum enabled TLS version for ledger API server.
CHANGELOG_END
2021-09-14 12:37:38 +02:00
Hubert Slojewski
b50bb8e437
Populate definite_answer in ApiException [KVL-1004] (#10832)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 16:28:39 +00:00
Remy
1e1c452b36
LF: drop ad-hoc FrontStack builders (#10839)
Following #10763, we drop the ad-hoc builders for `FrontStack`.

* Building a `Fronstack` from individuals elements should be done with
  standard scala buidler.

* Building a `Fronstack` from a `TraversableOne` should be done with
  the scala 2.13 `.to(FrontStack)` methd

* Building a `Fronstack` from a `ImmArray` should be done with the
  `toImmArray` method.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 17:49:09 +02:00
Remy
c4e0a755d4
LF: drop ad-hoc ImmArray builders (#10763)
Since we switch to scala 2.13, ImmArray companion object extends
`Factory`. Hence:

- the `apply` methods of `ImmArray` override the one from `Factory`

- we can use the notation `.to(ImmArray)` to convert an `Iterable` to
  `ImmArray`

This PR drops those `apply` ImmArray. Conversion from Iterable to
`ImmArray` should use the `.to(ImmArray)`.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-04 16:10:07 +02:00
Victor Peter Rouven Müller
5595d55c79
[JSON-API] Use the token from incoming requests to update the package list (#10602)
* Use the token from incoming requests to update the package list

changelog_begin
changelog_end

* Lazily initialize the ledger client

* Fix ee integration tests

* Fix package reloading behaviour by using a semaphore to check for ongoing updates

* Refactor out the semaphore code into a concurrency utility class

* Use correct locking for the updateTask so every thread always uses an up to date task

* Remove unused imports in utils.Concurrent & remove packages from the tests

* Hide & mark the token file cli option deprecated because we dont need it anymore and only keep it so client deployment code doesn't break

* Fix scala 2.12 build by adding more type annotations

* Update ledger-service/http-json-cli/src/main/scala/com/daml/http/OptionParser.scala

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

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

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

* Readd pgkManagementClient after it was removed accidentally (but now it's lazy)

* Remove concurrent object & use atomic boolean instead of a mutex because it makes more sense

* Replace semaphore with countdownlatch

* Refactor the caching into a separate class

* Use Instant instead of LocalDateTime

* Remove that ** of bad synchonization and do stupid simple synchronization because it JUST WORKS, besides adapt when we want to reload

* Remove await in tests because it can result in buggy tests

* remove unused code in WebSocketService.scala

* Unhide the access-token-file option as per request of Stefano

* Less implicit jwts per request of Stefano

* Try making some code more readable as by request of Akshay

* Use more shark because it expresses better than flatMaps if I don't need the arg

* Move defs in predicate in WebsocketService.scala around

* Try to minimize diff further in WebsocketService.scala

* Fix build and minimize diff in WebSocketService.scala further

* Minimize diff of function getTransactionSourceForParty in WebSocketService.scala

* Share the ec in WebSocketService.scala to minimize the diff

* Minimize in function predicate in WebSocketService.scala

* Further minimize in function predicate in WebSocketService.scala

* Change some case classes to be normal classes but with apply method

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

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

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

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

* Get rid of implicit jwt tokens, the world is already confusing and full of implicits enough

* Improve readability

* Integrate the new LedgerClient which does not depend on a leder id

* Fix tests

* Apply suggestions from code review

thanks to @S11001001

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

* Apply further review comments

* Remove outcommented code

* Deprecate access token file option in the description too

changelog_begin

- [JSON API] The cli option `--access-token-file` is now deprecated. It
    is not needed anymore and you can safely remove it. Reason is that
    the operations which prior required a token at startup are now done
    on demand using the token of the incoming request.

changelog_end

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2021-09-03 10:12:01 +00:00
Remy
97bda3ca36
LF: V1 Contract ID check in Preprocessor (#10687)
This PR makes possible to reject V0 contract IDs during preprocessing.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-30 20:14:55 +02:00
nickchapman-da
387c68b9eb
Normalize transaction values within the engine (#10648)
Create normalized TXs when a partial TX is finalised.

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

CHANGELOG_BEGIN
CHANGELOG_END

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

fix 2.12 build

backout redundant change

ensure byKey field is correctly normalized when constructed by engine

rename flag: valueNormalization -> transactionNormalization

improve comment

delete commented-out code

rename: toValueNorm --> toNormalizedValue

rename: (SValue.) toValue --> toUnNormalizedValue

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

improve comments

respell: toUnNormalizedValue --> toUnnormalizedValue

fix build
2021-08-25 09:53:26 +01:00
Remy
b22de6893b
LF: Contract ID suffix check in Preprocessor (#10642)
This PR makes possible to check for contract IDs suffix during
preprocessing.

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

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-24 18:45:33 +02:00
Remy
3598e0928c
LF: Drop contract ID Freshness check (#10620)
As stated in #10504 the contract ID freshness check cannot be
implemented correctly in general.

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

This corresponds to the fist task of #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-19 18:07:29 +02:00
Samir Talwar
8dd136fc7d
bazel-tools: Replace runner with either runner_with_port_check or runner_with_port_file. (#10615)
* Use `extra` in the port file runner, rather than `temporary`.

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

Much simpler than the port file runner for our purposes.

* Replace `runner` with `runner_with_port_file`.

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

CHANGELOG_BEGIN
CHANGELOG_END

* Rename the `runner_with_port_check` target to the default.
2021-08-18 15:23:45 +00:00
Andreas Herrmann
d92440471c
daml ledger export: export all parties (#10588)
* Add test-case to ConfigSpec for output type

changelog_begin
changelog_end

* Add an --all-parties flag to ledger export

changelog_begin
* [Daml export] You can now set the ``--all-parties`` option to generate
  a ledger export as seen by all known parties.
changelog_end

* Update docs

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-17 14:12:28 +02:00
Andreas Herrmann
244262dfac
Handle imports for builtin types correctly in Daml export (#10575)
* Move isTupleId

* Don't depend on DA.Types for tuple values

changelog_begin
changelog_end

* Date|Timestamp requires import DA.Date|Time

changelog_begin
changelog_end

date

* Use DA.TextMap consistently in encoding

changelog_begin
changelog_end

* TextMap requires DA.TextMap

changelog_begin
changelog_end

* Use DA.Map in encoding

* GenMap requires DA.Map

changelog_begin
changelog_end

* Add unit tests for module and package refs

changelog_begin
changelog_end

* Update daml-script/export/src/main/scala/com/daml/script/export/TreeUtils.scala

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

* Update daml-script/export/src/main/scala/com/daml/script/export/TreeUtils.scala

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

* Consistently use Set +

* Format scaladoc comment

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-08-16 11:20:10 +00:00
Samir Talwar
4b8b67a1b5
Upgrade Scalatest to v3.2.9. (#10576)
* Upgrade Scalatest to v3.2.9.

Because of some coupling we also have to upgrade Scalaz to the latest
v7.2 point release, v7.2.33.

The Scalatest changes are quite involved because the JAR has been broken
up into several smaller JARs. Because Bazel expects us to specify all
dependencies and doesn't allow transitive dependencies to be used
directly, this means that we need to specify the explicit Scalatest
components that we use.

As you can imagine, this results in quite a big set of changes. They
are, however, constrained to dependency management; all the code remains
the same.

CHANGELOG_BEGIN
CHANGELOG_END

* http-json-oracle: Fix a Scalatest dependency.

* ledger-api-client: Fix a Scalatest dependency.
2021-08-12 23:19:35 +00:00
Moritz Kiefer
f1a55aa4bf
Fix sdk version in script export tests (#10559)
changelog_begin
changelog_end
2021-08-11 17:04:08 +00:00
Andreas Herrmann
5cc78f5254
Handle missing template instances in Daml ledger export (#10526)
* LF 1.6 ledger export integration test

Test that Daml ledger export script handles DALF packages in LF version
1.6. These packages don't contain metadata, meanint `--package` flags
have to use the hash rather than the package name, and they contain no
type class instances, meaning the export script needs to contain newly
defined instances for type classes required to issue ledger commands in
Daml script.

changelog_begin
changelog_end

* Expose unconstrained Daml script commands

This will be used in Daml ledger exports of contracts defined in Daml LF
versions before 1.8. These versions did not include typeclass instances,
meaning that instances such as HasTemplateTypeRep need to be recreated
in the export Script. Not all instances required in the `Template t`
constraint can be recreated at the use-site. E.g. `HasSignatory`. By
avoiding these kinds of constraints it is possible to handle these cases
in Daml ledger exports anyway.

changelog_begin
changelog_end

* Identify all templates with missing instances

changelog_begin
changelog_end

* Use internal*Cmd on templates missing instances

changelog_begin
- [Daml export] Daml ledger export now handles templates in packages
  using LF versions 1.7 or older. These package versions don't include
  type class instances and Daml ledger export needs to generate
  replacement instances in the generated script. The generated script
  uses less type-safe versions of Daml script ledger commands.
changelog_end

* Add encodeType to encode Ast.Type in ledger export

This will be required to encode HasContractKey instances.

changelog_begin
changelog_end

* Simplify newline handling in encodeExport

* Encode missing template type class instances

* ZIP entries must use forward slash as path separator

* Throw error on encode of Any

Addressing
https://github.com/digital-asset/daml/pull/10526#discussion_r685807454

* Qualify choice using argument type

Addresses review comment
https://github.com/digital-asset/daml/pull/10526#discussion_r685817745

* Use lf.language.Util

Addresses
https://github.com/digital-asset/daml/pull/10526#discussion_r685827150

* Factor out header comment in tests

Addressing review comment
https://github.com/digital-asset/daml/pull/10526#discussion_r685830832

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-10 16:44:11 +00:00
Andreas Herrmann
35f1592098
Split the Daml ledger export integration tests (#10506)
changelog_begin
changelog_end

This test suite performs the same test with different parameters three
times. These tests each setup some state on the ledger, then create a
Daml ledger export script, compile it, run it, and compare the new
ledger state to the previous state.

Running all this three times in the same target get exceed the default
timeout of 300s in some case. This splits these tests into three
separate targets to reduce the risk of timeouts.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-09 13:58:11 +02:00
Andreas Herrmann
55ed83c7ea
Factor out Daml export integration tests (#10492)
* Move Daml export scala integration-tests

changelog_begin
changelog_end

* Move Daml export example test

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-09 10:04:01 +02:00
Samir Talwar
df78f9cb1e
Replace LedgerConfiguration with InitialLedgerConfiguration or the load timeout. [KVL-1058] (#10487)
* participant-integration-api: Encapsulate the initial configuration.

* participant-integration-api: Reduce usage of `LedgerConfiguration`.

* Inline `LedgerConfiguration` wherever it's used.

Most things don't need all its constituent parts; this reduces the
amount of unused properties.

CHANGELOG_BEGIN
- [Integration Kit] The ``LedgerConfiguration`` class has been
  removed in favor of ``InitialLedgerConfiguration``. Its usage
  has been changed accordingly, with the ``configurationLoadTimeout``
  property becoming part of ``ApiServerConfig`` instead.

  The default options provided by ``LedgerConfiguration`` have been
  removed; you are now encouraged to come up with sensible values for
  your own ledger. The ``Configuration.reasonableInitialConfiguration``
  value may help.
CHANGELOG_END

* Correct the initial configuration submission delay for KV ledgers.

* kvutils: Mark supertype unused parameters as unused.

* kvutils: Extract out common configuration submission delays.

These values are specific to kvutils; other drivers should come up with
their own.

* configuration: Delete `NoGeneration`, as it's unused.
2021-08-05 16:31:45 +00:00