Commit Graph

1654 Commits

Author SHA1 Message Date
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
Florian Klink
14ecfd7bae infra: add acls for google_storage_objects create via tf (#2460)
This ensures objects in the google storage bucket created by terraform
have the proper publicRead acl.
2019-08-08 19:13:15 +02:00
Martin Huschenbett
8fc5b62bd8
Avoid one indirection for dictionary construction (#2456)
* Avoid one indirection for dictionary construction

For every constructor `Foo` we generate a function `$ctor:Foo` which calls
the DAML-LF constructor for `Foo`. This function is useless since GHC already
creates a function `$WFoo` for us which does the same. This PR remove the
`$ctor:...` functions for type class dictionaries.

This makes a bit of a mess in the `Ctors` data type. This will be cleaned up
when all `$ctor:...` functions are finally gone.

* Fix construction of XInstance templates
2019-08-08 19:12:44 +02:00
nickchapman-da
5ebc5e4d19
Hlb apps package discovery (#2455)
* suggested tiny code simplifications

* fix package discovery for Nim/Chat ledger apps
2019-08-08 16:50:17 +01:00
Gary Verhaegen
87d2fd4f31 remove sandbox-head-tarball (#2458)
We can get the same jar out of the SDK tarball.
2019-08-08 16:34:00 +01:00
Robin Krom
6ccb18be08
language: put pkg version into pkgname (#2454)
This is a small step to solve the package name ambiguity problem.
Putting the package version into the package name allows to import a
package two times with different versions.
2019-08-08 16:31:09 +02:00
Stephen Compall
92f2dbf2eb
lf-value-json: don't hardcode String cids; more consistent test runtimes, with special cases called out (#2374)
* use Arbitrary for TypedValueGenerators to get existing 'sized' uses

* test Option[Option[Long]] specifically

* derive Arbitrary ValueMap solely by implicit means, for the sized

* make ApiCodecCompressed Cid-generic

* first sample JSON tests

* navigator adaptation to Cid genericity

* scalafmt

* Table-ify JSON tests

* more navigator adaptation

* adapt http-json to Cid-agnostic JSON codec

* stem the tide of namespace pollution wrought by the "mixin to import" style

* show line # of failed JSON cases

* naturally limit the nesting factor of generated types

* move SortedLookupList generation to data-scalacheck library

* more sample JSON cases from design doc

* add more parameters to ApiCodecCompressed

- AbsoluteContractId seems like it will give rise to incoherence
- and there are going to be two parameters
- so we might as well just parameterize the whole codec

* test canonical and equivalent encoded forms

* test lists

* test very very nested optionals

* many more optional-related tests
2019-08-08 09:02:05 -04:00
Martin Huschenbett
4d0a62801c Fix pretty printing of empty annotations in DAML-LF AST (#2453)
For example, we print two spaces if there's no annotation between `def` and
the function. This PR fixes this by using the `empty` document instead of the
document containing the empty string. (Please don't ask me why they are
different.)
2019-08-08 12:11:56 +00:00
Gerolf Seitz
6993232593 Fixed a bug that prevent sandbox from loading empty workflow ids. (#2446)
This happened because we translate empty workflow ids to None in the
API-to-domain translation layer. When we store the workflow id, we actually
convert the None case back to an empty string (and not a null value).

When loading the workflow id from the database, we parse the column as a regular
LedgerString, but unfortunately these cannot be empty. Therefore using empty workflow
ids on postgres has been broken since workflow id has changed from a tagged string
to LedgerString.
2019-08-08 11:29:21 +00:00
Shayne Fletcher
1d33433142
Update hlint (#2448) 2019-08-08 07:09:12 -04:00
Gerolf Seitz
d52d3bc451
Semantic tests fall back to wall-clock time if timeservice is not available (#2419) 2019-08-08 13:08:57 +02:00
Moritz Kiefer
9df8c7878e Add link to deploy URL in daml ledger --help and daml deploy --help (#2451)
* Add link to deploy URL in  daml ledger --help and daml deploy --help

* Update daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-08-08 08:41:22 +00:00
Moritz Kiefer
0c7cb171b7 Release 0.13.18 (#2447) 2019-08-07 17:13:13 +00:00
Leonid Shlyapnikov
c7b5482e43 JWT HMAC256 Authorization (#2389)
* Starting //ledger-service/jwt module

adding //3rdparty/jvm/com/auth0:java_jwt dependency, there are Scala JWT
libraries, however they are either immature or unsupported

* Keys and JWT generator utility/wrapper, WIP

* Keys and JWT generator utility/wrapper, WIP

* RSA Keys generator

* HMAC token validation added to command/create endpoint

HMAC is actually not good, need RSA, this is a shortcut for DABL team.

* Renaming

* command/create test cases fixed to pass OAth2 Bearer token

* removing unused method

* JWT authorization for /command/exercise

* the rest of the endpoints uses JWT authorization

removed hardcoded JwtPayload

* cleanup

* cleanup

* http status code in the header and in the json body should match now

* NotFound would also return a json body now

* Removing hardcoded JWT in the integration test

it is generated using the JwtSigner.HMAC256

* cleanup

* fixing error message

* instructions for making a JWT HMAC token for dev
2019-08-07 16:26:26 +00:00
Moritz Kiefer
c5664fe5b5
Speed up dependency information chasing (#2444)
Comparing FilePaths is really slow so by mapping them to Ints, we can
speed up dependency chasing significantly.

We might want to switch to doing some kind of global hash consing of
file paths at the Shake level but for now, this seems like a nice
improvement while not being too invasive.

This is roughly an ~8s speedup on my testcase.
2019-08-07 16:51:38 +02:00
Moritz Kiefer
9cd58e24fa
Fix VSCode invocation in "daml studio" (#2445)
Despite, a lot of searching around, I couldn’t find any information on
why exactly quoting "code" causes issues but removing the quotes seems
to fix the issue ¯\_(ツ)_/¯
2019-08-07 16:38:03 +02:00
Remy
5dd7f1afcf java-codegen: fix broken language-support/java/codegen/src/it/dar/integration-tests-model-1.0.dar (#2443) 2019-08-07 13:56:36 +00:00
nickchapman-da
8f9a781750
hlb, use Int64 / Fixed E10 as appropriate (#2440) 2019-08-07 13:27:58 +01:00
Martin Huschenbett
966dfbd400 Add test for manually desugared form of the generic proposal workflow (#2442)
Having a test that demonstrates how the desugared form of the template syntax
looks like seems to be a good idea.
2019-08-07 11:53:52 +00:00
associahedron
476181e9b8 Deliver additional detail in daml deploy documentation. (#2439)
* More detail about upload-dar and allocate-parties.

* Put the two steps in the right order.
2019-08-07 11:14:46 +00:00
Moritz Kiefer
8b171e50fb Release SDK 0.13.17 (#2437) 2019-08-07 10:40:41 +00:00
nickchapman-da
2b1204ceac
hlb, fix bug where sandbox is not being run on a dynamically allocated port (#2428) 2019-08-07 11:16:53 +01:00
Gary Verhaegen
a15256571a
macOS: cache the bazel repo cache (#2420) 2019-08-07 11:04:49 +01:00
associahedron
8916edef18
Adding some docs for daml deploy and daml ledger. (#2438)
* Some docs for daml deploy and daml ledger.

* Adding none in code blocks.

* Substitute*
2019-08-07 10:45:00 +01:00
Moritz Kiefer
b3e1833e71
Use FastString where possible and speed up conversions to Text (#2436)
This cuts allocations on my testcase by about 2% and provides a
similar speedup.
2019-08-07 11:03:40 +02:00
Martin Huschenbett
c0a07e7e07
Use template syntax in IOU proposal test (#2435)
Until now the test used the manually desugared syntax for the `Iou`
template. Now, we use the proper `template` syntax. The test is also
renamed from `IouDSL` to `ProposalIou` since the DSL would be confusing
after this change. In fact, we're mostly testing that the
instantiation of `Proposal a` with `a = Iou` actually works.
2019-08-07 10:04:45 +02:00
Martin Huschenbett
c63782791e Remove tests that are obsolete with new template desugaring (#2434)
* Remove tests that are obsolete with new template desugaring

The tests were only relevant during the transition phase to the new
template desugaring. Since that desugaring has landed the test don't
provide value anymore and can be deleted.

* Fix super class dictionary detection
2019-08-06 18:22:49 +00:00
Moritz Kiefer
d95d25fd2f Speed up convertModuleName (#2432)
On my testcase, this cuts allocations by about 6%.
2019-08-06 18:14:34 +00:00
associahedron
0673ceecac Fix daml ledger navigator configuration. (#2430)
* Fix daml ledger navigator

* Add newline after dots
2019-08-06 17:57:52 +00:00
Martin Huschenbett
15f94783d8
Use tasty-golden for daml-doc's golden tests (#2429)
* Use tasty-golden for daml-doc's golden tests

With our hand rolled version of golden tests it is pretty painful to update
the golden files when they must change. After this PR it is as simple as
```
> bazel run //compiler/damlc/tests:daml-doc -- --accept
```

* Address indentation issues

* Use diff command line tool for diffing

* Removed new unused dependecy on Diff package

* Ignore carriage returns in diff
2019-08-06 19:47:52 +02:00
Shayne Fletcher
1308c8232b
hlint => dlint everywhere (#2409) 2019-08-06 13:42:36 -04:00
Moritz Kiefer
180313b404
Unrecursionschemify freeVars calculation (#2427)
This cuts allocations and speeds things up (admittedly not by a whole
lot) but it also lets us delete a bunch of code which is always nice.
2019-08-06 19:33:11 +02:00
Anup Kalburgi
629266a445
Addressing comments on a previous PR #2371 (#2408) 2019-08-06 12:48:54 -04:00