Commit Graph

1782 Commits

Author SHA1 Message Date
Moisés Ackerman
7a3b715568
Add DA.Internal.Interface.AnyView.Types to scala StablePackage#stablePackages (#15559) 2022-11-14 18:13:57 +01:00
dylant-da
bb67fb7f51
Move userWrittenTuple check into own helper in GHC.Tuple.Check (#15445)
* Create tuple size check function in GHC.Tuple.Check

* Update desugar test

* lint

* Fix accidental minus in stable-packages

* Replace GHC.Types with GHC.Tuple.Check in doctest generation

* Fix DarReaderTest

* Fix DamlDocTest for GHC.Tuple.Check import

* Remove unnecessary DamlSyntax pragma

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* Point to merged GHC changes

* Point to akrmn's merged in changes

* Point back at merged in changes

* restart CI

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-11-11 15:59:29 +00:00
Remy
72c69fd55c
fix package in archive proto SNAPSHOT (#15550) 2022-11-11 14:15:50 +00:00
Remy
49f4d2979e
[LF] strengthen compilation flags (#15481) 2022-11-09 14:12:04 +01:00
tudor-da
346bb48904
Extract Ledger API error definitions in //ledger/ledger-api-errors [DPP-1269] (#15439)
* Extract Ledger API error definitions in //ledger/error-definitions

changelog_begin
SERVICE_INTERNAL_ERROR error code is created in CommonErrors and replaces the usage of LEDGER_API_INTERNAL_ERROR in ledger-api-client (as a fix).
changelog_end

* Tests in //ledger/error do not depend on //ledger/ledger-api-errors

* Remove unused dependency from //ledger/error

changelog_begin
changelog_end

* Address Martino's comment
2022-11-07 17:24:43 +01:00
Remy
f240917e94
[Speedy] Drop second argument of SResultFinal (#15429) 2022-11-04 14:20:21 +01:00
Remy
ed9d9c7ae6
[Speedy] move submissionTime in OnLedger case class (#15427) 2022-11-02 23:36:33 +00:00
Remy
e23f0a5cde
Speedy Cosmetic cleanup (#15421)
* change trait to abstract class
* add missing override
* cleanup scope restrictions
* add missing final
* add missing extends Product with Serializable
2022-11-02 16:11:36 +00:00
Remy
5a3a013b21
Speedy: cleanup SBUKeyBuiltin (#15420)
CHANGELOG_BEGIN
CHANGELOG_END
2022-11-02 13:35:59 +00:00
Remy
bd7e12809e
[LF] fix versioning of value w.r.t. interface (#15370)
CHANGELOG_BEGIN
CHANGELOG_END
2022-10-28 12:31:58 +02:00
Remy
0bba409d0e
[LF] Make ApiCommand.Exercise work directly with type constructor (#15360)
CHANGELOG_BEGIN
CHANGELOG_END
2022-10-26 18:13:38 +00:00
Carl Pulley
c407c4b635
Versioned triggering and correct parsing of TransactionMsg
CHANGELOG_BEGIN
CHANGELOG_END
2022-10-26 15:08:37 +01:00
dylant-da
da8064de64
Add AnyView with HasFromAnyView instances (#15280)
* Implement AnyView as a stable package / primitive

* Point to updated GHC

* Export AnyView datatype, move typeclasses, fix convertPrim

* Adjust AnyView w/ InterfaceTypeRep, implement {to,from}AnyView

* fix lint, satisfy changelog

CHANGELOG_BEGIN
CHANGELOG_END

* fix daml-desugar

* Has{From,To}AnyView instances in daml-docs

* Add DA.Internal.Interface.AnyView to LibraryModules for stdlib

* Fix hash for DA.Internal.Interface.AnyView

* Prefix AnyView with CurrentSdk, add to golden for daml-script test

* Remove HasToAnyView

* Split AnyView into AnyView and AnyView.Types

* fix hash

* Remove unused StandaloneDeriving

* Add HasField instances (requires relevant workers)

* Accept desugaring test changes for removal of HasToAnyView

* Update daml-doc for removal/modification of HasToAnyView/HasFromAnyView

* Update StablePackage hash for DA.Internal.Interface.AnyView.Types
2022-10-25 11:49:32 +00:00
Remy
4fa22e85c1
[Triggers] Version Trigger Daml code (#15298)
We track in `DA.Trigger.Internal` the version of the API between the Daml code and the scala code of the Triggers.

CHANGELOG_BEGIN
CHANGELOG_END
2022-10-21 11:36:59 +02:00
Remy
4318a2341b
[LF] Cleanup StablePackage object (#15250)
CHANGELOG_BEGIN
CHANGELOG_END
2022-10-19 08:06:49 +00:00
Moisés Ackerman
7e6908612b
Fix instance Show Text to produce escaped Text (#15235)
* Fix `instance Show Text` to produce escaped Text (#15177)

This adapts the code used in GHC's 'instance Show Char where { showList }', representing characters as single-character
'Text's using a type synonym. CPP can be used during development to switch to a newtype-based implementation in order
to check type safety.

changelog_begin
- [Daml Standard Library] ``show @Text`` now escapes special characters, producing syntactically correct expressions (#15177)
changelog_end

* Add daml-test-file testing `show @Text`

* Avoid 'explode' in 'showLitChr'

* Cleanup 'showLitChr'

* Update DarReaderTest.scala

* Clean up import of GHC.Base

* Add Note for __DEBUG__SHOW_TEXT_CHR_NEWTYPE macro

* Extract longStringSize from longStringOf in daml-test-file ShowText.daml

* Document differences with GHC implementation

* Remove redundancy between showLitChr and {ascii=>ctrlChrText}

* Add 'exhaustive' test case in daml-test-file ShowText.daml

* Change 'ctrlChrText' default case to throw error
2022-10-17 18:07:56 +02:00
Claudio Bley
e24497635d
Rework evidence security categories (#15226)
* Rework evidence security categories

using the 7 industry standard security testing areas:

* Authentication
* Authorization
* Confidentiality
* Integrity
* Availability
* Non-Repudiation
* Resilience

CHANGELOG_BEGIN
CHANGELOG_END

* Replace category `Input Validation`

* Replace category `Privacy`

* Replace category `Semantics`

* Replace category `Semantics`

* Replace category `Performance`

* Skip categories `NonRepudiation` and `Resilience` for now

There are currently no tests for these categories.

* Regenerate `security-evidence.md`
2022-10-13 09:55:45 +00:00
nickchapman-da
490056ebf9
fix bug in pretty-print for empty kont-stack (#15179)
changelog_begin
changelog_end
2022-10-10 16:35:10 +02:00
nickchapman-da
4d5157b20e
remove dead code (#15181)
changelog_begin
changelog_end
2022-10-06 15:57:27 +00:00
Carl Pulley
6364deb68e
Disable visibility checks for disclosed contracts and disclosed contract keys
* Fixes #14168

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-30 09:38:08 +01:00
Carl Pulley
233bca9d01
Proper error handling on input validation of disclosed contracts
* Fixes #14200

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-29 17:21:02 +01:00
Simon Maxen
817e6aac01
Exclude infrastructure transactions [DPP-1110] (#15121)
* Exclude infrastructure transactions

changelog_begin
changelog_end
2022-09-29 16:22:52 +01:00
dylant-da
485eb2b8dd
Archive choices for interfaces (#15085)
* Point to latest GHC with archive choices on interfaces

* Update Desugared daml for interfaces Archives

* satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-doc test files

* Add relevant identifiers to SignatureReaderSpec for iface Archive choice

* lint

* Point to GHC with generated HasArchive instance

* Add test for archive on interface

* Test that second archive doesn't work

* Update desugar tests

* Point to GHC merge
2022-09-29 10:57:07 +01:00
nickchapman-da
68b323635d
[engine] prefer lastLocation to stackTrace (#15111)
TLDR: Remove broken code which constructs stackTrace().
Happy never to have to read those NOTE(MH) comments in the pushLocation code again!

(1) This code was fundamentally broken for various reasons:
- It doesn't make sense to track location info on the continuation stack. The continuation stack is a record of the evaluation still to come; not a context for the current evaluation.
- Stack traces can't sensibly be provided in a language such as Daml which promises that tail-recursion is evaluated in constant stack-space.
- Attempting to keep location info on the continuation stack does not play well when exceptions are thrown and the stack is unwound.

(2) The stack-trace management code was also very hacky:
- The pushLocation code contained special cases when the continuation stack was headed by a KArg/SToken continuation. This is an internal implementation detail. The KArg doesn't even exist when we stop using the deprecated SEAppGeneral expression constructor.
- The pushLocation code also contained special support for copying stack-traces into SEVal and SDefinition caches, and then later back on to the continuation stack. Yuck!

(3) The stackTrace() code was barely used:
- Some time ago an alternative/simpler location tracking system (lastLocation) was implemented.
- Only ScenarioRunner makes use of the stackTrace()
- Only a single test changes behaviour when we drop use of stackTrace() in favour of getLastLocation
2022-09-28 13:15:08 +01:00
Carl Pulley
935a49d02d
OnLedger immutability
CHANGELOG_BEGIN
CHANGELOG_END
2022-09-27 11:37:29 +01:00
nickchapman-da
e222ee81d6
prefer @deprecated/@warn for SEAppGeneral and SEAppOnlyFunIsAtomic, to renaming functions with _DEPRECATED suffix (#15091) 2022-09-26 18:14:24 +00:00
Remy
1004355fa4
[LF-SPEC] remove files added by mistake after rebase (#15092)
CHANGELOG_BEGIN
CHANGELOG_END
2022-09-26 16:26:02 +00:00
Stephen Compall
dfab8c8b28
rename daml-lf-interface Maven artifact to ...api-type-signature; remove deprecated symbols (#15087)
* remove 2.4.0-deprecated symbols and functions from api-type-signature library

* rename daml-lf-interface maven artifact to daml-lf-api-type-signature

CHANGELOG_BEGIN
- [Daml-LF] Java/Scala applications that directly depend on the (not officially
  supported) ``daml-lf-interface`` library should upgrade to 2.4.0 first, fix
  all deprecations, then upgrade to 2.5.0+ and change their Maven dependencies
  to point to ``daml-lf-api-type-signature`` instead.
CHANGELOG_END
2022-09-26 16:12:20 +00:00
dylant-da
db652ef270
Improve EExpectedViewType (#15048)
* Add dylant-da as a codeowner on compiler-related directories

CHANGELOG_BEGIN
CHANGELOG_END

* SPlit EExpectedViewType into three variants with non-Text bodies

* Duplicate Haskell viewtype typechecking behaviour onto Scala side

* Split TypingSpec tests for different viewtype failures

* lint & changelog

CHANGELOG_BEGIN
CHANGELOG_END

* Fix lint
2022-09-26 14:38:12 +00:00
nickchapman-da
3180094987
[engine] avoid construction of unrestricted speedy expression applications (#15079)
Avoid construction of unrestricted speedy expression applications.SEApp (alias for SEAppGeneral)

- Replace occurrences of SEApp(General) to use SEAppAtomic, with SELet1 as required
- Add new helper SEApp for many cases where arguments are simple values.
- Rename the most general unrestricted constructor as SEAppGeneral_DEPRECATED. The only remaining use is by fromUpdateSExpr and fromScenarioSExpr, due to our unprincipled approach to stack-trace. See TODO in pushLocation. I hope to fix this in a future PR.
- Rename the slightly less unrestricted constructor as SEAppOnlyFunIsAtomic_DEPRECATED. The only call site being in Anf.scala (for the case when ANF is not performed). Maybe one day we can perform ANF in all cases, and hence remove this one remaining usage.
2022-09-26 14:33:51 +01:00
Carl Pulley
7635fbe83c
Test that disclosed contracts respect template/contract preconditions (i.e. ensure clauses)
* Fixes #14227

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-26 08:37:06 +01:00
Remy
6dd9a45e50
[Engine] small cleaning of LookupError (#15060)
* [Engine] small cleaning of LookupError

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-23 13:46:14 +00:00
Remy
56dfeb1e87
[LF] improve AstRewriter (#15073)
CHANGELOG_BEGIN
CHANGELOG_END
2022-09-23 15:13:19 +02:00
Carl Pulley
49f2f7ef20
Bug fix for Classify class - corrects continuation and expression counts
CHANGELOG_BEGIN
CHANGELOG_END
2022-09-23 13:26:11 +01:00
Remy
a1e92e539f
[LF] fix encoder for ELocation (#15070)
* [LF] fix encoder for ELocation

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-23 10:28:21 +00:00
Carl Pulley
3ace00d787
Refactor to ensure Instrumentation and Classify classes are immutable
* Refactor to ensure Instrumentation and Classify classes are immutable

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-22 17:57:16 +01:00
Carl Pulley
aa062cde42
Final step of explicit disclosure cached contract refactor
* Fixes #13897

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-21 18:12:55 +01:00
Remy
3f163e8e2e
[engine] drop deprecated LenientExercise Command (#15059)
CHANGELOG_BEGIN
CHANGELOG_END
2022-09-21 16:48:05 +00:00
nickchapman-da
0ebe770e59
[engine] stack-safe daml-lf archive decoding (#14964)
Transform our code for the protobuf-decoding phase to be stack-safe, by means of a Work trampoline. The code-style rules are:

runWork is never called in a nested context.
We introduce an explicit Work.Delay to break recursion.
Increase the size of the many-fields test from 120 to 160 fields.

(At 164 fields we run into the protobuf limit)

Part of: #13410
2022-09-20 16:51:50 +01:00
Carl Pulley
e134e04913
Part of explicit disclosure cached contract refactor
* Stubbed out `SBUpdateContractCache` builtin and integrated it into Engine and Compiler workflows

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-20 14:55:52 +01:00
Carl Pulley
f9b166ab35
Restrict degree to which Speedy.Machine exposes its mutable state
* Restrict degree to which Speedy.Machine exposes its mutable state

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-20 09:30:03 +01:00
Nicu Reut
03256ddbf5
[lf kv lib] - Clean up transaction traversal [kvl-1566] (#15032)
* [lf kvlib] - Remove scalaz usages from transaction traversal

* Explicitly handle unsupported node types when traversing with witnesses

changelog_begin
changelog_end
2022-09-16 10:36:19 +02:00
Nicu Reut
3f06e322fd
[lf kvlib] - Handle rollback nodes when traversing transaction [KVL-1566] (#15020) (#15028)
We need to extract all the package party mappings found in a transaction, including the nodes that are under a rollback node
Rollback nodes have no informees of their own but we extract the children as expected

changelog_begin
changelog_end
2022-09-15 08:48:14 +00:00
Nicu Reut
21e8ba089e
[daml-lf kvsupport] - Add transaction traversal for package party mappings [KVL-1566] (#14965)
changelog_begin
changelog_end
2022-09-08 11:31:24 +02:00
Carl Pulley
b361d96768
Changes to ensure CompiledPackages contains contract key template lambda definitions
* Compiler changes:
- add in ContractKeyWithMaintainersDefRef
- ensure compileModule compiles contract key lambdas for templates (and so allow contract keys to be extracted from contract instances)

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-06 13:53:34 +01:00
Moisés Ackerman
db4de4e8c5
Engine: Include interface's packageId in usedPackages (#14887)
* Give type signature for runApi

* Add InterfaceRetro.dar in daml-lf/tests

* Add failing test case

* Include interface packageId in usedPackages

changelog_begin
changelog_end
2022-09-02 16:22:33 +00:00
Stephen Compall
2b6289a259
enable interface view tests in api-type-signature (#14877)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-31 09:23:14 -04:00
dylant-da
804a0b7b9d
Reenable tests from #14773 #14770 / Add new tests for 1.15 (#14836)
* Squashed commit of the following:

commit fd04d54efffdd182b15ed5350ac190fd7e800f2c
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 14:46:19 2022 +0100

    lint

commit 117a3e1253cbede690127b66ee73a7ad7a75fd51
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 13:16:00 2022 +0100

    Temporarily disable isCompleted assertions - they appear to be too eager

commit a17e30b045affad557c1282b9c56229f64ab0d51
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 12:21:40 2022 +0100

    Remove unnecessary NotExtended tests, fix module names, reenable some

commit 075a62e6f263b86a342e887a0015cf0b812ad4e1
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 10:48:24 2022 +0100

    Remove InterfaceConversions - interface exercises are now Interface-only

commit 4b8a7b4a061ea740e5b72c06b99cf6eaced2315d
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 10:39:03 2022 +0100

    Update carbon test names for 1.dev suite test

commit 04e735223cc2c06fa3dd014538edcc5e4d5dd191
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 10:23:45 2022 +0100

    Point to 1.15 for carbon tests

commit 450e49479fc2daed3bc6a08234a95df8fe80382e
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 10:11:23 2022 +0100

    Move InterfaceSubscriptionsIT test to 1.15 folder

commit b1cd99d8074f789927d2e02b46a085fcd7a88319
Merge: 1dfdc2e7c5 f21b165c78
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 29 09:47:09 2022 +0100

    Merge remote-tracking branch 'origin/main' into dylan-lf-15-reenable-tests

commit 1dfdc2e7c503e9d798b60bc1279633295e50bb0c
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 25 16:58:37 2022 +0100

    Add NotExtended versions of all tests which use extended interfaces

commit 6398fa96c5c1d14dda1ff724d3d4b5de6301b97b
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 25 13:01:30 2022 +0100

    Make versions of tests that are NotExtended

commit c2daf05e134ab3d0d27d83a7ef24e07553b15c3e
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 25 12:20:03 2022 +0100

    Reenable disabled tests from #14770 / #14773

commit f390d37941
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 25 11:56:52 2022 +0100

    Remove 1.dev-only references from 1.15 protobuf

commit 87d6b540aa
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 25 11:36:08 2022 +0100

    Temporarily disable failing damlc tests

commit 05ea7bdb75
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 25 09:49:08 2022 +0100

    Update desugared daml for UExerciseInterface[Guarded] generation

commit 14fdd5f725
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 25 09:44:59 2022 +0100

    Run damlc interface tests w/o requires when since DAML_INTERFACE

commit d73c86df3f
Merge: 9a83d0776e 00705af419
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Wed Aug 24 16:35:31 2022 +0100

    Merge remote-tracking branch 'origin/main' into dylan-lf-15-minimal-distinguish-guards

commit 9a83d0776e
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Wed Aug 24 15:22:59 2022 +0100

    Exclude via $cexerciseGuarded check - ClassOpId approach did not work

commit b635dcd7cb
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Wed Aug 24 12:59:57 2022 +0100

    Add check for isId to splitDFunId

commit dcfa1e0ebf
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Wed Aug 24 11:43:19 2022 +0100

    Remove all instances of guarded exercises in versions <= 1.15

commit b0985ccdbd
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 23 13:10:15 2022 +0100

    Remove guarded exercise when Extended Interfaces are not enabled

commit 125280ca60
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 15:33:55 2022 +0100

    Clarify purpose of `Maybe Expr` type for exercise guard

    Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

commit 50cff3004b
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 15:32:17 2022 +0100

    Remove unnecessary mention of v1_14 from supportedInputVersions

    Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

commit 89744ef341
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 15:31:04 2022 +0100

    Rename interface features

    Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

commit c173799c47
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 15:23:13 2022 +0100

    Attach correct range to guard support error (if any)

    Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

commit c41f8480ed
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 18 12:57:28 2022 +0100

    Update to new GHC revision, removes pred argument from `exercise`

commit d9dfe87252
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 16 12:06:04 2022 +0100

    Desugar UExerciseInterface[Guarded] differently, point to updated GHC

commit dd0ac96dcd
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 16 12:05:53 2022 +0100

    Make exercise guards nullable, ignore Nothing in decode/encode

commit 53e23fac26
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 23 13:13:09 2022 +0100

    lint

commit abf5267051
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 23 12:50:04 2022 +0100

    Move InterfaceSubscriptionsIT test back into 1.dev suite

commit c2d1499747
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 23 12:00:17 2022 +0100

    Use dictionary comprehension to generate ledger/test-common test_names

commit 0d5f167fc6
Merge: 0242452662 ec4c86ac2d
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 23 10:27:21 2022 +0100

    Merge remote-tracking branch 'origin/main' into dylan-lf-15-minimal

commit 0242452662
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 23 10:26:29 2022 +0100

    Temporarily disable decode extended interface primitives test

commit b17ca7f03c
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 16:26:10 2022 +0100

    lint

commit ceaca2b0f6
Merge: c11eb08083 95d00c4e8a
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 16:12:43 2022 +0100

    Merge remote-tracking branch 'origin/main' into dylan-lf-15-minimal

commit c11eb08083
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 15:20:50 2022 +0100

    Disable PureConfigReaderWriter tests that assume early-access == stable

commit 03734d2f23
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 14:02:55 2022 +0100

    Also disable conformance-test-tls1.2-or-newer-1.15

commit e683ea3d7c
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 14:00:45 2022 +0100

    Temporarily disable 1.15 conformance tests - handle in another PR

commit 6fb140b0b6
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 13:59:58 2022 +0100

    lint

commit 65531fe577
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 22 11:00:41 2022 +0100

    Run retroactive implements tests only in extended interfaces

commit edf20bf4a7
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Fri Aug 19 17:48:39 2022 +0100

    Fix StableVersions back to 1.14, make EarlyAccessVersions 1.15

commit 12818dc58f
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Thu Aug 18 18:06:36 2022 +0100

    Allow unsafe_from_interface and interface_template_type_rep in 1.15

commit ff7271de1a
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Fri Aug 19 10:55:40 2022 +0100

    Update tests with extended interface features to only run on 1.dev

commit 9558feaec8
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Fri Aug 19 16:47:19 2022 +0100

    satisfy changelog check

    CHANGELOG_BEGIN
    CHANGELOG_END

commit 337cc25b7a
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Wed Aug 17 16:36:45 2022 +0100

    Fix InterfaceNotSupported message to 1.15 or higher

commit 4282ae396b
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 16 17:41:15 2022 +0100

    Move v1_15 ledger-api-tests into own suite

commit ac3d0a9f25
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Fri Aug 19 15:18:41 2022 +0100

    Reinclude 1.15 in COMPILER_LF_VERSIONS to build model-tests-1.15

commit 718879020d
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Fri Aug 19 14:43:35 2022 +0100

    Add 1.15 test suite to testtool

commit a6fd63d3d9
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Fri Aug 19 14:43:23 2022 +0100

    Add 1.15 as preview version

commit f5c48ddc99
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Fri Aug 19 14:43:12 2022 +0100

    Make 1.14 default again

commit b9527c1136
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Wed Aug 17 14:23:16 2022 +0100

    Update Version 1.15 changelog with Call/implements

commit 9cecad5205
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Wed Aug 17 11:24:49 2022 +0100

    Add Tests file for 1.15 in ledger API testtool

commit cde583d08d
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 16 16:41:58 2022 +0100

    Remove references to dev from 1.15 protobufs

commit 904da5679b
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 16 13:04:19 2022 +0100

    Stage 1.15 protobuf

commit 196fa6a3cf
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Tue Aug 16 11:54:20 2022 +0100

    Update Ast/Version & docs for 1.15, split interface into simple/extended

commit 1c58421f2d
Author: Dylan Thinnes <dylan.thinnes@digitalasset.com>
Date:   Mon Aug 15 13:05:37 2022 +0100

    Add version 1.15 - move interfaces into them

* API-test-tool: add InterfaceSubscriptionsIT to LF 1.15 tests

CHANGELOG_BEGIN
CHANGELOG_END

* fix bug

* Add version 1.15 - move interfaces into them

* Update Ast/Version & docs for 1.15, split interface into simple/extended

* Make 1.14 default again

* Update tests with extended interface features to only run on 1.dev

* Fix StableVersions back to 1.14, make EarlyAccessVersions 1.15

* Run retroactive implements tests only in extended interfaces

* Disable PureConfigReaderWriter tests that assume early-access == stable

* lint

* Move InterfaceSubscriptionsIT test back into 1.dev suite

* lint

* Remove unnecessary mention of v1_14 from supportedInputVersions

Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* Run damlc interface tests w/o requires when since DAML_INTERFACE

* Temporarily disable failing damlc tests

* Reenable disabled tests from #14770 / #14773

* Move InterfaceSubscriptionsIT test to 1.15 folder

* Remove InterfaceConversions - interface exercises are now Interface-only

* Re-enable assertEquals

* Modify PureConfigReaderWriterSpec to account for stable != early-access

* Disable conformance tests

* Disable on-canton conformance_test instead

* Remove InterfaceTypeRepCheck - all exercises are on interface now

* Fix UpcastDowncast tests

* Fix DowncastUpcast 1.15 test, convert assets to token in Guarded test

* Move typerep/unsafeFromInterface decode tests to basic interfaces

* Fix desugared daml for damlc test changes

* Reintroduce InterfaceConversions - remove impossible exercise

This reverts commit 075a62e6f263b86a342e887a0015cf0b812ad4e1.

* Reintroduce InterfaceTypeRepCheck - fix test to use T2Choice

This reverts commit d8a0a7f299.

* Run InterfaceTypeRepCheck for LF 1.15

Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-08-30 13:58:31 +00:00
Remy
4622de48bd
API-test-tool: add InterfaceSubscriptionsIT to LF 1.15 tests (#14800)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-30 09:20:22 +02:00
Stephen Compall
99a48557d3
deprecate interface library names; use new names downstream (#14856)
* new names in daml-script/runner

* new names in json-api

* new names in Scala bindings/codegen

* new names in Java bindings/codegen

* new names in daml-lf interpreter tests

* more new names in daml-script tests

* new names in navigator backend

* deprecate all iface symbols and old method names

CHANGELOG_BEGIN
- [Scala API] ``com.daml.lf.iface`` has been deprecated, as discussed
  further in
  `issue #14783 <https://github.com/digital-asset/daml/pull/14783>`__.
  Use the deprecation warnings as guidance to the new names.
CHANGELOG_END

* prefix cases in OrderingSpec

- suggested by @remyhaemmerle-da; thanks
2022-08-29 20:43:47 +00:00
Remy
45bfb26ade
LF clean up proto snapshot of LF 1.15 (#14799)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-29 10:40:19 +00:00
Chun Lok Ling
47216d1f1a
Pass retroImplements from Ast.DefInterface to DefInterface (#14843)
* pass retroImplements from Ast.DefInterface to DefInterface and addted test case

CHANGELOG_BEGIN
CHANGELOG_END

* added todo

CHANGELOG_BEGIN
CHANGELOG_END

* fixed findTemplate , added test cases

CHANGELOG_BEGIN
CHANGELOG_END

* add test data

CHANGELOG_BEGIN
CHANGELOG_END

* add copyright

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-25 23:53:01 +01:00
dylant-da
6ece737e46
Desugar guards compatibly with 1.15/1.dev split (#14773)
* Add version 1.15 - move interfaces into them

* Update Ast/Version & docs for 1.15, split interface into simple/extended

* Stage 1.15 protobuf

* Remove references to dev from 1.15 protobufs

* Add Tests file for 1.15 in ledger API testtool

* Update Version 1.15 changelog with Call/implements

* Make 1.14 default again

* Add 1.15 as preview version

* Add 1.15 test suite to testtool

* Reinclude 1.15 in COMPILER_LF_VERSIONS to build model-tests-1.15

* Move v1_15 ledger-api-tests into own suite

* Fix InterfaceNotSupported message to 1.15 or higher

* satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Update tests with extended interface features to only run on 1.dev

* Allow unsafe_from_interface and interface_template_type_rep in 1.15

* Fix StableVersions back to 1.14, make EarlyAccessVersions 1.15

* Run retroactive implements tests only in extended interfaces

* lint

* Temporarily disable 1.15 conformance tests - handle in another PR

* Also disable conformance-test-tls1.2-or-newer-1.15

* Disable PureConfigReaderWriter tests that assume early-access == stable

* lint

* Temporarily disable decode extended interface primitives test

* Use dictionary comprehension to generate ledger/test-common test_names

* Move InterfaceSubscriptionsIT test back into 1.dev suite

* lint

* Make exercise guards nullable, ignore Nothing in decode/encode

* Desugar UExerciseInterface[Guarded] differently, point to updated GHC

* Update to new GHC revision, removes pred argument from `exercise`

* Attach correct range to guard support error (if any)

Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* Rename interface features

Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* Remove unnecessary mention of v1_14 from supportedInputVersions

Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* Clarify purpose of `Maybe Expr` type for exercise guard

Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* Remove guarded exercise when Extended Interfaces are not enabled

* Remove all instances of guarded exercises in versions <= 1.15

* Add check for isId to splitDFunId

* Exclude via $cexerciseGuarded check - ClassOpId approach did not work

* Run damlc interface tests w/o requires when since DAML_INTERFACE

* Update desugared daml for UExerciseInterface[Guarded] generation

* Temporarily disable failing damlc tests

* Remove 1.dev-only references from 1.15 protobuf

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-08-25 14:20:03 +01:00
Remy
0f662a66a9
LF: simplify error about unserializability of view (#14803)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-25 09:53:03 +00:00
mziolekda
31cc435331
small corrections in the specification of the lf transaction (#14827)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-25 10:16:41 +02:00
Remy
5a07b6596f
LF: check viewtype is a monomorphic record (#14802)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-25 10:02:13 +02:00
Stephen Compall
f43bc5c8d1
use new api-type-signature names in some dependents (#14785)
* use new names in json-api

* use new names in java codegen

* use new names in Scala codegen

* use new names in TypedValueGenerators

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-23 17:52:10 +00:00
Stephen Compall
f85f7816c7
rename interface library to api-type-signature; alias symbols (#14783)
* move interface directory to api-type-signature; change bazel target; move scala files

* rename iface package to typesig; rename EnvironmentInterface to EnvironmentSignature

* rename Interface to PackageSignature

* rename fromReaderInterfaces to fromPackageSignatures

* rename InterfaceReader to SignatureReader

* rename InterfaceReader to SignatureReader in deprecation note

* rename readInterface to readPackageSignature

* rename InterfaceReaderError to Error

* rename InterfaceReaderMain to SignatureReaderMain

* rename InterfaceType to PackageSignature.TypeDecl

* rename astInterfaces to interfaces

* rename astInterfaces to interfaces in PackageSignature

* rename findAstInterface to findInterface

* rename a couple arguments

CHANGELOG_BEGIN
- [Scala API] The "quasi-public" API in ``com.daml.lf.iface`` has moved
  to the new ``com.daml.lf.typesig`` package, with many accompanying
  name changes as documented in `issue #13669
  <https://github.com/digital-asset/daml/issues/13669>`__.

  Daml 2.5.0 or later will remove the old names, and also rename the
  Maven artifact from ``daml-lf-interface`` to
  ``daml-lf-api-type-signature``.  We recommend that users of this API
  use the deprecation guidance in 2.4.0 to port their applications
  before this happens.
CHANGELOG_END
2022-08-23 15:21:45 +00:00
dylant-da
a74c020ddd
Add version 1.15 - move interfaces into them (#14770)
* Add version 1.15 - move interfaces into them

* Update Ast/Version & docs for 1.15, split interface into simple/extended

* Stage 1.15 protobuf

* Remove references to dev from 1.15 protobufs

* Add Tests file for 1.15 in ledger API testtool

* Update Version 1.15 changelog with Call/implements

* Make 1.14 default again

* Add 1.15 as preview version

* Add 1.15 test suite to testtool

* Reinclude 1.15 in COMPILER_LF_VERSIONS to build model-tests-1.15

* Move v1_15 ledger-api-tests into own suite

* Fix InterfaceNotSupported message to 1.15 or higher

* satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Update tests with extended interface features to only run on 1.dev

* Allow unsafe_from_interface and interface_template_type_rep in 1.15

* Fix StableVersions back to 1.14, make EarlyAccessVersions 1.15

* Run retroactive implements tests only in extended interfaces

* lint

* Temporarily disable 1.15 conformance tests - handle in another PR

* Also disable conformance-test-tls1.2-or-newer-1.15

* Disable PureConfigReaderWriter tests that assume early-access == stable

* lint
2022-08-23 13:39:16 +00:00
Carl Pulley
c69548fe21
Quick fix for interface and transaction versioning issues
CHANGELOG_BEGIN

* Ensure SBUBeginExercise has a version that is max(template version, interface version)

CHANGELOG_END
2022-08-22 10:01:18 +01:00
Remy
28f261ab5d
LF: Drop old deprecate definition (#14761)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-19 15:48:42 +02:00
Remy
769e26e104
LF: Remove unecesary spaces in LF snippet (#14762)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-19 15:29:32 +02:00
Remy
48abfeb9dc
LF: distinguish template Id from interface Id in exercise command (#14755)
preliminary work for #14747

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-19 14:00:40 +02:00
Remy
6ce1b71d69
LF: use Value instead KeyWithMaintainers in ContractStateMachine (#14760)
To simplify a bit

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-19 10:04:22 +02:00
Remy
18ef46052f
LF: force view evaluation during by_interface updates (#14738)
Possible errors during such evaluation are uncatchable

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-18 16:49:29 +00:00
Remy
4ac224b518
LF: Move TemplateOrInterface form language package to data package (#14748)
to be able to use it without direct dependence to language package.

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-18 16:20:18 +02:00
Remy
b53c7c3799
LF test use consistently record for interface view. (#14746)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-18 10:27:43 +00:00
Remy
965db6c839
LF: make error in controllers/observers of interface choice uncatchable (#14736)
* LF: make error in controllers/observers of interface choice uncatchable

CHANGELOG_BEGIN
CHANGELOG_END

* fix
2022-08-17 15:09:25 +00:00
Remy
4acdb85d4a
LF: missing braces in string interpolation for ConcreteInterfaceInstance#pretty (#14739)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-17 15:04:35 +00:00
Moisés Ackerman
009c3c306b
Add interface instance syntax, including retroactive interface instances (#14715)
* Extract qualifyLocally in LFConversion

* Update ghc rev

* Add parent type argument to interface instance desugaring types

* Check interface instance parent in LFConversion

* Convert interface instances in interface declarations

* Update daml-test-files to use 'interface instance' syntax

* Update other tests to use 'interface instance' syntax

* Update interface reference docs to use 'interface instance' syntax

* Update other files to use 'interface instance' syntax

* Add todo in DA.Daml.LF.Ast.Pretty

* Add daml-test-files for retroactive interface instances

changelog_begin
changelog_end
2022-08-17 12:06:59 +00:00
Carl Pulley
26b48133b4
Test expected behaviour when superfluous (i.e. unused) contracts are disclosed in commands (#14617)
* Resolves #14350

CHANGELOG_BEGIN

* Engine/speedy-level tests for explicit disclosure (#14227): Test expected behaviour when superfluous (i.e. unused) contracts are disclosed in commands.

CHANGELOG_END
2022-08-16 14:15:47 +01:00
dylant-da
b8a17e5dac
Remove TODOs relevant to #14112 (#14663)
* Remove outdated TODO on ValueEnricher

* Rename collectNewPackagesFromTemplateIds for interface use, remove TODO

* Remove outdated TODO on interfaceInstanceBody parser

* Check body view has interface viewtype as type

* Amend type iterator to go over Interface view method, remove TODO

* empty changelog commit

CHANGELOG_BEGIN
CHANGELOG_END

* Fail in Preprocessing when viewing nonimplementing interfaces

* Fix interface instance check in Typing

* Fix lint

* Typecheck view expression with tmplParam in scope

* Remove done TODO in checkInterfaceInstance

* Move AmbiguousInterfaceInstance error into LookupError as a case variant

* lint

* Add unapply to LookupError to default to NotFound
2022-08-15 16:12:42 +00:00
Sergey Kisel
6d2bcc001b
Typo fix (#14692)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-11 11:01:39 +00:00
dylant-da
0d37134bc2
Change placeholder unit viewtypes to empty records (#14656)
* Update views in integration-v1dev to be EmptyInterfaceView instead of ()

* Update expected desugared daml for `EmptyInterfaceView`

* Update compiler Shake / DataDependencies viewtypes to EmptyInterfaceView

* Add record viewtypes to docs, update docs

* Add empty records to daml-lf, language-support, ledger, trigger tests

* Qualify EmptyInterfaceView in ledger semantic Interface tests

* Fix imports for EmptyInterfaceView in IIou / CIou / Transferrable

* empty changelog commit

CHANGELOG_BEGIN
CHANGELOG_END

* Qualify EmptyInterfaceView import

* Fix imports of EmptyInterfaceView in TypeScript codegen tests

* Accept Interface doc changes

* Add EmptyInterfaceView to DataDependencies tests

* Remove missing interface viewtype test - all interfaces must have views

* Replace all EmptyInterfaceView with EmptyInterfaceView {}
2022-08-10 16:45:23 +00:00
Remy
1a0aec9096
LF: utility function for Canton to handle interfaces (#14678)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-10 14:40:15 +00:00
nickchapman-da
80f40fe376
prefer Control to throw (#14661)
changelog_begin
changelog_end

kill: SEDamlException
2022-08-10 09:31:35 +01:00
Carl Pulley
19a2b986bc
Disclosure testing invalid contract type
* Test that invalidly typed contracts are rejected

CHANGLELOG_BEGIN

* Engine/speedy-level tests for explicit disclosure (#14227): test that invalidly typed contracts are rejected.

CHANGELOG_END
2022-08-09 18:45:44 +01:00
Moisés Ackerman
992942b573
Refactor interface instance typechecking and compilation (scala) (#14647)
* Refactor (Co)Implements(Method) DefRefs

InterfaceInstanceDefRef replaces ImplementsDefRef and CoImplementsDefRef
InterfaceInstanceMethodDefRef replaces ImplementsMethodDefRef and CoImplementsMethodDefRef

* Define PackageInterface.lookupInterfaceInstance

* Remove lookupTemplateImplements and related functions

* Replace uses of lookupTemplateImplements and similar with lookupInterfaceInstance

* Rename ETemplateDoesNotImplementInterface=>EMissingInterfaceInstance

* Rename EConflictingImplementsCoImplements=>EAmbiguousInterfaceInstance

* Replace checkIface(Co)Implementations with direct use of checkInterfaceInstance

* Remove LookupError.Reference cases for implements/co-implements

* Rename and refactor EMissingRequiredInterface{=>Instance}

* Rename and refactor EMissingInterfaceMethod=>EMissingMethodInInterfaceInstance

* Rename and refactor EUnknownInterfaceMethod=>EUnknownMethodInInterfaceInstance

* Clean up checkInterfaceInstance

* Include interface signature in InterfaceInstanceInfo

changelog_begin
changelog_end
2022-08-09 16:17:29 +00:00
nickchapman-da
cd1a64c8cb
[engine] stack-safe alpha equivalence (#14645)
* testcases which show current lack of stack-safety

changelog_begin
changelog_end

* make alpha-equiv be stack-safe; enable large tests

* use ++: in preference to ++ (and toList)
2022-08-09 14:20:47 +00:00
dylant-da
a4e29299be
Implement Interface views in speedy (#14565)
* Add DA_Internal_Interface to convertTypeDef exclusion check

* Move desugared types/values for interface views into DA.Internal.Desugar

* Convert viewtype and view method declarations

* Typecheck view types and view declarations

* Add unit viewtypes to InterfaceChoiceCollision tests

* Add unit viewtypes to more compiler/damlc tests

* Modify empty interfaces/implements to have viewtypes/views

* Add unit viewtypes to remaining Interface tests

* Test for error thrown when viewtype not specified

* Fix daml-lf/ interface tests to use new syntax / unit views

* Add placeholder view of type Unit to TestInterfaces

CHANGELOG_BEGIN
CHANGELOG_END

* Fix typescript interface tests with unit viewtype

* Add unit viewtype to Java & Scala codegen

* Add unit viewtype to triggers tests interface

* Add unit viewtypes to ledger/test-common

* Add unit viewtypes to ledger-service/http-json

* Fix some damlc tests

* Use viewtype syntax in InterfaceViewNonSerializable test

* Remove HasInferfaceView instances in convertBind

* Add unit view to QualifiedInterface.daml test

* Generate HasInterfaceView instances in DataDependencies

* Add unit viewtypes and views to compiler/damlc/tests

* Document reconstruction of HasInterfaceView

* Move desugared types/values for interface views into DA.Internal.Desugar

* Add desugarable function view w/ EViewInterface desugaring

* Remove templateName and viewtype from generated EViewInterface

* Update desugared-daml

* Proof of concept: use _view -> EViewInterface prim via HasInterfaceView

* Move view, HasInterfaceView to DA.Internal.Interface

* Update desugared-daml tests

* Stop removing and re-generating HasInterfaceView instances

* Do not generate docs for generated "_view_" methods

* Report errors with interface TypeConNames prettily

* Fix InterfaceViewNotSpecified @ERROR to reflect new error text

* Don't import magic `view` method from Prelude to avoid name clash

* Update shake interface goto definition test locations

* Temp disable view spec tests, will re-implement views in speedy

* Add unit viewtype to Java code snippet docs

* Update Interface syntax docs for views

* Add unit viewtype to Transferrable.daml

* Add back "empty" interface implementation to interfaces.rst

* Re-enable view tests by having _view methods on InterfaceViews.daml file

* Remove deprecated commented-out view desugaring code

* Remove templateId and viewtype from EViewInterface

* Fix lint

* Compile DefRefs for views, return them in SBViewInterface

* Stop looking for `_view` method, remove ENoViewFound in TypeChecker.hs

* Remove ENoViewFound / remove view method lookup, use view param instead

* Fix use of viewMethod.returnType / import of MethodName

* Replace uses of `_view` in Scala, update parser w/ viewtype/view clauses

* Fix lint

* Update Interface LF encoding test for views

* Stop using unit views in ParsersSpec

* Fix tests to have new Scala test parser viewtype/view syntax

* Fix Interface_extended_1.dev_.lf to have viewtypes/views

* Change all spec/lf viewtypes/views to Unit

* Remove accidental use of requires

* Fix ParsersSpec to have record viewtypes/views

* Fix ValueEnricherSpec for switch to unit views

* Remove no view test from Scala - lack of view is caught at compile-time

* Remove unused _view method in InterfaceViews.daml test

* Return control expression via Control.Expression

* Retrieve compiled views via implementation body
2022-08-09 12:49:14 +01:00
nickchapman-da
454fc397a7
[engine] stack-safe kind-checking (#14632)
* add tests for stack-safe kind-checking

changelog_begin
changelog_end

* make kind-checking be stack-safe

* dont forget struct types!

* add missing comment
2022-08-05 16:44:02 +00:00
nickchapman-da
be11892507
[engine] avoid exceptions in speedy control (#14618)
* address nitpicks on previous PR: #14602

changelog_begin
changelog_end

* prefer Control.{Question.Complete} to exceptions SpeedyHungry/SpeedyComplete

* fix comments
2022-08-05 15:04:52 +01:00
Moisés Ackerman
c146bee87d
Reduce duplication between implements and co-implements (#14607)
* Reduce duplication between implements and co-implements

This extracts the common part (methods and view) to a new type InterfaceInstanceBody

changelog_begin
changelog_end
2022-08-04 17:01:15 +02:00
Carl Pulley
9edb0d2188
Disclosure testing contract normalization (#14544)
* Test that non-normalized contracts are accepted

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): test that non-normalized contracts are accepted.

CHANGELOG_END
2022-08-04 13:20:01 +01:00
Carl Pulley
d0f40d89ca
Disclosure error reporting fix
Add key hash to scenario service error reporting

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): Add key hash to scenario service error reporting.

CHANGELOG_END
2022-08-04 11:09:33 +01:00
nickchapman-da
6d0a681169
[engine] improve speedy control (#14602)
Improve handling of control within the speedy machine.
- Intro dedicated Control type, and single machine component control: Control
- Replacing old machine components: returnValue/ctrl
- Code which is expected to take a step and update the control, can now return Control
- Instead of side-effecting returnValue/ctrl, and returning Unit
2022-08-04 10:46:58 +01:00
dylant-da
8e8e0dabdf
Convert viewtype and view methods to LF (#14456)
* Add DA_Internal_Interface to convertTypeDef exclusion check

* Move desugared types/values for interface views into DA.Internal.Desugar

* Convert viewtype and view method declarations

* Typecheck view types and view declarations

* Add unit viewtypes to InterfaceChoiceCollision tests

* Add unit viewtypes to more compiler/damlc tests

* Modify empty interfaces/implements to have viewtypes/views

* Add unit viewtypes to remaining Interface tests

* Test for error thrown when viewtype not specified

* Fix daml-lf/ interface tests to use new syntax / unit views

* Add placeholder view of type Unit to TestInterfaces

CHANGELOG_BEGIN
CHANGELOG_END

* Fix typescript interface tests with unit viewtype

* Add unit viewtype to Java & Scala codegen

* Add unit viewtype to triggers tests interface

* Add unit viewtypes to ledger/test-common

* Add unit viewtypes to ledger-service/http-json

* Fix some damlc tests

* Use viewtype syntax in InterfaceViewNonSerializable test

* Remove HasInferfaceView instances in convertBind

* Add unit view to QualifiedInterface.daml test

* Generate HasInterfaceView instances in DataDependencies

* Add unit viewtypes and views to compiler/damlc/tests

* Document reconstruction of HasInterfaceView

* Move desugared types/values for interface views into DA.Internal.Desugar

* Add desugarable function view w/ EViewInterface desugaring

* Remove templateName and viewtype from generated EViewInterface

* Update desugared-daml

* Proof of concept: use _view -> EViewInterface prim via HasInterfaceView

* Move view, HasInterfaceView to DA.Internal.Interface

* Update desugared-daml tests

* Stop removing and re-generating HasInterfaceView instances

* Do not generate docs for generated "_view_" methods

* Report errors with interface TypeConNames prettily

* Fix InterfaceViewNotSpecified @ERROR to reflect new error text

* Don't import magic `view` method from Prelude to avoid name clash

* Update shake interface goto definition test locations

* Temp disable view spec tests, will re-implement views in speedy

* Add unit viewtype to Java code snippet docs

* Update Interface syntax docs for views

* Add unit viewtype to Transferrable.daml

* Add back "empty" interface implementation to interfaces.rst

* Re-enable view tests by having _view methods on InterfaceViews.daml file

* Remove deprecated commented-out view desugaring code
2022-08-03 16:23:38 +01:00
nickchapman-da
848fff4f13
[engine] make type checking stack-safe (#14533)
make type-checking stack-safe

changelog_begin
changelog_end
2022-08-02 13:37:47 +00:00
Carl Pulley
8145018fd7
Disclosure testing duplicate ids and keys
* Disclosure testing duplicate ids and keys

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): disclosure testing duplicate ids and keys

CHANGELOG_END
2022-08-02 13:18:07 +01:00
Stephen Compall
d2c7be9dd8
interface views for daml-lf/interface library (#14569)
* add viewType to DefInterface
* interface view type resolvers
* in codegen, interfaces depend on their view types

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-01 10:40:26 -04:00
Remy
b475d710aa
LF: Create LF 1.15 in scala to park basic interface constructs (#14534)
basic interface constructs contain:
- interface definition
- interface implementation
- retroactive template implemenation
- exerciseInterface and fetchInterface
- basic builin

but do not contain:
- "requires"
- exercise guards

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-29 20:09:57 +02:00
Carl Pulley
c87732c438
Disclosure testing of contracts and keys
* Basic explicit disclosure testing

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): test that explicit disclosure works for contracts and keys.

CHANGELOG_END
2022-07-28 16:00:55 +01:00
Remy
88d4ff93f2
LF: remove precondition in interface (proto & scala side) (#14511)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-27 10:52:35 +02:00
nickchapman-da
76e9fd8658
Burn unused sub-classes of ValidationError (#14530)
changelog_begin
changelog_end
2022-07-26 13:33:45 +01:00
Remy
8a02a050b1
LF: Remove interface methods from collision check (#14513)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-26 13:31:55 +02:00
Remy
6caedfb0ca
LF: Utility to enrich interface views (#14520)
CHANGELOG_BEGIN
CHANGELOG_END

* fix

* Add test
2022-07-25 17:36:40 +00:00
nickchapman-da
1d18889fe1
[engine] improve ptx/sbuiltin interface w.r.t. abort handling (#14465)
* improve ptx/sbuiltin interface w.r.t. abort handling

changelog_begin
changelog_end

* hack fix script fail

* preserve existing behaviour for ScriptService test

* inline noteAuthFails

* Right before Left
2022-07-25 11:41:38 +00:00
Remy
7c89050c60
LF: Utility function to compute the relation interface/implementation (#14409)
in a package.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-25 11:20:42 +00:00
Remy
df21aad8af
LF: Make ExerciseInterface guard field optional (#14493)
in protobuf

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-25 11:33:02 +02:00
Remy
c3789e70c3
[LF] minor refactoring of the type chect to reduce stack consumption (#14510)
After this change //daml-lf/tests:test-scenario-stable-many-fields
does not seem to stack overflow anymore.

This is a workaround until we make the type checker stack safe, See #13410.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-25 08:26:05 +00:00
Stephen Compall
67b47c6dff
replace custom toOptional in interface library with scala-library method (#14487)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-21 17:12:21 +00:00
dylant-da
8d93efdd12
Add EViewInterface to LF - stub compilation/interpretation in speedy (#14486)
* Add ViewInterface to LF - stub interpretation in speedy

* Remove templateId and viewtype from EViewInterface

* Fix lint
2022-07-21 15:10:53 +00:00
Remy
1cbc21e719
[LF] Cleanup Relation data structure (#14471)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-21 13:03:29 +02:00
dylant-da
ab948dd8de
Update LF AST protobuf for interface viewtype and implementation view (#14439)
* Update protobuf to include viewtype and implementation view

* Stub interface viewtype and implements view in updated AST

* Set views on Java builders in DecodeV1Spec

CHANGELOG_BEGIN
Update LF AST protobuf for interface viewtype and implementation view -
not currently linked to syntax or engine changes, all stubbed out in
LFConversion.
CHANGELOG_END

* Add view field to CoImplements

* Update iterators & parsers to account for CoImplements view

* Replace uses of TBuiltin(BTUnit) with TUnit

* Remove superfluous "Available in versions >= 1.dev" comment

* Fix missing TUnit imports, missing view param in daml-lf/parser

* Remove unused imports from DecodeV1Spec

* Add stub view in AstSpec
2022-07-19 12:00:04 +00:00
nickchapman-da
c17c580b84
Fix handling for throw within handler (#14461)
changelog_begin
changelog_end
2022-07-18 17:17:34 +01:00
Moritz Kiefer
786cf27534
Drop invalid invariants on byKey fields (#14457)
The one on Fetch was clearly never true.
The one on Exercise was true until exceptions meant that sometimes we
do not have an exercise result so now it's also not true.

changelog_begin
changelog_end
2022-07-18 10:34:09 +00:00
nickchapman-da
bbfcc55af7
[engine] Transmit completed transaction via SResultFinalValue. (#14416)
* Transmit completed transaction via SResultFinalValue.

changelog_begin
changelog_end

* remove spurious mods

* mark two commented-out tests with TODO 14431

* address small comments

* rename: SResultFinalValue --> SResultFinal
2022-07-18 09:45:37 +00:00
tudor-da
5f702bbf7d
[LLP] Indexer - Ledger API bypass [DPP-1043] (#14319)
* Moves ParticipantConfig and dependants to `participant-integration-api`

changelog_begin
changelog_end

* Implement Indexer - Ledger API bypass

* Adjust configuration parameters
* Remove run-mode
* Create inMemoryStateUpdaterParallelism

* Rename components

* IndexServiceOwner is not private[platform]

* Address review comments

* Rebase
2022-07-13 15:52:33 +02:00
Carl Pulley
0bf28176a7
Tidy up of Compiler.scala to ensure translate and compile naming conventions are used throughout
CHANGELOG_BEGIN

  * Tidy up of Compiler.scala to ensure translate and compile naming conventions are used throughout.

CHANGELOG_END
2022-07-12 16:48:10 +01:00
nickchapman-da
d4da8d8796
small cleanups in PartialTransaction (#14392)
- move submissionTime field out from PartialTransaction into enclosing execution Machine
- remove deprecated ptxInternal
- move InitialSeeding class to own file

changelog_begin
changelog_end
2022-07-12 08:50:47 +00:00
nickchapman-da
9f1b1b1f82
Cleanup boundary between Machine and PartialTransaction (#14393)
changelog_begin
changelog_end
2022-07-12 08:23:12 +01:00
Moisés Ackerman
415cf95c78
Retroactive implements scala runtime (#14372)
* Use lookupTemplateImplementsOrInterfaceCoImplements in checkGenImplementation

* Update docs for ImplementsDefRef to reflect reality

Namely, it does not point to a conversion function, and the actual value it points to is irrelevant.
Only its presence is used to determine whether a template implements an interface or not.

Consequently, it now points to the unit value instead of the identity function.

* Generate 'CoImplementsDefRef's for each co-implemented template

* Consider CoImplementsDefRef in SBuiltin when checking if a template implements an interface

Also factor out check into private function

* Compile co-implemented methods using CoImplementsMethodDefRef

* SBCallInterface now uses CoImplementsDefRef for co-implemented methods

* Add test cases for (co)implemented interfaces in SBuiltinInterfaceTest

* Remove TemplateDoesNotImplementInterface error

* Explicitly override def in '*Implements*DefRef'

changelog_begin
changelog_end
2022-07-11 18:03:59 +00:00
Carl Pulley
cfaa5883d6
Testing infrastructure for disclosed contracts
CHANGELOG_BEGIN

* Changes to facilitate testing explicit disclosure under Engine/speedy-level tests for explicit disclosure #14227.

CHANGELOG_END
2022-07-07 14:23:54 +01:00
Moisés Ackerman
d3824945b0
Retroactive implements scala typecheck (cont) (#14346)
* Extend EncodeV1Spec with interface co-implements

* Add lookupTemplateImplementsOrInterfaceCoImplements to PackageInterface

* Use lookupTemplateImplementsOrInterfaceCoImplements in checkImplements

* Add TypingSpec cases for interface conversion functions via co-implements

* Add TypingSpec cases for interfaces with co-implements

* Apply code review suggestions: result type formatting

changelog_begin
changelog_end
2022-07-07 12:49:09 +00:00
Moritz Kiefer
d5d0569b23
Track only local creates in ActiveLedgerState (#14265)
This PR simplifies the ContractStateMachine by dropping the very
complex tracking of `keys` and instead tracking only `localKeys` which
stores the latest create with a given key.

This is fully backwards compatible for uck & non-uck semantics.

changelog_begin
changelog_end
2022-07-07 12:24:16 +00:00
Moritz Kiefer
9f81401de5
Drop uses of Option.fold in ContractStateMachine (#14369)
To make Rémy happy

changelog_begin
changelog_end
2022-07-07 10:35:59 +00:00
Carl Pulley
b88bf68d9a
Improve performance when deserializing Daml Map
* Fixes Engine: Improve deserialization of Daml Map #13865

CHANGELOG_BEGIN

* [Engine] Improve performance when deserializing Daml Map by specialising Value.apply to generate SMap instances using a sorted map.

CHANGELOG_END
2022-07-06 18:33:58 +01:00
dylant-da
3c7ab41bc3
Check interface view exists and is serializable, in compiler and in engine (#14112) (#14322)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-07-05 13:43:28 +00:00
Sergey Kisel
e151090cf3
Introduction of HOCON configuration for SoX [DPP-1033] (#14029)
* Introduction of HOCON configuration

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-05 15:35:16 +02:00
Matthias Schmalz
8329a7b90f
ContractStateMachine#State.handleNode (#14337)
Generalized utility method ContractStateMachine#State.handleLeaf to handleNode.
Added polymorphic field ActionNode.keyOpt.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-05 10:59:56 +00:00
Remy
abd47e972b
[Speedy] Do not crash when encountering an inconsistent contract key (#14276)
but rather return a proper interpretation error.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-05 10:28:38 +00:00
Moisés Ackerman
1f1f2785b0
Retroactive implements scala typecheck (#14266)
* Add lookup functions for co-implements

* Typecheck interface co-implementations

    * Use new environment in checkIfaceCoImplementation

* Fix Interface_1.dev_.lf

* OtherMod=>InterfaceMod0

changelog_begin
changelog_end
2022-07-05 09:53:56 +02:00
Remy
52ec65040f
[Engine] Rename values/arguments of type PackageInterface (#14305)
to avoid confusion with Daml interface.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-01 15:38:04 +02:00
Remy
d0058dcff3
[Interface] make all ContractIds serializable (#14307)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-01 11:07:12 +02:00
Robin Krom
36b39aca7b
Move disclosed contract logic to speedy (#14288)
* Move disclosed contract logic to speedy

This moves the disclosed contract logic from the engine to speedy.

Fixes #14090.

* back to versioned contract instances

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-01 08:40:10 +00:00
Remy
2d8a016a3e
[Engine] add a glorified Either to handle Template or Interface cases (#14306)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-30 17:55:29 +00:00
Matthias Schmalz
450c0c9cce
Improved documentation of ContractStateMachine (#14304)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-30 11:14:45 +00:00
Stephen Compall
6e3069d220
add retroImplements to lf/iface DefInterface (#14192)
* add resolveRetroImplements to EnvironmentInterface
* test that resolveRetroImplements does nothing with no data
* resolve retroactive interfaces in Java codegen
* resolve retroactive interfaces in Scala codegen
* resolve retroactive interfaces in json-api

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-29 13:13:02 -04:00
Carl Pulley
5c026163a9
Remove redundant fields from LedgerNodeInfo
CHANGELOG_BEGIN

[DAML Studio] as the `parent` and `rolledbackBy` fields of `LedgerNodeInfo` are not used within the code base, they have been removed.

CHANGELOG_END
2022-06-29 16:35:42 +02:00
Stephen Compall
90ca397bc5
replace remaining RNil usages with shapeless.record.Record (#14275)
* deprecate RNil

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-28 19:16:25 +00:00
Carl Pulley
6ed88105bb
Refactor and simplification of Transaction#processNodes
* fixes #14183

CHANGELOG_BEGIN

- [DAML Studio] Refactor and simplification of Transaction#processNodes to avoid need for custom state during processing. Refactor of Transaction#processTransaction to make processing workflow more transparent and easier to unit test. See https://github.com/digital-asset/daml/issues/14183 for details.

CHANGELOG_END
2022-06-28 13:49:41 +02:00
Moisés Ackerman
0d1ef10472
Retroactive Implements - Scala side (#14130)
* Add CoImplements to daml-lf AST

* Add AstSpec case for duplicate co-implements in interface

* Add placeholders for CoImplements in daml-lf validation

* Handle CoImplements in daml-lf iterators

* Handle CoImplements in daml-lf scala decoder

* Test DefInterface components in DecodeV1Spec

* Handle CoImplements in daml-lf (testing) parser

* Handle CoImplements in daml-lf (testing) encoder

changelog_begin
changelog_end
2022-06-23 17:13:38 +00:00
Remy
2ddd744a91
[Engine] fix and test #14175 (#14206)
follow up of #14175

this is part of #14171

CHANGELOG_BEGIN
CHANEGELOG_END
2022-06-16 22:45:50 +02:00
Stephen Compall
707c3e1a52
accept standard hlists as record/variant specs (#14167)
* link to #14189

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Raymond Roestenburg <98821776+ray-roestenburg-da@users.noreply.github.com>
2022-06-16 15:05:50 +00:00
Remy
2d5094160e
[Engine] clean key uniqueness mode (#14194)
This is a follow up of #14175 and #14176.  

Basically
-  we kill the `On` mode which is not used anymore.
- we factorize the visibility check.
- we rename `LocalContractNotVisible` into `ContractNotVisible`

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-16 12:04:45 +00:00
Moisés Ackerman
78cc57b243
Add failing daml-test-file (#14176)
fix #14171

CHANGELOG_BEGIN

* [Bugfix] fix failing by-key ops after roll-backed archive and create
  See https://github.com/digital-asset/daml/issues/14171

CHANGELOG_END
2022-06-15 20:00:04 +00:00
nickchapman-da
b023bebfda
Track locally created contracts correctly through rollback. (#14163)
changelog_begin
changelog_end

temp mod to get build

 make sure to maintain localContractSet

engine test for: ExerciseAfterRollbackCreate

fix ContractStateMachineSpec testcases and add new case

rebase and fix build failure

fix test (and comment)

fix evaluation order test fails: revert the failure back to be the expected ContractNotActive, instead of ContractNotFound

improve new test (creates in try are rolled back) to check the DamlException thrown

remove ptx.localContracts. instead use ptx.contractState.locallyCreated

improve test name

un-inline ActiveLedgerState.consume

Set() --> Set.empty

add comments for new components of ContractStateMachine

combine checks: consumedBy / inactive

improve comments, doc and test-evidence
2022-06-15 15:09:37 +00:00
Moritz Kiefer
4357310bad
Improve docs on ContractStateMachine (#14185)
* Improve docs on ContractStateMachine

Based on Matthias suggestions.

changelog_begin
changelog_end
2022-06-15 16:50:23 +02:00
Remy
7a4fc9f5fe
Engine: systematic check of visibility for by-key operations (#14175)
instead of only for local contract

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-15 15:15:45 +02:00
Carl Pulley
7d76460ee8
DAML Studio Activeness checks
* fixes #13835

CHANGELOG_BEGIN
  - [Daml Studio] Fix a bug where some contracts were considered inactive even though their consumption was under a rollback. See https://github.com/digital-asset/daml/issues/13835 for details
CHANGELOG_END
2022-06-15 11:35:18 +01:00
Moritz Kiefer
d233bfa4b4
Add missing activeness check when reading from globalKeyInputs (#14080)
* Add missing activeness check when reading from globalKeyInputs

changelog_begin

- Engine. Fix lookup by key. See issue Lookup archived contracts may succeed when combined with rollback exceptions #14107 for more details.

changelog_end
2022-06-13 19:27:08 +00:00
Moritz Kiefer
3b0cbf4c73
Handle nested rollbacks in inactiveContracts properly (#14161)
changelog_begin
changelog_end
2022-06-13 15:45:31 +00:00
Moritz Kiefer
b451edbc66
Add PoC implementation of interface views to Daml Engine (#14116)
changelog_begin
changelog_end
2022-06-09 13:46:27 +02:00
Stephen Compall
1d20cbf887
hide unresolved/resolved states in lf/interface library (#14115)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-08 13:44:56 +00:00
Sergey Kisel
1d8f195438
Sandbox Classic Removal in Tests (#13934)
CHANGELOG_BEGING
CHANGELOG_END
2022-06-07 19:54:52 +00:00
Andreas Lochbihler
2ac54ce1f4
add advance to contract state machine (#14077)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-07 12:09:58 +02:00
Moisés Ackerman
ee394702b8
Add CoImplements to DefInterface in protobuf (#14053)
* Update docstring for TemplateImplements.tpiMethods
    * The change happend on https://github.com/digital-asset/daml/pull/13142

* Add CoImplements to DefInterface in protobuf
    * Also adds encoding/decoding logic in the haskell side

* Part of https://github.com/digital-asset/daml/issues/14047

changelog_begin
changelog_end
2022-06-03 16:05:18 +00:00
Remy
ae8f50dbb8
LF: drop inheretedChoices from Implements (#14068)
part of #13653

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 18:48:54 +00:00
Robin Krom
3ff8c1055e
disclosures: fix buildDiscTable (#14071)
* disclosures: fix buildDiscTable

This removes the pattern match on the template id for the argument
record in buildDiscTable. The arguments don't contain the template id
any longer.

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/Engine.scala

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2022-06-02 14:56:06 +00:00
Remy
09034a265d
ScenarioRunner: move the building of the speedy machine (#14024)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 16:40:48 +02:00
Remy
f2888f52ec
LF: update governance (#14065)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 16:20:59 +02:00
Remy
7638e086ae
Script: infer the typeId of Choice in daml (#13971)
part of #13653

goes with digital-asset/ghc#122

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 14:02:12 +00:00
Stephen Compall
4caba375e5
in daml-lf/interface, resolve choices directly from DefInterface (#14057)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 12:19:08 +00:00
Andreas Lochbihler
4cfffec87a
Extract a contract state machine for transaction interpretation and validation (#14044)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 09:39:37 +00:00
Marton Nagy
f5a2539d6f
Add globalKeyMapping to WriteService [DPP-1067] (#14026)
The field globalKeyMapping is recently added to
lf.transaction.Transaction.Metadata, and which is
computed by the Engine.
This field might be needed for processing by WriteService
implementors.
This PR adds this to the WriteService.

changelog_begin
Global contract key mapping is added to WriteService.
changelog_end
2022-06-01 10:08:18 +02:00
Stephen Compall
96a6fe62e4
choice name overloading in lf/interface (#13938)
* introduce TemplateChoices to mediate template choice resolution
* if any resolutions fail in EnvironmentInterface, discard the template's resolution
* if any resolutions fail in Interface, discard the remaining unresolved

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-31 08:41:48 -04:00
Remy
62877ab78b
LF: Cleanup Fetches (#13804)
- Rename fetch to fetch_template
- Rename misnamed fetch_by_interface to fetch_interface
- Drop dead fetch_by_interface

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-30 18:55:41 +02:00
Sergey Kisel
168f943ff0
Revise the config to use a hierarchical structure [DPP-1029] (#13629)
* Revise the config to use a hierarchical structure [DPP-1029]

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-30 18:02:53 +02:00
Remy
365fa11b10
PartialTransaction: make clear domain of keys is subset of globalKeyInputs (#14015)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-30 15:27:31 +00:00
Moritz Kiefer
3f20361cf8
Drop duplicatedContractKeys (#13999)
Not used by anyone anymore and broken under exceptions.

changelog_begin
changelog_end
2022-05-27 12:51:54 +00:00
Remy
12a488f6a4
LF: Expose the keys requested during interpretation (#13983)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-25 19:03:35 +02:00
Remy
d3264236ba
Interface: drop collision check between inherited choice name (#13939)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-24 17:53:18 +02:00
Stephen Compall
b307cd8406
remove some contract-ID generality from TypedValueGenerators (#13957)
* move where ContractId arbitrary instance passes into ValueAddend
* adjust ValueAddend users to deal with moved Arbitrary instance

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-24 06:28:34 -04:00
Robin Krom
29f79fc756
disclosures: support in engine (#13896)
* disclosures: support in engine

This adds support for contract disclosures in the engine.

Fixes #13863.

CHANGELOG_BEGIN
CHANGELOG_END

* move VersionedContractInstance to Value

* normalization/typechecking

* Update daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/Error.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Update daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/CommandPreprocessor.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Update daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/CommandPreprocessor.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* remove processImmArray

* throw exception in foldl

* check for duplicate contract keys in disclosures

* added issue for removal of empty disclosure assertion

* format

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Remy <remy.haemmerle@daml.com>
2022-05-23 16:13:46 +02:00
Remy
ea0d101913
Interface: Rename fixedChoice to choice (#13883)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-17 12:03:53 +02:00
Remy
6f6a3052a1
Repurpose templateId in ExerciseCommand and add interfaceId in ExerciseEvent (#13660)
part of #13653

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-16 15:30:07 +00:00
Remy
78642f2d4b
Speedy: Factorize interface exercise with or without guards (#13803)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-10 11:56:19 +02:00
Remy
7894fa33a7
Speedy: Delete dead code (#13809)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-06 16:34:34 +02:00
nickchapman-da
0c368aafdc
always typecheck the rhs of let expressions (#13779)
* always typecheck the rhs of let expressions

changelog_begin
changelog_end

* update security evidence

* test for new parer syntax: let _ = ...
2022-05-03 15:16:11 +00:00
nickchapman-da
804a399115
Tests for stack-safety of type-checking (#13729)
* Tests for stack-safety of type-checking

changelog_begin
changelog_end

* remove testcases app[123]of3

* typecheck returns Option[ValidationError]

* remove LARGE testset, which only has non-overflow because of ill-typed examples causing early exit

* ensure all test examples are well-typed

* fix TODO issue links
2022-05-03 08:59:12 +01:00
Moisés Ackerman
61cb257225
Make disclosure explicit in Daml Studio tree view (#13735)
changelog_begin
* Daml Studio: transaction tree view now differentiates between disclosed and divulged contracts
changelog_end
2022-05-02 09:18:46 +02:00
Hubert Slojewski
281de9ac2e
Publish daml-lf encoder, parser and error-test-lib [KVL-1424] (#13730) 2022-04-29 13:59:19 +02:00
Hubert Slojewski
968ca24b17
Remove kvutils buf configuration and other leftovers [KVL-1427] (#13732)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-28 16:00:23 +02:00
Nicu Reut
a792de39a5
Update scalafmt to 3.5.1. (#13584)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-28 09:57:04 +00:00
nickchapman-da
30f83bae46
Small cleanup to the bazel testing setup for daml-lf/interpreter and daml-lf/validation (#13716)
changelog_begin
changelog_end
2022-04-27 13:27:17 +01:00
nickchapman-da
aeda7159cf
clarify entry points to type checking code (#13697)
changelog_begin
changelog_end
2022-04-26 15:34:38 +01:00
Remy
0be64a8dd0
LF: Structure stable packages (#13682)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-26 12:47:06 +00:00
Remy
79af226966
LF: Add a convenient companion object for ArrayList (#13684)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-26 12:36:36 +02:00
Hubert Slojewski
0e9326f857
Publish daml-lf/snapshot proto [KVL-1245] (#13679)
* Publish daml-lf/snapshot proto [KVL-1245]

CHANGELOG_BEGIN
CHANGELOG_END

* fix snapshot_proto bazel target

Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2022-04-26 07:59:12 +02:00
Remy
3be994c4e8
LF: introduce interfaceId field in Exercise node (#13643)
.. to track where the choice is defined.

part of #13653

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-21 13:19:25 +00:00
Sofia Faro
8c864b439b
iface: Use ImplementsDefRef instead of PackageInterface in speedy builtins (#13644)
* iface: Use ImplementsDefRef instead of pkg iface

For looking up required interface conversions, like we already do in other cases.

Fixes #11345 (updated the ticket for the package interface TODO since it's very different)

changelog_begin
changelog_end

* scalafmt

* errors only a compiler could notice

* scalafmt again :-(
2022-04-21 11:20:58 +01:00
Remy
99a2f4384d
LF: Factorize language.Reference with validation.Context (#13608)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-20 11:57:16 +02:00
Stephen Compall
9cafd894c1
nicer party throwaway literals in tests (#13619)
* replace NoCid with Aux
* xmap on ValueAddend, a way to e.g. let users "pun" on scalars
* nicer party specifications
- suggested by @realvictorprm; thanks

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-19 09:54:50 -04:00
Sergey Kisel
a6b3d5f581
Cleanup around configuration (#13597)
* Cleanup around configuration

CHANGELOG_BEGIN
CHANGELOG_END

* Removal of unused configuration parameters. Merge cohesive params.

* Removal of ParticipantIndexerConfig as redundant transformation layer.

* Extracting engine config values

* Separation of IndexConfiguration
2022-04-19 13:19:11 +02:00
Gary Verhaegen
3416192735
fix typo in error message (#13594)
CHANGELOG_BEGIN

- The error message for invalid numerical conversion has been corrected:
  "loss of precision" instead of "lost of precision".

CHANGELOG_END
2022-04-14 09:17:50 +00:00
Robin Krom
fcd3b6622b
ifaces:support exercising by required interface (#13554)
* ifaces:support exercising by required interface

This adds support to exercise an interface choice on a contract ID,
where the interface is required by one of the implemented interfaces of
the contract template.

Fixes #13434.

CHANGELOG_BEGIN
CHANGELOG_END

* some improvements based on review

* added a test plus a bugfix

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

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

* 2 more interface tests for the command preprocessor

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-04-12 18:15:29 +00:00
Stefano Baghino
84c8be8181
Restrict Java codegen to types that can be seen over the Ledger API (#13571)
* Restrict Java codegen to types that can be seen over the Ledger API

Fixes #13324

Builds on top of refactorings part of #13372, #13439 and #13440,
alongside adding interface support to the transitive closure function
in #13557.

changelog_begin
[Java codegen] The Java codegen now restricts its output to Daml definitions
that are either directly or indirectly referred as part of a template or
interface (that is, only the types that can be seen over the Ledger API).
See #13324 for further details.
changelog_end

* Adapt tests to add template references for every type

* Address https://github.com/digital-asset/daml/pull/13440#discussion_r837318725

* Avoid invoking the recursion from two different places.

* Address https://github.com/digital-asset/daml/pull/13571#discussion_r848441581

* Address https://github.com/digital-asset/daml/pull/13571#discussion_r848442738

* Address https://github.com/digital-asset/daml/pull/13571#discussion_r848314960
2022-04-12 18:16:29 +02:00
Stefano Baghino
10cd76a5d4
Add interface support to transitiveClosure (#13557)
* Remove unused field from `Node`

* Add interface support to `transitiveClosure`

Contributes to #13324

changelog_begin
changelog_end

This work can be reused to address #13349 and I left `TODO`s where appropriate.

* Address https://github.com/digital-asset/daml/pull/13557#discussion_r847434729

* Address https://github.com/digital-asset/daml/pull/13557#discussion_r847435412

* Turn the bulk of the logic of `transitiveClosure` into a smart constructor
2022-04-11 16:36:23 +00:00
Moisés Ackerman
606896e17f
Add partial ContractId-in-template-key check (#13541)
* Add Keyability check in DA.Daml.LF.TypeChecker

* Update expected errors in daml-test-files/ContractIdInContractKey.daml

* Update no-contract-ids-in-keys daml-lf scenario test to circumvent new check

changelog_begin
[Daml Compiler] Implemented compile-time check disallowing ContractId types in contract key types. This check looks for potential problems with the contract key type only within the template's module.
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-04-11 18:05:49 +02:00
Stefano Baghino
b245703b39
Refactor Java codegen (#13440)
* Remove unused class `JavaConf`

* Adapt tests to add template references for every type

* Minimize the data passed to `collectDamlLfInterfaces`

* Separate `CodeGen` from `CodeGenRunner`

* Refactor interfaces collection and resolution

* Refactor Java codegen

* Return `InterfaceType`s from `transitiveClosure`, move `DefTemplateWithRecord` to the Scala codegen

* Remove unused abstractions from the Java codegen

changelog_begin
changelog_end

* Minimize diff: move as much as possible to `CodeGenRunner`

* Revert "Adapt tests to add template references for every type"

This reverts commit 37c8c827179daa29668fa843c79afc8cef09e431.

* Fix compilation errors

* Minimize diff: restore imports in `ClassForType`

* Minimize diff: get rid of unnecessary refactorings

* Further simplications and fixing compilation errors

* Minimize diff: move `collectDamlLfInterfaces` back to its previous position

* Address https://github.com/digital-asset/daml/pull/13440#discussion_r846301958
2022-04-11 10:06:30 +00:00
Remy
3d7c54f814
LF: separate test between API and Replay command (#13526)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-11 11:53:29 +02:00
Sofia Faro
e4717654a5
LF spec: Small-step semantics for expression evaluation (#13495)
* LF: Small-step semantics for expression evaluation

This PR factors expression evaluation into two parts:

- a set of evaluation contexts that determine *where to reduce next*
- a set of small-step reduction rules

The PR then redefines the big-step semantics relation as the iteration
of that small-step relation.

The main motivation for this change is to simplify & shorten the
semantics a lot by using evaluation contexts. These contexts not only
determine the evaluation order, they also handle the propagation of
errors from subterms. This means the small-step reduction rules really
only have to deal with redexes, so there's a lot fewer rules.

Incidentally, this change introduces semantics for infinitely looping
terms. Big-step relations generally can't handle infinitely looping
terms, but small-step relations handle them automatically.

I'm not sure if a similar simplification is possible for update
interpretation, but this seems worthwhile for expressions at least.

changelog_begin
changelog_end

* call-by-value, separate app e.c. lines

* split redex evaluation from small-step evaluation

* use kᵪ for erasable kind
2022-04-08 10:45:56 +00:00
Remy
4e51194041
LF: Drop byInterface field from Transaction Nodes (#13520)
part of #13491

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-07 11:06:17 +02:00
Remy
ef3c5d4e11
Remove byInterface form transaction tree SBuiltins (#13502)
Remove byInterface argument from SBUCreate, SBUInsertFetchNode and SBUBeginExercise.

advance the state of #13491.

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-06 15:49:59 +00:00
Remy
c048966d91
LF: Slightly reduce stack consumption of the type cheker. (#13513)
Workaroung to solve flakyness of
//daml-lf/tests:test-scenario-stable-many-field until #13410 is fixed.

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-06 13:10:18 +01:00
Remy
e080ceb0af
Remove ByInterface Replay Command (#13511)
part of #13491

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-06 09:40:18 +00:00
Remy
fc92298ac0
Remove by_interface field form proto Transaction Nodes (#13510)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-06 09:19:07 +00:00
pbatko-da
217c093938
Fix some typos in daml-lf .rst files (#13493)
changelog_begin
changelog_end
2022-04-05 15:09:53 +02:00
Robin Krom
f7ae70ce5a
ifaces:evaluation order tests for create_interface (#13477)
This adds evaluation order tests for dalm-lf for `create_interface`.

Part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-31 16:08:38 +02:00
Moisés Ackerman
f59d1cd0b4
Convert experimental primitive TYPEREP_TYCON_NAME into proper LF builtin (#13465)
* Convert experimental primitive TYPEREP_TYCON_NAME into proper LF builtin

* Add entry for TYPEREP_TYCON_NAME in daml-lf spec

* disable quickcheck test in DA.Test.Packaging

changelog_begin
changelog_end
2022-03-31 14:35:46 +02:00
Moisés Ackerman
907bc383e2
daml-lf/interfaces: Drop speedy typereps (#13403)
* Add SBGuardMatchTemplateId builtin

* drop speedy typeRep args

* Update expected exceptions in daml-lf InterfacesTest

changelog_begin
changelog_end
2022-03-31 13:36:33 +02:00
Stefano Baghino
9d6eecaa4f
Refactoring codegen (#13439)
* Remove unused `name` field from `InterfaceTreeBuilder`, inline builder construction

* Remove unused `Traverse` instance for `TypeDeclOrTemplateWrapper`

* Remove unneccessary type parameter from `TypeDeclOrTemplateWrapper`

* Remove some unnecessary copies `.toList`

* Remove `TypeDeclOrTemplateWrapper`, use `Either` directly as a wrapper

* Use `bimap` instead of explicitly wrapping and unwrapping the `Either`

* Remove unnecessary type `Mode`

* Remove unnecessary type parameter from `WriteParams`

* Remove unnecessary binding

* Pull `OrderedDependencies` out of `Graph`

* Move computation of relevant packages to `codegen-common`

* Move `templateCount` from `LFUtil` into `CodeGen`

* Comment the purpose of `TransitiveClosure`

* Pull the variance cache out of `LFUtil`

`LFUtil`'s purpose is that of limiting passing around certain
values. While the purpose is questionable, the variance cache did
not need to access any of those values and it's quite easy to
move to a separate class where the purpose and the scope are clearer.

* Make `DependencyGraph` work directly on type declarations

* Add constructor for a collection of interfaces to `EnvironmentInterfaces`

* Factor the error message from `cyclicDependencies` out of `DependencyGraph`

changelog_begin
changelog_end
2022-03-29 16:29:22 +02:00
Remy
dfee9dfaf8
Fix Transaction.Metadata used_packages field computation for interface (#13441)
fixes #13437

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-29 14:20:04 +00:00
Robin Krom
b2e7981b73
ifaces:evaluation order tests for fetch by iface (#13443)
This adds evaluation order tests for fetch_interface in the daml-lf
execution.

Part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-29 11:19:34 +00:00
Victor Peter Rouven Müller
cc06073333
Java bindings/interface support (#13366)
* WIP

* First working version of java codegen daml interface support

* Update language-support/java/codegen/BUILD.bazel

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Fix compile errors

* Simplify code massivly, enjoy less duplication

changelog_begin

- The Java codegen now has basic support for daml interface definitions. Converting a contract id of a template implementing an interface to a contract id of the interface is possible and both executing interface choices is possible on the contract id of the interface and implementing template.

changelog_end

* Rename the test file to reflect it is a test file & enhance the inner test name & extend it further

* Fix test

* Refactor parts of TemplateClass.scala into multiple files

* Format that files!

* Minimize duplication further

* Remove unused comment

* Simplify code
Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Update language-support/java/codegen/src/main/scala/com/digitalasset/daml/lf/codegen/CodeGenRunner.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Further refactoring and renaming of the TemplateClassSpec to ContractIdClassBuilderSpec

* Fix formatting

* Add interface docs

* Remove unnecessary code generation of the Contract class for interface types

* Use less bool flags and more good function names :)

* Fix build

Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-03-29 12:38:00 +02:00
Robin Krom
609cd12392
interface evaluation tests (#13432)
* ifaces: more evaluation order tests

This adds more evaluation order tests for the execution of daml-lf
during exercise_interface.

Part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/EvaluationOrderTest.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/EvaluationOrderTest.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

Co-authored-by: Remy <remy.haemmerle@daml.com>
2022-03-28 14:24:04 +00:00
Robin Krom
537cfdb11b
ifaces:additional interface evaluation order tests (#13425)
This adds additional interface daml-lf evaluation order tests.

Part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-28 13:08:08 +02:00
Remy
4a4833817a
Add a temporary lenient Replay Exercise Command (#13426)
To give some more time to Canto to handle properly the strict
versions.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-25 20:00:00 +01:00
Moisés Ackerman
b47fa3ba92
interface conversion primitives test cases (#13416)
* Add LF ParsersSpec cases for conversion primitives

* Add LF TypingSpec cases for conversion primitives

* Add LF DecodeV1Spec cases for conversion primitives

* Add LF EncodeV1Spec cases for conversion primitives

* update security-evidence.md

* Add missing cases in daml-lf encoder

* Add missing cases in EncodeV1Spec

* Add InterfaceMod in DamlLfEncoderTest

changelog_begin
changelog_end
2022-03-25 16:08:31 +00:00
Robin Krom
a43d7c5e1f
ifaces: new evaluation order tests (#13419)
This adds a new evaluation order test for the execution of daml-lf for
interfaces.

This is part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-25 14:09:59 +00:00
Robin Krom
3a4939d3d5
ifaces: one more evaluation order test (#13400)
This adds another evaluation order test for the execution of daml-lf for
interfaces.

This is part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-25 13:40:25 +01:00
Sofia Faro
8582b04861
ifaces: Add semantics for 'exercise_interface' in the LF spec (#13404)
* ifaces: Add exercise interface semantics to spec

This is based on the semantics of 'exercise'.

Closes #11349 (for now). Also fixes a small bug in the semantics of 'exercise'.

changelog_begin
changelog_end

* Uniformize exercise syntax
2022-03-25 11:37:43 +00:00
Remy
6aa2dd5f1b
LF: Remove unecessary logic to pull package dependencies (#13344)
in the preprocessor and the validation, since, The compiler is already doing that.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-25 11:47:59 +01:00
nickchapman-da
df1e738180
fix quadratic complexity for closure conversion of a multi-let (#13385)
changelog_begin
changelog_end
2022-03-25 10:28:49 +00:00
Moisés Ackerman
f9f1611d46
Unsafe interface conversion primitives (#13391)
* Add unsafeFromInterface method to HasFromInterface class

* Use unsafeFromInterface instead of fromInterface + experimental primitive

* Drop THROW_WRONGLY_TYPED_CONTRACT experimental primitive

* Add UnsafeFrom{,Required}Interface LF primitives

* Add convertPrim cases for UnsafeFrom{,Required}Interface

* Add InterfaceGuarded tests for WronglyTypedContract cases

changelog_begin
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-03-25 10:07:14 +00:00
Sofia Faro
3646ec2358
interfaces: Add unsafe conversion to LF spec (#13399)
changelog_begin
changelog_end
2022-03-24 15:22:39 +00:00
Robin Krom
ff333c8f07
ifaces: evaluation order tests for exercise/fetch (#13396)
This add a first test for evaluation order of exercise_interface and
fetch_interface. More tests will come in the following PR's.

This is part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-24 15:49:01 +01:00
Remy
fe25205098
LF: cleanup snapshot replay + add minimal doc (#13360)
CHANGELOG_BEGIN
CHANGELOG_END
2022-03-23 13:37:40 +01:00
Robin Krom
d10f678518
ifaces: tests for by_interface in transactions (#13365)
We add tests to check that by_interface fields are set for interface
transactions. We also extend the scenario service to show the
by_interface fields in the pretty printed transactions.

Fixes #13333

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-22 19:53:49 +00:00
nickchapman-da
6a869fc7a3
remove speedy compilation validate phase (phase4) (#13353)
changelog_begin
changelog_end
2022-03-22 14:56:40 +00:00
nickchapman-da
53c4447152
add stack-safety tests for wide expressions (#13347)
* add stack-safety tests for wide expressions

changelog_begin
changelog_end

* add links to quadratic issue
2022-03-22 08:44:38 +00:00
Remy
f7d1901a5c
LF: split Command into ApiCommand and ReplayCommand (#13323)
CHANGELOG_BEGIN
CHANGELOG_END
2022-03-21 14:07:41 +01:00
Remy
6c2dc2d508
Move Replay from KV to LF land (#13243)
* Move Replay from KV to LF land

+ base it on submission entries instead of ledger export

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-21 13:03:10 +01:00
nickchapman-da
5cce3e8891
prefer scalaz type tagging over case-classes to avoid allocation (#13328)
* prefer scalaz type tagging to case-classes to avoid allocation

changelog_begin
changelog_end

* remove snake case
2022-03-18 13:53:01 +00:00
nickchapman-da
9b90a909cb
reduce trampoline bouncing in ANF transform (#13318)
* explore less bouncing; convert every: Bounce -> yesBounce/noBounce

changelog_begin
changelog_end

* remove noBounce; yesBounce -> Bounce (with curly braces)

* multi args list for better layout

* use shadow variable naming more consistently

* reduce unnecessary polymorphism

* reinstate 2x Bounce in atomizeExps which are necessary

* avoid 2x linear args.size

* avoid pointless conversion to/from Array

* move definition of Res to correct place

* remove 2x comments to type param A which has been removed

* inline 2x unnecessary val defs
2022-03-18 11:05:57 +00:00
Robin Krom
b14e4aeacd
ifaces: tests for by_interface nodes in transactions (#13321)
This adds tests for decode . encode = id in the transaction
encoder/decoders.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-18 11:34:45 +01:00
nickchapman-da
6a103dfa83
remove duplicate list of testcases (#13327)
changelog_begin
changelog_end
2022-03-18 10:27:39 +00:00
Sofia Faro
79715ad32d
interfaces: Drop the typerep, raise WronglyTypedContract (#13314)
* Drop the typerep in interface desugaring.

GHC PR: https://github.com/digital-asset/ghc/pull/110

Fixes https://github.com/digital-asset/daml/issues/13275 and https://github.com/digital-asset/daml/issues/13283

changelog_begin
changelog_end

* compile ghc-lib

* update bazel-haskell-deps

* update InterfaceTypeRepCheck test

* scalafmt

* update compile.yml

* update bazel-haskell-deps last time
2022-03-17 16:12:46 +00:00
nickchapman-da
042d60a51f
Complete stack-safety fixes for speedy ANF transform (#13312)
* enable Anf stack-safety tests for EUpdate cases

* fix stack-safety for closures in Anf transform

* fix stack-safety for try-catch handling in Anf transform

* add missing testcases for scope-exercise/prevernt-catch ANF stack-safety, and fix the overflow

changelog_begin
changelog_end
2022-03-17 09:59:53 +00:00
Robin Krom
f7a73c5a87
ifaces: more tests for requires (#13309)
This adds tests for circular and non-closed requires in interfaces on
the daml-lf side.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-16 18:15:26 +01:00
Stefano Baghino
caa8025788
Reduce noise when building //daml-lf/encoder:testing-dar-* (#13313)
changelog_begin
changelog_end

Adding Logback to the runtime dependencies allows to avoid having
logging noise when building this due to the missing logger implementation.

Before:

```
> bazel build //daml-lf/encoder:testing-dar-1.12
INFO: Invocation ID: fd46d196-8780-4b3a-9c23-41501a4668d2
INFO: Analyzed target //daml-lf/encoder:testing-dar-1.12 (1 packages loaded, 27 targets configured).
INFO: Found 1 target...
INFO: From Executing genrule //daml-lf/encoder:testing-dar-1.12:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Target //daml-lf/encoder:testing-dar-1.12 up-to-date:
  bazel-bin/daml-lf/encoder/test-1.12.dar
INFO: Elapsed time: 0.365s, Critical Path: 0.01s
INFO: 5 processes: 1 remote cache hit, 4 internal.
INFO: Build completed successfully, 5 total actions
```

After:

```
> bazel build //daml-lf/encoder:testing-dar-1.12
INFO: Invocation ID: d79a9df8-8243-49db-bd67-56a4f53ca746
INFO: Analyzed target //daml-lf/encoder:testing-dar-1.12 (1 packages loaded, 27 targets configured).
INFO: Found 1 target...
Target //daml-lf/encoder:testing-dar-1.12 up-to-date:
  bazel-bin/daml-lf/encoder/test-1.12.dar
INFO: Elapsed time: 0.332s, Critical Path: 0.01s
INFO: 5 processes: 1 remote cache hit, 4 internal.
INFO: Build completed successfully, 5 total actions
```

Notice the lack of SLF4J warnings.

See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-03-16 16:24:16 +00:00
Robin Krom
93c53da3df
requires checks (#13300)
* interfaces: tests for requires typing

We add tests for the correct typing of the interface requires field.

CHANGELOG_BEGIN
CHANGELOG_END

* security evidence
2022-03-16 12:05:30 +00:00
Stephen Compall
0b5ad7a7bd
interface support in the interface library (#13154)
This adds the presence of interface names, as well as lists of choices
and their argument/return types for each interface.

It also changes the semantics of DefTemplate and EnvironmentInterface:
each may contain "unresolved choices", which are the choices inherited
from interfaces for each implementing template;
EnvironmentInterface#resolveChoices will copy the full type information
as a concrete choice for each implementing template, which should be
much simpler for codegen and json-api.

A type generator should take account of the astInterfaces as well as
typeDecls in EnvironmentInterface; interfaces aren't included in
typeDecls because where I is an interface only ContractId I is
serializable.

* Ast.DataInterface is empty, just use the interfaces map directly
* port json-api for interface API changes; does not solve #12689
* port Scala codegen for interface API changes; does not add support
* port Java codegen for interface API changes; does not solve #11350

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 19:34:54 +00:00
Sofia Faro
1feb4d25eb
Drop typerep argument from ExerciseInterface. (#13284)
* ifaces: Remove typerep arg from UExerciseInterface

changelog_begin
changelog_end

* Drop typerep argument in protobuf and haskell ast

changelog_begin
changelog_end

* scalafmt

* fix ExprParser

* fix PhaseOneTest

* fix validation test

* update evidencing security
2022-03-15 13:53:06 +00:00
Robin Krom
e2c13694f2
daml-lf:encoder/decoder for requires and tests (#13272)
This adds the parser for interface requires plus tests for it.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 12:56:49 +01:00
Sergey Kisel
a4f4300502
Naming and logging improvements [DPP-956] (#13270)
* Naming and logging improvements [DPP-956]

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 09:40:39 +01:00
Robin Krom
492e5fdd07
ifaces:tests: extend encoder tests, fix bugs (#13253)
This extends the Scala encoder tests to include interface definitions
and interface implementatioins. Some bugs in the encoder and ast
rewriter are fixed.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-14 12:55:27 +01:00
nickchapman-da
e1030365f0
Fix the ANF transform for case-alternatives to be stack-stafe. (#13251)
changelog_begin
changelog_end
2022-03-10 17:33:28 +00:00
Remy
3e6642f957
LF: Test that FetchInterface load unknown module (#13244)
The issue was indirectly fixed by #13080.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-10 16:16:38 +01:00
Robin Krom
69a2339906
ifaces: tests: name collisions between defs (#13216)
We add a check and a fix to make sure interface/exception/template names
don't collide.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-10 11:26:14 +01:00
nickchapman-da
cdf1be9464
Remove AExpr wrapper type. (#13233)
changelog_begin
changelog_end
2022-03-10 09:19:58 +00:00
Remy
8abf0bae96
Generate SubmissionEntry from KV export (#13209)
We split kv replay as follow:

- [LF] we introduce a simple protobuf to store submission entry (which
  roughly correspond to TRANSACTION_ENTRY and PACKAGE_UPLOAD_ENTRY KV
  submission)

- [KV] we create a tool to extract form a ledger export a sequence of
  submission entry

- [LF] we move the replay tool from KV to LF, and base it on
  submission entries instead of ledger export

The objectify of this split is double:

- on the one side it will simplify maintenance, as it will make API
  between KV and LF more clear (depends only on a protobuf definition)

- on the other side, it will made the use of the tool handy, as it
  will make possible to benchmark the engine without direct dependency
  between KV and LF.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-10 08:47:04 +01:00
Sergey Kisel
9a27edd656
Improve MessageDigest and Mac instance creation to solve lock contention [DPP-956] (#13221)
* Improve MessageDigest and Mac instance creation to solve lock contention problem [DPP-956]

changelog_begin
Scalability bottleneck in regard to hashing has been fixed in multiple places.
changelog_end
2022-03-09 22:15:32 +01:00
Sofia Faro
7bfd5e40c8
Fix a bug in AstRewriter (#13232)
And change the test that used AstRewriter to also serve as a regression
test. This bug has no impact on production code.

changelog_begin
changelog_end
2022-03-09 18:18:42 +00:00
nickchapman-da
d6bb26a978
Fix stack-safety when processing function-args in ANF transform. (#13198)
changelog_begin
changelog_end
2022-03-09 16:01:43 +00:00
Robin Krom
ca7efdabde
iface: tests: test DefInterface in daml-lf ast (#13220)
This adds tests for the DefInterface in Daml-lf.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-09 14:38:21 +01:00
Gary Verhaegen
dfa648f585
hunt down DAML better (#13195)
Process:

- `git ls-files -z | xargs -0 -n 100 sed -i --follow-symlinks 's/DAML/Daml/g'`
- `git add -p`
- `git restore -p`
- Check there is no unstaged change left.

To review:

- Check for false positives by carefully reviewing the diff in this PR.
- Check for false negatives with `git grep DAML`.
- Quicker check for fals positives:

```
git grep DAML | grep -v migration | grep -v DAML_
```

Fixes #13190

Note: This is the "second half" of #13191, which failed to cover all the
remaining DAMLs because of:

```
$ git ls-files | grep "'"
compiler/damlc/tests/daml-test-files/MangledScenario'.daml
```

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-08 17:04:58 +01:00
Robin Krom
d130bd2516
ifaces: tests: check for iface defs in templates (#13194)
* ifaces: tests: check for iface defs in templates

This adds a test that will fail when an interface definition is present
in a module when daml-lf < 1.dev.

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV1Spec.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Update daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV1Spec.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Update daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV1Spec.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* remy's suggestions

Co-authored-by: Remy <remy.haemmerle@daml.com>
2022-03-08 14:44:46 +00:00
Robin Krom
be6bbc82b9
ifaces: tests: check for interface collisions in ast (#13196)
* ifaces: tests: check for interface collisions in ast

We add a test to check for interface name collisions in the daml-lf AST.

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-lf/language/src/test/scala/com/digitalasset/daml/lf/language/AstSpec.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

Co-authored-by: Remy <remy.haemmerle@daml.com>
2022-03-08 14:08:48 +00:00
Sofia Faro
85c4ea0b5c
LF spce: Make controller/observer errors fatal (#13192)
changelog_begin
changelog_end
2022-03-08 12:32:10 +00:00