Commit Graph

1229 Commits

Author SHA1 Message Date
Remy
11bc22d085
LF: builtins to create, signatory, and obersver on interface payload. (#11120)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-05 11:59:07 +00:00
Remy
9cffa1faf6
LF: check LF transaction protobuf aginst local snapshots (#11064)
instead of last stable branch.

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-04 20:10:41 +02:00
nickchapman-da
fac05f657b
bypass value enrichment for the performance test (#11112)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-04 16:22:48 +01:00
Sofia Faro
db75f7da0f
interface methods: Scala Typechecker (#11097)
* interface methods: Scala Typechecker

Part of #11006.
I tried to match the behavior of the Haskell typechecker.

changelog_begin
changelog_end

* scalafmt

* Fix type
2021-09-30 16:41:49 +00:00
Moritz Kiefer
26d10b267d
Drop NodeId type parameter (#10921)
changelog_begin
changelog_end
2021-09-30 09:13:54 +00:00
Sofia Faro
bcd468625c
interface methods: Speedy (#11076)
* interface methods: Scala AST

Part of #11006
This PR takes care of the Scala AST and decoder.
It leaves the encoder, type checker, and speedy for later.

changelog_begin
changelog_end

* scalafmt

* AstRewriter

* interface methods: Speedy

Part of #11006

changelog_begin
changelog_end

* scalafmt

* Remove InterfaceMethods test

* Update daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV1.scala

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

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-09-30 08:38:08 +00:00
Stefano Baghino
d7b280b60c
Remove debug print in daml-lf/interpreter build (#11091)
Seems to be a leftover from #11067

changelog_begin
changelog_end
2021-09-30 07:43:38 +00:00
Remy
1ed6428980
LF: move archive snapshots in a separate directory (#11081)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-30 08:43:55 +02:00
Sofia Faro
c1d1521a14
interface methods: Scala AST (#11070)
* interface methods: Scala AST

Part of #11006
This PR takes care of the Scala AST and decoder.
It leaves the encoder, type checker, and speedy for later.

changelog_begin
changelog_end

* scalafmt

* AstRewriter
2021-09-29 14:11:23 +00:00
nickchapman-da
51125991e5
Explicit discard in daml-lf/interpreter (#11067)
* Explicit discard to avoid NonUnitStatement.

CHANGELOG_BEGIN
CHANGELOG_END

* define lf_scalacopts_stricter in scala.bzl
2021-09-29 11:24:42 +00:00
nickchapman-da
5458aa890c
Switch on NonUnitStatements warning in daml-lf/transaction (#11048)
* Add NonUnitStatements warning in daml-lf/transaction & fix using discard or similar.

CHANGELOG_BEGIN
CHANGELOG_END

* address comment

* prefer parens to braces for single statement map/foreach bodies
2021-09-28 15:34:31 +00:00
Oliver Seeliger
626e1fbd7d
Small lf value.cids regression fix (found by canton unit tests) (#11032)
value.Value.cids was not invoking foreach1 fully

changelog_begin
changelog_end
2021-09-27 15:23:13 +00:00
Remy
eac7963b87
LF: Refactor ProtoTest.scala (#11020)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-24 18:03:12 +02:00
Remy
19b2bf477f
LF: Cosmetic clean-up in the Speedy Compiler (#11015)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-23 21:02:50 +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
Sofia Faro
bf8b75dab5
interface methods: Add protobuf definitions. (#11005)
* interface methods: Add protobuf

Adds protobuf definitions for interface methods and calling them.
Encoders/decoders just ignore the extra stuff or error out.

Part of #10810 (maybe)

changelog_begin
changelog_end

* Update issue numbers where appropriate

* update stable protos
2021-09-23 14:55:19 +01: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
Sofia Faro
34390f7062
interfaces: Implemented conversions, added test. (#10982)
Part of #10810

- Implemented ToInterface, FromInterface in speedy
- Added a test that exercises and fetches an interface
- Fixed a bug in SBUChoiceInterface

Hey, interfaces work now!

changelog_begin
changelog_end
2021-09-22 15:50:54 +01:00
Remy
eb4f1b2a05
LF: Move lookup tests out of EngineTest (#10973)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-22 13:36:46 +02:00
Moritz Kiefer
99836d2610
Handle fetchByKey callback correctly in scenario runner (#10980)
fixes #10977

Turns out assertions are good unless they’re wrong …

This only affects scenarios, the engine never looks at the callback.

changelog_begin
changelog_end
2021-09-22 13:19:57 +02:00
Sofia Faro
d50df11f77
interface: Add to/from interface in scala ast (#10960)
Part of #10810

changelog_begin
changelog_end
2021-09-21 16:30:01 +00:00
Remy
8b3b033fad
LF: Test preprocessor resuming (#10936)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-21 08:53:37 +02:00
Robin Krom
2edfc062a0
ifaces: name collision, typecheck fetch/exercise (#10896)
* ifaces: name collision, typecheck fetch/exercise

This adds name collision detection and adds typechecking for
fetch/exercising of interface instances.

CHANGELOG_BEGIN
CHANGELOG_END

* turn on exercises in InterfaceDesugared test case

* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/NameCollision.hs

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-09-20 21:40:26 +00: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
Sofia Faro
409c0b4f60
interfaces: Add to/from_interface in proto (#10937)
* interfaces: Add to/from_interface in proto

Part of #10810

changelog_begin
changelog_end

* fix typo
2021-09-20 13:44:00 +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
Sofia Faro
61d214e451
Add fetch, exercise implementations for interfaces in speedy. (#10911)
* Draft: Daml Interfaces Speedy PoC

Part of #10810
Extracted from #10670

changelog_begin
changelog_end

* Improve cacheing situation, add implements checks

* scalafmt

* Add comment for ImplementsDefRef

* compile the new update expressions
2021-09-17 10:44:40 +00:00
Robin Krom
50291ed61b
interfaces: scala typechecker implementation (#10867)
* interfaces: scala typechecker implementation

This is the scala side of the lf typechecker for interfaces.

CHANGELOG_BEGIN
CHANGELOG_END

* added collision check

* added exercise/fetch typechecking

* review suggestions

* added todos for collision/typing scala tests
2021-09-16 20:37:33 +00:00
tudor-da
b6a6bf7aac
[Ledger API error codes] Extracted common errors and groups [DPP-607] (#10890)
* Extracted common error implementations
* ErrorGroups
* TransactionError hierarchy
* LedgerApiErrors
* PackageServiceError
* ProtoDeserializationError
* PruningServiceError
* SubmissionErrors

CHANGELOG_BEGIN
CHANGELOG_END

* Adapt extracted error groups and definitions to adhere to local tech stack:
* Use //ledger/error:error core API
* Use DAML SDK logging stack
* Manual rebase to latest changes from Canton

* Extracted RejectionGenerator from Canton

* Adapted RejectionGenerator
* Added //ledger/error:error to artifacts

* Pass correlationId to errors
* Pass parameters as implicits to shave some lines and improve readability

* Workaround for encountered Scala/JDK8 bug

* Addressed Ratko's review comments
2021-09-16 17:19:03 +02: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
9b0fa29aec
Separate exercise & fetch for interfaces from templates (#10908)
* Separate exercise & fetch for interfaces from templates

part of #10810

changelog_begin
changelog_end

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-09-16 12:05:11 +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
Robin Krom
f7c07eaa0c
interfaces: scala protobuf encoder (#10878)
This implements the protobuf encoder of the scala side for interfaces.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-14 12:27:53 +00:00
nickchapman-da
7c29eee130
Cleanup normalize from svalue (#10873)
* better variable name

CHANGELOG_BEGIN
CHANGELOG_END

* remove disallowGenMapAtVersion check
2021-09-14 09:23:48 +00:00
nickchapman-da
053f22a1af
Convert SValue to Value, and normalize, in a single code pass. (#10828)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-14 08:07:26 +01:00
Remy
a471225fa3
LF: Add missing collision check for type synonyms (#10841)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 17:52:26 +02: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
Robin Krom
8f5b4fa84c
interfaces: protobuf encoder haskell side (#10850)
* interfaces: protobuf encoder haskell side

This is the implementation of the protobuf encoder on the haskell side.

CHANGELOG_BEGIN
CHANGELOG_END

* missing decoder cases for added interface data constructor
2021-09-13 14:36:14 +00:00
Remy
24fff88992
LF: Simplify TransactionBuilder (#10753)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 15:37:46 +02:00
Remy
6ed21247a3
LF: clean up useless version tests. (#10833)
Since SDK 1.0.0 the min LF version is 1.6.
We drop some checks that are now redundant.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-10 11:43:49 +00: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
Moritz Kiefer
1e6540f8f2
Stop using controller _ can syntax in daml-lf tests (#10805)
If we want to kill this, as a first step let’s stop using it in tests.

changelog_begin
changelog_end
2021-09-08 11:49:46 +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
Robin Krom
b8bd5e6399
interface PoC: protobuf definitions (#10796)
* interface PoC: protobuf definitions

The protobuf changes for the Daml interface PoC.

CHANGELOG_BEGIN
CHANGELOG_END

* dummy interface decoder/encoder
2021-09-07 16:58:49 +02:00
nickchapman-da
a5999abf8e
remove dead code (#10765)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-06 13:35:37 +00: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
Moritz Kiefer
c6c304b778
Improve script error on invalid script identifier format (#10702)
fixes #9271

changelog_begin
changelog_end
2021-09-01 08:45:49 +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
9ef3377864
LF: Update specification with Contract ID Comparability check (#10703)
This is part of #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-31 13:01:25 +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
Andreas Herrmann
0b7980d6eb
Update rules_haskell (#10674)
* update rules_haskell

changelog_begin
changelog_end

* Build proto3-suite lib and exe in same repo

changelog_begin
changelog_end

* drop unneeded stack_snapshot packages

* Use packages.bzl consistently

* Sort stack_snapshot attribute values

* Remove unused constant

* drop unneeded stack_snapshot packages in compat

changelog_begin
changelog_end

* Sort stack_snapshot attribute values in compat

* Remove redundant dicts.add in compat

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-26 10:41:58 +02:00
Moritz Kiefer
5204d3ce7a
Include committers in PartialTransaction root context (#10665)
This gets us into a state where PartialTransaction always has the
authorization context which is much more sensible than having the
committers in speedy while the rest is in ptx.

The reason for having the split in the first place was the scenario
service but now that we create a new speedy machine per submission
that’s no longer a valid reason.

changelog_begin
changelog_end
2021-08-25 10:45:45 +00: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
5001329c9d
LF: Comparisons fail at runtime if comparing local vs global CIDs (#10630)
This PR enforces that LF Comparisons (both Ordering and Equality)
fails at runtime if comparing local vs global CID.

This corresponds to the second task of #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-23 17:06:44 +02:00
Oliver Seeliger
e807f4a918
Upgrade to a newer canton version (post 0.27.0 snapshot version) (#10632)
* Upgrade to a newer canton version (post 0.27.0 snapshot version)

with canton-community configuration that supports higher throughput.

changelog_begin
changelog_end

* Disable flaky reject DeeplyNestedValueIT:Reject tests that time out half the time
2021-08-20 06:10:54 +00: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
Moritz Kiefer
6d0109fca8
Support $ in daml-lf identifiers in the parser (#10609)
These are valid daml-lf identifiers and we use them e.g. in
f8a1820cc8/daml-lf/validation/src/main/scala/com/digitalasset/daml/lf/validation/Typing.scala (L49).

Arguably `experimental` is also just easier to understand than `$`.

changelog_begin
changelog_end
2021-08-19 09:59:18 +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
Sofia Faro
fb09b72f96
Improve divulgence warning message. (#10595)
Based on feedback from @bame-da on issue #9947

changelog_begin
changelog_end
2021-08-17 13:06:03 +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
Andreas Lochbihler
5728bbc14f
add cryptographic hash method to ChangeId and base equality on hash (#10554)
CHANGELOG_BEGIN
CHANGELOG_END
2021-08-11 17:34:44 +02:00
Andreas Herrmann
5cc78f5254
Handle missing template instances in Daml ledger export (#10526)
* LF 1.6 ledger export integration test

Test that Daml ledger export script handles DALF packages in LF version
1.6. These packages don't contain metadata, meanint `--package` flags
have to use the hash rather than the package name, and they contain no
type class instances, meaning the export script needs to contain newly
defined instances for type classes required to issue ledger commands in
Daml script.

changelog_begin
changelog_end

* Expose unconstrained Daml script commands

This will be used in Daml ledger exports of contracts defined in Daml LF
versions before 1.8. These versions did not include typeclass instances,
meaning that instances such as HasTemplateTypeRep need to be recreated
in the export Script. Not all instances required in the `Template t`
constraint can be recreated at the use-site. E.g. `HasSignatory`. By
avoiding these kinds of constraints it is possible to handle these cases
in Daml ledger exports anyway.

changelog_begin
changelog_end

* Identify all templates with missing instances

changelog_begin
changelog_end

* Use internal*Cmd on templates missing instances

changelog_begin
- [Daml export] Daml ledger export now handles templates in packages
  using LF versions 1.7 or older. These package versions don't include
  type class instances and Daml ledger export needs to generate
  replacement instances in the generated script. The generated script
  uses less type-safe versions of Daml script ledger commands.
changelog_end

* Add encodeType to encode Ast.Type in ledger export

This will be required to encode HasContractKey instances.

changelog_begin
changelog_end

* Simplify newline handling in encodeExport

* Encode missing template type class instances

* ZIP entries must use forward slash as path separator

* Throw error on encode of Any

Addressing
https://github.com/digital-asset/daml/pull/10526#discussion_r685807454

* Qualify choice using argument type

Addresses review comment
https://github.com/digital-asset/daml/pull/10526#discussion_r685817745

* Use lf.language.Util

Addresses
https://github.com/digital-asset/daml/pull/10526#discussion_r685827150

* Factor out header comment in tests

Addressing review comment
https://github.com/digital-asset/daml/pull/10526#discussion_r685830832

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-10 16:44:11 +00:00
Andreas Herrmann
7c6d3c5bc7
Handle package dependencies without metadata in Daml export (#10481)
* Expose set of stable-packages package-ids

Needed in Daml ledger export to decide whether to depend on a package
without metadata or not.

changelog_begin
changelog_end

* Handle package dependencies without metadata in Daml export

This addresses the immediate issue reported in
https://github.com/digital-asset/daml/issues/10435.

DALF before LF version 1.8 don't contain metadata such as the package
name and version. However, Daml ledger export assumed that metadata was
available to generate `--package` flags for data-dependencies.

This change generates `--package=<hash>` flags for such dependencies on
packages that don't have metadata available.

This change requires additional care when checking if a package is a
stable-package. As the package name is not available without metadata we
cannot just check against names such as `daml-stdlib`. Instead this
change uses the list of stable-package package-ids exposed by
`com.daml.lf.language.StablePackages.Ids`, which was introduced in
0da814d250 (diff-208c6948c7c7f2b582faa8e4792bfe78b231188881947ad0cdd5046e0b9a40e7)

Note that this does not fully resolve #10435. Building a generated Daml
ledger export script will fail on missing instances of standard classes
such as `HasTemplate` because packages prior to LF version 1.8 don't
contain type-class instances. This will be addressed in a separate PR.

changelog_begin
changelog_end

* Fix Scala 2.12

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-04 18:11:17 +02: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
5d5343aad5
LF: remove PartialTransaction argument from Speedy err pretty printer (#10470)
CHANGELOG_BEGIN
CHANGELOG_END
2021-08-03 18:09:59 +02:00
Remy
1971274893
Reactive canton conformance test aginst LF 1.13 (#10458)
Now we compile the conformance test for 1.13, we can run conton
against 1.13.

follow up of #10456

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-02 19:43:37 +02:00
Remy
4ae4a9daf7
LF: restrict length of Name and DottedName (#10453)
fixes #10358

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-02 15:49:03 +02:00
Moritz Kiefer
4cf5641678
Build & releases 1.13 Ledger API test tool (#10456)
Temporary hack to unblock Canton until they finish their exception support.

changelog_begin
changelog_end
2021-08-02 13:27:45 +00:00
Remy
3d9c1a09f4
LF: Missing value decoding changes from #10393 (#10443)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-29 13:28:10 +02:00
Samir Talwar
9c08e4cf7e
Move logging value definitions alongside their objects. (#10439)
* logging-entries: Make `LoggingEntries` a non-case class.

There's no reason for it to need `equals`, etc.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-api-domain: Convert commands into a logging value.

Instead of having a function, let's use `ToLoggingContext`.

This also adds a couple of missing items, and always logs `workflowId`.

* participant-state: Convert updates into a logging value.

Instead of having a function, let's use `ToLoggingContext`.

This changes some of the logging context structure, but otherwise
everything remains the same.

* Make sure Scaladoc is lined up for modified code.
2021-07-29 09:21:27 +00: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
Remy
cf7b1bb8b5
LF: ValueDecoder set recursion limit for values. (#10393)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-28 12:14:15 +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
85af078085
LF: parser for LF versions (#10424)
* LF: Simpler parser for LF version

CHANGELOG_BEGIN
CHANGELOG_END

* add a test
2021-07-27 15:46:47 +00:00
Remy
72cf2f36d3
LF: replace bazel keyword stable by default (#10410)
to refer to the compiler default LF output.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-27 09:27:03 +02:00
nickchapman-da
1bed05fec2
Treat KeyWithMaintainers field structurally in all node types. (#10392)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-23 13:51:03 +00:00
nickchapman-da
387945298d
fix cut&paste typo bug; there are no insig lookup tweaks! (#10389)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-23 11:08:22 +01:00
nickchapman-da
90c3582ee8
treat exerciseResult structurally for isReplayedBy (#10381)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-23 09:46:08 +00:00
Remy
5242e2c618
LF: drop old serializability check for Values (#10382)
We drop this check for the following reasons:

* Its only usage was inside the transaction builder, this is subsumed
  by the check we added in the SValue to Value translation (#10370)

* It seems to origianl check more that nesting (and so to be
  overcomplicate)

* It was used in non-consitent way. It was used to check create
  arguments and choice arguments, but niether choice result nor
  contract key.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-22 20:49:35 +02:00
Remy
ee755306fe
LF: Specify nesting constraint for serialized values. (#10375)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-22 17:50:29 +02:00
Remy
4a33c03f72
LF: Add check of nesting in SValue.toValue (#10370)
The conversion of SValue to Value already ensures the resulting value
has a serializable type. Here we add a check to ensure it does not
overpass the maximum allow nesting.
2021-07-22 17:49:54 +02:00
nickchapman-da
42b70ad31d
Fetch actingParties always non-empty for supported versions (>=1.6) (#10357)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-22 12:04:10 +00:00
Moritz Kiefer
66284c17f2
Limit length of package ids to 64 characters (#10368)
* Limit length of package ids to 64 characters

In practice, you cannot use a package id that is not a valid sha256
outside of a test anyway since we validate them. However, we didn’t
enforce it at the daml-lf level which is a bit annoying.

This PR fixes this and adds a length restriction of 64
characters (i.e. 256 bytes for sha256).

We could go a bit further and also restrict the characters to valid
sha256 hashes (i.e. 64 character hex strings). I don’t feel all that
strongly about that either way. We use other characters in tests but
fixing that shouldn’t be particularly hard either. The extra
characters don’t seem to cause problem so far, so I think it’s fine to
keep that.

No changelog entry since I don’t see how a user can be affected by this.

changelog_begin
changelog_end

* Update daml-lf/encoder/src/main/scala/com/digitalasset/daml/lf/archive/testing/DamlLfEncoder.scala
2021-07-22 10:50:11 +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
Remy
27d439d546
LF: Compile netsed ELets using constant stack (#10337)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-21 14:31:29 +02:00
Samir Talwar
cf2b61e6ac
participant-state: Remove the aliases to Ref.LedgerString. (#10325)
* participant-state: Remove the aliases to `Ref.LedgerString`.

Use the aliases directly in `Ref` instead.

CHANGELOG_BEGIN
CHANGELOG_END

* daml-lf/data: Improve comments on ID aliases.

* daml-lf/data: Fix a typo in a comment.

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
2021-07-21 08:34:46 +00:00
Moritz Kiefer
c9666c7fe0
Drop unnecessary mutability from speedy OnLedger state (#10340)
Those were only mutable for scenarios but now that we have split
scenario interpretation this is no longer required

changelog_begin
changelog_end
2021-07-21 09:53:47 +02:00
Sofia Faro
b701caab7d
Report divulgence warning at commit location. (#10329)
* Pass commitLocation along in engine warning log.

changelog_begin
changelog_end

* Use commitLocation in diagnostics.

* scalafmt

* update divulgence test

* Fix commitLocation and expected diagnostic locations
2021-07-20 15:47:49 +00:00
Samir Talwar
c3bc26fd1c
daml-lf/data: Move ID aliases to Ref from _ledger-api-common_. [KVL-1002] (#10323)
* daml-lf/data: Move ID aliases to `Ref` from _ledger-api-common_.

This allows us to remove a lot of dependencies on _ledger-api-common_,
and use these aliases in other places where that module is not used.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Remove an unused import.

* http-json-oracle: Remove `ledger-api-common` as a dependency.

* bindings-rxjava: Remove a now-unused dependency.
2021-07-20 11:01:19 +00:00
Remy
159728d716
LF: use Either by default in all archive reader API (#10295)
This is a follow up of #10277.
This is part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-19 19:48:37 +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
Remy
f033bc2bbb
LF: Clean legacy from archive proto + TEXT_TO_CODE_POINTS typo (#10286)
Thanks to @tristan-da for pointing this out.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-15 16:01:08 +02:00
Remy
a8f190214c
LF: change type from Try to Either in archive module (#10277)
* LF: change type from Try to Either in archive module

This is the first part of restructuring errors in archive module.
This is part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END

* Apply suggestions from code review

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* remove type alias

* apply stephen suggestion

* fix after rebase

* fix test

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2021-07-14 19:24:31 +00:00
Remy
906184ce1a
LF: Simplify UniversalDarReader (#10271)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-14 15:38:22 +02:00
Remy
caf85a2270
LF: rationalize archive Parser/Reader/Decoder (#10239)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-14 11:05:17 +02:00
Sofia Faro
b8e2198873
Separate traces from warnings in engine. (#10253)
* Separate traces from warnings in engine.

I decided to separate the engine warnings from the tracelog after all,
because I think it will make testing and maintenance easier in the
long run.

Part of #9947, follow up from #10179

changelog_begin
changelog_end

* scalafmt

* Apply suggestions from code review

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

* dont use case class for WarningLog

* revert TraceLog changes from last PR

* Scala 2.12 doesnt have ArrayBuffer.addOne :(

* remove isWarnEnabled check

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-07-13 14:24:27 +00:00
Remy
6e8ec1d618
LF: Drop old depreated code (#10251)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-13 13:10:00 +00:00
Remy
e4d7cd764a
LF: Deprecate com.daml.lf.data.TryOps.Bracket (#10249)
* LF: Deprecate com.daml.lf.data.TryOps.Bracket

CHANGELOG_BEGIN
CHANGELOG_END

* address reviews

* fix
2021-07-13 10:16:53 +00:00
Remy
6fe6ae075d
LF: Make DarReader ZipEntries immulatble (#10243)
* LF: Make DarReader ZipEntries immulatble

CHANGELOG_BEGIN
CHANGELOG_END

* optim

* Revert "optim"

This reverts commit 3b25a8c68b.

* a function should not close a stream it didn’t open

* typo

* we do not support dar without manifest !
2021-07-12 21:13:25 +00:00
Remy
f19f5b0821
LF: Simplify DarReader (#10217)
This PR simplifies a bit DarReader and UniversalDarReader

This is a follow up of #10208.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-08 17:03:45 +02:00
Remy
ebb76dca4c
LF: reorganize errors in com.daml.lf.archive (#10213)
* LF: reorganize errors in com.daml.lf.archive

part of #9974

CHANGELOG_BEGIN
CHANGELOG_END

* fix
2021-07-08 13:03:42 +00:00
nickchapman-da
69646451f2
Improvements for validation tests (#10214)
* prefer Seq to List when generating samples

CHANGELOG_BEGIN
CHANGELOG_END

* use TableDrivenPropertyChecks

* remove count/println
2021-07-08 13:48:07 +01:00
Remy
41b8448b17
LF: Simplify archive reader. (#10208)
* LF: Simplify archive reader.

- decouple Reader and Decoder
- introduce case class to handle hash, proto payload, and version

CHANGELOG_BEGIN
CHANGELOG_END

* Address Moritz' review

* cosmetic
2021-07-07 19:56:40 +00:00
Moritz Kiefer
6586dde11e
Move exercise context computation to the client side (#10199)
We probably want to start displaying the full ptx on the client side
but for now this at least moves things out of speedy and into the
rendering layer where they belong.

It also fixes IncompleteTransaction to unwind properly so the roots
are really the roots.

changelog_begin
changelog_end
2021-07-07 15:44:47 +02:00
nickchapman-da
e2bdca6be9
Use PartialFunction for more concise code. (#10191)
* Use PartialFunction for more concise code.

CHANGELOG_BEGIN
CHANGELOG_END

* tweak to use guards

* blind fix for 2.12

* try fix 2.12 build

* loose if-guard parens

* fixes for 2.12 build (should actually work this time!)
2021-07-06 16:43:49 +00:00
Sofia Faro
98b5ffee01
Add divulgence warning and test in script service. (#10179)
* Add divulgence warning and test in script service.

Part of #9947, building on the key visibility checks from #10136

This PR adds a divulgence warning inside the traceLog.
I wasn't sure whether:

1. these warnings should be kept in a separate structure from the
   traceLog, and therefore transmitted separately, or
2. these warnings should be kept together with traces, but the severity
   should be tracked and also transmitted over grpc, and warnings should
   be logged as warnings instead of as debug messages, or
3. these warnings should be kept together with traces, but
   logged as warnings instead of debug messages,
4. these warnings should be treated exactly like traces

I'm leaning toward #2, but this PR implements #3.

This PR tests the warning via the script service tests.

changelog_begin
changelog_end

* scalafmt

* Address Moritz's review

* Rename traceLog.add to traceLog.addDebug

* fix test

* Add test using exercise

* add single transaction test
2021-07-06 13:05:52 +01:00
nickchapman-da
8578e56aa7
Tests for transaction validation (#10167)
* Testing for Validation.isReplayedBy

changelog_begin
changelog_end

try fix scala 2_12 build

fetch node: samples and tweaks

list sig/insig field tweaks side-by-side so coverage is easier to eyeball

exerciseResult tweak sig & insig

add sig/insig tweak for byKey of Fetch node

add sig/insig tweak for key of Fetch node

must use ImmArray.empty instead of ImmArray() for scala 2.12

another blind attempt to fix scala 2.12

use for/yield instead of flatMap for list-comprehensions

test sig/insig tweaks to LookupByKey nodes

wont attempt to tweak rollbacks

(and shorten trailing dash in comment banners)

comment about how Tweak testing is organized

dont dep/import scalacheck (not used!)

no wild imports

* val --> private def

* def --> val

* prefer fail to println/assert(false)
2021-07-06 11:24:46 +00:00
Samir Talwar
e7e8a5705b
daml-lf/data: Optionally truncate party names in structured logs. [KVL-996] (#10163)
* daml-lf/data: Truncate party names in log output, on request.

The party name can grow quite long, so we offer ledger implementors the
opportunity to truncate it in structured log output.

Unfortunately, because we use Logback through the global
`LoggerFactory`, there is no place to inject logging configuration. This
means we also need to use global, mutable state to configure logging
output. I have added a `LoggingConfiguration` class+object in Daml-LF
Data, which may not be the best place, but I can't think of a better
one right now. I suggest we leave it there until it has reason to grow,
at which point we may want to move it.

CHANGELOG_BEGIN
CHANGELOG_END

* logging-entries: Make `ToLoggingValue` mixin-able.

* participant-integration-api: Truncate parties in filters when logging.

* participant-integration-api: Cast to `Party` for logging.

Invalid input should not break the request at this point. No assertions.

* daml-lf/data: Move `Party to LoggingValue` to a new package.

This avoids the transitive dependency issue most of the time.

* daml-lf-data: Move the `Identifier` logging to another package.

Again, reduces the need for transitively depending on _logging-entries_.
2021-07-01 16:50:49 +00:00
Samir Talwar
eda1245311
daml-lf/data: Add a conversion from Ref.Identifier to LoggingValue. (#10157)
I am getting quite tired of (Bazel + Scala)'s attitude to transitive
dependencies.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-30 20:05:06 +00:00
Remy
0a6df5c4db
LF: Clean Interpretation Error (#10145)
* LF: Clean Interpretation Error

part of #9974

CHANGELOG_BEGIN
CHANGELOG_END

* fix

* Address Mortiz' review

* fix
2021-06-30 16:49:48 +00:00
Sofia Faro
a6ee10be9a
Move visibility checks into speedy. (#10136)
* pass readAs to Engine.interpret/submit

* rename VisibleByKey -> Visibility

* Stop generating SResultNeedLocalKeyVisible

* engine: Remove localKeyVisible in Result.consume

* Don't run visibility checks during validation.

changelog_begin
changelog_end

* return of the scalafmt

* rename SVisibility -> SVisibleToStakeholders

* Extend documentation in engine for new argument

* sneaky error caused by merge
2021-06-29 11:36:55 +01:00
Remy
3df2566305
Scenario: move Scenario Error Throwable to scenario package (#10075)
com.daml.lf.speedy.SErrorScenario => com.daml.lf.scenario.Error

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-28 12:04:57 +00:00
Remy
398300b76f
LF: Move Speedy Interpretation Error to transaction package (#10091)
to be accessible from any package

part of #9974

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-25 20:50:15 +02:00
nickchapman-da
6af36fe1e3
Fix Tx.Metadata for normalized transactions (#10108)
* fix Tx.Metadata for normalized transactions

changelog_begin
changelog_end

* Fixup action seed normalization

changelog_begin
changelog_end

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-06-25 10:53:11 +02:00
Remy
f745f10394
LF: Realease LF 1.14 (#10077)
CHANGELOG_BEGIN
- [LF] Add support for Excepction
CHANGELOG_END
2021-06-24 13:44:09 +02:00
Remy
a6b536f3c4
Compiler: Make LF 1.13 the default output (#9907)
* Compiler: Roll LF Version

Fix #8591

CHANGELOG_BEGIN
- [Compiler] Default ouput LF version is now 1.13
CHANGELOG_END
2021-06-24 11:58:50 +02:00
nickchapman-da
5b73813dfd
Support reinterpretation for failing commands (#9993)
* WIP: reinterpret must fail

changelog_begin
changelog_end

EXPLORE: add x/y prefix to reinterpret

MiniEngineTest.scala

MiniTests.daml

setup reinterpret testing one step down, to be able to see rollback nodes

MiniEngineTest.scala - refactor yreinterpret

first minimal reinterpret test

setup testcase for reinterpret on a command which throws

catch exception during reinterpret; and test

introduce type for Validating; avoid boolean blindness

remove exploratory MiniTests

remove exploratory x/y prefix on reinterpret

question

fix build

* small cleanup

* add `unsafeCompileForReinterpretation`; preserve interface of existing `unsafeCompile` (command list)

* remove the Validating type (not needed for this work)

* undo format change

* more private

* update comment for Engine.reinterpret

* test ensure failure works correctly; no rollback expected

* refactor to share duplicated code in reinterpret tests

* remove unhelpful create/ensure tests

* test that reinterpretation of an uncatchable error remains a failure

* test that rollback-version-check-error remains a failure for reinterpretation

* remove dev comment left in by accident
2021-06-23 10:39:10 +00:00
Remy
58b1c4e771
Speedy: Refactor contract Id/Key callback (#10033)
CHANGELOG_BEGIN
CHANGELOG_END
2021-06-22 16:34:28 +02:00
Moritz Kiefer
e4c1c58317
Run scenarios in off-ledger machine (#10070)
* Run scenarios in off-ledger machine

This PR builds on the previous PR that split scenario execution in two
different speedy machines and now actually makes the machine that runs
scenarios run in off-ledger mode just like we handle Daml Script.

This required a bunch of refactoring to make it nice so apologies for
the slightly large PR. Hopefully it’s still relatively easy to follow
and luckily it deletes more code than it adds.

changelog_begin
changelog_end

* Apply suggestions from code review

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* review comments

changelog_begin
changelog_end

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2021-06-22 12:11:00 +02:00
Moritz Kiefer
fb757d8ed9
Handle visibility outside of speedy (#10056)
It makes no sense to pass NotVisible to Speedy especially since that
is not how visibility is handled for the Engine. Also it lets us
delete code and I like deleted code.

changelog_begin
changelog_end
2021-06-21 17:31:37 +02:00
Moritz Kiefer
febca5d62d
Use ScenarioRunner.submit in Daml Script (#10053)
* Use ScenarioRunner.submit in Daml Script

changelog_begin
changelog_end

* privatize ledger variable

changelog_begin
changelog_end

* drop space

changelog_begin
changelog_end
2021-06-17 17:12:45 +00:00
Moritz Kiefer
2b915e93da
Split scenario & ledger execution (#10039)
* Split scenario & ledger execution

This PR by no means aims to solve everything we can do here. It is
rather the minimal change that I could get to work that provides us
with one Speedy machine for scenario execution (which is still an
on-ledger machine to avoid having to change the callsites to much in
this PR) and one speedy machine per submission.

There is tons of cleanup we can do afterwards but this should
hopefully set the right foundations.

changelog_begin
changelog_end
2021-06-17 12:45:35 +02:00
Remy
3532460675
LF: Structure Preprocessing Errors (#10013)
part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-17 09:20:27 +02:00
Stephen Compall
401069ef00
prepare for upgrade to Scalaz 7.3.3 (#9997)
* upgrade scalacheck to 1.14.3

* regenerate maven_install files

* some different names and implicits

* remove some fromTryCatchNonFatal

* more porting

* port fromTryCatchNonFatal to attempt

* factor the assertions in SignatureSpec to avoid \/

* deal with invariant \/

* make partial unification do what we want

* \/, parse*, and toNel

* many uses of the .right method

* a legitimate use of fromTryCatchThrowable

* rebuild maven pins

* further invariant \/

* OneAnd and Nel interface changes

* further Either games

* \/ and reformatting

* \/ in http-json

* \/ in http-json

* deprecations

* more invariance

* cleanup unused

* more invariance; http-json compiles

* final either follies

* small 2.12 extra incompatibility

* rebuild deps

* revisit a couple earlier fixes using nicer expressions I learned later

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* repin 2.12
2021-06-15 14:41:48 -04:00
Remy
af144e8592
LF: Structure package loading errors (#9980)
part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-15 18:39:26 +02:00
Sofia Faro
0c32cf2968
Clarify the semantics of DIV_INT64 in LF spec. (#10003)
* Clarify semantics of DIV_INT64 in LF spec.

Especially around negative operands. Adds a couple of unit tests to make sure the behavior stays this way, and that MOD_INT64 is consistent with DIV_INT64.

changelog_begin
changelog_end

* spelling

* scalafmt

* hardcode numbers in MOD_INT64 test
2021-06-15 10:22:13 +00:00
Moritz Kiefer
998f106ee6
Drop pkgIds argument from Engine.validatePackages (#9986)
* Drop pkgIds argument from Engine.validatePackages

Doesn’t do anything useful, we just use it to validate that it matches
the keys of pkgs.

changelog_begin
changelog_end

* add test showing broken behavior

* Fix buggy tests

changelog_begin
changelog_end

Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2021-06-15 10:58:43 +02:00
Moritz Kiefer
836a82a6b6
Add proper error handling for missing contract keys (#9972)
* Add proper error handling for missing contract keys

These are clearly not internal errors so we should not be calling
`crash` here. Canton in fact already started string matching on the
crash message which is definitely not what we want.

changelog_begin
changelog_end

* backwards compat

changelog_begin
changelog_end

* fix tests

changelog_begin
changelog_end
2021-06-14 09:12:30 +00:00
Remy
d7d6e37785
LF: Structure Engine Errors. (#9971)
This PR is part of the effort to improve engine Errors.  Here we
classify all the errors the engine can report in 4 categories:

- Errors happening during package loading

- Error happening during command/transaction preprocessing

- Error happening during interpretation

- Error happening during transaction validation


part of #9974

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-14 08:43:00 +02:00
nickchapman-da
5f0f5756bf
Define IncompleteTransaction for use by scenario-service (#9952)
* Define IncompleteTransaction for use by scenario-service

changelog_begin
changelog_end

* improve names as per review comments
2021-06-10 15:06:58 +00:00
Remy
5e1ddfbd5e
LF: Fix specification of ArithmeticError (#9949)
CHANGELOG_BEGIN
CHANGELOG_END
2021-06-10 13:37:16 +02:00
Remy
bd26c43767
LF: fix TransactionCoderSpec (#9922)
This modifies a test about version encoding that should not be run
with Rollback nodes as those do no have explicit version.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-08 12:58:47 +00:00
Remy
cbcec32e70
LF: clean up the remaining Exception TODOs (#9913)
CHANGELOG_BEGIN
CHANGELOG_END
2021-06-08 11:49:02 +02:00
Remy
db1453640f
LF: Freeze archive proto for LF 1.14 (#9912)
CHANGELOG_BEGIN
CHANGELOG_END
2021-06-07 12:44:20 +00:00
Remy
512f1fd87d
LF: Preview version of LF 1.14 (#9906)
+ Preview support for Exceptions.
+ byKey flag for transaction nodes.

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-03 20:40:53 +02:00
Remy
3dee3d042d
LF: Fix encoder for Exception (#9904)
* LF: Fix encoder for Exception

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-lf/encoder/src/main/scala/com/digitalasset/daml/lf/archive/testing/EncodeV1.scala

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-06-03 13:03:08 +00:00
Remy
7bc925e4d2
LF: Factorize the logic for AST lookup (#9871)
Factorize the logic for AST lookup in
 - compiler 
 - type checker 
 - preprocessor
 - script triggers 
 - some tests

CHANGELOG_BEGIN
CHANGELOG_END
2021-06-03 13:32:56 +02:00