Commit Graph

104 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Martin Huschenbett
8ec03875c6
Lift restriction on serializable contract ids in DAML-LF 1.dev (#1315)
* Lift restriction on serializable contract ids in DAML-LF 1.dev

In DAML-LF 1.dev, make `ContractId a` serializable whenever `a` is
serializable. This is part 2 of #1277.

* Reformat Scala

* Add changelog entry to daml_lf_1.proto
2019-05-22 22:23:59 +02:00
Martin Huschenbett
ee02c9ee6e Make DAML-LF 1.4 the default version output by damlc (#1283)
* Make DAML-LF 1.4 the default version output by damlc

This removes the syntactic restriction on contract keys.

* Add DAML-LF 1.4 to release notes
2019-05-21 14:33:44 +00:00
Martin Huschenbett
cbeccb79ec
Add complex contract keys to DAML-LF (#1162)
* Add complex contract keys to daml_lf_1.proto

* Adapt Haskell implementation of DAML-LF protobuf encoder/decoder

* Adapt Scala implementation of DAML-LF protobuf encoder/decoder
2019-05-16 13:46:01 +02:00
Martin Huschenbett
d495428ccf
Remove all trailing spaces from daml_lf_1.proto (#1155)
These spaces drive me crazy because my editor highlights them (on purpose).
2019-05-15 16:22:32 +02:00
Remy
c7df212d42 Daml lf type safty (Decimal) (#1098)
* daml-lf: make Decimal type safe

* daml-lf: create Utf8String type

* daml-lf: cleanup in data package

* Address Stephen Comments

* daml-lf: remove UTF8String
2019-05-14 18:10:45 +00:00
Michał Majcherski
fdbc1f51ce
windows: fixed daml-lf tests for Windows by using Bazel's rlocation (#1053)
* windows: fixed daml-lf tests for Windows by using Bazel's rlocation

* more consistent logging on CI; publishing Windows test logs on failure

* windows: fix daml-lf engine tests

* windows: add diff tool to msys
2019-05-14 16:18:55 +02:00
Neil Mitchell
ed431b4717
Move Tuple and Either types to DA.Types (#1099)
* Add a helper function to qualify things with respect to a module

* Supress some warnings I saw when building

* Move Tuple* and Either to daml-prim:DA.Types, so they have a nice name for Java users (instead of GHC.Tuple or DA.Internal.Prelude)

* Add copyright header

* Update daml-foundations/daml-ghc/daml-prim-src/DA/Types.daml

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update daml-foundations/daml-ghc/daml-prim-src/DA/Types.daml

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update the daml-lf translation of tuple types

* Fix up the scala bindings for how to use types

* Clarify what action people need to take following the release notes

* Fix an expected test

* Clarify the changelogs even more

* Run ScalaFmt

* Clean up the release notes a bit

* Use the changelog from Beth

* Update the release notes again

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

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

* Fix up the scenario error messages
2019-05-13 16:36:21 +01:00
Remy
0489c6e0a5
Daml lf type safty (Party & PackageId) (#761)
* daml-lf: split SimpleString into Party and PackageId

* daml-lf remove parameter from DefinitionRef
2019-05-06 20:40:43 +02:00
Stephen Compall
f5490a5454 add LF 1.dev "minor dev version" (#709)
* clean up v3 contract key case in TransactionVersions

* clean up duplicate cases in ValueVersions.assignVersion

* make LanguageMinorVersion a proper ADT, aliased LanguageVersion.Minor

* port DecodeV1 to LanguageMinorVersion ADT via implicit conversion

- @remyhaemmerle-da might prefer the explicit application of Stable/Dev

* make releasePrecedes private

* add dev versions to the timeline

* copyright header for LanguageMinorVersion

* build the package database for 1.dev, support 1.dev as --target

* test presence and new-ness of "dev" in timeline

* report dev versions in engine info; note 1.dev target in release notes

* spec and governance rules on 1.dev and minor dev in general

* make the governance rule about dev more direct

* 1.x

* missed plural; thanks @leo-da

* further definition of 1.dev in LFv1 spec; thanks @remyhaemmerle-da
2019-05-03 10:36:45 +02:00
Stephen Compall
0ba1e5b386 increase ledger-api IT timeout; daml-lf, language-support/scala: remove long-deprecated symbols (#741)
* remove long-deprecated symbols from daml-lf and language-support scala libraries

* remove useless usage of 2-parameter TemplateId constructor

* grow ledger-api-integration-tests to account for usual 300s-ish runtime

* buildifier
2019-04-26 21:05:26 +00:00
Stephen Compall
a3e9aad147
remove major LF dev version (#681)
* removing major LF dev version from Haskell proto codecs

* removing major LF dev version from scenario service client

* missed import

* remove Scala support for dev major version; remove --allow-dev option from sandbox cli

* Version.minorFromCliOption function

* don't build daml-stdlib artifacts for dev major

* remove damlc CLI --target dev

* release note about removed dev major LF version

* governance now discusses minor dev, no more major dev

* don't build from daml_lf_dev.proto anymore

* remove daml_lf_dev.proto

* raise deprecated release

* reserve 9999 in the ArchivePayload sum, as suggested by @bitonic

* use reserved proto keyword, as suggested by @bitonic

- `reserved` cannot occur within `oneof` block

* remove --allow-dev test

* dev removal release note followed the previous release; move it back to HEAD
2019-04-26 13:10:09 -04:00
Stephen Compall
a1722d152c
empty daml_lf_0.proto, leaving Package so LFv0 errors preserved as-is (#707) 2019-04-26 12:07:40 -04:00
Neil Mitchell
85c72f87d1 Move to using proto3-wire from upstream (#480)
* Move to using proto3-wire from upstream

* Move to upstream proto3-suite, with some custom patches in my fork

* Delete the BUILD.bazel for hte proto3 stuff, not used and the test was failing

* Delete the old proto3-wire and proto3-suite forks

* Delete proto3-wire

* Prettify BUILD.bazel files, sort the deps

* Remove some special cases from the license checker

* Delete unused Nix files from grpc-haskell

* Switch to upstream proto3-suite

* Make old-time work on Windows

* Formatting

* Patch rules_haskell to use a response file for -optP to avoid overflowing argument size limits on Windows

* Update 3rdparty/haskell/BUILD.old-time

Co-Authored-By: neil-da <35463327+neil-da@users.noreply.github.com>

* Update the comments in old-time

* Use the revised location of proto3-suite
2019-04-24 15:59:08 +00:00
Jussi Mäki
7c275b17fb DamlOnX refactoring: Drop StateInit, Long Offset (#519)
* daml-on-x: Drop StateInit and use AtomicReference

- Drop the StateInit update message and introduce "getLedgerInitialConditions".
- Switch to AtomicReference from SyncVar as this is non-blocking and hence safer to use from Akka.

* ledger/participant-state: Rename recordTimeEpoch to initialRecordTime

and use the time from timeProvider at the ledger object initialization
time as the initial record time.

* fmt

* Fix use of repo as external workspace. Fix compilation issue in IndexState.scala

* Refix the use of this repo as external bazel workspace

* Fix compilation after rebase

* refmt
2019-04-23 12:56:40 +00:00
Robert Autenrieth
e2c79b27cf Fix broken link (#530)
* Fix broken link

* remove old daml-lf spec
2019-04-16 16:14:43 +02:00
Leonid Shlyapnikov
bdb5160403
Multiple fat DARs scala/codegen support, #109 (#366)
Add Dar Traverse and Equal, replace manually written test cases with
scalaz law checks;
Add test case for multiple DARs support;
Enforcing non empty list of input files
2019-04-15 17:12:07 -04:00
Stefano Baghino
4110e039dd
Fix the DAML-LF Archive package structure (#502)
The DAML-LF Archive Protobuf definitions, as packaged and distributed
via Bintray and the SDK, currently packages the files in a directory
structure that does not match with the actual one, causing the usage of
`protoc` on the packaged definitions to raise errors. This commit fixes
it by packaging the files in the same directory structure as the one
found in the repository.
2019-04-15 18:25:09 +02:00
moritzkiefer-da
ec46b8cec5 Add codegen to integration tests (#494) 2019-04-15 17:53:05 +02:00
Francesco Mazzoli
f50cbef297 use .dars consistently in tests (#484) 2019-04-15 16:45:08 +02:00
gleber
aa70c7f64e
Enforce consistent formatting of BUILD files. (#412)
* Add buildifier targets.

The tool allows to check and format BUILD files in the repo.

To check if files are well formatted, run:

    bazel run //:buildifier

To fix badly-formatted files run:

    bazel run //:buildifier-fix

* Cleanup dade-copyright-headers formatting.

* Fix dade-copyright-headers on files with just the copyright.

* Run buildifier automatically on CI via 'fmt.sh'.

* Reformat all BUILD files with buildifier.

Excludes autogenerated Bazel files.
2019-04-12 13:10:16 +02:00
Jussi Mäki
1f2246c822 Do not divulge contracts to observers in nonconsuming exercises (#325)
* Do not divulge contracts to observers in nonconsuming exercises

Disables support for non-default ledger feature flags, as they
are meaningless since ledger server logic does not respect the flags.
Instead of large refactoring to add support for the old flag settings,
it is best to disallow the deprecated flags, and later on phase out the
flags completely.

Re-enables test_divulgence_of_token in sandbox semantic tests.

Fixes #157.

* purge LedgerFlags entirely...

...since we only support one version of them anyway, and clearing them

* updated release notes
2019-04-11 14:41:35 +02:00
moritzkiefer-da
fa4067ad1b
Move POM file generation to Bazel rules (#374)
* Move POM file generation to Bazel rules
2019-04-11 11:24:52 +02:00
Remy
07858455c1
Fix DAML runtime for the new DAML-LF type Map (#204)
* add a test for daml-lf/interface
* fix scala code gen
* fix extractor
* fix navigator backend/frontend
* key of Map are strings in proto/json
2019-04-10 21:30:33 +02:00
Leonid Shlyapnikov
a8e32f6735
Add Universal Archive Reader to parse DARs and DALFs, #109 (#359)
Clean up DAR Reader errors.
2019-04-10 10:35:59 -04:00
Leonid Shlyapnikov
737fc06bfe
Implement Functor for Dar, #109 (#305) 2019-04-09 12:52:30 -04:00
Leonid Shlyapnikov
dc273159eb Implement legacy DAR support, #308 (#309)
* Implement legacy DAR support, #308

if MANIFEST.MF is not present filter zip entries by .dalf extension,
expect one main DALF and one optional *-prim* DALF, fail in other cases

* Implement legacy DAR support, #308

if MANIFEST.MF is not present filter zip entries by .dalf extension,
expect one main DALF and one optional *-prim* DALF, fail in other cases

* comments, naming
2019-04-09 10:48:49 +02:00
Stefano Baghino
7467925aa1
Fetch status.proto from remote, simplify JS gRPC codegen (#285)
* Fetch status.proto from remote, simplify JS gRPC codegen

Fetch the `status.proto` file (part of the standard gRPC distribution)
from a distribution channel. _Moreover_, use the recently introduced
`proto_gen` rule to simplify how the gRPC code for the Node.js bindings
are generated (and remove the need to have `google/rpc/status.proto`
locally in the repository.

* Add plugin_runfiles option to proto_gen

This allows use to add additional files to the bazel sandbox so that
plugins can refer to them. This will subsequently be used by the
protoc-gen-doc plugin.

Also, pass the plugin options via --name_opt parameter.

* Add missing status.proto dependency /language-support/java and /ledger

* Build proto docs using the proto_gen rule

To make this work, I had to turn on the bazel build flag
`--protocopt=--include_source_info` because we cannot turn enable this
flag only for specific build rules.

* Make /ledger-api/grpc-definitions:docs public again

* Revert to the old style of passing plugin arguments to --name_out=options:path

* Suppress output of unzipping

* Fix link for google.rpc.Status in proto-docs
2019-04-09 10:30:01 +02:00
Robin Krom
a8b2d30b3d
Stdlib package (#229)
language: ship daml-stdlib as a package
2019-04-05 18:11:13 +02:00
Brian Healey
0205a1a932 #233 remove changelogs 2019-04-04 16:08:52 -04:00
Leonid Shlyapnikov
e655aae9e3 add fat dar support to DarReader, #109 2019-04-04 12:29:28 -04:00
Digital Asset GmbH
05e691f558 open-sourcing daml 2019-04-04 09:33:38 +01:00