Commit Graph

68 Commits

Author SHA1 Message Date
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
Moisés Ackerman
b47fa3ba92
interface conversion primitives test cases (#13416)
* Add LF ParsersSpec cases for conversion primitives

* Add LF TypingSpec cases for conversion primitives

* Add LF DecodeV1Spec cases for conversion primitives

* Add LF EncodeV1Spec cases for conversion primitives

* update security-evidence.md

* Add missing cases in daml-lf encoder

* Add missing cases in EncodeV1Spec

* Add InterfaceMod in DamlLfEncoderTest

changelog_begin
changelog_end
2022-03-25 16:08:31 +00:00
Robin Krom
a43d7c5e1f
ifaces: new evaluation order tests (#13419)
This adds a new evaluation order test for the execution of daml-lf for
interfaces.

This is part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-25 14:09:59 +00:00
Robin Krom
3a4939d3d5
ifaces: one more evaluation order test (#13400)
This adds another evaluation order test for the execution of daml-lf for
interfaces.

This is part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-25 13:40:25 +01:00
Stephen Compall
467b8fbbe7
shorter Value expressions in json-api tests (#13358)
* template ID variables
* remove duplicate function

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-24 15:51:55 +00:00
Robin Krom
ff333c8f07
ifaces: evaluation order tests for exercise/fetch (#13396)
This add a first test for evaluation order of exercise_interface and
fetch_interface. More tests will come in the following PR's.

This is part of #12697.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-24 15:49:01 +01:00
Victor Peter Rouven Müller
dcd726e113
Add security evidence to the simple trigger tests (#13231)
changelog_begin
changelog_end
2022-03-22 17:01:35 +00:00
Victor Peter Rouven Müller
1d2c01d2ca
Fix main build (#13352)
just runs the formatter again which fixes the diff in security-evidence.md

changelog_begin
changelog_end
2022-03-21 15:41:10 +00:00
Victor Peter Rouven Müller
8e6493b02a
Add security evidence about the failure tests from the json api (#13229)
changelog_begin
changelog_end
2022-03-21 15:58:59 +01:00
Victor Peter Rouven Müller
47ca2cb953
Add security evidence annotations to the integration tests of the json api (#13225)
changelog_begin
changelog_end
2022-03-21 15:58:23 +01:00
Victor Peter Rouven Müller
31366b939c
Add test evidence annotation to unit test of the json api (#13219)
changelog_begin
changelog_end
2022-03-21 15:57: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
Robin Krom
f7a73c5a87
ifaces: more tests for requires (#13309)
This adds tests for circular and non-closed requires in interfaces on
the daml-lf side.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-16 18:15:26 +01:00
Robin Krom
93c53da3df
requires checks (#13300)
* interfaces: tests for requires typing

We add tests for the correct typing of the interface requires field.

CHANGELOG_BEGIN
CHANGELOG_END

* security evidence
2022-03-16 12:05:30 +00:00
Sofia Faro
1feb4d25eb
Drop typerep argument from ExerciseInterface. (#13284)
* ifaces: Remove typerep arg from UExerciseInterface

changelog_begin
changelog_end

* Drop typerep argument in protobuf and haskell ast

changelog_begin
changelog_end

* scalafmt

* fix ExprParser

* fix PhaseOneTest

* fix validation test

* update evidencing security
2022-03-15 13:53:06 +00: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
Remy
3e3fccacfd
LF: Make exceptions in choice's controller/obervser uncatchable (#13106)
fixes #13099

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-03 18:37:12 +01:00
Robin Krom
adaddde058
speedy: short circuit precondition checking (#12984)
* speedy: short circuit precondition checking

Instead of evaluating all preconditions of templates and interfaces we
evaluate preconditions one by one and throw an exception as soon as we
find a failing one.

This implemented via a lazy SBCheckPrecond builtin and a foldleft
expression over the list of preconditions.

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Compiler.scala

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

* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SBuiltin.scala

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

* fix SUnit -> Unit

* tests

Co-authored-by: Remy <remy.haemmerle@daml.com>
2022-02-22 14:24:06 +00: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
Moisés Ackerman
7f6e1f08d4
Interface primitives continued (#12795)
* Extend daml lf parser to support new interface primitives

* Test parser on new interface primitives

* Add daml lf decoding test cases for new interface primitives

* Add TypingSpec test cases for new interface primitives

* add SBuiltinTest test cases for interface primitives

changelog_begin
changelog_end
2022-02-08 16:02:20 +01:00