Commit Graph

541 Commits

Author SHA1 Message Date
Gerolf Seitz
e0cfb84681
Filter the contracts for the ACS already in the database. (#3180)
This avoids unnecessarily loading contracts from the database
that would anyway get discarded later on.
2019-10-15 11:39:45 +02:00
Remy
e45b585307 daml-lf: repackage daml-lf archive proto (daml_lf -> daml_lf_dev) (#3169) 2019-10-15 09:36:11 +00:00
Remy
d64df4b5f7 daml-lf: clean achive bazel build (#3175)
* clean the mess in daml-lf achive bazel build

* add release note

* Address Moritz's comments

* more release notes
2019-10-15 08:36:46 +00:00
Remy
fc1a000090 daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader (#3168)
* daml-lf: rename daml_lf_archive_scala target to daml_lf_archive_reader

* fix release
2019-10-14 14:53:50 +00:00
Remy
217405e883 daml-lf: Move archive protofile to a more usual place. (#3166)
* move daml-lf archive protobug to a more usual place

* formatting

* fix kvutils proto

* fix csharp namespace
2019-10-14 13:22:22 +00:00
Robert Autenrieth
9a1b10ef82
Add a mock AuthService (#3125)
A simple AuthService implementation useful for tests
2019-10-08 12:46:43 +02:00
Gerolf Seitz
5592092cc7
Remove DAML-on-X IndexServer and Reference Server (#3108)
It is not needed anymore and can therefore be deleted.
2019-10-08 11:47:21 +02:00
Oliver Seeliger
52302e2a1f
Ledger api index server starts only after indexer initializes db #2974 (#3087) 2019-10-08 10:57:50 +02:00
Robert Autenrieth
284a6d8197
Introduce ledger API authorization (#3051)
... by introducing an AuthService and checking authorization claims in all ledger API services
2019-10-07 22:29:46 +02:00
Jussi Mäki
09e93a6cdc
Fix handling of transient contract keys in kvutils (#3110)
* Add failing test case for transient contract keys

* Add kvutils tests for transient contracts and keys

* Fix handling of transient contracts and keys in kvutils
2019-10-04 14:00:54 +02:00
Oliver Seeliger
7dd482861b
Ledger api server fixes to persist divulged, otherwise unknown contracts #2946 (#3101) 2019-10-04 11:25:50 +02:00
Oliver Seeliger
cd915b64d7
Ledger api server indexer closes akka system on shutdown #2624 (#3089) 2019-10-03 18:57:14 +02:00
Oliver Seeliger
c9658c7813
Multi participant node named logging (#2647) (#3080)
* Upgrade scala-logging and slf4j

* Named logging for multi-participant tests (#2647)
2019-10-03 18:20:57 +02:00
Jussi Mäki
0c72eeaf32
kvutils metrics (#3065)
* Add initial metrics to kvutils

* Improve metrics. Use InsertOrdMap by default in kvutils.

* Add VarGauge
2019-10-03 14:34:12 +02:00
Stefano Baghino
2955c49828
Remove contract keys tests from semantic suite, make contract keys tests multi-node aware (#3058) 2019-09-27 13:51:51 +02:00
Stefano Baghino
717bd38ec0
Read the TTL from the configuration service (#3052)
* Read the TTL from the configuration service

* Address https://github.com/digital-asset/daml/pull/3052#discussion_r328698432

* Fix docs
2019-09-27 12:02:47 +02:00
Stefano Baghino
cde3797eb2
Finish porting TransactionServiceIT (#3043)
* Finish porting TransactionServiceIT

* Go easy on H2

* Address https://github.com/digital-asset/daml/pull/3043#discussion_r328547578
2019-09-26 14:20:02 +02:00
Robert Autenrieth
9583c1f470 Improve ledger sql backend performance (#2998)
* Remove extra key lookup

... when removing contracts

* Only look up contract LET

* Add ADT for let lookups

* Add release notes

Fixes #2888
2019-09-25 12:46:13 +00:00
Robert Autenrieth
afabb584c8
Move PackageServiceIT to the ledger api test tool 2019-09-24 15:17:18 +02:00
Remy
337c5ff215 Engine: drop value versioning in commands (#2995)
* daml-lf: remove value Version from commands

* ledger-api: fix ledger api

* ledger: fix tests

* leger: drop dead code

* Address Gerolf's comment
2019-09-24 12:38:56 +00:00
Stefano Baghino
aad98b4c9e
More transaction service tests ported to the new test tool (#2961)
* Remove dead code

* Port around 30 more tests, delete dead code

* Remove template comment

* Update unreleased.rst

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r327000163

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326999412

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326998734

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326998278

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326998888

* Address https://github.com/digital-asset/daml/pull/2961#discussion_r326997789
2019-09-23 15:33:32 +02:00
Remy
d540f7aab0 Daml-LF: change Numeric max scale from 38 to 37 (#2969)
* daml-lf: numeric maxScale change from 38 to 37

* daml-lf: update spec

* udpate protobuf comments
2019-09-23 12:39:28 +00:00
Remy
a46f1c041a Daml-LF: make Numeric scale type safe (#2958)
* daml-lf: make numeric scale type safe

* navigator: fix scale

* ledger: fix scale in tests

* Update daml-lf/data/src/main/scala/com/digitalasset/daml/lf/data/NumericModule.scala

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Update ApiCodecCompressedSpec.scala

* Update ApiCodecCompressedSpec.scala
2019-09-18 19:33:52 +00:00
Stefano Baghino
8faca7ec1a
Delete old //ledger/CONTRIBUTING.md (#2956) 2019-09-18 14:54:26 +02:00
Gerolf Seitz
52efe9ccf9 Use the SQL-backend to testing the postgres-backend (#2954) 2019-09-18 12:28:02 +00:00
Gerolf Seitz
b70e289303 ActiveContractsService stream ow always returns at least 1 element (#2799)
This removes the need for clients to handle the special case where the
stream might be empty.
Now the clients can always assume that they receive at least one
response element in the stream.
2019-09-18 11:16:56 +00:00
Gerolf Seitz
96642d9b19
Port TransactionServiceLargeCommandIT. (#2944)
Fixes #2861.
2019-09-18 13:05:46 +02:00
mziolekda
bf9ae046ba
ignore ledger updates that contain commands rejected due to de-duplication (#2939) 2019-09-18 12:21:30 +02:00
Robert Autenrieth
b97ef28de1
Rename BlindingInfo fields (#2883) 2019-09-18 00:28:53 +02:00
Jussi Mäki
11f1735613 Fix contract key uniqueness check in kvutils (#2933)
* Fix contract key uniqueness check in kvutils

Archival of a contract with a key and recreation within the
same transaction is now allowed in kvutils.

* Add assertions to check that new contract has been created with same key
2019-09-17 18:21:41 +02:00
Gerolf Seitz
f32f1b975e
Filter the contracts for the ACS already in the database. (#2931)
This avoids unnecessarily loading contracts from the database
that would anyway get discarded later on.
2019-09-17 15:30:45 +02:00
mziolekda
7c4cc96371
Use separate thread to preload dars in KVBC committer (#2924)
* use separate thread to preload dars in KVBC committer

* fix formatting
2019-09-17 14:48:36 +02:00
Gerolf Seitz
00f4ac133f
Port WronglyTypedContractIdIT to new TestTool. (#2907)
Fixes #2862.
2019-09-16 16:11:30 +02:00
Jussi Mäki
ae6f0fd631
Revert "Do not consider archives that are already loaded in engine (#2898)" (#2910)
This reverts commit 6ed6e0e990.
2019-09-16 15:26:21 +02:00
Stefano Baghino
e37e3ec314
SemanticTests synchronize/wait across participants, specify error codes (#2911) 2019-09-16 15:18:42 +02:00
Stefano Baghino
c1d3c54f65
Port transaction service tests (#2900)
* Delete dead code

* Add test case for contract identifier retrieval when filtering by template

* Factor out retry strategies, make transaction tests multi-node-aware, add one test case

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324541271

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324543869

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324543999

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324544107

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324544193

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324545838

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324545682

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324545947

* Address https://github.com/digital-asset/daml/pull/2900#discussion_r324546075

* Wrap eventual success around exercise exclusively
2019-09-16 14:26:58 +02:00
Gerolf Seitz
ad1b885494
Properly adhere to DbType#supportsParallelWrites in SqlLedger (#2902)
Since we still have issues with parallel writes when using H2,
we should properly only use a single DB connection and executor thread
for that.

Because we didn't do that before for Sandbox, tests like PackageManagement
appeared to be flaky due to racy inserts in H2.
2019-09-16 11:29:07 +02:00
Jussi Mäki
6ed6e0e990 Do not consider archives that are already loaded in engine (#2898) 2019-09-13 15:44:18 +00:00
Jussi Mäki
868cb785ad
Preload packages to engine during upload (#2860)
* Preload packages to engine during upload

* Improve logging in KeyValueCommitting and add timing information

* Fix scenario service tests now that logging is done in interpreter
2019-09-13 14:31:52 +02:00
Oliver Seeliger
d154c2cea9
Specify sql database driver in connection pool (#2877) (#2886)
This is believed to prevent race conditions that yield the following error:

java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:postgresql://...
2019-09-11 17:31:42 +02:00
Robert Autenrieth
e288437dc0
Support divulged contracts in a distributed ledger (#2739)
Fixes #2488

Includes some refactoring of ActiveContracts (now ActiveLedgerState).
2019-09-11 14:21:41 +02:00
Jussi Mäki
03962da4e3
Load packages only once in ledger API server (#2835)
* Load packages only once in ledger API server

* rework concurrent package loading
2019-09-11 11:46:36 +02:00
Gerolf Seitz
eefd481b9a
Explicitly run schema migration/validation (#2832)
The Ledger Indexer can now be started in 3 modes:

- validate schema and start
- migrate schema and start
- migrate schema only and exit

Contributes to #2660.
2019-09-10 14:56:35 +02:00
Oliver Seeliger
a0a7a81cde
Add participant state v1 participantId and TransactionId vals (#2821)
for easier code reuse
2019-09-09 16:21:16 +02:00
Stefano Baghino
dc1eb2b151
Make semantic tests multi-node aware (#2770) 2019-09-05 15:38:51 +02:00
Jussi Mäki
2a20a37139 Rename referencedContracts to divulgedContracts (#2741)
* Rename referencedContracts to divulgedContracts

We do not want to provide all referenced contracts as that would
require the ReadService to be able to read all those contracts, or
we would need to bundle the referenced contracts with the transaction.

The new type should match what was discussed in #2488.

* Add changelog entry to participant.state.v1.Version

* Remove divulgedTo from DivulgedContract

We decided not to prematurely add this feature.
2019-09-05 13:27:41 +00:00
Stefano Baghino
4bfabe80fd
First multi-node test (#2737)
* WIP

* Ensure identifier uniqueness across endpoints

* Use Greek alphabet letters for node naming to better tell them apart

* Allow reference server to specify extra participants

* Restore all semantic tests

* Update changelog

* Have exponential backoff retries when creating the endpoint test context
2019-09-05 09:37:51 +02:00
Brian Healey
d2803c4d0f Randomize hint to ensure PartyManagement tests are rerunnable on the same ledger (#2749)
* Randomize hint to ensure tests are rerunnable

* Include descriptive party name prefix for randomized party name cases

* resolve scalafmt woes

* try to resolve failing release azure step
2019-09-04 19:29:34 +00:00
Stefano Baghino
785e41eb2c
Enable multi-node conformance testing (#2735) 2019-09-03 15:57:23 +02:00
Gerolf Seitz
4dbbdaaf52
Use (submitter, command_id, application_id) for command deduplication (#2724) 2019-09-03 10:09:01 +02:00
mziolekda
e8c1c55e24
participant id and list of archives are optional command arguments (#2722) 2019-09-02 17:47:02 +02:00
Stefano Baghino
1d88fc3207
Make party and command identifiers unique across runs (#2721)
* Make party and command identifiers unique across runs

* Fix compilation error
2019-09-02 16:02:20 +02:00
Gerolf Seitz
63a92887dc
Store external offset on every state update. (#2719) 2019-09-02 16:00:13 +02:00
Stefano Baghino
e452aa2cea
Port semantic tests to the new test tool (#2718) 2019-09-02 14:40:10 +02:00
Stefano Baghino
13607031f5
Start porting the transaction service integration tests (#2713)
* Start porting the transaction service integration tests

Contributes to #1373

* Simplify creation of multiple contract in a single transaction

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319562016

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319562566

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563441

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563617

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563788

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319563838

* Fix test case description

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Fix test case description for disclosure

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Fix test description of parallel requests test case

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319883011

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319567251

* Address https://github.com/digital-asset/daml/pull/2713#discussion_r319567251

* Run all conformance tests in exclusive mode
2019-09-02 13:45:15 +02:00
mziolekda
051c3641b2
add participant-id as command line option to the damlonx reference server (#2717)
* add participant-id as command line option to the damlonx reference server

* address review comments
2019-09-02 13:43:21 +02:00
Jussi Mäki
07fef0d784 Dispatcher: Provide sub-source in startingAt (#2715)
This allows using the dispatcher in situations where the index is common,
but different data streams are materialized from it.

The practical reason for this is to allow using a single dispatcher to read
from both the ledger_entries and configuration_entries tables, which share
the same ledger offset construction.
2019-09-02 09:05:08 +00:00
Jussi Mäki
a96f3fb736 Disable the checkTtl validation in kvutils (#2714)
The time model is being reworked and the current stack is not prepared
to handle this additional check well.

We will reimplement time model related checks once the redesign has been
completed.
2019-09-02 02:57:40 +00:00
Gerolf Seitz
ecb506e803
SQL diagnostics (#2662)
* Use proper names for the DB connection pools.

* Add some trace logging for DB operations.

This does not capture timing of individual statements but
rather the time for "units of work".
For example "lookup contract" doesn't mean only loading
a single row from the contracts table, but also 2 additional
queries for looking up witnesses and divulgences.

This is not a problem, because this is trace level logging
that helps us debug problems and shouldn't be made sense of by
users at this stage.

* Make description a by-name parameter.

This avoids building up the string if trace logging
is not enabled (i.e. most of the time).
2019-08-30 13:41:44 +02:00
Jussi Mäki
93f39508a3
Add kvutils envelope (#2709)
The kvutils envelope is meant to be used whenever a kvutils produced
data is stored and transmitted over the network. It adds both versioning
and compression to the original message.
2019-08-30 13:28:56 +02:00
Gerolf Seitz
0e80f75ff4
Make sure ActiveContractService sends out a consistent snapshot (#2708)
* Make sure ActiveContractService sends out a consistent snapshot

instead of looking up the latest ledger end, we can only take the latest known ledgerEnd in the scope of SqlLedger.
If we don't do that, we can miss contracts from a partially inserted batch insert of ledger entries
scenario:
1. batch insert transactions A and B at offsets 5 and 6 respectively; A is a huge transaction, B is a small transaction
2. B is inserted earlier than A and the ledger_end column in the parameters table is updated
3. A GetActiveContractsRequest comes in and we look at the latest ledger_end offset in the database. We will see 6 (from transaction B).
4. If we finish streaming the active contracts up to offset 6 before transaction A is properly inserted into the DB, the client will not see the contracts from transaction A
The fix to that is to use the latest known head to the dispatcher, which is updated AFTER a batch has been inserted completely.

This PR also factors out the basic readonly functionality that is
duplicated between SqlLedger and ReadOnlySqlLedger into a class
BaseLedger.

* copyright header
2019-08-30 10:56:30 +02:00
Gerolf Seitz
7311350b55
Extend the timeout for running integration tests with H2 (#2710) 2019-08-30 10:36:40 +02:00
Remy
20649cf78e ledger-api: rename decimal field to numeric in value Proto (#2688)
* add Numeric.java

* ledger-api: rename `decimal` field to `numeric` in value protobuf

* Address Gerolf's comment

* ledger-api: add missing renammings

* ledger-api: relax syntax of numbers that can be sent as numerics

* extractor:  fix

* leger-api: change format of number though ledger api

* daml-lf: fix numeric regexp

* ledger: fix tests
2019-08-29 22:51:33 +00:00
Robert Autenrieth
74cc2056ae
Recover indexer from errors (#2582)
Adds a loop that restarts the indexer
with a delay any time it fails.
2019-08-29 15:06:05 +02:00
Robin Krom
7fca591df0
replace main file with a pointer to the source root (#2687)
* language: compile everything in the source directory

This removes the need to specify a 'main'. Instead we 'source' in
daml.yaml should point to the source root directory.
2019-08-29 13:42:33 +02:00
Oliver Seeliger
8247624fd6
H2database: Limit writes to single connection, add daml-on-x compat test (#2698)
* Add h2 database daml-on-x reference2 server compat test

* Limit H2 database writes to be single-threaded
2019-08-29 13:37:24 +02:00
Oliver Seeliger
834a06a397
Ledger API Server H2 Database support (#2425)
* Ledger API Server H2 Database support (#2528)

* Disable parallel batch ledger append due to lack of H2DB isolation
2019-08-28 14:14:21 +02:00
Stefano Baghino
6d1d0b80c5
Port package management tests to new test tool (#2638)
* Port package management tests to new test tool

* Address https://github.com/digital-asset/daml/pull/2638#discussion_r317025106
2019-08-23 13:55:50 +02:00
Stefano Baghino
c6d1724bf9
Fix party management service test error output (#2639) 2019-08-23 13:06:37 +02:00
Gerolf Seitz
139afa4e59
Properly set connection pool properties (#2637) 2019-08-23 10:24:56 +02:00
Remy
997212c8f4
daml-lf: decommission internal Decimal type in favor of Numeric. (#2594)
* daml-lf: ValueDecimal -> ValueNumeric
* Apply suggestions from Stephen's code review
   Co-Authored-By: Stephen Compall <stephen.compall@daml.com>
* extractor: add comment about Numeric SQL format
2019-08-22 18:07:47 +02:00
Stefano Baghino
d01b649bda
Port party management tests to the new test tool (#2630) 2019-08-22 18:01:46 +02:00
Moritz Kiefer
aaa3d243a4 Fix imports in ActiveContractsService (#2631) 2019-08-22 12:38:01 +00:00
Remy
16d88ebcc0
ledger-api-test: cleanning a bit the build files (#2613)
* ledger-api-test: cleanning a bit the build files
* bazel: adapt client_server_test rule to expands files path as arguments
2019-08-22 13:32:41 +02:00
Jussi Mäki
aaeb58b44f
kvutils: Add authorization checks (#2622) 2019-08-22 13:01:18 +02:00
Stefano Baghino
424bd0cbf4
Restore resource closing ordering in Ledger API server (#2623)
Fixes #2549
2019-08-22 11:44:58 +02:00
Gerolf Seitz
cd3a6f9ffe
Port integration test for ActiveContractsService (#2580) 2019-08-22 11:35:55 +02:00
mziolekda
91c4af5d96
include Test-1.6.dar file used for compatibility testing in the test tool jar file (#2615) 2019-08-21 20:27:58 +02:00
Jussi Mäki
4ecf070860
kvutils: Authorization and config submissions (#2433)
* Initial version for configuration submissions and authorization

* Refactor config submission based on review. Add tests.

* Cleanup test output and comments

* kvutils test-suite

- Add unit tests for kvutils
- Thread the input state into Commit monad
- Fix a bug in handling rejected transactions (from previous refactoring)

* Address PR review

- Add submissionId to configuration changes.
- Revert the dedup of the ParticipantNotAuthorized message. This did not buy much
  and we need to duplicate it anyway when modularizing kvutils.
2019-08-21 18:24:16 +02:00
Stefano Baghino
3f0aaf08f3
Run semantic and divulgence tests on reference-v2 (#2614) 2019-08-21 13:38:14 +02:00
Gerolf Seitz
67d4b7aec6
Upgrade akka to 2.5.23 and akka-http to 10.1.9 (#2576)
When diagnosing error logging from akka when shutting down the ledger
API server, I wanted to give upgrading akka to the latest good release
between akka and akka-http. Incidentally, this actually removed the
errors and the shutdown should now be successful.
2019-08-19 12:34:03 +02:00
Leonid Shlyapnikov
0960c49cff
LedgerClient JWT pass-through in the HTTP JSON API gateway (#2566)
* The first draft of LedgerClient JWT support

not integrated with HTTP JSON API gateway yet.

* JWT pass-through for create and exercise commands

* JWT pass-through for contracts search and lookup

* Removing unused class

* Readme updates
2019-08-17 06:54:05 -04:00
Stefano Baghino
35a36a6fd6
Remove old CommandService integration tests (#2568) 2019-08-16 18:33:17 +02:00
Stefano Baghino
eb965866cc
Simplify new test tool (#2573)
* Simplify new test tool

* Shorten exercise to leverage ContractId

* Remove dead code

* Address https://github.com/digital-asset/daml/pull/2573#discussion_r314702191

* Address https://github.com/digital-asset/daml/pull/2573#discussion_r314700739

* Simplify transaction requests
2019-08-16 16:24:00 +02:00
Gerolf Seitz
a17c6d1fc9
Add Command submission test (#2508)
Also loads all dar packages eagerly in sandbox tests
2019-08-15 16:45:50 +02:00
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
Gary Verhaegen
1d7622c35d
exclude ledger migrations from copyright update (#2514) 2019-08-13 15:24:38 +01:00
Gerolf Seitz
66f85ca530
Add ContractKeys test. (#2491)
This test represents the behavior of contract keys before the change of behavior in DAML LF 1.DEV.
The existing ContractKeys test is renamed to ContractKeysSubmitterIsMaintainer.

The `LedgerTestSuiteRunner` now uses a fixed number of
threads for the runner threadpool. This way we don't flood
the CPU with threads when using a CachedThreadPool.
2019-08-13 15:15:51 +02:00
Remy
c2e2e007e7 Fix release notes about improper freeze of 1.6 (#2489)
* daml-lf: clean up a bit how verion are handle

* fix releases not about imporper release of #1866

* address Gerolf's comments
2019-08-13 08:10:24 +00:00
Gerolf Seitz
9d1af43ec8
Port WitnessesIT to the new test infrastructure. (#2486) 2019-08-13 09:24:08 +02:00
Gerolf Seitz
8f14c19fc9 Move assertion on exception type to match block. (#2495)
Addresses
https://github.com/digital-asset/daml/pull/2282#pullrequestreview-272786088
2019-08-12 12:52:01 -04:00
Gary Verhaegen
bf5995f529
remove mentions of da-int servers (#2485) 2019-08-12 10:42:41 +01:00
Gerolf Seitz
816b93e2c2
Produce a more compact test summary output. (#2483)
Example:

ContractKeys
- Divulged contracts cannot be fetched or looked up by key ... Success
- Contract Keys should reject fetching an undisclosed contract ... Success
- Contract keys should be scoped by maintainer ... Success

Divulgence
- Divulged contracts should not be exposed by the transaction service ... Success
- Divulged contracts should not be exposed by the active contract service ... Success

Identity
- A ledger should return a non-empty string as its identity ... Success

SemanticTests
- Test:consistency_doublespend1 ... Success
- Test:contract_keys_test ... Success
- Test:consistency_doublespend2 ... Success
- Test:authorization_success1 ... Success
- Test:authorization_rule2_failure ... Success
- Test:authorization_rule1_failure ... Success
- Test:privacy_projections1 ... Success
- Test:consistency_doublespend3 ... Success
- Test:authorization_success2_delegation ... Success

Time
- Advancing time should return the new time ... Success<Paste>
2019-08-12 09:13:38 +02:00
Stefano Baghino
afa4659292
New Ledger API test tool (#2282)
* New acceptance test tool prototype

* Fix transaction filter helper

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r308081386

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r308082432

Moreover, creates specific helpers for test DAML code.

* Move helpers from session to context

Remove a circular dependency between session and context, and limits the
usage of implicits.

* Run tests with ledgers out of process

* Prepare for drop in

* Temporary timeout increase

* Move bulk of the logic to the test runner

* Have a map of tests for CLI integration

* Timeout per-test, runner uses context, renaming

* Allow usage of time service, integrate semantic tests

* Integrate CLI SSL configuration

* Integrate failure expectation CLI option

* Integrate with failure output verbosity CLI option

* Integrate with test listing and picking CLI options

* Integrate with timeout scaling CLI option

* Integrate with command TTL CLI option

* Review CODEOWNERS

* Drop previously unimplemented CLI parameters

* Expand test todo list to encompass latest additions

* Deduplicate some testing infrastructure, swap in new test tool

* Remove unused rule

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311045444

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311051974

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311035287

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311055290

* WIP

* Make gRPC thread factory spawn non-deamon threads

* Remove debug prints, complete divulgence test (missing assertion messages)

* Try to detect assertion failure line number

* Add Sandbox binary that starts an ephemeral postgres instance

This allows us to use the client_server_test bazel macro to run against
the sandbox backed by postgres.

Fixes #1543

* Add Sandbox binary that starts an ephemeral postgres instance

This allows us to use the client_server_test bazel macro to run against
the sandbox backed by postgres.

Fixes #1543

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r311400695

* Remove TlsConfiguration duplicate, move original to commons

* Make assertion more readable

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

* Fix build errors introduced in previous commit

- exclude time service tests from reference-v2
- add copyright header to TlsConfiguration

* Complete divulgence test and address review comments

Restores comments from original divulgence tests and strives to be as
close to them as possible.

- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311429169
- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431156
- Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431913

* Delete old divulgence tests

* Restore methods to fetch contracts by template identifier

* Run conformance tests on in-memory sandbox

* Run conformance tests on the persistent sandbox

* Remove workflow identifier workaround

* New contract keys test (#2452)

* Set channel type for LedgerSession

* Add ContractKeysIT

* Run tests against reference-server v2

* Removed the old ContractKeysIT. However, ...

... I cannot remove ContractKeysChecks completely, because we have
another test path for DARs created prior to DAML-LF 1.6, which doesn't
have the submitter == maintainer restriction for contract keys.

* Use codegen instead of custom code

* Add missing copyright headers

* Drop sandbox conformance test suite (seems to not work on Windows CI)

* Make time simpler

* Test tool tests to run only semantic tests

* Make CI behave more consistently

* Add missing files to run tests on Postrgres

* Fix flaky divulgence test, introduce readable identifiers

* Increase sandbox conformance tests timeout

* Address https://github.com/digital-asset/daml/pull/2282#discussion_r312363246

* Reintroduce test resource extraction

* Read semantic tests from the classpath rather than Bazel

* Use codegen types for ContractKeys integration test

allocateParty returns Primitive.Party and create and exercise also
accept Primitive.Party. This way we don't have to keep a String and
Primitive.Party representation around.

* Bump timeout for sandbox conformance tests

* Remove dependency on Bazel runfiles
2019-08-09 17:00:37 +02:00
Gerolf Seitz
353a19c9ae Fix shutdown order to avoid dead letter logging when stopping sandbox (#2471)
It looks like that closing the LedgerApiServer before closing the
AkkaExecutionSequencerPool (AESP) leads to a non-deterministic bunch of dead
letter warnings when stopping sandbox.

Closing the AESP first avoids these warnings.

Fixes #1886
2019-08-09 08:27:17 +00:00
Gary Verhaegen
87d2fd4f31 remove sandbox-head-tarball (#2458)
We can get the same jar out of the SDK tarball.
2019-08-08 16:34:00 +01:00
Gerolf Seitz
6993232593 Fixed a bug that prevent sandbox from loading empty workflow ids. (#2446)
This happened because we translate empty workflow ids to None in the
API-to-domain translation layer. When we store the workflow id, we actually
convert the None case back to an empty string (and not a null value).

When loading the workflow id from the database, we parse the column as a regular
LedgerString, but unfortunately these cannot be empty. Therefore using empty workflow
ids on postgres has been broken since workflow id has changed from a tagged string
to LedgerString.
2019-08-08 11:29:21 +00:00
Gerolf Seitz
d52d3bc451
Semantic tests fall back to wall-clock time if timeservice is not available (#2419) 2019-08-08 13:08:57 +02:00
Michał Majcherski
86bec619d0 Sandbox reset 'ledger ID not found' fix (#2331)
* Sandbox reset 'ledger ID not found' fix

* Improve Haskell Ledger bindings tests

- Add an interceptor to Ledger Sandbox rejecting calls during reset
- Wait for new Sandbox - retrying getLedgerId calls in Haskell's ResetService - retry on errors and when Ledger IDs don't change

* satisfy hlint

* backout unnecessary haskell changes

* fmt.sh
2019-08-06 13:42:16 +01:00
Jussi Mäki
689d969038
kvutils commit refactoring (#2393)
* kvutils refactoring

Move transaction submission processing to its own class and refactor to
stop early on errors.

Throw a known error rather than use sys.error.

* Refactor package and party allocation

* Introduce "Commit" computation abstraction

This also fixes an issue where the command dedup entry was not created
when a later validation failed and a rejection log entry was created.

* Drop input_log_entries. Add contract instance to DamlContractState.

* Add copyright headers

* Add KeyValueCommitting.submissionOutputs

This cleans up implementations that need to know the outputs of a submission
up-front.
2019-08-05 16:30:21 +02:00
Petro Semeniuk
a7afaa2d99
Expose grpc max inbound message size as cli option (#2347) 2019-07-31 20:37:40 +10:00
Michał Majcherski
43d30fd872 Multiple sandbox resets scala test (#2337) 2019-07-31 09:50:45 +02:00
Gerolf Seitz
5da6b9c0ae
Integration test fixes (#2314)
* Avoid double logging for API Services

* Make WitnessesIT a word spec with a "title"

* The test reporter should also print the "should" keyword.

* Enable ALL.THE.TESTS. for reference-server v2
2019-07-30 11:27:57 +02:00
Stefano Baghino
340a4eb6a4
Read stakeholders through the active contract service (#2316)
* Read stakeholders through the active contract service

Fixes #2070

Also standardizes the use of American English spelling for `serialize`
and `deserialize`. Standardize. Serialize. Americanize.

* Remove Haskell bindings test workaround

* Address https://github.com/digital-asset/daml/pull/2316#discussion_r308193661
2019-07-30 10:40:45 +02:00
Leonid Shlyapnikov
b940951a76
HTTP JSON API first version (#1994)
* Cleanup

* WIP

* first integration test + fixture

* minor cleanup

* Implementing ContractService.lookup

* Reverting back to endpoints.all (all2 did not work)

* Cleanup

* replace ApiValue ADT with aliases to daml-lf/transaction Value ADT

* porting rest of navigator to LF Value ADT

* Command Service WIP

* CommandService WIP

* porting more of navigator to LF Value ADT

* last error, not first

* rename ApiValueImplicits file

* special conversion features for ImmArray and FrontStack

- just .to[ImmArray] or .to[FrontStack] any random collection

* finish porting most of navigator main code

* use numeric indices for record field name fallback when pretty-printing

* tuples are not serializable

* use numeric indices for label fallback in JSON verbose encoding

* make traverseEitherStrictly more likely to preserve the seq's class

* to shortcut for ImmArraySeq .to[ImmArraySeq]

* compiling, passing navigator backend tests

* test traverseEitherStrictly more, er, strictly

* pass scalacopts through to scaladoc

* deal with unused warning

* remove unneeded function

* simpler error reporting, more private functions in ApiCodecCompressed

* move slowApply to FrontStack, test it so it actually works

* remove unneeded toStrings; better error from impossible ValueTuple case

* scalafmt FrontStackSpec

* support alternative, label-free record JSON encoding

* Adding domain.CreateCommand + corresponding json formats and dummy json format for lav1.value.Record

* CommandService.create should be done... need to test it

* TODO added

* Cleanup

* move ApiCodecCompressed, ApiValueImplicits, and some aliases to new lf-value-json package

* Using tagged TemplateId type instead of Identifier + exercise command WIP

* adapt navigator to moved pieces

* start defining scalacheck extension to ApiCodecCompressedSpec

* CommandService.exercise + introducing CommandMeta

* Adding command endpoints, can't test them yet, need lf value json formats

* fuse some list operations

- suggested by @stefanobaghino-da; thanks

* blue error message

* Minor fixes after merging librify-navigator-json-compressed, #2136

* experiment with an inductive case in TypedValueGenerators

* finish a List case for TypedValueGenerators; it's revealing

* Introducing API value to LF value converter,

CommandsValidator takes IdentifierResolverLike instead of IdentifierResolver

* cleanup

* remove accidentally readded duplicate aliases

* start tying knots in TypedValueGenerators

* verbatim copy ApiCodecCompressedSpec to lf-value-json

* shift some tests from navigator to lf-value-json

* test Optional and Map for ApiCodecCompressed

* heavier random testing of ApiCodecCompressed

* remove unused dependencies from lf-value-json

* adding value json writer

* cleanup

* Revert "cleanup"

This reverts commit 2e4d153f

* fixing the build

* cleanup

* cleaning up imports

* JsValue to API value is done, needs a test

* cleanup

* use scalac -Ypartial-unification in http-json

* simplify some Traverse instances

* factor CreateCommand and ExerciseCommand traverse instances

* Command create integration test WIP

* Command create integration test WIP, got rid of the JsonReader and JsonWriter for the values, converting values explicitly

* Extracting DomainJsonDecoder and DomainJsonEncoder

* LfV refactoring

* Create command serialize/deserialize test works

* cleanup

* resolving conflicts

* More json encode/decode tests

* logging

* command/create passes integration test now

* Adding readme

* grammar

* TODO added

* GetActiveContractsResponse encoding

* ideintifier conversion renaming

* PackageService resolveTemplateId returns domain.TemplateId now

* Resolving LF Identifier instead of Template ID, this should also work for Exercise command decoding

* cleaning up a bit

* daml-lf: show type in TypedValueGenerators-driven errors

* exercise command json encoding/decoding works

* command/exercise IOU_Transfer integration test passes now

* avoid filter for Gens; makes many contract ID gens not fail

* test ApiCodecCompressed against 100 random types, 20 random values each

* Updating README instructions

* improving error handling, failed futures, get logged and reported to the user now as 500

* [ROUTING DSL] Removing routing DSL, it did not work

* getting rid of HttpEntity.Strict match + cleanup

* fixing the merge conflict

* updating README

* use Show.shows instead of new Show

* List(_) isn't checked, but Seq(_) is slightly safer

* improving test assertions

* Adding /contracts/lookup implementation

* http-json: use ImmArraySeq instead of List; use toRightDisjuction

* http-json: .toList.toSet is shorter than fold

* http-json: replace .leftMap.map with .bimap

* http-json: use subst instead of reimplementing JsonFormat

* http-json: remove unused ExceptionHandler

* http-json: safer == comparison

* Adding two test cases for expected errors

* Adding BazelRunfiles.rlocation magic that supposed to handle windows path for bazel dependencies

* http-json: import, not extend
2019-07-29 16:49:57 -04:00
Rohan Jacob-Rao
0b56eedcea
Better method for finding ID of test package (#2306) 2019-07-29 12:13:23 -04:00
Jussi Mäki
3724a5789e
Contract keys for kvutils (#2304)
* Support for contract keys to kvutils

* Fix handling of CreateEvents with contract keys in semantic tester

* Add ContractKeysIT to tests and fix issues related to fetchByKey

* Address code review
2019-07-29 16:45:24 +02:00
Davin K. Tanabe
acc41c3b84 Idempotent package uploads (#2131)
* Idempotent package uploads

* Log the correct number of duplicates

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2019-07-29 11:44:11 +00:00
Gerolf Seitz
04ca108e7b Eliminate grpc-netty runtime warning after grpc upgrade (#2313)
Netty emits a warning if the eventLoopGroup is customize without setting
the corresponding channelType.
2019-07-29 09:39:29 +00:00
Gerolf Seitz
136f6d1c08
Remove ExercisedEvent#contract_creating_event_id. (#2262)
This is a breaking change on the ledger api. So far we could rely on the
assumption that contractId == eventId. This assumption doesn't hold
anymore in a daml-on-x setting, where the eventId is created by the
api server, but the absolute contractId is created by the ledger
implementation.

Instead of going through weird contortions to store the relevant data in
the existing database schema, it is more viable in the long term to
remove that field and instead provide facilities to lookup transactions
by contractId.

Contributes to #2068.
2019-07-29 11:30:01 +02:00
Stephen Compall
5a707960d2
navigator: replace Value<->ledger-api conversion with ledger-api-common functions (#2292)
* ledger: refactor validateValue from CommandsValidator to new ValueValidator

* daml-lf: add a matchable class for leaf Values except ValueContractId

* ledger: use IdentifierResolverLike for CommandsValidator

* daml-lf: add Traverse[FrontStack]

* navigator: define readRecordArgument and readArgument in terms of ledger-api-common ValueValidator

* navigator: clean up fillInVariantTI

* navigator: replace ledger-api Value writer with LfEngineToApi from ledger-api-common

* navigator: use traverse

* navigator: remove dead sequenceMap

* navigator: adapt to new ValueValidator structure

* ledger: dealias validateValue call

* navigator: a good use case for traverseEitherStrictly
2019-07-26 14:24:34 -04:00
Michał Majcherski
37a921516b
Upgrade gRPC JVM libs (#2276)
* Haskell ledger bindings tests setup fix - use --port-file to obtain sandbox's port

* Update gRPC JVM libs

* Add missing gRPC core dependency

* Redirect sandbox's stdout and stderr to /dev/null

* Amend ledger's NettyServerBuilder settings after gRPC upgrade
2019-07-26 14:44:59 +02:00
Robert Autenrieth
164d57a48e
Add notes on writing tests (#2264) 2019-07-24 07:28:50 +02:00
Remy
53de5edbc1 ledger-api: Kill legacy identifier (#2211)
* ledger-api: drop support for legacy identifier

* address scala-codegen: Stephen's comments

* language support: fix test
2019-07-23 20:34:52 +00:00
Gerolf Seitz
6e6b2d67d2
More integration tests for test tool (#2241)
* Add CommandSubmissionTtlIT to Ledger API Test Tool

* Add ActiveContractsServiceIT to Ledger API Test Tool

* Add WitnessesIT to Ledger API Test Tool

* Delete useless test

* Move time manipulation in TransactionServiceHelpers

* Add CommandServiceIT to Ledger API Test Tool

* Add the missing summary case to the ToolReporter
2019-07-23 16:51:28 +02:00
mziolekda
ac06bef329
eliminate v2 version of the participant-state interface (#2255)
* eliminate v2 version of the participant-state interface

* remove participant-state-v1 from release artifacts
2019-07-23 14:59:15 +02:00
Gerolf Seitz
c3731e6721 Only log the file-names and not the entire archive on startup (#2226) 2019-07-19 15:08:42 +00:00
Robert Autenrieth
73545d44a5
Wait for index before completing package upload (#2194)
This makes sure users can immediately query the new
packages after the upload completed.

Fixes #2066
2019-07-18 10:04:41 +02:00
Beth Aitman
cd514eb024 Stdlib doc edits (#2163)
* Stdlib doc edits

* Apply suggestions from code review

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update based on Moritz's suggestion

* Fix ledger-api-integration-tests
2019-07-17 07:54:13 +00:00
Stephen Compall
1a93db264d
navigator: Use LF Value ADT in place of ApiValue ADT (#2053)
* replace ApiValue ADT with aliases to daml-lf/transaction Value ADT

* porting rest of navigator to LF Value ADT

* porting more of navigator to LF Value ADT

* last error, not first

* rename ApiValueImplicits file

* special conversion features for ImmArray and FrontStack

- just .to[ImmArray] or .to[FrontStack] any random collection

* finish porting most of navigator main code

* use numeric indices for record field name fallback when pretty-printing

* tuples are not serializable

* use numeric indices for label fallback in JSON verbose encoding

* make traverseEitherStrictly more likely to preserve the seq's class

* to shortcut for ImmArraySeq .to[ImmArraySeq]

* compiling, passing navigator backend tests

* test traverseEitherStrictly more, er, strictly

* pass scalacopts through to scaladoc

* deal with unused warning

* remove unneeded function

* simpler error reporting, more private functions in ApiCodecCompressed

* move slowApply to FrontStack, test it so it actually works

* remove unneeded toStrings; better error from impossible ValueTuple case

* scalafmt FrontStackSpec

* support alternative, label-free record JSON encoding

* fuse some list operations

- suggested by @stefanobaghino-da; thanks

* blue error message
2019-07-16 10:53:17 -04:00
Stefano Baghino
26caa24c93 Remove dead file (#2140) 2019-07-15 08:51:40 +00:00
Gabor Aranyossy
77964ce426 Keeping loaded packages after reset (#2091)
* keeping loaded packages after reset

removing unnecessary extra reference

changelog

making InMemoryPackageStore immutable

* using Instant.now when loading packages in IndexServer
2019-07-12 12:20:18 +00:00
Stefano Baghino
f80de418f9 Filter out checkpoints in completion stream tailing test (#2122)
Fixes #2121
2019-07-12 12:06:04 +00:00
Stefano Baghino
c651e94f82 Throw away unused resource extensions (#2118) 2019-07-12 08:35:34 +00:00
Gabor Aranyossy
33c746fe9b loading Dars from ZipInputStreams (#2005)
* loading Dars from ZipInputStreams

formatting and cleanup

fixing DarReaderTest not compiling

fmt

using IOUtils to read the ZipInputStream

fixing CodeGen

fixing broken legacy DAR loading

fixed v2 ReferenceServer

cleanup

* fixing rebase conflicts

* introduced a fromFile method to avoid having to do boiler-plating where the input is a File

* addressing leaking resources

* cleanup

* inlining closures

* closing the darStream
2019-07-11 15:37:21 +00:00
Gabor Aranyossy
dc89f3fa72 fixing unhandled passTime cases in scenario loader (#2085)
* fixing unhandled passTime cases in scenario loader

* changelog update
2019-07-10 09:59:14 +00:00
Stefano Baghino
4ff9a6b7ea
Run PartyManagementServiceIT in conformance tests (#2040)
* Run PartyManagementServiceIT in conformance tests

* Poll for persisted user without using Await

Addresses https://github.com/digital-asset/daml/pull/2040#discussion_r301441379

* Remove unnecessary call to ledger end

Address https://github.com/digital-asset/daml/pull/2040#discussion_r301435726

* Review and improve test when endpoint is not implemented

Address https://github.com/digital-asset/daml/pull/2040#discussion_r301480120

* Fix typo in docstring

Address https://github.com/digital-asset/daml/pull/2040#discussion_r301475151

* Adopt exponential backoff for readability polling

Address https://github.com/digital-asset/daml/pull/2040#discussion_r301586140

* Disable PackageManagementServiceIT

* Restore previous testing of party names

* Replace blocking sleep with Akka's after
2019-07-09 18:44:18 +02:00
mziolekda
71e3edb21c clean up versions v1 and v2 of participant-state (#2036) 2019-07-08 15:04:17 +00:00
mziolekda
36ef2d1d1b Generate a list of single package updates for an upload message containing multiple packages (#2031)
* make every PublicPackageUploaded update contain exactly one package

* implement update subscriptions that start with offsets with the same major number

* address review comments
2019-07-08 11:22:28 +00:00
Gerolf Seitz
f310fe45e6 Integration test fixes + enable tests for postgres index|er (#2032)
* Do not convert the transaction id to Long in LedgerBackedIndexService

The InMemoryLedger does this, because it can make certain assumptions
(like transactionId == offset), but the sql based ledger cannot do that,
because the transactionId may be produced by another backend and thus
have a different format.

* Move tests that use contract keys into their own integration test file

This allows us to run the other tests via the ledger api test tool with
the postgres indexer while InMemoryKVParticipantState doesn't support
contract keys yet.

* Remove a few occurrences of LedgerBegin from TransactionServiceIT.

* Rename CommandTransactionChecksNo1866IT to ContractKeysNo1866IT

* Enable TransactionServiceTests,DivulgenceIT,TransactionBackpressureIT for postgres index|er

* format all the things

* Address a few review comments.

See https://github.com/digital-asset/daml/pull/2032#pullrequestreview-258771927

* Extract reusable base class for ContractKeys tests

This is needed because Bazel's scala_test_suite isolates the tests from
another, and one test cannot extend another one.

* Classify the reference-v2 conformance tests with a long timeout
2019-07-08 11:10:55 +00:00
Oliver Seeliger
33695b9961
DamlOnXSubmissionService shuts down ExecutorService on close (#1999)
* DamlOnXSubmissionService shut down of package load executor service

* ReferenceIndexServer specifies viable PackageId

Using dash (-) instead of slash (/)
2019-07-08 08:58:27 +02:00
Stefano Baghino
3799847041 Make PostgresIndexer persist PublicPackagesUploaded (#2022)
Advances #1273

Also adds tests for the data access object to upload packages and fixes
bug that emerged.
2019-07-05 19:04:52 +00:00
mziolekda
7e3d580768 Connect LedgerAPI party and package management with KVUtils (#1985)
* connenct LedgerAPI party and package management with KVUtils

* formatting

* address review comments

* add participantId parameter to sandbox and indexer

* annotate TODO's with github issue numbers
2019-07-05 15:31:17 +00:00
Gerolf Seitz
79d88a4952 dd a reference server main class that starts an ephemeral postgres server (#2024)
This way we can run the test suite of the ledger api test tool against the
postgres index and postgres indexer.
2019-07-05 13:52:43 +00:00
Francesco Mazzoli
ca5d045e62 check that submitter is in maintainers for lookup by key (#1967)
* check that submitter is in maintainers when looking up keys

Fixes #1866. Note that this limitation applies both for `lookupByKey`
and `fetchByKey` -- anything involving retrieving a key is affected.

* add UNTIL-LF to run tests up to a certain version of DAML-LF

* name targets for DAML tests better

* add notes about DAML-LF changes

* commit Test.daml with DAML-LF 1.5 rather than compiling it on the fly

* add scenario tests for #1866

* add warnings about future key behavior in docs

* use flag rather than version when executing
2019-07-05 09:34:26 +00:00
Gary Verhaegen
acbc5de820 remove some build warnings (#2012) 2019-07-04 22:07:49 +00:00
Gerolf Seitz
399cab79be
Make DivulgenceIT work with the test tool (#2002)
1) Change to SuiteResourceManagementAroundAll, transforming the test to
not assume a new/empty ledger for each test case
2) Use distinct workflow ids so the individual test cases don't clash
with each other
3) Use a new UUID for each randomized command id, instead of using the
uuid used per test run.
2019-07-04 18:43:38 +02:00
gleber
3dac96f8d3 Ledger API Test Tool: skip semantic tests on unsupported Ledger API. (#1976)
Semantic tests will be skipped if the specified Ledger API endpoint does not
implement TimeService.

This teaches MultiLedgerFixture to deal with cancelled tests.

This improves Ledger API Test Tool reporter to deal with cancellations better.
2019-07-03 18:27:25 +00:00
Gerolf Seitz
a449d86ee0
Initial Ledger API Server (#1978)
* Add external offset column to parameters

We only ever need to use the external offset when restarting the api
server from a persistent data store to resume the ReadService state
update stream from the last processed offset.

In the PostgresIndexer we then need to store the external offset while
adding a new ledger entry.

* Allow disabling the jmx reporter in metricsmanager

* Implement PostgresIndexer component

* Introduce read-only Ledger and Dao

* SandboxEventIdFormatter treats transactionId as opaque string

* Introduce LedgerBackedIndexService

This can be reused both in the Sandbox and the ApiServer

* Implement PostgresIndex component

* Reference Service based on kvutils-v2 and postgres(index|indexer)

* Disable conformance test for ReferenceServer
2019-07-03 15:25:22 +02:00
Michał Majcherski
5702df7808
windows: fixed client_server_test setup (#1958) 2019-07-03 09:59:29 +02:00
Gabor Aranyossy
7e7c5f08cc started centralizing api Test utils (#1863)
* Centralises testing utilities around:

* transaction filters
* offsets
* parties

* fixed CommandCompletionServiceIT

* overriding the party in commands helper

* fxied wrong filter usage in TransactionServiceLargeCommandIT

* fixing CommandTransactionChecks

* fixing broken tests
2019-07-02 15:06:52 +00:00
Robert Autenrieth
b50ee984a0
Implement a PostgreSQL package store (#1818)
Adds a PostgreSQL package store to the sandbox.

Previously, packages were only stored in memory and
specified as CLI arguments. So if a user uploaded a
package at run time, he needed to add the package to
the CLI when restarting the sandbox.
2019-07-02 15:43:43 +02:00
Stefano Baghino
4774e75eb8 The completion stream RPC defaults to the ledger end as offset (#1961)
* The completion stream RPC defaults to the ledger end as offset

Fixes #1913

Relevant changes are propagated to the Java bindings (including
deprecating a method that would now return a nullable ledger end).

* Refactor completionStream method

* Address review comments

- ignore command creation results
(https://github.com/digital-asset/daml/pull/1961#discussion_r299089539)
- avoid re-connecting to the client for every command
(https://github.com/digital-asset/daml/pull/1961#discussion_r299092328)
- move offset field optionality to domain object
(https://github.com/digital-asset/daml/pull/1961#discussion_r299090451)

* Improve tests
2019-07-02 10:02:43 +00:00
Gabor Aranyossy
2bb8263a5e adapting docs to match state as is regarding not supporting dalf files (#1951)
* adapting docs to match state as is regarding not supporting dalf files

* patching release notes instead

* validating for ZIP files in Cli parser

* guarding for parsing non zipped archives

* Update release-notes.rst

* Update unreleased.rst

Co-Authored-By: Beth Aitman <bethaitman@users.noreply.github.com>

* Update unreleased.rst

* Update release-notes.rst

* Update release-notes.rst
2019-07-01 13:36:56 +00:00
mziolekda
02e94ec845 provide party and package management in KVUtils and participant-state v1 (#1553)
* provide asynchronous interfaces for party and package management on the participant-state

* provide submission id for correlating req with resp on Write- and ReadService

* add asynchronous party allocation in KVUtils

* start conversion of the package upload and party allocation to synchronous paradigm

* implement synchronous versions of party allocamtion and packacge update

* document recent changes and unify concepts between v1 and v2 versions of
the participant-state interface

* scala formatting

* address review comments
2019-07-01 12:57:33 +00:00
Gabor Aranyossy
709112e92b fixing issue of returning inclusive ledger offsets with completions (#1932)
* fixing issue of returning inclusive ledger offsets with completions

* changelog update

* removed TODO

* fixing haskell tests
2019-07-01 07:45:26 +00:00
Ognjen Maric
54cf2ee836
Retain fetch actors during reinterpretation (#1414)
DAMLe: add submitters and retain fetch node actors in reinterpretation

Co-Authored-By: Francesco Mazzoli <f@mazzo.li>
2019-06-28 15:40:52 +02:00
gleber
2089b2dc0d Ledger API tests: option for non-unique identifiers (#1735)
* Ledger API Test Tool: Add --stable-identifiers option.

* Ledger API Test Tool: split stable party and command identifiers options.

This allows to control individually which identifiers are stable and which are
randomized.

* Ledger API tests: introduce TestIdsGenerator.

It combines all places where per-run unification of identifiers was generated.

* Ledger API Tests: use unification methods instead of run*Suffix

* Review fixes
2019-06-28 10:22:50 +00:00
gleber
52e88b3364 Sandbox: streamline log-level scopt option parsing. (#1931) 2019-06-28 09:52:21 +00:00
gleber
eba635fde4 Sandbox: add cli-controlled logging level (#1835) 2019-06-28 08:35:25 +00:00
Moritz Kiefer
61eace44fe
Switch to nixpkgs-unstable (#1921)
The main reason for doing this is that it saves us the trouble of
having to backport changes, e.g., a newer MacOS toolchain.
2019-06-27 18:47:42 +02:00
Remy
c412d4e3d2 Add pretty C# namespaces in archive and leger-api protos (#1911)
* add nice C# namespace for in leger-api proto

fixes #1901

* add pretty C# namespace for archive protos

fix #1900
2019-06-27 11:39:33 +00:00
Robert Autenrieth
77d916288a
Update participant state v2 interfaces (#1800)
Moves party allocation to its own WriteService trait (similar to package upload).

Changes uploadDar to uploadPackages, so that the write service does not depend on the DAR file format.

Adds or improves many comments.
2019-06-27 11:44:15 +02:00
Gabor Aranyossy
d24366f3e2 Archives CLI args are not mandatory anymore (#1908)
* making archives optional

* amending CliSpec to match the new spec

* changelog
2019-06-27 09:15:22 +00:00
Jussi Mäki
c23af0eaa0
Introduce contract key to exercise node (#1783)
* Introduce contract key to exercise node

Track the contract key in NodeExercises. This is in
preparation for adding the key into exercise events, and
for support for contract keys in kvutils, where we need
to be able to compute the outputs of the submission, e.g.
the contract key that would be unset by a consuming exercise.

This introduces transaction version 8.

* Move release note on contract keys in exercises to unreleased.rst

* Address Stephen's review

- Drop changelog entry for this change as it is not user facing
- Add info on version 8 to transaction.rst. Fix typo in version 7.
- Reorder VersionTimeline as per review
- Only compare the NodeExercise 'key' if it is set in the original
  transaction (in order to compare transactions in a backwards
  compatible manner)

* Unbork unreleased.rst
2019-06-27 09:57:40 +02:00
Stefano Baghino
f8bebffb4e Expose signatories and observers throughout the platform (#1814)
* Add signatories and observers to Ledger API

Cascade fixes deriving from compilation and test errors.

* Add signatories and observers to Java bindings and codegen

* Add signatories and observers to Scala bindings and codegen

* Add signatories and observers to navigator

* Add signatories and observers to the Haskell bindings

* Add integration test

* Comply with formatting standard

* Add release notes

* Apply edits from CI feedback and self-review

* Fix wrong input on test case for observers sorting

Co-Authored-By: Robert Autenrieth <31539813+rautenrieth-da@users.noreply.github.com>

* Read JSON as strings from DB, parse them as parties

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296405252

* Change parties rendering and observer display condition

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296390104

* Fix sorting tests, implement sorting by agreement

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296397390

FIXME notes have been added for suspicious test cases

* Prevent any mutation of CreatedEvent arguments

Address https://github.com/digital-asset/daml/pull/1814#discussion_r296572639

* Comply with formatting standard

* Stakeholders are filtered up to the witnesses

Addresses https://github.com/digital-asset/daml/pull/1814#discussion_r297102521
2019-06-26 14:02:59 +00:00
Gabor Aranyossy
6456834459 fixing typo in Postgres config (#1855) 2019-06-25 08:11:37 +00:00
Gabor Aranyossy
9de01124e6 increasing default JMH timeout for manySmallContracts (#1851)
* increaseing default JMH timeout for manySmallContracts

* reenable perf tests
2019-06-25 07:24:11 +00:00
gleber
f63bb8a410 Ledger API: scale all timeLimits in tests with ScaledTimeSpans (#1843) 2019-06-24 13:26:04 +00:00
Gerolf Seitz
ab4c147cdb
Additional tests for ledger api test tool (#1792)
* Run integration tests for sandbox through the IT test suite

We currently don't run sandbox on postgres via ledger-api-test-tool. We
need to first figure out how to best do that before we can switch
sandbox to the test tool again.

* CommandClient#submitSingleCommand also uses commandUpdater

* The test reporter for the test tool now handles ignored tests

* More optional tests for ledger-api-test-tool

- TransactionBackpressureIT
- DivulgenceIT
- CommandTransactionChecksHighLevelIT
- CommandTransactionChecksLowLevelIT

Contributes to #1374.
2019-06-21 13:24:24 +02:00
Robert Autenrieth
439830b5bc
Update participant state v2 interfaces (#1767)
... with recent changes done to v1
2019-06-20 13:03:46 +02:00
Gerolf Seitz
0ab4199bc6
Preparations for Index + Indexer (#1766)
* Add missing domain.RejectionReason cases
* Use java.time.Instant instead of damlf Timestamp
* Make applicationId, submitterParty, commandId optional in LedgerEntry.Transaction
2019-06-19 16:28:28 +02:00
Robert Autenrieth
c14b909c71 Implement package management API in the sandbox (#1610)
* store archive size in `DarReader`

* rename `SandboxTemplateStore` to `SandboxPackageStore`

* store package info in `SandboxPackageStore`

* introduce package upload / read to write / index services

not tested yet, just a ton of plumbing

* WIP test the package service

* Fix build errors after rebase

* Move packages service to v2

* Ledger API client uses ledger API types

* Fix ReflectionIT

* Correctly handle uploading invalid dar files

* Fix reading DAR entry file sizes

* Improve package management IT

* Improve handling of duplicate packages

* Fix language-support build

* Use unique party and command names

* Rename lfpackage to language

* Rename SandboxPackageStore to InMemoryPackageStore

* Remove getCurrentTime ledger method

* Improve package management IT

* Move InMemoryActiveContracts and InMemoryPackageStore

* Use case object for UploadDarResult.Ok

* Address review comments

* Update release notes

Fixes #1311

* Use BazelRunfiles in test
2019-06-19 12:31:53 +00:00
Stefano Baghino
656e456b78 Add ExerciseByKey command to Ledger API (#1724)
Fixes #1366

Also adds support for the new command to the Java bindings and codegen
2019-06-19 09:11:52 +00:00
Davin K. Tanabe
a77c5216b5 sandbox: Fix a migration script. (#1684)
This fixes two issues with the sandbox database migration:
* A typo in the migration script
* Error deserializing transactions due to protobuf recursion limits

Fixes #1682
2019-06-18 23:48:15 +02:00
Gabor Aranyossy
a590b5c0aa adding more logging around Postgres fixture lifecycle (#1750) 2019-06-18 15:56:06 +00:00
Francesco Mazzoli
a15d9e28a9 try to make macOS tests less flaky by bumping the TTL (#1744)
see comment for more details.
2019-06-18 14:52:52 +00:00
Gabor Aranyossy
e2b34cdea9 adding some debug printlns (#1734) 2019-06-18 11:58:08 +00:00
Gabor Aranyossy
7b7b7d9cb2
added missing closure for checkpointQueue in SqlLedger (#1702)
* added missing closure for checkpointQueue in SqlLedger

* changelog update
2019-06-17 15:42:10 +02:00
Michał Majcherski
285c766e16
windows: ledger and extractor tests; improved msys2 installation (#1643)
* windows: ledger tests

* windows: extractor tests

* windows: combine msys2 manifest files
2019-06-17 09:40:28 +02:00
Stefano Baghino
6ba26f4e1f Add contract keys to created events in the Ledger API (#1586)
* Add contract keys to created events in the Ledger API

Fixes #1268

* Update ledger/ledger-api-integration-tests/src/test/itsuite/scala/com/digitalasset/platform/tests/integration/ledger/api/TransactionServiceIT.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Update language-support/java/bindings-rxjava/src/test/scala/com/daml/ledger/rxjava/grpc/helpers/TransactionGenerator.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Update ledger/ledger-api-integration-tests/src/test/itsuite/scala/com/digitalasset/platform/tests/integration/ledger/api/TransactionServiceIT.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Add run suffix to transaction service integration tests

Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293233810
Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293233886

* Re-introduce unused bindings

Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293056685
Addresses https://github.com/digital-asset/daml/pull/1586#discussion_r293056741

* Update ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/participant/util/LfEngineToApi.scala

Co-Authored-By: Stephen Compall <scompall@nocandysw.com>

* Use newly introduce assertOrRuntimeEx method

Applies the suggestion introduced by 7cc5c3eb71

* Contract keys to be typed after generated types

Also adds support in daml-lf/interface for contract keys

Addresses https://github.com/digital-asset/daml/pull/1586#pullrequestreview-249431707

* Address https://github.com/digital-asset/daml/pull/1586#discussion_r293773427

* Fix compilation error from previous commit

* Fix compilation errors in navigator
2019-06-14 16:45:12 +00:00
Jussi Mäki
866b135a85
Disable TransactionIT for the daml-on-x reference server (#1644)
The test adds latency and may be flaky. Since it is very soon
replaced by the sandbox-based implementation, we shouldn't need
to constantly test this.
2019-06-14 15:51:10 +02:00
Jussi Mäki
8faa414760
Fix various issues with the reference daml-on-x implementation (#1613)
* Fix various issues with the reference daml-on-x implementation

- Add authorization check to submission to catch authorization errors early
- Fix filtering by templates in transaction service
- Loosen the transaction_id validation to accept transaction_ids as used by
  the reference implementation
- Fix handling of ledger end
- Add caching to archive decoding
- Enable TransactionIT for the reference implementation
- Fix time service event dedup

* fix transaction validation which started reporting different error type

* fix transaction fetching tests on sandbox that assumed that transaction ids would be verified as numbers by the api validation layer

* return NOT_FOUND in all places where a non-existing transaction id or event id is used to fetch transactions
2019-06-13 14:37:26 +02:00
gleber
13d299f23d
Ledger Api Test Tool: Add --command-submission-ttl-scale-factor arg. (#1634)
Scale factor for time-to-live of commands sent for ledger processing
(captured as Maximum Record Time in submitted transactions) for
"SemanticTests" suite. Useful to tune Maximum Record Time depending on
the environment and the Ledger implementation under test. Defaults to
1.0. Use numbers higher than 1.0 to make timeouts more lax, use
numbers lower than 1.0 to make timeouts more strict.
2019-06-13 14:18:56 +02:00
Remy
0591075187 cleanup daml-lf scala packages (#1581)
* cleanup daml-lf scala packages

* Address Stephen's Comments

* update maven coordinates of language package
2019-06-12 15:55:48 +00:00
mziolekda
319e042860 create separate bazel targets for participant-state-v2 (#1562) 2019-06-11 08:00:02 +00:00
Robert Autenrieth
80e8ac113d
Add support for party management in the sandbox (#1452)
Fixes #1312

This PR adds support for party management in the sandbox:

Both the in-memory and the SQL backend track a list of known
parties, and implicitly add any party mentioned in a transaction.
New calls were added to the IndexService and the WriteService
for managing parties. These calls are wired to the above mentioned
persistence backends, and to a new API service.
A corresponding client interface was added to the scala API client.
An integration test was added for checking that a call to allocate a
party succeeds.
An integration test for the sandbox was added for checking that the
sandbox implicitly adds all parties mentioned in a transaction.
2019-06-11 08:08:55 +02:00
Gabor Aranyossy
002266caab
introducing the Indexer (#1559) 2019-06-07 16:09:57 +02:00
Gabor Aranyossy
e80e2f55c4 removed dependency on SandboxConfig from ApiServices (#1555)
* removed dependency on SandboxConfig from ApiServices

* using v2 state API applying some backporting where necessary

* cleanup
2019-06-07 12:06:40 +00:00
Gerolf Seitz
8a08b752a9
Use Ledger API Test Tool for sandbox (#1545)
Extra command line arguments to the client_server_test target are passed
to the ledger-api-test-tool instead of the arguments defined in the
bazel target.

For example:
`bazel run //ledger/sandbox:conformance-test-static-time --list` will
pass the --list parameter to the ledger-api-test-tool (to print all
available tests), instead of actually running the tests in static-time mode.


The Ledger API Test Tool takes the flag --all-tests to run all defaul
 and optional tests

The tool also allows multiple occurrences of the --include and --exclude
flags.

Also removes StandaloneSemanticTestRunner.

Fixes #1371
2019-06-07 12:04:31 +02:00
mziolekda
4389cbc83e Provide initial implementation of package management in the KVUtils (#1498)
* Provide initial implementation of package management in the KVUtils

* rename updateArchives to updatePublicPackages and add them to the abstract interface

* remove participant-state:reference app from published artifacts

* adopt the changes to the recent version split
2019-06-07 07:03:02 +00:00
mziolekda
7efceffb60 introduce participant-state interface v2 (#1541)
* introduce participant-state interface v2 to allow spliting daml-on-x workstream from sandbox

* correct code comments documenting the v2 participant-state package
2019-06-06 20:43:12 +00:00
Gabor Aranyossy
eb922743d1 Ledger abstraction moves behind IndexAndWriteService (#1544)
* Sandbox ContractStore has been internalized

* Ledger got moved behind WriteAndIndexService

* cleanup

* fixed wrong SqlStartMode usage
2019-06-06 14:41:46 +00:00
gleber
b61203d1cd Run Transaction Service IT as part of Ledger API Test Tool (#1434)
Add tTansactionServiceIT into Ledger API Test Tool as an optional test.

Available tests can be listed with the --list option.
Tests can be included with --include, and excluded with --exclude.

Fixes #1372, #1472
2019-06-06 13:32:55 +02:00
Martin Huschenbett
468ef3e469
Make it explicit that contract key maintainers are computed from key (#1527)
* Use ghc-lib-0.20190604

* HieFile fix

* Update to ghc-lib-0.20190604.1

* Make maintainers depend directly on key

* Remove useless tests

* Adjust documentation

* Add release notes

* Simplify some code

* Fix tests to use new syntax

* Fix template desugaring docs

* Fix more tests
2019-06-05 10:27:38 -04:00
Gabor Aranyossy
9cb6baacdf removing ledger backend module (#1524)
* removed ledger backend module

* removed artifact publishing

* some formatting

* updated comment

* changing names

* Update ledger/participant-state/src/main/scala/com/daml/ledger/participant/state/v1/SubmitterInfo.scala

Co-Authored-By: Gary Verhaegen <gary.verhaegen@digitalasset.com>
2019-06-05 11:01:52 +00:00
Robert Autenrieth
f30b6404cd
Add party management to participant state (#1510) 2019-06-04 15:19:25 +02:00
Robert Autenrieth
b146295cf4
Move ActiveContractsInMemory to a separate file (#1509) 2019-06-04 11:48:50 +02:00
Gabor Aranyossy
35ef13f52a
added recovery logic around ledger entry persistence failures (#1505)
* added recovery logic when ledger entry persistence fails

* adding release notes

* logging only when the queues are closed due to an error

* using error instead of warn
2019-06-04 11:48:34 +02:00
Martin Huschenbett
5396f42b3a
Drop support for DAML-LF 1.3 from damlc (#1445)
* Drop support for DAML-LF 1.3 from damlc

This means `damlc` now only supports versions allowing arbitrary expressions
as contract keys. This is very helpful for the upcoming new template
de/re-sugaring underpinning generic templates.

* Unpin a few DAML-LF target versions in tests

* Fix golden tests

* Adapt changelog to rebase

* Rename DAML-LF scenario tests to 1.dev

* Update tests to --target 1.dev

* Fix release notes
2019-06-03 14:00:25 -04:00
gleber
a69b4b8c86 Ledger API Tests: use real ledger ID everywhere. (#1400)
This fetches and caches ledger ID inside LedgerContext.SingleChannelContext to
reduce number of calls into the Ledger API under test.
2019-06-03 12:28:36 +02:00
Gabor Aranyossy
35acc58335
Index service refactor (#1476)
* IndexService renamings

* renaming APIServices

* IdentityProvider into SandboxBackend

* SandboxIndexService awaken

* goodbye LedgerBackend!

* integration of IndexPackagesService

* ContractStore got embedded too

* collapsed index-service sub interfaces when creating an ApiServer
2019-06-03 09:45:12 +02:00
Gabor Aranyossy
e12cf0d418
introducing a validator into completion service (#1465)
* things compile

* cleanup close() invocations

* introducing PartyValidator
2019-05-31 14:06:20 +02:00
Remy
f84e7d79d2 Add enum type to daml-lf (#1397)
* add enum type to daml-lf dev

* Address Francesco's comments

* Address Martin's comments

* fix daml-lf proto version history
2019-05-29 12:15:01 +00:00
gleber
9a0e1ac89a Bring back integration tests. (#1440)
These were mistakenly disabled along with the move to tests-as-a-library
construct. The 'scala_test_suite' macro does discovery only over sources, not
dependencies.
2019-05-29 13:45:46 +02:00
Gerolf Seitz
70f748379a
Use effective_at to populate contracts loaded in SqlBackend (#1436)
Because the record time was mapped to the ledger effective time field
when deserializing contracts from the SQL database, a subsequent
comparison between the LETs of two nodes in the same transaction caused
the transaction to be rejected.

Fixes #1435.
2019-05-29 12:40:03 +02:00
Gabor Aranyossy
6642aa35c8
Completion Service via Index Service (#1426)
* SandboxLedgerBackend implements CompletionsService from IndexService

* things compile

* cleanup

* cleanup

* commandId is not optional anymore

* proper filtering of completions
2019-05-28 15:54:04 +02:00
Gerolf Seitz
977fc7669d SandboxSubmissionService defined in terms of ContractStore and WriteService (#1419)
Towards #1273.
2019-05-28 10:28:32 +00:00
gleber
40ce2b9be8 Unify semantic test between sandbox IT and Ledger API Test Tool (#1171)
* Add RemoteApiProxy fixture type.

This is in preparation for using Sandbox IT suite as part of the Ledger API Test
Tool.

* ledger-api-test-tool: Drop reset functionality.

This is no longer necessary for the tool and it does not scale with the types of
tests in the suite.

* integration-tests: Fail if the server under fixture is stuck.

This makes sure that a server getting stuck will get detected by a test, instead
of ignoring it and potentially allowing the server to linger.

* integration-test: Make semantic testing runs independent.

It manges parties and command identifier to include a unique (random) suffix in
all ledger-commited identifiers. This allows the test to run against a Ledger
API without reseting it.

* ledger-api-test-tool: Unify test code using scenario runner with IT suite.

This reuses the scenario runner test code from the IT suite, instead of
reimplementing it. This should be a no-op (except for tests reports formatting).

* Review fixes.

* Ledger API Test Tool: Provide logback config.

This quites Ledger API Test Tool output.

* Make sure akka threads are terminated at end of test runs.

This makrs Akka threads to be daemons, hence forcing them to be closed at the
end of Ledger Api Test Tool.

* Use Ledger API Test Tool in tests of reference server.

* Add Apache commons-lang3.

* Ledger API Test Tool: Implement custom test reporter.

This addresses two needs:
- avoid using buggy scalatest test reporter;
- pretty-prints test results prettier.

* dade-copyright-headers: return success on successful reformatting.
2019-05-28 09:58:58 +00:00
Gerolf Seitz
9f21b6c669 Transaction service (#1404)
* Isolate daml-on-x prototype

* Implement TransactionService of index api.

Towards the first milestone of the daml-on-x integration steps

* fix compiler error after last-minute refactoring

* formatting

* remove unnecessary dependency from api-server-damlonx

* Fix some inconsistencies.
2019-05-27 15:36:57 +00:00
Gabor Aranyossy
be0a8110a9
using LedgerId domain type (#1403)
* getting a compiler SOE

* /ledger/... compiles

* all compiles

* fmt
2019-05-27 17:01:17 +02:00
gleber
d4efabe6cb Make logback config explicit in binaries and tests. (#1405)
This prevents binaries from including random logback configuration via library
dependencies.

Relevant binaries were found with:

    bazel query  --order_output=no  --universe_scope='//...:*' \
       'kind(".*(test|binary).*", allrdeps(//ledger/ledger-api-integration-tests:ledger-api-integration-tests-lib))'
2019-05-27 16:34:44 +02:00
Gabor Aranyossy
ff088efd94
porting API services to used Index Service v2 (#1362)
* moving to index service v2

* damlonx does not depend on v2 index service anymore

* leger -> ledger

* transacion id fix
2019-05-24 19:18:51 +02:00
Gabor Aranyossy
1b846386a7 avoid null characters to generate rejections (#1378)
* using valid utf characters to generate rejections

* Update ledger/sandbox/src/test/suite/scala/com/digitalasset/platform/sandbox/stores/ledger/sql/PostgresDaoSpec.scala

Co-Authored-By: Remy <45566104+remyhaemmerle-da@users.noreply.github.com>
2019-05-24 13:31:37 +00:00
Remy
294abecf5d daml-lf remove LedgerIdString (#1376) 2019-05-24 12:08:28 +00:00
Martin Huschenbett
9a97169ad6
Remove exerciseExplicit from daml-stdlib (#1351)
This is a preparation for making the actors in DAML-LF's exercise
instruction optional (see #1347).

This is technically a breaking change but since `exerciseExplicit` has never
been exposed via the documentation, we don't add a release note.
2019-05-24 12:26:38 +02:00
Remy
4f18b1afa7 DAML-LF internal type safety (#1192)
* Rename Value's ContractId to VContractId

* daml-lf: a bit more about PartyId

* daml-lf: Concatenable MatchingStringModule

* daml-lf make clear type used for Scenarios only

* daml-lf create ContractId, LedgerId, TransactionId

* sandbox-sql conversion util

* LedgerName -> LedgerString

* futher type cleanup in the sandbox

* daml-lf add test for LedgerString

* fixing tests

* a bit more safety in the DB

* Address Stephen's comments

* fix rebase

* More fixes for StringModule

* change length of LedgerString (256 -> 255)
2019-05-24 09:53:29 +00:00
Gabor Aranyossy
e21dd44570
Active Contacts Service from IndexService is wired through (#1314)
* Active Contacts Service from IndexService is wired through

* almost all tests pass

* fixing the offset toString issue

* removing irrelevant .await in RemoteServerResource
2019-05-23 11:54:05 +02:00
Francesco Mazzoli
4922cdfa87 do not run ledger-api-integration-tests on macOS (#1318)
* do not run ledger-api-integration-tests on macOS

* Update build.sh

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2019-05-23 08:21:19 +00:00
Gerolf Seitz
5cddf5316b
IndexService independent from participant-state (#1313)
The index service serves as a "bridge" between the data on the ledger
and the ledger api users. That is also the reason why the index service
API is defined in terms of the types in ledger-api-domain. It is the
responsibility of the index service implementations to return compatible
types and adhere to the expected semantics, so we can actually reuse
index service implementations in the ledger api servers.
2019-05-23 08:16:10 +02:00
Jussi Mäki
31cf7d75a1
Add foldWithPathState and computePerPartyProjectionRoots (#1249)
The foldWithPathState is a fold over the transaction that allows
keeping extra state along the path of the traversal.

We add computePerPartyProjectionRoots in preparation for the
work on privacy-aware kvutils, where transaction nodes are stored
separately rather than in one blob. This function allows us to compute
the projected transaction roots for each party mentioned in the
transaction. We require this information to establish the order
of the root nodes when the size and form of the transaction is
blinded by assigning random node ids.
2019-05-21 18:02:39 +02:00
Gabor Aranyossy
333d720b1e Package and IdentityService wired through (#1278)
* using IdentityService

* package service wired through

* using ledger id from identityService

* extracting out ApiServer trait

* making ApiServer creation async

* using async tolerance when waiting on ApiServer creation
2019-05-21 14:28:50 +00:00
Francesco Mazzoli
8d9c2721ec allow to load packages eagerly, and do not compile twice with --scenario (#1248)
fixes #1238 and should help with #1230.
2019-05-21 14:14:59 +00:00
Stefano Baghino
9684e1325e
Reject transaction filters without any party (#1257)
Fixes #1250

The previous behavior when receiving a transaction filter without any
party was to reply with an empty stream. Since, given the current
situation, no data could ever be served for such request, it represents
a better feedback for the user to reject such requests as carrying an
`INVALID_ARGUMENT`.
2019-05-21 15:21:09 +02:00
Francesco Mazzoli
95e8dd01c7 Maintainers must be signatories (#1124)
* check that maintainers are a subset of signatories

fixes #1123

* add note on why `fetchByKey` gets you the contract data
2019-05-21 11:59:59 +00:00
Gabor Aranyossy
e50222ce30 making Netty's EventLoopGroup shutdown's eager (#1255) 2019-05-21 09:30:38 +02:00
Gabor Aranyossy
5ede6f48ea index service decomposition (#1240)
* extracting some sub-interfaces

* dump

* dump

* things compile

* extracting more concerns

* comment change

* making configuration service return a stream

* adding documentation around the new interfaces
2019-05-20 12:08:56 +00:00
Remy
4e7f628eb4 sandbox-sql: minor cleanup of KeyHasher (#1201)
* sandbox-sql: minor cleanup of KeyHasher

* sandbox-sql: migrate db in small batches

* sql migration: make smaller batches
2019-05-20 10:20:45 +00:00
Stefano Baghino
2858f55bd2
Unify command validation logic (#1227)
* Unify command validation logic

Fixes #572

* Fix formatting
2019-05-17 17:24:35 +02:00
Gabor Aranyossy
4328d27c80 fixing Pascalized package name (#1211) 2019-05-17 13:21:47 +00:00
Gabor Aranyossy
1e32d842dc fixing hanging Sandbox process in case of invalid starting arguments (#1217)
* fixing hanging Sandbox process in case of invalid starting arguments

* fixing issue for using random ports in case the network address is defined
2019-05-17 12:23:58 +00:00
Gerolf Seitz
c645348ca1
Expose a contract's agreement text on the Ledger API (#1151)
* Added agreement_text field to the CreatedEvent in Ledger API.
* Changed java bindings + java codegen
* Changed utilities for scala codegen
* Made necessary changes in Sandbox to propagate the agreement text from ContractInst to the CreatedEvent
* Made changes to the navigator to show the agreement text in the contract details page when it is set and not empty

Fixes #1110
2019-05-17 11:22:05 +02:00
Gabor Aranyossy
f48b7c764e introducing WriteService in Sandbox (#1193)
* introdocing WriteService in Sandbox

* changing submit to return java CompletableStage

* introduced TimeModelChecker interface

* removing whitespaces

* doc updates

* dependency order fix
2019-05-17 08:59:19 +00:00
Jussi Mäki
44c67547f5 Add tracking of disclosure to contract state (#1059)
* Add tracking of disclosure to contract state

And clean up some of the error handling in processSubmission.

* Do not add, but rather union the divulged parties
2019-05-16 21:43:14 +00:00
Gabor Aranyossy
e70cbfe65c eliminating some mutable state (#1130)
* no var no problem

further refactor

introduced InfraState

a bit less vars

encapsulating closes

SandboxServer starts automatically

rebase fixup

collecting state into a single object

some cleanup

removing exposed materializer

LedgerBackend is closed in SandboxServer

changed ownership of Ledger

fixing perf tests

fixing some compile errors

formatting

removing unused method

fixing integration test to use correct dar file

fixing issue with PostgresFixture and SandboxResource

Fix integration tests on Windows

* fixing rebase artifacts
2019-05-16 08:52:14 +00:00
Robert Autenrieth
b4506ca370 Check contract visibility in SQL sandbox (#959)
* Store divulgence info for contracts

* Store divulgence info for contracts

* some documenting refactors

* Use fail instead of sys.error in test

* Add release note

* Rename migration files

* Fix typo

* Fix updating divulgence info in scenarios

The ACS was comparing differently formatted contract IDs.

Fixes #1166
2019-05-16 09:54:21 +02:00
gleber
3eb6f83b3a
ledger-api-intgration-tests: Cleanup ledger ID handling. (#1129)
* ledger-api-intgration-tests: Cleanup ledger ID handling.

This changes nothing in the logic of tests. It is a preparation for moving of
most of the tests to use Dynamic ledger ID mode for tests, which is a
preparation for running these tests against remote Ledger API endpoints.

* sandbox: Rework LedgerIdMode and move it up into common.
2019-05-15 17:05:16 +02:00
Gerolf Seitz
a5cf706040 Less logging in tests (#1145)
* Less DEBUG logging in java codegen tests

* Add logback-test.xml for ledger/sandbox tests
2019-05-15 08:58:08 +00:00
Gabor Aranyossy
60b608288d removing println (#1140) 2019-05-15 07:44:54 +00:00
Remy
c7df212d42 Daml lf type safty (Decimal) (#1098)
* daml-lf: make Decimal type safe

* daml-lf: create Utf8String type

* daml-lf: cleanup in data package

* Address Stephen Comments

* daml-lf: remove UTF8String
2019-05-14 18:10:45 +00:00
Francesco Mazzoli
186cf14729 fix duplicate contract ids when loading scenarios with pass (#1105)
* rename --jdbcurl to --postgres-backend

* increment ledger end correctly when loading from scenarios

fixes #1079
2019-05-14 10:05:43 +00:00
Stephen Compall
c6a382db70 warn on use of 'return' Scala keyword; remove most usages (#956)
*  enable Return wartremover wart

* remove return keyword from various places in daml-lf

* remove return keyword from various places in ledger

* simpler ImmArray equals

* move traverseEitherStrictly to point of use

* remove return from ledger-api-server-example
2019-05-13 17:10:29 +00:00
Gabor Aranyossy
496cf5069f
Re-revert) "Ledger API Server refactor" (#1109)
* Revert "Revert "Ledger API Server refactor (#1077)" (#1096)"

This reverts commit e2fa13e62b.

* fixing race conditions why resetting the ledger
2019-05-13 17:23:03 +02:00
Gerolf Seitz
8158269b7d
Remove ExercisedEvent in Event oneof. (#1067)
* Remove ExercisedEvent in Event oneof.

The Event message is only used in the Transaction message. Flat
transactions do not contain exercised events, but only created and
archived events. Therefore we can remove the ExercisedEvent from the
Event oneof, without breaking transport compatibility.

HOWEVER: The Java Bindings used to use the data.Event class for both flat
transactions and transaction trees. To properly represent the actual
event types in the two transaction structures,
1) Event is now and interface and is only used in the Transaction class.
2) there is a new interface TreeEvent, which is used in the TransactionTree class.

* CreatedEvent implements Event and TreeEvent
* ExercisedEvent implements TreeEvent
* ArchivedEvent implements Event

Some "pathological" cases where an occurrence of an exercised event
would have resulted only in an exception, are now removed (see change in
LedgerApiV1.scala).

Fixes #960.
2019-05-13 14:36:13 +02:00
Remy
2e3a87934b Daml lf type safty (ChoiceName, VarName, FieldName, ConstructorName) (#983)
* daml-lf: make DefinitionRef more typesafe

* daml-lf: Identifier -> DefinitionRef

* daml-lf: remove unsafe apply and copy methods from DottedName

* daml-lf: create identifier

* daml-lf: make ChoiceNames Identifiers

* daml-lf: cleanup TVar

* daml-lf: FieldNames & VariantConstructors -> Identifiers

* bazel fmt

* daml-lf: VarName -> Identifier

* daml-lf: drop return inside Ref.scala

* daml-lf Identifier -> Name

* daml-lf DefinitionRef -> Identifier

* daml-lf make iface more type safe
+ address Francesco's comments

* daml-lf: remove unsafe unapply from MatchingStringModule

* fix navigator

* Address Stephen's Comments
2019-05-13 11:17:12 +00:00
Gabor Aranyossy
e2fa13e62b Revert "Ledger API Server refactor (#1077)" (#1096)
This reverts commit 17060b6225.
2019-05-13 10:31:14 +00:00
Gabor Aranyossy
17060b6225
Ledger API Server refactor (#1077)
* adding necessary @volatiles

* services are factored out

* no need for ResetService to stop the services before

* removing not needed callback methods

* mostly renaming things

* some further cleanup
2019-05-13 10:51:36 +02:00
Gabor Aranyossy
4abc18d8a1
avoiding linear searching for transactions from genesis (#994)
* avoiding linear searching for transactions from genesis

* validating transaction ids

* one more failing test nailed down

* fixing off by 1 error

* docs + release notes

* fixing EventIdFormatterSpec

* fixing broken validation test
2019-05-10 11:28:14 +02:00
Francesco Mazzoli
de54e8f60f
dynamically check type of contract ids, fixes #1005 (#1037)
Up to now, the engine blindly assumed that contract ids pointed to
contracts of the right type. However, this assumption is faulty:
contract ids coming from the Ledger API cannot be type checked
in command translation since we need access to the contract itself
to do so.

This caused some seriously surprising / broken behavior: one could
send an exercise command with the wrong template id and still go
through, or break internal invariants about the type of choices.

This commit fixes this by checking that the type of the contract
instances we fetch is correct at runtime.

cc @hurryabit @dajmaki @remyhaemmerle-da @S11001001 @meiersi-da
2019-05-09 17:11:05 +02:00
Jussi Mäki
66934f8a1e
Fix log output of ledger-api-integration-tests (#1016)
The logback-test.xml file was not included as a resource.
2019-05-09 17:09:32 +02:00
Jussi Mäki
17438382b8 Remove ledger-api-server-example (#1017)
* Remove ledger-api-server-example

This code does not serve any purpose anymore as it has been replaced
by ledger/participant-state and friends.

* Remove ledger-api-server-example from Windows build
2019-05-09 17:04:38 +02:00
Gabor Aranyossy
b72377a950
cleaning up LedgerApiServer (#1036)
* cleanup/refactoring of LedgerApiServer

* fixed LedgerResource

* fixed ResetService to be great again
2019-05-09 15:21:03 +02:00
Gerolf Seitz
662a21f493
Fix LedgerResource after concurrent changes being merged to master (#1033) 2019-05-09 13:01:49 +02:00
Gabor Aranyossy
b6b9a08c82
increasing a perf test timeout due to flakiness (#1028) 2019-05-09 11:26:13 +02:00
Gerolf Seitz
c89f3bdebe
Sandbox: Respect MRT (#990)
Transactions with a record time > maximum record time are now rejected
with a timeout error instead of being committed to the ledger.
2019-05-09 11:10:54 +02:00
Gabor Aranyossy
82edab41f8
making sql queue depth configurable -> making back-pressure tests more reliable (#1027)
* making sql queue depth configurable -> making back-pressure tests more reliable

* fixing SqlLedgerSpec
2019-05-09 10:42:22 +02:00
Francesco Mazzoli
5b1e82b4ef run ledger-api-integration-tests exclusively (#1018)
might help with #1012
2019-05-08 17:43:01 +00:00
Remy
67772baf61 sandbox: correct KeyHasherSpec (#995) 2019-05-08 15:00:16 +00:00
Jussi Mäki
a23000446b
Check contract visibility in reference index service (#947)
* Use Sandbox's ActiveContracts in reference index service

This properly handles contract key updates and adds the required
checks for contract activeness and visibility.

Could consider moving the ActiveContracts.scala into another library,
but since we're soon starting the work to bring sandbox onto the
daml-on-x stack we might postpone that.

* reformat

* Exclude logback.xml from sandbox the library

This allows users of sandbox as a library to specify their
own logging configuration.
2019-05-08 14:36:28 +02:00
Stefano Baghino
f9839a7e4c
Re-order fields in records if all labels are provided (#989)
* Re-order fields in records if all labels are provided

Fixes #988

* Add line to release notes

* Fix line on release notes

* Document change on the Ledger API definition

* Simplify pattern matching

* Improve and fix tests

Integration tests now look for the "Missing field label" rather then the
"Mismatching record label" when inspecting errors. Furthermore, a test
has been added that ensures that repetitions in labels still raise an
error.

* Add comment

Comment about relationship between fields length check and fields reordering based on labels

Co-Authored-By: stefanobaghino-da <43749967+stefanobaghino-da@users.noreply.github.com>

* Improve Ledger API docstring

Explicitly state the semantics of labeled fields (i.e. repeated keys are not accepted)

Co-Authored-By: stefanobaghino-da <43749967+stefanobaghino-da@users.noreply.github.com>
2019-05-08 12:54:53 +02:00