It seems that I have a decent sized Logic error in my application. With many stated variables to be operated against by a Controller with a Choice, they were assigned no values. So @SteveSeow suggested a way to address this, and I have been working through it but have had some weirdness arise.
Fixed: If I do not match the exact Number of Parties in the final Controller/Choice section with the Number of Parties in the next, linking Templates, it fails.
I now also see that if I introduce a custom data record in the first contract like:
data QueryDetails = QueryDetails with currentPatient : Bool covid19Related : Bool queryName : Party queryMessage : Text queryDate : Date deriving (Eq, Show)
Fixed, well actually removed the Data Record calls: then assign that
QueryDetails as a Party in the next Template, it causes that Number of Parties imbalance issue.
Also, incorrect Templates code removed.
So two questions:
- Why am I getting Party numbering conflicts?
- Why is the use of custom data records in a Template causing issues in the next Template?
I read through Workflow factoring and thought it was correct.
Update: The templates now seem to talk to each other correctly, although on execution of the
CommenceConsult in the
PrescribingPhysician.daml file, I am getting authorization errors:
Last Build Execution: Navigator.log
5:07:03.141 [da-ui-backend-akka.actor.default-dispatcher-7] INFO c.d.n.s.platform.PlatformSubscriber - Command ‘2349414276b63aae’ completed with status ‘CommandStatusError(INVALID_ARGUMENT,Invalid argument: Command interpretation error in LF-DAMLe: Interpretation error: Error: node NodeId(0) (5b500d07f51bfc12c501a88e720e9a4fd34b1aff918a8faa37a27c47bafb84e1:PrescribingPhysician:CommenceConsult) requires authorizers Doctor,Medcentre,Patient, but only Doctor were given. Details: Last location: [DA.Internal.Prelude:378], partial transaction: root node NodeId(0): NodeCreate(ContractId(00fb2177dc86ea67ea125c91abbd0dd2a7019db81608bdd47801cec60fb39dffab),5b500d07f51bfc12c501a88e720e9a4fd34b1aff918a8faa37a27c47bafb84e1:PrescribingPhysician:CommenceConsult,ValueRecord(None,ImmArray((None,ValueParty(Medcentre)),(None,ValueParty(Doctor)),(None,ValueParty(Patient)),(None,ValueRecord(None,ImmArray((None,ValueBool(true)),(None,ValueBool(false)),(None,ValueParty(Johnny Boy)),(None,ValueInt64(3)),(None,ValueDate(2021-10-27)),(None,ValueText(Needs new Right Thumb)),(None,ValueBool(true)),(None,ValueText(Needs walking stick))))))),Simple line of placeholder textSimple line of placeholder text,TreeSet(Doctor, Medcentre, Patient),TreeSet(Doctor, Medcentre, Patient),None,V14).)’. akkaAddress=akka://da-ui-backend, sourceThread=da-ui-backend-akka.actor.default-dispatcher-5, akkaSource=akka://da-ui-backend/user/$a/party-Doctor, sourceActorSystem=da-ui-backend, akkaTimestamp=02:07:03.141UTC
Executing the following Templates, gives me the same result:
- template CommenceConsult
- template ContinueConsult
- template CompleteConsult
PrescribingPhysician:CommenceConsult) requires authorizers Doctor,Medcentre,Patient, but only Doctor were given.
Current CommenceConsult template
type CommenceConsultId = ContractId CommenceConsult -- Test, fail template CommenceConsult with commenceMedcen : Party -- Medcentre OBS? commenceDoctor : Party -- Doctor SIG commencePatient : Party -- Patient SIG? -- commenceDetails : DetailsCommenceConsult -- Data Record commenceDetails : Text -- As Test where agreement "Simple line of placeholder text" <> "Simple line of placeholder text" signatory commenceMedcen, commenceDoctor, commencePatient controller commenceDoctor can CommenceConsult_Start : ContractId CommenceConsult -- Doctor; start do create CommenceConsult with commenceDoctor, commenceMedcen, commencePatient, commenceDetails CommenceConsult_Cancel : () do return () -- Doctor; cancel controller commenceMedcen can CommenceConsult_Stop : () do return () -- Medcen; stop controller commencePatient can CommenceConsult_Terminate : () do return () -- Patient; terminate 8-) controller commenceMedcen can ContinueConsult_Cease : () do return () -- Doctor; cease ContinueConsult_Action : ContractId ContinueConsult -- Doctor; action do create ContinueConsult with continueDoctor = commenceMedcen, continueMedcen = commenceMedcen, continuePatient = commencePatient
I have been over these templates a few times, according to
daml.yaml, we are at
version: 0.3.0 … well if nothing else, at least I am persistent