Commit Graph

272 Commits

Author SHA1 Message Date
Stefano Baghino
ec87d8dbb1
Address CVE-2022-24785 (#13549)
changelog_begin
changelog_end
2022-04-11 10:56:51 +02:00
Victor Peter Rouven Müller
cc06073333
Java bindings/interface support (#13366)
* WIP

* First working version of java codegen daml interface support

* Update language-support/java/codegen/BUILD.bazel

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Fix compile errors

* Simplify code massivly, enjoy less duplication

changelog_begin

- The Java codegen now has basic support for daml interface definitions. Converting a contract id of a template implementing an interface to a contract id of the interface is possible and both executing interface choices is possible on the contract id of the interface and implementing template.

changelog_end

* Rename the test file to reflect it is a test file & enhance the inner test name & extend it further

* Fix test

* Refactor parts of TemplateClass.scala into multiple files

* Format that files!

* Minimize duplication further

* Remove unused comment

* Simplify code
Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Update language-support/java/codegen/src/main/scala/com/digitalasset/daml/lf/codegen/CodeGenRunner.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Further refactoring and renaming of the TemplateClassSpec to ContractIdClassBuilderSpec

* Fix formatting

* Add interface docs

* Remove unnecessary code generation of the Contract class for interface types

* Use less bool flags and more good function names :)

* Fix build

Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2022-03-29 12:38:00 +02:00
Stefano Baghino
98a62622e8
Address open security advisories (#13377)
Address CVE-2022-24771
Address CVE-2022-24772
Address CVE-2022-24773

changelog_begin
changelog_end
2022-03-23 11:05:20 +01:00
Stefano Baghino
9fef07a02a
Address CVE-2021-44906 (#13376)
changelog_begin
changelog_end
2022-03-23 09:27:15 +00:00
Stephen Compall
0b5ad7a7bd
interface support in the interface library (#13154)
This adds the presence of interface names, as well as lists of choices
and their argument/return types for each interface.

It also changes the semantics of DefTemplate and EnvironmentInterface:
each may contain "unresolved choices", which are the choices inherited
from interfaces for each implementing template;
EnvironmentInterface#resolveChoices will copy the full type information
as a concrete choice for each implementing template, which should be
much simpler for codegen and json-api.

A type generator should take account of the astInterfaces as well as
typeDecls in EnvironmentInterface; interfaces aren't included in
typeDecls because where I is an interface only ContractId I is
serializable.

* Ast.DataInterface is empty, just use the interfaces map directly
* port json-api for interface API changes; does not solve #12689
* port Scala codegen for interface API changes; does not add support
* port Java codegen for interface API changes; does not solve #11350

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-15 19:34:54 +00:00
Gary Verhaegen
dfa648f585
hunt down DAML better (#13195)
Process:

- `git ls-files -z | xargs -0 -n 100 sed -i --follow-symlinks 's/DAML/Daml/g'`
- `git add -p`
- `git restore -p`
- Check there is no unstaged change left.

To review:

- Check for false positives by carefully reviewing the diff in this PR.
- Check for false negatives with `git grep DAML`.
- Quicker check for fals positives:

```
git grep DAML | grep -v migration | grep -v DAML_
```

Fixes #13190

Note: This is the "second half" of #13191, which failed to cover all the
remaining DAMLs because of:

```
$ git ls-files | grep "'"
compiler/damlc/tests/daml-test-files/MangledScenario'.daml
```

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-08 17:04:58 +01:00
Stefano Baghino
dc5f203323
Address CVE-2022-0144, resolve shelljs to 0.8.5 (#12927)
changelog_begin
changelog_end
2022-02-14 22:30:06 +00:00
Stefano Baghino
a49c321902
Add party identifier autocompletion to Navigator (#12923)
Fixes #12789

Adds a new query endpoint to Navigator's GraphQL backend that
lists all the parties registered by Navigator. The parties are
filtered on the server based on a query from the frontend and
served back. The frontend uses this to provide suggestion and
autocompletion features whenever a party identifier input is
required.

changelog_begin
[Navigator] Whenever you have to input a party identifier you
are now offered suggestions and the possibility to
autocomplete. See #12789.
changelog_end
2022-02-14 20:55:46 +00:00
dependabot[bot]
afef1a3827
Bump follow-redirects from 1.14.7 to 1.14.8 in /navigator/frontend (#12911)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 18:47:26 +00:00
Stefano Baghino
7252a66b2f
Wire contract identifier autocompletion in Navigator (#12916)
Navigator already had the possibility of autocompleting contract
identifiers, the only thing missing was to wire it in in full. This is
done mostly to inform how to address the more involved #12789.

changelog_begin
[Navigator] All input fields where a contract identifier can be passed
now provide the possibility of auto-completing based on the contracts
existing on the ledger.
changelog_end
2022-02-14 15:55:46 +00:00
Stefano Baghino
09a3eeab0c
Shorten contract and party identifiers in Navigator (#12913)
As we transition to Canton, we use a new format of contract and party
identifiers that can break the UI of Navigator here and there. In
order to prevent this, we use the same rules as Canton does to shorten
identifiers (basically, elide any hash longer than 12 characters).
Full identifiers are still shown as part of the tooltip.

Furthermore, a tooltip suggests that clicking on the shortened
identifier copies it in full length on the clipboard (which is indeed
what happens). There are a couple of possible improvements to this
interaction, which cannot be handled as part of this PR due to time
constraint:

- the visual cue suggesting that the identifier can be copied can be
improved by adding a clipboard icon besides the label
- there is no visual feedback from copying the identifier, ideally the
user should somehow see that the copying took place (e.g. by turning the
clipboard icon suggested in the point above into a checkmark for a
couple of seconds)

changelog_begin
[Navigator] Contract and party identifiers are shortened on the UI
but can be copied in full by clicking on their label.
changelog_end
2022-02-14 16:10:09 +01:00
Adriaan Moors
3ebd9d7be0
Navigator: don't leak memory via PartyState (#12896)
Undoing an unnecessary refactoring from #12187

stefanobaghino-da confirmed this fixes the memory leak he observed
in "long" running navigator sessions.

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-12 11:37:21 +01:00
Victor Peter Rouven Müller
c0c40bd10f
Add autoformatting to ts bindings & navigator frontend (#12693)
* Add autoformatting for the ts&tsx files (typescript effectively)

changelog_begin
changelog_end

* Format ts files

* Fix ts linter warnings
2022-02-11 11:44:52 +00:00
Adriaan Moors
46c32289c0
Navigator supports user management (#12187)
Add basic support for user management to navigator:
log in as a user, act/read as its primary party.

When user management is supported & enabled, you can
only log in as a user (and that user must have a
primary party, which is what you'll actually be
acting/reading as).

The above is the default behavior. It can be disabled
using a feature flag (`--feature-user-management`),
and you can also still specify parties explicitly 
in the config file.


CHANGELOG_BEGIN
Navigator supports user management by default. To disable,
use `--feature-user-management false` or specify parties 
explicitly in `daml.yaml`.
CHANGELOG_END



Co-authored-by: Robert Autenrieth <31539813+rautenrieth-da@users.noreply.github.com>
Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
Co-authored-by: Victor Peter Rouven Müller <mueller.vpr@gmail.com>
2022-02-09 10:28:30 +01: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
tudor-da
bb5722cd1b
Move sandbox-classic test lib and IT tests to Sandbox-on-x (#12641)
* Moved SandboxFixture and IT tests to Sandbox-on-X

changelog_begin
changelog_end

* Addressed review comments
2022-01-31 12:49:46 +01:00
Jennifer Whyte
7305a8c297
Color and typography edits (#12609)
CHANGELOG_BEGIN
CHANGELOG_END
2022-01-26 17:35:01 -05:00
Stefano Baghino
f1cd4b1c7c
Remove dependencies on compatibility libraries (#12548)
Continues the work started in https://github.com/digital-asset/daml/pull/12543

These libraries were only needed to transition from Scala 2.12 to 2.13
and are no longer useful as all the necessary items are now available
in Scala 2.13.

changelog_begin
changelog_end
2022-01-24 18:04:07 +00:00
Stefano Baghino
36f8d67c59
Upgrade css-loader to 5.2.7 (#12550)
changelog_begin
changelog_end

Fixes the transitive vulnerable dependency on `nanoid`.

Verified via `yarn audit`. Ran a quick manual test to check that
this did not break `navigator`.
2022-01-24 12:07:21 +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
Stefano Baghino
995c8bdfe3
Unpin the self-signed resolution (#12446)
Follow up to #12443 and #12457, removes the transitive vulnerable
dependency on `node-forge` 0.10.0.

changelog_begin
changelog_end
2022-01-18 15:15:25 +00:00
Stefano Baghino
4af48bbccc
Split channel configuration from LedgerClientConfiguration (#12433)
* Split channel configuration from LedgerClientConfiguration

Fixes #12391

The channel configuration now has to be provided separately from the
configuration specific to the ledger client. In this way we avoid
situations where the builder is provided with some configuration
that gets overridden.

changelog_begin
[Scala bindings] The channel configuration has been split from the
LedgerClientConfiguration class. Provide the gRPC channel specific
configuration separately or use a builder. The channel configuration
no longer overrides the builder.
changelog_end

* Fix compilation issues in //ledger-service/...
2022-01-18 10:03:33 +00:00
Stefano Baghino
69a8b6797e
Fix reported vulnerabilities (#12443)
changelog_begin
changelog_end

Bump resolved markdown-it version to 12.3.2 for modernizr

Bump webpack-dev-server to 4.3.7 to fix transitive issue reported on selfsigned 1.x

Bump marked to 4.0.10 to address reported vulnerability
2022-01-17 17:55:01 +00:00
dependabot[bot]
952a939620
Bump follow-redirects from 1.14.0 to 1.14.7 in /navigator/frontend (#12418)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.0 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.0...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-17 08:04:59 +00:00
Gary Verhaegen
ea55ea2d14
Further copyright updates (#12249)
Somewhat error-prone, so please review carefully.

Reasons we need this:

- Some file types are not properly handled by the script.
- The only exclusion mechanism we currently have (`NO_AUTO_COPYRIGHT`)
  is overly coarse.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-04 16:32:17 +01: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
Moisés Ackerman
0b79d8ae7c
Deprecate 'controller ... can' syntax (#11363)
Closes #11317

* Add warning for uses of 'controller ... can' syntax

* Remove uses of 'controller ... can' syntax

* Add test cases for -W{,no-}controller-can

* Update docs to reflect 'controller ... can' syntax deprecation

changelog_begin
* Deprecate 'controller ... can' syntax.
  * It will be removed in a future version of Daml.
  * Instead, use 'choice ... with ... controller' syntax. Note that this does not implictly add the controller as an observer, so it must be added explictly as one (or as a signatory).
changelog_end
2021-12-01 13:36:04 +01:00
Remy
58e69ade1a
LF: replace "dev" LF version by "1.dev" in bazel files (#11894)
the more consistent, as asked by Moritz in review of #11820

CHANGELOG_BEGIN
CHANGELOG_END
2021-11-26 12:23:17 +00:00
nicu-da
8f458d8d2a
[ledger-api] Include the completion offset in the command_service.proto responses [KVL-1171] (#11658)
CHANGELOG_BEGIN
[ledger-api] - Include the completion offset in the responses from the command_service.proto
CHANGELOG_END
2021-11-18 04:37:26 -08: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
tudor-da
2fc7490df2
[Self-service error codes] Adapt error factories [DPP-656] (#11270)
* Moved ErrorCodesVersionSwitcher to //ledger/error

CHANGELOG_BEGIN
CHANGELOG_END

* Rename ErrorCodeLoggingContext to ContextualizedErrorLogger

* Refactored ErrorFactories
* All error factories use ContextualizedErrorLogger for being able to dispatch self-service error codes.
* The ContextualizedErrorLogger is passed down from the dispatching Ledger API services.
* ErrorFactoriesSpec asserts both legacy (V1) and self-service error codes (V2).

* Adapted ApiSubmissionService

* Addressed Marcin's review comments
2021-10-18 16:46:20 +02:00
Moritz Kiefer
df59f3fe8e
Fix Navigator dependabot alerts (#11044)
I used a selective override for strip-ansi because html-webpack-plugin
cannot handle 7.0.0 and I don’t want to downgrade it in other places
where we are already using 7.0.0.

changelog_begin
changelog_end
2021-09-28 08:07:56 +00:00
Moritz Kiefer
6bf45a344a
Upgrade Navigator to Webpack 5 (#11040)
* Upgrade Navigator to Webpack 5

changelog_begin
changelog_end

* Disable broken modernizr checks

changelog_begin
changelog_end

* drop unused dep

changelog_begin
changelog_end
2021-09-27 21:59:54 +02:00
Stefano Baghino
e36eb46f59
Resolve set-value to 4.0.1 and above (#11029)
Fixes security notice

changelog_begin
changelog_end
2021-09-27 11:21:36 +00:00
Moritz Kiefer
5f3f5824f2
Upgrade webpack-dev-server in Navigator (#11025)
Tested manually that it worked. It didn’t work before actually since
the `webpack serve` switch was needed even for the old version but now
it does.

Unfortunately this still doesn’t get rid of the dependency on setvalue.

changelog_begin
changelog_end
2021-09-27 08:14:41 +00:00
nicu-da
e79a30aa80
For the client binding propagate the full original completion [KVL-1112] (#10879)
* For the client binding propagate the full original completion.

Because more fields are added to the completion it gets more difficult to deconstruct it into our own models while keeping the same external API. Because of this, we are propagating the full completion as well

CHANGELOG_BEGIN
java-client-bindings - the original full completion is included in the `CompletionResponse` when available
CHANGELOG_END
2021-09-24 13:47:41 +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
matevarga-da
1fc58d93f1
Navigator customviews highlight and choices button, apply custom theme on the login screen (#10859)
* Custom views menu highlighting and choices button fixes.

* Consider theme on the login screen

* Consider theme on the login screen

Originally reported here: https://discuss.daml.com/t/how-to-highlight-selected-custom-filter-button-in-navigator-how-to-use-the-choice-field-in-a-custom-view

changelog_begin
- [Navigator] The currently selected custom view is now highlighted on the sidebar
changelog_end

* Use page.state.id and defined user object.
2021-09-14 11:32:04 +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
Samir Talwar
eff09c010a
ledger-api-client: Wrap command submissions in a new class. [KVL-1009] (#10683)
* bindings-akka: Parameterize RetryInfo with its value type.

* ledger-api-client: Wrap command submissions in a new class.

This will allow me to pass a deadline alongside the commands in the
future.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-api-client: Inline `CommandRetryFlow.Value`.

* bindings-akka: Inline `CommandRetryFlow`'s `createRetry`.

It's always the same: `retryInfo.value`.
2021-08-26 17:44:12 +02:00
Moritz Kiefer
654d2eee1b
Bump url-parse to address dependabot alerts (#10593)
changelog_begin
changelog_end
2021-08-17 11:03:10 +02:00
Moritz Kiefer
56059f32d4
Upgrade path-parse to 1.0.7 (#10587)
Mostly to get dependabot to shutup

changelog_begin
changelog_end
2021-08-16 16:39:45 +00:00
Samir Talwar
4b8b67a1b5
Upgrade Scalatest to v3.2.9. (#10576)
* Upgrade Scalatest to v3.2.9.

Because of some coupling we also have to upgrade Scalaz to the latest
v7.2 point release, v7.2.33.

The Scalatest changes are quite involved because the JAR has been broken
up into several smaller JARs. Because Bazel expects us to specify all
dependencies and doesn't allow transitive dependencies to be used
directly, this means that we need to specify the explicit Scalatest
components that we use.

As you can imagine, this results in quite a big set of changes. They
are, however, constrained to dependency management; all the code remains
the same.

CHANGELOG_BEGIN
CHANGELOG_END

* http-json-oracle: Fix a Scalatest dependency.

* ledger-api-client: Fix a Scalatest dependency.
2021-08-12 23:19:35 +00:00
nicu-da
ee34d0f80c
Track command - use types for error handling instead of grpc statuses [KVL-1005] (#10503)
* Track command response using an Either instead of passing the completion with the grpc code.

This makes it clearer as to the result of command tracking. We no longer count on the grpc status to determine if there was an error or not, and instead use types for that.

CHANGELOG_BEGIN
akka-bindings: `LedgerClientBinding.commands` now returns a flow of `Either[CompletionFailure, CompletionSuccess]` instead of `Completion` for clearer error handling. For backwards compatiblity the new return type can be turned back into a `Completion` using `CompletionResponse.toCompletion`
CHANGELOG_END

* Fix formatting

* Code review changes

- remove usages of Symbol in tests
- clean curly braces

* Remove change added from another PR

* Fix import

* Fix import

* Fix retry flow and extract one more match case

* Un-nest matches to a single level for simplicity

* fix typo

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>

* Be consistent in assertions and prefer `inside` for pattern matching

* Inline CompletionResponse to use the full type

* Use simpler matcher

* Formatting

* Add a way to convert back an `Either[CompletionFailure, CompletionSuccess]` to a `Completion` for backwards compatibility. This simplifies update for systems that are tightly coupled to `Completion`

* Add test for converting to/from CompletionResponse

* Remove unnecessary brackets

* Add missing header

* Use checked exceptions to preserve backwards compatiblity

* Fix unapply

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2021-08-12 08:37:53 +02:00
Moritz Kiefer
34fa5a0a7c
Support running daml navigator without a config file (#10532)
No reason to force the existence of a config file if you can start
without one.

fixes #10516

changelog_begin

- [Navigator] Navigator will now start with an empty config if no
config file exists and it is run outside of a project.

changelog_end
2021-08-10 11:15:55 +00:00
Moritz Kiefer
b7cf42d173
Upgrade doobie to version 0.13.4 (#10326)
Was curious if there were any relevant performance improvements in
newer versions. Looks like the answer is no but we might as well
upgrade anyway.

changelog_begin
changelog_end
2021-07-20 19:19:11 +02:00
Samir Talwar
c3bc26fd1c
daml-lf/data: Move ID aliases to Ref from _ledger-api-common_. [KVL-1002] (#10323)
* daml-lf/data: Move ID aliases to `Ref` from _ledger-api-common_.

This allows us to remove a lot of dependencies on _ledger-api-common_,
and use these aliases in other places where that module is not used.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Remove an unused import.

* http-json-oracle: Remove `ledger-api-common` as a dependency.

* bindings-rxjava: Remove a now-unused dependency.
2021-07-20 11:01:19 +00:00
Remy
159728d716
LF: use Either by default in all archive reader API (#10295)
This is a follow up of #10277.
This is part of #9974.

CHANGELOG_BEGIN
CHANGELOG_END
2021-07-19 19:48:37 +02:00
Miklos
0eba812109
Remove trace_context field from Ledger API [KVL-1021] (#10256)
CHANGELOG_BEGIN
* [Integration Kit] Removed trace_context field from Ledger API and its bindings as we now have trace context propagation support via gRPC metadata. If you are constructing or consuming Ledger API requests or responses directly, you may need to update your code.
CHANGELOG_END
2021-07-15 19:06:25 +02:00
Remy
caf85a2270
LF: rationalize archive Parser/Reader/Decoder (#10239)
CHANGELOG_BEGIN
CHANGELOG_END
2021-07-14 11:05:17 +02:00