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

Fix disclosure bug in the presence of upgrades #19167

Merged
merged 4 commits into from
May 14, 2024

Conversation

paulbrauner-da
Copy link
Contributor

@paulbrauner-da paulbrauner-da commented May 8, 2024

Fixes #19162

Disclosures in exercise commands are accompanied by a template ID, and the ledger API verifies that the blob's template ID matches the provided one. The GrpcLedgerClient class was not always returning matching blobs and template IDs for disclosure queries. Submitting these retrieved disclosures+IDs as part of an exercise was then leading to runtime errors. This PR fixes that.

In addition, the Disclosure daml opaque datatype stores a blob and the purported template ID of the contract encoded by the blob. We fix the queryContractId command of daml script so that it receives not only the requested (possibly upgraded) contract and its blob, but also the template ID of the blob, thus creating valid Disclosures.

Not blocking for this PR but worth noting: @remyhaemmerle-da pointed out that the current design of Disclosure as an opaque type is not ideal: there is no way for a user to know what the concrete type of a disclosure they requested actually is (they could have requested a v2 and gotten a v1).

@paulbrauner-da paulbrauner-da changed the title repro of #19162 as a test and fix for daml3 Fix disclosure bug in the presence of upgrades May 8, 2024
@paulbrauner-da paulbrauner-da marked this pull request as ready for review May 8, 2024 15:59
Copy link
Contributor

@samuel-williams-da samuel-williams-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! :D

@paulbrauner-da paulbrauner-da enabled auto-merge (squash) May 14, 2024 14:58
@paulbrauner-da paulbrauner-da merged commit 3145345 into main May 14, 2024
15 checks passed
@paulbrauner-da paulbrauner-da deleted the pb/disclosure-upgrade-bug branch May 14, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

daml-script: disclosures are malformed in the presence of uprades
2 participants