Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Daml 3 Contract Keys and lookupNByKey completeness?Forum ↗

Daml 3 Contract Keys and lookupNByKey completeness?

App Development2 posts22 views1 likesLast activity 21h ago
WA
WallaceKellyOP
22h ago

What are some scenarios in which we know that lookupAllByKey will return all contracts for a given key?

For example, is this such a scenario:

  • A single synchronizer (i.e., the contracts never cross “domains”) 1
  • A single-hosted maintainer (i.e., the same participant node is used for all submissions and validations by the maintainer) 2

If so, can we push the single-synchronizer scenario further?

  • What if the maintainer is multi-hosted, but always submits through the same participant node? 3
  • What if the maintainer is multi-hosted, but might submit to any of its hosting nodes? 4

Related to: Canton 3 Contract Keys

AN
Andreas_Lochbihler
21h ago

Even a single synchronizer and a single-hosted maintainer submitting through its one participant node does not suffice here. That’s because lookupAllByKey will not return any contracts created by commands that are in flight concurrently to the submission. Say if the maintainer submits a command to create a contract c with a key k and while this command is making its way through the Canton protocol, the maintainer submits another command with lookupAllByKey. This second command will not find the contract c even though by the time the second command appears as an accepted transaction on the ledger API, c is active. You can in theory prevent such concurrency problems in this scenario by using the same command ID for deduplication on all commands that create/lookup a particular key, but that’s not particularly scalable.

Moreover, the maintainer should not grant any other party (hosted on another node) the right to create such contracts via a Daml delegation contracts because this would again open up such concurrency problems again.

← Back to Discussions