Commit Graph

282 Commits

Author SHA1 Message Date
nickchapman-da
fd75c5ece1
[engine] construct ResultNeedAuthority (#16390) 2023-02-27 15:13:30 +00:00
dylant-da
adb01a7b68
Table and transaction view in daml test (#16353)
* Initial outputTables work

* refactor outputTables

* Fix duplicate ShowCoverage opt

* Export TableOutputPath & TransactionsOutputPath constructors

* Implement outputTransactions

* Fix redundant imports, unused fields

* Embed extension's CSS style into generated tables / traces

* lint

* Extract webview css without locateResource

* Check stylesheet exists before reading it, emit warning if necessary

* Refactor tryWithPath
2023-02-22 17:56:50 +00:00
dylant-da
a90865d370
Show time elapsed on running scenarios in IDE (#16324)
* PoC: Add live script runner with intermediate live messages

* Unify live and non-live scenario service script runners

* Add live scenarios

* Clean up runLiveScenario

* dedupe runLiveScenario/runLiveScript

* return to onComplete mode

* Send status update every second

* Send progress events with milliseconds passed instead

* Fix runLiveScript -> runLiveScenario

* Show milliseconds passed in scenarios

* Sleep a random amount 300;600 ms

* Try to prevent older status updates from overwriting newer ones

* lint

* wrap errors appropriately

* Remove wrong secondary webview update

* Define variants inside companion object

* use abstract class instead of trait

* lint
2023-02-20 17:19:42 +00:00
Remy
12c240e06e
[Speedy] do not need disclosed contract at Machine creation time (#16302)
This PR make several (small) changes on how the disclosed contract are
handle by the speedy machine.

(1) disclosed contract at not anymore pass a builtin time. They were
any pass latter using `SBCacheDisclosedContract`.

(2) disclosed contracts are first keep in their own cache,
disclosedContracts: Map[V.ContractId, CachedContract]. They are moved
to the cached for used contract only if used.  In fact we need to be
sure the used disclosed contracts pass through the
Speedy#addGlobalContract to verify the transaction limits are not
overpassed.
2023-02-17 22:59:41 +00:00
Samuel Williams
fb55f4c1bb
Add signatory labels to create and fetch in tree view (#16291)
* Add signatory labels to create and fetch in tree view

* Switch node printing in scala and expected ledger files

* Update docs/images

* Update party formatting to use `x, y and z` and correct verb tense

* Update scala to match haskell, update tests and docs (except images)

* Cleanup code from suggestions

* Fix misformatting, refactor
2023-02-16 15:57:01 +00:00
Remy
a75db47275
[LF] factorize GlobalKeyWithMaintainers and KeyWithMaintainers (#16251) 2023-02-08 13:58:43 +01:00
Remy
2851401df6
[ScenarioService] add evaluation timeout (#16204)
Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2023-02-06 08:59:12 +01:00
Remy
3603ba870b
[Speedy] add cooperative interuptions (#16129)
Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2023-01-26 16:05:33 +01:00
nickchapman-da
4aa5b7d768
add new tx node type: Node.Authority (#16070) 2023-01-25 11:09:56 +00:00
Gary Verhaegen
151e12b81a
bump copyright (#16002)
This is the result of:

- Updating `./COPY` to say `2023`.
- Running `./dev-env/bin/dade-copyright-headers update .`
2023-01-04 18:21:15 +01:00
Remy
f1aca5e11c
[Speedy] create Scenario Machine (#15588) 2022-12-16 08:20:42 +00:00
Remy
7cac969756
[Speedy] Inline LedgerMode in the Machine (#15514) 2022-11-15 14:47:22 +00:00
Moisés Ackerman
06892a4ae9
Clean up uses of locateRunfiles (#15446)
* Define DA.Bazel.Runfiles.locateResource as an alternative to locateRunfiles

* Use locateResource to get default dlint rules file

Fixes #15443

* Use locateResource to get scenario-service.jar

* Use locateResource to get ghc-pkg executable

* Use locateResource to get stable-packages directory

* Use locateResource to get ghcversion.h

* Use locateResource to get hpp executable

* Use locateResource to get builtin package dbs

* Drop unused function DA.Daml.Options.Types.getBaseDir

* Use locateResource to get d3{,plus}.min.js

* Use locateResource to get repl-service.jar

* data Resource now takes a runfilesPathPrefix instead of a runfilesPath

* Add hlint warning 'locateRunfiles/package_app'

* Let locateRunfiles crash when used outside of bazel target

* typo
2022-11-10 13:20:43 +01:00
Remy
49f4d2979e
[LF] strengthen compilation flags (#15481) 2022-11-09 14:12:04 +01:00
Carl Pulley
aa062cde42
Final step of explicit disclosure cached contract refactor
* Fixes #13897

CHANGELOG_BEGIN
CHANGELOG_END
2022-09-21 18:12:55 +01:00
Carl Pulley
19a2b986bc
Disclosure testing invalid contract type
* Test that invalidly typed contracts are rejected

CHANGLELOG_BEGIN

* Engine/speedy-level tests for explicit disclosure (#14227): test that invalidly typed contracts are rejected.

CHANGELOG_END
2022-08-09 18:45:44 +01:00
Carl Pulley
d0f40d89ca
Disclosure error reporting fix
Add key hash to scenario service error reporting

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): Add key hash to scenario service error reporting.

CHANGELOG_END
2022-08-04 11:09:33 +01:00
Carl Pulley
c87732c438
Disclosure testing of contracts and keys
* Basic explicit disclosure testing

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): test that explicit disclosure works for contracts and keys.

CHANGELOG_END
2022-07-28 16:00:55 +01:00
Remy
abd47e972b
[Speedy] Do not crash when encountering an inconsistent contract key (#14276)
but rather return a proper interpretation error.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-05 10:28:38 +00:00
Moisés Ackerman
ba9abf3c5f
Use the appropriate daml-script for each Script (#14321)
* Add failing test

* Overload daml-script 'Runner.run' to work directly with 'PureCompiledPackages'

* Use new daml-script 'Runner.run' in scenario-service

changelog_begin
* data-dependencies: fixed an issue with the handling of multiple versions of the daml-script package (#14291)
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2022-07-04 08:26:12 +00:00
Robin Krom
36b39aca7b
Move disclosed contract logic to speedy (#14288)
* Move disclosed contract logic to speedy

This moves the disclosed contract logic from the engine to speedy.

Fixes #14090.

* back to versioned contract instances

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-01 08:40:10 +00:00
Carl Pulley
5c026163a9
Remove redundant fields from LedgerNodeInfo
CHANGELOG_BEGIN

[DAML Studio] as the `parent` and `rolledbackBy` fields of `LedgerNodeInfo` are not used within the code base, they have been removed.

CHANGELOG_END
2022-06-29 16:35:42 +02:00
Carl Pulley
6ed88105bb
Refactor and simplification of Transaction#processNodes
* fixes #14183

CHANGELOG_BEGIN

- [DAML Studio] Refactor and simplification of Transaction#processNodes to avoid need for custom state during processing. Refactor of Transaction#processTransaction to make processing workflow more transparent and easier to unit test. See https://github.com/digital-asset/daml/issues/14183 for details.

CHANGELOG_END
2022-06-28 13:49:41 +02:00
Remy
2d5094160e
[Engine] clean key uniqueness mode (#14194)
This is a follow up of #14175 and #14176.  

Basically
-  we kill the `On` mode which is not used anymore.
- we factorize the visibility check.
- we rename `LocalContractNotVisible` into `ContractNotVisible`

CHANGELOG_BEGIN
CHANGELOG_END
2022-06-16 12:04:45 +00:00
dylant-da
90f0bf8ba0
Display key used by exerciseByKey and fetchByKey in transaction log (#14035) (#14162)
* Show key in transaction log when exercising by key

* Only show key if key was actually used

* Show key if used by a fetch in transaction view

* Add test for key showing up in log on fetch/exercise

* CHANGELOG_BEGIN
Display key used by exerciseByKey and fetchByKey in transaction log
CHANGELOG_END

* Dummy commit for CHANGELOG

changelog_begin
changelog_end

* Use "by key" instead of "using key", to better match function names

* Test that key is only reported when ByKey is used
2022-06-15 16:50:35 +00:00
Carl Pulley
7d76460ee8
DAML Studio Activeness checks
* fixes #13835

CHANGELOG_BEGIN
  - [Daml Studio] Fix a bug where some contracts were considered inactive even though their consumption was under a rollback. See https://github.com/digital-asset/daml/issues/13835 for details
CHANGELOG_END
2022-06-15 11:35:18 +01:00
Remy
09034a265d
ScenarioRunner: move the building of the speedy machine (#14024)
CHANGELOG_BEGIN
CHANGELOG_END
2022-06-02 16:40:48 +02:00
Moisés Ackerman
61cb257225
Make disclosure explicit in Daml Studio tree view (#13735)
changelog_begin
* Daml Studio: transaction tree view now differentiates between disclosed and divulged contracts
changelog_end
2022-05-02 09:18:46 +02:00
Robin Krom
fcd3b6622b
ifaces:support exercising by required interface (#13554)
* ifaces:support exercising by required interface

This adds support to exercise an interface choice on a contract ID,
where the interface is required by one of the implemented interfaces of
the contract template.

Fixes #13434.

CHANGELOG_BEGIN
CHANGELOG_END

* some improvements based on review

* added a test plus a bugfix

* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/PhaseOne.scala

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

* 2 more interface tests for the command preprocessor

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-04-12 18:15:29 +00:00
Remy
d94aa137f1
Remove by_interface from scenario transaction Nodes (#13509)
part of #13491

CHANGELOG_BEGIN
CHANGELOG_END
2022-04-06 11:09:52 +00:00
Moisés Ackerman
6402b2e95c
Handle scenario service errors (#13479)
* Add ChoiceGuardFailed and ContractDoesNotImplementInterface errors to scenario-service protocol

* Update daml-test-file InterfaceErrors.daml 

* Add daml-test-files for ChoiceGuardFailed and ContractDoesNotImplementInterface errors

changelog_begin
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2022-04-05 09:26:08 +00:00
Robin Krom
d10f678518
ifaces: tests for by_interface in transactions (#13365)
We add tests to check that by_interface fields are set for interface
transactions. We also extend the scenario service to show the
by_interface fields in the pretty printed transactions.

Fixes #13333

CHANGELOG_BEGIN
CHANGELOG_END
2022-03-22 19:53:49 +00:00
Moritz Kiefer
4e004e0a88
Replace scenario messages with script (#13207)
* Replace scenario messages with script

In theory we could try to be clever and print the "right" thing. In
practice, scenarios are almost dead so the complexity for that doesn’t
seem worth it.

fixes #13178

changelog_begin
changelog_end

* .
2022-03-09 11:35:37 +01:00
Moritz Kiefer
0ea4866adc
Fix activeness display in script service (#13059)
The previous way of tracking this only worked for direct children of
rollback nodes but lost the information when there was an exercise
node in between.

Reported in https://discuss.daml.com/t/exception-rollback/4000

changelog_begin

- [Daml Studio] Fix a bug where contracts that have been rolled back
  would still show up as active in the table view and in the list of
  active contracts at the end of the transaction view. This only
  affected display. Fetching those contracts failed and `query` also
  did not return those contracts.

changelog_end
2022-02-24 16:20:00 +01:00
Remy
e834a7b85c
Triggers: Connect Logging context from Triggers to the Speedy. (#13009)
Follow up of #12976.
fixes #12208

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-22 18:28:49 +01:00
Remy
ac3d9a4647
LF: Add LoggingContext to Speedy Machine (#12976)
This advances the state of #12208

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-21 13:34:46 +01:00
Moritz Kiefer
0fb0bf2f52
Disable implicit party allocation in Daml Studio (#12839)
* Disable implicit party allocation in Daml Studio

fixes #12058

This matches what sandbox does in 2.0 so it reduces a source of
inconsistency and potential confusion.

changelog_begin
changelog_end

* Update compiler/scenario-service/protos/scenario_service.proto

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

Co-authored-by: Remy <remy.haemmerle@daml.com>
2022-02-09 17:47:40 +00:00
Moritz Kiefer
486c869986
Replace most scenario references in the docs by Daml script (#12741)
* Replace most scenario references in the docs by Daml script

There are still some left in the Daml studio docs (should be updated)
and in quickstart-java (should be updated but probably not by us
🤷) but I’ll leave those for separate PRs.

changelog_begin
changelog_end

* delete unused code

changelog_begin
changelog_end
2022-02-03 15:55:55 +00:00
Moritz Kiefer
0d5443f8de
Drop direct dependencies on system-filepath (#12658)
That package has been deprecated for years and we don’t even use
it. The deps are just redundant.

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

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

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

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

changelog_begin
changelog_end

[1]: https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
2022-01-24 15:01:35 +00:00
nickchapman-da
6fbaac467f
Remove user-management error cases from scenario-service proto. (#12460)
* Remove user-management error cases from scenario-service proto.

changelog_begin
changelog_end

* remove Error.UserManagement

* remove UserManagememtError

* simp

* meh... done over by scala's poor excuse for a type system
2022-01-19 10:44:04 +00:00
nickchapman-da
6bf24fce93
Proxy user management errors via the scenario service proto (#12267)
* Proxy user management errors via the scenario service proto and display them

changelog_begin
changelog_end

* address comment
2022-01-05 13:41:49 +00:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

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

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
Moisés Ackerman
149474f3cb
Drop scenarios from the user-facing SDK (#12128)
* Add --enable-scenarios hidden flag
* Fail LFConversion when a scenario is defined and --enable-scenarios=no
* Remove unused optIsGenerated=True test cases
* Refactor getIntegrationTests
* Add no-scenarios-enabled tests
* Add enable-scenarios flag to scenario-service server
* Add test ensuring that scenario-returning functions are still allowed
* Remove 'enable scripts' option (--daml-script)
* Add --scripts synonym to --scenarios
* Rephrase scenarios flags descriptions

changelog_begin
changelog_end
2021-12-15 13:39:14 +01:00
Moritz Kiefer
ffe05aab3d
Apply grpc-max-message-size in both directions in the script service (#12149)
Previously, it was only applied for messages towards the script
service but not for messages towards the Haskell client. Now we
increase the max size in both directions.

See
https://discuss.daml.com/t/increase-max-message-size-in-daml-studio/3573/9
for the forum thread that raised this.

changelog_begin

- [Daml Studio/Daml Test] The `grpc-max-message-size` field in
  `daml.yaml` now also applies to the message that contains the result
  of a script.

changelog_end
2021-12-15 09:33:55 +00:00
Sofia Faro
b99952407c
Update TODOs to outdated issues. (#12090)
* Update TODOs to outdated issues.

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

changelog_begin
changelog_end

* typo

* remove numeric/bignumeric todo

* scalafmt!!

* drop choice observer TODO
2021-12-09 21:01:27 +00:00
Moritz Kiefer
e036e2c00a
Implement user management in Daml script service (#12050)
* Implement user management in Daml script service

changelog_begin
changelog_end

* Update compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala

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

* move assertion into replaceInfo

changelog_begin
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2021-12-08 16:11:09 +00:00
Remy
b02ed7765a
LF: Introduce configurable limits on produced transactions (#11948)
This is part of #11691

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

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

Part of #10810 and #11703

changelog_begin
changelog_end

* use inside

* rename error
2021-11-29 15:54:31 +00:00
Moritz Kiefer
dbbb05fe2e
Split daml-lf encode/decode Haskell libraries (#11906)
* Split daml-lf encode/decode Haskell libraries

I was working on limiting the supported input versions in damlc. This
requires the list of stable package ids so we can allow those to be
decoded even if they are older.

However that leads to a cyclical dependency:
To get the package ids of the stable packages, I need to encode
them. The version check is in the decoder. If those live in the same
package, I now end up with a cyclical dependency and
Bazel (understandably) gets very sad.

This PR splits decoding/encoding into two libraries with the
generation of stable packages only depending on encoding.

changelog_begin
changelog_end

* Fix dependants

changelog_begin
changelog_end
2021-11-29 12:49:02 +00:00