Commit Graph

87 Commits

Author SHA1 Message Date
Remy
5a07b6596f
LF: check viewtype is a monomorphic record (#14802)
CHANGELOG_BEGIN
CHANGELOG_END
2022-08-25 10:02:13 +02:00
Simon Maxen
937f8d1d45
Switch metering report to using Struct [DPP-1135] (#14767)
* Switch metering report to using Struct

changelog_begin
changelog_end
2022-08-22 08:55:06 +01: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
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
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
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
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
Remy
88d4ff93f2
LF: remove precondition in interface (proto & scala side) (#14511)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-27 10:52:35 +02:00
Stephen Compall
8309cfef1e
group JSON API tests by endpoint, other categories (#14522)
* group query tests
* group remaining abstract integration tests
* group user management tests
* group websocket tests

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-26 11:50:04 -04:00
Remy
df21aad8af
LF: Make ExerciseInterface guard field optional (#14493)
in protobuf

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-25 11:33:02 +02: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
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
Sergey Kisel
f9521f27eb
Accept new form of JWT tokens [DPP-1102] (#14323)
* Accept new form of jwt tokens [DPP-1102]

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-04 17:41:08 +02:00
Remy
d0058dcff3
[Interface] make all ContractIds serializable (#14307)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-01 11:07:12 +02:00
Victor Peter Rouven Müller
8d21d19133
Add support for cmd deduplication & submission id for cmd submissions (#13771)
* Add completion offset to cmd submission responses

changelog_begin
- [HTTP-JSON] there is now a new meta field called deduplicationPeriod for cmd submissions with which one can specify the deduplication period. Moreover there also is another new meta field submissionId for the cmd submissions.
- [HTTP-JSON] Calls to endpoints for command submission now include the completion offset
changelog_end

Co-authored-by: Raymond Roestenburg <98821776+ray-roestenburg-da@users.noreply.github.com>
2022-06-29 16:57:05 +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
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
Stephen Compall
19ad1be8f2
use domain.Party instead of String in json-api tests (#14158)
* use domain.Party instead of String for iouCreate{,AndExerciseTransfer}Command

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-15 08:59:23 -04: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
Sergey Kisel
1d8f195438
Sandbox Classic Removal in Tests (#13934)
CHANGELOG_BEGING
CHANGELOG_END
2022-06-07 19:54:52 +00:00
Stephen Compall
7c23420876
use more domain models for json-api response tests (#14101)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-07 08:57:17 -04:00
Remy
ae8f50dbb8
LF: drop inheretedChoices from Implements (#14068)
part of #13653

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 18:48:54 +00:00
Stephen Compall
a716428ebc
replace hand-disassembly of json in tests with domain model values (#13960)
* make postJsonRequestWithMinimumAuth parse, and make all its callers declarative
* make getRequestWithMinimumAuth parse, and make all its callers declarative
* note about further cleanup

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-24 06:31:06 -04:00
Stephen Compall
97f3f4f956
reduce fixture-passing boilerplate in json-api tests (#13829)
* move the fixture data to a single value, make utilities extend off it
* start unifying the with* functions

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-23 16:16:35 +00: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
f4338bdece
Trigger: return less confusing message when trigger is not found. (#13904)
* Trigger: return less confusing message when trigger is not found.

fixes #13893

CHANGELOG_BEGIN
CHANGELOG_END
2022-05-18 09:31:16 +00: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
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
Victor Peter Rouven Müller
3decea2a95
Use deriveFormat for ErrorDetailsFormat instead of hand written JsonFormat (#13770)
* Use deriveFormat for ErrorDetailsFormat instead of hand written JsonFormat

changelog_begin

- [HTTP-JSON] The field "@type" was renamed to "type" for encoding the ErrorDetails case

changelog_end

* Use moar types! :)

* Use proper tags, not aliases
2022-05-03 13:28:15 +00:00
Victor Peter Rouven Müller
2e6dbefa8c
Add optional ledgerApiError details to responses (#13751)
* Add optional ledgerApiError details to responses

* Finally get some proper error details

* Cleaning up the code

* Less bad words in the code

* Better deserialization error msg

changelog_begin

- [JSON-API] The response of the json api now includes a field ledgerApiError that contains extended information in the case of ledger errors. See issue https://github.com/digital-asset/daml/issues/9834 for more details.

changelog_end

* Reformat!

* Remove debug logging statements

* also update security evidence file

* more cleanup

* Improve Json decoder & encoder

* Add test for json encoder&decoder

* Add test which ensures that the LedgerApiError field in the response is filled with valid information

* Fix failing failure tests
2022-04-29 21:44:37 +02:00
Stephen Compall
f4d603757e
split AbstractHttpServiceIntegrationTest into two files (#13685)
* move AbstractHttpServiceIntegrationTestFuns to separate file
* security evidence moved

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-25 15:25:23 -04:00
Stephen Compall
7c33a02d44
test and document error when querying with a pruned offset argument (#13633)
* pruning test successful, shows the real error
* document current pruning failure

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-20 10:57:33 -04: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
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
Stephen Compall
f6fed6eaed
use matchers for trigger service test assertions (#13567)
* remove boolean usage of assertTriggerStatus
* remove CompatAssertion

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-11 19:07:17 +00:00
Stephen Compall
289e1c3692
use matchers for auth middleware test assertions (#13565)
* use OptionValues instead of Option#get

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-11 14:47:57 -04: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
Victor Peter Rouven Müller
ad4ed5c4b2
Add security evidence for auth middleware (#13424)
changelog_begin
changelog_end
2022-04-05 11:25:56 +02:00
Stephen Compall
4bf0de8901
better errors when querying by interface ID (#13406)
- double the resolveTemplateId interface and use the "contract type" for
  exercise-by-id only
- lookup for template ID only
- 400 + error message test
- move query test to also run on PG/oracle

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-31 15:53:39 +00: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
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
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