Exercise Interface choice on Daml Script with Json API

David_Martins
Wed, 28 Feb 2024 15:50:24 +0000
App Development

Hello,

I have the following daml script that I wish to run against a remote ledger.

execute : Party -> Script ()
execute party = script do
  (cidList, _) <- unzip <$> queryInterface @IFoo csd
  mapA_ (\ cid -> submit party do exerciseCmd cid (RunIt party)) cidList

Only the json api has been opened up to use externally and such I must run this script with that option turned on.
However when I try to run it I get the following error stacktrace:

Exception in thread "main" com.daml.lf.engine.script.Script$FailedCmd: Command submit failed: key not found: cc1e0d2f2a25abfff922f5deeacaa8eaa17ffe3f31a71f0ab08b9e23c2e7f414:Interface.Archivable:Archivable
Daml stacktrace:
submit at 159b7e01db1c1817df6cb57f41f5365e4c9ef8b37ae7cad5e5670b665d12ab1f:Test:15
        at com.daml.lf.engine.script.v1.Runner.$anonfun$runWithClients$11(Runner.scala:147)
        at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:475)
        at org.apache.pekko.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:73)
        at org.apache.pekko.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:110)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
        at org.apache.pekko.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:110)
        at org.apache.pekko.dispatch.TaskInvocation.run(AbstractDispatcher.scala:59)
        at org.apache.pekko.dispatch.ForkJoinExecutorConfigurator$PekkoForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:57)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.util.NoSuchElementException: key not found: cc1e0d2f2a25abfff922f5deeacaa8eaa17ffe3f31a71f0ab08b9e23c2e7f414:Interface.Archivable:Archivable
        at scala.collection.immutable.BitmapIndexedMapNode.apply(HashMap.scala:670)
        at scala.collection.immutable.BitmapIndexedMapNode.apply(HashMap.scala:672)
        at scala.collection.immutable.HashMap.apply(HashMap.scala:132)
        at com.daml.lf.engine.script.v1.ledgerinteraction.JsonLedgerClient.lookupChoice(JsonLedgerClient.scala:533)
        at com.daml.lf.engine.script.v1.ledgerinteraction.JsonLedgerClient.exercise(JsonLedgerClient.scala:448)
        at com.daml.lf.engine.script.v1.ledgerinteraction.JsonLedgerClient.$anonfun$submit$2(JsonLedgerClient.scala:329)
        at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
        ... 12 more

Just for additional context I am using a participant config file with the correct jwt and the query portion of the script runs fine, just not the submittion.

Thank you

3 posts - 2 participants