Canton user multiple actas behaviour

Does possessing an actas right implicitly grant the readAs right? In the ledger API do you need to pass the actas party into both actas and readAs fields?

My guess here is no - can a canton user who possesses multiple actas claims act upon a controlled choice in a contract the acting party can’t see but the canton users claim set can.

actAs does imply readAs so you only need to specify readAs if you have additional parties that are not in actAs.

2 Likes

Thanks and for the second part (I’m assuming the answer is no) can a party act up on a contract (exercise a choice) they are not an observer of but one which the canton user has an actAs claim for a party who is an observer?

Not quite sure I understand your question but let me try to answer it:

To exercise a choice over the ledger API two things need to be true:

  1. The set of actAs parties must be a (non-strict) superset of the controllers of the choice. In other words, you have authorization to exercise the choice.
  2. At least one party in the union of actAs and readAs is a stakeholder on the contract. In other words, the contract is visible.

Let me try to rephrase the question, to check I understand it:

Say we have a choice where the controller is party A, on a contract not visible to B, and I have a token with actAs: ["A", "B"], can I exercise the choice “as B”?

If that is indeed your question, the answer is technically yes:

module Main where

import Daml.Script

template Asset
  with
    owner : Party
  where
    signatory owner
    choice Appropriate : ContractId Asset
      with
        newOwner : Party
      controller newOwner
      do create this with
           owner = newOwner

setup : Script ()
setup = script do
  alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
  bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")

  asset <- submit alice do
    createCmd Asset with owner = alice

  debug(show asset)
  
  asset <- submitMulti [bob] [alice] do
    exerciseCmd asset Appropriate with newOwner = bob
  
  debug(show asset)

  return ()

Although the choice is not exercised “as B”, it is exercised using a token that can actAs B and readAs A, passing in B as the argument to a choice that has been specifically designed to accept a flexible (really any) controller.

In a way, there isn’t really a notion of exercising a choice “as a party”, it’s more of a “as a token with actAs and readAs permissions”.

More specifically:

can a party act up on a contract (exercise a choice) they are not an observer of but one which the canton user has an actAs claim for a party who is an observer?

As @cocreature said, you can exercise a choice (the only way to “act up on a contract”) if the Ledger API Request comes with a token that has actAs permission on a superset of the controllers of that choice, and at least one readAs (or actAs) permission on a Party that can see the contract (observer or signatory). As illustrated above, a Party may be in the set of possible controllers without being able to see the contract, so both of @cocreature’s points are necessary.

Note that this is only possible in my example because the choice has been specifically designed to allow it. Most choices won’t be that flexible.

This is exactly what I meant with my question. Thank you for the confirmation.