Hi @cocreature ,
I just repeated the test again and here are the files.
FYI: Alice is enabled in participant1, and Bob is enabled in participant2.
daml/Main.daml (where script is inside). Note that I have modified the party part in order to use the existing parties enabled in the Canton setup.
module Main where
import Daml.Script
type AssetId = ContractId Asset
template Asset
with
issuer : Party
owner : Party
name : Text
where
ensure name /= ""
signatory issuer
controller owner can
Give : AssetId
with
newOwner : Party
do
create this with
owner = newOwner
setup : Script AssetId
setup = script do
Some alice <- pure $ partyFromText "Alice::122057c90c134e1776b8506498f35f163dfed1de7c9e0436c2f2b6cf3eaf3e6bdab6"
Some bob <- pure $ partyFromText "Bob::122090a134a43489f72651ea05054ddb9e9bbb0b633c0110c42c90bc49c7f52cd164"
aliceTV <- submit alice do
createCmd Asset with
issuer = alice
owner = alice
name = "TV"
bobTV <- submit alice do
exerciseCmd aliceTV Give with newOwner = bob
submit bob do
exerciseCmd bobTV Give with newOwner = alice
participants.json
{
"participants": {
"alice": {"host": "localhost", "port": 5011, "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJwYXJ0aWNpcGFudDEiLCJhcHBsaWNhdGlvbklkIjoiSFRUUC1KU09OLUFQSS1HYXRld2F5IiwiYWN0QXMiOlsiQWxpY2U6OjEyMjA1N2M5MGMxMzRlMTc3NmI4NTA2NDk4ZjM1ZjE2M2RmZWQxZGU3YzllMDQzNmMyZjJiNmNmM2VhZjNlNmJkYWI2Il19fQ.NnLBmg0lg3aV5Rg-UY4CtY8k2XLYKAMCbPMCY_osyc4", "application_id": "HTTP-JSON-API-Gateway"},
"bob": {"host": "localhost", "port": 5021, "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJwYXJ0aWNpcGFudDIiLCJhcHBsaWNhdGlvbklkIjoiSFRUUC1KU09OLUFQSS1HYXRld2F5IiwiYWN0QXMiOlsiQm9iOjoxMjIwOTBhMTM0YTQzNDg5ZjcyNjUxZWEwNTA1NGRkYjllOWJiYjBiNjMzYzAxMTBjNDJjOTBiYzQ5YzdmNTJjZDE2NCJdfX0.4oScBbRNoK6cv2HJmWXkjvqq6Vk1P3S_eVAOIFPq02Q", "application_id": "HTTP-JSON-API-Gateway"}
},
"party_participants": {
"Alice::122057c90c134e1776b8506498f35f163dfed1de7c9e0436c2f2b6cf3eaf3e6bdab6": "alice",
"Bob::122090a134a43489f72651ea05054ddb9e9bbb0b633c0110c42c90bc49c7f52cd164": "bob"
}
}
The command I run the script is
daml script --dar .daml/dist/testscript-0.0.2.dar --script-name Main:setup --participant-config participants.json
Finally here is the error message in the first run.
Exception in thread "main" com.daml.lf.engine.script.ScriptF$FailedCmd: Command submit failed: ABORTED: ContractNotFound(CN11007-5): Transaction is referring to an unknown contract; reason=Contract could not be found with id ContractId(003704d570ffc59f24aabc11b1af1ce2f1e3212fa85936df20a6a397f1c8b3ecb1ca001220ad63f8a1d62c5b185ed097b52fe2249adb9cedf1f23edf69b4d513a000e2c4bc), participant=participant2
Daml stacktrace:
submit at 334ce6d2a0f4a7d6bf32f5353c0bbfb208345de6967c69e337b5ae4b82f1c485:Main:35
at com.daml.lf.engine.script.Runner.$anonfun$runWithClients$10(Runner.scala:432)
at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:439)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:53)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: io.grpc.StatusRuntimeException: ABORTED: ContractNotFound(CN11007-5): Transaction is referring to an unknown contract; reason=Contract could not be found with id ContractId(003704d570ffc59f24aabc11b1af1ce2f1e3212fa85936df20a6a397f1c8b3ecb1ca001220ad63f8a1d62c5b185ed097b52fe2249adb9cedf1f23edf69b4d513a000e2c4bc), participant=participant2
at io.grpc.Status.asRuntimeException(Status.java:534)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:533)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:553)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:68)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:739)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:718)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
daml-helper: Received ExitFailure 1 when running
Raw command: java -Dlogback.configurationFile=/home/kctam/.daml/sdk/1.15.0/daml-sdk/script-logback.xml -jar /home/kctam/.daml/sdk/1.15.0/daml-sdk/daml-sdk.jar script --dar .daml/dist/testscript-0.0.2.dar --script-name Main:setup --participant-config participants.json
From the result (through Navigator) we see the error happened after Alice sent Bob the TV, and before Bob sent Alice back the TV.
And for upcoming execution of this script, no more error happens, and the contract behaviour is correct according to our script (i.e. Alice gets back the TV, and we see archived contracts in Bob as well.)
Thanks for your attention.
cheers,
kc