Concurrent submission of commands - how does it work?

Lets say a template has two controller blocks with two different controllers? if both parties submit at the same time, what’s the behaviour of DAM tech stack? Is every command serially applied or multiple commands can be submitted and applied concurrently? in other words transactions on DAML Engine are single threaded or multithreaded?

What’s the behaviour in a similar situation when you have one choice as post-consuming vs the other consuming choice?

1 Like

The amount of concurrency depends on the specific ledger implementation. In theory, DAML Ledgers only guarantee causality order, meaning you can only say if one transaction happens before or after another if there is some sort of causality between the two. For example, a create always comes before a fetch and a fetch always comes before a consuming exercise like archive.

There is no causality between two non-consuming exercises or fetches so DAML Ledgers could process two transactions with two fetches on the same contract entirely concurrently.

However, if there is contention, as, for example, in the case of two consuming exercises, the transactions are ordered. The order can’t be predicted so the two transactions will race. The transaction that gets sequenced first will succeed, the other one will fail. How sequencing happens and how it is ensured that only one of the two transactions can go through can differ between DAML Ledger implementations.

3 Likes