Is there an easy way for partial transaction processing in Daml?

I have a list of chained contract updates, so that the returned contrat id from one transaction is input for the next one.

It’s straightforward to process these updates as an atomic transaction, meaning if any of the updates gets aborted, nothing is committed to the ledger.

Is there an easy way to process the list so, that the updates before the first abort are committed?

I see two options:

  1. You submit each step as a single transaction. In that case, things will just work out properly but you might have to change your model a bit and there is some performance impact (10 small transactions with one update each can be significantly more expensive than one transaction with 10 updates).
  2. You handle the failures and cleanly finish your transaction instead of aborting it. This is more limited, you cannot handle all failures within Daml (e.g. you cannot handle contracts not being active). But if that’s a reasonable limitation, something like catching all exceptions in each step and if there is an exception stop processing but finish the transaction successfully would also give you the semantics you are after.
2 Likes

Thank you, Moritz. I’m posting a separate question concerning the scope of error handling you mention here.