diff --git a/compatibility/bazel_tools/testing.bzl b/compatibility/bazel_tools/testing.bzl index b0527f3f38a..bad010fbdb6 100644 --- a/compatibility/bazel_tools/testing.bzl +++ b/compatibility/bazel_tools/testing.bzl @@ -850,6 +850,7 @@ excluded_test_tool_tests = [ "end": "2.3.0-snapshot.20220611.10066.0.458cfc43", "exclusions": [ "ExceptionsIT:ExRollbackCreate", + "ExceptionsIT:ExRollbackExerciseCreateLookup", ], }, ], diff --git a/ledger/ledger-api-tests/suites/src/main/scala/com/daml/ledger/api/testtool/suites/v1_14/ExceptionsIT.scala b/ledger/ledger-api-tests/suites/src/main/scala/com/daml/ledger/api/testtool/suites/v1_14/ExceptionsIT.scala index ed3fb68ba11..38c6a0ae992 100644 --- a/ledger/ledger-api-tests/suites/src/main/scala/com/daml/ledger/api/testtool/suites/v1_14/ExceptionsIT.scala +++ b/ledger/ledger-api-tests/suites/src/main/scala/com/daml/ledger/api/testtool/suites/v1_14/ExceptionsIT.scala @@ -441,4 +441,16 @@ final class ExceptionsIT extends LedgerTestSuite { } }) + test( + "ExRollbackExerciseCreateLookup", + "Lookup a contract Archiving a contract created within a rolled-back try-catch block, fails", + allocate(SingleParty), + )(implicit ec => { case Participants(Participant(ledger, party)) => + for { + helper <- ledger.create(party, ExceptionTester(party)) + withKey <- ledger.create(party, WithSimpleKey(party)) + _ <- ledger.exercise(party, helper.exerciseRollbackExerciseCreateLookup(_, withKey)) + } yield () + }) + } diff --git a/ledger/test-common/src/main/daml/semantic/Exceptions.daml b/ledger/test-common/src/main/daml/semantic/Exceptions.daml index 921853d0ab5..67ff6ca0872 100644 --- a/ledger/test-common/src/main/daml/semantic/Exceptions.daml +++ b/ledger/test-common/src/main/daml/semantic/Exceptions.daml @@ -374,3 +374,16 @@ template ExceptionTester catch Ecid cid -> archive cid + + -- regression test for https://github.com/digital-asset/daml/issues/14171 + nonconsuming choice RollbackExerciseCreateLookup: () + with cid : ContractId WithSimpleKey + controller p + do + try do + exercise cid Archive + create (WithSimpleKey p) + throw (E "") + catch E _ -> pure () + result <- lookupByKey @WithSimpleKey p + result === Some cid