Prohibit contract IDs in contract keys and add key maintainers to exercises
CHANGELOG_BEGIN
- [DAML-LF] Prohibit contract IDs in contract keys completely. Previously, creating keys containing absolute (but not relative) contract IDs was allowed, but `lookupByKey` on such a key would crash.
CHANGELOG_END
Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Stephen Compall <scompall@nocandysw.com>
The docs build is currently not reproducible as it include to-the-minute
time-of-build information. It also includes some Sphinx binary caches
which I suppose will also not be reproducible (though I have not checked
the details there).
This commit attempts to remove all sources of non-reproducibility from
the docs build, though this is hard to test without having a stable,
older release to compare with.
CHANGELOG_BEGIN
CHANGELOG_END
* language: bazel rules for daml-json-types/daml-ledger-fetch
This moves the daml-json-types/daml-ledger-fetch libraries out of the
tests directory and builds them with bazel. We'll rename these libraries
in a follow up PR.
CHANGELOG_BEGIN
CHANGELOG_END
* Update deps.bzl
Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
* updated package.json
* rename nodejs patch
* update yarn.lock
* update @bazel/bazel dependency
* wrong typescript version in toplevel package.json
Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
* Test data-dependencies for more LF version combinations
This PR extends the cross-LF version tests to run for all
combinations where depLfVer >= targetLfVer.
changelog_begin
changelog_end
* Fix comments and add TODO
This PR fixes a minor issue where we were including more references
than we need which causes problems on older SDKs where GHC.Prim is not
a stable module since GHC.Prim cannot be imported (it’s builtin GHC
magic).
More importantly, this PR adds a test for cross-SDK data-dependencies
against the DAVL DAR which is built with SDK 0.13.32 before we started
making all the changes. The test also includes a slightly hacky but
mostly reasonable way of actually using the templates instead of just
the data types from the DAVL DAR which and a scenario to test this.
changelog_begin
changelog_end
* daml2ts: Isolate tests better
Currently, the `sh_test` for `daml2ts` copies too many files into the
temporary directory where the test is run. This can cause issues with
stale files from development experiments being copied into the test.
This PR addresses the issue by exluding some directories which only
contain generated files.
CHANGELOG_BEGIN
CHANGELOG_END
* Exclude `node_modules` from buildifier check
Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
This fixes the ZIP modification times in all DARs to a specific
value (1980-01-01) whereas they used the current time before. This
both gives us the nice property that not only our DALF builds but also
DAR builds should be deterministic (and there is a test for this). I
have a suspicion that this could help significantly with build times
and avoid rerunning half of the Scala tests on a change to damlc that
should not change the DALFs.
changelog_begin
- [DAML Compiler] The modification times in a DAR are now fixed to a
given value which makes the output of ``daml build`` deterministic
in single-threaded mode (which is the default).
changelog_end
* First cut at generalized type
changelog_begin
changelog_end
* Update code gen and test
Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
* Navigator: Fixes dependencies
This PR fix the navigator decencies that were remove a bit too eagerly in f33e79c787 (#3938)
* changelog
CHANGELOG_BEGIN
CHANGELOG_END
* formatting
* formatting
* Implement exercise by key
ExerciseCommand got a new required element: `reference` of polymorphic type.
* Add test case: exercise Archive by contractKey
* Add test case for ExerciseCommand JSON protocol
* flatten contract reference in ExerciseCommand JSON protocol
* formatting
* Update exercise by key
* Update documentation
CHANGELOG_BEGIN
- [JSON API - Experimental] Support Exercise by Key. See #4009.
CHANGELOG_END
* Address code review comments
* for searchForever, use a similar response format to exercise results
CHANGELOG_BEGIN
- [JSON API - Experimental] Response format in ``searchForever`` changed to be more like ``exercise``.
See `issue #4072 <https://github.com/digital-asset/daml/issues/4072>`__.
CHANGELOG_END
* typo left from add->created replacement
Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
* in query argument, rename %templates to templateIds, and nest query under 'query' field
CHANGELOG_BEGIN
- [JSON API - Experimental] In 'search' endpoint arguments, %templates is now templateIds.
Additionally, all contract query fields must occur under 'query'.
See `issue #3450 <https://github.com/digital-asset/daml/issues/3450>`__.
CHANGELOG_END
* fix other old query format usages
This PR fixes a whole bunch of bugs when using data-dependencies on a
package produced by damlc rather than the handcrafted simple-dalf.
The end result is that we are able to build a package with
`--target=1.6` and use it as a data-dependency from a package with
`-target=1.7`. While the test that I’ve added for this is not
cross-SDK it is arguably even trickier since we cannot rely on the
unit id of daml-stdlib changing the version in the unit id.
The changes all fall into one of the following two categories:
- Special handling for daml-prim and daml-stdlib to avoid collisions
with the one from the current SDK.
- Special treatment of stable packages to avoid generating new code
for those.
- Remove a couple of filters for daml-prim since we do need to include
daml-prim from a data-dependency if it is a different version.
This is definitely not perfect and there are a bunch of rather hacky
parts in here but it seems like a good intermediate step (and it has a
test :))
changelog_begin
changelog_end
This was accidentally set to 1.7 before for no reason. Note that this
simply meant that we did not use the stable module when compiling with
--target=1.6 since we filter out newer stable packages.
Nevertheless, I’ve also added a test that verifies that we do not
accidentally introduce dependencies on packages in newer LF versions.
changelog_begin
changelog_end
* sandbox: Tidy up the RecoveringIndexerSpec a little.
* sandbox: Move the JdbcLedgerDao owner constructor to its object.
* sandbox/damlonx: Make sure the RecoveringIndexer terminates.
Previously, if there was a failure and a termination at the same time,
we could recover after terminating, which means we'd end up in a weird
state. This makes sure we stop correctly.
Unfortunately, I couldn't find a good place to put these tests apart
from in reference-v2, as they need to depend on both _kvutils_ and
_sandbox_. Perhaps they belong in their own Bazel package.
This might address #3945; it's hard to say.
CHANGELOG_BEGIN
- [Indexer] Potentially fix a bug when recovering from failure.
CHANGELOG_END
* reference-v2: Address a race condition in the IndexerIT assertions.
* sandbox: Make sure the RecoveringIndexer can stop during a restart.
* reference-v2: Use Mockito to simulate errors in IndexerIT.
* sandbox: When the RecoveringIndexer is stopped, stop quickly.
* reference-v2: Make sure each test has its own metrics registry.
* Replace TestNamedLoggerFactory with in-memory appender
* sandbox: Test RecoveringIndexerSpec with a mock logger.
Using a real logger was causing massive stack traces in all other tests
that didn't have `RecoveringIndexerSpec$Appender` available, and adding
the appender programmatically didn't work for some reason.
The mock gives much nicer error messages on failure, too.
Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
* Try to improve the docs on DA.Internal.Template.Functions a little.
* More docs.
changelog_begin
- [DAML Standard Library] The ``Template``, ``Choice``, and
``TemplateKey`` typeclasses have been split up into many small typeclasses
to improve forward compatibility of DAML models. ``Template``,
``Choice`` and ``TemplateKey`` constraints can still be used as before.
changelog_end
* Example typo
* Bump ghcide to include bugfix
This includes a fix for a bug in completions which we introduced in
the latest ghcide bump which in turn broke the DAML IDE completely.
changelog_begin
- [DAML Studio] Fix a bug in completions that caused DAML Studio to
stop responding after the first completion was requested.
changelog_end
* Use ghcide from master branch and simplify test
* libs-scala/resources: Move `Resource` and friends to their own package.
CHANGELOG_BEGIN
- [Ledger API Server] Publish the resource management code as a library
under ``com.digitalasset:resources``.
CHANGELOG_END
* libs-scala/resources: Add to the artifacts list.
* libs-scala/resources: Factor out the test helpers into test/lib.
* libs-scala/resources-akka: Make the Akka resources an optional dep.
* EC256 rather than EC512 algo
CHANGELOG_BEGIN
[Ledger API Authorization]Support EC256 algorithm for JWT rather than EC512
CHANGELOG_END
* support both 256 and 512 ECDSA algo
Signed-off-by: Brian Healey <brian.healey@digitalasset.com>
* scalafmt
* correct comment, avoid unnecessary private def
Signed-off-by: Brian Healey <brian.healey@digitalasset.com>
* correct BAZEL formatter
* Introduce ContextualizedLogger and LoggingContext
A ContextualizedLogger is a wrapper around an Slf4j logger. It uses
call-by-name parameters to only construct logging lines when necessary.
The underlying context can be used by invoking withoutContext.
More interestingly, every call to one of its logging methods requires
the presence of an implicit LoggingContext.
A LoggingContext is a way of definining a set of pairs that a
ContextualizedLogger can log without the need of it being specified for
every call.
A new context can be created with newLoggingContext and, given an
implicit LoggingContext, pairs can be added or overwritten using
withEnrichedLoggingContext.
Pairs in the context will be appended to each event logged by a
ContextualizedLogger in the following form:
some text logged explicitly (context: {key1=value1, key2=value2)
If the underlying Logger is configured to use the Logstash encoder the
keys and values in the LoggingContext will also be added to the logging
event encoded in JSON format.
CHANGELOG_BEGIN
CHANGELOG_END
* Apply suggestion in https://github.com/digital-asset/daml/pull/4046#pullrequestreview-343224692
Thanks to @SamirTalwar
Co-Authored-By: Samir Talwar <samir.talwar@digitalasset.com>
* Address https://github.com/digital-asset/daml/pull/4046#discussion_r366874330
Co-authored-by: Samir Talwar <samir@noodlesandwich.com>
* ledger-on-sql: Implement a ledger using the simplified kvutils on JDBC.
This tests against H2; PostgreSQL coming soon.
No changelog because we're not shipping this yet.
CHANGELOG_BEGIN
CHANGELOG_END
* kvutils/app: Extract ledger construction into a trait.
* ledger-on-sql: Run the conformance tests against H2.
* ledger-on-sql: Use H2-specific queries to perform actions atomically.
* ledger-on-sql: Extract queries to `Queries` and `H2Queries`.
* ledger-on-sql: SQLite can't have more than one connection at a time.
* ledger-on-sql: Run conformance tests against SQLite.
* ledger-on-sql: Fix error message if the JDBC URL is missing.
Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>
* kvutils/app: Rename LedgerConstructor to LedgerFactory.
* ledger-on-sql: Don't release connections early.
* ledger-on-sql: Rename `withConnection` so it's more meaningful.
* ledger-on-sql: Use a sequential log entry ID.
* ledger-on-sql: Disable H2 conformance tests.
Until we can figure out why some fail.
Co-authored-by: Gerolf Seitz <gerolf.seitz@digitalasset.com>
* minor improvements on websocket and add websocketIT
* add it for websocket, and support config args
* add one more test case
* make ws config optional
* avoid fromTryCatchNonFatal when derivative already exists
* spelling and missing type parameter
* use richer Matchers in WebsocketServiceIntegrationTest
* scalafmt
* IDEs may love braces but we don't
* utility for simplifying FanOutShape2s; use in ContractsService
* split matSecondOut into generalization; make compile again
* match matSecondOut utility with standard utility methods
* spelling
* getCreatesAndArchivesSince doesn't need to query the transaction boundary
* boolean newtype utility
* split up transactionMessageHandler into components
* decodeAndParsePayload passes through the Jwt
* clean up config and default WS config
* take multiple template IDs for insertDeleteStepSource
* replace websocket return with {errors, add, remove}, based on acsFollowingAndBoundary
* parse ValuePredicate in websocket
* remove unused lfvToJson
* nominal internal state for emitted WS steps-and-errors
* missing copyright headers
* add filtering to convertFilterContracts
* add step conflation to websocket output
* move conflation to static function
* rename /transactions endpoint to /contracts/searchForever
* empty requests are not allowed; numConns is per-service
* option for GetCreatesAndArchiveSince to not terminate; use in WebsocketService
* start of searchForever documentation
* stub searchForever longer test
* use valueOr
* don't run all other tests again with WebsocketServiceIntegrationTest
* start of websocket delta test
* solve init order problem with AbstractHttpServiceIntegrationTestFuns
- previous order caused test set to be cleared; mutation is intuitive
for sure!
* full flow test, fails for lack of create/exercise yet
* passing full flow test
* full documentation examples
* rename add/remove to created/archived
* cleaner NewBoolean.Named
* document heartbeats
* document subprotocols for searchForever
* note about the tests mysteriously terminating
* ensure create has happened before attempting query in tests
* reorganize multi-step WS test so its states and assertions are clearer
* filter out heartbeats in raw string tests
* factor out ContractDelta
* make exercisePayload easier to read
* filter out heartbeats in conversation test
* remove type lambda
* accept chunked queries
- clients may not be in control of how query bodies are delivered to the
server, so we should be agnostic in that respect
* add changelog
CHANGELOG_BEGIN
- [JSON API - Experimental] WebSocket contract search at ``/contracts/searchForever``.
See `issue #3936 <https://github.com/digital-asset/daml/pull/3936>`_.
CHANGELOG_END
* adapt to #3991 template ID strings
* adapt to #3971 argument -> payload
* fix create command for test (string template ID redux)
* adapt to #4014 ResolveTemplateId change
* update copyright headers
* rebuild WS example output to match latest changes
- thanks @leo-da
* SeqOps is not a safe name
* don't need breakOut anymore
* use util library form of partitionMap
- thanks @leo-da for pointing it out
Co-authored-by: lima-da <54044170+lima-da@users.noreply.github.com>
* Patterns and test for new desugaring
* working on new template conversion
* Update ghc-lib
changelog_begin
changelog_end
* shut up hlint
* Update desugar stdlib
* update test
* remove unuseful templatebinds
* Add implicit qualified GHC.Types import
* Add missing primitives
* Remove chaff
* update comments
* Remove patterns that dont seem useful anymore
* Capture key data in template binds
* Dont make TypeRep/ToAny/FromAny classes conditional
* Remove some unnecessary TODOs
* Generate the template definition
* Remove new template desugaring test
* Fix jq query
* Rename makeDesugarDFunProjection to useSingleMethodDict
* Let TTypeRep and TAny be TUnit in primitives.
* Fix damlc visual wrt the new desugaring
* Fix visualization tests in shake test suite
* Fix damldocs
* Drop envTemplateKeyData
* Use the new ghc-lib release
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Fixes#3984.
CHANGELOG_BEGIN
[Sandbox] Fix bug that can cause the transaction stream to not terminate.
See `issue #3984 <https://github.com/digital-asset/daml/issues/3984>`__.
CHANGELOG_END
The bug is that the ledger end gets updated without writing any ledger entries,
for example when uploading packages or in case of duplicate commands.
The termination of the stream (i.e. the comparison of offsets) only happened
on actual ledger entries. If there are none, then the stream just waits for the next
entry to be written.
This change moves the stream termination/completion to BEFORE potential entries
are loaded. The stream knows that after a certain offset has been reached, that it can
be terminated/completed.
* kvutils, etc: Remove duplicate copyright notices.
* ledger-on-posix-filesystem: Implement a simplified KV ledger on FS.
CHANGELOG_BEGIN
- A simple KVUtils-based ledger that runs against a POSIX filesystem.
Intended as a reference implementation for testing and documentation.
CHANGELOG_END
* ledger-on-posix-filesystem: Make it runnable.
* ledger-on-posix-filesystem: Chunk long state paths for macOS.
macOS only supports file names of up to 255 characters.
* ledger-on-posix-filesystem: Run conformance tests.
The lock is temporarily implemented as an in-memory mutex.
* ledger-on-posix-filesystem: Move the paths into the class.
* ledger-on-posix-filesystem: Lock using the file system.
We use the movement of a directory as an atomic operation.
* ledger-on-posix-filesystem: Use a sequential log entry ID.
* ledger-on-posix-filesystem: Check exception types using patterns.
* ledger-on-posix-filesystem: Test that state key collisions can't happen.
* ledger-on-posix-filesystem: Document the various directories.
* ledger-on-posix-filesystem: Use a *persistent* sequential log entry ID.
Because this is a persistent store. Duh.
* ledger-on-posix-filesystem: Don't worry about using Futures.
It's a global lock anyway.
* Allow invoking generate-src on the main dalf of a dar
Given that daml build outputs a .dar file this is much more convenient
for testing against actual build outputs of damlc rather than
handcrafted .dalf files.
The behavior matches the one of `damlc inspect` in that it detects
whether it works on a .dar or a .dalf based on the file ending.
changelog_begin
changelog_end
* Update compiler/damlc/lib/DA/Cli/Damlc.hs
Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>