Commit Graph

360 Commits

Author SHA1 Message Date
Robin Krom
b14e4aeacd
ifaces: tests for by_interface nodes in transactions (#13321)
This adds tests for decode . encode = id in the transaction
encoder/decoders.

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-18 11:34:45 +01:00
Sergey Kisel
a4f4300502
Naming and logging improvements [DPP-956] (#13270)
* Naming and logging improvements [DPP-956]

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 09:40:39 +01:00
Sergey Kisel
9a27edd656
Improve MessageDigest and Mac instance creation to solve lock contention [DPP-956] (#13221)
* Improve MessageDigest and Mac instance creation to solve lock contention problem [DPP-956]

changelog_begin
Scalability bottleneck in regard to hashing has been fixed in multiple places.
changelog_end
2022-03-09 22:15:32 +01:00
Remy
515f4277a9
LF: Make TransactionVersion.Ordering public (#12966)
To be accessible from Canton.

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-16 16:15:50 +00:00
Victor Peter Rouven Müller
aa45f48798
Upgrade to Scala 2.13.8 (#12506)
* Upgrade to Scala 2.13.8

changelog_begin
changelog_end

* Update hash for scala in nixpkgs

* update more hashes for scala upgrade

* Fix most warnings etc.

* Fix remaining errors etc.

* Fix formatting

* Resolve last errors hopefully

* Fix ledger api common build file

* Combine imports & revert accidental change that broke the CI run

* Rename exporting vals to scriptExport & minimize diff

* Remove more wrong changes

* moved warning around
2022-02-03 09:05:31 +00:00
Remy
2ac76fd4fe
LF: Gracefully handle serialization error of Values beyond 2GB (#12638)
fixes #12392

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-31 21:10:27 +00:00
Remy
ebf7908007
LF: check contracts are consumed when found them in the cache (#12527)
fixes #11874

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-25 13:33:54 +00:00
Stefano Baghino
aec3390904
Replace silencer plugin with built-in warning configuration (#12543)
Since Scala 2.13.2, Scala introduced built-in support to
manage warnings in a more granular fashion, thus making
the silencer plugin we are currently using no longer
strictly useful. Removing compiler plugins also removes
friction from migrating to Scala 3 in the future. As a
cherry on top, the built-in warning configuration also
allows to check whether a `@nowarn` actually does
anything, allowing us to proactively remove unused
warnings should the need arise.

[Here][1] is s a blog post by the Scala team about it.

Warnings have been either solved or preserved if useful,
trying to minimize the scope (keeping it at the single
expression scope if possible). In particular, all
remaining usages of the Scala Collection API compatibility
module have been removed.

Using the silencer plugin also apparently hid a few
remaining usages of compatibility libraries that were used
as part of the transition from Scala 2.12 to Scala 2.13
that are no longer needed. Removing those warnings
highlighted those.

changelog_begin
changelog_end

[1]: https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
2022-01-24 15:01:35 +00:00
Moritz Kiefer
688f1e1e0b
Drop v0 contract ids (#12464)
* Drop v0 contract ids

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2022-01-20 15:28:27 +00:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
Simon Maxen
51b9405f5c
TransactionNodesStatistics.stats to return case class of same name (#12159)
* TransactionNodesStatistics.stats now returns case class of same name

changelog_begin
changelog_end

* Rename TransactionNodesStats to Detail and make inner class

* Rename TransactionNodesStatistics.stats to apply

* Rename TransactionNodesStatistics to TransactionNodeStatistics

* Reformat

* Remove rollback from statistic action count

* Update with review comments

* Update with review comments
2021-12-17 15:27:53 +00:00
Moritz Kiefer
5f688dd704
Cache localContract calls in contractKeyInputs (#12183)
changelog_begin
changelog_end
2021-12-17 11:37:24 +00:00
Sofia Faro
b99952407c
Update TODOs to outdated issues. (#12090)
* Update TODOs to outdated issues.

In particular update a lot of defunct interface TODOs to the LF 1.15
issue (or add the LF 1.15 issue if it's also relevant).

changelog_begin
changelog_end

* typo

* remove numeric/bignumeric todo

* scalafmt!!

* drop choice observer TODO
2021-12-09 21:01:27 +00:00
Remy
9e5bea193c
LF: Node statistics of a transaction (#12018)
fixes #11961

CHANGELOG_BEGIN
CHANGELOG_EN
2021-12-07 19:21:33 +00:00
Remy
f228f9575c
LF: replace boolean by ADT in transaction traversal (#11988)
CHANGELOG_BEGIN
CHANGELOG_END
2021-12-06 18:19:47 +00:00
Remy
b02ed7765a
LF: Introduce configurable limits on produced transactions (#11948)
This is part of #11691

This PR allows to limits:
- the number of signatories,
- the number of observers,
- the number of controllers,
- the number of inputContracts,

CHANGELOG_BEGIN
CHANGELOG_END
2021-12-02 16:31:09 +01:00
Sofia Faro
0b9d57b95e
Add ContractDoesntImplementInterface error. (#11884)
* Add a ContractDoesntImplementInterface error

Part of #10810 and #11703

changelog_begin
changelog_end

* use inside

* rename error
2021-11-29 15:54:31 +00:00
Sofia Faro
5c12d757f4
Add a guard when exercising by interface. (#11836)
* Add a guard when exercising by interface.

This fixes part of #11703, when exercising an inherited choice by
interface and you know the template id, via the command preprocessor.

It does this by inserting a "guard" in between the interface fetch and
the exercise body. The guard is a function Interface -> Bool, which
is general enough to check the template id, without complicating too
much in speedy. And can be generalized in the future to check more,
like signatories, etc.

I added the guard as an optional argument to UExerciseByInterface.
This isn't hooked up to the protobuf AST yet (or Haskell side for
that matter) -- but I'll do it in the next PR! For now you can invoke
the guarded exercise via the command preprocessor, so I can enable the
approprate engine tests. (There's still some failing fetch tests left,
but I decided to leave this for later. Fetch can be a lot simpler than
guarded choices, since you always add a fetch node. No need for fancy
continuations.)

changelog_begin
changelog_end

* scalafmt

* Feedback and fix matches

* Update comments, we are always going to abort the transaction

* Raise WronglyTypedContract in SBGuardTemplateId.

* rebase and fix parser

* restore ANF

* scalafmt
2021-11-24 14:22:40 +00:00
Remy
1bb2fc28a3
LF: Simplify transaction versionning for interface (#11744)
We revert #11626, and just change the way transaction version is
computed:

- As before, Node version is calculated from the
  package of the template ID action.

- Transaction version is the max of the version of all the nodes,
   instead of the root nodes.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-18 22:46:46 +01:00
Moritz Kiefer
fa7663148a
Drop 2.12 versioned_scala_deps (#11748)
I’ve kept the infrastructure for versioned_scala_deps around because
I’m optimistic and hope that eventually we’ll do another Scala upgrade.

changelog_begin
changelog_end
2021-11-17 22:13:08 +00:00
Sofia Faro
c2d4ea4ef1
Add separate commands for create/fetch/exercise by template/interface. (#11724)
* Add separate commands wrt by template/interface

Resolves #11674 and #11675

changelog_begin
changelog_end

* remove unnecessary commands
2021-11-17 17:08:24 +00:00
Remy
775b41c235
LF: Reintroduce TransactionVersion.asVersionedTransaction (#11692)
* LF: Reintroduce TransactionVersion.asVersionedTransaction

This have been drop in #11626, but canton is using it.

CHANGELOG_BEGIN
CHANGELOG_END

* cosmetic

* cosmetic
2021-11-15 12:07:23 +00:00
Sofia Faro
57f1b868d3
Improve byInterfaceNodes based on suggestions (#11672)
* Improve byInterfaceNodes based on suggestions

From the last PR #11662

changelog_begin
changelog_end

* use transaction traversal order
2021-11-12 17:31:47 +00:00
Remy
15b925a116
LF: Compute transaction version as the maximum of the children (#11626)
fixes #11377

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-12 17:00:07 +01:00
Remy
7eb22ddf4f
LF: drop forgotten deprecate Node aliases. (#11673)
Because a bug in the scala compiler deprecated pattern matching are
not detected (See https://github.com/scala/bug/issues/12493).
Hence some deprecated usage of Node aliases have been forgotten in

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-12 15:07:22 +00:00
Sofia Faro
409864f220
Use by_interface field when fetching transaction dependencies. (#11662)
* Use by_interface field when fetching tx deps.

Fixes #10915

changelog_begin
changelog_end

* scalafmt
2021-11-12 09:37:24 +00:00
Remy
b8f384e193
LF: Drop typeparameter from KeyWithMaintainers (#11625)
Following up #10827 and #10921, we drop type parameter to
KeyWithMaintainers, and use the `Versioned` wrapper introduced in

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-10 13:21:13 +01:00
Remy
92181161cc
LF: Abstract VersionedValue and VersionedContractInstance (#11533)
* LF: Abstract VersionedValue and VersionedContractInstance

CHANGELOG_BEGIN
CHANGELOG_END

* formatting
2021-11-09 23:22:38 +00:00
Remy
830779ff78
LF: drop useless class com.daml.lf.transaction (#11601)
It became obsolete after #10524.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-09 16:14:26 +00:00
Remy
a7559d047e
LF: Rename GenTransaction to Transaction (#11599)
* LF: Rename GenTransaction to Transaction

Following up #10827 and #10921 that drop type parameters from GenNode,
we rename GenTransaction to Transaction.

CHANGELOG_BEGIN
CHANGELOG_END

* fix

* a bit more fixes
2021-11-09 13:30:34 +00:00
Sofia Faro
cbc3c8c686
Add by_interface field in Create, Fetch, & Exercise transaction nodes. (#11576)
* Add by_interface field in tx nodes.

This PR adds an optional `by_interface` field in the Create, Fetch,
and Exercise nodes, as part of #10915. It also updates TransactionCoder
to support these fields.

Setting these fields (in the LF interpreter) is left to a separate PR.

changelog_begin
changelog_end

* update security-evidence.md

* Add version checks in TransactionCoder
2021-11-08 16:33:02 +00:00
Remy
692dac665d
LF: deprecate remaining type alias in Transaction (#11554)
CHANGELOG_BEGIN
CHANGELOG_END
2021-11-04 18:02:16 +00:00
Remy
73cb42e102
LF: deprecate ensureNoCid and assertNoCid in CidContainer (#11502)
After #10827 that drops type parameters in Value, `CidContainer`'s
`ensureNoCid` and `assertNoCid` loose their interest.
To check a value does not contain Contract Ids one should use
`foreachCid` or `cids` methods instead.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-04 14:49:19 +01:00
Remy
a8ae4d6f9c
LF: Rename GenNode to Node (#11469)
Following up #10827 and #10921 that drop type parameters from GenNode,
we rename GenNode into Node.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-02 16:42:16 +00:00
Remy
f81d880bcc
LF: drop com.daml.lf.transaction.Transaction.Transaction type alias. (#11470)
After dropping type parameter from GenTransaction we do not
com.daml.lf.transaction.Transaction.Transaction type alias.  We use
instead directly com.daml.lf.transaction.VersionedTransaction, wich is
anyway more informative.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-02 10:23:17 +01:00
Remy
98e7461fc5
LF: ContractInstance should be a CidContainer (#11487)
In #11419 we drop the implicit call that convert ContractInstance in
CidContainer. Thie is used by Canton and should be restore.

Note that now ContractInstance is not polymorphic anymore, hence we
can inherite CidContainer instead of defining an implicit.

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-01 18:58:47 +00:00
Remy
d678a4046d
LF: remove type parameter from ContractInstance (#11419)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-27 09:59:13 +02:00
Remy
c8006b866a
ScenarioRunner: enrich incomplete transactions (#11384)
* ScenarioRunner: enrich incomplete transactions

fixes #11352

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-26 19:28:05 +02:00
Remy
a1d94e10ba
LF: Create special case class for VersionedContractInstance (#11127)
To replace usage of ContractInstance[VersionedValue]

CHANGELOG_BEGIN
CHANGELOG_END
2021-10-14 08:53:26 +02: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
Moritz Kiefer
26d10b267d
Drop NodeId type parameter (#10921)
changelog_begin
changelog_end
2021-09-30 09:13:54 +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
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
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
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
Remy
24fff88992
LF: Simplify TransactionBuilder (#10753)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 15:37:46 +02: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
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