Commit Graph

176 Commits

Author SHA1 Message Date
Remy
63be90c0fd
Engine: documents for Engine configuration (#7420)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-22 09:08:02 +02:00
Remy
e1f8d9c781
DAML-LF: utility to compute duplicated keys in a transaction. (#7409)
The Engine does not verify key duplication when construction a
transaction, this task is currently let to the ledger implementation.
This PR provides an utility function to compute the duplicated keys
in a transaction.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-21 09:18:47 +02:00
nickchapman-da
4e32fde001
Cleanup following interleave execution and authorization (#7437)
* remove failedTransactions field from ScenarioLedger.RichTransaction

changelog_begin
changelog_end

* remove Blinding.checkAuthorizationAndBlind; fixup callers to use Blinding.blind when blindningInfo is required

* rename/relocate: ScenarioLedger.CommitError.FailedAuthorizations --> SError.DamlEFailedAuthorization

* fix types to demonstate that at most one FailedAuthorization is detected/reported

* address small review comments
2020-09-18 19:05:19 +01:00
nickchapman-da
96d704b25b
Perform authorization checks during execution and not as a separate post-execution phase. (#7400)
changelog_begin
changelog_end

Adapt test for small error message change. An improvement! Previously an internal message was shown. Make test flexible enough to pass for old & new message.

Adapt expected output file. Only change is the contract-ids for active-contracts when the test ends.

fix small test bugs in testcase where authorization is wrong

temp disabled 3 tests; needs investigation; see TODO markers

temp adapt 1 test for change in error message

temp disable 1 test. needs invesigation

undo accidentally commited change to .bazelrc

add copyright header to new file

remove testcase (badActorCheck2) which is no longer expected behaviour, when authorization occurs during execution

address comments: be mre private & other tiny changes

appease scala formatter

improve expected error message in KeyNotVisibleStakeholders testcase

fix authorization issues and re-enable the 3 failing tests in EngineTest which now pass

fix auth issue and re-enable ledger-test-tool test: WronglyTypedContractIdIT

fix compatibility

re-enable test in KVUtilsTransactionSpec.scala
2020-09-17 17:50:04 +01:00
Remy
ddbb334ecb
Engine: add submitter arg to Engine#validate (#7405)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-16 13:47:21 +02:00
Remy
78e770bf72
LF: Use the new Struct data structure for ValueStruct (#7241)
This PR uses the new data structure introduced in #7220.
Additionnally this fix `Value Equal instance` which was considering
<a: x, b: y> different from <b:y, a:x>.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-04 18:32:39 +02:00
nickchapman-da
4e80ee62e6
Refactor EnrichedTransaction (#7262)
* Refactor EnrichedTransaction

This PR prepares for work to interleave _authorization_ with _execution_, which has been an open issue for a long time: #132.

- Split computation of `BlindingInfo` and `FailedAuthorizations` into separate modules.

- Fixup callers: `Blinding.scala` and `ScenarioLedger.scala`, to do:

```
    val failedAuthorizations =
      AuthorizingTransaction.checkAuthFailures(authorization, tx)

    val blindingInfo =
      BlindingTransaction.calculateBlindingInfo(tx)
```

- Simplify code to remove `DontAuthorize` and `Authorization` types, which were only needed to restrict the combined _enrichment_ code from doing the authorization check when `blind`ing only is required. Now  `Blinding.blind` calls just `calculateBlindingInfo`.

* address comments from Stefano
2020-08-28 15:16:37 +00:00
Remy
cc6e8fa901
Engine: submit fail nicely when transaction output cannot be serialized (#7189)
CHANGELOG_BEGIN
CHANGELOG_END
2020-08-20 09:20:50 +02:00
Remy
66ae38da6c
LF: control of input value version in the engine (#6828)
CHANGELOG_BEGIN
CHANGELOG_END
2020-08-13 21:15:52 +02:00
Remy
a890618782
LF: Drop completely the support for LF 0 (#7128)
CHANGELOG_BEGIN
CHANGELOG_END
2020-08-13 19:59:07 +02:00
Remy
ae7e92a6c4
LF: adapt TransactionBuilder to the new version inference (#6854)
This PR changes TransactionBuilder according the new version inference
algorithm implemented in #6756

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-03 19:05:30 +02:00
Stephen Compall
fd07a26510
check for scaladoc comments that are not actually used (#6802)
* add -Xlint:doc-detached

- reverts 1feae964e3 from #6798

* attach several scaladocs where they'll actually be included

* no changelog

* attach several more scaladocs where they'll actually be included

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-28 20:32:30 +00:00
Remy
ce3c3c89a4
LF: redesign engine configuration (#6763)
This PR redesigns the engine Configuration as described in #5164. 

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-22 12:17:07 +02:00
Remy
5468e4d160
DAML-LF: Simplify inference of output transaction/value version. (#6756)
* LF: Simplify inference of output transaction/value version.

As part of #5164, we simplify the way transaction and value versions
are inferred for the engine output.

The versioning of a transaction tr is done as follow:

* Let tvMin be the minimal transaction version allowed by the DAML
  engine configuration
* Let tvMax be the maximal transaction version allowed by the DAML
  engine configuration
* Let n₁, ..., nₘ be the nodes of tr.
* Let pkgᵢ be the package of the template associated to the node nᵢ
* Let lvᵢ be the maximal language version that pkgᵢ uses (directly or
  through its dependencies)
* let tvᵢ be the maximal transaction version supported by all engines
  that support both lvᵢ and tvMin
* Let vvᵢ be the maximal value version supported by all engines that
  support tvᵢ.
* Let tv be the maximal transaction version between tv₁, ..., tvₘ.
* If tv is not greater than tvMax
  + then
    - Version the values of each node nᵢ according vvᵢ
    - Version tr according tv
  + fail otherwise

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-21 17:07:11 +02:00
Remy
a629959c09
LF: Move GlobalKey and GlobalKeyWithMaintainers outside Node (#6795)
CHANGELOG_BEGIN
CHANGELOG_END
2020-07-21 09:08:36 +02:00
Remy
a70da3478c
LF: clean TransactionCoder (#6785)
CHANGELOG_BEGIN
CHANGELOG_END
2020-07-20 20:22:35 +02:00
Remy
fca9f3d90b
DAML-LF: unset the field NodeFecth#value_version in transaction.proto (#6784)
According transaction specification the field `value_version` "is
optional; if defined, it must be a version ofthe value
specification, and `template_id` shall be consumed according to
that version.  Otherwise, it is assumed to be version 1."

We take advantage that the encoding of identifier in value does not
change since version "1" to unset the field `value_version`, hence
using the default interpretation.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-20 17:50:59 +02:00
Remy
5f4dd39b5d
Engine: add maintainers to contract key call back (#6781)
CHANGELOG_BEGIN
[Engine] - Change the callback for contract key from `GlobalKey => Option[ContractId]` to  `GlobalKeyWithMaintainers => Option[ContractId]`
CHANGELOG_END
2020-07-20 17:42:06 +02:00
Stephen Compall
134dbf0f01
check NodeFetch value_version on decode (#6786)
- decoding the template ID is not valid if the value_version is unknown

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-20 11:23:05 +02:00
Remy
bdcfb6c114
DAML-LF: add templateId method to GenNode (#6752)
* DAML-LF: add templateId abstract method to GenNode

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-16 10:17:04 +02:00
Remy
15da222939
DAML-LF: move some type definitions out of Transaction object (#6739)
SubmittedTransaction and CommittedTransaction are moved from com.daml.lf.transaction.Transaction to
com.daml.lf.transaction

This helps intelliJ type inference.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-16 09:13:30 +02:00
Remy
121a6a7d77
DAMLLF: clean up Transaction definitions (#6714)
* LF: move NodeId from value to transaction

* LF: remove some `private` keywords in Transaction

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-14 14:42:58 +02:00
Remy
a3c35e9678
Engine: bug fix for transaction validation (#6664)
CHANGELOG_BEGIN
* [Engine] fix transaction validation bug
CHANGELOG_END
2020-07-09 13:43:22 +02:00
Stephen Compall
4cd419623a
replace traverseU and sequenceU with traverse and sequence (#6594)
* replace traverseU and sequenceU with traverse and sequence

- with -Ypartial-unification on, the extra Unapply typeclass lookup is
  unnecessary

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* limit imports; we only need *> and void
2020-07-07 15:01:58 +00:00
Martin Huschenbett
873e0163cd
Drop the global from globalImplicitDisclosure and globalDivulgence (#6588)
Since we have only absolute contract ids, there is no more distinction
between local and global disclosure/divulgence. Let's please remove the
`global` prefix since it causes confusion (at least for me it did).

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-03 08:43:31 +02:00
Stephen Compall
86148c398b
make @silent annotations narrower (#6570)
* check that all @silent annotations are used

CHANGELOG_BEGIN
CHANGELOG_END

* make all @silent annotations very specific about what they're silencing
2020-07-01 20:53:22 +00:00
Stefano Baghino
36a9042594
Remove localDisclosures from BlindingInfo entirely (#6509)
* Address https://github.com/digital-asset/daml/pull/6507#discussion_r446113575

* drop blindinginfo.proto

changelog_begin
changelog_end

* drop BlindingCoder

* Remove blindinginfo Protobuf definition JAR

changelog_begin
[DAML-LF] The blindinginfo Protobuf definition JAR, which was previously unused, has been pulled from the artifacts released on Maven
changelog_end

Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2020-06-26 14:50:49 +00:00
Remy
6d27825acb
Engine: introduce config to control value/transaction output version (#6428)
* Engine: introduce configuration to control value/transaction output version

This advances the state of #5164

CHANGELOG_BEGIN
CHANGELOG_END
2020-06-26 13:38:38 +02:00
Stephen Compall
a51d0db8ff
set scalac -Xsource:2.13 -Ypartial-unification globally (#6469)
* add -Xsource:2.13, -Ypartial-unification to common_scalacopts

* add now-referenced scalaz-core where needed

* work around bad type signatures in scalatest Aggregating, Containing

* unused Any suppression

* work around bad partial-unification wrought by type alias

* remove unused Conversions import

- not required in 4f68cfc480 either, so unsure how it's survived this long

* work around Future.traverse; remove unused show import

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* remove unused bounds

* remove -Ypartial-unification and -Xsource:2.13 where they were explicitly passed

* longer comment on what the options do

- suggested by @stefanobaghino-da; thanks

* forget Future.traverse, just use scalaz, it knows how to do this
2020-06-24 16:51:24 -04:00
Remy
ec7d53eb59
LF-REPL: proper dev-mode (#6453)
We add a flag in LF-REPL to prevent usage of DAML-LF Dev and dev value/transaction version.

This PR advances #5164.

CHANGELOG_BEGIN
CHANGELOG_END
2020-06-23 17:08:37 +02:00
Remy
2a10a124d8
LF: Control transaction version inferrence. (#6365)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-18 19:11:33 +02:00
Remy
cbe423fc6c
LF: rename library transaction-scalacheck to transaction-test-lib (#6347)
* LF: rename library transaction-scalacheck to transaction-test-lib

CHANGELOG_BEGIN
CHANGELOG_END

* move files in com/daml

* missing change in release/artifacts.yaml

* remove 'com/dam' from the path
2020-06-17 10:52:40 -04:00
Remy
39ceac7a2c
LF: Change engine output from GenTransaction to VersionedTransaction (#6311)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-15 17:35:15 +02:00
Remy
3351dd8963
Address miklos' comments made in #5966 (#6315)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-12 16:33:52 +02:00
Remy
f487b051f9
Ledger: use standard transactions in the indexer (#6297)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-11 16:12:21 +02:00
Remy
da48be2be5
LF: Make VersionedTransaction a CidContainer (#6304)
plus some minor cleanup in CidContainer

CHANGELOG_BEGIN
CHANGELOG_END
2020-06-11 14:49:33 +02:00
Remy
cb23eb2c29
Ledger: use EventId instead of LedgerString (#6278)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-11 09:49:12 +02:00
Remy
5ff15a8ef5
DAML-LF: discriminate submitted and committed transactions (#6143)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-09 09:05:15 +02:00
Remy
00972f38b5
DAML-LF: split com.daml.lf.types.Ledger (#6264)
We split the object  com.daml.lf.types.ledger in three:
- one part in `com.daml.lf.ledger.` (in //daml-lf/transaction) for the part relative to EventId (shares between scenario service and sandbox)
- one part in `com.daml.lf.ledger.` (in //daml-lf/interpreter) for the part common to Blinding and Scenario
- one part in `com.daml.lf.scenario.` (in //daml-lf/interpreter) for the part specific to Scenario

fixes #6260

CHANGELOG_BEGIN
CHANGELOG_END
2020-06-08 17:29:10 +02:00
Remy
5e9490f1dc
Engine: Centralize the place where value version is inferred. (#6229)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-05 21:01:21 +02:00
Remy
bffc289868
DAML-LF: deprecate Transaction.TContractId (#6223)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-04 19:13:41 +02:00
Stephen Compall
39dc5aa88b
replace NodeExercises#controllers with controllersDifferFromActors boolean (#6073)
* replace NodeExercises#controllers with controllersDifferFromActors

* remove controllers from ActorMismatch and scenario service exercise

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* remove reserved ID #s in scenario-service grpc

As discussed, we don't need to worry about
version mismatches.

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-06-02 13:43:47 -04:00
Stephen Compall
ae9e3e2ec1
clean up Node map function (#6149)
* remove boilerplate from GenNode.map3

- There is no need to enumerate the unchanged fields, because if you
  miss one, you get a type error.  Unfortunately foreach3 cannot benefit
  from the same typechecking.

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-28 16:28:01 -04:00
Stephen Compall
15350a7bc2
disable warts.Any and remove most suppressions (#6132)
* disable Any wart

* first pass removal of Any suppressions for false positives

* second pass removal of Any suppressions for false positives

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* third pass removal of Any suppressions for false positives

* fourth pass removal of Any suppressions for false positives

* reformat newly single-suppressions into single lines

- suggested by @SamirTalwar-DA; thanks
2020-05-28 16:53:41 +00:00
Stephen Compall
78205afa0d
use 2.13-style collections library syntax in json-api (#6075)
* register scala-collection-compat with java deps list

* add scala-collection-compat to http-json deps

* remove breakOut throughout http-json, replaced with view/to or iterator/to

* use scala 2.13-style `to` calls in http-json

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* use 2.13-style to in lf-value-json

* some fused size comparisons

* remove low-hanging breakOuts in daml-lf

* regenerate maven_install.json for scala-collection-compat

* regenerate maven_install.json for scala-collection-compat

* regenerate maven_install.json for scala-collection-compat
2020-05-27 22:27:25 +00:00
Stephen Compall
1be6b3640f
equalz Scalatest matcher in new daml-lf/scalatest-tools library (#1200)
* equalz Scalatest matcher in new daml-lf/scalatest-tools library

* equalz typing tests

* a 'should' replacing design

* a 'MatcherFactory1' design

- this fails because the TC parameter should be a type member to avoid
  scala/bug#5075 but it is not

* MatcherFactory1 with chained Lub+Equal typeclass

- requires partial-unification at point of use, which is not great

* LubEqual's extra tparam is probably unneeded

* better LtEqual

* demonstrate that HK LubEqual's resolve with DMT should + MatcherFactory

* remove unneeded 3rd param from LubEqual, again

* update dependency specs and license headers

* allow use with should, shouldNot in some cases, preserving the shouldx/shouldNotx alternatives

* move Equalz to libs-scala/scalatest-utils

* rename bzl targets and place in com.daml.scalatest package

* add scalatest-utils to release

* move *SpecCheckLaws, Unnatural to scalatest-utils

* missed scalacheck dep in scalatest-utils

* downstreams of *SpecCheckLaws now get them from scalatest-utils

* test equal-types case as well

* update LF documentation

CHANGELOG_BEGIN
CHANGELOG_END

* whitespace error
2020-05-27 17:25:43 -04:00
Remy
3f29ac84f0
DAML-LF: cleanup last refs to Absolute Contract IDs (#6126)
follow up of #5991

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 18:05:48 +02:00
Remy
46bb942964
DAML-LF: restrict value versions (#6109)
advances #5164

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 15:51:56 +02:00
Remy
9e456a1016
DAML-LF: Kill RelativeContractId (#5991)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-25 22:30:45 +02:00
Remy
deedec9b9f
Engine: Remove optionality of contract ID Seeding. (#5966)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-13 20:29:14 +02:00