Odd behavior with rollback nodes and archiving?


I’m trying to understand exceptional semantics and rollback nodes and I found this odd behavior from daml studio v. 2.0 and 2.1.1. In particular, the program below throws a double spend error. From all of my reading of the docs, it seem like it shouldn’t be the case? In particular, it looks like studio believes that transaction #1:3 consumes the contract #0:0? However, #1:3 appears under a rollback node. From Exceptions — Daml SDK 2.1.1 documentation it seems like this should not be a double spend. Am I missing something?

template Foo 
    owner : Party
    signatory owner 
    nonconsuming choice Catch : ()
      controller owner
        do try do
              exercise self Fail
              GeneralError _ -> pure ()
    nonconsuming choice Fail : ()
      controller owner
        do  exercise self Archive
            abort ""

test: Script ()
test = script do
  a <- allocateParty "a"
  c <- submit a do
    createCmd Foo with
      owner = a
  submit a do
    exerciseCmd c Catch
  submit a do
    exerciseCmd c Catch
Script execution failed on commit at Main:30:3:
  Attempt to exercise a consumed contract #0:0 (Main:Foo)
  Consumed by: #1:3

Ledger time: 1970-01-01T00:00:00Z

Partial transaction:

Committed transactions: 
  TX 0 1970-01-01T00:00:00Z (Main:25:8)
  │   consumed by: #1:3
  │   referenced by #1:0, #1:2, #1:3
  │   known to (since): 'a' (0)
  └─> create Main:Foo
        owner = 'a'
  TX 1 1970-01-01T00:00:00Z (Main:28:3)
  │   known to (since): 'a' (1)
  └─> 'a' exercises Catch on #0:0 (Main:Foo)
      │   known to (since): 'a' (1)
      └─> rollback
          │   known to (since): 'a' (1)
          └─> 'a' exercises Fail on #0:0 (Main:Foo)
              │   known to (since): 'a' (1)
              └─> 'a' exercises Archive on #0:0 (Main:Foo)


Hi @mkawa!

This is a bug in daml studio. I opened an issue to track this: Daml studio is not handling activeness checks under rollback nodes correctly. · Issue #13835 · digital-asset/daml · GitHub

1 Like