* Enable DAML Script service by default and document it
fixes#7193
changelog_begin
- [DAML Script] DAML Scripts are now run in DAML Studio just like
scenarios. The functionality for inspecting the results is
identical. If you encounter issues, please report them.
changelog_end
* fix double "is identical"
changelog_begin
changelog_end
This is primarily intended to improve error reporting in DAML Script,
in particular, https://github.com/digital-asset/daml/issues/7192 which
is a blocker for replacing scenarios by DAML Script.
However, I think it is also a very reasonable feature in general.
changelog_begin
changelog_end
Adds a Boolean check for the existence of an active contract with a
given key (that is visible with the current set of authorizations), and
explain `lookupByKey` in terms of it to hopefully clarify the relationship
between `lookupByKey` and `fetchByKey`.
Fixes#7143; see that for more information.
CHANGELOG_BEGIN
- [DAML Standard Library] Added a new function `visibleByKey`
which, given a contract key, returns True if the current context can
see an active contract with that key.
CHANGELOG_END
* REPL test `:json` command
changelog_begin
changelog_end
* Implement :json command in DAML REPL
changelog_begin
- [DAML REPL] You can now convert DAML expressions to JSON in the DAML
REPL using the meta-command ``:json`` for example ``:json [1, 2, 3]``.
changelog_end
* Extend DAML REPL documentation
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* IDE distinguish scripts and scenarios
The code lens above DAML script definitions now reads `Script results`
instead of `Scenario results`.
This also adds DAML Script test cases to the lsp-tests.
The functionality for testing scenario and script code-lenses in the
`Utils` module is identical. However, this adds dedicated definitions
for scripts to clearly distinguish the scenario and script test-cases.
changelog_begin
changelog_end
* Add sum type to distinguish Scenario and Script
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
lookupContract catches the exception which results in us continuing
and eventually running into a null-pointer exception.
This is another reason why we should enable the NonUnitStatements wart
but I’ll leave that for a separate PR (last I tried the scenario
service resulted in a ton of false positives).
fixes#7185
changelog_begin
changelog_end
* Test-case for operation after submitMustFail
Currently this triggers
```
BErrorClient (ClientIOError (GRPCIOBadStatusCode StatusUnknown (StatusDetails {unStatusDetails = ""})))
```
changelog_begin
changelog_end
* Reset the machine after every submit in IdeClient
This ensures that the machine is not stuck in a brocken state after a
`submitMustFail` completed.
changelog_begin
changelog_end
* Machine cleanup in finally block
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
We have seen timeouts on port file waits occasionally.
Those timeouts are already very high so reducing load is a more
sensible option than bumping the timeout.
changelog_begin
changelog_end
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
fixes#7114
This PR changes the Show instance of ContractId and flips the switch
on triggers and DAML Script to run in off-ledger mode.
It also adds a test that for DAML Script we actually get back the
correct contract id.
There is a bit of a design decision here in how we want to print
contract ids, so let me list the options I considered. $cid will stand
for the actual cid and all options are wrapped in markdown inline
code.
1. `"$cid"`. Indistinguishable from string. Suggests that there might
be an IsString instance for ContractId.
2. `<$cid>`. Matches the dummy `<contract-id>` but it’s not a dummy so
I don’t think matching that is benefitial.
3. `$cid`. Easy to spot (contract ids start with # and have no
spaces), clearly not a string but might look slightly weird.
changelog_begin
- [DAML Script/DAML Triggers] When using DAML-LF 1.dev, the `Show` instance of `ContractId` will now display the actual contract id instead of a dummy `<contract-id>` value. Note that this only applies to DAML Script and DAML Triggers not to ledger code.
changelog_end
* Add TO_TEXT_CONTRACT_ID primitive
This is the first part of #7114.
This PR
* Adds the primitive to the protobuf.
* Handles decoding and encoding in Haskell and Scala.
* Handles typechecking in Haskell and Scala.
* Handles speedy compilation and interpretation in Scala.
* Updates the specification.
This PR does not yet change the standard library to make use of this
primitive.
changelog_begin
changelog_end
* Apply suggestions from code review
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Avoid extra allocation
changelog_begin
changelog_end
Co-authored-by: Remy <remy.haemmerle@daml.com>
* script service party management test-case
* script service: allocateParty and listKnownParties
Behave like sandbox on party hint. If a hint is given then allocate
exactly that party name and fail if it already exists. Otherwise
generate a fresh party name. For easier debugging the fresh name is
based on the display name.
changelog_begin
changelog_end
* Track parties that were not allocated explicitly
E.g. parties generated by `partyFromText`.
* Handle and test party already exists error
* fmt
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
The chosen example happened to work for at least three well known functions with the given arguments, `(+)`, `(*)` and `(**)`. Making the example a little less ambiguous.
* submitMustFail test-case
* script compat test for submitMustFail
changelog_begin
changelog_end
* Support submitMustFail in DAML Script Service
Pushes handling of `submitMustFail` into the DAML script interpreter
rather than DAML script itself.
* fmt
* Simplify IdeClient.submitMustFail
* Comment on case we don't expect to hit
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
This is set per participant since it is similar to the token file.
fixes#7029
changelog_begin
- [DAML Script/DAML REPL] You can now configure the application id via
`--application-id` or the `--participant-config`. This is primarily
useful if you are working against a ledger with authentication and
need to match the application id in your token.
changelog_end
This makes much more sense since for things like the JSON API and the
script service, we don’t actually have the application id as a
separate parameter.
I’ve also cleaned up all the arbitrary hardcoded application id in
various tests in favor of a DEFAULT_APPLICATION_ID value.
Next step is #7029
changelog_begin
changelog_end
* add -Ywarn-unused to all scalac options
* remove some unused arguments
* remove some unused definitions
* remove some unused variable names
* suppress some unused variable names
* changeExtension doesn't use baseName
* no changelog
CHANGELOG_BEGIN
CHANGELOG_END
* work around no plugins in scenario interpreter perf tests
* remove many more unused things
* remove more unused things, restore some used things
* remove more unused things, restore a couple signature mistakes
* missed import
* unused argument
* remove more unused loggingContexts
* some unused code in triggers
* some unused code in sandbox and kvutils
* some unused code in repl-service and daml-script
* some unused code in bindings-rxjava tests
* some unused code in triggers runner
* more comments on silent usages
- suggested by @cocreature; thanks
* fix missing reference in TestCommands
* more unused in triggers
* more unused in sandbox
* more unused in daml-script
* more unused in ledger-client tests
* more unused in triggers
* more unused in kvutils
* more unused in daml-script
* more unused in sandbox
* remove unused in ledger-api-test-tool
* suppress final special case for codegen unused warnings
.../com/daml/sample/mymain/ContractIdNT.scala:24: warning: parameter value ev 0 in method ContractIdNT Value is never used
implicit def `ContractIdNT Value`[a_a1dk](implicit `ev 0`: ` lfdomainapi`.Value[a_a1dk]): ` lfdomainapi`.Value[_root_.com.daml.sample.MyMain.ContractIdNT[a_a1dk]] = {
^
.../com/daml/sample/mymain/ContractIdNT.scala:41: warning: parameter value eva_a1dk in method ContractIdNT LfEncodable is never used
implicit def `ContractIdNT LfEncodable`[a_a1dk](implicit eva_a1dk: ` lfdomainapi`.encoding.LfEncodable[a_a1dk]): ` lfdomainapi`.encoding.LfEncodable[_root_.com.daml.sample.MyMain.ContractIdNT[a_a1dk]] = {
^
* one more unused in daml-script
* special scaladoc rules may need silencer, too
* unused in compatibility/sandbox-migration
* more commas, a different way to `find`
- suggested by @remyhaemmerle-da; thanks
* testCreateAndExercise test-case
* CreateAndExerciseCommand in DAML Script service
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* Test exerciseByKeyCmd in DAML Script service
* ExerciseByKeyCommand in DAML Script service
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* Factor out tar/gzip reproducibility flags
* use mktgz in package-app
* Bazel managed tar/gzip
* Remove quiet = True
As stated in the comment this is no longer required with Bazel >= 3.0.
* Build package-app as a sh_binary
This way Bazel will manage the runtime dependencies tar, gzip, mktgz,
and patchelf.
package-app.sh changes directory so it needs to make sure that all paths
are absolute and that the runfiles tree/manifest location is forwarded
to programs called by package-app.sh.
* Avoid file path too long errors
* Fix readlink -f on MacOS
* Document abspath
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* Extend the scenario service with DAML Script support
This adds most of the infrastructure for running DAML Script via the
scenario service which means it runs as part of DAML Studio and `daml
test`. This is hidden behind a feature flag so we can land this and
parallelize the remaining tasks. The main things that are missing are:
1. `createAndExerciseCmd` and `exerciseByKeyCmd`.
2. Party management needs some work and listing parties is
unsupported.
3. Time management
4. Potentially some better error handling (we need to go through
SResult and SError and see what is relevant for us).
Overall, it is already in a very usable state and there is a decent
range of tests.
closes#3688
changelog_begin
changelog_end
* Update compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs
Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
* Fix name for actor system and pool
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
* Add evaluation order tests for foldl and foldr
I'd like to have a play with the implementation of `foldl` and `foldr`
in Speedy in order to improve their performance. Doing so without any
tests for the evaluation order of those builtins, is too scary for me.
Thus, let's kick off the effort by adding some tests.
Except for the usual case where we need to test that we're running over
the list in the right order, we also need to test for the case where
the step function only consumes one argument and the case where the
accumulator is a function. In the latter case we need to make sure we
don't evaluate the argument applied to the final accumulator too early.
We're also very short on the semantics of `foldl` and `foldr` in the
DAML-LF spec but I leave that for another PR.
CHANGELOG_BEGIN
CHANGELOG_END
* Fix copy/paste error
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
* Minor fixes
CHANGELOG_BEGIN
CHANGELOG_END
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
This was not only unnecessarily duplicated, it also had a bug where
`--crt` behaved like `--pem` instead of setting the cert chain.
I didn’t add new tests since it seems like the wrong place to test
config parsing of a library. We do have tests for TLS in general for
both DAML Script and DAML Triggers.
changelog_begin
changelog_end
* Strip ELocation nodes in simplifier rules.
Uses stripLoc in the patterns used by the simplifier. This change
reduces the size of the generated code by 1.5% for a very large project,
meaning we had rules (like `let x = e in x`) that weren't trigerring
because of the `ELocation` nodes that weren't being properly ignored.
changelog_begin
changelog_end
* More stripLoc
* Add a test for the conversion of (nested) record updates to DAML-LF
The new tests check that we generate the DAML-LF we intend to generate,
namely code using `ERecUpd` AST nodes rather than calls to the
`setField` function.
CHANGELOG_BEGIN
CHANGELOG_END
* Use get_value_name instead of get_dotted_name
CHANGELOG_BEGIN
CHANGELOG_END
* Evaluation order for exercise & other updates.
This adds more DAML tests and error cases for, finishing off the update
interpretation for now. I believe this is roughly the limit of what we
can test directly in DAML, and the rest is up to DAML-LF testing.
For example, there's no way to test that the contract inactivity check
in EvUpdExercInactive happens before the evaluation of the controller
expression, since there is no way to generate an 'exercise' with actors
from DAML, as far as I could tell, and 'exercise_without_actor' always
evaluates the controller before passing it off to 'exercise'.
For the same reason, the EvUpdExercBadActor check seems impossible to
trigger from DAML itself. The closest is an authorization test that
happens during submit (which I added a test for, because it is kinda
relevant to evaluation order of scenarios, even though scenario
interpretation isn't really important to the spec).
So at the very least we should add LF tests for those two cases.
changelog_begin
changelog_end
* Apply Moritz\'s suggestions
* Add test with fetch of consumed contract
* Expose type synonyms in data-dependencies.
This PR converts (non-unit) type synonyms during LF conversion, and then
exposes them via data-dependencies. This is possible only when using an
LF version that supports type synonyms (LF version >= 1.7), the
type synonym isn't of unit type (because it clashes with empty
typeclasses, and the (fully applied) type synonym has kind *
(e.g. you can't define a * -> * synonym in LF).
This fixes issue #6306
changelog_begin
- [DAML Compiler] The DAML compiler will now compile type synonyms
(``type X = Y``) into the DAR, whenever possible, and will expose
these synonyms via data-dependencies.
changelog_end
* Add more tests
* Fix formatting
* DAML REPL :show imports
changelog_begin
- [DAML REPL] You can now list the currently imported modules using
the REPL command ``:show imports``.
changelog_end
* Accept \r\n on Windows.
* REPL functests use text mode file for stdin/out
So that `\r\n` will be mapped to `\n` automatically on Windows.
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* Deduplicate REPL imports and store in map
changelog_begin
changelog_end
* DAML REPL subsumed imports functest
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* DAML REPL help and module commands
changelog_begin
- [DAML REPL] You can now type ``:help`` at the REPL prompt to see a
list of possible REPL commands.
- [DAML REPL] You can now add and remove module imports using
``:module [+-] Some.Module``.
changelog_end
* REPL :module functests
* Improve module not imported error message
* DAML REPL document REPL commands
* Update docs/source/daml-repl/index.rst
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
GHC hates its users and defaults to optimizing out assertions. We
fixed that in Buck at some point but clearly that got lost when
migrating to Bazel.
Turns out enabling assertions catches bugs. This insight was brought to
you from the people that also brought you “Turns out writing tests
catches bugs”.
fixes#5624
changelog_begin
changelog_end
This PR extends DAML REPL to also support `let` bindings which plays
well with the improved support for pure expressions. We support both
pattern bindings and function bindings.
changelog_begin
- [DAML REPL] DAML REPL can now run without a ledger. Take a look at
the documentation for details.
- [DAML REPL] DAML REPL now supports ``let`` bindings to bind pure
expressions. Take a look at the documentation for details.
changelog_end
This PR makes the ``--ledger-host`` and ``--ledger-port`` parameters
optional so DAML REPL works without a ledger which is useful now that
we have better. support for pure expressions. This just piggybacks on
DAML Script’s multiparticipant support so there are no significant
changes on the service.
Docs are updated and we have a testcase.
Side note: What is still missing is `let x = …` in DAML REPL. I’ll
tackle that in a separate PR.
changelog_begin
changelog_end
* Upgrade nixpkgs revision
* Remove unused minio
It used to be used as a gateway to push the Nix cache to GCS, but has
since been replaced by nix-store-gcs-proxy.
* Update Bazel on Windows
changelog_begin
changelog_end
* Fix hlint warnings
The nixpkgs update implied an hlint update which enabled new warnings.
* Fix "Error applying patch"
Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files
and applying patches has been reversed. The allows users to define
patches to these files that will not be immediately overwritten.
However, it also means that patches on another repository's original
`WORKSPACE` file will likely become invalid.
* a948eb7255
* https://github.com/bazelbuild/bazel/issues/10681
Hint: If you're generating a patch with `git` then you can use the
following command to exclude the `WORKSPACE` file.
```
git diff ':(exclude)WORKSPACE'
```
* Update rules_nixpkgs
* nixpkgs location expansion escaping
* Drop --noincompatible_windows_native_test_wrapper
* client_server_test using sh_inline_test
client_server_test used to produce an executable shell script in form of
a text file output. However, since the removal of
`--noincompatible_windows_native_test_wrapper` this no longer works on
Windows since `.sh` files are not directly executable on Windows.
This change fixes the issue by producing the script file in a dedicated
rule and then wrapping it in a `sh_test` rule which also works on
Windows.
* daml_test using sh_inline_test
* daml_doc_test using sh_inline_test
* _daml_validate_test using sh_inline_test
* damlc_compile_test using sh_inline_test
* client_server_test find .exe on Windows
* Bump Windows cache for Bazel update
Remove `clean --expunge` after merge.
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* Fix reference to return produced by ApplicativeDo
see https://github.com/digital-asset/ghc/pull/53 for details.
fixes#6820
changelog_begin
changelog_end
* bump to merged commit
changelog_begin
changelog_end
* switch to new ghc-lib
changelog_begin
changelog_end
* Draft of new operational semantics.
* make errors deterministic, and be explicit about them
* Flesh out the op semantics for expressions and add tests.
* Nail down the semantics of create
* Apply suggestions from code review
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Add a reminder that u has to be a value
... in the update interpretation section.
changelog_begin
changelog_end
* add a test to track the ghc behavior on multi-lets
* add test for erasable type abstraction
* Add non-erasable type abstraction value test.
* move the ValExpTyAbsNat to 1.7-only value test
Co-authored-by: Remy <remy.haemmerle@daml.com>
This limits the JVM max memory and initial memory in a few tests that
look like they might be using more than they have two and that run for
a long time so there is a high chance they end up running in parallel
with something else.
changelog_begin
changelog_end
* LF: Simplify inference of output transaction/value version.
As part of #5164, we simplify the way transaction and value versions
are inferred for the engine output.
The versioning of a transaction tr is done as follow:
* Let tvMin be the minimal transaction version allowed by the DAML
engine configuration
* Let tvMax be the maximal transaction version allowed by the DAML
engine configuration
* Let n₁, ..., nₘ be the nodes of tr.
* Let pkgᵢ be the package of the template associated to the node nᵢ
* Let lvᵢ be the maximal language version that pkgᵢ uses (directly or
through its dependencies)
* let tvᵢ be the maximal transaction version supported by all engines
that support both lvᵢ and tvMin
* Let vvᵢ be the maximal value version supported by all engines that
support tvᵢ.
* Let tv be the maximal transaction version between tv₁, ..., tvₘ.
* If tv is not greater than tvMax
+ then
- Version the values of each node nᵢ according vvᵢ
- Version tr according tv
+ fail otherwise
CHANGELOG_BEGIN
CHANGELOG_END
* Print results in DAML REPL and support pure expressions
This extends DAML REPL to behave similar to GHCi in that it prints
results if the result is an instance of `Show` and it also supports
pure, non-script expressions now. We copy the same hack from GHCi and
typecheck multiple times. This doesn’t seem to have any noticeable
performance impact (which makes sense, the expressions are tiny and
the overhead of grpc is much much bigger).
Docs and tests are updated.
fixes#6780
changelog_begin
changelog_end
* windows is garbage
* but I fixed it \o/
* Rename getReplLogger to newReplLogger
changelog_begin
changelog_end
* Add a --timeout option to `daml ledger` commands
At least in the compatibility tests, we see timeouts fairly regularly
in the tests for fetch-dar. If we see those timeouts in the tests, I
see no reason why our users should never see that especially on
actually distributed ledgers and hardcoded timeouts are a bad idea
anyway so now they are configurable.
I’ve also changed the timeout for the fetch tests (those are the only
once I’ve seen timeout) to 120s.
changelog_begin
- [DAML Assistant] The `daml ledger` commands now accept a `--timeout`
option which can be used to change the timeout for API requests from
the default of 30s.
changelog_end
* Generate parties as uuids to avoid collisions
changelog_begin
changelog_end
* Match on Deadline Exceeded as well
changelog_begin
changelog_end
* Update compatibility/bazel_tools/test_utils/DA/Test/Util.hs
Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
* Update daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs
Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
* Add some docs
changelog_begin
changelog_end
* Better version checks
changelog_begin
changelog_end
* fix imports
changelog_begin
changelog_end
* This is not how you exception
changelog_begin
changelog_end
* Update daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs
Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
* Update rules_haskell hie-bios support
* Decouple Haskell ghcide and DAML ghcide
Creates a separate `stack_snapshot` to pull in `ghcide` for the Haskell
IDE use case independent of the `ghcide` for DAML. This allows to update
these two `ghcide` instances independently. As DAML uses `ghcide` the
library updates can be involved if the API experienced breaking changes.
At the same time we may wish to update `ghcide` for Haskell earlier to
make use of new features and stay compatible with rules_haskell's ghcide
support.
* Fix Haddock warnings reported by ghcide
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* DAML REPL - Explicit package imports
changelog_begin
- [DAML REPL] The REPL no longer imports all modules from the main DALFs
of all specified DARs automatically at start-up. Instead, the REPL
will only import modules from packages specified on the command-line
using the `--import` flag.
changelog_end
* Accept package-name or package-id
* REPL test case for --import flag
* DAML REPL use `UnitId` for import packages
Addressing review comment
https://github.com/digital-asset/daml/pull/6707#discussion_r453731353
* DAML REPL Parse package-name/id at CLI
* DAML REPL Simplify unversioned pkgs
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* REPL: Factor out Dar loading
* REPL accept multiple DARs
* REPL CLI take multiple packages
CHANGELOG_BEGIN
- [DAML REPL] The REPL now supports loading multiple DARs specified at
the command line. The DARs are loaded as data-dependencies, and the
modules of each DAR's main DALF will be imported into the REPL session
at startup.
CHANGELOG_END
* REPL test loading multiple DARs
* REPL Load packages from current session
* REPL func-test test symbols from two DARs
* Update compiler/damlc/daml-compiler/src/DA/Daml/Compiler/Repl.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Revert ANF changes and add a testcase for evaluation order
After careful consideration, we decided that the change in evaluation
order that was accidentally introduced by the ANF changes should be
considered a breaking change or arguably even a bug and should not
land in 1.3.0.
Therefore, this PR reverts the following commits:
1. 353d0da6f7
2. a45b51042f
3. 04c7b2af7f
4. a624dd7242
5. b3aab72cee
Other PRs mostly had trivial merge conflicts that I resolved. The two
most interesting ones here are probably
1. https://github.com/digital-asset/daml/pull/6576 which was easy to
resolve and the change to return SEValue instead of SExpr is still
nice and useful even if we do not need the guarantees.
2. it https://github.com/digital-asset/daml/pull/6542 which required
some changes since the constructors changed. If you want to review
those changes in detail (they are pretty straightforward so not too
important), it’s probably easiest to check out this PR and run
```
git diff 2cd2a8f2a8
daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Compiler.scala
```
to see the diff to the parent commit of the first commit that
introduced ANF.
changelog_begin
changelog_end
* Update rules_haskell
- Fixes the issue where a `sh_test` wrapping a `haskell_binary` couldn't
add runfiles as is the case with other Bazel rules.
CHANGELOG_BEGIN
CHANGELOG_END
* Save the runfiles environment at start-up
To work around the fact that `withProgName` overwrites `argv[0]`.
See https://gitlab.haskell.org/ghc/ghc/-/issues/18418.
* damlc_compile_test include damlc runfiles
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Buildifier now comes with a handy attachment to catch single `\`
characters inside strings and replace them with `\\` if the escape
sequence is invalid. Skylark/Python will do this at runtime anyway; this
just makes it clearer what the actual behavior is.
I needed to change `\` characters at the end of lines to `\\` manually
in order to stop Buildifier from simply concatenating the lines
together. Everything else was automatic.
CHANGELOG_BEGIN
CHANGELOG_END
* Fix record update evaluation order.
This PR only fixes the evaluation order for single-constructor record
types. Fixing it for variant records, if we do, will be a major
challenge.
This PR also adds a regression test.
changelog_begin
changelog_end
* fix daml-lf-verify
As requested by @shaul-da, this PR hides the information added by
@hurryabit in #6571 behind a checkbox, and reverts to plain "X"s by
default (checkbox unchecked).
CHANGELOG_BEGIN
- [DAML Studio] The new S/O/W/D information is hidden behind a top-level
checkbox (next to Show archived). When that checkbox is not checked
(which is the default), we display X's as before.
CHANGELOG_END
'.' is not a valid character in a mangled name which caused unmangling
to fail. Sadly the scenario service does not properly distinguish
between dotted an undotted names but for now everything we unmangle is
dotted anyway so I’ve taken the easy approach of simply changing our
unmangling to take that into account.
We might want to change the scenario service here but I’ll leave that
for a separate PR.
changelog_begin
- [DAML Studio] Fix a crash in scenarios that referenced records
originating from definitions like `data T = T1 { f1 : Int } | T2 { f2
: Int }`.
changelog_end
Currently, the scenario service ships the disclosure information of a
transaction twice. One of the two copies is completely unused. This PR
simply deletes it. I hope this reduces confusion in the future.
CHANGELOG_BEGIN
CHANGELOG_END
* Split damlc integration tests per DAML-LF version
Currently, we have one test for all stable DAML-LF versions. This test
takes quite a while to run and times out occasionally. This PR splits
the big test into one test per stable DAML-LF version.
CHANGELOG_BEGIN
CHANGELOG_END
* Address some feedback
* Distinguish witnesses and divulgences in scenario table view
Currently, we display a "D" (for "Disclosure/Divulgence") in the table
view of the scenario view when a party can see a contract because they
have learnt about it via disclosure.
This change further refines this visibily indicators for disclosure:
We display a "W" for "Witness" (i.e. the party has witnessed the
creation of the contract) and "D" for "Divulgence".
Help for the reviewer: In the scenario service server, witnessing is
called explicit disclosure whereas divulgence is called implicit
disclosure.
CHANGELOG_BEGIN
* [DAML Studio]
When displaying scenario results in table view in DAML Studio, we now
indicate _why_ a party knows about the existence of a contract:
- `S` means the party is a signatory.
- `O` means the party is an observer.
- `W` means the party has witnessed the creation of the contract.
- `D` means the party has learned about the contract via divulgence.
CHANGELOG_END
* Address @cocreature's feedback
The whole instPrSelf thing is just repeating what DecodeAsDependency
does. Handling unqualified TypeConNames also sounds very questionable
so I changed that as well. Sadly this doesn’t fix the issue I was
hoping to fix.
changelog_begin
changelog_end
Implementing substitution once is scary enough, let’s not implement it
twice.
Sadly this is also does not fix the bug I was hoping to address.
I would not be surprised if it does fix some bugs but given that I
don’t know which there is no new testcase.
changelog_begin
changelog_end
* Fix haddock typo
* Daml REPL - use data dependencies
Without this a DAR that has a transitive dependency on another DAR
cannot be loaded into the REPL since the interfaces are missing, with
data-dependencies they are reconstructed.
CHANGELOG_BEGIN
- [DAML REPL] The provided DAR is now loaded as a data-dependencies,
meaning that the REPL supports loading DARs with transitive
dependencies.
CHANGELOG_END
* REPL test - use indirect DAR dependency
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
* ANF transformation in Speedy.
The idea behind this PR is to transform speedy expressions into a simpler form where all non-atomic sub-expressions are made explicit by the introduction of let-forms. In particular, for the function-application form. These simpler forms allow the execution engine to take advantage of the atomic assumption, and often removes many additional execution steps. In particular the pushing of continuations to allow execution to continue after a compound expression has been reduced to a value.
changelog_begin
changelog_end
* improve comment
* inline functions relocateA/L
* remove comment about scalafmt
* remove commented out alterative def for transformLet1
* improve code by adding incr methods to DepthA/E
* remove (n == 0) special case in trackBindings
* clarify comment further
* improve validate/go to not consume stack for deeply right-nested let-expressions
* address comments from Remy: be private; use final case case; etc
* rename to unsafeCompilationPipeline
* add back some trailing commas
* remove commented-out debug line
* improve comment
* remove dev/debug code in compilationPipeline
* remove commented out code in SEAppGeneral.execute
* undo unrelated code improvement in SValue.scala
* fix compile. object Anf cannot be private
Verification tool update:
- Support for recursion and mutual recursion.
- Significant code cleanup and bugfixes.
- Minor improvements: keep track of more typing information, handle updates properly when called multiple times, support additional operators, more test cases etc.
For `damlc test` and `damlc ide`, `optScenarioService` is (correctly)
enabled. However, every call to `withDamlIdeState` will spawn a
scenario service. This means that during package initialization we
will spawn at least one extra scenario service (potentially) more. On
a simple project this gets `damlc test` from 10s down to 7s and I see
a noticeable (although hard to measure) speedup in IDE startup time.
changelog_begin
changelog_end
Returning the original relative path from withProjectRoot makes no
sense since we change the directory in there so this PR fixes this to
return the canonicalized project root.
fixes#6245
changelog_begin
- [DAML Compiler] damlc test --project-root now works with relative
paths as well.
changelog_end
* add simplifier tests
* add some lambda constant lifting tests
changelog_begin
changelog_end
* update copyright
* clarify that the subexpression is a lambda
* Explicit export list in tests module
* don't use lambda in test names :-(
* DAML REPL --static-time regression test
* damlc repl --static-time|--wall-clock-time flags
CHANGELOG_BEGIN
- [DAML REPL] The time mode can now be specified using the
``--static-time`` and ``--wall-clock-time`` flags.
CHANGELOG_END
* Update compiler/damlc/lib/DA/Cli/Damlc.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Verify the effect of setTime using getTime
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Display why a party knows about a contract in table view
When displaying scenario results in table view in DAML Studio, we now
indicate _why_ a party knows about the existence of a contract:
- `S` means the party is a signatory.
- `O` means the party is an observer.
- `D` means the party has learned about the contract via disclosure or
divulgence.
With the information we get from the scenario service there is no
straightforward way of distinguishing between disclosed (you
witnessed the `create`) and divulged (you witnessed a `fetch`)
contracts. Fortunately, both words start with a "D" and we're fine. :)
This addresses the first point of
https://github.com/digital-asset/daml/issues/6412 for the table view.
CHANGELOG_BEGIN
* [DAML Studio]
When displaying scenario results in table view in DAML Studio, we now
indicate _why_ a party knows about the existence of a contract:
- `S` means the party is a signatory.
- `O` means the party is an observer.
- `D` means the party has learned about the contract via disclosure or
divulgence.
CHANGELOG_END
* Add tooltips
CHANGELOG_BEGIN
CHANGELOG_END
* Add test
CHANGELOG_BEGIN
CHANGELOG_END
* Remove tooltip for invisible contracts
CHANGELOG_BEGIN
CHANGELOG_END
* Move parties to then end
CHANGELOG_BEGIN
CHANGELOG_END
* Support multiple auth tokens in DAML Script
This piggy backs on top of the already existing --participant-config
feature. While you can argue that it might be slightly confusing that
you have to specify the same participant twice to specify different
auth tokens, I think this actually makes sense: In an ideal
world (ignoring any performance issues) you have one participant per
party anyway and one connection per participant specified in the
config file still seems like a very reasonable model.
changelog_begin
- [DAML Script] You can now use DAML Script with multiple auth
tokens. This is particularly useful if you are working with the JSON
API where you can only have one party per token or with an IAM that
only provides single-party tokens. The tokens are specified in the
participant configuration passed via `--participant-config` in a new
``access_token`` field. The existing `--acess-token-file` flag is still supported if you want to use the same token for all connections. See
https://docs.daml.com/daml-script/index.html#running-daml-script-against-authenticated-ledgers
for more details.
changelog_end
* I will never understand rst
changelog_begin
changelog_end
* Prefix IDE include paths with project root
As described in #6174, `--include` is broken pretty badly in the IDE
atm. LSP works based on absolute file paths so if you have a relative
include dir you run into two issues:
1. You end up with two GHC sessions e.g, one for `/multidir` and one
for `.`. That results in fun type errors like “Couldn’t match expected
type `Text` with actual type `Text`”.
2. The same file can end up being represented twice. Apart from being
horribly inefficient, this breaks as soon as we try to build a DALF
since the function for constructing that (correctly) explodes when
there are two files with the same module name.
This change does not break `daml build` since the project root is
relative there.
fixes#6174
changelog_begin
- [DAML Studio] Fix an issue where use of the `--include` option
resulted in various confusing type errors. See
https://github.com/digital-asset/daml/issues/6174
changelog_end
* Stop wasting my time hlint
changelog_begin
changelog_end
* Consistently display stakeholders for key visibility errors
fixes#6404
As pointed out by Bernhard in #6404, the previous behavior was pretty
weird. If the committer was only a divulgee, we only displayed
stakeholders. If the committer was neither a stakeholder nor a
divulgee, we displayed stakeholders + parties the contract has been
divulged to. Given that only stakeholders can do lookups it makes much
more sense to display them consistently which is what this PR
achieves. I’ve also renamed “disclosed to” to “stakeholders” to make
it very explicit what is shown there.
changelog_begin
changelog_end
* Apply suggestions from code review
Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
* fmt
changelog_begin
changelog_end
* lalala
changelog_begin
changelog_end
Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
fixes#6403
I am not entirely sure why I thought that using `missingWith` makes
sense here but it clearly doesn’t make sense and resulted in a pretty
bad bug where a transaction both succeeded via `submit` as well as
failed via `submitMustFail` which is clearly the wrong thing to do.
This PR fixes this issue and introduces a `notVisibleWith` function
that does the right thing. I’ve also added some comments and an extra
assertion to clarify things a bit.
changelog_begin
changelog_end
* support external anchors
changelog_begin
- `daml docs` now supports an `--input-anchor` argument specifying the
path to a database of external anchors
changelog_end
* Add daml-base-anchors.json to the damlc-dist target