* Cleaning up BigNumeric somewhat.
Done in this PR:
- Moved BigNumeric and RoundingMode to GHC.Types to be alongside Numeric and Decimal
- Additive, Multiplicative, Number instances for BigNumeric
- Eq, Ord instances for BigNumeric and RoundingMode
Todo:
- BigNumeric literals in Daml
- Constructors and pattern matching for rounding mode
- Better documentation
changelog_begin
changelog_end
* remove ^ for now
* define (^) because it's required
* Error in (^) for negative powers.
* better error message
* import fromString and error
* Add -Wno-unused-imports because of compiling to different versions.
* add (fromString) and (error)
* Update bignumeric test.
* Fix gRPC status codes for inconsistency rejections and DamlLf errors
Also, add unit tests and exclude failing compatibility and conformance tests
CHANGELOG_BEGIN
- [Integration Kit] Fix gRPC status codes for inconsistency rejections and DamlLf errors (ContractNotFound, ReplayMismatch) by changing them from INVALID_ARGUMENT to ABORTED
CHANGELOG_END
* Implement match-handling for `NodeRollback` in _structural cases_
where what the code has to do is in some sense _obvious_.
changelog_begin
changelog_end
* do cases in daml-lf/interpreter
* do cases in daml-lf/engine
* fix spello in comment
* drop Rollback nodes when normalizing for KV
* reinstate one 8020 todo
* more 8020 TODOs
We already store them in cachedContracts, no reason to store them
twice. This should also be slightly more efficient since we only do
one lookup in cachedContracts in the common case and only look at
localContracts if there’s a wrongly typed contract. I doubt it’s
measurable but at least it’s not worse.
changelog_begin
changelog_end
* New transaction node: NodeRollback. Fixup every match with a crash + TODO.
changelog_begin
changelog_end
* remove 3 methods from NodeRollback which are not needed to fulfill its interface
* add override to remaining 4 methods implemented in body of NodeRollback
* remove unrequired 2nd type parameter (Cid) from NodeRollback
* add missing 8020 marker
* Cache contract fetches in speedy
This PR adds a cache to speedy to cache contract fetches and
information only derived from the contract argument, namely,
signatories, observers and keys.
The cache is engine-internal so on the first fetch of a global
contract in a transaction, we recompute that information.
This does not change observable semantics:
Ledgers must be consistent within a transaction so caching is safe. We
still recompute signatories, observers & keys the first time so if
they fail, we still blow u.
We also never compute more than before. While `SBUFetch` itself did
not compute that information, it was immediately folowed by either
`SBUBeginExercise` or `SBUInsertFetchNode` which compute that
information.
We also keep the optimization that we do not have to compute key and
maintainers on by-key operations
On the collect authority benchmark, this is around a ~1.48x
improvement which is pretty decent.
changelog_begin
changelog_end
* Remove dead code
changelog_begin
changelog_end
* Less stupid error handling
changelog_begin
changelog_end
* Add a test for wrongly typed contract ids
changelog_begin
changelog_end
* Check type of cached contracts
changelog_begin
changelog_end
* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SBuiltin.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Add tests for wrongly-typed contract ids to EngineTest
changelog_begin
changelog_end
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Add documentation for the Daml Profiler
changelog_begin
- [Daml Profiler] Daml Connect EE now includes a profiler which can be
used to profile Daml execution time.
changelog_end
* Update docs/source/tools/profiler.rst
Co-authored-by: Bernhard Elsner <40762178+bame-da@users.noreply.github.com>
* Make sphinx happy
changelog_begin
changelog_end
Co-authored-by: Bernhard Elsner <40762178+bame-da@users.noreply.github.com>
* Document profiling internals
This is a cleaned up version of my comment on
https://github.com/digital-asset/daml/pull/9151#discussion_r595474708
in the hope that this makes it easier to understand for the next person.
changelog_begin
changelog_end
* fmt
changelog_begin
changelog_end
This PR addresses the TODO to expose the actual exception values and
type instead of the message. This allows us to simply speedy a bit by
removing the continuation used for that but more importantly it means
we can now catch and handle the exception in Daml script.
changelog_begin
changelog_end
This untangles the dependency structure a bit so that //daml-lf no
longer ends up depending on daml script and sandbox and similar crap
which should improve build times in general.
changelog_begin
changelog_end
I don’t entirely buy that we need to use AnyRef at all here given that
the labels are allocated during speedy compilatoin and not runtime but
regardless, we can definitely use proper case classes/objects instead
of arbitrary strings.
changelog_begin
changelog_end
* Add new variant to Value.scala for builtin-exceptions.
final case class ValueBuiltinException[+Cid](tag: String, value: Value[Cid]) extends Value[Cid]
And push through the code consequences.
Most places fixed up.
A couple more things to do in this PR (marked NICK)
A couple of things which can be left for later (marked 8020)
fix build
fix another scala match
changelog_begin
changelog_end
* fix any match
* add marker of code which needs attending to in the PR
* extend ledger-api value.proto & fix LfEngineToApi
* undo/comment-out the change to value.proto
* add tests in HashSpec for BuiltinException
* code but dont yet enable value-gen for builtin exceptions
* address comments which suggest we crash in various places
* support BuiltinException in scenario_service.proto
* one more TODO 8020 tag
This PR adds a hook in the compiler and the engine to allow easy prototyping of new features.
In particular by using this hook, one can add a new feature in 1.dev with modifying:
compiler
type checkers (both Haskell and Scala)
archive Protobuf
archive decoder
In addition of development speed, this also adds a bit of confidence, as the peaces enumerated above are not touched when adding the feature: The feature can be added by modifying only 1.dev Daml standard library and Speedy.
aa7991f8 shows a use case of this hook.
CHANGELOG_BEGIN
CHANGELOG_END
* WIP
At a baseline test in RollbackTest for an exercise when no exception thrown.
changelog_begin
changelog_end
* call abortExercises if exception throwing unwinds stack through KCloseExercise Kont frames
* WIP
add LF examples to test try-catch & throw
add (integer) info to template for created contracts
call {begin,end,abort,rollback}Try during speedy on-ledger execution
add test to exercise abortTry
changelog_begin
changelog_end
* share boilerplate in test setup
* test value of created contracts, not just the count
* naming
* avoid Scenarios in tests. Just working directly with Update expressions
* use machine.withOnLedger, so crash if we are not
* Fix closure references in Daml Repl
Turns out the comment "we probably need to extend this to merge the
modules from each line" was exactly correct: If the result evaluates
to a closure (or a value including a closure), it can reference
definitions from the current module. This happens if the simplifier
lifted something out of the current definition (otherwise we have only
one and it cannot be recursive so no chance of leaking a reference).
This PR fixes this by checking whether the result references the
current module and if it does, we keep it around.
changelog_begin
changelog_end
* Address review comments
changelog_begin
changelog_end
* fmt
changelog_begin
changelog_end
CHANGELOG_BEGIN
- [LF] Release LF 1.12. This version reduce the size of transaction
- [Compiler]: Change the default LF output from 1.8 to 1.11.
CHANGELOG_END
* Ledger API test tool: test against legacy and preview version.
+ use dictionary instead of alias to map version keywords to LF version
CHANGELOG_BEGIN
CHANGELOG_END
No need to include the agreement text because the agreement text is derived from the contract instance argument using a DAML function specified in the template
CHANGELOG_BEGIN
CHANGELOG_END
* Refactor speedy code so `endExercise` is performed by a new continuation `KCloseExercise`.
This is in preparation for support of unwinding the continuation stack (when an exception is thrown) through a `KCloseExercise` continuation. In this case we will need to call `abortExercise`.
changelog_begin
changelog_end
* remove unnecessary env-save/restore in KCloseExercise
* remove unnecessary SomeArrayEquals
* remove unnecessary templateId parameter to SEScopeExercise and KCloseExercise
* daml-lf/interpreter: Avoid `.iterator.map(...).toArray`.
It ends up being pretty heavy on calls, making the stack really big when
we recurse. This doesn't solve the recursion problem, but it does make
it a little lighter.
* daml-lf/archive: Unroll a foldLeft to reduce the stack size.
CHANGELOG_BEGIN
CHANGELOG_END
As evidenced by #8856, daml script dumps currently fail to compile if
we generate a dump including templates which are newer than the
default LF version in the compiler. This PR addresses this by
including a --target flag in the generated daml.yaml.
changelog_begin
changelog_end
This PR fix a regression performence intoriduce in #8804, were we
calculate exercise node seed twice.
Here is the result of a benchmark:
before:
CollectAuthority.bench //daml-lf/scenario-interpreter/CollectAuthority.dar CollectAuthority:test avgt 20 48.968 ± 0.667 ms/op
after:
CollectAuthority.bench //daml-lf/scenario-interpreter/CollectAuthority.dar CollectAuthority:test avgt 20 41.772 ± 0.374 ms/op
CHANGELOG_BEGIN
CHANGELOG_END
We inline the unnecessary decodeExprBody call inside decodeExpr. This
reduces the recursion depth of decoding expression inside archive,
increasing hence the depth of expression the scala part of the stack
can handle without blowing off the stack.
Before the change the test
//daml-lf/tests:test-scenario-stable-many-fields crashed 25 out of 100
runs. After the changes the test crashed not once out of 100 runs.
CHANGELOG_BEGIN
CHANGELOG_END
Renaming:
`SECatch` --> `SECatchSubmitMustFail`
`tryHandleException` --> `tryHandleSubmitMustFail`
`KCatch` --> `KCatchSubmitMustFail`
These existing types/functions are renamed to make it clear they *dont* relate to our _new_ exceptions, but are part of the legacy mechanism for handling _scenario/submit-must-fail_.
changelog_begin
changelog_end
* Factor out shared DAR encoder
changelog_begin
changelog_end
* Update daml-lf/archive/encoder/BUILD.bazel
Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
* Add a version of encode that takes a Path and document stream closing
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
* Add --target=1.12 support in the compiler.
changelog_begin
- [DAML Compiler] Add support for ``--target=1.12`` in the DAML compiler.
changelog_end
* version1_12 not version1_11
* Update codegen tests.
* Update codegen tests again
* Fix data-dependencies test.
Disabling it per target works nicely for compilation but it gets
annoying in ghci since the warnings are still triggered. We could
disable it everywhere but I think the warning is generally useful. I
tried patching proto3-suite to use DerivingStrategies but that doesn’t
work because haskell-src is dead and doesn’t support it. So for now
adding it to the per-file list seems like the best option.
changelog_begin
changelog_end
CHANGELOG_BEGIN
* LF: preview of LF 1.11. Preview versions can be changed only to
include bug fixes. Changes of LF 1.12 include:
- reduce transaction size by erasing type information in user-defined
type.
CHANGELOG_END
* Add choice observers in LF spec.
Part of #7709. Adds choice observers to the syntax, type system, and
and operational semantics of LF. Adds a test for the operational
semantics of choice observers.
changelog_begin
changelog_end
* typo
* remove duplicate rule
* Always have choice observers
* Add comment in serialization section
CHANGELOG_BEGIN
- [Daml-LF] Release LF 1.11
- add suport for Generic Map
- add support for choice observer
- add generic comparison
- add convert of contract ID to string (available only in off-ledger mode)
- reduce size of dar using type interning
CHANGELOG_END
Hence we avoid usage of the standard Global key builder which require
an extra pass to ensure the contract key does not contain contract IDs.
CHANGELOG_BEGIN
CHANGELOG_END
The ContractInstance is a concept a bit off. For instance it is not
clear why `agreementText` is more important for a contract that the
signatories, the stackholder or the key. In this PR, we get ride of
the ContractInstance inside LF code, except from the Engine/Ledger API
(com.daml.lf.engine.ResultNeedContract$)
CHANGELOG_BEGIN
CHANGELOG_END
This includes the following changes:
1. The Decoder was not verifying the value inside a node use the exact
same version as the node itself.
2. We use the node version directly in the node encoder (instead of
used versionedX node methods).
3. We avoid used of .asJava in the encoder.
4. We add test for testing the decode verify 1.
CHANGELOG_BEGIN
CHANGELOG_END
* Remove redundant list of LF versions
After #8472, I realized that there must be a list used for daml-stdlib
and daml-prim already and it turns out there is. I’ve removed that one
in favor of the one added in #8472 since I like having all in one
place and the one from #8472 is created by filtering an existing list
instead of creating a completely separate list like we do here.
changelog_begin
changelog_end
* Introduce SCRIPT_LF_VERSIONS
changelog_begin
changelog_end
We prune the code of ValueTransalation from the user-defined patterns
in the code of Speedy's ValueTranslation. In particular we remove the usage of
com.daml.lf.language.Util.TTyConApp which:
- induces bad complexity,
- make difficult optimization.
CHANGELOG_BEGIN
CHANGELOG_END
The hardcoded list is obviously garbage and didn’t include 1.11 so
this PR changes it to use the one we already have so they are always
in sync.
changelog_begin
changelog_end
The flag allows the sandboxes (both classic and next) to use preview
version of the upcoming Daml-LF version (currently LF 1.11).
CHANGELOG_BEGIN
* [Sandbox-classic] add a flag to allow early access to the next
Daml-LF to be released.
* [Sandbox] add a flag to allow early access to the next Daml-LF
to be released.
CHANGELOG_END
This PR updates scalafmt and enables trailingCommas =
multiple. Unfortunately, scalafmt broke the version field which means
we cannot fully preserve the rest of the config. I’ve made some
attempts to stay reasonably close to the original config but couldn’t
find an exact equivalent in a lot of cases. I don’t feel strongly
about any of the settings so happy to change them to something else.
As announced, this will be merged on Saturday to avoid too many conflicts.
changelog_begin
changelog_end
* Replace many occurrences of DAML with Daml
* Update docs logo
* A few more CLI occurrences
CHANGELOG_BEGIN
- Change DAML capitalization and docs logo
CHANGELOG_END
* Fix some over-eager replacements
* A few mor occurrences in md files
* Address comments in *.proto files
* Change case in comments and strings in .ts files
* Revert changes to frozen proto files
* Also revert LF 1.11
* Update get-daml.sh
* Update windows installer
* Include .py files
* Include comments in .daml files
* More instances in the assistant CLI
* some more help texts
* Port the rest //daml-lf/... to Scala 2.13
Draw the rest of the owl
changelog_begin
changelog_end
* Update daml-lf/encoder/src/main/scala/com/digitalasset/daml/lf/archive/testing/DamlLfEncoder.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Port damlc dependencies to Scala 2.13
I got a bit fed up by the fact that going directory by directory
didn’t really work since there are two many interdependencies in
tests (e.g., client tests depend on sandbox, sandbox tests depend on
clients, engine tests depend on DARs which depend on damlc, …).
So before attempting to continue with the per-directory process, this
is a bruteforce approach to break a lot of those cycles by porting all
dependencies of damlc which includes client bindings (for DAML Script)
and Sandbox Classic (also for DAML Script).
If this is too annoying to review let me know and I’ll try to split it
up into a few chunks.
changelog_begin
changelog_end
* Update daml-lf/data/src/main/2.13/com/daml/lf/data/LawlessTraversals.scala
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
* fixup lawlesstraversal
changelog_begin
changelog_end
* less iterator more view
changelog_begin
changelog_end
* document safety of unsafeWrapArray
changelog_begin
changelog_end
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
This commit fixes a few copyright headers that have been missed in the
automatic update on Jan 1, as well as the generation code in the compat
workspace so it generates the right headers.
CHANGELOG_BEGIN
CHANGELOG_END
* Port //daml-lf/interpreter to Scala 2.13
For now the perf tests are left out since they depend on a DAR built
by damlc which depends on daml script which depends on the world
:exploding-head:
changelog_begin
changelog_end
* Scala 2.13-style to for ImmArray and FrontStack
changelog_begin
changelog_end
* Avoid extra conversion
changelog_begin
changelog_end
CHANGELOG_BEGIN
* Release preview of LF 1.11. Preview versions can be changed only to
include bug fixes. Changes of LF 1.11 include:
- add support for generic map;
- add support for choice observers;
- reduce archive size thanks to type interning.
CHANGELOG_END
* Port //daml-lf/(parser|validation) to Scala 2.13
changelog_begin
changelog_end
* Rename (Expr|Type)Traversable to (Expr|Type)Iterable
changelog_begin
changelog_end
* LF: Scala type checker handle exceptions
This includes some fixes of the DAML-LF specifications.
This is part of #8020.
CHANGELOG_BEGIN
CHANGELOG_END
As we strive for more inclusiveness, we are becoming less comfortable
with historically-charged terms being used in our everyday work.
This is targeted for merge on Dec 26, _after_ the necessary
corresponding changes at both the GitHub and Azure Pipelines levels.
CHANGELOG_BEGIN
- DAML Connect development is now conducted from the `main` branch,
rather than the `master` one. If you had any dependency on the
digital-asset/daml repository, you will need to update this parameter.
CHANGELOG_END
* Port //daml-lf/data to Scala 2.13
changelog_begin
changelog_end
* factor common ImmArraySeq code to version-agnostic file
- ImmArraySeq itself is agnostic; the 2.12 and 2.13 versions contain
implementation mixins/superclasses for parts that must be specific. The 2.13
version will collapse into the agnostic version when 2.12 support is no longer
desired
* factor common InsertOrdMap code to version-agnostic file
- InsertOrdMap itself is agnostic; the 2.12 and 2.13 versions contain
implementation mixins/superclasses for parts that must be specific. The 2.13
version will collapse into the agnostic version when 2.12 support is no longer
desired
* factor common InsertOrdSet code to version-agnostic file
- InsertOrdSet itself is agnostic; the 2.12 and 2.13 versions contain
implementation mixins/superclasses for parts that must be specific. The 2.13
version will collapse into the agnostic version when 2.12 support is no longer
desired
* factor Map removal
* Move ImmArraySeq back into ImmArray
changelog_begin
changelog_end
* Type assertion instead of symbol
changelog_begin
changelog_end
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
* Update protobuf to throw exceptions directly.
Part of #8020. This PR changes the exception protobuf and AST (Haskell
side) to make exceptions be thrown directly via a primitive expression
(EThrow), instead of wrapping them up via AnyException.
changelog_begin
changelog_end
* Rename MakeAnyException to ToAnyException
* update EToAnyException field names
* Missing stuff
* missing scala case
* Make AnyException unserializable
* reindex protobuf builtins
* meaningless change
* refrobulate
* change pretty
* Make choice observers mandatory when available.
This is an invariant of the DAML-LF proto.
The haskell AST allows missing choice observers for any version, because the AST represents what was written in the syntax. However, if we are targeting a new DAML-LF version (>= `featureChoiceObservers`) then `Nothing` is converted to `Just (ENil TParty)` by the haskell encoder (`EncodeV1.hs`) to satisfy the proto invariant.
On the scala side, the decoder (`DecodeV1.scala`) now insists that choice observers are present when_ the version is new. (>= `LV.Features.choiceObservers`).
changelog_begin
changelog_end
* LF: LF encoder generate always choice observer if lf >= 1.dev (#8318)
This is a follow up of #8316.
This advances the state of #7709
CHANGELOG_BEGIN
CHANGELOG_END
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Upgrade Scala dependencies for 2.13 compatibility
This upgrades a bunch of Scala libraries to versions that have 2.13
support. There are two libraries that are still missing:
- diffson, this has a new version but with significant breaking
changes and it is only used in Naigator console which I hope to kill
before I have to worry about this.
- ai.x:diff, this is used in the ledger API test tool. The library is
abondened but there are a few alternatives.
changelog_begin
changelog_end
* Fix pureconfig
changelog_begin
changelog_end
* Fix Navigator
changelog_begin
changelog_end
We use the constants defined in LanguageVersion/TransactionVersions instead
repeating the somewhat magic constants "6", "7", "8", "10" and "dev" in multiple places?
CHANGELOG_BEGIN
CHANGELOG_END
We drop the distinction (at the type level) of Dev and Stable language
version. The two main reason that motivate this choice:
* we never really used this distinction.
* we want to add the concept of "preview" version (which is neither Dev nor Stable)
CHANGELOG_BEGIN
CHANGELOG_END
Changes:
- replaced submitter: Party with actAs: Set[Party] and readAs: Set[Party] in com.daml.ledger.api.domain.Commands
- adapted contract and key lookups for multi-party submissions
* Changed single Commands to accept multiple submitters
* Removed submitter field from Commands
* Replaced submitters with actAs and readAs in Commands
* Moved actAs and readAs to com.daml.ledger.api.Commands
* Contract lookup tests
* Key lookup tests
CHANGELOG_BEGIN
CHANGELOG_END
* Formatted code changes
* Remove unused method
* Formatting fixes
* Simplified logical condition for active contracts visibility
* Removed unused temporary method in Commands
* Unified contract key lookup query for different type of db types
* Simplified ContractReader class structure
* Improved dao unit tests
* Unit tests for lookups as a divulgee
* Reduced code duplication in unit tests
* Minor improvement
* Formatted code
* Fixed a ContractsReader's query
* Improved unit tests
* Explanation for engine's command authorizers and contract readers
* Minor fixes
* Adapted SpannedIndexService for the multi-party submission
* Improve error messages on use of contract ids in contract keys
We got some feedback that "Unexpected contract id" sounds like an
internal error whereas this is really a user error.
changelog_begin
changelog_end
* Include templateId in error message
changelog_begin
changelog_end
With this PR, the Repl now:
* outputs the transaction version (not sure why it was not
there before)
* outputs the node version, because each node is now versioned
independently (See #7788)
* drops the value version, because it is dictated by the node version
(See #7788)
CHANGELOG_BEGIN
CHANGELOG_END
This is necessary to at least attempt an upgrade to 2.13 and
generally, I want to keep our rulesets up2date. rules-scala forces the
version of scalatest so we have to bump that at the same time.
This requires changes to basically all Scala test suites since the
import structure has changed and a bunch of things (primarily
scalacheck support) got split out.
Apologies for the giant PR, I don’t see a way to keep it smaller.
changelog_begin
changelog_end
We have a builtin SBConsMany use to concatenate a list with a prefix
of variable size. Its appear that most of the concatenation happens
with only one element. For this reason we add a new builtin to handle
the most efficiently possible the case with 1 element.
CHANGELOG_BEGIN
CHANGELOG_END
CHANGELOG_BEGIN
- [DAML-LF] Some types that were deprecated in DAML 1.4 have been
removed. Please fix any deprecation warnings by using the new types
before upgrading.
CHANGELOG_END
* Bazel: Reduce the visibility of some Protobuf targets.
* Bazel: Make Protobuf JAR visibility parameterizable.
Default to private, and explicitly make it public where it's needed.
CHANGELOG_BEGIN
CHANGELOG_END
* Tail-recursive function definitions execute with bounded environment and continuation stacks.
changelog_begin
changelog_end
* be more precise about the throw exception; use thrownBy
* add test for the KFoldr1Map/Reduce case
* Multiple submitters field for Command
* Multiple submitters field for Engine API
* Tests for multi-party submissions in Engine
* Make use of multi-party Engine capabilities in the engine benchmark
* Enable multi-party submission in Engine's API
CHANGELOG_BEGIN
CHANGELOG_END
* Separate unit tests for multi-party engine
* Unit tests for multi-party submission transaction replay
* ledger-api: Use `proto_jars`.
CHANGELOG_BEGIN
- [Ledger API] The Scala JARs containing the gRPC definitions no longer
contain the *.proto files used to generate the ScalaPB-based classes.
CHANGELOG_END
* Create a source JAR for *.proto files in `proto_jars`.
* ledger-api: Publish the protobuf sources as "ledger-api-proto".
CHANGELOG_BEGIN
- [Ledger API] The *.proto files containing the gRPC definitions are now
provided by a new Maven Central artifact, with the group "com.daml"
and the artifact name "ledger-api-proto".
CHANGELOG_END
* release: We don't need the "main-jar" option.
* Bazel: Proto JARs will always have a Maven artifact suffix.
* Bazel: Simplify Protobuf source file TAR and JAR targets.
* Bazel: Extract out Protobuf functions.
String validators from com.daml.lf.data.IdString are use extensively.
This PR optimize the implementation of some of those.
CHANGELOG_BEGIN
CHANGELOG_END
* WIP Draft of formal exception semantics
CHANGELOG_BEGIN
CHANGELOG_END
* Make throw take an AnyException
* Don't allow templates as exceptions
* Make throw a builtin
* Pass the textual error message to to_any_exception
* Rename builtin exceptions to errors
* Rename to_any_exception in make_any_exception
* Fix typing rules for make/from_any_exception
* Add availability notes
* Fix typo
* simplify interface to construct speedy continuations
move code from caller to definition
* relocate comment to the relocated code it refers to!
changelog_begin
changelog_end
* rename var: m -> machine
* relocate instrumentation print() from where KFinished is thrown, to where it is handled in run()
* revert KFinished back to an object (instead of a class taking machne); and revert back to use initialKontStack()
Turns out the `package_dir` is not what we're looking for. Omitting it
fixes the path.
_Before:_
```
1766 2010-01-01 00:00 protos-0.0.0/com/digitalasset/daml_lf_1_8/com/digitalasset/daml_lf_1_8/daml_lf.proto
```
_After:_
```
1766 2010-01-01 00:00 protos-0.0.0/com/digitalasset/daml_lf_1_8/daml_lf.proto
```
CHANGELOG_BEGIN
CHANGELOG_END
* kvutils: Use ScalaPB to generate a Scala JAR for daml_kvutils.proto.
* Bazel: Delete the unused `da_java_binary` rule, and inline `_wrap_rule`.
* Bazel: Factor out Java/Scala protobuf class generation into a helper.
CHANGELOG_BEGIN
CHANGELOG_END
* daml-lf/archive: Use `proto_jars`.
* Bazel: Remove the visibility modifier from `proto_jars`.
It's too confusing. Just make everything public.
* daml-lf/archive: Push protobuf source tarballs into `proto_jars`.
* Bazel: Add comments to the various parts of `proto_jars`.
* daml-assistant: Do unpleasant things with `location` in Bazel.
As requested by Martin in #8069, we extract most of the changes from
DecodeV1Spec in a separate PR.
This advances the state of #7155
CHANGELOG_BEGIN
CHANGELOG_END
CHANGELOG_BEGIN
kvutils reports LookupByKey node mismatches during validation as Inconsistent
instead of Disputed if they can be due to contention on the contract key
CHANGELOG_END
* Refactor indexing to minimize transaction traversals
changelog_begin
[Integration Kit] Bugfix: daml.index.db.store_transaction metrics were keeping track of empty insertions, skewing down the numbers
[Integration Kit] Performance: minimizing the number of traversals of a transaction to index it, more efficient indexing
changelog_end
* Add empty stakeholders for non-consuming exercises
* Fix test to check usage of pre-computed blinding info
* Remove unnecessary string interpolators
* Shorten creation of net visibility
* Delete obsolete comment
* Add visibility of divulged contracts
* Address review https://github.com/digital-asset/daml/pull/8019#discussion_r527666572
* Address review https://github.com/digital-asset/daml/pull/8019#pullrequestreview-535399441
* Address review https://github.com/digital-asset/daml/pull/8019#discussion_r527681774
* Fix ordering of batches, use explicitly named types to avoid confusion
* Default to an empty set if a divulged contract is not visible in the current transaction
* Shorten references to store transaction metrics when writing
* Address review https://github.com/digital-asset/daml/pull/8019#discussion_r527745640
* Add divulgences from past transactions
* More fine-grained types and signatures
Add a description of how to enable LaTeX input mode when editing the
DAML-LF spec in VS Code. Also add some additional symbols.
CHANGELOG_BEGIN
CHANGELOG_END
* Adapt to new desugaring for choice observers.
update hash of ghc patch.
changelog_begin
changelog_end
update ghc patch to final version
update stack-snapshot hashes for ghc-lib(-parser)
update stackage_snapshot.json, following `bazel run @stackage-unpinned//:pin`
expose Optional constructors for desugared code to use
adapt LFConversion to expect a 4-tuple for a desugared choice def/sig
update LFConversion for choice-observers
first example using new choice observer syntax.
fix scala type checker to have correct scoping rules for choice-observers
remove comment from example which says it is broken
improve variable names
improve tests for choice-observer clause
only test choice-observers SINCE 1.dev
add jq queries for choice observeres
make positive statement in jq test which checks choice obserers are present
test behaviour of choice observers
squash me
typo
* test more choice-observer divulgence
* Update documention for choice observers.
changelog_begin
Support choice observers in 1.dev
changelog_end
* fix docs build
* fix daml docs choice-observers example
* address comments: rewording text
* annotate choices observers as early-access in documention
* split out documentation code-snippets which require --target=1.dev
* final tweaks to documentation text
* DAML-LF: Add interning for type to DAML-LF 1.dev
We add two new features to DAML-LF 1.dev:
* a per package list (or table) of `Type` messages, and
* a new case in the `Type` message which is an index into this table.
In combination, these two features can be used to allow DAML-LF
encoders to perform hash-consing of `Type` messages. We also change the
Haskell implementation of our DAML-LF encoder to do exactly that when
targetting DAML-LF 1.dev.
Doing this has a few benefits:
1. The DALFs produced by `damlc` get smaller: I've seen a case where
the size dropped from 69MB to 45MB.
2. DAML-LF decoders need to decode less data.
3. Decoded packages use less memory because identical structures are
now shared. This is particularly helpful in situations where we need
to keep the interface (or signature) of a package in memory for a
long time.
This PR mostly takes care of the Haskell implementation. However, we
need to make the Scala implementation of the decoder aware of the new
features as well since we have tests that load DAML-LF 1.dev into the
engine. A decoder and _targeted_ tests on the Scala side will follow
in a separate PR.
CHANGELOG_BEGIN
CHANGELOG_END
* Make jq tests aware of type interning
CHANGELOG_BEGIN
CHANGELOG_END
* Improve jq test
CHANGELOG_BEGIN
CHANGELOG_END
* Apply Remy's suggestions
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Improve the imperative bits
CHANGELOG_BEGIN
CHANGELOG_END
Co-authored-by: Remy <remy.haemmerle@daml.com>
We introduce in #7835 VersionedNode which associate to each node a
version. In this PR, we update Transaction validation to take into
account this version when comparing nodes.
This advances the state of #7788
CHANGELOG_BEGIN
CHANGELOG_END
Following what have been done in #7944, we add a check in the Scala
version of the LF type checker that rejects invalid kinds (i.e. kinds
of the form k -> Nat).
This PR does the "Scala side" of #7917.
CHANGELOG_BEGIN
CHANGELOG_END
* Require pattern match exhaustiveness in spec.
Changes the rules for case expressions to require exhaustiveness.
This involves moving out the "well-formed case alternative" rules
to a separate judgement, and introducing a "pattern match
exhaustiveness" judgement.
The symbol ⊲ used for pattern match exhaustiveness comes from
sheaf theory and formal topology, where "A ⊲ B₁, …, Bₙ" means
"A is covered by { B₁, …, Bₙ }", indicating an exhaustive
coverage of A by possibly overlapping conditions B₁, …, Bₙ.
For example, see [this nlab page](https://ncatlab.org/nlab/show/posite).
It seemed appropriate.
changelog_begin
changelog_end
* rst syntax
* fix ExhaustVariant and some weird other syntax
* review comments
Remove file describing how contract key will be implement. The file
is not usefull as contract key have been fully implemented. Futhermore
the file contains plenty of out of date information.
CHANGELOG_BEGIN
CHANGELOG_END
This PR prepares the change of inference algorithm described #7788
where each node is version independently. This PR associates to each
node of `VersionedTransaction` a version. In the current state, all
nodes are associated to the version of the transaction itself. The
inference algorithm (that will make those versions potentially
distinct) will be implemented in an upcoming PR.
CHANGELOG_BEGIN
CHANGELOG_END
This PR fixes two bugs in the type checker:
- Fetch are now rejected if the type constructor does not match a
template
- to_any, from_any, and type_rep are now rejected if the type
parameter contains synonyms.
Additionally, this PR adds the type of the validation error that each
test case should throw in the test that ill formed expression are
properly rejected. In the way we fix some wrong test cases.
CHANGELOG_BEGIN
CHANGELOG_END
- Exercises' results are checked after the children have been checked.
- output the mismatching nodes in case of comparison failure.
CHANGELOG_BEGIN
CHANGELOG_END
* DALF Reader: Refactor decoder environment
Currently, the module to be decoded is part of the decoder environment.
This turned out to be unpleasant during my attempts to implement
interning for types since decoding the type interning table does not
happen in the context of a module.
This PR moves the module out of the decoder environment and passes it
to the decoder function for modules directly. Unfornatunately, we still
need to keep the module name in the environment since that is used as a
default when decoding location information. We solve this problem by
making the module name in the environment optional and always filling
it in when decoding in actual module.
CHANGELOG_BEGIN
CHANGELOG_END
* Adapt tests
CHANGELOG_BEGIN
CHANGELOG_END
* Follow Remy's suggestion
CHANGELOG_BEGIN
CHANGELOG_END
This PR drops support for Transaction version 1 to 9. This is a
breaking change that may affect only ledger created with a pre SDK
1.0.0. No Sandbox-based ledger is affected by this change.
This advances the state of #7788
This breaking change was approved by the architecture committed.
CHANGELOG_BEGIN
CHANGELOG_END
* LF: Rotate type checking of case expressions by 90 degrees
This reproduces changes made to the Haskell type checker (in #7873)
into the Scala type checker.
CHANGELOG_BEGIN
CHANGELOG_END
Add two more tests for the following cases:
1. The Expressions the values should be updated with are non-atomoic.
This tests that our internal ANF transformation doesn't destroy the
omptimization. (In fact, it can't really do that because it is run
after the phase which does the optimization. But better safe than
sorry.)
2. A single record field is updated multiple times. This tests that
the last update wins. Unfortunately, we cannot drop the earlier
updates, or at least computing their values, since these values
might be bottom. (We could add an optimization _after_ we've
transformed into ANF but I don't expect any benefits from this in
practice and would hence not do it.)
CHANGELOG_BEGIN
CHANGELOG_END
* Cache computation of top-level values at definition level
Earlier the computation of a top-level value was only cached at the
use-site in SEVal. This introduces SDefinition which contains the same
mechanism as SEVal to cache the computation.
As expected this does not impact performance much:
before: CollectAuthority.bench //daml-lf/scenario-interpreter/CollectAuthority.dar CollectAuthority:test avgt 40 44.267 ± 0.728 ms/op
after: CollectAuthority.bench //daml-lf/scenario-interpreter/CollectAuthority.dar CollectAuthority:test avgt 40 43.693 ± 0.702 ms/op
What this does have a significant impact is on reducing the number of distinct
SValues for things like type class dictionaries etc, so that now we have one
SValue per dictionary rather than one per SEVal.
CHANGELOG_BEGIN
CHANGELOG_END
* Address code review
* Fix speedy tests
* Fix scenario service vs struct projections bug
In a recent change, we have sped up the projection from structural
records by means of an inference in the DAML-LF type checker. This
change was made under the assumption that users of the DAML interpreter
run through package validation before compiling to the internal Speedy
AST. Unfortunately, that assumption was wrong and not covered by our
existing tests. Manually testing of a new release candidate reminded us
of the fact that the scenario service skips package validation for the
sake of faster response times in the IDE.
This PR drops the assumption that package validation is always run.
Instead, we add the old implementation of struct projection, which works
without DAML-LF type checking, back and use it whenever the AST has not
been annotated with the information inferred by the type checker. We do
the same for struct updates.
We improve test coverage by _additionally_ running the `damlc`
integration tests without package validation for the latest stable
version of DAML-LF and DAML-LF 1.dev. These tests would have caught the
issue we only discovered during manual testing.
CHANGELOG_BEGIN
CHANGELOG_END
* Add some explanations
CHANGELOG_BEGIN
CHANGELOG_END
* choice observers, WIP
changelog_begin
changelog_end
fix generator driven test
Node.isReplayedBy, consider observers
add observers to NodeExercise in transaction.proto
add observers to TemplateChoice in Ast.scala
add observers to LF .proto, and Haskell Ast for TemplateChoice
reinstate trailing // for better format
fix validate tests
fix haskell LF decoder when choice-observers field is missing in .proto
fix build
make choice-observers optional in scala AST
make choice-observers optional in Haskell Ast
address comments from Remy and Martin
more review comments
check TransactionVersions.minChoiceObservers in Transaction encode/decode
featureChoiceObservers, and check in haskell type-checker
improve speedy Compiler for empty choice-observers
extend scala LF decoder for optional choice observers
extend scala parser for choices to allow optional choice-observers clause, and test
rename new field in scala Ast -> "choiceObservers"
var rename
extend TypingSpec tests for choice-observers. also add missing negative test for controllers
switch from keyword "ob" to identifier "observers" in scala parser choice syntax
add TODO for featureChoiceObservers to be part of DAML 1.9 (issue 7139)
* replace "NICK" comment markers with "FIXME #7709" comment markers
* Regularize scala mod-parser syntax for controllers in preparation for adding choice-observers.
From keyword "by" to identifier "controllers" + leading ","
changelog_begin
changelog_end
* fix another use of the old "by" syntax -> ", controllers"
This is pretty much a verbatim copy of
https://github.com/digital-asset/daml/pull/7740, but for updates of
structural records instead of projections.
This has no immediate performance impacts since the DAML compiler does
_currently_ not produce any structural record updates. Having both,
projections and updates, have the same runtime characteristics seems to
be a desirable property nevertheless, simply to avoid nasty surprises
should we ever start to use these updates.
Since the compiler does not produce any structural record updates, I
have no way to benchmark this. However, since the code is changed here
in the same way it was changed in the PR mentioned above, I expect the
same saving, which were roughly 80 ns per operation, where the previous
cost of an operation was _at most_ 210 ns.
CHANGELOG_BEGIN
CHANGELOG_END
* Speed up projections of structural records
Currently, for every projection of a structural record, we first do a
linear search through the field names to find the index of the field
value in the record value. Then we use this index to get the actual
value. However, since we started sorting the fields in alphabetic order
both in types and in values, this lookup will always yield the same
result for a fixed record type and a fixed field name, regardless of the
value of the record.
This PR changes the AST node for structural record projection to
contain the index of the field within the record as well. This
information is not contained in the DAML-LF archive itself and must
hence be filled in by the DAML-LF type checker.
The only context in which we use structural record prejections are
typeclass method invocations, which do a little bit more than just the
projection. Unfortunately, typeclass method invocations are the small
unit of work I can benchmark using the setup I have. In the end, they
are also the feature our users really care about.
My benchmarks show that the time a single typeclass method invocation
takes has dropped from ca. 210ns to ca. 130ns. That's a speedup of
ca. 1.6x.
CHANGELOG_BEGIN
[DAML Interpreter] Typeclass method invocation is now 1.6x faster.
CHANGELOG_END
* Apply Remy's suggestions
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Make it compile again
CHANGELOG_BEGIN
CHANGELOG_END
Co-authored-by: Remy <remy.haemmerle@daml.com>
This fixes a bug in the Speedy interpreter. With this change, the
interpreter crashes if it attempts to fetch using a contract key that
has an empty set of maintainers. This propagates to exerciseByKey as
this command is compiled using fetchByKey speedy built-in.
This is a breaking change approved by @bame-da .
CHANGELOG_BEGIN
[LF] (Bug fix) enforce non-empty maintainers in contract key during fetchByKey and exericiseByKey.
CHANGELOG_END
As part of multi-party read/write on command submissions we also need
to be able to support multi-party queries in DAML Script. Since the
queries in DAML Studio go via ParticipantView, this PR extends this as
a prerequisite to making use of this in DAML Script.
This does not yet relax any restrictions on command submissions. Those
still require a single committer.
For consistency with the surrounding code, I went for a simple Set
rather than a non-empty Set.
changelog_begin
changelog_end
* add silent_annotations option to da scala bazel functions
* use silent_annotations for several scala targets
* use silencer_plugin instead when the lib isn't used
* use silent_annotations for several more scala targets
* use silencer_lib for strange indirect requirement for running tests
* no changelog
CHANGELOG_BEGIN
CHANGELOG_END
* silent_annotations support for scaladoc
Currently the list of node that correspond to a "by key" operations
is tracked in the Transaction metadata. this PR move this information
into the nodes themself.
This is a preparatory work to include this information in the serialization
format for transactions
This advances the state of #7622
CHANGELOG_BEGIN
CHANGELOG_END
* LF: enforce non-empty maintainer in contracts key lookup
This fixes a bug in the Speedy interpreter. With this change, the
interpreter crashes if it attempts to lookup using a contract key that
has an empty set of maintainers.
This is a breaking change approved by Bernhard Elsner.
CHANGELOG_BEGIN
- [LF] (Bug fix) enforce non-empty maintainers in contract key during
lookupByKey.
CHANGELOG_END
* Apply suggestions from code review
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Address Moritz's review.
* Address Martin's review
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
This PR creates 3 validation modes:
* `Strict`: Specifies that the committer should validate the package
before committing them to the ledger. When using this mode, the
packages committed to the ledger can be fully trusted and do not
have to be validated when loaded into the engine.
* `Lenient`: Specifies that the committer should perform a fast
validation of the packages before committing them to the ledger.
This mode is useful for ledger integrations that cannot handle
long-running submissions (> 10s). When using this mode, the
packages committed to the ledger cannot be trusted and must be
validated every time they are loaded into the engine.
* `No`: Specifies that the committer should not perform any
validation the packages before committing them to the ledger. This
should be used only by non distributed ledgers, like DAML-on-SQL,
where the validation done in the API server can be trusted.
This PR creates 3 preloading modes:
* `Synchronous` : Specifies that the packages should be preloading
into the engine before committed.
* `Asynchronous`: Specifies that the packages should be preloaded into
the engine asynchronously with the rest of the commit process. This
mode is useful for ledger integrations that cannot handle
long-running submissions (> 10s). Failure of the preloading process
will not affect the commit.
* `No`: Specifies that the packages should not be preloaded into
the engine.
CHANGELOG_BEGIN
- [Integration Kit] In kvutils, add metric
daml.kvutils.committer.package_upload.validate_timer to track
package validation time.
CHANGELOG_END
This fixes a bug in the Speedy interpreter. With this change, the
interpreter crashes if it attempts to create a contract containing a
contract key that has an empty set of maintainers.
This is a breaking change approved by Bernhard Elsner.
CHANGELOG_BEGIN
- [LF] (Bug fix) enforce non-empty maintainers in contract key during
contract creation.
CHANGELOG_END
* LF: force `actor` field in Exercise Update to be undefined.
This PR forces the field 'actor' from 'Upate.Exercise' to be undefined
starting from LF 1.5.
This breaking change is approved by Bernhard Elsner and Shaul Kfir.
It will affect only handcrafted LF archives, as no compiler from SDK
1.0.0 or latter made use of this field.
CHANGELOG_BEGIN
CHANGELOG_END