question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow for rollback of sub-transactions within DAML workflow

See original GitHub issue

A cursory review of the business requirements for production DAML projects suggests that >90% of any given workflow is specifying exceptional workflows to handle business constraint violations.

At the present point in time, DAML only permits a single response to a business constraint violation: abort the current transaction in its entirety. Unfortunately, this leaves the system in an invalid state, as the business requirement is for the workflow to transition to an error handling/recovery state, and this would require updating the ledger—something that is currently impossible once an abort has been triggered.

What is needed is the ability to ‘catch’ the abort at a sub-transaction level, and then proceed with an alternative ledger-update. It is anticipated that this would end up looking something along the lines of MonadError.

Worth noting that:

  • This is not an asynchronous exception capability, specifically:
  • Failures of fetchBy, fetch, key-uniqueness violations, exercises on inactive cids are all contention failures only detectable at post-sequence validation, not business constraint violations, so do not interact with this feature
  • ensuring violations and assert/abort violations do represent business constraint violations, and so should interact with this feature
  • This would entail requiring assert/abort to take any instance of Show as an argument.
  • Update a, would now become a right-biased Update e a
  • If the exception remains uncaught at the outer transaction, then the behaviour remains identical to the current behaviour, except for an implicit call to show e go obtain a string

Note: Our experience to date suggests that any non-trivial, real-world, multi-party workflow requires this functionality.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
filmackaycommented, Apr 2, 2019

Thanks for raising @andrae-da I was just about to raise this Issue after discussing with @neil-da last night! I see this as splitting current failures into two classes:

  • aborts: fetch/exercise failures => cannot be caught - remains as-is. Akin to a SQL database deadlock victim.
  • errors: everything else - arithmetic overflow, div-by-zero, asserts, thrown errors (what we currently call abort). Akin to any other kind of error in a SQL database.

We’re not trying to introduce any non-determinism, but simply handle the deterministic failures (what I’ve called errors, above).

0reactions
cocreaturecommented, Jun 22, 2021

this is covered as part of exceptions in daml-lf 1.14

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exceptions — Daml SDK 2.4.0 documentation
We do this by introducing rollback nodes in the transaction. Each rollback node contains a rolled back subtransaction. Rollback nodes are not considered ......
Read more >
To DLT, or not to DLT? That is not the question | DAML Driven
In this blog post, I'll demonstrate that writing many applications in DAML — an open source language designed specifically to encode ...
Read more >
A Daml based ledger interoperability protocol - Canton
Daml's transaction model makes atomic composition of workflows trivial, and makes authorization and privacy both mandatory, yet simple. The code, written in ......
Read more >
The structure and flow of Daml smart contracts: Part 1
A basic feature of Daml is workflow composition, which is reflected in the smart contract architecture. The “do” block of the “Accept” ...
Read more >
An Approach for Achieving the Atomicity of Composed Web ...
workflow ontology including the AWT is presented in Section 4. ... Semantic atomicity means that after the commitment of a subtransaction, or component...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found