Commit Graph

554 Commits

Author SHA1 Message Date
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
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
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
Remy
1a0aec9096
LF: utility function for Canton to handle interfaces (#14678)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-10 14:40:15 +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
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
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
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
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
Remy
88d4ff93f2
LF: remove precondition in interface (proto & scala side) (#14511)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-27 10:52:35 +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
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
1cbc21e719
[LF] Cleanup Relation data structure (#14471)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-21 13:03:29 +02:00
nickchapman-da
c17c580b84
Fix handling for throw within handler (#14461)
changelog_begin
changelog_end
2022-07-18 17:17:34 +01: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
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
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
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
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
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
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
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
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
b451edbc66
Add PoC implementation of interface views to Daml Engine (#14116)
changelog_begin
changelog_end
2022-06-09 13:46:27 +02:00
Sergey Kisel
1d8f195438
Sandbox Classic Removal in Tests (#13934)
CHANGELOG_BEGING
CHANGELOG_END
2022-06-07 19:54:52 +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
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
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
12a488f6a4
LF: Expose the keys requested during interpretation (#13983)
CHANGELOG_BEGIN
CHANGELOG_END
2022-05-25 19:03:35 +02: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
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
Nicu Reut
a792de39a5
Update scalafmt to 3.5.1. (#13584)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-28 09:57:04 +00: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
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
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
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
Remy
3d7c54f814
LF: separate test between API and Replay command (#13526)
CHANGELOG_BEGIN
CHANGELOG_END
2022-04-11 11:53:29 +02: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
e080ceb0af
Remove ByInterface Replay Command (#13511)
part of #13491

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-06 09:40:18 +00: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
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
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
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
Remy
f7d1901a5c
LF: split Command into ApiCommand and ReplayCommand (#13323)
CHANGELOG_BEGIN
CHANGELOG_END
2022-03-21 14:07:41 +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
Remy
d5471076ad
Speedy: Factorize fetch part between fetch by template and by itnerface (#13148)
CHANGELOG_BEGIN
CHANGELOG_END
2022-03-07 20:32:47 +01:00
tudor-da
ea48173350
Switch daml-lf/engine and leger-api-tests/tool not depend on kvutils (#13107)
changelog_begin
changelog_end
2022-03-01 15:41:12 +01:00
Remy
ac3d9a4647
LF: Add LoggingContext to Speedy Machine (#12976)
This advances the state of #12208

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-21 13:34:46 +01:00
Remy
380dfa3502
LF: Add cause to internal error (#12965)
When an internal error is due to an unexpected exception, we wrap the
exception into the InternalError.

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-16 11:06:10 +00:00
tudor-da
307931d5b4
Extracted kvutils Config to //leger/ledger-runner-common [DPP-865] (#12889)
* Extracted kvutils Config to //leger/ledger-runner-config

changelog_begin
changelog_end

* Sandbox-on-X logback.xml does not depend on the kvutils/app one

* Remove unused dependencies

* Add copyright header back

* Remove dependency of SoX on kvutils
2022-02-14 13:52:06 +00:00
tudor-da
c9dcd1c493
Update kvutils Config with missing flags options from SandboxConfig [DPP-864] (#12629)
* Update kvutils Config and SandboxConfig
* Remove `eager-package-loading` and `scenario` from SandboxConfig
* Add `profile-dir` and `stackTraces` to kvutils Config
* Configurable authService in kvutils

changelog_begin
changelog_end

* Addressed Samir's review comments

* Add back Maximum supported deduplication duration enforcement of 1 hour
2022-02-07 20:13:04 +00:00
Remy
ee7e0c1cd8
Engine: fix compilation exception catch (#12787)
During refactoring of #9993, the "unsafe" compilation of the seedy command
has been moved out of the scope of `Engine.runSafely`, whose only purpose
was to catch exceptions thrown by the Speedy compiler.

This fixes the issue and renames the function `runSafely` to
`runCompilkerSafely` to make its purpose more obvious.

This is not a critical bug, as the command preprocessing should ensure
that (1) the command are properly typed and (2) all the dependencies
have been loaded.

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-07 20:07:53 +00:00
Remy
35eae895e4
Compiler: expose LF builtin ExerciseByKey (#12615)
With this change, Daml exerciseByKey use the LF primitive
ExerciseByKey instead of the combinason of FetchByKey + Exercise.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-28 16:29:16 +01:00
Moritz Kiefer
688f1e1e0b
Drop v0 contract ids (#12464)
* Drop v0 contract ids

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2022-01-20 15:28:27 +00:00
Stefano Baghino
4af48bbccc
Split channel configuration from LedgerClientConfiguration (#12433)
* Split channel configuration from LedgerClientConfiguration

Fixes #12391

The channel configuration now has to be provided separately from the
configuration specific to the ledger client. In this way we avoid
situations where the builder is provided with some configuration
that gets overridden.

changelog_begin
[Scala bindings] The channel configuration has been split from the
LedgerClientConfiguration class. Provide the gRPC channel specific
configuration separately or use a builder. The channel configuration
no longer overrides the builder.
changelog_end

* Fix compilation issues in //ledger-service/...
2022-01-18 10:03:33 +00:00
Samir Talwar
9c77a3c94b
kvutils: Remove the DAR upload parameters from the runner. (#12366)
* kvutils: Remove the DAR upload parameters from the runner.

No production ledger needs to upload DARs on participant startup; this
feature is primarily for users of Sandbox. The feature never worked in
the case of multiple participants and was only ever used in testing.

This also removes the associated functionality from Sandbox-on-X as they
share a configuration object. Hopefully this won't be an issue.

Some tests were using this feature, so I have updated them to upload the
DARs through the PackageManagementService instead.

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils: Remove the `writePackagesService` factory constructor.

We no longer use it.

* daml-lf/engine: Revert an unnecessary change.

* daml-script/test: Shut down the channel after uploading the DAR.
2022-01-12 12:57:02 +01:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
Sofia Faro
b99952407c
Update TODOs to outdated issues. (#12090)
* Update TODOs to outdated issues.

In particular update a lot of defunct interface TODOs to the LF 1.15
issue (or add the LF 1.15 issue if it's also relevant).

changelog_begin
changelog_end

* typo

* remove numeric/bignumeric todo

* scalafmt!!

* drop choice observer TODO
2021-12-09 21:01:27 +00:00
Remy
b02ed7765a
LF: Introduce configurable limits on produced transactions (#11948)
This is part of #11691

This PR allows to limits:
- the number of signatories,
- the number of observers,
- the number of controllers,
- the number of inputContracts,

CHANGELOG_BEGIN
CHANGELOG_END
2021-12-02 16:31:09 +01:00
Moritz Kiefer
8179c73763
Drop support for Daml-LF party literals from the Scala side (#11922)
* Drop support for Daml-LF party literals from the Scala side

This PR enforces that forbidPartyLiterals is always `true` and drops
the corresponding literals from the AST. Haskell side is in #11930

fixes #11581

changelog_begin
changelog_end

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

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

* Revert "Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ComparisonSBuiltinTest.scala"

This reverts commit 55e542ce4e3a7fd15544ee703de3277ffc309b17.

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-12-01 10:37:42 +00:00
Sofia Faro
1d7bca801e
Add optional typerep argument in UExerciseInterface. (#11910)
* Add type rep argument for interface exercises.

(Still WIP.)

Part of #11703. Fixes the order in which errors are raised ("wrong type"
takes priority over "does not implement interface"). This PR also simplifies
ExerciseInterface by making the guard mandatory, otherwise there's too
many variations. We can revisit that later if we want.

changelog_begin
changelog_end

* haskell side

* dont throw exception in checkTemplateId

* scalafmt

* evidence security

* fix TypingSpec test
2021-11-30 15:10:33 +00:00
Sofia Faro
0b9d57b95e
Add ContractDoesntImplementInterface error. (#11884)
* Add a ContractDoesntImplementInterface error

Part of #10810 and #11703

changelog_begin
changelog_end

* use inside

* rename error
2021-11-29 15:54:31 +00:00
Remy
58e69ade1a
LF: replace "dev" LF version by "1.dev" in bazel files (#11894)
the more consistent, as asked by Moritz in review of #11820

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-26 12:23:17 +00:00
Sofia Faro
024400b9e4
Error when fetching the wrong template id (via fetch by interface). (#11862)
* Prevent wrongly typed fetch by interface.

When doing a "fetch by interface" command with a known template id,
error out with a WronglyTypedContract if the fetched contract has
a different template id. This doesn't affect daml, only affects
replays, so it's rather minor. I also enabled the engine test that
caught this.

Part of #11703, follow up to #11836.

changelog_begin
changelog_end

* strengthen test output checks
2021-11-25 16:19:36 +00:00
Sofia Faro
5c12d757f4
Add a guard when exercising by interface. (#11836)
* Add a guard when exercising by interface.

This fixes part of #11703, when exercising an inherited choice by
interface and you know the template id, via the command preprocessor.

It does this by inserting a "guard" in between the interface fetch and
the exercise body. The guard is a function Interface -> Bool, which
is general enough to check the template id, without complicating too
much in speedy. And can be generalized in the future to check more,
like signatories, etc.

I added the guard as an optional argument to UExerciseByInterface.
This isn't hooked up to the protobuf AST yet (or Haskell side for
that matter) -- but I'll do it in the next PR! For now you can invoke
the guarded exercise via the command preprocessor, so I can enable the
approprate engine tests. (There's still some failing fetch tests left,
but I decided to leave this for later. Fetch can be a lot simpler than
guarded choices, since you always add a fetch node. No need for fancy
continuations.)

changelog_begin
changelog_end

* scalafmt

* Feedback and fix matches

* Update comments, we are always going to abort the transaction

* Raise WronglyTypedContract in SBGuardTemplateId.

* rebase and fix parser

* restore ANF

* scalafmt
2021-11-24 14:22:40 +00:00
Sofia Faro
f8933d1f4b
Make lookupTemplateChoice return only choices in the template. (#11808)
This fixes a bug in the typechecker (#11558) and the command
preprocessor, since those were written with this behavior of
lookupTemplateChoice in mind. Enables the engine test that
caught this.

changelog_begin
changelog_end
2021-11-22 13:27:48 +00:00
Remy
f33486154f
LF: Simplify LF Syntax (#11795)
- Do not wrapped choices in `choices { ... }`
- use sytematic `;` after choice component instead of ',`

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-19 17:23:36 +01:00
Remy
cbe9c922ba
LF: Clean up Ast (#11786)
- rename non-default builders `apply` to `build`
  * avoid confusing both
  * make explicit the build can crash

- make interfaceId and templateId fields consitent

- use when possible named arguments

- check for non-repetition of inherited choices

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-19 15:40:28 +01:00
Sofia Faro
51f646cb22
Add engine tests for interfaces. (#11773)
* Add engine tests for interfaces.

Adds engine tests using the new commands. This uncovered a few issues:

- getDependencies doesn't work when given an interfaceId as a templateId
  (such as when exercising an interface via the ledger api). I patched
  it up so it deals with interface ids. We've already discussed a way to
  simplify getDependencies that will also avoid this in the future, but I'll
  leave that to the future.

- issue #11703 is confirmed via some tests that don't pass (and are
  currently disabled)

- PackageInterface.lookupTemplateChoice returns inherited choices, when it
  should only return own choices. At least, the typechecker assumes
  it doesn't -- this affects #11558 -- as does the command
  preprocessor. I'll leave the cleanup to a separate PR.

changelog_begin
changelog_end

* scalafmt, add missing file

* Move interfaces tests to separate file

* scalafmt
2021-11-18 16:40:03 +00:00
Moritz Kiefer
fa7663148a
Drop 2.12 versioned_scala_deps (#11748)
I’ve kept the infrastructure for versioned_scala_deps around because
I’m optimistic and hope that eventually we’ll do another Scala upgrade.

changelog_begin
changelog_end
2021-11-17 22:13:08 +00:00
Sofia Faro
c2d4ea4ef1
Add separate commands for create/fetch/exercise by template/interface. (#11724)
* Add separate commands wrt by template/interface

Resolves #11674 and #11675

changelog_begin
changelog_end

* remove unnecessary commands
2021-11-17 17:08:24 +00:00
Remy
775b41c235
LF: Reintroduce TransactionVersion.asVersionedTransaction (#11692)
* LF: Reintroduce TransactionVersion.asVersionedTransaction

This have been drop in #11626, but canton is using it.

CHANGELOG_BEGIN
CHANGELOG_END

* cosmetic

* cosmetic
2021-11-15 12:07:23 +00:00
Sofia Faro
57f1b868d3
Improve byInterfaceNodes based on suggestions (#11672)
* Improve byInterfaceNodes based on suggestions

From the last PR #11662

changelog_begin
changelog_end

* use transaction traversal order
2021-11-12 17:31:47 +00:00
Remy
15b925a116
LF: Compute transaction version as the maximum of the children (#11626)
fixes #11377

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-12 17:00:07 +01:00
Remy
7eb22ddf4f
LF: drop forgotten deprecate Node aliases. (#11673)
Because a bug in the scala compiler deprecated pattern matching are
not detected (See https://github.com/scala/bug/issues/12493).
Hence some deprecated usage of Node aliases have been forgotten in

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-12 15:07:22 +00:00
Sofia Faro
409864f220
Use by_interface field when fetching transaction dependencies. (#11662)
* Use by_interface field when fetching tx deps.

Fixes #10915

changelog_begin
changelog_end

* scalafmt
2021-11-12 09:37:24 +00:00
nickchapman-da
2dd5289a35
different types for different speedy phases (#11605)
* Refactor speedy to distinuish SExpr types before/after ANF compilation phase

CHANGELOG_BEGIN
CHANGELOG_END

* remove commment/marker left in error

* make SExpr0 private to speedy

* reinstate (non-pp) print of original expression in AnfTest faiure

* avoid use of s./t. prefixes for expressions in SBuiltin; add 3 TODO markers

* inline "runtime" apply methods of SDefinitionRef into sole caller: SBCallInterface

* avoid use of t. prefix in SExpr0

* change s./t. prefix to source./target.

* add comment to summarize differences between SExpr0 and SExpr
2021-11-11 08:21:12 +00:00
Remy
b8f384e193
LF: Drop typeparameter from KeyWithMaintainers (#11625)
Following up #10827 and #10921, we drop type parameter to
KeyWithMaintainers, and use the `Versioned` wrapper introduced in

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-10 13:21:13 +01:00
Remy
92181161cc
LF: Abstract VersionedValue and VersionedContractInstance (#11533)
* LF: Abstract VersionedValue and VersionedContractInstance

CHANGELOG_BEGIN
CHANGELOG_END

* formatting
2021-11-09 23:22:38 +00:00
Remy
a7559d047e
LF: Rename GenTransaction to Transaction (#11599)
* LF: Rename GenTransaction to Transaction

Following up #10827 and #10921 that drop type parameters from GenNode,
we rename GenTransaction to Transaction.

CHANGELOG_BEGIN
CHANGELOG_END

* fix

* a bit more fixes
2021-11-09 13:30:34 +00:00
Remy
3b61a1b748
LF: allow exercise command by template for inherited choice. (#11584)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-09 13:10:06 +00:00
Sofia Faro
cbc3c8c686
Add by_interface field in Create, Fetch, & Exercise transaction nodes. (#11576)
* Add by_interface field in tx nodes.

This PR adds an optional `by_interface` field in the Create, Fetch,
and Exercise nodes, as part of #10915. It also updates TransactionCoder
to support these fields.

Setting these fields (in the LF interpreter) is left to a separate PR.

changelog_begin
changelog_end

* update security-evidence.md

* Add version checks in TransactionCoder
2021-11-08 16:33:02 +00:00
Moisés Ackerman
7d68e05f7f
Remove virtual choices (#11482)
* Remove virtual choices

* Remove choices without a body in 'interface' definition
* Remove choices in 'template ... implements' section

part of #11372

changelog_begin
changelog_end

* Remove virtual choices cont.

Switch uses of virtual choices to fixed choice with method implementation

* update snapshot after pin on windows

* Disable failing interface tests with TODO #10810
2021-11-08 17:05:23 +01:00
Remy
a8ae4d6f9c
LF: Rename GenNode to Node (#11469)
Following up #10827 and #10921 that drop type parameters from GenNode,
we rename GenNode into Node.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-02 16:42:16 +00:00
Remy
f81d880bcc
LF: drop com.daml.lf.transaction.Transaction.Transaction type alias. (#11470)
After dropping type parameter from GenTransaction we do not
com.daml.lf.transaction.Transaction.Transaction type alias.  We use
instead directly com.daml.lf.transaction.VersionedTransaction, wich is
anyway more informative.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-02 10:23:17 +01:00
nickchapman-da
b5540a9c3b
Evidence for contract-key testing (#11479)
* Split contract-key tests from engine tests, and mark for evidence.

CHANGELOG_BEGIN
CHANGELOG_END

* remove contract key tests from their original location

* evidence for unique/non-unique contract keys
2021-11-01 16:38:26 +00:00
Remy
3098b70624
pretty print contract IDs properly (#11359)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-29 09:02:33 +02:00
Moritz Kiefer
fcc7e581cf
Make stable packages dependent on supported LF versions (#11382)
* Make stable packages dependent on supported LF versions

Note that this just introduces an API dependency, we are not yet
filtering the list of packages. For that, I’d really like to
autogenerate StablePackages.scala since I don’t want to make that
manually maintained list even more complex. But review seems easier if
we first change the usage sites and then switch to autogenerating than
trying to do both in one go.

changelog_begin
changelog_end

* Fix script export tests

changelog_begin
changelog_end
2021-10-28 11:20:42 +00:00
nickchapman-da
68f44325a6
Improve evidence of testing (#11428)
* fine grained test evidence for authorization

* fine grained test evidence for privacy

* fine grained test evidence for input-validation (typing)

* fix exit code of security/update.sh script (set -euo pipefail)

* add security evidence test category: Input Validation

* regenerate security-evidence.md

CHANGELOG_BEGIN
CHANGELOG_END

* fix bug in securoty evidence generation (must sort before group, or else we loose lines)

* evidence for input validation of commands

* address comments

* cleanup: remove backticks from evidence free text
2021-10-28 09:24:52 +00:00
Moritz Kiefer
ba106873b9
Replace 1.14 min version conformance test by custom test (#11433)
We waste 2 minutes on most CI runs with the conformance test for no
good reason. Uploading the package & sending a command should be
sufficient as an integration test.

changelog_begin
changelog_end
2021-10-27 16:55:52 +00:00
Remy
d678a4046d
LF: remove type parameter from ContractInstance (#11419)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-27 09:59:13 +02:00
Remy
c8006b866a
ScenarioRunner: enrich incomplete transactions (#11384)
* ScenarioRunner: enrich incomplete transactions

fixes #11352

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-26 19:28:05 +02:00
nickchapman-da
a2a15716b4
Generate security evidence by documenting security testcases (#11306)
* Generate security evidence by documenting security testcases.

CHANGELOG_BEGIN
CHANGELOG_END

* move generated file to root of repo, so links work

* formatError function instead of Show instance

* dont use Show instances for generating Markdown

* magic comment: SECURITY_TEST --> TEST_EVIDENCE

* use megaparsec and Data.Text

* remove redundant T.pack

* use: Text.Megaparsec.Char.space
2021-10-26 09:07:59 +00:00
nickchapman-da
2db8c138a8
Test authorization within Exercise choice. (#11246)
* Test authorization within Exercise choice.

CHANGELOG_BEGIN
CHANGELOG_END

* fix build following rebase

* 4x shouldBe a Right

* test for exercise within exercise

* implicit Name.assertFromString

* def --> val. massive speedup!

* be more private

* implicit Identifier creation

* use implicit for Party and ChoiceName creation

* comment test purpose

* delete stray text; fix build
2021-10-18 12:33:23 +01:00
Remy
a1d94e10ba
LF: Create special case class for VersionedContractInstance (#11127)
To replace usage of ContractInstance[VersionedValue]

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-14 08:53:26 +02:00
nickchapman-da
9c107a7aa8
Fix fishy discards (#11197)
* dont discard errors

CHANGELOG_BEGIN
CHANGELOG_END

* remove redundant match case
2021-10-12 11:18:34 +00:00
Robin Krom
3115d104aa
daml script interfaces (#11124)
* interfaces: introduce TemplateOrInterface class in stdlib

The template typeclass is to strong for many applications. The new
constraint `TemplateOrInterface` only contains the methods to convert
contract IDs and choices.

CHANGELOG_BEGIN
CHANGELOG_END

* ghc-lib update, interface script tests

* pinned stackage on unix

* added missing implementation in preprocessor

* added test

* fixing tests

* remove Iface type

* pinned stackage windows

* make sure createAndExercise is not called on interfaces
2021-10-11 18:22:40 +02:00
nickchapman-da
67d4011fcd
Fix NonUnitStatements in daml-lf code (#11145)
* build daml-lf/* with lf_scalacopts_stricter; and fix NonUnitStatements

fix daml-lf/archive

CHANGELOG_BEGIN
CHANGELOG_END

fix daml-lf/data/

fix daml-lf/engine

fixes for scala 2.12

data-scalacheck, interface, kv-transaction-support: switch on; nothing to do

* daml-lf/parser -- switch on; nothing to do

* daml-lf/validation : switch on lf_scalacopts_stricter & fix wartremover:NonUnitStatements

* lf_scalacopts_stricter in daml-lf/transaction-test-lib

* lf_scalacopts_stricter in daml-lf/scenario-interpreter
2021-10-11 14:54:33 +01:00
nicu-da
9b2a8c7eb5
Enable top level statement blank lines scalafmt rule, which adds a blank line after imports (#11180)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-10 23:16:48 -07:00
Remy
4336184a79
LF: Add interface fixed choices in scala AST and type checker (#11146)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-08 08:59:26 +02:00
nickchapman-da
1522c84bae
Unit tests for FailedAuthorization (#11082)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-06 12:25:42 +01:00
Moritz Kiefer
26d10b267d
Drop NodeId type parameter (#10921)
changelog_begin
changelog_end
2021-09-30 09:13:54 +00:00
Remy
cb0e41f101
LF: Add interface support to the Preprocessor (#11013)
This is part of #10810

We handle only the case of Exercise as Fetch is currenlty used only by
Canton

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-23 17:58:44 +00:00
nickchapman-da
c33297c5fe
Remove transactionNormalization flag. (#11010)
Transactions produced by the engine are now normalized unconditionally.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-23 17:10:10 +00:00
nickchapman-da
88e1430a42
Make LargeTransactionTest use ValueEnricher, so it can work with normalized transactions coming out of the engine. (#11003)
(Also: generalize type of `enrichTransaction` to work for _submitted_ and _committed_ transactions & adapt existing callers)

This change paves the way to remove the `transactionNormalization` flag, and always normalize transactions coming out of the engine.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-23 11:51:14 +00:00
Remy
58c82b6e41
LF: reduce usage of NodeCreate.coinst (#10988)
Access directly templateId, argument, and agreementText.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-22 18:52:23 +00:00
nickchapman-da
fe10ffbe8f
Use ValueEnricher in ScenarioRunner. (#10897)
1st attempt. Causes package recompilation (bad!).

CHANGELOG_BEGIN
CHANGELOG_END

fix build

Change ValueEnricher interface to work without passing an Engine

ValueEnricher has optional preprocessor

simplify new interface to ValueEnricher: caller passes translateValue function
2021-09-22 16:57:52 +01:00
Remy
eb4f1b2a05
LF: Move lookup tests out of EngineTest (#10973)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-22 13:36:46 +02:00
Remy
8b3b033fad
LF: Test preprocessor resuming (#10936)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-21 08:53:37 +02:00
Remy
5dc15c6911
LF: rename language Interface to PackageInterface (#10938)
To avoid confusion with the new Daml concept of Interface.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-20 19:04:14 +00:00
Remy
ac02dbdeb9
LF: Exhaustive test for valueTranslator. (#10927)
* LF: Exhaustive test for value translator.

CHANGELOG_BEGIN
CHANGELOG_END

* cosmetic
2021-09-20 14:21:45 +00:00
Remy
906368d7e2
LF: exhaustive test for CommandPreprocessor (#10914)
While implementing the tests I found a bug.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-17 11:41:29 +00:00
Remy
9582e019ec
LF: Refactor PreprocessorSpec test (#10909)
Just moving stuff arround

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-16 13:58:47 +00:00
Moritz Kiefer
8e22bb6b2d
Drop ContractId typeparameter from Value (#10827)
99% of our usecases use Value[ContractId] so this PR just fixes it.

The few other usescases are:

1. Value[Nothing] which we use for keys. This is technically more
precise but we benefit very little from it.
2. Value[String] mostly because in a few places we are lazy.

We don’t have any code which benefits from being polymorphic in the
contract id type.

changelog_begin
changelog_end
2021-09-16 08:46:57 +00:00
Remy
1e1c452b36
LF: drop ad-hoc FrontStack builders (#10839)
Following #10763, we drop the ad-hoc builders for `FrontStack`.

* Building a `Fronstack` from individuals elements should be done with
  standard scala buidler.

* Building a `Fronstack` from a `TraversableOne` should be done with
  the scala 2.13 `.to(FrontStack)` methd

* Building a `Fronstack` from a `ImmArray` should be done with the
  `toImmArray` method.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 17:49:09 +02:00
Remy
24fff88992
LF: Simplify TransactionBuilder (#10753)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 15:37:46 +02:00
Remy
e42cd3a1c6
LF: add interface to scala AST and decoder (#10830)
this is part of #10810

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-10 08:46:19 +02:00
nickchapman-da
8405ad58fd
Enhance InMemoryLedger to use the ValueEnricher (#10757)
* Enhance InMemoryLedger to use the ValueEnricher.

Allowing SandboxServer to run Engine with the default transactionNormalization=false

CHANGELOG_BEGIN
CHANGELOG_END

* enrich only when responding to verbose API queries
2021-09-08 08:47:47 +01:00
Remy
c4e0a755d4
LF: drop ad-hoc ImmArray builders (#10763)
Since we switch to scala 2.13, ImmArray companion object extends
`Factory`. Hence:

- the `apply` methods of `ImmArray` override the one from `Factory`

- we can use the notation `.to(ImmArray)` to convert an `Iterable` to
  `ImmArray`

This PR drops those `apply` ImmArray. Conversion from Iterable to
`ImmArray` should use the `.to(ImmArray)`.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-04 16:10:07 +02:00
Moritz Kiefer
50fecfb9ef
Wrap missing label names in quotes (#10749)
* Wrap missing label names in quotes

See
https://discuss.daml.com/t/why-might-i-be-getting-missing-record-label-identity-from-the-ledger-api-when-submitting-a-command/3059/5
this has caused some confusion for users since it’s not obvious that
it is the label name if you have a very generic label name like
`identity`.

I have no strong feelings on whether this should be single or double
quotes so happy to change it.

changelog_begin
changelog_end
2021-09-03 13:52:55 +00:00
Remy
c11323ddb1
LF: Refactor engine test reinterpret (#10724)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-01 09:57:16 +02:00
Remy
27c13334b6
LF: Drop outdated TODOs (#10725)
* LF: Drop outdated TODOs

CHANGELOG_BEGIN
CHANGELOG_END

* Address Moritz' Review
2021-08-31 18:02:29 +00:00
Remy
9f072aeba0
Ledger-API Conformance test for Contract ID V0 (#10717)
CHANGELOG_BEGIN
CHANGELOG_END
2021-08-31 18:17:29 +02:00
Remy
97bda3ca36
LF: V1 Contract ID check in Preprocessor (#10687)
This PR makes possible to reject V0 contract IDs during preprocessing.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-30 20:14:55 +02:00
Remy
d54adb2543
Ledger-API: Conformance tests for contract IDs suffixing (#10654)
This is part of #10504

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-26 16:14:02 +02:00
nickchapman-da
387c68b9eb
Normalize transaction values within the engine (#10648)
Create normalized TXs when a partial TX is finalised.

Except in limited cases! (i.e for scenario-runner, sandbox)

CHANGELOG_BEGIN
CHANGELOG_END

normalize values in the engine as they are converted from speedy-values

fix 2.12 build

backout redundant change

ensure byKey field is correctly normalized when constructed by engine

rename flag: valueNormalization -> transactionNormalization

improve comment

delete commented-out code

rename: toValueNorm --> toNormalizedValue

rename: (SValue.) toValue --> toUnNormalizedValue

revert changes to ptx so that the interface to insertCreate() etc is Value-based (not SValue-based)

improve comments

respell: toUnNormalizedValue --> toUnnormalizedValue

fix build
2021-08-25 09:53:26 +01:00
Remy
b22de6893b
LF: Contract ID suffix check in Preprocessor (#10642)
This PR makes possible to check for contract IDs suffix during
preprocessing.

This is the first part of the task 3 described in #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-24 18:45:33 +02:00
Remy
3598e0928c
LF: Drop contract ID Freshness check (#10620)
As stated in #10504 the contract ID freshness check cannot be
implemented correctly in general.

This PR drops the support for this (buggy) check.

This corresponds to the fist task of #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-19 18:07:29 +02:00
nickchapman-da
aec601f929
Fix badly versioned empty tx (#10596)
* build correctly versioned empty tx

* dont call normalizeTx from Engine.validate

* dont recalc the tx-version in normalizeTx; just assume it is correct

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-17 13:58:58 +01:00
nickchapman-da
9db5ccfc4e
Normalize transactions & values as a separate pass (#10524)
* Normalize transactions & values as a separate pass. Use for simpler defintiion of isReplayedBy.

CHANGELOG_BEGIN
CHANGELOG_END

normalize transaction version

* remove stray import from bad merge which breaks scala 2_12 build

* change isReplayedBy to only norm its RIGHT (replay) argument

* add forgotton normalization for ValueEmum

* switch to use existing value normalization code (remove my newly coded duplicate code)

* normalize submittedTransaction before calling engine.validate

* dont call normalizeTx from Engine.validate

* *do* call normalizeTx from Engine.validate
2021-08-16 14:54:50 +00:00
Samir Talwar
4b8b67a1b5
Upgrade Scalatest to v3.2.9. (#10576)
* Upgrade Scalatest to v3.2.9.

Because of some coupling we also have to upgrade Scalaz to the latest
v7.2 point release, v7.2.33.

The Scalatest changes are quite involved because the JAR has been broken
up into several smaller JARs. Because Bazel expects us to specify all
dependencies and doesn't allow transitive dependencies to be used
directly, this means that we need to specify the explicit Scalatest
components that we use.

As you can imagine, this results in quite a big set of changes. They
are, however, constrained to dependency management; all the code remains
the same.

CHANGELOG_BEGIN
CHANGELOG_END

* http-json-oracle: Fix a Scalatest dependency.

* ledger-api-client: Fix a Scalatest dependency.
2021-08-12 23:19:35 +00:00
Samir Talwar
41e60f7302
Upgrade to Scala 2.12.14 and 2.13.6. (#10573)
* Upgrade to Scala 2.12.14.

* Upgrade Scala to 2.13.6.

CHANGELOG_BEGIN
CHANGELOG_END

* compability: Re-pin the Maven dependencies.
2021-08-12 14:25:53 +00:00
Remy
dc47b105de
LF: Log internal errors (#10471)
part of #9974

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-04 12:31:58 +02:00
Remy
c243f82525
LF: Clean up of Errors (#10052)
part of #9974

 - rename `msg` field to `message`
 - drop `engine.Error.Validation.Generic`
 - rename argument `where` to `location`
 - Builtin set the `dependsOnTime` before throwing the callback `SResultNeedTime`

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-03 18:35:34 +02:00
Remy
73290c29d5
LF: Add context in missing package errors (#10418)
explaining the origining of missing package.

This is part of #9974

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-28 12:17:07 +02:00
Remy
41009f79cc
Compiler: Make LF 1.14 the default output (#10394)
CHANGELOG_BEGIN

- [Compiler] Default compiler output LF version is now 1.14

CHANGELOG_END
2021-07-28 12:14:56 +02:00
Sofia Faro
0da814d250
Let stable packages bypass LF version restrictions. (#10377)
* Stable packages bypass version restrictions.

Part of #10029

changelog_begin
changelog_end

* Add missing bypass

* scalafmt

* Fix tests

* fix script runner

* Fix scenario service

* Dont make stable packages configurable

* unused import

* revert unnecessary formatting changes

* Added a StableOnly engine mode and a conformance test that uses it

* buildifier-fix

* Inline LanguageVersions.StableOnly

* scalafmt

* Remove EngineMode in favor of representing the version range directly

* Add -unsafe to flag name

* Apply suggestions from code review
2021-07-27 18:51:00 +00:00
Remy
faf479e8c8
LF: add context in LookupError (#10314)
This is part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-21 19:03:53 +02:00
nickchapman-da
0e09f3ba08
Remove optLocation field from transaction nodes. (#10301)
* Remove Optional[Location] field from transaction nodes.

xoptLocation

working but very messy!

cleanup PartialTransaction code

pass locationInfo in CompleteTransaction

dont pass locationInfo in SumittedTransaction

pass optLocation to CheckAuthorization

temp reinstate xoptLocation in ExerciseContextInfo

cleanup Conversions.scala

remove Optional[Location] field from transaction nodes.

CHANGELOG_BEGIN
CHANGELOG_END

* fix bad merge

* fix build after merge

* rename

* doc comment, and question
2021-07-19 13:03:30 +00:00