Commit Graph

571 Commits

Author SHA1 Message Date
pbatko-da
6dcdaa411c
[DPP-589] Add CLI flag to select minimum enabled TLS version (#10854)
- Add support for specifying either 1.2 or 1.3 as minimum TLS versions for ledger api server.
- Log enabled protocols (~TLS versions) and cipher suites at server and client startup.
- Add integration tests against Sandbox-classic and Sandbox

CHANGELOG_BEGIN
Sandbox: Add CLI flag to select minimum enabled TLS version for ledger API server.
CHANGELOG_END
2021-09-14 12:37:38 +02:00
Moritz Kiefer
9a4c9df06a
Implement LF desugaring of interface definitions (#10834)
This only handles the interface definition, not the implementation in
the template. There are also a few rough edges:

1. It maks all choices as consuming.
2. it ignores locations

But for a poc that doesn’t seem too bad.

The tests don’t do anything super useful since the typechecker falls
over but I checked tha tthe generated LF looks more or less reasonable.

changelog_begin
changelog_end
2021-09-13 15:15:31 +02:00
Moritz Kiefer
6d347d4e88
Add daml interfaces to the Haskell LF AST (#10811)
* Add daml interfaces to the Haskell LF AST

Just copied from Sofia’s PR with no changes and stubbed all usages of
it that aren’t trivial.

changelog_begin
changelog_end
2021-09-08 15:48:02 +00:00
Moritz Kiefer
8830eaa2ec
Drop controller can syntax from compiler tests (#10807)
You definitely want to review this with whitespace disabled.

changelog_begin
changelog_end
2021-09-08 15:28:09 +02:00
Moritz Kiefer
e9c8af5024
Bump ghc-lib to include dropped parsing code for generic templates (#10735)
* Bump ghc-lib to include dropped parsing code for generic templates

changelog_begin
changelog_end

* bump snapshot

changelog_begin
changelog_end

* drop old generics file

changelog_begin
changelog_end

* drop other broken file

changelog_begin
changelog_end

* Bump again

changelog_begin
changelog_end

* bump to merged commit

changelog_begin
changelog_end

* and bump snapshots

changelog_begin
changelog_end
2021-09-01 15:35:40 +02:00
Moritz Kiefer
6016633bb7
Construct ParsedModule directly in Daml Repl (#10701)
This is a relatively large change unfortunately which unfortunately
requires reimplementing parts of the logic of the typechecker & core
compilation. I don’t think it is too bad but we might want to think
over time if we can factor this better.

This fixes #10073 and fixes #10664 by referencing the exact types
instead of going via the renamer.

There are some minor changes around error messages for "module not
found" errors. This is because these are now caught in the
typechecker instead of in our own code. We could keep the errors but
it requires duplicating even more logic and I don’t really see what it
buys us so I think I prefer the approach here.

changelog_begin

- [Daml Repl] Fix a bug where bindings with out of scope types would result in error in following lines.

changelog_end
2021-08-30 17:28:16 +02:00
Robin Krom
0c1878530b
test: test for platform independent dars (#10535)
We add a CI test to check that dars don't depend on the underlying
operating system where the dar is build.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-17 18:59:12 +02:00
Sofia Faro
fb09b72f96
Improve divulgence warning message. (#10595)
Based on feedback from @bame-da on issue #9947

changelog_begin
changelog_end
2021-08-17 13:06:03 +01:00
hgrano
4430f52cdc
changelog_begin (#10579)
- [Daml Stdlib] Ord instance added for NonEmpty
changelog_end
2021-08-15 12:52:03 +02:00
Moritz Kiefer
c447898cc9
Fix display of unhandled exceptions in the scenario service (#10572)
fixes #10570

I’m increasingly convniced, that the future failures here are a
maintenance nightmare and we should switch to Either completely but
not in this PR

changelog_begin
changelog_end
2021-08-12 14:35:26 +02:00
Gary Verhaegen
9756bf8104
add minimumOn & maximumOn (#10527)
Requested in #10509. Should we also add `minimumBy` and `maximumBy` for
consistency with `sortBy`?

CHANGELOG_BEGIN
- The DA.List and DA.List.Total modules now export minimumBy, maximumBy,
  minimumOn and maximumOn, respectively behaving similarly to sortBy and
  sortOn.
CHANGELOG_END
2021-08-11 16:34:38 +00:00
Moritz Kiefer
348c6de92c
Add dlint rule to suggest === (#10485)
* Add dlint rule to suggest ===

This rule doesn’t quite work in all cases since you can have types
that have Eq instances but not Show instances. However, I think the
benefits of people learning about this are much larger than the
downsides here of getting a hint that doesn’t apply in edge cases.

changelog_begin
changelog_end

* fix all the tests, why are there so many :(

changelog_begin
changelog_end
2021-08-05 09:44:57 +00:00
Robin Krom
36f3ba8a6a
lsp-types patch for platform independence (#10288)
* fix shake rebuild tests

* patch pretty printing in ghc

* pin linux deps

* pin windows deps

* cosmetics

* address review

* update ghc commit hash

* pin linux stackage deps

* update stack snapshot

* pin windows deps
2021-08-04 21:33:52 +02:00
Remy
41009f79cc
Compiler: Make LF 1.14 the default output (#10394)
CHANGELOG_BEGIN

- [Compiler] Default compiler output LF version is now 1.14

CHANGELOG_END
2021-07-28 12:14:56 +02:00
Remy
72cf2f36d3
LF: replace bazel keyword stable by default (#10410)
to refer to the compiler default LF output.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-27 09:27:03 +02:00
Andreas Herrmann
9c064dac35
Allow imports of internal modules (#10397)
* Allow imports of internal modules

changelog_begin
- [Daml Compiler] Imports of internal modules from stable packages are
  no longer illegal. Previously, the compiler raised an error when it
  encountered imports of internal modules such as
  `DA.Internal.Template`. Such imports are now accepted by the compiler.
  Note, however, that internal modules are still not part of the stable
  API. Fixes https://github.com/digital-asset/daml/issues/10379
changelog_end

* ~unstable~

https://github.com/digital-asset/daml/pull/10397#discussion_r676485891

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-07-26 11:45:52 +00:00
Sofia Faro
b701caab7d
Report divulgence warning at commit location. (#10329)
* Pass commitLocation along in engine warning log.

changelog_begin
changelog_end

* Use commitLocation in diagnostics.

* scalafmt

* update divulgence test

* Fix commitLocation and expected diagnostic locations
2021-07-20 15:47:49 +00:00
Sofia Faro
cf2f79db4e
Register divulgence warning as a diagnostic (#10289)
* Register divulgence warnings as diagnostics

The divulgence warnings for a scenario are registered as a diagnostic,
when there isn't a scenario error. (Rationale: Scenario errors already
include the warnings in their text, after trace log entries.)

Part of #9947, follow up from #10253

changelog_begin
changelog_end

* Rewrite case expression to make it more readable

* Fix a couple integration tests
2021-07-20 09:50:23 +01:00
Sofia Faro
b8e2198873
Separate traces from warnings in engine. (#10253)
* Separate traces from warnings in engine.

I decided to separate the engine warnings from the tracelog after all,
because I think it will make testing and maintenance easier in the
long run.

Part of #9947, follow up from #10179

changelog_begin
changelog_end

* scalafmt

* Apply suggestions from code review

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

* dont use case class for WarningLog

* revert TraceLog changes from last PR

* Scala 2.12 doesnt have ArrayBuffer.addOne :(

* remove isWarnEnabled check

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-07-13 14:24:27 +00:00
Sofia Faro
00d622f268
Make @UNTIL-LF exclusive, add @UNTIL-LF-FEATURE. (#10240)
In the damlc integration tests.

changelog_begin
changelog_end
2021-07-12 10:46:36 +00:00
Moritz Kiefer
6680d368a1
Warn on DA.Exception import (#10201)
* Warn on DA.Exception import

We had a few confused users that imported that module and got weird
errors. The warning should hopefully make things a bit clearer. We
could do this for other modules as well but I’ll leave that for
separate PRs.

changelog_begin

- [Daml Compiler] Importing DA.Exception on LF < 1.14 now produces a
warning that exceptions require Daml-LF >= 1.14.

changelog_end

* Add a test for exception imports

changelog_begin
changelog_end
2021-07-08 16:51:19 +00:00
Sofia Faro
98b5ffee01
Add divulgence warning and test in script service. (#10179)
* Add divulgence warning and test in script service.

Part of #9947, building on the key visibility checks from #10136

This PR adds a divulgence warning inside the traceLog.
I wasn't sure whether:

1. these warnings should be kept in a separate structure from the
   traceLog, and therefore transmitted separately, or
2. these warnings should be kept together with traces, but the severity
   should be tracked and also transmitted over grpc, and warnings should
   be logged as warnings instead of as debug messages, or
3. these warnings should be kept together with traces, but
   logged as warnings instead of debug messages,
4. these warnings should be treated exactly like traces

I'm leaning toward #2, but this PR implements #3.

This PR tests the warning via the script service tests.

changelog_begin
changelog_end

* scalafmt

* Address Moritz's review

* Rename traceLog.add to traceLog.addDebug

* fix test

* Add test using exercise

* add single transaction test
2021-07-06 13:05:52 +01:00
Remy
0a6df5c4db
LF: Clean Interpretation Error (#10145)
* LF: Clean Interpretation Error

part of #9974

CHANGELOG_BEGIN
CHANGELOG_END

* fix

* Address Mortiz' review

* fix
2021-06-30 16:49:48 +00:00
Moritz Kiefer
fa80f1b615
Bump ghcide and upgrade to lsp/lsp-types (#10139)
* Bump ghcide and upgrade to lsp/lsp-types

changelog_begin
changelog_end

* Bump rev

changelog_begin
changelog_end
2021-06-30 12:16:12 +00:00
Stefano Baghino
bb4641756f
Daml assistant capitalization (#10140)
changelog_begin
changelog_end

- DAML -> daml
- Assistant -> assistant

The capitalization of the latter fixed one occurrence of a capitalized 'A'
which was inconsistent with the vast majority of uncapitalized 'a's.
2021-06-29 14:32:44 +02:00
Moritz Kiefer
d4150ac078
Refactor error reporting in Daml Repl (#10118)
* Refactor error reporting in Daml Repl

fixes #10098

As mentioned in that issue, the current behavior is a mess which
silently drops errors in certain cases. This PR switches things around
so that errors are reported to the client and we print them there
making sure that no error should ever get lost.

changelog_begin
changelog_end

* Bump timeout

changelog_begin
changelog_end
2021-06-25 14:08:44 +00:00
Remy
a6b536f3c4
Compiler: Make LF 1.13 the default output (#9907)
* Compiler: Roll LF Version

Fix #8591

CHANGELOG_BEGIN
- [Compiler] Default ouput LF version is now 1.13
CHANGELOG_END
2021-06-24 11:58:50 +02:00
Moritz Kiefer
85e383ce0b
Fix --max-inbound-message-size flag in Daml Repl (#10078)
fixes #10072

changelog_begin
changelog_end
2021-06-23 10:10:40 +02:00
Remy
58b1c4e771
Speedy: Refactor contract Id/Key callback (#10033)
CHANGELOG_BEGIN
CHANGELOG_END
2021-06-22 16:34:28 +02:00
Moritz Kiefer
febca5d62d
Use ScenarioRunner.submit in Daml Script (#10053)
* Use ScenarioRunner.submit in Daml Script

changelog_begin
changelog_end

* privatize ledger variable

changelog_begin
changelog_end

* drop space

changelog_begin
changelog_end
2021-06-17 17:12:45 +00:00
Sofia Faro
2f5186938e
Allow constraints in any position in data-deps. (#10049)
This fixes #8411. It turns out the issue was some missing parentheses.

changelog_begin
changelog_end
2021-06-17 15:45:10 +01:00
Moritz Kiefer
836a82a6b6
Add proper error handling for missing contract keys (#9972)
* Add proper error handling for missing contract keys

These are clearly not internal errors so we should not be calling
`crash` here. Canton in fact already started string matching on the
crash message which is definitely not what we want.

changelog_begin
changelog_end

* backwards compat

changelog_begin
changelog_end

* fix tests

changelog_begin
changelog_end
2021-06-14 09:12:30 +00:00
Remy
512f1fd87d
LF: Preview version of LF 1.14 (#9906)
+ Preview support for Exceptions.
+ byKey flag for transaction nodes.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-03 20:40:53 +02:00
Sofia Faro
e38bb4a55d
Make data-deps exception tests version-aware. (#9870)
* Make data-deps exception tests version-aware.

This PR changes the exception data-dependencies tests to test cross-version imports of exceptions (once we release exceptions in preview).

It also removes the last exceptions TODO from the Haskell side, other than changing `featureMinVersion` for once we start releasing excepions.

Part of #8020

changelog_begin
changelog_end

* qualify everything

* typo
2021-06-01 13:18:29 +00:00
Moritz Kiefer
2a1e1ba1d5
Add a Foldable instance for Set (#9860)
changelog_begin
changelog_end
2021-06-01 10:54:20 +00:00
Rafael Guglielmetti
6af6c930a3
Fix behavior of Math.sqrt at 0 (#9818) (#9828)
* Fix behavior of Math.sqrt at 0 (#9818)

CHANGELOG_BEGIN
[Daml Compiler] Ensure that sqrt(0.0) == 0 and 0 ** 0 == 1
CHANGELOG_END
2021-05-31 15:25:47 +02:00
Sofia Faro
f355931a59
Fix typeclass detection in data-dependencies (#9830)
* Fix typeclass detection in data-dependencies

Fixes #9689 which was actually caused by misinterpreting a constraint
synonym as an empty typeclass.

This PR fixes and deduplicates the logic for detecting typeclass
definitions in data-dependencies. It also tries to avoid lifting
constraint tuples unnecessarily (since constraint synonym
definitions are already lifted). And for any constraint tuples
that are lifted, it picks a more unique name.

The PR adds a regression test, and a test for nested constraint tuples.

changelog_begin
changelog_end

* Preserve nice comment.
2021-05-28 12:25:46 +01:00
Remy
1f021b25c6
LF: Drop Builtin Exceptions completly (#9790)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-26 19:30:44 +02:00
Sofia Faro
7a7b5fee76
Add a data-dependencies test for stdlib exceptions. (#9799)
* Add a data-dependencies test for stdlib exceptions.

changelog_begin
changelog_end

* fix test and run damlc test
2021-05-26 10:04:43 +01:00
Robin Krom
a336363020
ghc-lib: update (#9742)
* ghc-lib: update

CHANGELOG_BEGIN
CHANGELOG_END
2021-05-25 15:52:39 +02:00
Remy
8ef93611fa
Scenario: Test ArithemticError (#9757)
Two integration-type tests:

- An uncaught arithmetic error
- A caught arithmetic error

This is part of #8020

CHANGELOG_BEGIN
CHANGELOG_END
2021-05-25 14:43:27 +02:00
Sofia Faro
cd2ed07a50
Rename ContractError to PreconditionFailed (#9782)
* Rename ContractError to PreconditionFailed

Part of #8020

changelog_begin
changelog_end

* Packaging.hs mistake
2021-05-25 10:11:37 +01:00
Sofia Faro
765d7e3f53
Throw ContractError in template precondition field (#9760)
* Throw ContractError in template precondition field

changelog_begin
changelog_end

* s/pre-condition/precondition/where relevant
2021-05-20 19:10:25 +00:00
Remy
a2775605d8
LF: change format of ArithmeticError message (#9761)
in order to follow LF conventional syntax.

CHANGELOG_BEGIN
CHANGELOG_END
2021-05-20 20:10:31 +02:00
Moritz Kiefer
3827f82a7a
Fix consumedBy in rollback nodes for scenario service (#9746)
changelog_begin
changelog_end
2021-05-20 12:07:13 +00:00
Sofia Faro
2ba5ca7ca2
Make DA.Assert throw AssertionFailed instead of GeneralError (#9747)
* Make DA.Assert throw AssertionFailed instead of GeneralError

changelog_begin

- [Daml Standard Library] `assert`, `(===)`, and other assertion functions (see DA.Assert) now use a new `CanAssert` typeclass constraint instead of `CanAbort`, in preparation for exceptions support.

changelog_end

* Add CanAssert instances for Script and Trigger.

* buildifier-fix

* update script test runner output

* Fix flag and add tests.

* update script test runner again
2021-05-20 12:01:50 +00:00
Miklos
f5c84a2aa4
Daml-LF: Damlification of Scala/Haskell files (#9666)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-20 09:52:33 +02:00
Sofia Faro
1794a6f969
Refactor GenerateStablePackages (#9744)
* Refactor GenerateStablePackages

Summary of changes:

* Split GenerateStablePackages executable into a library (containing the stable package data) and an executable (that writes out the packages)

* Hook up data-dependencies test to the new library so we don't have to manually update the number of stable packages every time we add a stable package or release a new LF version.

changelog_begin
changelog_end

* buildifier-fix
2021-05-19 13:57:09 +01:00
Moritz Kiefer
bb5dd4cbf3
Fix locking of envScenarioContexts (#9736)
This fixes a race condition in our handling of scenario contexts. See
the comments for details. I verified with a bunch of extra logging
that this is what is actually failing in our tests. I’ll try to
upstream the logging separately since ideally I’d like to have that in CI.

I ran all integration tests with --runs_per_test=20 over night and
with this change I’m no longer able to get it to flake so dropping the
flaky marker.

fixes #6910

changelog_begin
changelog_end
2021-05-19 12:51:30 +02:00
Sofia Faro
b55613be6c
Parallelize the data-dependencies test. (#9733)
* Parallelize the data-dependencies test.

It runs about twice as fast on my laptop (240s -> 120s) when allowed to
run tests in parallel. I'm not sure this will work or make a huge
difference when it comes to timeouts in CI, but it's worth a shot.

changelog_begin
changelog_end

* TASTY_NUM_THREADS := 3

* set bazel tag for test
2021-05-19 10:03:00 +00:00