Commit Graph

1491 Commits

Author SHA1 Message Date
Carl Pulley
c87732c438
Disclosure testing of contracts and keys
* Basic explicit disclosure testing

CHANGELOG_BEGIN

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

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

* fix

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

changelog_begin
changelog_end

* hack fix script fail

* preserve existing behaviour for ScriptService test

* inline noteAuthFails

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

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

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

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

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

* Remove templateId and viewtype from EViewInterface

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

* Stub interface viewtype and implements view in updated AST

* Set views on Java builders in DecodeV1Spec

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

* Add view field to CoImplements

* Update iterators & parsers to account for CoImplements view

* Replace uses of TBuiltin(BTUnit) with TUnit

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

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

* Remove unused imports from DecodeV1Spec

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

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

changelog_begin
changelog_end

* remove spurious mods

* mark two commented-out tests with TODO 14431

* address small comments

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

changelog_begin
changelog_end

* Implement Indexer - Ledger API bypass

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

* Rename components

* IndexServiceOwner is not private[platform]

* Address review comments

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

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

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

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

* Update docs for ImplementsDefRef to reflect reality

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

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

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

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

Also factor out check into private function

* Compile co-implemented methods using CoImplementsMethodDefRef

* SBCallInterface now uses CoImplementsDefRef for co-implemented methods

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

* Remove TemplateDoesNotImplementInterface error

* Explicitly override def in '*Implements*DefRef'

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

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

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

* Add lookupTemplateImplementsOrInterfaceCoImplements to PackageInterface

* Use lookupTemplateImplementsOrInterfaceCoImplements in checkImplements

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

* Add TypingSpec cases for interfaces with co-implements

* Apply code review suggestions: result type formatting

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

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

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

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

CHANGELOG_BEGIN

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

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

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

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

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

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

* Typecheck interface co-implementations

    * Use new environment in checkIfaceCoImplementation

* Fix Interface_1.dev_.lf

* OtherMod=>InterfaceMod0

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

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

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

Fixes #14090.

* back to versioned contract instances

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

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

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

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

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

CHANGELOG_BEGIN

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

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

* Add AstSpec case for duplicate co-implements in interface

* Add placeholders for CoImplements in daml-lf validation

* Handle CoImplements in daml-lf iterators

* Handle CoImplements in daml-lf scala decoder

* Test DefInterface components in DecodeV1Spec

* Handle CoImplements in daml-lf (testing) parser

* Handle CoImplements in daml-lf (testing) encoder

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

this is part of #14171

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

CHANGELOG_BEGIN
CHANGELOG_END

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

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

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

CHANGELOG_BEGIN

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

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

temp mod to get build

 make sure to maintain localContractSet

engine test for: ExerciseAfterRollbackCreate

fix ContractStateMachineSpec testcases and add new case

rebase and fix build failure

fix test (and comment)

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

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

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

improve test name

un-inline ActiveLedgerState.consume

Set() --> Set.empty

add comments for new components of ContractStateMachine

combine checks: consumedBy / inactive

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

Based on Matthias suggestions.

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

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

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

changelog_begin

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

changelog_end
2022-06-13 19:27:08 +00:00