Commit Graph

417 Commits

Author SHA1 Message Date
Samir Talwar
bd8e3286c6
daml-lf: Tiny performance improvements. (#5493)
* daml-lf/data: Improve performance of `areEqual`.

`areEqual` constructs a one-element `FrontStack`, which should be cheap,
but turns out to be expensive because it constructs builders along the
way. This provides overloads for `apply` that construct the FrontStack
directly, rather than jumping through hoops.

This also changes the behavior of `FrontStack#equals` to check the
length first, which makes the tests work but might also help
performance.

* daml-lf/data: Merge `length` and `len`.

In `FrontStack`, `BackStack`, and `ImmArray`.

No reason to have `def length = len` when `len` can just be public.

* daml-lf/interpreter: Allocate the right-sized list for arguments.

We spend a fair amount of time in `ArrayList#add`; this lessens that by
making sure than when we clone the `args` array for function
application, we leave some room for adding the arguments.

CHANGELOG_BEGIN
CHANGELOG_END

* daml-lf/data: Revert accidentally-lengthened imports.

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

* daml-lf/interpreter: Rename `functionArgs` to `extendedArgs`.

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-04-08 16:28:42 +00:00
Remy
b3ccacc006
DAML-LF. fix computation of cid (#5486)
The fix is to use the number of nodes of the partial transaction instead of the number of nodes of the full transaction.


CHANGELOG_BEGIN
CHANGELOG_END
2020-04-08 16:44:48 +02:00
Remy
af5b8e553f
Speedy: optimize value translation (#5379)
CHANGELOG_BEGIN
CHANGELOG_END
2020-04-07 17:17:13 +00:00
Gerolf Seitz
cadaa59ad8
Fix redirects, java-bindings javadoc, and live-preview.sh (#5446)
* Fix redirects, java-bindings javadoc, and live-preview.sh

- javadoc_library now supports sources from filegroups as well
- //language-support/java:javadoc now generates javadoc for ledger-api, java bindings, rxjava bindings
- live-preview.sh refers to the correct javadoc target //language-support/java:javadoc
- removed leading / from redirects.map

* Only generate daml-lf javadocs if not on windows

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-07 09:53:26 +02:00
Remy
50694c7abe
DAML-LF. fix parameter and self binder in choices. (#5444)
* DAML-LF. fix parameter and self binder in choices.

* fix

* DAML-LF: address moritz's comments

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-06 14:32:30 +00:00
Remy
37cda0e2cb
Engine: increase memory for large transaction test (#5447)
* Engine: increase memory for large transaction test

* changelog

CHANGELOG_BEGIN
CHANGELOG_END

* address Moritz's comments
2020-04-06 13:40:49 +00:00
Remy
943919585e
Java Codegen: fix template code generation (#5443)
* Java Codegen: fix template code generation

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-06 08:56:51 +00:00
Gerolf Seitz
a2d785e3ee
Use com.daml as root package (#5343)
Packages com.digitalasset.daml and com.daml have been unified under com.daml

Ledger API and DAML-LF DEV protos have also been moved from `com/digitalasset`
to `com/daml` on the file system.
Protos for already released DAML LF versions (1.6, 1.7, 1.8) stay in the
package `com.digitalasset`.

CHANGELOG_BEGIN
[SDK] All Java and Scala packages starting with
``com.digitalasset.daml`` and ``com.digitalasset`` are now consolidated
under ``com.daml``. Simply changing imports should be enough to
migrate your code.
CHANGELOG_END
2020-04-05 19:49:57 +02:00
Remy
f82f98b28e
Engine: simplify commandPreprocessor output (#5415)
* Engine: simplify commandPreprocessor output

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-03 12:49:28 +00:00
Moritz Kiefer
644e76d047
Build a zip containing all protobuf files (#5412)
* Build a zip containing all protobuf files

This builds a fat zip that contains the DAML-LF protobuf files and
the Ledger API protobuf files for a given release.

I’ll tackle the Azure config for uploading this to github releases afterwards.

To ease reviewing this is how the resulting zip looks like:

```
Archive:  bazel-bin/release/protobufs.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
     3593  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/package_service.proto
     1355  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/ledger_identity_service.proto
     6262  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/event.proto
     2282  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/testing/reset_service.proto
     1908  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/testing/time_service.proto
      886  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/ledger_offset.proto
     1327  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/transaction_filter.proto
     2380  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/command_submission_service.proto
     6208  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/transaction_service.proto
     3800  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/transaction.proto
     1506  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/completion.proto
     1893  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/ledger_configuration_service.proto
     5109  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/admin/party_management_service.proto
     3562  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/admin/package_management_service.proto
     3559  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/admin/config_management_service.proto
     5542  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/commands.proto
     4286  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/command_completion_service.proto
     2989  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/active_contracts_service.proto
     3393  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/command_service.proto
     5868  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/value.proto
     1810  2010-01-01 00:00   protos-0.0.0/com/digitalasset/ledger/api/v1/trace_context.proto
      558  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_6/daml_lf_0.proto
     1766  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_6/daml_lf.proto
    27265  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_6/daml_lf_1.proto
      558  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_7/daml_lf_0.proto
     1766  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_7/daml_lf.proto
    35657  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_7/daml_lf_1.proto
      558  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_8/daml_lf_0.proto
     1766  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_8/daml_lf.proto
    37168  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_1_8/daml_lf_1.proto
      596  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_dev/daml_lf_0.proto
     1804  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_dev/daml_lf.proto
    39864  2010-01-01 00:00   protos-0.0.0/com/digitalasset/daml_lf_dev/daml_lf_1.proto
```

changelog_begin
changelog_end

* Try to get tar from PATH

* Address review comments
2020-04-03 14:16:15 +02:00
Stefano Baghino
bc8c8bfd5d
Reduce memory necessary to run the zipbomb detection test (#5345)
changelog_begin
changelog_end
2020-04-01 15:35:54 +00:00
Gerolf Seitz
329320bad9
Organize maven coordinates (#5272)
* Use com.daml as groupId for all artifacts

CHANGELOG_BEGIN
[SDK] Changed the groupId for Maven artifacts to ``com.daml``.
CHANGELOG_END

* Add 2 additional maven related checks to the release binary

1. Check that all maven upload artifacts use com.daml as the groupId
2. Check that all maven upload artifacts have a unique artifactId

* Address @cocreature's comments in https://github.com/digital-asset/daml/pull/5272#pullrequestreview-385026181
2020-04-01 11:41:18 +02:00
Remy
5218b5f3e8
DAML-LF. method to suffix V1 cid (#5319)
CHANGELOG_BEGIN
CHANGELOG_END
2020-04-01 10:02:32 +02:00
Remy
fa21bd3f24
DAML-LF: deprecate all DAML-LF < 1.6 (#5321)
CHANGELOG_BEGIN
* [DAML-LF] *Breaking* deprecating all DAML-LF versions < 1.6
   - older versions will be maintained and supported for Sandbox classic.
   - no data continuity would be guaranteed any-more for other ledgers using DAML-LF < 1.6
CHANGELOG_END
2020-03-31 21:28:28 +02:00
Remy
0e1ca7df7c
Engine: ensure freshness of local cid discriminator (#5277)
* Engine: ensure freshness of local cid discriminator

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-31 18:06:18 +02:00
Remy
1d0c0df325
Scenario serice: use new contract ids (#5296)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-31 14:37:41 +02:00
Remy
7185608f87
Engine: lf-repl uses to new contract ids (#5249)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-31 11:06:50 +02:00
Remy
3fc1175436
Engine: force recent version for serializing transactions and values. (#5232) 2020-03-30 16:29:18 +02:00
Ognjen Maric
5be5036f27
Engine: support reinterpreting LookupByKey nodes (#5271)
Fixes #5264

CHANGELOG_BEGIN

- [Engine] Support reinterpreting LookupByKey nodes

CHANGELOG_END
2020-03-30 15:13:43 +02:00
Stefano Baghino
746b774e82
Add canonical string representation for identifiers (#5270)
* Add canonical string representation for identifiers

An identifier is represented as a string as a package identifier and a qualified name separated by a colon.

changelog_begin
changelog_end

* Simplify explicit type signature for HexString

Thanks @remyhaemmerle-da

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Fix hashing test expected output

* Fix key hasher test expected output

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-03-30 12:55:11 +00:00
Remy
4cb3ea5c7c
Ledger: clean up contract id seeding (#5260)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-30 10:13:42 +02:00
Remy
1b37f6c482
DAML-LF: redesign absolute contract ids (#5207)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 19:07:42 +01:00
Remy
20218e4175
DAML-LF: restrict length of parties (#5237)
CHANGELOG_BEGIN
* [DAML-LF]. *Breaking* Restrict length of parties
CHANGELOG_END
2020-03-27 14:52:43 +01:00
Gary Verhaegen
1872c668a5
replace DAML Authors with DA in copyright headers (#5228)
Change requested by Manoj.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 01:26:10 +01:00
Gary Verhaegen
9f3900d870
pin copyright headers (#5227)
When files should be immutable, they should also be protected from the
copyright headers script.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 23:30:23 +01:00
Andreas Herrmann
f0929f2d04
Consistently replace zip by bazel_tools zipper (#5215)
* sdk-release-tarball: zip is unused

* daml-lf/archive: Use bazel_tools zipper

@bazel_tools//tools/zip:zipper avoids timestamps and sources of
indeterminism when creating an archive, so that the result is
reproducible.

CHANGELOG_BEGIN
CHANGELOG_END

* Remove unused @zip_dev_env

zip is fully replaced by @bazel_tools//tools/zip:zipper.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-26 17:38:03 +01:00
Ognjen Maric
f7aa2a3db0
Add keys with maintainers to Fetch nodes (#5186)
Add keys with maintainers to Fetch nodes

The new field is populated by the interpreter whenever the fetched
contract has a key. Used for contract key reinterpretation in Canton.

CHANGELOG_BEGIN

- [DAML-LF] Add keys with maintainers to Fetch nodes in transactions.

CHANGELOG_END
2020-03-26 14:07:17 +01:00
Remy
9880f3d7c2
Engine: Change type of ExerciseCommand contractId (#5182)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 10:44:24 +01:00
Stephen Compall
8d2c13cf43
generating GenMaps for testing (#5115)
* building a GenMap generator

* move Party Order to accessible place; test whether Name Equal is still in use

* add Order instance for SortedLookupList

* switch to Map for genMap's Inj; more Order instances

* remove all Order from TypedValueGenerators

* Revert "add Order instance for SortedLookupList"

This reverts commit 03a59a8249.

* moving the Equal instance means scenario-interpreter no longer direct-deps scalaz

* add a test using TypedValueGenerators GenMap

* remove Party Order

* refmt bazel

* remove stray import

* followup dep change to moving the Equal[Name] instance

* add changelog

CHANGELOG_BEGIN
CHANGELOG_END

* Name equal instance appears to be no longer used, but keeping anyway
2020-03-25 10:28:06 -04:00
Robert Autenrieth
3f597aae16
New ledger time (#5100)
* Tighten result type

Command execution can't result in a sequencer error

* New helper method for extracting used contracts

* New error clause

* Add a DAO query for the maximum time of contracts

* Implement algorithm for finding ledger time

CHANGELOG_BEGIN
CHANGELOG_END

* fixup ledgerTimeHelper

* Use new ledger time algorithm

* Mark LET/MRT as deprecated

CHANGELOG_BEGIN
- [Ledger API] DAML ledgers have switched to a new ledger time model.
  The ledger_effective_time and maximum_record_time fields of command submission are deprecated,
  the ledger time of transactions is instead set automatically by the ledger API server.
  Ledger time is no longer strictly monotonically increasing, but only follows causal monotonicity:
  ledger time of transactions is greater than or equal to the ledger time of any used contract.
  See `#4345 <https://github.com/digital-asset/daml/issues/4345>`__.
CHANGELOG_END

* Add ledger time skew check

* Remove command updater

LET/MRT are now deprecated, this class is now useless

* Remove old time model validator

* Switch to new time model check: kvutils

* Switch to new time model check: in-memory ledger

* Switch to new time model check: SqlLedger

* Use initial ledger config

* Ignore user provided LET

* Use TimeProvider in submission services

* Use deduplication_time in daml-script runner

- Also remove unnecessary command completion output of CommandTracker.
- Remove usage of maximum record time in CommandTracker.

* Use arbitrary default value for deduplication time

* Use built-in Instant ordering

* Remove obsolete test

* Remove obsolete test: CommandStaticTimeIT

* Refactor test: TransactionMRTCompliance

* Disable test: CommandTrackerFlow timeout

* thread maxDeduplicationTime through to CommandTracker

* Improve test

* Refactor command client configuration

* Deduplication time should always use UTC

* Add missing method in TimedIndexService after rebase

* Put more details into the deduplication error response.

* Use system time for command dedup submittedAt.

* Use explicit UTC time source in command validator

* Revert CommandTracker[Flow] to previous completion-recovering-behavior

* Adapt scala client command config to new config params

Co-authored-by: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2020-03-25 09:28:56 +01:00
Moritz Kiefer
2b47f6994d
Switch default DAML-LF target to 1.8 (#5127)
changelog_begin

- [DAML Compiler] The default output DAML-LF target version is now
  1.8. You can target 1.7 by specifying ``--target=1.7`` in the
  ``build-options`` field in your ``daml.yaml``.

changelog_end

Fix daml2ts tests
2020-03-24 11:02:13 +01:00
Remy
8fb86b7133
Engine: create type for immutable byte array (#5140)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-24 09:04:52 +01:00
Remy
2dd9c50631
DAML-LF: contract id spec (#5106)
* DAML-LF: contract id spec

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-23 18:05:48 +01:00
Gerolf Seitz
f9fb888cc4
Allow for predictable contractIDs and transactionIDs (#5112)
- New seeding type "Static" that uses a fixed seed for generating new seeds.
This is only used in Sandbox and Sandbox-next.

- Remove the fuzzing for submission time in Engine.scala

- DAML-on-SQL: Create new log entry IDs from a provided SeedService.
This allows for generating deterministic transaction IDs in
Sandbox-Next.

Fixes #5107

CHANGELOG_BEGIN
[Sandbox] Add contract-id-seeding=static to allow for predictable contract IDs. This is useful for documentation,
to be able to refer to a specific contract ID instead of having to write "note down the contract ID you see on the screen. we will use it later."
[DAML-on-SQL] Derive the next log entry ID using the provided SeedService. This allows us to also deterministically create transactionIds in static time mode together with `--contract-id-seeding=static`. This should only be used for demos or documentation.
CHANGELOG_END
2020-03-23 10:55:40 +01:00
Stephen Compall
f2b068f0b5
remove List and TextMap support from the JSON query language (#5099)
* remove List and TextMap support from the JSON query language

CHANGELOG_BEGIN
- [JSON API - Experimental] Removed support for maps and lists from the query language.
  See `issue #4855 <https://github.com/digital-asset/daml/issues/4855>`_.
CHANGELOG_END

* GenMap won't be supported in general, remove FIXME

- thanks @leo-da

* more documentation on unsupported query types

- as suggested by @hurryabit; thanks
2020-03-20 16:22:22 -04:00
Remy
1216fd1a6f
Engine: fix missing usage of Enum Svalue rank (#5083)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-19 14:27:13 +01:00
nickchapman-da
d81caa9568
rework daml_compile bazel rule (#5070)
Avoiding `damlc compile/package` commands (which we would like to deprecate), and replace with plain `damlc build` together with a post dar->dalf extraction step in the couple of places where we actually want the .dalf for testing.

changelog_begin
changelog_end
2020-03-18 23:06:55 +00:00
Remy
3cbba8a444
Engine: Use enum and variant svalues' enum and variant s rank (#5068)
CHANGELOG_BEGIN
CHANGELOG_END

We use the rank recently introduced in the enum and variant svalues for:
* pattern matchin
* value hashCode
* value ordering (so the oredering match the DAML-LF spec)
* value equality
2020-03-18 20:44:17 +01:00
Remy
c2070170b3
Engine: add rank to Enum and Variant SValue (#5048)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-18 14:37:44 +01:00
Remy
eae3844ed9
Engine: Replace SResultMissingDefinition by SResultNeedPackage (#5039)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-17 19:25:57 +01:00
Remy
6e535e6c42
DAM-LF minor fixes relative to GenMap (#5028)
Here we fix some minor issue relatives to GenMap.

In particular:
    * validity of keys are checked when GenMap is created.
    * interface test
    * outdated comments
2020-03-17 11:00:33 +01:00
Remy
04196597a7
forbid non-generic comparison in 1.dev (#5020)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-16 17:25:43 +00:00
Remy
da79d89cc8
DAML-LF fix semantics of GenMap insert, lookup, and delete (#5024)
to follow the DAML-LF spec

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-16 16:39:14 +00:00
Remy
ac8554eddd
Engine: drop old internal comparsion builtin (#4990)
* Engine: drop old internal comparison builtin

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-16 15:15:32 +01:00
Remy
1c26f63fad
DAML-LF: GenMap Spec (#4981)
* DAML-LF: GenMap Spec

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-16 13:09:44 +01:00
Remy
c76e0bc1e0
DAML-LF add support for generic comparison in archive (#4983)
* DAML-LF: add generic comparison to archive
2020-03-13 20:13:13 +01:00
Gary Verhaegen
364262a7f6
saner scalafmt target (#4985)
The current behaviour of our scalafmt checks compares for changes with
origin/master, which means it is dependent on the state of the local git
repository. This makes it non-reproducible.

Added to the fact that the master branch is not currently green as per
our scalafmt rules, this makes it impossible to rebuild older commits,
which in turn could interfere with our release process.

This PR does two things:

1. Fix our codebase to agree with our formatting rules.
2. Add a flag to `fmt.sh` to enable scalafmt's diff behaviour, and
   change the default to a full scan.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-13 17:37:13 +01:00
Remy
277883e4d5
DAML-LF: base GenMap on SortedMap (#4893)
Change underlying implementation of GenMap from insertion order Map to sorted Map

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-13 11:10:38 +01:00
Remy
65e988b778
[DAML-LF] specification for generic comparison. (#4942)
* [DAML-LF] specification for generic comparison.

+ update generic equality

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-12 22:07:13 +01:00
Remy
198973f23b
DAML-LF: introduce HexString to represents base16 array encoding (#4952)
* DAML-LF: introduce the string type HexString that represents base16 array encoding

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-12 22:04:36 +01:00