Commit Graph

276 Commits

Author SHA1 Message Date
Remy
5e63db7a40 speedy: Rename SMap to STextMap (#3664)
+ rename MAP to TEXTMAP in decoder/encoder
2019-11-28 17:05:26 +00:00
Remy
54d98fd186 navigator: add GenMap support (#3525)
* navigator: add GenMap support

* fix after rebase

* change missing 'map' to 'textmap'

* more fixes

* navigator: fix query for TextMap and GenMap
2019-11-28 16:13:36 +00:00
Remy
d465787dde Extractor: Add support for GenMap (#3614)
* Ledger-service: fix json encoding for genMap

* Extractor: Add support for GenMap

* Address Leo's comments
2019-11-28 12:31:28 +00:00
nickchapman-da
885bbefdf3 rename structural records: tuple -> struct (#3660)
* rename structural records: tuple -> struct

* add missing renames (tuple -> struct) in comments, var-names and error messages

* exposition: structural vs nominal; change history note

* remove accidentilly checked-in file
2019-11-28 10:00:24 +00:00
nickchapman-da
d3d6891021
Rename daml lf tuples (#3658)
* Rename DAML-LF tuples as structs (structural records)
2019-11-28 07:58:30 +00:00
Remy
5b155409a0 DAML-LF iface reader: rename Map to TextMap (#3610)
CHANGELOG_BEGIN

 [DAM-LF Interface Reader]: **Rename** ``PrimTypeMap`` to ``PrimTypeTextMap`` and ``PrimType.Map`` to ``PrimType.TextMap``

CHANGELOG_END
2019-11-27 14:01:35 +00:00
Remy
997e206779 daml-lf: type synonyms are also taken into account for collisions (#3644) 2019-11-27 08:36:59 +00:00
Moritz Kiefer
41958b1430 Fix typo in synonym spec (#3636) 2019-11-26 17:15:58 +01:00
Moritz Kiefer
f402acf19b Add specification for type synonyms in DAML-LF (#3635)
* Add specification for type synonyms in DAML-LF

* Fix identifiers for type synonyms

* Use S for type synonyms

* Address review comments

* Split up TyTypeSynonym and DefTypeSynonym
2019-11-26 15:01:44 +00:00
Remy
06b7a106a1 DAML-LF: generic map values protobuf format (#3583)
* DAML-LF: generic map values protobuf format

* Apply suggestions from code review

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

* Address Gerolf's comment

* Apply suggestions from code review

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

* fix test

* Address Stephen's last comment
2019-11-26 13:34:33 +00:00
Andreas Herrmann
15f12eea6a Remove Bazel override (#3603)
* Remove Bazel override

The extended default shell env is no longer required. See
https://github.com/digital-asset/daml/pull/3597#pullrequestreview-322096242

* Import diff from rules_sh posix toolchain
2019-11-26 09:06:44 +00:00
Remy
d152c7cbfd daml-lf: rename Map to TextMap in archive proto (#3589)
* daml-lf: rename Map to TextMap in archive proto
+ in Scala/haskell AST

* a bit more renamming

* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/Serializability.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* fix test

* Apply suggestions from code review

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-11-25 12:14:57 +00:00
Andreas Herrmann
f4d0eb636e Replace Hazel by stack_snapshot (#2743)
* Unmangled libz.so and libbz2.so

* Use stack_snapshot instead of Hazel

* Remove Hazel

* Define stack_snapshot

* Update rules_haskell

* Document stack_snapshot

* Clean stack's lock file from aborted builds
2019-11-22 14:24:08 +00:00
Remy
3f8bd0da5e DAML-LF: rename ValueMap to ValueTextMap. (#3584) 2019-11-22 11:35:32 +00:00
Jussi Mäki
01be23fa82
Implement GenericSetTemplate and ImmutableSetFactory for InsertOrdSet (#3557)
This ensures we retain InsertOrdSet when transforming it.
2019-11-21 16:08:08 +01:00
Moritz Kiefer
8615266230 Switch the default DAML-LF version to 1.7 (#3530) 2019-11-19 19:18:07 +00:00
Jussi Mäki
ff03ed5f3f
Add party to participant mappings as submission inputs (#3456)
* Add InsertOrdSet

A set with deterministic ordering.

* Add party to participant mappings as inputs to kvutils submissions

* Add InsertOrdSetTest, remove fromSet. Sort packages and parties.

* Apply suggestions from code review

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

* Add AbstractSet and SetLike traits to InsertOrdSet. Remove (Non)EmptyInsertOrdSet.
2019-11-19 18:03:58 +01:00
Moritz Kiefer
6b536805bc Expose conversion from Ast.Type to iface.Type (#3511)
* Expose conversion from Ast.Type to iface.Type

This allows me to get rid of the duplicated conversion logic for DAML
script. The reason for why I can’t use the higher level APIs provided
by the interface reader is that the type of the script identifier can
be a function which is not serializable and therefore does not show up
in the interface. However, I only want to translate the type of the
argument of that function which is serializable.

* Update daml-lf/interface/src/main/scala/com/digitalasset/daml/lf/iface/reader/InterfaceReader.scala

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>
2019-11-18 18:22:50 +00:00
Moritz Kiefer
6a09ea7755
Support starting a DAML script from a JSON input value (#3490)
This uses the format for LF values that we already use elsewhere.

There is one annoying part in this PR where I had to duplicate the
logic for converting to the types used in the interface reader since
it is not exposed but hopefully we can get rid of this soon in a
separate PR.

fixes #3470
2019-11-18 14:42:14 +01:00
Remy
43eb69cbbd DAML-LF: add GenMap tests for LF encoder (#3491)
* daml-lf: fix decoder

* daml-lf: extend testing dar for encoder

* add EOF to .lf files

* change 1.dev to 1.7 for java codegen encoding test

* formatting

* fixes
2019-11-18 10:07:13 +00:00
Martin Huschenbett
3f2f69224c Fix comment about Party type in DAML-LF Engine (#3496) 2019-11-17 12:20:42 +00:00
Remy
4bd98b6cbc DAML-LF: add GenMap in iface reader (#3487)
* daml-lf: add GenMap in iface reader

* remove useless code

* Update language-support/scala/codegen/src/main/scala/com/digitalasset/codegen/lf/LFUtil.scala

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

* please restart CI
2019-11-17 08:12:10 +00:00
Remy
4d36c01682 Daml lf genmap (#3453)
* shortcup for SBMapEmpty

* daml-lf: add GenMap in the interpreter.
2019-11-15 10:36:41 +00:00
Remy
79383bd090 fix InsertOrdMap (#3474)
* fix InsertOrdMap

* Address Samir first comment

* Address Samir second comment

* more tests
2019-11-14 18:06:47 +00:00
Remy
b7e2c17863
cleanup InsertOrdMap (#3466)
* cleanup InsertOrdMap
2019-11-14 16:27:21 +01:00
Stephen Compall
c36696f3a7 json-api: in-memory comparison query (#3405)
* comparison query parser given scalar parser

- written in half-error-propagation style to better suit other potential
  error features

* factor dupes in RangeExpr

* text range parsing

* interpreting Range into in-memory predicate; points out bad dedupe from earlier

* make reuse of the scalar extractors much nicer

* express date, time, int64 as factored-out range exprs

* express numeric as factored-out range expr

* factor \&/ usage

* refactor LF value extractors for reuse in range queries

* factor mkRange usage

* totally deconstruct the int64 and text cases

* totally deconstruct the date and timestamp cases

* totally deconstruct the numeric case

* document comparison queries

* use Utf8.Ordering for text comparison queries

* int64 range query tests

* more int64 range query tests

* date, string, numeric range query tests

* include line # in query test successes table

* timestamp range query tests

* add release note

* remove duplicate changelog entry from #3425
2019-11-12 23:02:33 +00:00
Moritz Kiefer
b3ae6560d7
Add an initial version of DAML script (#3428)
The code still needs a fair amount of cleanup but it seems to work and
there is a test so I’d like to do the cleanup in-tree after merging
the current state
2019-11-12 18:02:14 +01:00
Remy
6f5c5fd3b1 daml-lf: add GenMap to archive proto (#3431)
* add GenMap to archive proto

* Address Martin's comments

* Address Gerolf's comments
2019-11-12 14:25:19 +00:00
Jussi Mäki
b57ef848aa
Use TreeMap for storing transaction nodes (#3418)
* Use TreeMap for storing transaction nodes

Going forward we require deterministic serialization for transaction nodes.
This PR switches the `Transaction.nodes` to use a TreeMap instead of HashMap,
which gives us deterministic serialization order for the transaction nodes.

An alternative would be to sort the transaction nodes when serializing, but
I feel avoiding HashMap altogether is the safer option as this may bite us
elsewhere as well (e.g. tests, new serialization code, etc.).

* Address review

* Remove unused import
2019-11-12 13:55:03 +01:00
Remy
aeea029030 cleanup equality for SValues (#3416)
* cleanup equality for SValues

* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/svalue/Equality.scala

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* fix equality

* fix EngineTest
2019-11-12 11:10:38 +00:00
associahedron
cacd12f511
Add GenMap to DAML-LF 1.dev spec (#3260)
* Add GenMap to DAML-LF 1.dev

* Update LF spec

* remove type constraints again

* Revert "remove type constraints again"

This reverts commit 2081e5b8ef.

* Fix a messed up merge
2019-11-11 16:36:09 +00:00
Andreas Herrmann
33e47828e3
Bazel 1.1 (#3249)
* bazel: 0.28.1 --> 1.1.0

* bazel-watcher sha256

* Fix missing line in patch

* proto_source_root --> strip_import_prefix

See https://github.com/bazelbuild/bazel/issues/7153 for details.

* Update rules_nixpkgs

Required to avoid errors of the form
```
ERROR: An error occurred during the fetch of repository 'node_nix':
   parameter 'sep' may not be specified by name, for call to method split(sep, maxsplit = None) of 'string'
```

and
```
ERROR: An error occurred during the fetch of repository 'node_nix':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 149
		_execute_or_fail(repository_ctx, <3 more arguments>)
	File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 318, in _execute_or_fail
		fail(<1 more arguments>)

Cannot build Nix attribute 'nodejs'.
Command: [/Users/runner/.nix-profile/bin/nix-build, /private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/node_nix/nix/bazel.nix, "-A", "nodejs", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/nixpkgs/nixpkgs"]
Return code: 1
Error output:
src/main/tools/process-tools.cc:173: "setitimer": Invalid argument
```

* Update rules_scala

* .proto has been removed, use [ProtoInfo] instead

See
https://docs.bazel.build/versions/1.1.0/be/protocol-buffer.html#proto_library

* python3_nix add nix_file attribute

To avoid the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/BUILD:66:1: //:nix_python3_runtime depends on @python3_nix//:bin/python in repository @python3_nix which failed to fetch. no such package '@python3_nix//': Traceback (most recent call last):
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 149
                _execute_or_fail(repository_ctx, <3 more arguments>)
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 318, in _execute_or_fail
                fail(<1 more arguments>)

Cannot build Nix attribute 'python3'.
Command: [/home/aj/.nix-profile/bin/nix-build, "-E", "import <nixpkgs> { config = {}; overlays = []; }", "-A", "python3", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/nixpkgs/nixpkgs"]
Return code: 1
Error output:
error: anonymous function at /home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/nixpkgs/nixpkgs.nix:3:1 called with unexpected argument 'config', at (string):1:1
```

* rules_haskell unnamed string.split(_, maxsplit = _)

The keyword argument may no longer be named.

* string.replace(_, _, maxsplit = _) may not be named

* Move proto sources from deps to data

Fixes

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/daml-lf/archive/BUILD.bazel:150:1: in deps attribute of scala_test rule //daml-lf/archive:daml_lf_archive_reader_tests_test_suite_src_test_scala_com_digitalasset_daml_lf_archive_DecodeV1Spec.scala: '//daml-lf/archive:daml_lf_1.6_archive_proto_srcs' does not have mandatory providers: 'JavaInfo'. Since this rule was created by the macro 'da_scala_test_suite', the error might have been caused by the macro implementation
```

* Define sha256 for haskell_ghc__paths

Bazel 1.1.0 fails on missing hashes.

* Disable --incompatible_windows_native_test_wrapper

* //compiler/daml-extension don't modify sources

Modifying sources in-place can cause issues on Windows, where build
actions are not sandboxed and changes on sources can affect other build
steps.

* bazel-genfiles --> bazel-bin

The bazel-genfiles symlink has been removed since Bazel 1.0.
See https://github.com/bazelbuild/bazel/issues/8651

* Mark dev_env_tool repository rule as configure

See
https://docs.bazel.build/versions/1.1.0/skylark/lib/globals.html#repository_rule

* Move data deps into data attribute

* Mark dev_env_tool as local = True

* Manually fetch @makensis_dev_env
2019-11-11 10:06:03 +01:00
Remy
ce36674ea0 daml-lf: clone dev protobuf for LF 1.7 (#3371) 2019-11-07 12:32:38 +00:00
Remy
d39d7974fc daml-lf: freeze version 1.7 (#3340)
* daml-lf: freeze daml-lf 1.7

* speedy: remove useless double checks
2019-11-07 09:51:18 +00:00
Remy
2885766826 daml-lf-encoder: validate dar generated by the encoder (#3339) 2019-11-05 15:15:08 +00:00
Remy
7d8a484ce9
daml-lf: prepare release of LF 1.7 (#3329)
* daml-lf: prepare release of LF 1.7

* add comment
2019-11-04 22:57:35 +01:00
Remy
7c427119e1 DAML-LF add Type Representation value (#3326)
* daml-lf: update spec with type-rep

* daml-lf: update proto with type-rep

* daml-lf: update scala side with TypeRep

* daml-lf: update compiler side with TypeRep

* Get triggers to compile

* Add featureTypeRep to allFeatures

* Apply suggestions from code review

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* daml-lf: add builtin for TypeRep equality

* Address Andrea's comments

* formatting

* Fix triggers

* Fix template typerep tests
2019-11-04 17:00:55 +00:00
Remy
d56a4aa715 Intern all strings: proto cleanup (#3296)
* daml-lf: cleanup strings/names interning for 1.dev

* change level of dottedName intening
* make interning mandatory
* rational name of proto field

* fix tests

* spec update

* fix test

* formatting

* Address Gerolf's comments

* Address Jussi's comments
2019-11-01 17:03:42 +00:00
Brian Healey
d530b2cdeb Address warnings over filename mismatch (#3313) 2019-11-01 15:14:25 +00:00
Jussi Mäki
0ca8580914 Fix the import paths of {value,transaction,blindinginfo}.proto (#3312)
* Fix the import paths of {value,transaction,blindinginfo}.proto

This cleans the imports in daml_kvutils.proto:

  -import "daml-lf/transaction/src/main/protobuf/transaction.proto";
  +import "com/digitalasset/daml/lf/transaction.proto";

This shouldn't be a breaking change to the outside as the proto files
themselves are not published, only the java libraries generated from them.

* Update missed deps
2019-11-01 14:54:55 +00:00
Ognjen Maric
cae0ffd7dc
Correctly handle package dependencies in Result#needPackage (#3308)
When a package has dependencies, `ConcurrentCompiledPackages#addPackage` returns
a `ResultNeedPackage` on the dependency.

This return value was ignored in `Result#needPackage`. As a consequence,
the package would never be added to the map of compiled packages in
this way.

This is problematic for the reinterpretation of `Fetch` nodes, when
performed on an `Engine` with a clean cache. The package would never get
loaded, but the interpretation would commence and then blow up. See
the modified test in `EngineTest.scala`.

The problem would not appear for other types of nodes, because the other
`CommandPreprocessor#preprocess*` functions (e.g., preprocessCreate)
also invoke `translateValue`, which correctly chains the result of `addPackage`.
2019-11-01 11:59:40 +01:00
Remy
5812a1246d
daml-lf: to_text_template_id -> to_text_type_con_name (#3293)
* simplify to_text_template_id

* to_text_template_id -> to_text_type_con_name
2019-10-30 17:32:36 +01:00
Remy
bd054b4955 daml-lf: interned strings/names in scenarios (#3255)
* daml-lf: interned strings/names in scenarios

* clean up

* Address Moritz's comments
2019-10-30 10:25:46 +00:00
Remy
b66c231aa0 daml-lf-spec: remove improper changes from a3518d67 (#3277)
* daml-lf-spec: remove improper changes from a3518d67

* address Gerolf's comments
2019-10-29 13:36:58 +00:00
Andreas Herrmann
2bd1db490a
Replace bazel-deps by rules_jvm_external (#3253)
* Update bazel-common to fix javadoc issues

Specifically, to fix the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel:7:1: in javadoc_library rule //ledger-api/rs-grpc-bridge:rs-grpc-bridge_javadoc:
Traceback (most recent call last):
        File "/home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel", line 7
                javadoc_library(name = 'rs-grpc-bridge_javadoc')
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/com_github_google_bazel_common/tools/javadoc/javadoc.bzl", line 27, in _javadoc_library
                dep.java.transitive_deps
object of type 'JavaSkylarkApiProvider' has no field 'transitive_deps'
```

* Define Maven deps using rules_jvm_external

* Pin artifacts

* Remove bazel-deps generated targets

* Remove bazel-deps

* Switch to rules_jvm_external targets

* update bazel documentation

* pom_file: There are no more bazel-deps targets

* BAZEL-JVM.md `maven_install` typo
2019-10-28 13:53:14 +01:00
Andreas Herrmann
dc2f10ebe6 Use TemplateTypeRep in DAML Trigger API (#3245)
* Add TemplateTypeRep to AnyContractId

* Define Trigger.ContractId t

* Use Trigger.ContractId t

* Implement fromCreated and fromArchived

* instance MapKey TemplateTypeRep

* More efficient ACS access using Map TemplateTypeRep

* ./fmt.sh

* toString and fromString for Identifier

* Replace Identifier by TemplateTypeRep

* TheContractId --> AbsoluteContractId

https://github.com/digital-asset/daml/pull/3245#discussion_r338033546
2019-10-23 13:56:59 +00:00
Remy
f3b98ca31d DAML LF: limit allocations for trivial constants (#3212)
* speedy: limit allocation of trivial SValue constants

* daml-lf: limit allocation of constants for Value, Exp, Type

* weaken numeric equality in ledger service test
2019-10-18 15:00:49 +00:00
Remy
5d9d679607 daml-lf. fix mapContractId for Any values (#3231) 2019-10-18 14:40:26 +00:00
Remy
25c3797d89
DAML-LF Numeric: compute properly the value version for + test update (#3122)
* extractor: update test with numerics
* java-codegen: test numeric
* fix some numeric tests
* fix assignVersion for values
2019-10-17 13:17:21 +02:00
Remy
416bfcfa8e
daml-lf: fix maven coordinates of daml_lf_archive_reader (#3209) 2019-10-17 10:50:56 +02:00