Commit Graph

39 Commits

Author SHA1 Message Date
Moritz Kiefer
4cd5766ab4 Remove duplication from PrettyScenario (#2236)
While experimenting with the pure Haskell gRPC implementation I
noticed that there is a fair amount of duplication in PrettyScenario
so this PR cleans up some of that.
2019-07-22 08:26:48 +00: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
Moritz Kiefer
cf0e0d6243 Remove outdated fixme in scenario service client (#2008) 2019-07-04 13:31:26 +00:00
Moritz Kiefer
bc20ace034
Make the gRPC timeout used for the scenario service configurable (#2000)
Given that we already made the max message size configurable it only
seems reasonable to also make the timeout configurable and on very
large projects, we do sometimes hit this.
2019-07-04 11:01:01 +02:00
Moritz Kiefer
995ee82fd0 Fix race condition in termination of scenario service (#1974)
Previously we sometimes ended up declaring the expected exit of the
scenario service as an unexpected exit. This PR addresses this by
adding a new variable that we set to True before we ask the scenario
service to exit by closing stdin.
2019-07-02 15:07:33 +00:00
Moritz Kiefer
c2a3d6ea28
Allow controlling the gRPC message limit via daml.yaml (#1970)
* Allow controlling the gRPC message limit via daml.yaml

We have had to raise that in the past since it caused issues on large
projects so it makes sense to make it configurable.

* Update unreleased.rst

Co-Authored-By: Beth Aitman <bethaitman@users.noreply.github.com>
2019-07-02 14:22:35 +02: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
Martin Huschenbett
25f1369cd7 Add support for DAML-LF's enum types to damlc (#1824)
* Add support for DAML-LF's enum types to damlc

This is part of #105.

* Address feedback
2019-06-25 14:44:21 +00:00
Moritz Kiefer
98e91d2ca2
Handle early exits of the scenario service (#1858)
fixes #1772
2019-06-25 15:34:02 +02: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
Moritz Kiefer
1406c41c02
Use 127.0.0.1 instead of localhost to connect to scenario service (#1848)
This fixes issues when running in an Alpine Linux docker container.
2019-06-24 16:45:12 +02:00
Moritz Kiefer
b41775e4d8
Move webview src to a separate JS file (#1784)
This makes it easier to modify and @hurryabit can no longer claim to
review Haskell when I change JS ;)
2019-06-20 14:55:30 +02:00
Moritz Kiefer
647c4d539e
Preserve the selected view on scenario result updates (#1776)
Previously, we always reverted back to the table view when the
scenario results changed. This PR changes this to preserve the
selected view.

I’ve also tested that this does not break backwards compatibility: If
you use the newer extension with an older SDK, you will get the
previous behavior of reverting to the table view and you can still
switch by clicking on the button.

Fixes #1675
2019-06-20 13:03:14 +02:00
Moritz Kiefer
3636bc7846
Double gRPC limit in the scenario service (#1697)
This is a temporary fix to unblock users that have run into this
limit. The long-term solution here is to use compression and/or make
the limit configurable.
2019-06-17 09:55:27 +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
Moritz Kiefer
1f76f23022 Run daml-ghc tests with full validation in the scenario service (#1546)
* Run daml-ghc tests with full validation in the scenario service

Fixes #128

* Swap default of optScenarioValidation
2019-06-06 13:14:11 +00:00
Moritz Kiefer
e400bc7eb8
Remove use of managed for starting the scenario service (#1508)
Ironically `managed` didn't turn out to make our code more manageable
and we ended up mostly using it in very isolated places only to then
immediately convert it back to bracket-style functions using `with`.

This PR also removes the use of `managed` from the GcpLogger which was
the only other place where we are using it and it finally kills the
rather silly logic that starting up the scenario service was tied to
having an event logger.
2019-06-04 17:17:05 +02: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
Anup Kalburgi
c0f4585033
Scenario header (#1285)
Scenario headers from type Constructor instead of data
2019-05-28 11:11:15 -04: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
Martin Huschenbett
6e73868220 Replace all occurrences of Tagged in DAML-LF AST with newtypes (#1289)
* Replace all occurrences of Tagged in DAML-LF AST with newtypes

This must end as it makes the code bases harder to understand without
adding any benefits.

* Add two more usages of mkVal

* Remove Orphans.Lib_hashable

* Remove tagged from package dependencies

* Derive stock classes as such
2019-05-21 16:19:57 +00:00
Francesco Mazzoli
95e8dd01c7 Maintainers must be signatories (#1124)
* check that maintainers are a subset of signatories

fixes #1123

* add note on why `fetchByKey` gets you the contract data
2019-05-21 11:59:59 +00:00
Martin Huschenbett
02d61cc48f
Rename render/parse functions for DAML-LF minor versions in Haskell (#1182)
The current naming suggests, the protobuf encoding and the CLI use different
textual representations of minor versions, which is not true. They only
differ in their types. We push this type conversion to the call sites
of both functions instead.
2019-05-16 14:58:10 +02:00
Moritz Kiefer
ad10f98020
Fix SDK integration tests on Windows (#1125)
* Fix SDK integration tests on Windows

* Switch to Haskell-based tar extraction
2019-05-14 21:55:45 +02:00
Remy
2e3a87934b Daml lf type safty (ChoiceName, VarName, FieldName, ConstructorName) (#983)
* daml-lf: make DefinitionRef more typesafe

* daml-lf: Identifier -> DefinitionRef

* daml-lf: remove unsafe apply and copy methods from DottedName

* daml-lf: create identifier

* daml-lf: make ChoiceNames Identifiers

* daml-lf: cleanup TVar

* daml-lf: FieldNames & VariantConstructors -> Identifiers

* bazel fmt

* daml-lf: VarName -> Identifier

* daml-lf: drop return inside Ref.scala

* daml-lf Identifier -> Name

* daml-lf DefinitionRef -> Identifier

* daml-lf make iface more type safe
+ address Francesco's comments

* daml-lf: remove unsafe unapply from MatchingStringModule

* fix navigator

* Address Stephen's Comments
2019-05-13 11:17:12 +00:00
Francesco Mazzoli
de54e8f60f
dynamically check type of contract ids, fixes #1005 (#1037)
Up to now, the engine blindly assumed that contract ids pointed to
contracts of the right type. However, this assumption is faulty:
contract ids coming from the Ledger API cannot be type checked
in command translation since we need access to the contract itself
to do so.

This caused some seriously surprising / broken behavior: one could
send an exercise command with the wrong template id and still go
through, or break internal invariants about the type of choices.

This commit fixes this by checking that the type of the contract
instances we fetch is correct at runtime.

cc @hurryabit @dajmaki @remyhaemmerle-da @S11001001 @meiersi-da
2019-05-09 17:11:05 +02: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
Neil Mitchell
fe3e5c9639
Delete DA.Prelude (#914)
* Use DA.Prelude a lot less

* Make LANGUAGE pragmas have the right case

* Don't reexport DA.Prelude

* Remove more DA.Prelude imports

* Remove the nastiest renaming DA.Prelude

* Final removal of DA.Prelude

* Kill DA.Prelude

* Add missing dependencies

* More missing package imports

* More missing package imports

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

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs
2019-05-04 18:51:56 +01:00
Neil Mitchell
3cab59ad6d Remove completely redundant imports of DA.Prelude (#911)
* Remove completely redundant imports of DA.Prelude

* Start chipping away at some NoImplicitPrelude too
2019-05-04 12:40:07 +00: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
Neil Mitchell
4040dffc7a
Start cleaning up pretty-print (#821)
* Move from prettyDiagnostic to prettyDiagnostics

* Remove as much pretty print stuff as we can

* Try moving duplicate named functions with similar semantics and identical types to different names

* Change to returning pretty printed outputs from Diagnostics

* Remove a redundant import
2019-05-01 19:06:00 +01:00
Neil Mitchell
5ed95bc64c
Move DA.Pretty into da-hs-base (#818)
* Move DA.Pretty into da-hs-base

* Bazel formatting

* Remove another instance of da-hs-pretty
2019-05-01 14:50:19 +01: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
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
Stephen Compall
fef8a956ee use WithTxValue in place of VersionedValue more broadly (#643)
* GenTransaction.WithTxValue alias

* undo parts of parent dealing explicitly with serialization

* use GenNode.WithTxValue more often

* use Node*.WithTxValue more often
2019-04-24 13:54:41 +00:00
Moritz Kiefer
416b0949fa Fix termination of scenario service on Windows (#629)
* Fix termination of scenario service on Windows

The lack of a proper Windows IO manager resulted in us being unable to
kill the conduits reading the output of the scenario service so `damlc
test` and `damlc ide` blocked forever. This PR fixes the problem by
shutting down the scenario service (by closing its stdin) before
killing the conduits .

* Use fail instead of error

* Add debugging output

* Remove debug output

* Bump timeout of perf test
2019-04-23 19:43:23 +00: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
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
Digital Asset GmbH
05e691f558 open-sourcing daml 2019-04-04 09:33:38 +01:00