Commit Graph

482 Commits

Author SHA1 Message Date
Martin Huschenbett
f725137795 daml2ts: Do some maintenance tasks in daml-ledger-fetch (#3922)
Fix a few todos. Remove a few useless lambdas. Use newer syntax.
2019-12-20 18:44:17 +00:00
Martin Huschenbett
02d72e3a55 daml2ts: Clean up yarn.lock for support libraries (#3921) 2019-12-20 17:08:56 +00:00
Shayne Fletcher
11681c6aa3
Add 'R' to 'Choice<T,C,R>' defn (#3895)
* 'Choice<T,C,R>' defn

* Speculative. Account for the absence of tuples

* Finalize the exercise decoding and add a test

* Shorter version of bazel bootstrap (recommended by AH)

* argDecoder => argumentDecoder

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/daml-ledger-fetch/src/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/generated/src/__tests__/test.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/tests/ts/generated/src/__tests__/test.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Remove spurious return

* argDecoder => argumentDecoder

* Note to self : don't accept suggestions, implement them yourself

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-12-20 08:48:23 -05:00
Brian Healey
9f13a2fb10 Upgrade to Akka 2.6.1, akka-http 10.1.11 and Scala 2.12.10 (#3903)
* Upgrade to Akka 2.6.1, akka-http 10.1.11 and Scala 2.12.10

Akka 2.6.1 Upgrade Changes
- Materializer in place of ActorMaterializer
- Source.future instead of Source.fromFuture
- The Scheduler.schedule method has been deprecated in favor of selecting scheduleWithFixedDelay or scheduleAtFixedRate
- onDownstreamFinish(cause: Throwable)
- ActorAttributes.supervisionStrategy(...) in place of ActorMaterializerSettings.withSupervisionStrategy

See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html

* Akka 2.6.1 Upgrade Changes
- onDownstreamFinish(cause: Throwable)

See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html

* code review: remove unnecessary supervision strategy
2019-12-19 18:00:59 +00:00
Moritz Kiefer
c48b0ee289 Move Any wrappers and Archive to stable packages (#3890)
* Move Any wrappers and Archive to stable packages

There are no actual API or functionality changes in this PR but the
logic for locating the stable packages has slightly changed since the
Any wrappers package only makes sense for LF 1.7. To address this, we
simply filter out stable packages for newer LF versions since it
doesn’t make sense to depend on those anyway.

CHANGELOG_BEGIN

- [DAML Compiler] Move ``Archive`` type to a separate DALF.

CHANGELOG_END

* More comments

* Fix java codegen tests

* fix more tests

* Force cache reset on Windows

* Revert "Force cache reset on Windows"

This reverts commit 9f2b7d70b2.
2019-12-19 01:26:38 +00:00
Martin Huschenbett
00f23ef7d5
Rename Contract type to CreateEvent and move it to daml-ledger-fetch (#3869)
What was called `Contract` until now is actually a create event. Hence the
renaming. We'll most likely get a `Contract` type in DAML as well and this
renaming will avoid a name conflict. Also, create events are not part of
DAML-LF values and hence not generated by `daml2ts`. Thus, there's not need
to have them in `daml-json-types`. Instead, they should be in a future
`daml-json-api-types` package which captures the types used by the JSON API.
2019-12-17 15:05:32 +01:00
Martin Huschenbett
6d83a7bf47
Move daml-json-types to TypeScript 3.7.3 (#3856)
This should have happened in a previous PR, but I missed it.
2019-12-17 08:47:41 +01:00
Robin Krom
bbb6e27d04
language: daml2ds: Removal of accidentally slipped in dependencies (#3862)
These seem to have slipped in when running yarn locally.
2019-12-16 15:40:49 +01:00
Robin Krom
881d36eab4
language: daml2ts: support for enum types (#3852)
* language: daml2ts: support for enum types

This adds support for enum types to daml2ts. daml-lf enums are converted
to typescript enums and a decoder defined in the same namespace.

* static serializable check for enums and better tests
2019-12-16 13:57:25 +01:00
nickchapman-da
1369351f70
separate type-synonyms from type-constructors (#3829)
* separate type-synonyms from type-constructors in DAML-LF .proto and Haskell AST

* comments
2019-12-16 11:52:28 +00:00
Samir Talwar
71e8c20127 Sandbox: Fix warnings in SandboxServer. (#3853)
* sandbox: Move SandboxServer's helper classes to the companion object.

And make them `private`, `final`, and non-`case`.

* sandbox: Drop SandboxServer.apply and just call the constructor.

* sandbox: Move the SandboxServer#SandboxState class into the object.

Leave the `resetAndRestartServer` method behind, though.
2019-12-14 20:52:03 +00:00
Martin Huschenbett
44005348a3
daml2ts: Upgrade to TypeScript 3.7 (#3854)
Also upgrade ESLint to the newest version and its plugins to the newest
version.
2019-12-13 23:01:05 +01:00
Martin Huschenbett
05860d1df4
daml2ts: Tie the knot between templates and their choices without hacks (#3839)
In the code generated by `daml2ts`, every template companion object lists
all its choices and every choice has a pointer back to the companion object
of its template. Thus, there's a knot to tie.

So far, we initialized the choices as `undefined` and later mutated them to
point to the template companion object. This feels kind of hacky,
particularly since we end up with cyclic values.

This PR pushes the pointer from the choice back to the template companion
object behind a lambda. This makes the hack unnecessary and removes the
cyclic values.
2019-12-13 12:03:51 +01:00
Jussi Mäki
ce70ad4a2f
Async package management (#3806)
* Add package_entries table

* Change PublicPackageUpload event to cover list of packages.

Add PublicPackageUploadRejected.

* Produce new package update events in KeyValueConsumption

* Update signature of uploadPackages

* Cleanup InMemoryKVParticipantState. Add submissionId to uploadPackages.

* Fix up InMemoryKVParticipantStateIT

* Initial ledger dao changes for package entries

Drop the participant_id as we never expect to see
entries of other participants. This should be done
for party_entries as well.

* Drop UploadPackagesResult

* Implement getPackageEntries and refactor callers

* Add maxRecordTime to uploadPackages

* First cut at updating ApiPackageManagementService

* Update tests, wire through the packageEntries

* Don't extend IndexPackagesService in InMemoryPackageStore

It does not implement the full interface and it isn't used
directly as one anyway.

* Drop maximum_record_time from package_management_service

Adding maximum record times touches the whole stack. Leaving
this change to another PR.

* Wire through the removal of maximum_record_time.

And remove dead code from InMemoryKVParticipantState

* Remove checking for duplicate package uploads

This aligns with the behaviour of WriteService.

* Reformat

* Fix PackageManagementService after adding of submission_id to the service
2019-12-13 09:56:47 +01:00
Martin Huschenbett
3722f32429
daml2ts: Add more tests (#3832) 2019-12-12 18:42:27 +01:00
Gary Verhaegen
2b3693bf4d
restore 0.13.38 logging defaults for daml jars (#3819)
CHANGELOG_BEGIN
- [Sandbox] Restore 0.13.38 logging behaviour.
- [Navigator] Restore 0.13.38 logging behaviour.
- [Extractor] Restore 0.13.38 logging behaviour.
- [Internals] As of 0.13.39, we merged a number of internal JAR files in
  the SDK tarball to reduce its size. These jars used to be standalone
  JARs you could invoke as e.g. ``java -jar sandbox.jar <args>``. As a
  result of merging the jars, they lost their individual ``logback.xml``
  configuration file. Although running the jars directly was (and is
  still) not supported, note that you can now achieve the same behaviour
  with e.g. ``java -Dlogback.configurationFile=sandbox-logback.xml -jar
  daml-sdk.jar sandbox <args>``.
CHANGELOG_END
2019-12-12 14:02:23 +01:00
Leonid Shlyapnikov
0b172da49a Add ExceptionOps to extract exception details safely (#3822)
* Add ExceptionOps to extract exception details safely

`Throwable.getMessage` can return `null` which caused unexpected NPE
in JSON API error handling

* Fix formatting

* Remove show instance

* Addressing code review comments,

thanks Stefano!
2019-12-11 18:38:44 +00:00
associahedron
08ee42fb30 Implement missing genmap fns (#3807) 2019-12-11 11:16:25 +00:00
Remy
94aea562d6 scala codegen: add GenMap support (#3522)
* scala codegen: add GenMap support

* scala-codegen: use InsertOrdMap as underlying of Generic Map binding

* Address Stephen's comments

* make TextMap a strict subtype of immutable.Map to avoid overlap with GenMap

Otherwise, attempted GenMap encodings like
`Value.encode(InsertOrdMap("foo" -> "bar"))` (and any contract
containing such a structure) are either ambiguous or, worse, yield the
wrong result.

* ensure better return types for InsertOrdMap and similar wrappers' operations

* if is an expression

* adapt various primitive encodings to newtype TextMap

* easy cleanups of the TextMapApi

* proper alias for deprecated Map

* update deprecation releases

* Revert "proper alias for deprecated Map"

This reverts commit e85aa85b960c4bf5c4f9624896183ec6e2182bba.

* remove useless invisible deprecated notice

* add generic map tests for scala codegen

* please restart CI
2019-12-11 09:22:38 +00:00
Leonid Shlyapnikov
dcc7dc913f
Add choice result to the exercise response (#3757)
* Adding choice result to the exercise response, WIP

* Adding choice result to the exercise response, WIP

* Refactoring towards #3390,

ExerciseCommand argument does not always have to be a Record, changing
typearg: JsObject -> JsValue

* Cleanup

* exercise-with-result endpoint

* todo

* Switching /commands/exercise to use SubmitAndWaitForTransactionTree,

populating archived and created from TransactionTree

* removing debug println

* Fixing tests

* Removing `/command/exercise-with-result` endpoint

this one returns only exercise result, `/command/exercise` now returns
exercise result and events

* Updating docs

* Updating docs

CHANGELOG_BEGIN

- [JSON API - Experimental] Expose exercise result. Changed the output
of the ``/command/exercise``. Note ``exerciseResult`` and ``contracts``
in ``{"status":200,"result":{"exerciseResult": ...,"contracts":[...]}``.
See #3314

CHANGELOG_END
2019-12-10 10:09:24 -05:00
Martin Huschenbett
0b63fa432b
daml2ts: Add instructions on how to develop (#3799) 2019-12-10 12:52:03 +01:00
Moritz Kiefer
e769264ddf Move all datatypes out of daml-prim (#3791)
* Move all datatypes out of daml-prim

This moves the remaining two modules DA.Types and GHC.Tuple to
separate LF packages with stable identifiers.

The only data types remaining are the ones for typeclasses which will
disappear once we move this to type synonyms.

CHANGELOG_BEGIN

- [DAML Compiler] The modules DA.Types and GHC.Tuple from daml-prim
have been moved to separate packages.

CHANGELOG_END

* Fix codegen tests

* Fix DarReader test

* Fix kvutils tests

* Fix jdbcdao tests

* Fix hs ledger bindings tests
2019-12-10 09:19:16 +01:00
Stefano Baghino
6e17cdba90
Fix typo in JavaDoc (#3793) 2019-12-09 17:58:33 +01:00
Robert Autenrieth
bf2098f038
Check ledger and participant ID in claims (#3781)
* Add ledger and participant ID to claims

CHANGELOG_BEGIN
- [Ledger] AuthService implementations can now restrict the validity of access tokens to a single ledger or participant.
- [Sandbox] The sandbox JWT authentication now respects the ledgerId and participantId fields of the token payload.

CHANGELOG_END

* Add tests for ledger and participant in claims

* Address review comment

* Address review comment

* Fix tests

* Fix tests
2019-12-09 17:55:17 +01:00
Stefano Baghino
18824016c1 Ensure the access token is initialized when constructing a client (#3788)
* Ensure the access token is initialized when constructing a client

CHANGELOG_BEGIN
- [Java Client] Ensure the access token is initialized when using a
deprecated constructor.
CHANGELOG_END

* Improve phrasing and grammar
2019-12-09 14:14:45 +00:00
Martin Huschenbett
0211e1337d Move the bazel aliases for yarn and java to the root BUILD file (#3786)
Replicating the yarn alias in multiple places doesn't make sense.
2019-12-09 13:22:21 +00:00
Martin Huschenbett
19d2a22b0b
daml2ts: Add E2E tests (#3776)
* daml2ts: Add E2E tests

* Attempt to fix failing test

* Don't try to delete the temp directory

* Cleanup block can't be empty

* Leave TMP_DIR before removing it
2019-12-07 18:34:40 +01:00
Gerolf Seitz
9d926d81b0 RxJava Bindings: Allow bot to run on a scheduler (#3404)
* RxJava Bindings: Allow bot to run on a scheduler

It seems that having many bots results in a some sort of deadlock
or blocking of data flow within the flowable network.

Adding some async boundaries to allow for concurrent processing
seems to help.

Fixes #2356

CHANGELOG_BEGIN
- [RxJava Bindings] Added a method to the ``Bot`` class allowing users to specify a ``Scheduler`` to use for running the bot. See `issue #2356 <https://github.com/digital-asset/daml/issues/2356>`__.
CHANGELOG_END

* Go easy, test!
2019-12-06 16:30:25 +00:00
Gerolf Seitz
658365e5eb Java codegen fixes (#3762)
* Fix compiler warnings in generated enums

* Fix warnings in generated equals method for parameterized types.

* Remove warning in equals for records without fields.

CHANGELOG_BEGIN
- [Java Bindings] Removed warnings in code emitted by the Java Codegen.
CHANGELOG_END

* fix compilation error in tests
2019-12-06 15:10:38 +00:00
Stefano Baghino
da9306414b Add authentication support to DamlLedgerClient (#3743)
Add documentation

CHANGELOG_BEGIN
- [Java Bindings] Added authentication support. See `issue #3626 <https://github.com/digital-asset/daml/issues/3626>`__.
CHANGELOG_END
2019-12-05 10:57:51 +00:00
Stefano Baghino
94aafd8121 Add authentication support to Java transaction client (#3733)
* Add authentication support to Java transaction client

* Address https://github.com/digital-asset/daml/pull/3733#discussion_r354182366
2019-12-05 10:17:30 +00:00
nickchapman-da
1684b2290a daml assistant: expect auth token in Bearer format (#3736)
* daml assistant expected auth token in Bearer format

* Daml assistant does no validation of the auth token before passing in on to the ledger.

* clarify code with newtype Token
2019-12-05 09:19:02 +00:00
Robin Krom
ed4397b2eb language: add registerTemplate for daml2ts (#3737) 2019-12-05 09:07:16 +01:00
Moritz Kiefer
ba30e86911
Split wired-in modules into separate LF packages (#3696)
This is a first step towards making sure that the package ids for
types defined in daml-prim and daml-stdlib don’t change. This PR
mostly adds all the necessary infrastructure for that and moves
GHC.Types and GHC.Prim to make sure it works.

Until data-dependencies are really solid and we have verified that we
no longer have performance issues with an increasing number of Haskell
packages, we still include the source files in daml-prim and then just
rewrite the references.

We will also need to add tests that these packages really have stable
ids but I’ll leave that for separate PRs since this doesn’t make that
much sense anyway until all of the types have moved to stable
packages.

CHANGELOG_BEGIN

- [DAML Compiler] The modules GHC.Prim and GHC.Types from daml-prim
have been moved to separate packages.

CHANGELOG_END
2019-12-04 16:42:48 +01:00
Martin Huschenbett
5c02b1a1c3 Make the daml2ts tests fail on generated unused imports/definitions (#3714)
* Make the daml2ts tests fail on generated unused imports/definitions

* Shut up buildifier
2019-12-04 14:08:50 +00:00
Robert Autenrieth
a827040e4c
Add authentication docs (#3661)
* Add authentication docs

* Use anonymous references

* Update obsolete info on authentication

* Improve authentication intro
2019-12-04 14:51:19 +01:00
Stefano Baghino
50d689d011 Optimize imports in //language-support/java/bindings-rxjava (#3728) 2019-12-04 11:08:13 +00:00
Stefano Baghino
ba0c5e8b30
Add support for authentication to Java command submission client (#3716)
* Add support for authentication to Java command submission client

* Fix compilation error
2019-12-04 11:31:50 +01:00
Stefano Baghino
36da75e1d6
Add authentication support to Java command completion client (#3713)
* Add authentication support to Java command completion client

* Address https://github.com/digital-asset/daml/pull/3713#discussion_r353629606
2019-12-04 11:31:21 +01:00
Stefano Baghino
8d5b4af0f2
Add support for authentication to Java time client (#3721) 2019-12-04 11:00:30 +01:00
Stefano Baghino
8eb5956f31
Add support for authentication to Java package client (#3720) 2019-12-04 10:42:48 +01:00
nickchapman-da
d15b0c7538
Add support for type-synonyms in DAML-LF .proto and Haskell AST (#3703)
* Add support for type-synonyms in DAML-LF .proto and Haskell AST

* address review comments
2019-12-03 14:51:02 +00:00
Martin Huschenbett
7d1068b69d
daml2ts: Avoid 'unused definition' warning for modules without templates (#3698)
We only use the `templateId` function in a module only when the module
contains at least one template definition. Thus, we don't generate it if
there are no modules. That's the only functional change. The other changes
are due to the fact that we want better readability of the code.
2019-12-02 18:21:22 +01:00
Martin Huschenbett
6e6614ae56 daml2ts: Use monoTraverse to collect modules refs in types (#3690)
This was suggested by @corcreature on a previous PR.
2019-12-02 14:56:22 +00:00
Martin Huschenbett
712231c963 daml2ts: Don't produce unused imports (#3689)
Instead of importing _all_ other modules referenced from a module, only
import those that are actually referenced from the generated code. First,
this produces less noise within each generated file. Second and probably
more important, this allows for not generating files without any actual
definition at all.

https://github.com/digital-asset/davl/pull/81 demonstrates the effect of
this change on DAVL.
2019-12-01 11:38:56 +00:00
associahedron
2713d6978d
Reduce SDK tarball size by 70% by deduplicating Scala dependencies. (#3678)
* Start moving all the jars into a single jar.

* Fold navigator into daml-sdk jar

* include sandbox

* Remove unnecessary compileDeps.

CHANGELOG_BEGIN

- [DAML SDK] Reduced the size of the DAML SDK by about
60% uncompressed, 70% compressed, by deduplicating Scala
dependencies.

CHANGELOG_END

* update copyright header

* buildifier fix
2019-11-29 13:26:47 +00:00
Stefano Baghino
0123c659f2 Add authentication support to CommandClient (#3666) 2019-11-29 07:20:39 +00:00
Stefano Baghino
9e9eb68e38 Make ActiveContractsClient work against auth ledgers (#3653)
* Make ActiveContractsClient work against auth ledgers

* Address review comments

- Address https://github.com/digital-asset/daml/pull/3653#discussion_r351667485
- Address https://github.com/digital-asset/daml/pull/3653#discussion_r351667588
2019-11-28 12:36:50 +00:00
nickchapman-da
d3d6891021
Rename daml lf tuples (#3658)
* Rename DAML-LF tuples as structs (structural records)
2019-11-28 07:58:30 +00:00
Brian Healey
02186ef068 Ledger configuration indexing changes (rebased to master) (#3553)
* Add participant-state configuration protobuf

- Move the "DamlConfiguration" from kvutils into participant-state/protobuf/ledger_configuration.proto.
- Add version number and spec (ala transaction.proto)

This is a preparation for indexing the configuration and having one canonical serialization for it.

* Initial thoughts on indexing the configuration

* Implement indexing of ledger configuration changes

* Add record time to all Updates. Wire through participant id.

and rename V7__Add_configuration to V8.

* Add ledger_configuration_java_proto to release artifacts

* Fix up release of ledger_configuration_java_proto

* Suggestions from review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Apply suggestions from code review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* address rebase issues

* Resolve compilation errors after rebase/merge

* happy formatting for scala and bazel and friends

* Drop "openWorld" setting from configuration

And refactor the tests to allocate parties explicitly.

* Fix up migration and tests

* Drop authorizedParticipantIds from configuration

Implement configuration authorization in kvutils using the previous
the participant id of the previous configuration.

* Post-rebase fixes

* Add missing migrations

* Apply suggestions from code review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Add missing mavenUpload to ledger-api-server

* Remove stateUpdateRecordTime

* Address code review

- Address PR review
- Merge TimeModelImpl and the traits. Remove TimeModel from ledger-api-common.
- Throw `Err` from KeyValueConsumption on parse errors instead of assert/sys.error

* Reformat

* Add missing protobuf file

* Fix compilation after TimeModel changes. Add version logs to participant-state{,-kvutils}.

* Fix TestUtil.scala build

* Apply suggestions from code review

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Address review

- synchronized access to ledgerConfiguration in InMemoryLedger
- store rejection if configuration generation is wrong

* Update ledger/participant-state/protobuf/ledger_configuration.rst

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2019-11-27 17:41:23 +01:00
Martin Huschenbett
677b30687f Improve wording of daml2ts readme (#3652) 2019-11-27 16:16:10 +00:00
Remy
5b155409a0 DAML-LF iface reader: rename Map to TextMap (#3610)
CHANGELOG_BEGIN

 [DAM-LF Interface Reader]: **Rename** ``PrimTypeMap`` to ``PrimTypeTextMap`` and ``PrimType.Map`` to ``PrimType.TextMap``

CHANGELOG_END
2019-11-27 14:01:35 +00:00
Stefano Baghino
4d922e763b Add authentication to Java identity client (#3630)
* Add authentication to Java identity client

Contributes to #3626

No changelog added right now, it will be added with the PR that
effectively closes the ticket.

Moves `LedgerCallCredentials` to a shared package.

Establishes the test framework for other Java clients.

* Address https://github.com/digital-asset/daml/pull/3630#discussion_r350663731

* Address https://github.com/digital-asset/daml/pull/3630#discussion_r350663731

* Rebase and fix compilation errors

* Fix type of jar in artifacts.yaml

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Fix more errors emerged after rebase

* Add dependency for DAML assistant ITs

* Add missing dependency

* Fix wrong dependency

* fix release
2019-11-26 18:51:09 +00:00
Martin Huschenbett
09a681d4f3 Add a readme for daml2ts (#3638) 2019-11-26 17:49:40 +00:00
Stefano Baghino
25f65f746b
Move DamlLedgerClient to builder-based constructors (#3620)
With the intent of adding more functionality to the Java bindings, in
particular authentication, this PR deprecates existing constructors in
favor of a more flexible builder based approach.

CHANGELOG_BEGIN

- [Java Bindings] Deprecated existing constructors for
``DamlLedgerClient``, please use the static ``newBuilder`` method to
instantiate a builder and use it to create the client, starting from
either a ``NettyChannelBuilder`` or a plain host/port pair.

CHANGELOG_END
2019-11-25 23:19:14 +01:00
nickchapman-da
0f0a12db22 Sdk access token file (#3607)
* support --access-token-file in SDK

* rename: HostAndPort -> LedgerArgs; HostAndPortFlags -> LedgerFlags

* integration test for --access-token-file

* doc & more help

* address comments: use FilePath

* adapt to renamed arg: --auth-jwt-hs256-unsafe

* avoid use of single quotes on command line
2019-11-25 17:38:41 +00:00
Stefano Baghino
552bf6497d Obscure shared-secret-based authenticated sandbox (#3609)
The shared-secret-based authentication is there exclusively for testing,
this PR makes sure that this is correctly reported through the CLI and
hides this until further notice.

Makes sure that the flag clearly says that this option is not meant for
production use cases.

A warning is already printed when this feature is used, both at startup
and every time this verifier is used.

CHANGELOG_BEGIN

- [Sandbox] The ``--auth-jwt-hs256`` is renamed to
``--auth-jwt-hs256-unsafe``: you are advised to _not_ use this JWT token
signing way in a production environment.

CHANGELOG_END
2019-11-25 14:27:21 +00:00
Remy
d152c7cbfd daml-lf: rename Map to TextMap in archive proto (#3589)
* daml-lf: rename Map to TextMap in archive proto
+ in Scala/haskell AST

* a bit more renamming

* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/Serializability.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* fix test

* Apply suggestions from code review

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-11-25 12:14:57 +00:00
Andreas Herrmann
10031a614c Remove all instances of use_default_shell_env = True (#3597)
* use_default_shell_env = False in proto_gen

* use_default_shell_env = False in scala_source_jar

* use_default_shell_env = False in scaladoc_jar

* use_default_shell_env = False in dar_to_scala

* use_default_shell_env = False in _real_pkg_tar

* use_default_shell_env = False in client_server_build

* use_default_shell_env = False in npm_package
2019-11-25 09:15:00 +00:00
Samir Talwar
1bd2ec5b1a grpc-utils: Simpler extractors. (#3594)
* grpc-utils: Simpler GrpcStatus extractors when you know the code.

And don't care about the description.

* grpc-utils: Simpler GrpcException extractors when you know the code.

And don't care about the description.

* Apply suggestions from code review

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

* Add `new` to `SpecificGrpc{Exception,Status}` constructor calls.

Also, don't blindly apply GitHub suggestions.
2019-11-22 21:09:17 +00:00
Remy
b506e27bde Java-codegen: add support for Generic Maps. (#3549)
* java-bindings: use LinkedHashMap asunderlying Map for DamlGenMap

* Address Samir's comments

* java-codegen: make DamlList, DamlMap and DamlGenMap immutable

* Address Samir's comments

* Adress Gerolf's comments

* more cleanup

* fix value generator

* Address Gerolf's comments:

CHANGELOG_BEGIN

[Java Bindings]
  * Rename ``DamlMap`` to ``DamlTextMap``
  * ``DamlCollectors`` class provides Collectors to build more easily ``DamlList`` and ``DamlTextMap``
  * Change the recommended method to convert ``DamlValue`` containers from/to Java Bindings containers.
    See `docs/source/app-dev/bindings-java/codegen.rst` for more details the new methodology.

CHANGELOG_END

* fix tests
2019-11-22 08:07:53 +00:00
nickchapman-da
9ab2923814
support authenticating ledgers in haskell ledger bindings (#3561)
* support authenticating ledgers in haskell ledger bindings

* address comments

CHANGELOG

- [Haskell Ledger Bindings] - support for passing `JWT` tokens to authenticating ledgers.
2019-11-21 15:11:33 +00:00
Stefano Baghino
c51ecd3c58
Extractor with authentication (#3514)
* Make Extractor work against Ledger API servers protected by authentication

* Update changelog

* Address https://github.com/digital-asset/daml/pull/3514#pullrequestreview-318811500

- https://github.com/digital-asset/daml/pull/3514#discussion_r347753205
- https://github.com/digital-asset/daml/pull/3514#discussion_r347753629
- https://github.com/digital-asset/daml/pull/3514#discussion_r347754462

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347755484

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347752424

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347756328

* Fix docs

* Fix artifacts.yaml
2019-11-19 17:12:25 +01:00
Martin Huschenbett
c33517cf9f MVP for a daml2ts codegen (#3441)
* MVP for a daml2ts codegen

This PR adds an MVP for a codegen for TypeScript.

Given a DAR, daml2ts replicates the structure of the serializable type
definitions in it as TypeScript type definitions following our JSON
representation of DAML-LF types. It also adds decoders for all these types,
which can be used to check where an arbitray JSON value has the given type.
Finally, daml2ts also produces one JavaScript object for each template, which
reflects the type information of that template.

All produces objects implement some interfaces defined in a TypeScript
library currently called `@digitalasset/daml-json-types`. This libary is not
yet uploaded to NPM but rather included in the `tests/ts/daml-json-types`
directory. This libary also contains the JSON decoders for all of DAML-LF's
builtin types.

There are quite a few limitations right now. Most notably, variant and enum
types are not properly typed right now but rather gradually "typed" as
`unknown`. We also don't support nested `Optional`s, the `Numeric` type or
sum-of-product types in DAML. These issues are tracked in #3518.

There is currently one test. It takes a very simple DAML model, generates
the TypeScript for it and checks that it compiles and contains no linter
warnings/errors. Proper integration tests against the JSON API will follow.

* Address @cocreature's comments

* Make test work on Windows
2019-11-19 15:51:17 +00:00
Remy
027d63a787 java representation for value GenMap (#3515) 2019-11-19 08:53:15 +00:00
Remy
fedc49dd12 leger-api: add GenMap support (#3506)
* leger-api: add GenMap support

* cosmetic

* Address Gerolf's  comment

* add a point in the release notes

* Address Fran's comments
2019-11-18 18:13:25 +00:00
Remy
43eb69cbbd DAML-LF: add GenMap tests for LF encoder (#3491)
* daml-lf: fix decoder

* daml-lf: extend testing dar for encoder

* add EOF to .lf files

* change 1.dev to 1.7 for java codegen encoding test

* formatting

* fixes
2019-11-18 10:07:13 +00:00
Remy
4bd98b6cbc DAML-LF: add GenMap in iface reader (#3487)
* daml-lf: add GenMap in iface reader

* remove useless code

* Update language-support/scala/codegen/src/main/scala/com/digitalasset/codegen/lf/LFUtil.scala

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

* please restart CI
2019-11-17 08:12:10 +00:00
Gerolf Seitz
172ce90597
Upload codegen fat-jars to maven central (#3476) 2019-11-14 18:40:54 +01:00
Fabio Tudone
011cb0cdcb Fix build command typo in quickstart-scala's README.md (#3459) 2019-11-13 17:18:03 -05:00
Stefano Baghino
f55a044312 Remove font coloring (#3448) 2019-11-13 12:38:22 +00:00
Andreas Herrmann
c7038f128e Fix Bazel warnings (#3414)
* No longer depend on "@bazel_tools//tools/jdk:jar"

To avoid the following warnings
```
WARNING: /home/aj/.cache/bazel/_bazel_aj/c1e06e2358666d118d0ae50e2d32c25d/external/bazel_tools/tools/jdk/BUILD:124:1: in alias rule @bazel_tools//tools/jdk🫙 target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594)
```

* Targets and files should not share names

To avoid the warning
```
WARNING: /home/aj/tweag.io/da/da-master/compiler/damlc/tests/BUILD.bazel:316:1: target 'simple-dalf.dalf' is both a rule and a file; please choose another name for the rule
```
2019-11-11 15:41:34 +00:00
Stefano Baghino
377b43f2d6
Pass token in individual calls, remove default location for client token (#3403)
* Pass token in individual calls, remove default location for client token

* Fix things for AuthorizationIT

* Fix ledger-service usages of LedgerClient

* Fix remaining compilation errors
2019-11-11 16:22:25 +01:00
Martin Huschenbett
6fe3df57cd Rewrite PRSelf when loading a dependency package (#3406)
When buidling simple project that has our favourite large project as a
dependency, this decreased
- total allocations from 63GB to 57GB
- run time from 34.0s to 31.5s
2019-11-11 08:52:07 +00:00
Remy
d39d7974fc daml-lf: freeze version 1.7 (#3340)
* daml-lf: freeze daml-lf 1.7

* speedy: remove useless double checks
2019-11-07 09:51:18 +00:00
Stefano Baghino
c8aaffd62c Add GrpcException extractor (#3344)
* Add GrpcException extractor

* Use GrpcStatus in integration test

* Fix compilation error

* Fix compilation error

* Address https://github.com/digital-asset/daml/pull/3344#discussion_r342981204

* Restricting extractor types
2019-11-06 14:44:06 +00:00
Remy
2885766826 daml-lf-encoder: validate dar generated by the encoder (#3339) 2019-11-05 15:15:08 +00:00
Stefano Baghino
42051ae037
Add and validate expiration on claims (#3286)
* Add and validate expiration on claims

* Address review comments

* Test existing services for token expiration

* Test expiration mid-stream

* Address https://github.com/digital-asset/daml/pull/3286#pullrequestreview-309710454
2019-10-31 13:14:44 -04:00
Andreas Herrmann
2bd1db490a
Replace bazel-deps by rules_jvm_external (#3253)
* Update bazel-common to fix javadoc issues

Specifically, to fix the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel:7:1: in javadoc_library rule //ledger-api/rs-grpc-bridge:rs-grpc-bridge_javadoc:
Traceback (most recent call last):
        File "/home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel", line 7
                javadoc_library(name = 'rs-grpc-bridge_javadoc')
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/com_github_google_bazel_common/tools/javadoc/javadoc.bzl", line 27, in _javadoc_library
                dep.java.transitive_deps
object of type 'JavaSkylarkApiProvider' has no field 'transitive_deps'
```

* Define Maven deps using rules_jvm_external

* Pin artifacts

* Remove bazel-deps generated targets

* Remove bazel-deps

* Switch to rules_jvm_external targets

* update bazel documentation

* pom_file: There are no more bazel-deps targets

* BAZEL-JVM.md `maven_install` typo
2019-10-28 13:53:14 +01:00
Remy
25c3797d89
DAML-LF Numeric: compute properly the value version for + test update (#3122)
* extractor: update test with numerics
* java-codegen: test numeric
* fix some numeric tests
* fix assignVersion for values
2019-10-17 13:17:21 +02:00
Remy
e45b585307 daml-lf: repackage daml-lf archive proto (daml_lf -> daml_lf_dev) (#3169) 2019-10-15 09:36:11 +00:00
Remy
d64df4b5f7 daml-lf: clean achive bazel build (#3175)
* clean the mess in daml-lf achive bazel build

* add release note

* Address Moritz's comments

* more release notes
2019-10-15 08:36:46 +00:00
Remy
fc1a000090 daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader (#3168)
* daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader

* fix release
2019-10-14 14:53:50 +00:00
Gerolf Seitz
e310cbe143 Fix automatic retry mechanism in scala bindings. (#3061)
* Fix automatic retry mechanism in scala bindings.

This fix only affects the usage of
com.digitalasset.ledger.client.binding.LedgerClientBinding#retryingConfirmedCommands

The retry mechanism didn't distinguish between submission failures and
final completion failures. Retrying completion failures with the same
commandId doesn't make sense, as the deduplication mechanism will kick
in.
The new mechanism now only retries commands with an updated LET and MRT
in case the server responds with a RESOURCE_EXHAUSTED status code (i.e.
backpressure).

Fixes #3057.

* Add UNAVAILABLE as retryable error code

* fix unreleased.rst
2019-10-11 08:17:33 +00:00
Leonid Shlyapnikov
06a4d56025
Scala codegen StackOverflowError fix (#3159)
* introducing map and bimap

not relying on default implementations provided by Traverse and Bitraverse

* lazy collect

* updating release doc

* cleanup

* daml-lf/interface: add foldMap overrides

* implementing `bifoldMap` explicitly for `DefDataType` and `DataType`

* replacing `toStream` with `to[ImmArraySeq]`, updating release notes
2019-10-10 17:15:08 -04:00
Richard Kapolnai
4c280a5f1b Add helper to Java Bindings to prepare transformer for Bot.wire. (#3098)
* Add helper to Java Bindings to prepare transformator for Bot.wire. Fixes #3097

* Java bindings: rename to contractTransformer

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

* Rename to transformer

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

* Keep error info for invalid class

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

* Add generic info to declaration

* Add test for contract tranformer

* Add license header

* Improve contractTransformer by storing reflection results

* Rename folder scala to java

* Add maven coordinates tag

* rename bazel goal back to bindings-java-tests

* integrate contract transformation test with codegen

* manual merge on unreleased.rst

* add daml model for integration testing
2019-10-07 17:38:26 +02:00
Oliver Seeliger
c9658c7813
Multi participant node named logging (#2647) (#3080)
* Upgrade scala-logging and slf4j

* Named logging for multi-participant tests (#2647)
2019-10-03 18:20:57 +02:00
Gary Verhaegen
5e0f664473
fix haskell export script (#3076) 2019-10-03 08:36:14 +02:00
Remy
d540f7aab0 Daml-LF: change Numeric max scale from 38 to 37 (#2969)
* daml-lf: numeric maxScale change from 38 to 37

* daml-lf: update spec

* udpate protobuf comments
2019-09-23 12:39:28 +00:00
Leonid Shlyapnikov
c982478c6e Fixing quickstart-scala example and doc (#2901)
* Fixing quickstart-scala example

* Updating docs

* Adding Scala codegen config

* Minor cleanup

* Apply suggestions from code review

Applying doc changes, thanks @bame-da!

Co-Authored-By: Bernhard Elsner <40762178+bame-da@users.noreply.github.com>
2019-09-16 12:44:04 +00:00
Leonid Shlyapnikov
4a9fb1ccff
DAML assistant codegen command (#2800)
* DAML assistant codegen command, codegen config reader and docs
2019-09-12 14:23:49 -04:00
Stefano Baghino
47d8432670
Panic on interface reader error (#2890) 2019-09-12 15:15:21 +02:00
nickchapman-da
69b520c879
Hlb update and document external build steps (#2769)
* stack setup for HLB and Nim

* build_packages.sh and daml-ledger.cabal

* update README

* export-package for daml-ledger

* export-package, run here

* find tmp daml-ledger

* update README for review comments

* ref daml instructions

* further improve the process and documentation in response to comments

* have -with-rtsopts match the bazel build

* fixes for Gary
2019-09-09 14:37:03 +01:00
Andreas Herrmann
ed39800a9f Rename hazel_deps to hackage_deps (#2789)
* hazel_deps --> hackage_deps

Mechanical change:

```
sed -i 's/hazel_deps/hackage_deps/g' $(ag -l hazel_deps)
```

* Hazel dependencies --> Hackage dependencies
2019-09-06 09:01:09 +00:00
Moritz Kiefer
1fa15ffb1d
Fix typo in filterEverythingForParty in HS ledger bindings (#2771) 2019-09-05 16:08:34 +02:00
Remy
3ee9b83fb1 daml-lf: adapt interface reader to Numeric (#2666) 2019-09-02 10:02:56 +02:00
Remy
20649cf78e ledger-api: rename decimal field to numeric in value Proto (#2688)
* add Numeric.java

* ledger-api: rename `decimal` field to `numeric` in value protobuf

* Address Gerolf's comment

* ledger-api: add missing renammings

* ledger-api: relax syntax of numbers that can be sent as numerics

* extractor:  fix

* leger-api: change format of number though ledger api

* daml-lf: fix numeric regexp

* ledger: fix tests
2019-08-29 22:51:33 +00:00
Moritz Kiefer
3cda28935b Refactor DAR manifest reader (#2699)
* Refactor DAR manifest reader

This PR replaces the ad hoc string munging by a proper parser.

* Fix tests

* Fix more tests

* Factor out isHeaderChar
2019-08-29 10:26:53 +00:00
Moritz Kiefer
96bc868261 Mark Haskell ledger bindings tests flaky on all platforms (#2692) 2019-08-28 15:37:12 +00:00
Remy
6a96060af1 daml-lf: udpate LF protobuf for numerics (#2649)
* daml-lf: update proto for Numerics

* daml-lf: test decoder

* daml-lf: update spec

* daml-lf: polish proto doc

* damlc: address reviewers' comments

* daml-lf: minor fix
2019-08-26 11:55:48 +00:00
nickchapman-da
ea02814b34
hlb, remove dependency on DAML-LF libs (#2650)
* hlb, remove dependency on DAML-LF libs

* Update language-support/hs/bindings/src/DA/Ledger/Services/PackageService.hs

newtype instead of data

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2019-08-23 18:00:58 +01:00
Stefano Baghino
d79e03d42c
Ensure uniqueness of decoding and encoding methods (#2651)
Fixes #2367
2019-08-23 17:31:37 +02:00
Remy
9a4dff63b2
daml-lf: introduce Numeric in internal AST (#2608)
* daml-lf: introduce numeric in daml-lf AST
* daml-lf: add test for command preprocessor
* interface-reader: fix for Numerics
* Address Gerolf's review
2019-08-23 15:27:14 +02:00
Moritz Kiefer
67c2e2a9ef
Switch to upstream gRPC-haskell (#2642)
* Switch to upstream gRPC-haskell
2019-08-23 15:10:15 +02:00
Gerolf Seitz
32a61b275f Java Codegen now supports parametrized ContractIds. (#2621)
Fixes #2258
2019-08-22 12:01:22 +00:00
Moritz Kiefer
49b2ec1558
Refactor gRPC request cancellation support in gRPC-haskell (#2626)
* Refactor gRPC request cancellation support in gRPC-haskell

Previously, we had a separate constructor that took an additional
callback that had access to the client call so that we could use that
for cancellation. This PR removes the separate constructor and instead
changes the callback accepted by ClientReaderRequest (and for
consistency also the one accepted by ClientBiDiRequest) to pass the
client call.

This seems like a simpler solution so I’m more hopeful that we will be
able to upstream this change (this is the only API breaking change we
made afaik). There are two caveats here:

1. This will break existing consumers that use ClientReaderRequest. At
this stage in gRPC-haskell this is very reasonable and upstream
doesn’t seem to try very hard to avoid those.

2. The callback is called slightly later than the custom callback we
added before so you have to wait a bit longer until you can cancel
things. At least on our test suite that doesn’t seem to make a
difference.
2019-08-22 12:53:30 +02:00
Bernhard Elsner
d9298c8744 Various improvements to make hs-bindings usable outside repo (#2583) 2019-08-19 16:44:45 +00:00
Bártfai Tamás
a76f82d088 Fix log level for errors in Bot.java (#2581) 2019-08-17 19:42:54 +02:00
Moritz Kiefer
6a0ebc9f5e Go back to building grpc-haskell-core using c2hs (#2574)
* Go back to building grpc-haskell-core using c2hs

This should hopefully avoid issues like the CSize vs CULong issue we
had a while back and might fix some of the issues we have been seeing
on CI.

I’m marking the Haskell ledger bindings as non-flaky for now so we can
see if the issues reappear.

* Fix path

* Fix c2hs runfiles

* s/basedir/dirname/

* Fix varname

* Remove fixme \o/

* Mark hs ledger bindings flaky again
2019-08-16 14:17:11 +00:00
Moritz Kiefer
f3f2d3311b
Remove dependency on isolated sandboxes from HS ledger bindings tests (#2554)
The only tests that relied on this, were the ones for package
management and party management but we can fairly easily remove that
dependency by only checking the diff in packages and thereby folding
the listKnown* and uploadParty/uploadDar file into a combined test.

I’ve also bumped one timeout that I’ve seen fail on CI and managed to
get to fail locally under load.

I am unable to get the tests to fail now locally so I’ve marked them
as non-flaky on everything but Windows (we’ve seen weird segfaults
there).
2019-08-15 11:50:51 +02:00
Moritz Kiefer
ef635ea301
Mark tests that use Haskell gRPC bindings as flaky (#2521)
I’m hoping to investigate this soon but for now this should hopefully
result in less time spend restarting tests.
2019-08-13 20:38:51 +02:00
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
Moritz Kiefer
8f587dc456
Use per-test parties in HS ledger bindings tests (#2481)
* Use per-test parties in HS ledger bindings tests

This should hopefully solve the flakiness issues caused by the reset
service. For now, there is a very small number of tests that we run on
an isolated sandbox namely the tests for party management and package
management.

* shut up hlint

* Disable reset tests
2019-08-12 12:56:18 +02:00
nickchapman-da
5ebc5e4d19
Hlb apps package discovery (#2455)
* suggested tiny code simplifications

* fix package discovery for Nim/Chat ledger apps
2019-08-08 16:50:17 +01:00
Remy
5dd7f1afcf java-codegen: fix broken language-support/java/codegen/src/it/dar/integration-tests-model-1.0.dar (#2443) 2019-08-07 13:56:36 +00:00
nickchapman-da
8f9a781750
hlb, use Int64 / Fixed E10 as appropriate (#2440) 2019-08-07 13:27:58 +01:00
nickchapman-da
2b1204ceac
hlb, fix bug where sandbox is not being run on a dynamically allocated port (#2428) 2019-08-07 11:16:53 +01:00
nickchapman-da
f5688bdc25
hlb, cleanup daml used for tests (#2370) 2019-08-01 22:24:54 +01:00
nickchapman-da
1c12354f38
hlb, reformat all the types (#2369) 2019-08-01 22:24:28 +01:00
nickchapman-da
662361ac47
hlb, convert all the values (#2368) 2019-08-01 15:27:14 +01:00
Gary Verhaegen
568403210b
hs-bindings readme: fix link (#2349) 2019-07-31 14:22:01 +01:00
Gary Verhaegen
0b8933627c record Nick's comments on hs ledger bindings (#2340) 2019-07-30 16:25:19 +00:00
nickchapman-da
8b5cd613f4
hlb, no wildcard record construction (#2332)
* remove: type Status = LL.Status

* no {..} in record construction
2019-07-30 13:47:09 +01:00
Moritz Kiefer
50a04397e4
Supporting producing sdist tarballs for the HS ledger bindings (#2336)
* Supporting producing sdist tarballs for the HS ledger bindings

The README.md has an explanation for how you can use this.

This should hopefully allow others to experiment with the bindings.
2019-07-30 14:34:16 +02:00
Stefano Baghino
340a4eb6a4
Read stakeholders through the active contract service (#2316)
* Read stakeholders through the active contract service

Fixes #2070

Also standardizes the use of American English spelling for `serialize`
and `deserialize`. Standardize. Serialize. Americanize.

* Remove Haskell bindings test workaround

* Address https://github.com/digital-asset/daml/pull/2316#discussion_r308193661
2019-07-30 10:40:45 +02:00
nickchapman-da
53eed132db
fix missing Status info in Completion (#2321) 2019-07-30 09:23:54 +01:00
nickchapman-da
b90862ebec
improve haskell module hierarchy to be more consistent (#2319) 2019-07-29 15:55:55 +01:00
Gerolf Seitz
136f6d1c08
Remove ExercisedEvent#contract_creating_event_id. (#2262)
This is a breaking change on the ledger api. So far we could rely on the
assumption that contractId == eventId. This assumption doesn't hold
anymore in a daml-on-x setting, where the eventId is created by the
api server, but the absolute contractId is created by the ledger
implementation.

Instead of going through weird contortions to store the relevant data in
the existing database schema, it is more viable in the long term to
remove that field and instead provide facilities to lookup transactions
by contractId.

Contributes to #2068.
2019-07-29 11:30:01 +02:00
Gerolf Seitz
c1608604ae
Add all packages in bindings-(rx)java to the javadoc (#2284)
Fixes #2280
2019-07-29 09:54:13 +02:00
nickchapman-da
77ed83b5b7
assert the reset service has worked as expected (#2305)
* assert the reset service has worked as expected

* flipping hlint
2019-07-26 18:46:52 +01:00
nickchapman-da
7064953a13
hlb, support: PartyManagementService (#2300)
* small refactorings in response to previous PR

* hlb, support: PartyManagementService
2019-07-26 16:47:01 +01:00
Michał Majcherski
37a921516b
Upgrade gRPC JVM libs (#2276)
* Haskell ledger bindings tests setup fix - use --port-file to obtain sandbox's port

* Update gRPC JVM libs

* Add missing gRPC core dependency

* Redirect sandbox's stdout and stderr to /dev/null

* Amend ledger's NettyServerBuilder settings after gRPC upgrade
2019-07-26 14:44:59 +02:00
nickchapman-da
7d7ee965d9
fix retry handling for issue #2260 (#2294) 2019-07-26 13:44:40 +01:00
nickchapman-da
49e21660f1
support --host option for daml deploy command (#2285) 2019-07-25 12:26:07 +01:00
nickchapman-da
b30228ab95
{-# LANGUAGE OverloadedStrings #-} is now on by default (#2270) 2019-07-24 08:09:26 +01:00
Remy
53de5edbc1 ledger-api: Kill legacy identifier (#2211)
* ledger-api: drop support for legacy identifier

* address scala-codegen: Stephen's comments

* language support: fix test
2019-07-23 20:34:52 +00:00
nickchapman-da
d306814193
hlb, support: CommandService, all 4 RPCs (#2267) 2019-07-23 17:29:30 +01:00
nickchapman-da
dd09c42210
hlb, support: RPC ListKnownPackages (#2261) 2019-07-23 14:09:58 +01:00
nickchapman-da
eec0333c73
support TimeService RPCs in haskell ledger bindings (#2247) 2019-07-23 09:42:36 +01:00
nickchapman-da
a31d5f04e1
go all-in on RecordWildcard syntax: {..} (#2212) 2019-07-18 12:36:45 +01:00
nickchapman-da
83e01d42eb
cleanup and refactor code structure for nim/chat ledger apps (#2210) 2019-07-18 12:36:19 +01:00
Michał Majcherski
76f877e71d
Haskell ledger bindings - multiple reset test (#2185) 2019-07-17 17:17:29 +02:00
Andreas Herrmann
63b46304eb
Base DA.Bazel.Runfiles on bazel-runfiles (#2147)
* DA.Bazel.Runfiles based on bazel-runfiles

* locateRunfilesMb -> locateRunfiles

* .exe extension on Windows

* Add docstring to locateRunfiles

* bazel-runfiles: Normalize on Windows
2019-07-17 09:48:44 +02:00
nickchapman-da
102cca04cd
haskell ledger bindings, support uploadDarFile (#2146)
* support uploadDarFile

* comment

* move uploadDarFileGetPid into test code
2019-07-15 16:06:41 +01:00
Remy
7c8bb0257d java-codegen: add integration tests for lf 1.5 (#2143)
* java-codegen: add integration tests for lf 1.5

* formatting

* java-codegen: add README abotu tests organization
2019-07-15 14:35:35 +00:00
nickchapman-da
63dd57ab19
fix nim/chat apps (#2120) 2019-07-15 08:57:43 +01:00
Remy
e7bbf87692 Freeze DAML-LF version 1.6 (#1937)
* daml-lf: cosmetic

* daml-lf: release V1.6

* daml-lf: update spec

* update unreleased.rst

* Address Martin's comments

* damlc: active daml-lf-target 1.6

* lf-encoder: fix testing dar generation

* daml-lf spec: simplify 1.dev description

* daml-lf: fix engine test

* daml-lf: fix version timeline

* extractor: fix test

* Address Stephen's comments

* Add more meat to the release notes

* java-codegen: update docs

* damlc: set 1.6 as default output version

* java-codegen update integration tests

* undo replicating typo

* release notes

* scala-codegen: update test

* java-codegen: fix doc

* extractor: fix  test

* address Gerolf's comments

* realse-notes: cleanup unreleased.rst

* Address last comment from Stephen

+ cosmetic cleanup

* formatting
2019-07-12 19:06:44 +00:00
nickchapman-da
4909ee1f01
refactor Stream -> StreamCore/StreamExtra (#2114) 2019-07-11 18:52:50 +01:00
nickchapman-da
a183df6585
haskell ledger bindings: improve thread handling (#2096)
* no forkIO

* mask_ body of asyncStreamGen

* reinstate flaky = True

* use: MonadUnliftIO

* thank you HLint
2019-07-11 17:25:02 +01:00
Gabor Aranyossy
33c746fe9b loading Dars from ZipInputStreams (#2005)
* loading Dars from ZipInputStreams

formatting and cleanup

fixing DarReaderTest not compiling

fmt

using IOUtils to read the ZipInputStream

fixing CodeGen

fixing broken legacy DAR loading

fixed v2 ReferenceServer

cleanup

* fixing rebase conflicts

* introduced a fromFile method to avoid having to do boiler-plating where the input is a File

* addressing leaking resources

* cleanup

* inlining closures

* closing the darStream
2019-07-11 15:37:21 +00:00
nickchapman-da
c41aca5b64
haskell ledger bindings -- LedgerConfigurationService (#2075)
* support: LedgerConfigurationService

* add da_haskell_repl target for haskell legdger bindings build

* address review comments

* fmt
2019-07-10 11:35:46 +01:00
nickchapman-da
5296f0253e
support: ActiveContractsService (#2067) 2019-07-09 15:09:55 +01:00
nickchapman-da
7a981d0e33
preserve [Transaction] per stream element in getTransactions rpc-wrapper, matching the .proto definition (#2054) 2019-07-09 10:35:34 +01:00
nickchapman-da
85a5222a28
Hlb address review comments (#2034)
* inline Convert.lowerList

* newtype Verbosity

* generalize type for raiseMap, and add comment
2019-07-08 16:28:07 +01:00
nickchapman-da
74b684ee0a
Hlb transaction service (#2029)
* support rpc: GetFlatTransactionByEventId

* support rpc: GetFlatTransactionById

* test: GetTransactions

* support rpc: GetTransactionTrees, and types: TransactionTree,TreeEvent

* reorder TransactionService.hs to match .proto

* rpcs: GetTransactionByEventId, GetTransactionById
2019-07-05 17:20:08 +01:00
Gary Verhaegen
acbc5de820 remove some build warnings (#2012) 2019-07-04 22:07:49 +00:00
Brian Healey
ecbe0b15b5 resolve daml warnings for language-support (#1995)
* resolve daml warnings for language-support

* resolve warnings for generated very large archive daml
2019-07-03 17:48:42 +00:00
nickchapman-da
f3ae835d30
Hlb optional offset in command completion (#1989)
* dont drop error info when not StatusOk

* CommandCompletionService supports optional offset; adapt tests
2019-07-03 14:32:46 +01:00
Stefano Baghino
4774e75eb8 The completion stream RPC defaults to the ledger end as offset (#1961)
* The completion stream RPC defaults to the ledger end as offset

Fixes #1913

Relevant changes are propagated to the Java bindings (including
deprecating a method that would now return a nullable ledger end).

* Refactor completionStream method

* Address review comments

- ignore command creation results
(https://github.com/digital-asset/daml/pull/1961#discussion_r299089539)
- avoid re-connecting to the client for every command
(https://github.com/digital-asset/daml/pull/1961#discussion_r299092328)
- move offset field optionality to domain object
(https://github.com/digital-asset/daml/pull/1961#discussion_r299090451)

* Improve tests
2019-07-02 10:02:43 +00:00
Gabor Aranyossy
709112e92b fixing issue of returning inclusive ledger offsets with completions (#1932)
* fixing issue of returning inclusive ledger offsets with completions

* changelog update

* removed TODO

* fixing haskell tests
2019-07-01 07:45:26 +00:00
Stefano Baghino
3dc0c02766
Add contract key support to Scala bindings and navigator (#1950)
* Expose the contract key in the Scala bindings

* Expose contract keys on the navigator

* Update release notes

* Remove ui-backend.conf file from navigator scenario

Addresses https://github.com/digital-asset/daml/pull/1950#discussion_r298814223

* Fix broken docstring reference to DamlLfDefRef

Addresses https://github.com/digital-asset/daml/pull/1950#discussion_r298814301
2019-06-30 20:57:55 +02:00
Michał Majcherski
2afefb7883
windows: root build (#1894)
* windows: root build

* windows: fixed haskell bindings tests

* windows: disable client_server_test test

* windows: marking daml_test flaky due to #1907

* windows: removing da-hs-damlc-app run from build.ps1

* windows: disable hie-core alias of currently disabled target
2019-06-28 12:55:31 +02:00
Stefano Baghino
2f319315a9 Mark Haskell bindings tests as flaky until #1927 is fixed (#1928) 2019-06-28 08:37:06 +00:00
nickchapman-da
0473734359
Hlb wrap more services (#1904)
* support: CommandCompletionService.completionEnd

* support checkpoints from: CommandCompletionService.completionStream

* address review comments

* add type for LedgerOffset; prefer AbsOffset when known

* extend submit/complete testcase
2019-06-27 15:30:47 +01:00
Remy
6cd3f93d2e scala-codegen: add support for enum type (#1833)
* scala-codege: add support for enum type

* formatting

* first part of Stephen comments

* Address Stephen's comments
2019-06-26 17:50:37 +00:00
Stefano Baghino
f8bebffb4e Expose signatories and observers throughout the platform (#1814)
* Add signatories and observers to Ledger API

Cascade fixes deriving from compilation and test errors.

* Add signatories and observers to Java bindings and codegen

* Add signatories and observers to Scala bindings and codegen

* Add signatories and observers to navigator

* Add signatories and observers to the Haskell bindings

* Add integration test

* Comply with formatting standard

* Add release notes

* Apply edits from CI feedback and self-review

* Fix wrong input on test case for observers sorting

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

* Read JSON as strings from DB, parse them as parties

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296405252

* Change parties rendering and observer display condition

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296390104

* Fix sorting tests, implement sorting by agreement

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296397390

FIXME notes have been added for suspicious test cases

* Prevent any mutation of CreatedEvent arguments

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296572639

* Comply with formatting standard

* Stakeholders are filtered up to the witnesses

Addresses https://github.com/digital-asset/daml/pull/1814#discussion_r297102521
2019-06-26 14:02:59 +00:00
Remy
41574d33f7 java-codegen: Add support for enum types (#1648)
* java-codegen: add support for Enum

* Address Stefano's comment
2019-06-26 11:50:25 +00:00
nickchapman-da
eba9af48ac
Hlb review comments (#1881)
* Define LedgerService using ReaderT to avoid boilerplate
* re-export TimeoutSeconds from GRPC.HighLevel.Client, instead of defining as a newtype
* rename: Valuable -> IsLedgerValue
2019-06-26 11:02:12 +01:00
nickchapman-da
4432a79407
refactor (#1865) 2019-06-26 08:09:08 +01:00
Gerolf Seitz
b0a465784e
Add grpc-netty as dep for bindings-java. publish daml-lf-archive (#1798)
We add a dependency in bindings-java to grpc-netty, so it is
automatically available in the classpath for users. Otherwise they get
an error like [0] if they don't add it explicitly.

We also publish daml-lf-archive-java to maven central.

[0] io.grpc.ManagedChannelProvider$ProviderNotFoundException: No
functional channel service provider found. Try adding a dependency
on the grpc-okhttp, grpc-netty, or grpc-netty-shaded artifact
2019-06-24 08:16:31 +02:00
Moritz Kiefer
c5cce0b22c [hs-ledger-bindings tests] Read the main dalf from the DAR manifest (#1803)
Previously, we got the package id by listing all packages and taking
the first. That is not a valid assumption and broke with a PR. This PR
changes the tests to use the DAR reader that we already used for
visualization (now factored into a separate library) and reads the
main dalf using that.
2019-06-21 15:32:40 +00:00
Robert Autenrieth
c14b909c71 Implement package management API in the sandbox (#1610)
* store archive size in `DarReader`

* rename `SandboxTemplateStore` to `SandboxPackageStore`

* store package info in `SandboxPackageStore`

* introduce package upload / read to write / index services

not tested yet, just a ton of plumbing

* WIP test the package service

* Fix build errors after rebase

* Move packages service to v2

* Ledger API client uses ledger API types

* Fix ReflectionIT

* Correctly handle uploading invalid dar files

* Fix reading DAR entry file sizes

* Improve package management IT

* Improve handling of duplicate packages

* Fix language-support build

* Use unique party and command names

* Rename lfpackage to language

* Rename SandboxPackageStore to InMemoryPackageStore

* Remove getCurrentTime ledger method

* Improve package management IT

* Move InMemoryActiveContracts and InMemoryPackageStore

* Use case object for UploadDarResult.Ok

* Address review comments

* Update release notes

Fixes #1311

* Use BazelRunfiles in test
2019-06-19 12:31:53 +00:00
Stefano Baghino
656e456b78 Add ExerciseByKey command to Ledger API (#1724)
Fixes #1366

Also adds support for the new command to the Java bindings and codegen
2019-06-19 09:11:52 +00:00
Stefano Baghino
02e950394d Support generic types as contract keys in codegen (#1743)
Fixes #1728
2019-06-18 14:54:23 +00:00
Nick Smith
0c0e4231f3
Fixes #1204: Release bindings and codegens to Maven Central. (#1205)
* Fixes #1204: Release bindings and codegens to Maven Central.

Upload the Java and Scala Bindings with the respective code
generator binaries to Sonatype Open Source Repository
Host for synchronization with Maven Central.
2019-06-17 15:37:49 +02:00
nickchapman-da
8cd1bc738c
GroupChat, take 2 (#1671)
* GroupChat, take 2
* GroupChat, last member may leave
* Add origin field into Group to support the group identity
2019-06-17 10:01:25 +01:00
nickchapman-da
fab80b7813
remove duplicate grpc example (#1679) 2019-06-17 09:56:03 +01:00
Stefano Baghino
ee3dae56e2
Add contract key support for created events to Haskell bindings (#1689)
Fixes #1688
2019-06-17 10:52:31 +02:00
Stefano Baghino
6ba26f4e1f Add contract keys to created events in the Ledger API (#1586)
* Add contract keys to created events in the Ledger API

Fixes #1268

* Update ledger/ledger-api-integration-tests/src/test/itsuite/scala/com/digitalasset/platform/tests/integration/ledger/api/TransactionServiceIT.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Update language-support/java/bindings-rxjava/src/test/scala/com/daml/ledger/rxjava/grpc/helpers/TransactionGenerator.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Update ledger/ledger-api-integration-tests/src/test/itsuite/scala/com/digitalasset/platform/tests/integration/ledger/api/TransactionServiceIT.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Add run suffix to transaction service integration tests

Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293233810
Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293233886

* Re-introduce unused bindings

Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293056685
Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293056741

* Update ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/participant/util/LfEngineToApi.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Use newly introduce assertOrRuntimeEx method

Applies the suggestion introduced by 7cc5c3eb71

* Contract keys to be typed after generated types

Also adds support in daml-lf/interface for contract keys

Addresses https://github.com/digital-asset/daml/pull/1586#pullrequestreview-249431707

* Address https://github.com/digital-asset/daml/pull/1586#discussion_r293773427

* Fix compilation error from previous commit

* Fix compilation errors in navigator
2019-06-14 16:45:12 +00:00
nickchapman-da
106e90e8a6
Group chat daml model (#1618)
Nim:
* fix index numbering in demo.md
* add in game "help" command to show available commands
* small code simplification for code review

GroupChat:
* DAML chat-room model, with support for multiple chat-groups with entry by invitation
* simplify: pass Invitation
* fix bug spotted by Bernhard -- Gain access to a Group without a valid invite
2019-06-13 11:06:49 +01:00
Remy
0591075187 cleanup daml-lf scala packages (#1581)
* cleanup daml-lf scala packages

* Address Stephen's Comments

* update maven coordinates of language package
2019-06-12 15:55:48 +00:00
Leonid Shlyapnikov
3eab89e6c6
Custom bindings doc + iou-no-codegen scala example (#1569)
* Custom bindings doc + iou-no-codegen scala example

* Fixing formatting

* Review suggestion

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Adding bazel build for `language-support/scala/examples/iou-no-codegen`

* Review suggestions

* Final touches + addressing review comments

* Adding notes about codegen alternatives

* Removing detectedOs lazy val
2019-06-12 09:26:54 -04:00
Nick Smith
7575f8cb0e
Buildsystem scala sources improvements (#1602)
* Fixes #1600. Improve Bazel Scala source JAR generation.

Include sources from JAR files defined as 'sources' to a Bazel Scala
target. The improvement will allow inclusion of generated source targets
in sources JARs of dependencies.

* Use temporary directory in the dar_to_scala() rule.

Place the output of the Scala code generator in a temporary
directory instead of a directory at the 'primary' output path as Bazel
rules should never have directory dependencies.
2019-06-12 14:45:54 +02:00
Jost Berthold
b0b3e29c49
language-support/scala: add support for specifying dependency roots explicitly (#1210)
* language-support/scala: add support for specifying roots explicitly

By default, code-gen will use all templates in the given package as roots, and
generate code for all types used. This patch adds the ability to specify roots
explicitly via a set of regex.es to match the (fully qualified) template names.

This is an experiment, tests and UI need to be adjusted later.

* scala codegen rootfilter: move filtering to envIFace handling

* doc for --root option

* scalafmt

* test filterTemplatesBy

* release note for --root Scala codegen option
2019-06-12 11:10:23 +10:00
Stephen Compall
cc21c78be2
Scala ecosystem: discourage Identifier name in scala primitive (#1570)
* Primitive.LegacyTemplateId replaces 2-tuple TemplateId.unapply; 3-tuple variant introduced

* ensure the suggested replacements are well-typed and behaved

* suggest LegacyTemplateId for 2-valued form
2019-06-11 17:31:28 -04:00
Leonid Shlyapnikov
8ed703e14d Removing damlc dependency (#1588)
quickstart-scala example does not buld DAR from SBT
2019-06-11 18:17:51 +00:00
Beth Aitman
e6c1d1e414 Suggestions for demo instructions (#1580) 2019-06-11 11:25:27 +01:00
nickchapman-da
19449affb5
Ledger App Demos (#1572)
* chat ledger-app, first cut

* pre-demo improvements to nim-console

* Valuable instance for Text

* nim-console/demo.md
2019-06-10 15:08:57 +01:00
Michał Majcherski
9b5f152f18
windows: better language-support build / test coverage (#1548) 2019-06-07 17:29:07 +02:00
Michał Majcherski
90c854f3bf
windows: language-support java codegen tests (#1542) 2019-06-06 16:19:39 +02:00
Martin Huschenbett
5396f42b3a
Drop support for DAML-LF 1.3 from damlc (#1445)
* Drop support for DAML-LF 1.3 from damlc

This means `damlc` now only supports versions allowing arbitrary expressions
as contract keys. This is very helpful for the upcoming new template
de/re-sugaring underpinning generic templates.

* Unpin a few DAML-LF target versions in tests

* Fix golden tests

* Adapt changelog to rebase

* Rename DAML-LF scenario tests to 1.dev

* Update tests to --target 1.dev

* Fix release notes
2019-06-03 14:00:25 -04:00
nickchapman-da
47e6d9ab05
Haskell ledger bindings (#1460)
* use with syntax in Daml

* attend to code review comments

* move ledger services implementation to own sub-module

* use ledger reset service when running tests for haskell-ledger-bindings

* expose LL.ClientCall in high level interface

* cancel streaming gRPC calls when attached stream is closed

* fix modification to gRPC-haskell so existing interface in preserved

* ClientCall and clientCallcancel were already available on HighLevel interface
2019-05-30 15:00:42 +01:00
Remy
f84e7d79d2 Add enum type to daml-lf (#1397)
* add enum type to daml-lf dev

* Address Francesco's comments

* Address Martin's comments

* fix daml-lf proto version history
2019-05-29 12:15:01 +00:00
Gerolf Seitz
82f81a7588 Test codegen against the latest DAML-LF version (#1446)
I'm refurbishing the DAML-LF 1.3 specific tests to run against the
latest DAML-LF version (by removing the explicit target version in the
daml_compile target).
Going forward we only "reify" specific DAML LF versions when breaking
changes or new features are introduced, and we need to test the old
behavior specifically (just like we did for DAML LF 1.0 and 1.1).
2019-05-29 11:30:38 +00:00
Martin Huschenbett
6cb8c3bc94
Add back the Java codegen integration tests for DAML-LF 1.0 (#1418)
I accidentally deleted them at some point and nobody noticed.
2019-05-28 12:36:03 +02:00
Martin Huschenbett
34d436d77d Drop support for DAML-LF 1.1 from damlc (#1231)
* Drop support for DAML-LF 1.1 from damlc

Part of #853.

* Fix docs test

* Add show party test back

* Update release notes

* Remove target version from Java codegen test
2019-05-27 16:07:35 +00:00
Gabor Aranyossy
be0a8110a9
using LedgerId domain type (#1403)
* getting a compiler SOE

* /ledger/... compiles

* all compiles

* fmt
2019-05-27 17:01:17 +02:00
Martin Huschenbett
a25a641c35
Check in DAR file for Java codegen test against DAML-LF 1.1 (#1406)
This is a prerequisite for dropping DAML-LF 1.1 support from the compiler.
2019-05-27 16:33:31 +02:00
Nick Smith
54cfc6d316
Fixes #1340 - Add Scaladocs generation to the Bazel rules. (#1341)
* Fixes #1340 - Add Scaladocs generation to the Bazel rules.
2019-05-27 12:59:19 +02:00
Stephen Compall
aa6bbe8de6 compile Scala codegen output removing ContractId tparam constraints (#1350)
* ValuePrimitiveEncoding.Mapped, mixin for the "axiom" parts of mapped and xmapped

* remove ValuePrimitiveEncoding.mapped

- it was okay with 1 inductive case, but now there will be 4, so just
  mixin Mapped instead

* mark members of ValuePrimitiveEncoding.Mapped final

- mixins are easier to get right if you mark everything final

* add Maps to random tests

* replace <: Template[A] with : TC in ValuePrimitiveEncoding#valueContractId

- no current subclass uses this context bound, but it may be useful for
  encodings that wish to make ContractId encodings dependent on the type
  parameter

* replace : TC with no bound in ValuePrimitiveEncoding#valueContractId

- fixes #1325
- can reintroduce : TC with #822

* stub test for generating with #1315's liberated contract IDs

- commented out because we still want to test codegen with stable LF
  only

* undo useless changes

* ContractId#apply is unbounded
2019-05-24 18:01:32 +00:00
Gabor Aranyossy
ff088efd94
porting API services to used Index Service v2 (#1362)
* moving to index service v2

* damlonx does not depend on v2 index service anymore

* leger -> ledger

* transacion id fix
2019-05-24 19:18:51 +02:00
Remy
294abecf5d daml-lf remove LedgerIdString (#1376) 2019-05-24 12:08:28 +00:00
Remy
4f18b1afa7 DAML-LF internal type safety (#1192)
* Rename Value's ContractId to VContractId

* daml-lf: a bit more about PartyId

* daml-lf: Concatenable MatchingStringModule

* daml-lf make clear type used for Scenarios only

* daml-lf create ContractId, LedgerId, TransactionId

* sandbox-sql conversion util

* LedgerName -> LedgerString

* futher type cleanup in the sandbox

* daml-lf add test for LedgerString

* fixing tests

* a bit more safety in the DB

* Address Stephen's comments

* fix rebase

* More fixes for StringModule

* change length of LedgerString (256 -> 255)
2019-05-24 09:53:29 +00:00
nickchapman-da
7ee7931407
nim-console Ledger App (#1342)
* Use closable Stream in Haskell ledger bindings

* move PastAndFuture abstraction into ledger interface code

* distinguish past/future transactions in return of Ledger.getTransactionsPF

* first cut: nim-console running against a ledger

* remove flaky failing test
2019-05-23 15:56:12 +01:00
Leonid Shlyapnikov
67da43cff5
Document the meaning of Option in Contract#agreementText (#1319)
* Documenting `agreementText`

* Code review suggestion

Co-Authored-By: Francesco Mazzoli <f@mazzo.li>
2019-05-23 08:00:42 -04:00
gaborh-da
4259ad28bc Expose a testable ledger view (#1236) 2019-05-21 12:29:07 +02:00
Leonid Shlyapnikov
4c6ea2875d Add test cases to validate the received agreement text, #1159 (#1259) 2019-05-21 08:09:20 +00:00
Leonid Shlyapnikov
3d91ac6734 Compile codegen-sbt-example as part of the bazel build, #1254 (#1261)
Fix codegen-sbt-example compilation, sandbox API changed.
2019-05-21 07:13:03 +00:00
Leonid Shlyapnikov
f31980c18f Add Scala codegen bazel rule: dar_to_scala (#1202)
* Removing unused/broken daml.bzl rules, adding Scala codegen rule

Scala codegen rule: dar_to_scala follows the same approach
as dar_to_java with a few differences:
- dar_to_scala supports multiple dars as an input
- dar_to_scala does not try to compile the generated scala (separation
  of responsibilities)

* Using dar_to_scala to compile quickstart-scala example

* Fixing formatting

* Add dependency to examples-quickstart-scala-bin

So if example does not compile, it can't be published.

* Fixing the path to the jar executable

* Changing scala codegen rule to rely on zipper instead of jar

JDK's jar creates srcjar with timestamped files, zipper doesn't
timestamp files. This means we can create reproducible/deterministic/
cacheable srcjars

* Addressing code review comments, wrong var name
2019-05-20 14:13:30 +00:00
Stephen Compall
53058001e6 add createAnd syntax to prepare CreateAndExercise commands from Scala codegen contracts (#1197)
* add createAnd syntax to prepare CreateAndExercise commands from Scala codegen contracts

* open-style ExerciseOn typeclass

* GADT-style ExerciseOn works perfectly well, so let's go with that instead

* testing implicit conversion + ExerciseOn TC lookup

* use scalatest-style typesafe === to avoid Anys

* many more ExerciseOn tests

* support ExerciseOn polymorphism in Primitive.exercise

* generate ExerciseOn references in Scala codegen, permitting `createAnd` to combine with exercise* methods

* refactor testCreateContractAndReceiveEvent to support other commands

* compare create and createAnd's command generation behavior in a simple test

* bazel style

* test CreateAndExercise from Scala codegen against sandbox

* release note for Scala codegen create-and-exercise support
2019-05-20 07:43:08 +00:00
Gerolf Seitz
c645348ca1
Expose a contract's agreement text on the Ledger API (#1151)
* Added agreement_text field to the CreatedEvent in Ledger API.
* Changed java bindings + java codegen
* Changed utilities for scala codegen
* Made necessary changes in Sandbox to propagate the agreement text from ContractInst to the CreatedEvent
* Made changes to the navigator to show the agreement text in the contract details page when it is set and not empty

Fixes #1110
2019-05-17 11:22:05 +02:00
Gabor Aranyossy
f48b7c764e introducing WriteService in Sandbox (#1193)
* introdocing WriteService in Sandbox

* changing submit to return java CompletableStage

* introduced TimeModelChecker interface

* removing whitespaces

* doc updates

* dependency order fix
2019-05-17 08:59:19 +00:00
Leonid Shlyapnikov
b5dec5aa3b Remove //language-support/scala/sandbox-control and references, #950 (#1203)
the class referring to sandbox-control has not been used itself.
2019-05-17 07:27:11 +00:00
Andreas Herrmann
a6809310e8
Update to Bazel 0.24 (#567)
* bazel: 0.23.1 -> 0.24

* bazel-deps: Fix for Bazel 0.24.0

* bazel no longer supports + on dicts

Replace by dict.update.

* Fix junit classpath issue

* azure: Update MacOS image to Mojave

* Windows: --noincompatible_windows_escape_jvm_flags

* rules_scala: Support escape_jvmflags

* rules_scala: separate jvm_flags by TAB

* Document --noincompatible_windows_escape_jvm_flags
2019-05-16 18:04:30 +02:00
nickchapman-da
8510e6afc5
Haskell ledger bindings (#1181)
* Bindings & tests for more ledger services

* fix hardcoded package id in test

* language-support/hs/bindings/examples/nim-console

* make hlint happy

* headers & format

* README

* increase timeouts; track location of GPRC Deadline Exceeded.

* Update language-support/hs/bindings/examples/nim-console/README.md

Co-Authored-By: Neil Mitchell <35463327+neil-da@users.noreply.github.com>

* rename: Mes --> Logger, mes --> log, tagMes --> tagLog (etc)

* replace isOpen with ==Open

* Avoid fragile hardcoded PackageId in testcase
2019-05-16 16:45:54 +01:00
Leonid Shlyapnikov
b57246642c
Build quickstart-scala as part of the bazel build cycle, #675 (#1138)
Set up exports instead of loading `variables.bzl` with transitive deps
2019-05-16 10:21:52 -04:00
Gabor Aranyossy
e70cbfe65c eliminating some mutable state (#1130)
* no var no problem

further refactor

introduced InfraState

a bit less vars

encapsulating closes

SandboxServer starts automatically

rebase fixup

collecting state into a single object

some cleanup

removing exposed materializer

LedgerBackend is closed in SandboxServer

changed ownership of Ledger

fixing perf tests

fixing some compile errors

formatting

removing unused method

fixing integration test to use correct dar file

fixing issue with PostgresFixture and SandboxResource

Fix integration tests on Windows

* fixing rebase artifacts
2019-05-16 08:52:14 +00:00
Leonid Shlyapnikov
3cb958f656 Changes recommended by @jost.berthold (#1168) 2019-05-15 22:59:18 +00:00
gleber
3eb6f83b3a
ledger-api-intgration-tests: Cleanup ledger ID handling. (#1129)
* ledger-api-intgration-tests: Cleanup ledger ID handling.

This changes nothing in the logic of tests. It is a preparation for moving of
most of the tests to use Dynamic ledger ID mode for tests, which is a
preparation for running these tests against remote Ledger API endpoints.

* sandbox: Rework LedgerIdMode and move it up into common.
2019-05-15 17:05:16 +02:00
Leonid Shlyapnikov
90c2a11c30
Scala ecosystem SDK doc (#1025)
* Scala ecosystem SDK doc (#675)

* Improving quickstart-scala error handling, #675
2019-05-15 10:09:33 -04:00
Gerolf Seitz
a5cf706040 Less logging in tests (#1145)
* Less DEBUG logging in java codegen tests

* Add logback-test.xml for ledger/sandbox tests
2019-05-15 08:58:08 +00:00
Nick Smith
6f6f3337c7
Fixes 895: Improve DA Bazel rules for building javadocs. (#896)
* Fixes 895: Improve DA Bazel rules for building javadocs.

Extend the da_java_library Bazel macro to also build the Javadoc for the
target. Add the Javadoc artefacts to the release procedure.
2019-05-14 09:40:30 +02:00
Neil Mitchell
ed431b4717
Move Tuple and Either types to DA.Types (#1099)
* Add a helper function to qualify things with respect to a module

* Supress some warnings I saw when building

* Move Tuple* and Either to daml-prim:DA.Types, so they have a nice name for Java users (instead of GHC.Tuple or DA.Internal.Prelude)

* Add copyright header

* Update daml-foundations/daml-ghc/daml-prim-src/DA/Types.daml

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update daml-foundations/daml-ghc/daml-prim-src/DA/Types.daml

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update the daml-lf translation of tuple types

* Fix up the scala bindings for how to use types

* Clarify what action people need to take following the release notes

* Fix an expected test

* Clarify the changelogs even more

* Run ScalaFmt

* Clean up the release notes a bit

* Use the changelog from Beth

* Update the release notes again

* Update docs/source/support/release-notes.rst

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Fix up the scenario error messages
2019-05-13 16:36:21 +01:00
Gerolf Seitz
17df4e78e1
Java Codegen: generate methods for CreateAndExerciseCommand (#1107)
The Java Codegen now generates methods for creating a
CreateAndExerciseCommand for a particular choice given a template.

Contributes to #1092.
2019-05-13 16:11:10 +02:00
Gerolf Seitz
8158269b7d
Remove ExercisedEvent in Event oneof. (#1067)
* Remove ExercisedEvent in Event oneof.

The Event message is only used in the Transaction message. Flat
transactions do not contain exercised events, but only created and
archived events. Therefore we can remove the ExercisedEvent from the
Event oneof, without breaking transport compatibility.

HOWEVER: The Java Bindings used to use the data.Event class for both flat
transactions and transaction trees. To properly represent the actual
event types in the two transaction structures,
1) Event is now and interface and is only used in the Transaction class.
2) there is a new interface TreeEvent, which is used in the TransactionTree class.

* CreatedEvent implements Event and TreeEvent
* ExercisedEvent implements TreeEvent
* ArchivedEvent implements Event

Some "pathological" cases where an occurrence of an exercised event
would have resulted only in an exception, are now removed (see change in
LedgerApiV1.scala).

Fixes #960.
2019-05-13 14:36:13 +02:00
Remy
2e3a87934b Daml lf type safty (ChoiceName, VarName, FieldName, ConstructorName) (#983)
* daml-lf: make DefinitionRef more typesafe

* daml-lf: Identifier -> DefinitionRef

* daml-lf: remove unsafe apply and copy methods from DottedName

* daml-lf: create identifier

* daml-lf: make ChoiceNames Identifiers

* daml-lf: cleanup TVar

* daml-lf: FieldNames & VariantConstructors -> Identifiers

* bazel fmt

* daml-lf: VarName -> Identifier

* daml-lf: drop return inside Ref.scala

* daml-lf Identifier -> Name

* daml-lf DefinitionRef -> Identifier

* daml-lf make iface more type safe
+ address Francesco's comments

* daml-lf: remove unsafe unapply from MatchingStringModule

* fix navigator

* Address Stephen's Comments
2019-05-13 11:17:12 +00:00
nickchapman-da
c1de0abcd6 haskell-ledger-bindings, test connect against sandbox (#1023)
* haskell-ledger-bindings, test connect with sandbox

* use System.Time.Extra.timeout instead of rolling own

* fix module name to match hierachical path

* increase timeout to 10s, fix macOS CI?

* delete-trailing-whitespace

* dont specify daml version for daml_compile rule

* unalign module imports

* replace xxx with undefined
2019-05-09 17:31:06 +00:00
Michał Majcherski
9610d74b50
windows: back to official rules_scala repo (#1040) 2019-05-09 13:53:47 +02:00
Moritz Kiefer
90550cc801
Remove broken timestamp test (#1026)
This test only worked by chance since in older JDK versions
java.time.Instant.now() didn’t have nanoseconds precision. As
evidenced by the test after this, nanoseconds are lost during a
roundtrip so this test breaks on newer JDK versions that increased the
precision. See https://bugs.openjdk.java.net/browse/JDK-8068730 for
more information.
2019-05-09 11:17:46 +02:00
Leonid Shlyapnikov
0ca414f09c
quickstart-scala daml assistant template cleanup (#614) (#1007) 2019-05-08 11:18:22 -04:00
Leonid Shlyapnikov
6cc9e685e5 Add quickstart-scala template to DAML Assistant (#991)
* Add quickstart-scala template to DAML Assistant , #614

Removing the rule to create a quickstart-scala.tar.gz, it is not needed

* Return non-zero error code if failures detected, #614

* Reading project name from `daml.yaml`, #614

Removing Versions.scala.template
2019-05-08 06:57:15 +00:00
Leonid Shlyapnikov
8534e2837f
quickstart-scala DAML Assistant template (#745)
* Add quickstart-scala IOU example, DAML Assistant template, #614

* Move all scala examples under language-support/scala/examples

* Removing target dirs which don't get excluded by the glob, #614
2019-05-07 11:41:29 -04:00
Gerolf Seitz
bac5c4a6f4 Java Bindings: Properly convert CreateAndExerciseCommand (#982)
The conversion of the CreateAndExerciseCommand in the Command base class
was missing. This also adds a missing test for that.

Fixes #979.
2019-05-07 17:04:48 +02:00
Gerolf Seitz
6ac1e5cf28
Java Codegen: Removing some dead/unused code (#971) 2019-05-07 14:59:20 +02:00
Gerolf Seitz
2c04e1fd6d
Java Codegen: Generate types with multiple name components (#946)
If a variant itself is not serializable, but the synthesized record for
one of its constructors is, then said record is returned by the
interface reader in the set of type declarations, when the variant type
itself is not.
When constructing the InterfaceTree in preparation of the codegen, we
previously rejected such a situation.

We now generate Java code for such a synthesized record, as it is a more
generally correct way of interpreting DAML LF (i.e. the DAML compiler
could decide tomorrow to create such multi-component record names for
regular records).

In any case, we consider this to be an edge case, as the synthesized
record for the variant constructor cannot be used directly either from
DAML or the Ledger API.
2019-05-07 11:12:42 +02:00
Remy
0489c6e0a5
Daml lf type safty (Party & PackageId) (#761)
* daml-lf: split SimpleString into Party and PackageId

* daml-lf remove parameter from DefinitionRef
2019-05-06 20:40:43 +02:00
Martin Huschenbett
1af740ced8 Remove a useless dependency on daml-prim from a sandbox-control test (#948) 2019-05-06 18:57:25 +02:00
Nick Smith
d725d50be9 add result of exercise to transaction -- fixes #479 (#583)
Modify the DAML Engine, Ledger API and Sandbox to pass the result of the
exercise as a field of the transactions.
2019-05-06 14:33:44 +02:00
Gerolf Seitz
b38ac29532
Attempt at fixing flaky CodegenLedgerTest (#929)
* Increase call timeout to 40 seconds
* Run test exclusively
* Add logback-test.xml and set level to DEBUG

Contributes to #808.
2019-05-06 12:48:20 +02:00
Martin Huschenbett
f098b0e4be
Remove a deprecated package database build rule (#913)
The rule was used in only in one place and that place can be updated
to a newer rule.
2019-05-04 15:32:05 +02:00
Gerolf Seitz
ecf6ece8c4
CommandService returns useful data for successful submissions (#875)
Submitting a command via the CommandService now returns either the
transaction id (SubmitAndWaitForTransactionId), the flat transaction
(SubmitAndWaitForTransactionResponse), or the transaction tree
(SubmitAndWaitForTransactionTreeResponse).

This means that users don't have to wade through the transaction stream
to retrieve the resulting transaction. This is particularly useful in
combination with #479.

Fixes #406
2019-05-03 16:01:41 +02:00
nickchapman-da
549cf086e1 Haskell ledger bindings (#879)
* HL types for Ledger API. Command Submission & Completion services.

* whitespace

* remove renamed file that came back after bad merge

* delint

* adapt to change in transaction_service.proto
2019-05-03 10:37:08 +00:00
Gerolf Seitz
f4d8e134e3
Add TransactionService methods for looking up flat transactions (#830)
This change is needed in preparation of #406, where we want to return a
transaction tree and flat transaction after a SubmitAndWaitForTransaction(Tree).
2019-05-03 09:03:12 +02:00
Martin Huschenbett
df230912c7
Drop DAML-LF 1.0 support from compiler (#863)
* Drop DAML-LF 1.0 support from compiler

This will enable us to add `Functor`, `Applicative` and `Monad` instances
for `(->) r` in the `daml-stdlib`. We'll do this in a separate PR.

* Remove codegen test for DAML-LF 1.0
2019-05-02 21:35:06 +02:00
nickchapman-da
15ea5ef8b4 haskell-ledger-bindings: TransactionService, GetTransactions (#816)
* haskell-ledger-bindings: TransactionService, GetTransactions

* passify linter

* passify humans linters!

* format!
2019-05-01 14:29:23 +00:00
Stephen Compall
157fab963b
daml-lf: move EnvironmentInterface from Scala codegen to interface library (#781)
Also move Interface and InterfaceType out of the reader subpackage; they
belong with the rest of the data model at the iface root.

The specific mechanics of reading a Dar all the way to producing an
EnvironmentInterface are left to Scala codegen's Codegen and Java
codegen's CodeGenRunner; there's no consensus or great stability on the
best way to tie these pieces together, but all the pieces might as well
be available in the interface library at least.

Inspired by a query on Slack by @leonelag regarding reading the
codegen-relevant parts of dalfs and dars; thanks!

* daml-lf: move EnvironmentInterface to interface library from Scala codegen

* daml-lf: move Interface out of reader subpackage

* language-support/java: deal with moving Interface out of reader subpackage

* document Interface and EnvironmentInterface

* missed copyright header in reader package.scala

* extractor: deal with moving Interface out of reader subpackage

* navigator: deal with moving Interface out of reader subpackage
2019-04-29 17:01:01 -04:00
nickchapman-da
b2e8df5c6a haskell-ledger-bindings, LedgerIdentity (#755)
* haskell-ledger-bindings, LedgerIdentity

* copyright headers

* address review comments

* format

* fix haskell indentation
2019-04-29 14:02:25 +00:00
Stephen Compall
0ba1e5b386 increase ledger-api IT timeout; daml-lf, language-support/scala: remove long-deprecated symbols (#741)
* remove long-deprecated symbols from daml-lf and language-support scala libraries

* remove useless usage of 2-parameter TemplateId constructor

* grow ledger-api-integration-tests to account for usual 300s-ish runtime

* buildifier
2019-04-26 21:05:26 +00:00
Gabor Aranyossy
cc32ee5025
adding missing tests around Sandbox's CLI module (#668)
* introducing CliSpec

* updating sandbox sdk docs

* fixing the missing code block

* adding missing copyright headers

* making allow-dev hidden

* HardCoded -> Predefined

* updated changelog
2019-04-26 10:12:23 +02:00
nickchapman-da
43abaee299
example of using haskell-grpc (#700)
example of using haskell-grpc
2019-04-25 18:23:32 +01:00