Explicit archives on the TransactionTree stream

Under which circumstances will I see an explicit archive (i.e an ExercisedEvent with choice = “Archive” or something similar) on the TransactionTree stream?

I don’t see separate archives when I exercise consuming choices, however I assume that I will see them when raw archives are performed, but what about the other two variants (pre/post) of a consuming choice?

If a pre-consuming choice is equivalent to an archive followed by a non-consuming choice, I’d expect to see an ExercisedEvent(choice = “Archive”, …) followed by ExercisedEvent(isConsuming = false, …). Is this the case?

2 Likes

Pre and post-consuming choices are exactly equivalent to a non-consuming choice that calls the Archive choice at the beginning or end of the choice body. So you will see the choice in the transaction tree. However, they won’t follow each other but instead you have a nested structure: The Archive is a consequence of the non-consuming choice.

The transaction view in Daml Studio is a good way to inspect this type of stuff:

1 Like

I think that your example is missing some kind of work in the Preconsuming and Postconsuming choice bodies as they look identical except for the name. Could you add a fetch or another exercises to it ?

Good point, I was only trying to show the hierarchical structure rather than the difference between the two but definitely makes sense to include it. Here’s an updated version including a create in the body (and nothing else):

1 Like