Commit Graph

1782 Commits

Author SHA1 Message Date
Paul Brauner
8562bdd1ea
Add LF2 support to interpreter/perf/explore (#17594)
* Add LF2 support to interpreter/perf/explore

* remove unused dep
2023-10-30 18:29:37 +01:00
Simon Maxen
6592cb7bd5
Add SharedGlobalKey (#17650)
* Add SharedGlobalKey

* Update with review comments

* Add temporary canton compatibility
2023-10-26 14:31:36 +01:00
Remy
422b6934d6
[Speedy] improve upgrade failure error message (#17634) 2023-10-25 15:16:11 +00:00
Remy
f0792597ab
Fix FatContractInstance doc (#17638) 2023-10-25 11:58:24 +02:00
Remy
6169c4fe5d
Bazel rule to build canton ce (#17480)
Co-authored-by: Paul Brauner <paul.brauner@digitalasset.com>
2023-10-24 15:06:17 +02:00
Remy
de97121cf2
linear time builder for order TreeSet (#17620) 2023-10-24 10:21:49 +02:00
Samuel Williams
14f9f58dcf
Add support for querying upgraded contracts to daml-script (#17629) 2023-10-23 17:24:56 +01:00
Remy
8b0daf03b7
[LF] Define FatContractInstance and its (de)serialization (#17598) 2023-10-23 15:27:18 +00:00
Simon Maxen
0b637ff695
Make package optional in scenario service (#17619) 2023-10-23 13:42:36 +01:00
Remy
9575b72a01
[Engine] allow (up/down)grade in create command (#17451)
This PR provides a basic API for ledger client to create contracts with down/up-grade support.
One can send a create Command where the payload contains

-  (upgrade path) less fields than requires by the package definition (as long as the missing fields are optional), in such case the engine assume those fields are None
-  (downgrade path) more fields than requires by the package definition (additional field should be node), in such case the engine drop those fields.

Here are some restrictions we assume for this first step:

 - For the sake of simplicity, we forbid field reordering when upgrade is enable
 - The package of explicit disclosed contract is required
 - we ignore package ID complelty inside value (probably not what we want in final version)
2023-10-19 18:02:02 +00:00
Paul Brauner
e897bb49cc
Remove warning that prevents canton tests from passing (#17573)
* Remove warning that prevents canton tests from passing

* remove unused logger

* remove unused dep
2023-10-16 16:02:23 +00:00
Rafael Guglielmetti
76f74987f4
[Engine] Add string describing the type of node (#17571)
Co-authored-by: Remy <remy.haemmerle@daml.com>
2023-10-16 15:31:53 +00:00
nickchapman-da
80a243e902
[engine] allow disclosed contracts to be upgraded (#17498)
Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2023-10-12 18:25:25 +00:00
Remy
b269a00f24
[Speedy] Ensure continuation of Update questions do not throw (#17549)
It is important continuations of Engine Result does not throw exceptions, as we cannot ensure those are properly caught.

Until now, we have to carefully review the code we write never throws exceptions. However as the code in continuation grows, I think this is not possible to do it anymore. For this reason, this PR systematically caught any possible exception thrown during continuation evaluation, and delay the error reporting to the next Speedy iteration.


Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2023-10-12 12:32:49 +00:00
Paul Brauner
f4ee00361e
Make LF v2 non backwards-compatible with LF v1 in the compiler (#17492)
* initial commit

* split gen-stable-packages-v_i into two targets

* rename compatibleWith to canDependOn

* update damlc integration tests annotation to allow for 2.x

* use the right package ID for preconditionFailed when compiling to V2

* fuse stable-packages-v1 and stable-packages-v2 into one single filegroup

* Fix DA.Daml.LF.Ast.Tests

* remove leftover 'undefined' in Version.hs

* progress on fixing DataDependencies.hs

* fix Cross-SDK typeclasses test for 2.dev

* Fix the 'Typeclasses and instances' data dependency test

* Update comment

* fix //compiler/damlc/tests:packaging

* Add TODO

* parameterize the machine by the langage version, hardcode v1 in script v2, v2 in script v2, v1 in exports

* get EngineTests to pass

* fix more tests

* fix canton integration tests

* formatting

* fix more tests

* fix transactionversiontest

* fix exceptiontest

* Fix ValueEnricherSpec

* Fix EngineInfoTest

* fix PartialTransactionSpec

* fix upgragetest

* fix TransactionSnapshot

* Fix ContractKeySpec

* Fix ReinterpretTest

* fix InterfaceViewSpec

* fix InterfacesTest

* fix stable package v1 names

* fix validate.sh tests

* formatting

* Fix ChoiceAuthorityTest

* fix explicit disclosure test

* Fix SpeedyTest

* formatting

* Fix integration test

* fix data dependency tests

* fix package vetting count, increased due to metadata being added

* Redact stable package IDs in error messages in order for the ExceptionSemantics test to work for both v1 and v2

* cleanup

* fix Daml2ScriptTestRunner

* fix JsonApiIT and daml-script golden tests

* fix daml3-script runner test

* enable v2 for all integration tests

* formatting

* fix NodeSeedsTest

* fix since-lf annotations

* add comments, improve consistency

* stop hardcoding V1 in runPureExpr and runPureSExpr

* formatting

* remove harcoding of LFv1 in ConcurrentCompiledPackages.apply

* Parameterize Compiler.Config.Default with major language version

* remove global parser implicit and default package ID and language version
2023-10-11 11:40:17 +02:00
Remy
48713358ba
[Speedy] fix non-loaded package when translating interface payload (#17536)
Bug was introduced by #17171, i.e. after last release
2023-10-11 08:12:48 +00:00
Remy
176c8505b9
[Speedy] Move back contract cache in speedy (#17523)
For reference, this undoes some of the changes from #17171.
2023-10-06 10:04:09 +02:00
Remy
fedcb1350b
Fix complexity of SMap deserialization (#17511) 2023-10-05 16:09:55 +00:00
Remy
4a8fcd4098
[Speedy] Test node seeds are maintained properly in aborted rollback (#17524)
Test for the bug DACH-NY/canton#14712 fixed in #16422

This is adapted from a minimal example designed by @simonmaxen-da to reproduce the bug.
2023-10-05 17:47:01 +02:00
nickchapman-da
28605bc349
use array instead of map for SRecord representation; pre-compute index for lookup/update field (#17112) 2023-10-04 09:22:26 +00:00
Paul Brauner
158cdd90d7
Fix the external name of daml3-script.dar to mention 2.dev (#17512)
* Fix the external name of daml3-script.dar to mention 2.dev

* make the compilation and distribution of daml3-script dars more future proof

* fix path in ci/copy-unix-release-artifacts.sh
2023-10-03 09:16:00 +00:00
Andreas Triantafyllos
44c0c51bb3
Refactor ledger/error (#17509) 2023-09-29 17:51:32 +02:00
Moisés Ackerman
e6bf01717f
Remove more internal uses of Scenario (#17375)
* daml-lf-test.sh no longer takes damlc argument

* Split //daml-lf/tests:BasicTests into engine and integration tests

* Remove unused //daml-lf/engine:Optional

* Convert //daml-lf/tests:AuthorizedDivulgence into integration test

* Convert //daml-lf/tests:DontDiscloseNonConsumingExercisesToObservers into integration test

* Convert //daml-lf/tests:ConjunctionChoices into integration test

* Convert //daml-lf/tests:ContractKeys into integration test LFContractKeys

* Move //daml-lf/tests:AuthTests to //daml-lf/engine:AuthTests

* Split //daml-lf/tests:LargeTransaction into ledger and non-ledger tests

* Remove scenarios in //language-support/java/codegen:ledger-tests-model

* Remove unused scenarios in //test-common:src/main/daml/model/Test.daml

* Remove 'enable_scenarios' param in da_scala_dar_resources_library

* Remove 'enable_scenarios' param in damlc_compile_test

* Remove '--enable-scenarios=yes in //compiler/damlc/tests:deterministic

* Convert /daml-lf/tests/scenario/dev/experimental to integration test

* Convert /daml-lf/tests/scenario/dev/interfaces to integration test

* Convert /daml-lf/tests/scenario/stable/big-numeric to integration test

* Convert /daml-lf/tests/scenario/stable/contract-key-through-exercises to integration test

* Convert /daml-lf/tests/scenario/stable/contract-keys to integration test

* Convert /daml-lf/tests/scenario/stable/divulge-iou to integration test

* Convert /daml-lf/tests/scenario/stable/embed-abort to integration test

* Convert /daml-lf/tests/scenario/stable/eval-agreement to integration test

* Convert /daml-lf/tests/scenario/stable/exception-auth to integration test

* Convert /daml-lf/tests/scenario/stable/gen-map to integration test

* Convert /daml-lf/tests/scenario/stable/many-fields to integration test

* Convert /daml-lf/tests/scenario/stable/mustfailcommit to integration test

* Convert /daml-lf/tests/scenario/stable/mustfailinterpretation to integration test

* Convert /daml-lf/tests/scenario/stable/mustfails to integration test

* Convert /daml-lf/tests/scenario/stable/no-contract-ids-in-keys to integration test

* Convert /daml-lf/tests/scenario/stable/pass-time to integration test

* Convert /daml-lf/tests/scenario/stable/pattern-matching to integration test

* Convert /daml-lf/tests/scenario/stable/timeout to integration test

* Remove scaffolding for daml-lf/tests/scenario

* Remove unused 'enable-scenarios' flags

* Remove unused daml-lf/tests/daml-lf-test.sh

* Remove unused daml-lf/tests/scala-test-limited-stack.sh

* Remove comments about deprecated flag 'DontDivulgeContractIdsInCreateArguments' in AuthorizedDivulgence integration test

* Add 'create' in LfStableTimeout:testScriptLoop

* add TODO for nesting limits test in LfStableMustFails

* Move LfStableMustFails expected ledger files into subdir
2023-09-28 16:29:46 +01:00
Paul Brauner
e8abfeb069
Check for duplicate contract IDs in the contract state machine (#17394)
* First stab at detecting double creates in the state machine

* Use subtyping to encode unions of errors instead of Either

* run formatter

* propagate duplicate contract ID error to clients

* remove redundant 'with TransactionError'

* also check fetches for double creation

* add test for create after fetch, found a bug!

* add one transaction test for create after fetch

* use sums instead of subtyping for classifying errors

* crash on double creation in SBuiltin rather than propagating the error as it should never happen

* remove unused parameter

* track all input contract IDs, not just fetches

* remove non-sensical test

* Fix the computation of input contract IDs
2023-09-26 13:42:16 +02:00
nickchapman-da
a70c328d65
unit test speedy calls to NeedUpgradeVerification (#17475) 2023-09-26 11:52:30 +01:00
nickchapman-da
b3bd9ad07c
Engine calls to ResultNeedUpgradeValidation are mode (submision/validation) dependent (#17472) 2023-09-22 14:35:37 +00:00
nickchapman-da
8d06f8fffe
engine, refuse to upgrade non-optional type (#17465) 2023-09-22 09:23:53 +01:00
nickchapman-da
26f78da944
[engine] unit test upgrading (#17386) 2023-09-21 08:35:30 +01:00
Remy
4f2007238b
do not test anymore LF 1.6 and 1.7 (#17434) 2023-09-19 13:27:26 +02:00
Paul Brauner
a5cd445d3b
Introduce LF2 major version (#17348)
- Introduces a new major version, "2", in the daml_lf proto
- Adds new major versions to the compiler and the engine
- Updates all code that assumes only one major version
- Updates all code that assumes only one dev version
2023-09-13 10:01:42 +02:00
Remy
5acb02dc41
[Speedy] Make Kont parametric in question (#17335) 2023-09-11 18:58:47 +00:00
Paul Brauner
da08791df4
Use feature names instead of explicit mentions to 1.dev in speedy (#17379) 2023-09-09 10:33:28 +02:00
nickchapman-da
0cac8c29a3
[engine] call: ResultNeedUpgradeVerification (#17360) 2023-09-07 10:18:41 +01:00
Paul Brauner
818bb1e6e8
Clean up some bazel rules (#17359)
* Fix a probable typo in //daml-fl/encoder/testing-dar-*

* apply TODOs in bazel files

* remove obsolete comments in bazel files

* use 'default' instead of 'latest' for targets relying on 'latest' in order to ensure interfaces are supported
2023-09-06 08:25:58 +02:00
Simon Maxen
2d3ac27383
Revert "Add ResultNeedCreate (#17243)" (#17321)
This reverts commit 7ba1e6754c.
2023-08-31 11:18:14 +01:00
Paul Brauner
4c9fd6c257
Fix proto_breaking_changes tests for LF (#17347)
After this change, the buf tool sees the files under src/main/protobuf. Without this change, it only sees an empty directory and the diff is trivially empty.
2023-08-31 09:05:32 +02:00
Carl Pulley
20330329ac
nix changes to allow PDF documentation to be built and latex cruft to be ignored (#17315) 2023-08-30 14:00:31 +00:00
Simon Maxen
8b92c9294b
Document ResultNeedUpgradeVerification differences between submission and reinterpretation (#17277) 2023-08-30 14:04:18 +01:00
Carl Pulley
62c9864514
Verification of the Contract State Machine in UCK mode (#17293) (#17312)
PR of Andrea Gilot's work from #17293

---------

Co-authored-by: Andrea Gilot <126685183+andreagilot-da@users.noreply.github.com>
2023-08-29 19:46:01 +00:00
Carl Pulley
195795537d
interpretation Error ValueNesting should not be in Dev (#17241) 2023-08-22 09:01:30 +01:00
Moisés Ackerman
ab038ab078
Add warning for uses of 'template-let' syntax (#17266)
* Update GHC_REV

* Add daml-test-files for template-let warning and its toggle

* Adapt daml-test-files to template-let warning

* update *.desugared-daml golden files

* Adapt //daml-lf/tests to template-let warning

* Adapt //test-common to template-let warning

* Update //compiler/damlc/tests:daml-doc golden output

* Adapt //docs to template-let warning

* Update GHC_REV
2023-08-18 15:14:46 +00:00
Paul Brauner
7585f72d7a
Add flag-protected right-to-left evaluation (#17253)
Right-to-left evaluation allows for a faster and simpler interpreter, but is incompatible with the semantics of Daml 2.x. Adding it behind a flag so we can switch to it in Daml 3.0.

See PR #17253 for ample details.
2023-08-15 13:10:44 +00:00
nickchapman-da
4b60e35a5d
[engine] Restructure contract caching (#17171) 2023-08-09 16:09:13 +00:00
Remy
0918843090
[Script] Runner does not return the machine is using anymore (#17255) 2023-08-09 13:02:36 +00:00
Paul Brauner
4e54c69c9d
Simplify Anf.scala by removing the continuations. (#17242)
The core functions of the ANF transformation in Anf.scala handle 3 different types of continuations:

1. The "transformations" (called tx), that are an inherent aspect of any ANF transformation expressed in pseudo-CPS style for convenience.
2. The "continuations" (called k) that had been introduced to avoid stack oveflows.
3. The trampolines, that have also been introduced to avoid stack overflows.

This commit recognizes that types 2 and 3 are redundant and merges them into only type 3. It relies on the fact that trampolines are monadic, and so we switch from the hand-rolled trampolines to that of scala's std library since they already implement flatMap.
2023-08-09 10:19:01 +00:00
Simon Maxen
7ba1e6754c
Add ResultNeedCreate (#17243) 2023-08-07 17:51:53 +01:00
Carl Pulley
86497ca91c
Error reporting fix for the Daml-LF parser (#17180) 2023-07-28 08:00:59 +01:00
nickchapman-da
3e846d96ac
Final wiring of enable-contract-upgrading feature flag (#17179) 2023-07-26 13:40:53 +00:00
Samuel Williams
aecf70c900
Implement TrySubmit in daml3-script (#17043)
Co-authored-by: Azure Pipelines Daml Build <support@digitalasset.com>
Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2023-07-25 18:22:31 +02:00
Remy
235abfa8ed
Revert "[LF] make Timestamp parsing consistent accross Java versions (#17053)" (#17170)
This reverts commit db7a5b3653.
2023-07-24 16:11:00 +00:00