Commit Graph

50 Commits

Author SHA1 Message Date
Gary Verhaegen
878429e3bf
update copyright notices to 2020 (#3939)
copyright update 2020

* update template
* run script: `dade-copyright-headers update .`
* update script
* manual adjustments
* exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files)
2020-01-02 21:21:13 +01: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
Andreas Herrmann
06cd1f14a2
Expose timestamp in DAML triggers (#3858)
* Add time to Trigger update function

CHANGELOG_BEGIN

- [DAML Triggers - Experimental] Expose timestamp in triggers.
  See `#3612 <https://github.com/digital-asset/daml/issues/3612>`__.

CHANGELOG_END

* Add triggers time test

* Update trigger docs
2019-12-17 11:12:05 +01:00
Moritz Kiefer
022c60ccb3 Publish the thin trigger library instead of the fat jar (#3739)
This still contains the main class so you can use it like you would
use the fat jar but publishing fat jars to maven central is apparently
bad practise and some peple have asked for the library.

This includes some slight tweaks to the scala_docs rule to make it
capable of coping with the generated source file and a hack in the
release script to avoid it complaining about the scenario proto
library not being published to Maven even though it is included in the
transitive deps.
2019-12-05 13:04:20 +00:00
Stefano Baghino
5254520b80 Spin off TokenHolder into a new library (#3741)
* Spin off TokenHolder into a new library

Avoids having weird dependencies between different packages, makes TokenHolder available on Maven

* Fix auth-utils path
2019-12-05 12:31:14 +00:00
Moritz Kiefer
24b6dfd319
Support authentication in DAML triggers (#3730)
* Support authentication in DAML triggers

fixes #3259

CHANGELOG_BEGIN

- [DAML Triggers - Experimental] DAML triggers can now be run against
an authenticated ledger.

CHANGELOG_END

* Remove debug printf

* Windows is bad
2019-12-04 13:57:44 +01:00
Moritz Kiefer
5a3b5f498a Fix SDK versions in trigger and daml-script dars (#3706)
* Fix SDK versions in trigger and daml-script dars

* Fix SDK versions in tests
2019-12-03 07:28:49 +00:00
Martin Huschenbett
167232bd81
Ban usage of generic templates (#3631)
We don't drop full support from the compiler yet but rather ban their use by
adding a check to the preprocessor. We'll remove the actual support as we go
along with fixing the upgrading story.

CHANGELOG_BEGIN

- [DAML Compiler] Make the experimental feature "generic templates"
  unavailable. The current implementation is at odds with other, more important
  language features still under development.

CHANGELOG_END
2019-11-26 17:15:17 +01:00
Moritz Kiefer
c34f56ab2e
Add template id filtering to triggers (#3577)
* Add template id filtering to triggers

CHANGELOG_BEGIN
- [Daml Triggers - Experimental] DAML triggers now allow you to specify which templates you want to listen for which can improve performance.
CHANGELOG_END

* Address review comments

* Fix list-triggers test
2019-11-21 16:50:40 +01:00
Moritz Kiefer
c3438a58af
Refactor trigger runner in preparation for template id filtering (#3570)
This is a prepatory PR before introducing template id filtering in
DAML triggers. It does not change or introduce any new functionality.
2019-11-21 14:08:11 +01:00
Moritz Kiefer
6d2ed90f29 Remove target flags in DAML triggers and DAML script (#3545)
1.7 is now the default so we no longer need those.
2019-11-20 10:54:16 +00:00
Moritz Kiefer
5458053ea9 Add pending set to DAML triggers (#3502)
fixes #3360
2019-11-18 14:25:40 +00:00
Andreas Herrmann
712bc456ba Map CommandIds in MTransaction (#3501)
* Regression test for #3485

* Respect CommandId mapping for transactions

* triggers: Fix ExerciseByKey

Make choice nonconsuming, so that no second `T` is created later.
Only execute `dedupExerciseByKey` if `T_` doesn't exist, yet.

* Update list-triggers test

* triggers: Empty commandId on foreign TransactionM

95ccc59b45 (r347287514)
2019-11-18 14:34:48 +01:00
Moritz Kiefer
4eb72d496e
Fix conversion from Ledger API to Speedy in DAML triggers (#3458)
Previously, we use SValue.fromValue for the conversion. However, this
breaks in cases like Numeric where the scale information is lost. By
using the ValueTranslator instead, we avoid this issue.

There is a similar problem in DAML script but I’ll fix that in a
separate PR.

Since the ValueTranslator is package private, this PR moves the
triggers in the engine package.
2019-11-14 09:26:36 +01:00
Moritz Kiefer
45d2b7048c
[daml-triggers] Rename getTemplates to getContracts (#3430)
Given that this returns the contracts of a given template rather than
returning templates, this name makes a lot more sense.
2019-11-12 14:48:24 +01:00
Moritz Kiefer
11044f3683 Add exerciseByKey to DAML triggers (#3413)
fixes #3317
2019-11-11 18:12:25 +00:00
Moritz Kiefer
7db11ca427 Add toAnyContractKey and fromAnyContractKey (#3408)
* Add toAnyContractKey and fromAnyContractKey

This is necessary to add exerciseByKey to DAML triggers.

* Switch to proper ghc-lib release

* Remove unnecessary filter

* Bump timeout because macos is terrible

* bazel fmt
2019-11-11 17:35:53 +00:00
Moritz Kiefer
c57a31d630
Compile DAML trigger library with --target 1.7 (#3372) 2019-11-07 12:08:44 +01:00
Jussi Mäki
ca7bbacd6c Build rules for producing and verifying ledger dumps (#3290)
* Add client_server_build and integrity_test rules

And use them to implement ledger dump of the reference
server and to check it.

* Only build and test ledger dump on Linux. Only run tests relevant to dump.

* Make client_server_build quiet in happy path

* Reformat

* Remove unnecessary runfiles for client_server_build
2019-11-07 09:41:54 +00:00
Moritz Kiefer
90679c93f8
Use regular ContractIds in DAML triggers (#3337)
The only reason for having AbsoluteContractId was that we could get
some more instances in particular `Ord` and `MapKey` but given that
`ContractId` will be a valid key type for the new DAML-LF maps, we can
just use slower implementations for now and switch to Map-based
implementations once that has landed.

fixes #3336
2019-11-05 15:15:07 +01:00
Moritz Kiefer
e70bb007be Add a command to list the triggers in a DAR (#3268)
For now, this uses a somewhat adhoc format with one trigger identifier
per line but given that I expect that it won’t be particularly common
to want to do this mechanically this should be sufficient and it’s
trivial to parse.
2019-10-28 22:34:19 +00: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
Andreas Herrmann
dc2f10ebe6 Use TemplateTypeRep in DAML Trigger API (#3245)
* Add TemplateTypeRep to AnyContractId

* Define Trigger.ContractId t

* Use Trigger.ContractId t

* Implement fromCreated and fromArchived

* instance MapKey TemplateTypeRep

* More efficient ACS access using Map TemplateTypeRep

* ./fmt.sh

* toString and fromString for Identifier

* Replace Identifier by TemplateTypeRep

* TheContractId --> AbsoluteContractId

https://github.com/digital-asset/daml/pull/3245#discussion_r338033546
2019-10-23 13:56:59 +00:00
Andreas Herrmann
b0bd8328ea
Detect high level trigger (#3239)
* capture high-level module in converter

* Factor out trigger discovery

* Support running high-level triggers directly

* Don't convert to low-level trigger in Retry

* ./fmt.sh

* Update CopyTrigger, docs, and changelog
2019-10-21 14:22:08 +02:00
Moritz Kiefer
f2618ec85b Run DAML trigger rule on failed completions (#3226)
fixes #3214
2019-10-18 13:04:31 +00:00
Moritz Kiefer
e31526c35c Use the same CopyTrigger in the docs and the tests (#3213)
* Use the same CopyTrigger in the docs and the tests

That way, we actually test what we use in our docs which seem like a
much better idea than duplicating the code.

* Add debugging output on failures
2019-10-17 12:52:15 +00:00
Moritz Kiefer
6d3ae219d1 Improve logging and debugging of DAML triggers (#3210)
- We now display `trace` messages so they can be used for debugging.
- I’ve removed the log message from the low-level API since it is
  confusing as it is not exposed via the high-level API and somewhat
  redundant since you can use `trace` for debugging. If there is a
  demand for proper logging support we might want to add it back at
  some point.
- We now display errors from speedy properly. This is mainly important
  for calls to `error` since we previously lost the error message.
- Logging messages go through a proper logging library now and the
  internal debugging stuff is only displayed at debug level so not by default.
- We log failed completions at warning level to ease debugging.
2019-10-17 10:21:56 +00:00
Moritz Kiefer
87427ba334
Fix a race condition in the DAML trigger tests (#3199)
Previously, it could happen that the command flow used in the test was
started before the trigger queried the ACS on startup.

Now we wait for the ACS to be queried before starting the commands
flow which fixes this issue.
2019-10-16 16:51:06 +02:00
Moritz Kiefer
155302a247 [daml-triggers] Support wallclock time and make TTL configurable (#3186)
* [daml-triggers] Support wallclock time and make TTL configurable

fixes #3184

* Remove duplicate wall clock option
2019-10-15 15:43:55 +00:00
Moritz Kiefer
dbddead461
Add a first draft of documentation for DAML triggers (#3181)
* Add a first draft of documentation for DAML triggers

The API will still change in a bunch of ways but I’d rather get some
docs in place now and update them as we change things than not have
any docs at all.

* Fix path to daml.yaml

* s/bot/trigger/

* fix source code markers

* Fix tests

* Update docs/source/triggers/index.rst

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2019-10-15 16:50:43 +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
Moritz Kiefer
1da742ec60 Use UUIDs for command ids emitted from DAML triggers (#3170)
fixes #3130
2019-10-14 14:49:01 +00:00
Moritz Kiefer
d500d9967a
Allow emitting commands on trigger initialization (#3132)
fixes #3128

Also includes a small bug fix to reenable some tests that I
accidentally disabled in #3127 and fixes deserialization of command
ids in completions which I accidentaly broke when making fromCommandId
return an Optional since that’s what we need for transactions.
2019-10-09 09:24:34 +02:00
Moritz Kiefer
bf04fe1be9
First draft of a high-level API for DAML triggers (#3127)
This PR adds a first draft of a high-level API for DAML
triggers. There is definitely more work to be done and the design is
absolutely not final. However it already allows expressing the copy
bot fairly cleanly so I would like to merge this in its current
state (or at least without bikeshedding the design too much) and then
iterate upon it.
2019-10-08 15:34:14 +02:00
Moritz Kiefer
e51e27fe27
Make the DAML trigger tests more generic (#3096)
This is a first step towards making our tests more generic so we can
add more easily tests different triggers.
2019-10-04 10:59:02 +02:00
Moritz Kiefer
8743dbbda7
Use newtypes for id types in DAML triggers (#3082)
This makes the API a bit safer and nicer to use. Since this is a
low-level API the constructors are exposed, for the high-level API we
probably want to hide them.
2019-10-02 16:57:20 +02:00
Moritz Kiefer
a96f219f47 Share akka logic between DAML trigger main and tests (#3084) 2019-10-02 13:29:33 +00:00
Moritz Kiefer
7e7f35216f
Remove flaky=True from trigger tests (#3079)
I’ve run them a 100 times locally and haven’t been able to get them to
fail so it looks like the issue has been fixed since.

fixes #2881
2019-10-01 17:21:16 +02:00
Moritz Kiefer
a7fbad153c
Expose completions in daml triggers (#3077) 2019-10-01 15:28:59 +02:00
Andreas Herrmann
98bb580aa2 Bundle packages with SDK releases (#3056)
* Enable SDK daml-lib package dependencies

* integration-test: SDK daml-libs dependency

* trigger --> daml-trigger

Rename the trigger library package to match other builtin packages.

* Bundle daml-trigger.dar in SDK release tarball

* Describe SDK bundled packages in changelog

* Push case match inside expand

Addressing review comment
8208277747 (r329428240)
2019-09-30 09:15:11 +00:00
Moritz Kiefer
11c686b255
Support emitting multiple transations from DAML triggers (#3049)
fixes #3047
2019-09-30 08:46:08 +02:00
Moritz Kiefer
7a2e12d6d2
[daml-triggers] Expose template data in CreateEvents (#2973)
Now that we have AnyTemplate, we can actually make the template data accessible.
2019-09-23 12:49:01 +02:00
Andreas Herrmann
df7262e853 Infer templateId and choiceName in daml trigger commands (#2945)
* Infer templateId from createCmd argument

* Infer templateId and choiceName in exerciseCmd

* Use exerciseCmd in ACS test

Add a layer of indirection to test `exerciseCmd` in the ACS test.

The trigger first creates a `AssetMirrorProposal`, only when the
proposal has been created, will it exercise the `Accept` choice to
create the actual `AssetMirror` contract.

* Remove toTemplateId

* getTemplateId --> toTemplateId

* Tuple2 --> AnyContractId

* Run Scala formatter

* Export AnyContractId

* extractTemplateId|ChoiceName
2019-09-18 10:06:53 +00:00
Moritz Kiefer
01eccf2c64 Mark DAML trigger tests as flaky while we investigate (#2882) 2019-09-11 13:32:54 +00:00
Moritz Kiefer
77225af6da
Support Exercise and Create commands in DAML triggers (#2864)
* Support Exercise and Create commands in DAML triggers

This is a bit rough but I want something to experiment with before we
settle on a design and start making the LF changes required to make it
nicer.

It does already allow you to use the original template and choice types.

* Update triggers/runner/src/main/scala/com/daml/trigger/Runner.scala

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-09-10 17:31:36 +02:00
Moritz Kiefer
9de5e3cfa4
Initialize DAML triggers with ACS (#2798) 2019-09-09 15:47:11 +02:00
Moritz Kiefer
f1a9afdf17 Clean before running daml build (#2816)
This should hopefully fix some of the flakiness we’ve been seeing on
Windows. Not entirely sure what’s going wrong without the clean but
since this only happens the lack of sandboxing seems like the most
likely difference.
2019-09-08 17:49:00 +00:00
Moritz Kiefer
5e962a2b61
DAML Triggers V0 (#2762)
This is a first step towards DAML triggers. At the moment, triggers
can consume (very simplified) create and archive events via the Ledger
API, update a state based on that and emit log mesages at each update.

All of this is likely to change significantly in the future, so I
would prefer to not focus too much on minor details for now.

As a test, I added a simple trigger that tracks active contract ids.
2019-09-05 12:56:41 +02:00