digital-asset / daml

The Daml smart contract language
https://www.digitalasset.com/developers
Other
802 stars 204 forks source link

Add multi-party support to JSON API JWT #5948

Closed leo-da closed 4 years ago

leo-da commented 4 years ago

See discussion: https://discuss.daml.com/t/query-and-create-exercise-as-multiple-parties/409

Add support for readAs and actAs with multiple parties, as specified in the following docs:

Related to #4630

cocreature commented 4 years ago

There are a few different points here (some of which were not clear when this ticket was created):

  1. Accept tokens that contain multiple parties in actAs and readAs.
  2. Support reading ledger data as multiple parties. This applies to all read endpoints. This is already supported by the gRPC Ledger API.
  3. Support submitting commands as multiple parties. This applies to command submission endpoints (surprise). This is not yet supported by the gRPC API but will be as part of multi-party submissions which are already on the roadmap.

An open question here is if it should be possible to specify parties separately (with the ledger enforcing that they are a subset of the parties in the token) or if they should always be inferred from the token. I don’t feel strongly about this but I would probably suggest going with the latter and if there is demand we can optionally (and therefore backwards compatible) allow to specify parties explicitly.

leo-da commented 4 years ago

My preference is currently implemented in JSON API -- infer the party from the token.

Regarding 3. If we have to specify a party in addition to what we currently have in JWT (e.g. if we cannot define the rule how to pick one party when multiple parties present in the JWT), the best place to add this party would be in the com.daml.http.domain.CommandMeta: https://github.com/digital-asset/daml/blob/15350a7bc2cf796057b27432e1a525aa7ea366bd/ledger-service/http-json/src/main/scala/com/digitalasset/http/domain.scala#L106-L109

cocreature commented 4 years ago

Glad to hear that we have the same preference :+1:

cocreature commented 4 years ago

We now have multi-party queries since #7571 is merged. Multi-parties are blocked until we get that on the ledger. I’ll open a separate issue for that.