Commit Graph

837 Commits

Author SHA1 Message Date
gleber
40ce2b9be8 Unify semantic test between sandbox IT and Ledger API Test Tool (#1171)
* Add RemoteApiProxy fixture type.

This is in preparation for using Sandbox IT suite as part of the Ledger API Test
Tool.

* ledger-api-test-tool: Drop reset functionality.

This is no longer necessary for the tool and it does not scale with the types of
tests in the suite.

* integration-tests: Fail if the server under fixture is stuck.

This makes sure that a server getting stuck will get detected by a test, instead
of ignoring it and potentially allowing the server to linger.

* integration-test: Make semantic testing runs independent.

It manges parties and command identifier to include a unique (random) suffix in
all ledger-commited identifiers. This allows the test to run against a Ledger
API without reseting it.

* ledger-api-test-tool: Unify test code using scenario runner with IT suite.

This reuses the scenario runner test code from the IT suite, instead of
reimplementing it. This should be a no-op (except for tests reports formatting).

* Review fixes.

* Ledger API Test Tool: Provide logback config.

This quites Ledger API Test Tool output.

* Make sure akka threads are terminated at end of test runs.

This makrs Akka threads to be daemons, hence forcing them to be closed at the
end of Ledger Api Test Tool.

* Use Ledger API Test Tool in tests of reference server.

* Add Apache commons-lang3.

* Ledger API Test Tool: Implement custom test reporter.

This addresses two needs:
- avoid using buggy scalatest test reporter;
- pretty-prints test results prettier.

* dade-copyright-headers: return success on successful reformatting.
2019-05-28 09:58:58 +00:00
Martin Huschenbett
c1b98f8f1d
Back parseInt/parseDecimal by DAML-LF primitives when available (#1415)
* Back parseInt/parseDecimal by DAML-LF primitives when available

DAML-LF 1.5 introduces two new primitives `FROM_TEXT_INT64` and
`FROM_TEXT_DECIMAL`. We translate `parseInt` and `parseDecimal` to
these primitives when compiling to DAML-LF 1.5 or later.

This fixes #1398.

* Fix DAML-LF decoder (Scala)
2019-05-28 11:15:40 +02:00
Martin Huschenbett
bd2773048e Allow leading plus sign in parseInt/parseDecimal (#1416)
* Allow leading plus sign in parseInt/parseDecimal

This behaviour is in line with the newly added DAML-LF primitives
`FROM_TEXT_INT64` and `FROM_TEXT_DECIMAL`.

* Update release notes

* Allow leading plus in parseDecimal as well
2019-05-28 07:30:27 +00:00
Martin Huschenbett
3e935dd937
Generic templates: support ensure and agreement clauses (#1411)
I don't add tests since they will all become useless once we desugar the
surface syntax to the new type class representation. At this point all
existing tests will kick in.

This is part of #1387.
2019-05-28 09:01:07 +02:00
Martin Huschenbett
2605f00804 Freeze DAML-LF 1.dev into DAML-LF 1.5 (#1408)
* Freeze DAML-LF 1.dev into DAML-LF 1.5

In other words, we release DAML-LF 1.5.

This is required for generic templates (#1387).

* description of FROM_TEXT_INT64 & FROM_TEXT_DECIMAL

* amend version history

add ``FROM_TEXT_INT64`` and ``FROM_TEXT_DECIMAL`` in the specification changelog

* typos

* Fix markup in DAML-LF spec

* Add release notes
2019-05-27 21:11:37 +00:00
Remy
439613bee8 daml-lf: add FROM_TEXT_INT64 and FROM_TEXT_DECIMAL (#1407)
* daml-lf: add FROM_TEXT_INT64 and FROM_TEXT_DECIMAL

* Fix typos in Haskell

* cosmetic change

* Fix DAML-LF type checker

* Fix merging fallout
2019-05-27 17:19:01 +00:00
Moritz Kiefer
53c5351144
Add a --project-root option damlc to specify the project root (#1401)
This was already possible before via the DAML_PROJECT environment
variable but for users that want to call damlc directly, e.g., via
damlc.jar a CLI flag can be more convenient.
2019-05-27 18:09:43 +02:00
Martin Huschenbett
34d436d77d Drop support for DAML-LF 1.1 from damlc (#1231)
* Drop support for DAML-LF 1.1 from damlc

Part of #853.

* Fix docs test

* Add show party test back

* Update release notes

* Remove target version from Java codegen test
2019-05-27 16:07:35 +00:00
Gerolf Seitz
9f21b6c669 Transaction service (#1404)
* Isolate daml-on-x prototype

* Implement TransactionService of index api.

Towards the first milestone of the daml-on-x integration steps

* fix compiler error after last-minute refactoring

* formatting

* remove unnecessary dependency from api-server-damlonx

* Fix some inconsistencies.
2019-05-27 15:36:57 +00:00
Gabor Aranyossy
be0a8110a9
using LedgerId domain type (#1403)
* getting a compiler SOE

* /ledger/... compiles

* all compiles

* fmt
2019-05-27 17:01:17 +02:00
gleber
d4efabe6cb Make logback config explicit in binaries and tests. (#1405)
This prevents binaries from including random logback configuration via library
dependencies.

Relevant binaries were found with:

    bazel query  --order_output=no  --universe_scope='//...:*' \
       'kind(".*(test|binary).*", allrdeps(//ledger/ledger-api-integration-tests:ledger-api-integration-tests-lib))'
2019-05-27 16:34:44 +02:00
Martin Huschenbett
a25a641c35
Check in DAR file for Java codegen test against DAML-LF 1.1 (#1406)
This is a prerequisite for dropping DAML-LF 1.1 support from the compiler.
2019-05-27 16:33:31 +02:00
Nick Smith
54cfc6d316
Fixes #1340 - Add Scaladocs generation to the Bazel rules. (#1341)
* Fixes #1340 - Add Scaladocs generation to the Bazel rules.
2019-05-27 12:59:19 +02:00
Martin Huschenbett
d194f525aa
Push StateT evaluation into convertCoercion (#1396)
... and inline only use of `convertCast`.
2019-05-27 11:49:33 +02:00
Stefano Baghino
63c006d83c Expunge Ledger API NPM package (#1394)
These files were used to publish the `.proto` files on NPM so that the
dependency could be defined in the Node.js bindings package manifest.
These files are not longer used and can be safely removed from this
repository.
2019-05-27 09:12:02 +00:00
Martin Huschenbett
ad2172217d Generic templates: remove controller/action from Choice type class (#1395)
These methods don't seem particularly useful, have odd names and we have
never advertised them.

This is part of #1387.
2019-05-27 08:54:19 +00:00
Martin Huschenbett
05db47f6a3
Generic templates: restructure type classes (#1393)
Instead of scattering the information regarding a single template across
multiple type class instances, we put it all into a single type class,
more precisley into its default method implementations.

This has the additional benefit that we can merge the `Creatable` class
into `Template` and `Exercisable` into `Choice` again.

The only potential downside of this approach is that we can call, say,
`signatory` on `Proposal t` only if there's an instance
`ProposalInstance t`. However, this might actually also be an upside.

This is part of #1387.
2019-05-27 10:21:14 +02:00
Martin Huschenbett
56b3a6daf3
Split generic proposal + IOU test in multiple modules (#1392)
We want to verify that our approach works even when the generic template
definition and its instantiation live in different modules.

This is part of #1387.
2019-05-26 16:12:54 +02:00
Martin Huschenbett
e9d78cc9fb Prototype implementation of the backend for generic templates (#1391)
This is part of #1387.
2019-05-25 20:44:04 +00:00
Neil Mitchell
784411f647
Improve parseInt/parseDecimal at the edge cases (#1389)
* Improve parseInt/parseDecimal at the edge cases

* Update the change log
2019-05-25 14:16:45 +01:00
Martin Huschenbett
3fc69c8874 Detect type class instances during template resugaring qualified (#1388)
Currently, we match on any class named `Template`. This PR changes it such
that we only matchon `Template` from `DA.Internal.Template`. Similarly for
`Choice` and `TemplateKey`.

Unfortunately, default method implementation names do not carry a module
name with them, this we need to continue matching on them unqualified.

This change is a preparation for #1387. We'll have two sets of type classes
for templates during the implementation phase of generic templates, although
the new set will be hidden from the documentation.
2019-05-25 12:42:47 +00:00
Martin Huschenbett
871feeff67 Add a test for hihger-kinded coercions in damlc (#1386) 2019-05-25 12:00:00 +00:00
Martin Huschenbett
e70ec5c781
Rewrite coercion conversion in higher-order abstract syntax style (#1383)
The current version in first-order abstract syntax style does not play well
with dictionary sanitization in the corner case of a type class which has
exactly on method and this method has a default implementation. As a side
effect we also eliminate a few lambdas in the generated code.

I've deliberatly removed the handling of forall coercions and coercion
applications since we don't have any code triggering them. I'll add them
back as soon as we find such code. In the meantime, I prefer not handling
these cases and blowing up loudly rather than silently doing something
which might be wrong.

This fixes #1379.
2019-05-25 10:31:13 +02:00
Remy
0771f5d5d3 remove dead code in extractor (#1382) 2019-05-24 18:29:55 +00:00
Stephen Compall
aa6bbe8de6 compile Scala codegen output removing ContractId tparam constraints (#1350)
* ValuePrimitiveEncoding.Mapped, mixin for the "axiom" parts of mapped and xmapped

* remove ValuePrimitiveEncoding.mapped

- it was okay with 1 inductive case, but now there will be 4, so just
  mixin Mapped instead

* mark members of ValuePrimitiveEncoding.Mapped final

- mixins are easier to get right if you mark everything final

* add Maps to random tests

* replace <: Template[A] with : TC in ValuePrimitiveEncoding#valueContractId

- no current subclass uses this context bound, but it may be useful for
  encodings that wish to make ContractId encodings dependent on the type
  parameter

* replace : TC with no bound in ValuePrimitiveEncoding#valueContractId

- fixes #1325
- can reintroduce : TC with #822

* stub test for generating with #1315's liberated contract IDs

- commented out because we still want to test codegen with stable LF
  only

* undo useless changes

* ContractId#apply is unbounded
2019-05-24 18:01:32 +00:00
Gabor Aranyossy
ff088efd94
porting API services to used Index Service v2 (#1362)
* moving to index service v2

* damlonx does not depend on v2 index service anymore

* leger -> ledger

* transacion id fix
2019-05-24 19:18:51 +02:00
Robin Krom
7d506d74fc
Simple generics (#1276)
* ghc compiles generics

* more general kind conversion

* rename varKind to tyVarKind for clarity

* added a comment regarding a check for origin of Meta constructor in conversion

* added reference to original Generics.hs and git commit hash

* added copyright header

* fixing doc generation

* update dar reader test

* no PolyKinds in generics

* functional dependencies and small fixes

* convert MetaData, MetaSel, MetaCons types
2019-05-24 18:28:48 +02:00
Martin Huschenbett
e7a068775f
Change damlc and daml-stdlib to use exercise without actors (#1380)
The main purpose of this is to get rid of the `fetch` preceding each
`exercise`. This will work for DAML-LF 1.5 when it is frozen.

This finishes #1347.
2019-05-24 18:10:35 +02:00
Gabor Aranyossy
1b846386a7 avoid null characters to generate rejections (#1378)
* using valid utf characters to generate rejections

* Update ledger/sandbox/src/test/suite/scala/com/digitalasset/platform/sandbox/stores/ledger/sql/PostgresDaoSpec.scala

Co-Authored-By: Remy <45566104+remyhaemmerle-da@users.noreply.github.com>
2019-05-24 13:31:37 +00:00
Martin Huschenbett
c30ec0fc03
Make the actors optional in DAML-LF's exercise instruction (#1377)
* Make the actors optional in DAML-LF's exercise instruction

If they are not present, the controllers will be filled in. Surface DAML
does this currenty anyway by fetching the contract and computing the
choice controllers before each `exercise`. This change will allow for
getting rid of the additional `fetch` preceding each `exercise`.

The compiler does not use the new form yet. I will do this in a separate
PR together with tests for the new behaviour.

This fixes #1347.

* Fix DAML-LF type checker test

* Check presence of actors for old DAML-LF versions in decoder
2019-05-24 15:01:56 +02:00
A. F. Mota
2329b1b97a
Display warnings in daml build. (#1375)
* Display warnings in daml build.

* Prevent errors from showing twice.

* Use flagYesNoAuto for scenario service.
2019-05-24 14:36:48 +02:00
Remy
294abecf5d daml-lf remove LedgerIdString (#1376) 2019-05-24 12:08:28 +00:00
Martin Huschenbett
9a97169ad6
Remove exerciseExplicit from daml-stdlib (#1351)
This is a preparation for making the actors in DAML-LF's exercise
instruction optional (see #1347).

This is technically a breaking change but since `exerciseExplicit` has never
been exposed via the documentation, we don't add a release note.
2019-05-24 12:26:38 +02:00
Remy
4f18b1afa7 DAML-LF internal type safety (#1192)
* Rename Value's ContractId to VContractId

* daml-lf: a bit more about PartyId

* daml-lf: Concatenable MatchingStringModule

* daml-lf make clear type used for Scenarios only

* daml-lf create ContractId, LedgerId, TransactionId

* sandbox-sql conversion util

* LedgerName -> LedgerString

* futher type cleanup in the sandbox

* daml-lf add test for LedgerString

* fixing tests

* a bit more safety in the DB

* Address Stephen's comments

* fix rebase

* More fixes for StringModule

* change length of LedgerString (256 -> 255)
2019-05-24 09:53:29 +00:00
Stefano Baghino
dd1def721e
Format all the things (#1363) 2019-05-24 11:11:06 +02:00
Moritz Kiefer
3b92b0c642 Disable daml-ghc-shake-test-ci on Windows (#1364) 2019-05-24 09:10:27 +00:00
Martin Huschenbett
b09cbd037b
Add coerce for contract ids to DAML-LF (#1346)
* Add coerce for contract ids to DAML-LF

This is needed for our implementation plan for generic templates.

Fixes #1277.

* Reformat Scala
2019-05-24 09:08:15 +02:00
mziolekda
f085af003b
provide initial definitions for party management and package management (#1264)
* provide initial definitions for party management and package management protobuf interfaces

* incorporate feedback from the three rounds of reviews
2019-05-24 06:07:40 +02:00
Bolek@DigitalAsset
d7048740c8
webide: analytics (#1358)
* webide: analytics

Because we don't control the html content of the actual web ide, we
won't integrate with the more common front end js for google analytics.
Instead we use server side communications.

* webide: add page to events
2019-05-23 19:25:29 -04:00
Shayne Fletcher
5ce4b5955e Upgrade to ghc-lib 0.20190523.1 (#1355) 2019-05-23 21:45:51 +00:00
Bernhard Elsner
203dd346d4 Update installation.rst (#1359) 2019-05-23 21:44:39 +00:00
Gary Verhaegen
ac719e7927 [ci/linux] keep daml copy until it's actually not needed anymore (#1349)
The existing script is deleting the daml directory too early, leading to
the "shutdown agents" step failing.
2019-05-23 15:25:37 +00:00
nickchapman-da
7ee7931407
nim-console Ledger App (#1342)
* Use closable Stream in Haskell ledger bindings

* move PastAndFuture abstraction into ledger interface code

* distinguish past/future transactions in return of Ledger.getTransactionsPF

* first cut: nim-console running against a ledger

* remove flaky failing test
2019-05-23 15:56:12 +01:00
Moritz Kiefer
91057be37c Use Shake rules to access files of interest and open VRs (#1348)
This should make things a bit less fragile since global state is
always tricky :)
2019-05-23 14:54:37 +00:00
A. F. Mota
489244886c List all available versions, and persist version data. (#1339)
* List all available versions.

* Add --all flag in daml version

* Save version list to cache

* Update version cacheing logic.

* Linting error

* PR revisions.

* Update release notes.

* Update daml-assistant/src/DAML/Assistant/Version.hs

* Update docs/source/support/release-notes.rst

Co-Authored-By: Beth Aitman <bethaitman@users.noreply.github.com>
2019-05-23 14:33:07 +00:00
Moritz Kiefer
1c580d84a5
Make exposed-modules field in daml.yaml optional (#1345)
If unspecified, we expose all modules in the project.

Fixes #1328
2019-05-23 15:37:37 +02:00
Martin Huschenbett
af1bf0cd67
Simplify how we handle DAML-LF version dependent builtins in damlc (#1335)
The previous code cannot be nicely extended to new builtins.
2019-05-23 14:29:48 +02:00
Leonid Shlyapnikov
67da43cff5
Document the meaning of Option in Contract#agreementText (#1319)
* Documenting `agreementText`

* Code review suggestion

Co-Authored-By: Francesco Mazzoli <f@mazzo.li>
2019-05-23 08:00:42 -04:00
Moritz Kiefer
9834451f37
Fix race condition in the initialization of scenario ctx roots (#1331)
Fixes #1306

The problem was caused by the following steps:

1. We first call setFilesOfInterest. However that does not block until
 ofInterestRule finishes and subsequent calls to shakeRun will kill
 the current run so we never reach the point where the scenario
 context roots are updated.

2. We then call runScenarios before ever setting up the context roots
and throw an exception.
2019-05-23 12:56:13 +02:00
Martin Huschenbett
408a9158d3
Test damlc against all supported DAML-LF version (#1337)
I disabled this in the past because the tests were to slow. They have gotten
quite a bit faster since then and I'm slowly getting scared by the fact we
don't do this right now. Also, it incentivices us to drop support for old
DAML-LF versions more frequently, which will most of the time also remove
complexity from the compiler.
2019-05-23 12:51:54 +02:00