Hi, I am trying out the Multiple Party Agreement Pattern example from the documentation. The test script works but when I try to run daml start to try it out in the navigator, I get an ExitFailure 1 error instead. Would greatly appreciate some help!! My code is as followed:
module Main where
import Daml.Script
import DA.List (sort, unique)
makePartiesFrom names =
mapA allocateParty names
template GovermentContract
with
signatories: [Party]
where
signatory signatories
ensure
unique signatories
template Pending
with
finalContract: GovermentContract
alreadySigned: [Party]
where
signatory alreadySigned
observer finalContract.signatories
ensure
-- Can't have duplicate signatories
unique alreadySigned
-- The parties who need to sign is the finalContract.signotories with alreadySigned filtered out
let toSign = filter (`notElem` alreadySigned) finalContract.signatories
choice Sign : ContractId Pending with
signer : Party
controller signer
do
-- Check the controller is in the toSign list, and if theu are, sign the Pending contract
assert (signer `elem` toSign)
create this with alreadySigned = signer :: alreadySigned
choice Finalize : ContractId GovermentContract with
signer : Party
controller signer
do
-- Check that all the required signotories have signed Pending
assert (sort alreadySigned == sort finalContract.signatories)
create finalContract
fail_test : Script (ContractId GovermentContract)
fail_test = script do
parties@[person1, person2, person3, person4] <- makePartiesFrom ["Alice", "Bob", "Charlie", "Dion"]
let finalContract = GovermentContract with signatories = parties
-- Parties cannot create a contract already signed by someone else
initialFailTest <- person1 `submitMustFail` do
createCmd Pending with finalContract; alreadySigned = [person1, person2]
-- Any party can create a contract a pending contract provided they list themeselves as the only signatory
pending <- person1 `submit` do
createCmd Pending with finalContract; alreadySigned = [person1]
-- Each signatory of the finalContract can Sign the Pending contract
pending <- person2 `submit` do
exerciseCmd pending Sign with signer = person2
pending <- person3 `submit` do
exerciseCmd pending Sign with signer = person3
pending <- person4 `submit` do
exerciseCmd pending Sign with signer = person4
-- A party can't sign the Pending contract twice
pendingFailTest <- person3 `submitMustFail` do
exerciseCmd pending Sign with signer = person3
-- A party can't sign on behalf of someone else
pendingFailTest <- person3 `submitMustFail` do
exerciseCmd pending Sign with signer = person4
person1 `submit` do
exerciseCmd pending Finalize with signer = person1
Error i get on my command prompt is:
C:\Users\diont\TechChallenge>daml start
2022-10-22 08:31:23.88 [INFO] [build]
Compiling TechChallenge to a DAR.
2022-10-22 08:31:25.68 [INFO] [build]
Created .daml\dist\TechChallenge-0.0.1.dar
Waiting for canton sandbox to start.
Uploading .daml\dist\TechChallenge-0.0.1.dar to localhost:6865
DAR upload succeeded.
Running the initialization script.
Exception in thread "main" java.lang.IllegalArgumentException: unknown definition d098ece50e95acbafc88a6d3b6b7647696ca47df6500e858e0a4e645e1beb747:Main:setup while looking for value d098ece50e95acbafc88a6d3b6b7647696ca47df6500e858e0a4e645e1beb747:Main:setup
at com.daml.lf.data.package$.$anonfun$assertRight$1(package.scala:10)
at scala.util.Either.fold(Either.scala:190)
at com.daml.lf.data.package$.assertRight(package.scala:10)
at com.daml.lf.engine.script.Runner$.run(Runner.scala:363)
at com.daml.lf.engine.script.Runner$.run(Runner.scala:334)
at com.daml.lf.engine.script.RunnerMain$.$anonfun$main$4(RunnerMain.scala:55)
at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
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)
daml-helper: Received ExitFailure 1 when running
Raw command: java "-Dlogback.configurationFile=C:\\Users\\diont\\AppData\\Roaming\\daml\\sdk\\2.4.0\\daml-sdk/script-logback.xml" -jar "C:\\Users\\diont\\AppData\\Roaming\\daml\\sdk\\2.4.0\\daml-sdk/daml-sdk.jar" script --dar ".daml\\dist\\TechChallenge-0.0.1.dar" --script-name Main:setup --wall-clock-time --ledger-host localhost --ledger-port 6865
daml-helper: Received ExitFailure 1 when running
Shell command: ""C:\Users\diont\AppData\Roaming\daml\bin\daml.cmd" "script" "--dar" ".daml\dist\TechChallenge-0.0.1.dar" "--script-name" "Main:setup" "--wall-clock-time" "--ledger-host" "localhost" "--ledger-port" "6865""