Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daml-script: disclosures are malformed in the presence of uprades #19162

Closed
paulbrauner-da opened this issue May 7, 2024 · 0 comments · Fixed by #19167
Closed

daml-script: disclosures are malformed in the presence of uprades #19162

paulbrauner-da opened this issue May 7, 2024 · 0 comments · Fixed by #19167
Assignees
Labels
broken Product is broken and must be fixed component/daml-script

Comments

@paulbrauner-da
Copy link
Contributor

paulbrauner-da commented May 7, 2024

The following script

queriedDisclosuresAreValid : Script ()
queriedDisclosuresAreValid = do
  a <- allocatePartyOn "alice" participant0

  cid <- a `submit` createExactCmd V1.QueryDisclosureTemplate with party = a
  let v2Cid = coerceContractId @V1.QueryDisclosureTemplate @V2.QueryDisclosureTemplate cid
  disclosure <- fromSome <$> queryDisclosure a v2Cid
  submitWithDisclosures a [disclosure] $ exerciseCmd v2Cid V2.QueryDisclosureChoice

Fails with this error:

INVALID_ARGUMENT: INVALID_ARGUMENT(8,961b09b6): The submitted request has invalid arguments: Mismatch between DisclosedContract.template_id (72684bade0a0af9e5cbc87ae932cab0901cad9166cb854c61d8f4c7672a4a5cf:QueryDisclosure:QueryDisclosureTemplate) and template_id from decoded DisclosedContract.created_event_blob (debf7a4d67d6d2c7ef956c5d8703f9fb14ee0413150af49bbcf5f09b2af75729:QueryDisclosure:QueryDisclosureTemplate)

That's because GrpcLedgerClient returns the requested template ID rather than the actual one in the disclosure: https://github.com/digital-asset/daml/blob/main/sdk/daml-script/runner/src/main/scala/com/daml/lf/engine/script/v2/ledgerinteraction/grpcLedgerClient/GrpcLedgerClient.scala#L160.

But also because queryDisclosure stores the requested template ID in the Disclosure record that it builds:

tplId = templateTypeRep @t

I see how to fix the former, I'm not sure how to fix the latter yet. I'm not sure what the semantics should be.

@paulbrauner-da paulbrauner-da added broken Product is broken and must be fixed component/daml-script labels May 7, 2024
@paulbrauner-da paulbrauner-da self-assigned this May 7, 2024
paulbrauner-da added a commit that referenced this issue May 14, 2024
* repro of #19162 as a test and fix for daml3

* use a different party for exercising a choice on the disclosed contract

* factorize TemplateTypeRep svalue creation

* Move makePair/makeTriplet to Converter.makeTuple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broken Product is broken and must be fixed component/daml-script
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant