When do unallocated parties cause errors?

I recently got this question through another channel (thank you @Shine_Li for asking) and wanted to share both question and answer here:

I’m on 1.4.0-snapshot.20200729.4851.0.224ab362 . And I’m using sandbox (not the classic) with --implicit-party-allocation false . I have managed to save a Party (that is not allocated) on more than one contracts. But when I exercise choice using that party, I have failure Status(3,Party not known on ledger: Not all parties known,Vector()) Should it be errored out on saving the party on a contract?

1 Like

You only get errors if the party is “used” as signatory, observer, or controller/actor. Note that in the choice ... syntax, controllers are only evaluated at the time an exercise is performed so the following works

template T
  with
    allocated : Party
    unallocated : Party
  where
    signatory allocated
    choice C : ()
      controller unallocated
      do return ()

You’ll get an error as soon as you try to exercise C , though that may be a moot point since I don’t see a way to exercise C without allocating the party first.

controller unallocated can will fail immediately because that syntax makes unallocated an observer.

4 Likes