Commit Graph

86 Commits

Author SHA1 Message Date
Andreas Herrmann
5266b042b2 Implement ToTextTemplateId in proto (#3118) 2019-10-07 14:56:52 +00:00
Remy
449500bad8 Revert "Intern all strings and dotted names in the DAML-LF protobuf encoding (#3067)" (#3114)
This reverts commit 68e4453324.
2019-10-04 16:13:27 +02:00
Martin Huschenbett
68e4453324 Intern all strings and dotted names in the DAML-LF protobuf encoding (#3067)
* Intern all strings and dotted names in the DAML-LF protobuf encoding

On one of our huge DAML code bases this has brought down the size of the
DALF by 60% and cut the memory usage during decoding by 50%.

The `@QUERY-LF` tests in the damlc integration tests check that the
interning actually works.

* Add scala decoder support for interned strings

* Memoize versionisOlderThan. Speeds up decoding by 6x.

* Properly fix the performance problem with version ordering

LanguageVersion.ordering was a `def` and not `val` causing us to
recreate the ordering tables every time.

* Clean up //daml-lf/archive:decode-test

* Use int32 for interning indices

* Adapt QUERY-LF tests

* Strip a few useless field_ prefixes

* Add test for uniqueness in interning tables

* Drop field_ prefix from jq queries

* Fix Scala encoder

* Fix bond-trading tests

* Rename decode-test to decode-tester

* Address @cocreature's comments

* daml-lf: proper versioning for reading internedStrings

* daml-lf repl: revert change
2019-10-04 11:26:31 +00:00
Remy
d540f7aab0 Daml-LF: change Numeric max scale from 38 to 37 (#2969)
* daml-lf: numeric maxScale change from 38 to 37

* daml-lf: update spec

* udpate protobuf comments
2019-09-23 12:39:28 +00:00
Remy
a46f1c041a Daml-LF: make Numeric scale type safe (#2958)
* daml-lf: make numeric scale type safe

* navigator: fix scale

* ledger: fix scale in tests

* Update daml-lf/data/src/main/scala/com/digitalasset/daml/lf/data/NumericModule.scala

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

* Update ApiCodecCompressedSpec.scala

* Update ApiCodecCompressedSpec.scala
2019-09-18 19:33:52 +00:00
Remy
5b36d5f88b Daml-LF: make archive decoder more restrictive for 1.dev (#2937)
* daml-lf: make decoder more restrictive

* daml-lf: update spec

* daml-lf: update comment in archive proto
2019-09-18 17:22:48 +00:00
Remy
220a03c9e8 Daml-LF: make MUL_NUMERIC and DIV_NUMERIC multi-scale (#2921)
* daml-lf: Make MUL_NUMERIC and DIV_NUMERIC multi-scale

* update release notes

* compiler: fix with type change
2019-09-17 14:32:49 +00:00
Moritz Kiefer
36e95f6cf3
Add Any type and to_any/from_any primitives to protobuf (#2930)
* Add Any type and to_any/from_any primitives to protobuf

Following a suggestion by Rémy, the protobuf representation is more
general and is associated with an arbitrary type instead of a
typecon. This allows us to easily extend this later to a full Any
type.

I’ve still called the type in the protobuf Any instead of Haskell’s
Dynamic since I find AnyTemplate more clear than DynamicTemplate and
having AnyTemplate and Dynamic seems confusing.

Right now, the decoder enforces that the type is a TypeCon.

* Fix some mistakes in the spec

* Update daml-lf/spec/daml-lf-1.rst

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update daml-lf/spec/daml-lf-1.rst

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update daml-lf/spec/daml-lf-1.rst

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update daml-lf/spec/daml-lf-1.rst

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Add evaluation rule for to_any_template

* Update daml-lf/spec/daml-lf-1.rst

Co-Authored-By: Remy <remy.haemmerle@daml.com>
2019-09-17 15:02:59 +02:00
Remy
dc9429be1d Daml-LF: Add CAST_NUMERIC and SHIFT_NUMERIC (#2919)
* daml-lf: add CAST_NUMERIC and SHIFT_NUMERIC internally

* daml-lf: add CAST_NUMERIC and SHIFT_NUMERIC to archive proto

* daml-lf: update spec with CAST_NUMERIC and SHIFT_NUMERIC

* update release notes

* fix spec

* Address comments from Fran and Gerolf

* fix unrel
2019-09-17 08:52:54 +00:00
Andreas Herrmann
ed39800a9f Rename hazel_deps to hackage_deps (#2789)
* hazel_deps --> hackage_deps

Mechanical change:

```
sed -i 's/hazel_deps/hackage_deps/g' $(ag -l hazel_deps)
```

* Hazel dependencies --> Hackage dependencies
2019-09-06 09:01:09 +00:00
Remy
6a96060af1 daml-lf: udpate LF protobuf for numerics (#2649)
* daml-lf: update proto for Numerics

* daml-lf: test decoder

* daml-lf: update spec

* daml-lf: polish proto doc

* damlc: address reviewers' comments

* daml-lf: minor fix
2019-08-26 11:55:48 +00:00
Remy
9a4dff63b2
daml-lf: introduce Numeric in internal AST (#2608)
* daml-lf: introduce numeric in daml-lf AST
* daml-lf: add test for command preprocessor
* interface-reader: fix for Numerics
* Address Gerolf's review
2019-08-23 15:27:14 +02:00
Remy
2abf27cd67 Revert DAML-LF proto change for Numeric (#2600)
* Revert DAML-LF proto change for Numeric

This partially reverts commit 0ffe5945b8.

* daml-lf: udpate release notes

* Apply suggestions from code review

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-08-20 08:13:15 +00:00
Remy
daf10bf247
daml-lf: make LF parser numeric compatible (#2587) 2019-08-19 16:31:33 +02:00
Remy
6920a6be11
daml-lf: base implementation of Decimal on top of Numeric (#2569)
* daml-lf: base implementation of Decimal on top of Numeric
2019-08-16 15:33:10 +02:00
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
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01: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
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
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
Remy
2d1d5fc5af daml-lf: update release notes with archive protobuf change (#2334) 2019-08-02 19:40:37 +00:00
Stephen Compall
52efc0966c
daml-lf: new data-scalacheck library for ImmArray, FrontStack, et al (#2342)
* new data-scalacheck library for ImmArray, FrontStack, et al

* add checkLaws functions as library to data-scalacheck

* make checkLaws more configurable at use points
2019-08-01 11:10:56 -04:00
Rohan Jacob-Rao
e6a4d8b251
New template desugaring (#2178)
* Update ghc-libs to use new template desugaring
* Replace old template typeclasses with generic-friendly ones
* New template desugaring doc
* Fix tests
* Fix damldoc tests regarding Archive choice
* Update visualisation code to not traverse master dictionary
* Additional class method stubs to template instance declaration for upgrades
* Increase stack limit for bond trading compilation test
* Update hlint version
2019-07-30 19:49:33 -04:00
Remy
0ffe5945b8 DAML-LF: Prepare archive proto for Numeric (#2298)
* daml-lf: prepare archive proto for Numeric

* replace DECIMAL by NUMERIC in messages and fields
* add nat kind and nat type
* add builtins CAST_NUMERIC and SHIFT_NUMERIC

* daml-lf: remove new builtins from archive proto

* daml-lf: some more doc about numeric

* daml-lf: fix spec
2019-07-29 18:33:52 +00:00
Remy
e7bbf87692 Freeze DAML-LF version 1.6 (#1937)
* daml-lf: cosmetic

* daml-lf: release V1.6

* daml-lf: update spec

* update unreleased.rst

* Address Martin's comments

* damlc: active daml-lf-target 1.6

* lf-encoder: fix testing dar generation

* daml-lf spec: simplify 1.dev description

* daml-lf: fix engine test

* daml-lf: fix version timeline

* extractor: fix test

* Address Stephen's comments

* Add more meat to the release notes

* java-codegen: update docs

* damlc: set 1.6 as default output version

* java-codegen update integration tests

* undo replicating typo

* release notes

* scala-codegen: update test

* java-codegen: fix doc

* extractor: fix  test

* address Gerolf's comments

* realse-notes: cleanup unreleased.rst

* Address last comment from Stephen

+ cosmetic cleanup

* formatting
2019-07-12 19:06:44 +00:00
Gabor Aranyossy
33c746fe9b loading Dars from ZipInputStreams (#2005)
* loading Dars from ZipInputStreams

formatting and cleanup

fixing DarReaderTest not compiling

fmt

using IOUtils to read the ZipInputStream

fixing CodeGen

fixing broken legacy DAR loading

fixed v2 ReferenceServer

cleanup

* fixing rebase conflicts

* introduced a fromFile method to avoid having to do boiler-plating where the input is a File

* addressing leaking resources

* cleanup

* inlining closures

* closing the darStream
2019-07-11 15:37:21 +00:00
Gerolf Seitz
840ee94bf6 Improve logic for building daml-lf-archive-java (#2059)
daml-lf-archive-java is put together from the proto sources with the
compiled java classes. However, the logic that picks the java classes
was dependent on the output of $(locations :daml_lf_proto_lib_java),
because it always would pick the first item.

The new logic filters by name rather than position.

Fixes #2058.
2019-07-09 11:44:35 +00:00
Moritz Kiefer
bb3a98bf61
Move code in daml-tools outside of daml-foundations (#2033) 2019-07-08 11:40:48 +02:00
Francesco Mazzoli
ca5d045e62 check that submitter is in maintainers for lookup by key (#1967)
* check that submitter is in maintainers when looking up keys

Fixes #1866. Note that this limitation applies both for `lookupByKey`
and `fetchByKey` -- anything involving retrieving a key is affected.

* add UNTIL-LF to run tests up to a certain version of DAML-LF

* name targets for DAML tests better

* add notes about DAML-LF changes

* commit Test.daml with DAML-LF 1.5 rather than compiling it on the fly

* add scenario tests for #1866

* add warnings about future key behavior in docs

* use flag rather than version when executing
2019-07-05 09:34:26 +00:00
Gary Verhaegen
acbc5de820 remove some build warnings (#2012) 2019-07-04 22:07:49 +00:00
Remy
c412d4e3d2 Add pretty C# namespaces in archive and leger-api protos (#1911)
* add nice C# namespace for in leger-api proto

fixes #1901

* add pretty C# namespace for archive protos

fix #1900
2019-06-27 11:39:33 +00:00
Remy
3f1b5d7761 daml-lf: Update spec for daml-lf 1.dev (#1899)
* daml-lf: Update spec for daml-lf 1.dev

* daml-lf: more details on interned package IDs in spec

* daml-lf: more comments in daml_lf_1.proto
2019-06-27 10:36:34 +00:00
Remy
383888169d daml-lf: fix lf decoder (#1879) 2019-06-26 15:12:46 +00:00
Moritz Kiefer
8e701cd229 Fix release process (#1878)
This PR adds a check that all artifacts that will be uploaded to Maven
central actually exists and fixes the artifacts for
daml_lf_archive_java.
2019-06-26 09:19:08 +00:00
Stephen Compall
9bcc925a40
intern package IDs in LF (#1614)
* specify the new fields for interning package IDs

* percolating intern tables

* crawl packages for package IDs as a pre-phase: generic prep

* stub case for interned_id in Scala packageref reader

* HasPackageRefs instances for the rest of the ast

* make intern table and use when encoding PackageRefs in v1

* don't need where

* stub out decode for interned package IDs

* no benefit to using uint32 instead of uint64

* percolate in encode one step

* interned case for decoding PackageRefs

* naming details

* intern table decoder

* finish propagating the intern table in encoder

* encode the package ID table

* document the vital assumption of encodeInternedPackageIds

* propagate the intern table through the LF decoder

- done by stacking ReaderT on top of Decode internally,
  as discussed with @hurryabit

* daml-lf-proto requires mtl

* stub out interned case in Scala LF decoder

* stub interface decoder function

* get the interned table to most places in InterfaceReader

* support for interned package IDs in Scala decoder

* use ImmArraySeq instead of Vector for Scala intern decode table

* adding that ghc extension didn't make sense

* implement interned ID decoding for InterfaceReader

* scenario service won't have interned package IDs

* test the interned ID resolution in Scala by examining the proto -> AST in detail

* proper precondition for the dev phase of interned IDs testing

* better error reporting for malformed DALFs in intern test

* just import Data.Int

- suggested by @neil-da; thanks

* pass around the lookup function instead of the vector in decoder

- suggested by @neil-da; thanks

* remove derivations for types deleted in e63b012d2d

* rename VersionAware to EncodeCtx

- suggested by @hurryabit; thanks

* rename MDecode to MonadDecode

- suggested by @hurryabit; thanks

* pass a function through the encoder instead of a set

- based on suggestions by @hurryabit and @neil-da; thanks

* daml-ghc test that interned IDs are generated

- suggested by @hurryabit; thanks

* adapt to 5b480c99ec #1844
2019-06-26 11:15:24 +02:00
Moritz Kiefer
37ada7e770
Build javadoc for daml-lf-archive (#1867)
This is required for uploading to Maven.

The rational for needing our custom javadoc_library rule is documneted
in the file itself.
2019-06-25 21:12:25 +02:00
Martin Huschenbett
19b2d5c86c Rename none and some to optional_none and optional_some in DAML-LF (#1810)
This fixes #95.
2019-06-25 12:47:38 +00:00
Stephen Compall
5b480c99ec
Decode modules abstractely in scenario-service server (#1844)
* add scenario Module decoding to Decode.OfPackage

* use purely data-driven decoding in scenario service in Scala

- decouples scenario service from LF decoder implementation

* make DecodeV1 companion private

* make extension to LFv2 more obvious
2019-06-25 09:49:04 +02:00
Martin Huschenbett
ca3ca745fb
Rename DAML-LF primitives for conversion between Text and code points (#1777)
I find the current names very confusing and unintuitive.

I'm aware that there are other primitives called `TO_TEXT_X`. But there the
`X` is meant to be a type index to `TO_TEXT`. This doesn't make much sense in
the context of `TO_TEXT_CODE_POINTS` though since there's no type named
`CodePoints`.
2019-06-20 16:03:11 +02:00
Robert Autenrieth
c14b909c71 Implement package management API in the sandbox (#1610)
* store archive size in `DarReader`

* rename `SandboxTemplateStore` to `SandboxPackageStore`

* store package info in `SandboxPackageStore`

* introduce package upload / read to write / index services

not tested yet, just a ton of plumbing

* WIP test the package service

* Fix build errors after rebase

* Move packages service to v2

* Ledger API client uses ledger API types

* Fix ReflectionIT

* Correctly handle uploading invalid dar files

* Fix reading DAR entry file sizes

* Improve package management IT

* Improve handling of duplicate packages

* Fix language-support build

* Use unique party and command names

* Rename lfpackage to language

* Rename SandboxPackageStore to InMemoryPackageStore

* Remove getCurrentTime ledger method

* Improve package management IT

* Move InMemoryActiveContracts and InMemoryPackageStore

* Use case object for UploadDarResult.Ok

* Address review comments

* Update release notes

Fixes #1311

* Use BazelRunfiles in test
2019-06-19 12:31:53 +00:00
Remy
11b602da03 Scala Daml-lf encoder (#1715)
* encode ast in protobuf

* daml-lf parser: make defaultPackageId and languageVersion parametric

* daml-lf rewritting of AST

* test ast encoder

* copyright

* test function type encoding

* daml-lf add parameter to parser implicits

* damlfl-as stands for "damllf assembler"

* move encoder in its own private package
2019-06-18 17:32:21 +00:00
Martin Huschenbett
2ef1ab2022
How to spell "builtin" (#1676)
`git blame` says I'm the culprit for all the wrong spellings fixed here.
All in a single day. Must have been a hell of a day...
2019-06-15 13:58:46 +02:00
Remy
0591075187 cleanup daml-lf scala packages (#1581)
* cleanup daml-lf scala packages

* Address Stephen's Comments

* update maven coordinates of language package
2019-06-12 15:55:48 +00:00
Martin Huschenbett
504337b5b2
Expose conversion between text and code points in daml-stdlib (#1536)
* Expose conversion between text and code points in daml-stdlib

* Fix tests

* Fix feature dependency

* Fix test imports
2019-06-06 11:33:07 -04:00
Remy
bf5309b42e daml-lf: add enum pattern matching (#1506)
* daml-lf: add enum pattern matching

* daml-lf: add test for interpreter pattern matching
2019-06-04 22:25:22 +00:00
Robin Krom
e83740d72c
Generics impl (#1513)
* working generated representation type

* from/to method generation compiles

* moved GHC.Generics to DA.Generics

* removed strictness metainfo

* added test

* some cleanup

* deal with empty record constructors

* more fine grained testing
2019-06-04 18:00:32 +02:00
Remy
e115c39b67 make colon valid fro party literals + spec cleanup (#1467) 2019-06-04 15:50:02 +00:00
Remy
0d25b73d1f daml-lf add builtin to (un)pack string in code points (#1480)
, namely

* FROM_TEXT_CODE_POINTS: Text -> [Int64]
* TO_TEXT_CODE_POINTS: [Int64] -> Text
2019-06-04 14:06:25 +00:00
Remy
f84e7d79d2 Add enum type to daml-lf (#1397)
* add enum type to daml-lf dev

* Address Francesco's comments

* Address Martin's comments

* fix daml-lf proto version history
2019-05-29 12:15:01 +00: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