Commit Graph

1686 Commits

Author SHA1 Message Date
Martin Huschenbett
803fee057f Show function names in stack trace on failing scenario (#2516)
* Show function names in stack trace on failing scenario

So far, we've only shown the location of the function but not its name.
Now, we add the name of the function as well.
2019-08-14 09:16:07 +02:00
Shayne Fletcher
117afdafa1 Upgrade hlint (#2524) 2019-08-14 08:46:31 +02:00
Stephen Compall
f77e4229a2
document lf-value-json's encoding of various types (#2519)
* copy design draft for JSON LF encoding with minimal changes

* literal block formatting

* :: on its own

* only describe the variant notation we've chosen

* wrap

* mark some text literal

* correct reason why null is not a valid Unit

* alignment

* explain that the presence of type variables has no bearing on nested Optional encoding

* correct copyright header

* quotes and subscripts

* remove disallowed examples of variants

* positive? negative?

* you never know when JavaScript will ruin your day

* what's {} anyway

* we are talking about JSON, you know
2019-08-13 17:56:33 -04:00
Stephen Compall
0d72f84fe8
new JSON formats for some DAML-LF data (#2463)
* daml-lf: make match2's fallback lazy, and add tuple2 syntax for better inference

* lf-value-json: when decoding, branch on type, *then* on value

- restores totality checking for interface ADT
- makes alternate input formats obvious at a glance
- lets us restructure in the future to cache type branch lookups

* lf-value-json: support numbers for int64s

* lf-value-json: test failures and more timestamp cases

* lf-value-json: adapt timestamp decoding to new rules

* lf-value-json: cleanup

* lf-value-json: decode Number as decimal

* lf-value-json: forbid yet another timezone format

* lf-value-json: don't copy

* lf-value-json: replace {Some, {None optional format with nest-sensitive [] format

* lf-value-json: round decimals rather than rejecting, in either string or number form

* lf-value-json: support output to JsNumber for int64s and decimals, separately

- not dependent on JavaScript safe integer range, because that is not
  the purpose of this option

* lf-value-json: uncomment some now-tested rounding cases

* allow None record fields to be omitted in object syntax

* release notes
2019-08-13 17:00:08 -04: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
Leonid Shlyapnikov
678ac0d725
Fixing the copyright header (#2522) 2019-08-13 14:25:28 -04:00
Moritz Kiefer
3eb112e4ca
Only report progress when client supports it (#2517)
* Only report progress when client supports it

This fixes an issue that some people encountered when running hie-core
in Emacs with a version of haskell-lsp that does not understand
progress events.

* Fix tests

* More test fixes
2019-08-13 20:00:21 +02:00
Moritz Kiefer
3d0699a9a8
Add an option to build Haskell code with DWARF debug info (#2504)
For now, this only works on Linux (that’s a GHC limitation as far as I
know) and you have to enable it by setting the GHC_DWARF env var to a
non-empty string.
2019-08-13 20:00:14 +02:00
Leonid Shlyapnikov
689d4d876c
Removing JWT verification (should be done by the ledger... eventually) (#2501)
* Removing JWT verification (should be done by the ledger... eventually)

Adding JwtDecoder that does not do JWT signature validation at all.

* Updating README

* Changes to allow overriding the default JWT decode only logic.

You can pass a function that does more than just decoding.
2019-08-13 13:43:26 -04:00
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
Andreas Herrmann
a1c21d9829
Update rules haskell (#2509)
* update rules_haskell

* adapt rules_haskell patches

* io_tweag_rules_haskell --> rules_haskell

* io_tweag_rules_haskell --> rules_haskell

* haskell:haskell.bzl --> haskell:defs.bzl

* rules_haskell_dependencies
2019-08-13 16:46:31 +02:00
Gary Verhaegen
1d7622c35d
exclude ledger migrations from copyright update (#2514) 2019-08-13 15:24:38 +01:00
Robin Krom
db59c228c1
language: tests: tests for merging and non-toplevel main files (#2515)
We add tests for the `merge-dars` command and check that we can handle
main files that are not at the top source level.
2019-08-13 15:47:41 +02:00
Richard Kapolnai
b4a9ee914f Fix URL to daml code (#2513) 2019-08-13 13:31:04 +00:00
Moritz Kiefer
da3f295507
Add commands for inserting and deleting lines to ide-debug-driver (#2511) 2019-08-13 15:25:26 +02:00
Gerolf Seitz
66f85ca530
Add ContractKeys test. (#2491)
This test represents the behavior of contract keys before the change of behavior in DAML LF 1.DEV.
The existing ContractKeys test is renamed to ContractKeysSubmitterIsMaintainer.

The `LedgerTestSuiteRunner` now uses a fixed number of
threads for the runner threadpool. This way we don't flood
the CPU with threads when using a CachedThreadPool.
2019-08-13 15:15:51 +02:00
Robin Krom
8400e33cb7
language: fix: compute correct source root when building dar (#2500)
* language: fix: compute correct source root when building dar

Previously we just took the base directory of the main file, which is
wrong when the main is deeper down in the module structure.

* hlinting

* reuse moduleImportPaths
2019-08-13 13:45:22 +02:00
Moritz Kiefer
052cbe0fd4
Fix more leaks in Development.IDE.Core.Shake (#2507)
We accumulated some thunks in those variables that leak over long
sessions.
2019-08-13 13:36:03 +02:00
Gary Verhaegen
7363d73500 copyright: do not add extra blank line (#2502) 2019-08-13 12:52:07 +02:00
Remy
c2e2e007e7 Fix release notes about improper freeze of 1.6 (#2489)
* daml-lf: clean up a bit how verion are handle

* fix releases not about imporper release of #1866

* address Gerolf's comments
2019-08-13 08:10:24 +00:00
Gerolf Seitz
9d1af43ec8
Port WitnessesIT to the new test infrastructure. (#2486) 2019-08-13 09:24:08 +02:00
Martin Huschenbett
c2940705ff Remove unused message from scenario service protobuf (#2503)
I assume the plan was to implement stack traces. I intend to do that as well
but the message type does not fit my approach. Thus, let's remove it first.
2019-08-13 07:07:38 +00:00
Martin Huschenbett
0ca2601cd9 Print stack traces in the scenario on failure (#2497)
* Print stack traces in the scenario on failure

Currently, we only print the last source location, which is not
particularly helpful for debugging. Now, we put all source locations we
encounter during execution on the continuation stack and print them when
a scenario fails. This PR does not print the names of entered functions
or choices. We leave this for a future PR.

* Address Moritz' comments
2019-08-12 19:05:19 +00:00
Moritz Kiefer
b87215e111 Remove the --dump-pom flag from damlc package (#2496)
It doesn’t serve any purpose at this point so we might as well get rid
of it.
2019-08-12 17:49:43 +00:00
Gerolf Seitz
8f14c19fc9 Move assertion on exception type to match block. (#2495)
Addresses
https://github.com/digital-asset/daml/pull/2282#pullrequestreview-272786088
2019-08-12 12:52:01 -04:00
Anup Kalburgi
c96dae3a52
Visual ide (#2467)
Generate visualization from IDE
2019-08-12 12:42:45 -04:00
Moritz Kiefer
9ce0d414c4
Force values in setValues and getValues (#2494)
Otherwise, we can end up retaining references to the old map which
prevent it from being garbage collected.

On a simple testcase that repeatedly opens and closes a module, this
seems to make memory usage constant whereas it was increasing
each time before.
2019-08-12 17:40:12 +02:00
associahedron
ed0d5667c2 damldocs: Small type rendering improvements. (#2492)
* Add parentheses around type operators in expressions.

* Remove levity arguments from (->) in stdlib docs

* Avoid parenthesizing type-level literals
2019-08-12 15:28:57 +00:00
Robin Krom
829cb4cef5
Daml stdlib with versions (#2479)
* language: build daml_stdlib with a version in the package name.

* versioned daml-stdlib in damlc

* reformat bazel files

* fix daml_doc_test
2019-08-12 16:05:28 +02:00
associahedron
b16f937d7e damldocs: Show relevant instances for types and classes. (#2487)
* Add md_instances field to ModuleDoc

* Extract instances

* Add instance fields to class and type docs.

* Implement distributeInstanceDocs

* Use Maybe list instead of list.

* Render instance docs.

* Add instance data in tests and add a golden test.

* Rename to orphan typeclass instances.
2019-08-12 13:48:46 +00: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
Gary Verhaegen
bf5995f529
remove mentions of da-int servers (#2485) 2019-08-12 10:42:41 +01:00
Martin Huschenbett
bbfa0a1318 Simplify test for issue with GHC.Tuple.Unit (#2475)
* Simplify test for issue with GHC.Tuple.Unit

* Make sure tests actually produces GHC.Tuple.Unit somewhere
2019-08-12 09:20:40 +00:00
Gerolf Seitz
816b93e2c2
Produce a more compact test summary output. (#2483)
Example:

ContractKeys
- Divulged contracts cannot be fetched or looked up by key ... Success
- Contract Keys should reject fetching an undisclosed contract ... Success
- Contract keys should be scoped by maintainer ... Success

Divulgence
- Divulged contracts should not be exposed by the transaction service ... Success
- Divulged contracts should not be exposed by the active contract service ... Success

Identity
- A ledger should return a non-empty string as its identity ... Success

SemanticTests
- Test:consistency_doublespend1 ... Success
- Test:contract_keys_test ... Success
- Test:consistency_doublespend2 ... Success
- Test:authorization_success1 ... Success
- Test:authorization_rule2_failure ... Success
- Test:authorization_rule1_failure ... Success
- Test:privacy_projections1 ... Success
- Test:consistency_doublespend3 ... Success
- Test:authorization_success2_delegation ... Success

Time
- Advancing time should return the new time ... Success<Paste>
2019-08-12 09:13:38 +02:00
Rohan Jacob-Rao
c2f315d2ba
Support generic templates (#2465)
* Upgrade ghc-libs supporting generic templates
* Update Proposal and ComposedKey tests to generic template syntax
* Temporarily patch daml-doc test output (will need to fix for template instances)
2019-08-09 17:15:51 -04:00
Remy
a156880dc2 engine: cleanup environment (#2480) 2019-08-09 19:53:40 +00:00
Remy
55c573f29d Based the interface reader on the archive decoder. (#2441)
* daml-lf: base interface reader on archive decoder

* fix call to InterfaceReader.readInterface

+ cosmetic changes

* daml-lf: decoder can process only serializable data
2019-08-09 18:15:46 +00:00
Aman Manocha
8da226ac0e Allow extractor to write to custom sinks (#2366)
* Minimum changes to reuse extractor as library

* Make Writer independent of Target so that Target can be sealed.

* treat writerExtractor as a sort of pseudo-typeclass
2019-08-09 13:10:06 -04:00
Moritz Kiefer
2b690fd420 Increase timeout on lsp-tests (#2478)
Now that they are no longer marked as flaky on Windows, we seem to be
hitting the actual Bazel timeout sometimes.
2019-08-09 15:32:32 +00:00
associahedron
2262c5add0
damldocs: Show only exported things. (#2477)
* Add exports to doc ctx

* Filter out unexported things.

* Added a golden test

* Fix missing constructors.

* Hide unexported class members

* Add rst golden test as well

* Remove unnecessary HIDEs from stdlib.

* lint
2019-08-09 16:12:47 +01:00
Stefano Baghino
afa4659292
New Ledger API test tool (#2282)
* New acceptance test tool prototype

* Fix transaction filter helper

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r308081386

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r308082432

Moreover, creates specific helpers for test DAML code.

* Move helpers from session to context

Remove a circular dependency between session and context, and limits the
usage of implicits.

* Run tests with ledgers out of process

* Prepare for drop in

* Temporary timeout increase

* Move bulk of the logic to the test runner

* Have a map of tests for CLI integration

* Timeout per-test, runner uses context, renaming

* Allow usage of time service, integrate semantic tests

* Integrate CLI SSL configuration

* Integrate failure expectation CLI option

* Integrate with failure output verbosity CLI option

* Integrate with test listing and picking CLI options

* Integrate with timeout scaling CLI option

* Integrate with command TTL CLI option

* Review CODEOWNERS

* Drop previously unimplemented CLI parameters

* Expand test todo list to encompass latest additions

* Deduplicate some testing infrastructure, swap in new test tool

* Remove unused rule

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311045444

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311051974

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311035287

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311055290

* WIP

* Make gRPC thread factory spawn non-deamon threads

* Remove debug prints, complete divulgence test (missing assertion messages)

* Try to detect assertion failure line number

* Add Sandbox binary that starts an ephemeral postgres instance

This allows us to use the client_server_test bazel macro to run against
the sandbox backed by postgres.

Fixes #1543

* Add Sandbox binary that starts an ephemeral postgres instance

This allows us to use the client_server_test bazel macro to run against
the sandbox backed by postgres.

Fixes #1543

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311400695

* Remove TlsConfiguration duplicate, move original to commons

* Make assertion more readable

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

* Fix build errors introduced in previous commit

- exclude time service tests from reference-v2
- add copyright header to TlsConfiguration

* Complete divulgence test and address review comments

Restores comments from original divulgence tests and strives to be as
close to them as possible.

- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311429169
- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431156
- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431913

* Delete old divulgence tests

* Restore methods to fetch contracts by template identifier

* Run conformance tests on in-memory sandbox

* Run conformance tests on the persistent sandbox

* Remove workflow identifier workaround

* New contract keys test (#2452)

* Set channel type for LedgerSession

* Add ContractKeysIT

* Run tests against reference-server v2

* Removed the old ContractKeysIT. However, ...

... I cannot remove ContractKeysChecks completely, because we have
another test path for DARs created prior to DAML-LF 1.6, which doesn't
have the submitter == maintainer restriction for contract keys.

* Use codegen instead of custom code

* Add missing copyright headers

* Drop sandbox conformance test suite (seems to not work on Windows CI)

* Make time simpler

* Test tool tests to run only semantic tests

* Make CI behave more consistently

* Add missing files to run tests on Postrgres

* Fix flaky divulgence test, introduce readable identifiers

* Increase sandbox conformance tests timeout

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r312363246

* Reintroduce test resource extraction

* Read semantic tests from the classpath rather than Bazel

* Use codegen types for ContractKeys integration test

allocateParty returns Primitive.Party and create and exercise also
accept Primitive.Party. This way we don't have to keep a String and
Primitive.Party representation around.

* Bump timeout for sandbox conformance tests

* Remove dependency on Bazel runfiles
2019-08-09 17:00:37 +02:00
Moritz Kiefer
d388c5692b
Upgrade haskell-lsp and lsp-test (#2474)
* Upgrade haskell-lsp and lsp-test

There have been some fixes upstream that should hopefully mean that we
no longer need to mark the lsp-tests as flaky on Windows. I am having
trouble reproducing the flakiness locally, so let’s see what happens
on CI.

* Also bump stack.yaml
2019-08-09 15:09:59 +02:00
Martin Huschenbett
3c03d8c33b Simplify how we compute the label of a data constructor (#2473)
Currently, we pass the flavour of the type constructor around although that
is cheaply computable from the data constructor itself. Thus, don't pass the
flavour around.
2019-08-09 11:39:58 +00:00
Moritz Kiefer
491d13a276
Add an ide-debug-driver to make it easier to find leaks (#2472) 2019-08-09 12:48:05 +02:00
Martin Huschenbett
e9e96be3da Avoid one indirection when constructing enum values (#2469)
For every enum constructor `Foo` we produce a function `$ctor:Foo` whose
value is simply `Foo`. When we convert `Foo` to DAML-LF, we convert to
a call of `$ctor:Foo`. Since enum constructors are always fully applied,
this indirection is useless. Thus, we remove it in this PR.
2019-08-09 09:01:36 +00:00
Gerolf Seitz
353a19c9ae Fix shutdown order to avoid dead letter logging when stopping sandbox (#2471)
It looks like that closing the LedgerApiServer before closing the
AkkaExecutionSequencerPool (AESP) leads to a non-deterministic bunch of dead
letter warnings when stopping sandbox.

Closing the AESP first avoids these warnings.

Fixes #1886
2019-08-09 08:27:17 +00:00
Martin Huschenbett
9b1d5c8c32 Avoid duplicate record constructors (#2466)
GHC produces a function `$WFoo` for every record data constructor `Foo`.
The conversion to DAML-LF produces a function `$ctor:Foo` which does exactly
the same. We stop doing this and use the `$WFoo` function instead. Since GHC
does not produce `$WFoo` for newtypes, we need to produce these nevertheless.

I'll leave solving the corresponding issue for variant types to another PR.
2019-08-09 07:24:20 +00:00
Martin Huschenbett
53de4511ce Make DAML internal functions version independent (#2464)
Right now, the set of internal functions seems to depend on the DAML-LF
version although it actually doesn't. Since GHC is smart enough this doesn't
bite us but doesn't feel particularly clean either. If the internal functions
ever start to depend on the DAML-LF version again, we should probably put
them into the environment of the conversion to DAML-LF.
2019-08-08 18:32:10 +00:00
Martin Huschenbett
f357b2f0b7 Remove compiler code to inject DAML-LF primitives for old desugaring (#2462)
The code removed was responsible for injecting DAML-LF primitives for
`create`, `exercise`, etc. for the old template desugaring. These code
paths are not hit anymore with the new template desugaring.
2019-08-08 18:04:15 +00:00
Moritz Kiefer
bdd665fcf8
Only change project root once (#2459)
* Only change project root once

As described in #2449, calling withProjectRoot' twice breaks with
relative paths and is also just silly so this PR fixes this by
factoring out the actual logic from init from execInit which does the
project root thingy.

* Add a regression test
2019-08-08 19:56:04 +02:00