Commit Graph

2002 Commits

Author SHA1 Message Date
Remy
8cfe4c01a3
Check qualified name when upgrading a contract (#17662) 2023-10-31 09:53:17 +01:00
Paul Brauner
db91552b4a
replace community canton snapshot with our bazel-built canton deploy jar (#17651)
* replace community canton snapshot with our bazel-built canton deploy jar

* add VERSION to the resources of the jar

* fix canton-test-runner-with-dependencies-script

* add resources to community_common

* Update test-common/canton/it-lib/src/main/com/daml/CantonFixture.scala

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

---------

Co-authored-by: Remy <remy.haemmerle@daml.com>
2023-10-30 10:23:15 +00:00
Remy
422b6934d6
[Speedy] improve upgrade failure error message (#17634) 2023-10-25 15:16:11 +00:00
Moisés Ackerman
d5ec537cee
Daml.Script: Add trySubmit{,Multi}Concurrently (#17608)
* Update docs for SubmitError:TemplatePreconditionViolated

* Daml.Script: add 'trySubmit{,Multi}Concurrently'

* Make trySubmitConcurrently fully sequenced when using IdeLedger

* Add test cases for trySubmitConcurrently

* Test trySubmitConcurrently in Daml3ScriptTestRunnerDev

* Handle LOCAL_VERDICT_LOCKED_{CONTRACTS,KEYS} in gRPCi Ledger Client

* Move 'trySubmit{Multi}Concurrently' to 'Daml.Script.Questions.Submit.Internal'

* Apply review feedback

* Test 'trySubmitConcurrently' using AbstractScriptTest instead of DamlScriptTestRunner

* Apply review feedback: trySubmitConcurrently returns List instead of Seq
2023-10-25 12:12:43 +00:00
Simon Maxen
0b637ff695
Make package optional in scenario service (#17619) 2023-10-23 13:42:36 +01:00
dylant-da
9011c13579
Initial typechecking for upgrades (#17220)
* first example

* remove reliance on NameMap in del/existing/new logic

* Add testing for upgrades typechecking in `daml damlc build`

* lint

* add typecheck-upgrades flag

* rename Foo to MyLib

* Add missing field to PackageConfigFields

* Add reasonable context location for upgrade errors

Staging last changes before I leave for CX for some time.

* fix quoting for windows paths

* Check template choices specifically

* Refactor to have signatory etc. checks, improve choice/template check

* Check return types of choices

* Update DamlcUpgrades for new versions

* Check for deleted top level datatypes, add TODO for type check

Also add type signatures to some helpers

* Add tests for templates as input and outputs of choices

* lint

* Move upgrading error variants into own UpgradeError type

* Improve comment for choice input type invariant

* Replace TemplateChoiceOutput with shouldCheck
2023-10-19 17:37:11 +00:00
Moisés Ackerman
61ba0fa6fa
Cleanup after LF V2 backwards compatibility break (#17558)
* Set 'optDetailLevel = PrettyLevel (-1)' in integration tests

This means we don't need to postprocess the damlc output to remove package ids

* Move stable type constructors to DA.Daml.StablePackages

* Don't use 'rewriteStableQualified' for Tuples in LFConversion

* Don't use 'rewriteStableQualified' for DA.Internal.Erased.Erased in LFConversion

* Don't use 'rewriteStableQualified' for DA.Internal.PromotedText.PromotedText in LFConversion

* update StablePackages comment

* Future-proof renderFeatureVersionReq
2023-10-16 15:47:31 +02:00
Samuel Williams
5eb2696deb
Implement multi-package.yaml CLI (#17267)
* First working model (requires ghcide changes)

* Bug fixes, add logging

* Use pinned ghcide

* Comment up a storm

* Add multi sdk version support

* Implement project.yaml approach

* Cleanup

* Add projects to multi-package.yaml

* Add flags for build all projects in multi-project, and no caching

* Delete ghcide

* Start migration from daml multi-build to daml build

* Add non --all daml build flow

* Finish migration over to daml build

* Add comments

* Change --all and --no-cache to switches

* Fix caching issue with source set to .

* Address initial comments

* Add daml.yaml source as a file caching warning

* Forward sub-assistant call errors to multi-build

* Update comment

* Update merged ghcide
2023-10-11 13:50:55 +01: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
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
Remy
623f305e9c
Move canton directory to let place for code drop (#17506) 2023-09-29 14:37:01 +00: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
Samuel Williams
c0a18eeb7e
Fix daml3-script warning (#17481) 2023-09-26 17:07:52 +01:00
Moisés Ackerman
84ca088b2c
Check script output in damlc integration tests (#17380)
* Refactor damlc integration test input into datatype

* Factor out 'withLog' helper function

* Reduce scope of 'service' in 'testCase'

* Use 'testPassed' helper for ignored test files

* Reduce scope of 'TestCase' and 'log' in 'testCase'

* Use guards instead of nested if-then-else in 'testCase'

* Extract 'testSetup' from 'testCase' using 'withResource'

* {testCase=>damlFileTestTree} now produces a test tree

* Split jq queries into individual tests

* whitespace

* Add ledger expectation tests

* Avoid double inversion-of-control
2023-09-20 18:07:28 +00:00
dylant-da
87927df0af
Add flag for selectively disabling choices in coverage report (#17442)
* Add flag for selectively disabling choices in coverage report

* Rename `shouldntSkip` to `shouldKeep`

Avoid double negation
2023-09-20 15:42:35 +00:00
Moisés Ackerman
5f051050f9
Add --detail=LEVEL option for daml test and daml ide (#17399)
* avoid extra newlines in prettyScenarioResult

* Add '--detail=LEVEL' option to choose level of detail in e.g. 'daml test' and 'daml ide'

This way we can choose whether to print package ids

DA.Daml.LF.PrettyScenario: add 'PrettyLevel' argument
2023-09-19 17:24:46 +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
Moisés Ackerman
1bee52e40c
Remove compiler support for controller..can choice syntax (#17362)
* Update GHC_REV

* Remove 'controller..can' syntax in java codegen StakeholdersTest

* Remove 'controller..can' syntax in ChoiceSyntaxes daml-test-file

* Remove daml-test-files {,No}WarnControllerCan

* Remove 'controller..can' syntax in SemanticsEvalOrder{,RightToLeft} daml-test-files

* Update {Structure,Reference}.daml code snippets for docs.daml.com

* Remove 'controller..can' syntax in TestGrammar.daml

* changelog entry for 'controller..can' removal

* Update UNRELEASED.md

Co-authored-by: carrielaben-da <91496516+carrielaben-da@users.noreply.github.com>
2023-09-08 10:30:21 +00:00
Gary Verhaegen
4bf7693f42
fix cache (#17377)
Looks like the issue was Bazel 5.2.0.
2023-09-08 10:31:42 +02:00
Moisés Ackerman
0fd8c51343
Remove dependency of //compiler/damlc/tests:incremental-package-db on //daml-lf/repl (#17372) 2023-09-06 14:11:47 +02: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
Moisés Ackerman
6ae0e0111e
Upgrade to Bazel 5 (again) (#17319)
* Update to rules_haskell v0.16
* Update comments re bazel patches
* clean up bazel overrides
* Upgrade to Bazel 5.2.0
* Remove '--distinct_host_configuration=false'
* Update buildifier to 6.3.2
* Suffix macos and ubuntu caches with yyyymm
* bump windows cache to v14
* [REVERTME] bump linux/macos/darwin timeout to 4h
2023-09-01 15:15:36 +02:00
Remy
99f466d47b
[Script] Factorize out Generic Free Monad Runner (#17194) 2023-08-28 18:54:30 +02:00
Samuel Williams
1a771dcb13
Refactor daml-script cli interface to be unified (#17215)
* Refactor daml-script cli interface to be unified

* Add --upload-dar flag.

* Fix tests with new uploadDar flag

* Initial daml-script binary testing

* Tests for argument passing and failure behaviour

* add participant config and ide tests

* Add windows support to tests

* Fix missing tls error assertion

* Update changelogs
2023-08-24 15:58:32 +01:00
Samuel Williams
6146149a22
Expose daml3-script to sdk (#17291)
* Expose daml3-script to sdk

* Add warning to daml3-script
2023-08-24 10:42:47 +01:00
Remy
0a1777c491
Revert bouncy castle fix, included in #17236. (#17295)
This partially reverts commit 2f4b494fa5.
2023-08-23 10:54:29 +02:00
Samuel Williams
9179b2e7d0
Jar licensing (#17299)
* Add _distribute.jar target with correct license
Use it everywhere

* Fixes from review

* Change NOTICES to NOTICES.txt for consistency
2023-08-22 15:56:29 +01:00
Remy
755ea16def
[ScenarioService] log errors more nicely (#17292) 2023-08-22 09:59:24 +00:00
Carl Pulley
195795537d
interpretation Error ValueNesting should not be in Dev (#17241) 2023-08-22 09:01:30 +01:00
Paul Brauner
e1fef18e56
Limit right-to-left integration tests to script v2 (#17286) 2023-08-21 15:52:49 +00: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
923bd500e4
Test both evaluation orders in daml script tests. (#17271)
PR #17253 introduces a right-to-left evaluation order behind an interpreter feature flag. It also modifies every scala test that uses the interpreter to test both evaluation orders and documents any divergence as a new test case.

In this commit we do the same for Daml script tests (compiler/damlc/tests/daml-test-files/...). We introduce a new file annotation for Daml script tests: @EVALUATION-ORDER (LeftToRight|RightToLeft). A test that uses this annotation will be ignored when run with an evaluation order that differs from the specified one. The BUILD file is modified to run every test twice: once in left-to-right order, and once in right-to-left order.

The only test for which the evaluation orders disagree is SemanticsEvalOrder.daml. So we mark it as left-to-right only, and we introduce SemanticsEvalOrderRightToLeft.daml, which is right-to-left only and documents the new behavior. All the other existing tests are run using both modes and do not diverge.
2023-08-15 20:55:33 +02:00
Remy
0918843090
[Script] Runner does not return the machine is using anymore (#17255) 2023-08-09 13:02:36 +00:00
dylant-da
5c31bc3f21
More fixes to ContractNotFound AdditionalInfo (#17211)
* Replace Text with AnyContractId in AdditionalInfo.templateIdentifier

Also, subsume ContractNotActive variant into AdditionalInfo

* lint

* rename contractIdentifier to something clearer

* remove ContractNotActive constructor, update indices

* add isNotActive for Daml3ScriptTrySubmit tests

* Use isNotActive on ContractNotFound instead of ContractNotActive

* Remove show instance for deleted ContractNotActive variant

* fix variant numbers for ContractNotFoundAdditionalInfo

* Expect different Daml3ScriptTrySubmit:contractNotActive per test ledger

* temp: swap expectations

* Disable cantonFixtureDebugMode check
2023-08-09 11:06:58 +01:00
Samuel Williams
e8cd28289a
Capitalise The Standard Library in title position (#17208) 2023-08-07 09:31:47 +01:00
azure-pipelines[bot]
2f4b494fa5
bump canton to 2.8.0-snapshot.20230804.10940.0.ve26becd2 (#17236)
bump canton to 2.8.0-snapshot.20230804.10940.0.ve26becd2

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Azure Pipelines Daml Build <support@digitalasset.com>
Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
2023-08-06 13:32:51 +02:00
dylant-da
777779f363
Add additional debugging info to ContractNotFound where possible/allowed (#17183)
* Add additional debugging info to ContractNotFound where possible/allowed

* import foldMap

* add variants and conversion logic for structured ContractNotFound errors

* lint

* Add Identifier for template, document invariant in ContractNotFound

* Move ContractNotFoundAdditionalInfo to ContractNotFound.AdditionalInfo

* lint

* Don't export construtors for ContractNotFoundAdditionalInfo

* Test to make sure ContractNotFoundAdditionalInfo is hidden
2023-07-27 16:44:58 +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
Samuel Williams
d657c419fc
Run Damldoc test serially to avoid flake (#17118) 2023-07-12 13:25:35 +00:00
Samuel Williams
f6379328e9
Added diagnostics logging for damldoctest failures (#17111) 2023-07-12 09:09:58 +01:00
azure-pipelines[bot]
851bfe59aa
bump canton to 2.7.0-snapshot.20230710.10749.0.va7968768 (#17102)
* bump canton to 2.7.0-snapshot.20230710.10749.0.va7968768

CHANGELOG_BEGIN
CHANGELOG_END

* Update Repl.hs (#17105)

---------

Co-authored-by: Azure Pipelines Daml Build <support@digitalasset.com>
Co-authored-by: Sergey Kisel <98825453+skisel-da@users.noreply.github.com>
2023-07-11 15:45:27 +00:00
Samuel Williams
95dd64bc02
Script package vetting (#17035)
* Version the script runner

* Fix import

* Add v2 files

* Add v1/v2 switching logic

* Add -- @ SCRIPT-V2 flag to integration tests

* Fix daml-v2 docs gen, refactor withDamlScriptDep

* Fix package name for daml-script2

* Fix polymorphic script warning for daml-script2

* Address review comments

* Scala, not haskell

* Add warnings to template files

* Rename daml-v2 to daml3, daml-script-v2 to daml3-script

* Fix polymorphic warning again

* Switch try catch to a command

* Use free properly, make all continues identity

* Split up DamlScript, implement Questions logic

* Fix most of the issues

* Drop internal callstack frames

* Minor fixes

* Prevent Catch being treated as an old-style typeclass

* Fix catch parsing

* Implement package vetting and unvetting

* Add no such template error to scenario service proto

* Notes for updateCompiledPackages in IdeLedgerClient

* Improve script src copying

* Add package vetting test, and framework for extra packages in integration tests

* Fix daml script dar rule mistake

* Apply suggestions from code review

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

* Convert PureCompiledPackages to case class

* Generalise Lookup error over scenario proto

* Address review

---------

Co-authored-by: Remy <remy.haemmerle@daml.com>
2023-06-29 15:42:34 +01:00
Rex Ng
c6579773a6
Export shows function (#16965) 2023-06-28 14:12:58 +00:00
Samuel Williams
6640c6fbd8
Daml3 script refactoring (#17028)
* Version the script runner

* Fix import

* Add v2 files

* Add v1/v2 switching logic

* Add -- @ SCRIPT-V2 flag to integration tests

* Fix daml-v2 docs gen, refactor withDamlScriptDep

* Fix package name for daml-script2

* Fix polymorphic script warning for daml-script2

* Address review comments

* Scala, not haskell

* Add warnings to template files

* Rename daml-v2 to daml3, daml-script-v2 to daml3-script

* Fix polymorphic warning again

* Switch try catch to a command

* Use free properly, make all continues identity

* Split up DamlScript, implement Questions logic

* Fix most of the issues

* Drop internal callstack frames

* Minor fixes

* Prevent Catch being treated as an old-style typeclass

* Fix catch parsing

* Improve script src copying

* Fix daml script dar rule mistake

* Address review comments

* Address deep dive comments

* Update daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/Runner.scala

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

* Small fix

* Add some information to Internal.daml

---------

Co-authored-by: Remy <remy.haemmerle@daml.com>
2023-06-28 09:15:21 +01:00
Gary Verhaegen
0e9cb10f7d
optionally get canton EE (#17039) 2023-06-27 11:00:24 +02:00
Remy
7b7a6f6211
Reactivate windows tests disable in #16760 (#16958)
namely:
-  //daml-script/export/integration-tests/reproduces-transactions:test
-  //compiler/damlc:daml-stdlib-doctest

Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
2023-06-20 16:28:50 +02:00
Samuel Williams
3807cd94bc
Fix formatting for controllers and sigs (#16961)
* Fix formatting for controllers and sigs

* Revert parser changes, take non-breaking fix
2023-06-20 15:27:39 +01:00
Samuel Williams
d813fbbdc3
Add daml-script v2 (#16934)
* Version the script runner

* Fix import

* Add v2 files

* Add v1/v2 switching logic

* Add -- @ SCRIPT-V2 flag to integration tests

* Fix daml-v2 docs gen, refactor withDamlScriptDep

* Fix package name for daml-script2

* Fix polymorphic script warning for daml-script2

* Address review comments

* Scala, not haskell

* Add warnings to template files

* Rename daml-v2 to daml3, daml-script-v2 to daml3-script

* Fix polymorphic warning again
2023-06-20 14:26:45 +01:00
dylant-da
ab5a9d56bb
Prevent scripts from restarting when users trigger other IDE actions, like hover (#16984)
* Stop the semaphore thread cleanly when a result was received

* Use ContextId to disamiguate similar script runs

* Test opposite side (cancellation does *not* happen after hover)

* Longer timeout, drop todo for `scenario service does not interrupt` test

* Add better comments, refactor 4-tuple into RunInfo
2023-06-16 12:50:09 +00:00
dylant-da
2216cd70aa
Fix missing import suggestions (#16944)
* Point to updated GHCIDE

* Add test for infix operator import code actions
2023-06-16 11:16:17 +00:00