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

KV: do not use "Effects" part of InputsAndEffects #9433

Merged
merged 5 commits into from
Apr 20, 2021
Merged

Conversation

remyhaemmerle-da
Copy link
Collaborator

The PR is based one #9429.
Together with #9429 this make InputsAndEffects useless.

CHANGELOG_BEGIN
CHANGELOG_END

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@remyhaemmerle-da remyhaemmerle-da requested a review from a user April 16, 2021 14:14
@remyhaemmerle-da remyhaemmerle-da changed the base branch from main to remy-kv-input April 16, 2021 14:16
@cocreature cocreature self-assigned this Apr 16, 2021
@cocreature cocreature marked this pull request as draft April 19, 2021 08:15
@cocreature
Copy link
Contributor

turning this into a draft, this one needs some more work to be ready for review.

Base automatically changed from remy-kv-input to main April 19, 2021 11:11
@cocreature cocreature force-pushed the remy-lf-kv-effects branch 2 times, most recently from 70e714e to 861c0cc Compare April 19, 2021 11:34
The PR is based #9429.

changelog_begin
changelog_end
@cocreature cocreature marked this pull request as ready for review April 19, 2021 12:01
Comment on lines 382 to 402
def create() = {
val cid = builder.newCid
val node = builder.create(
cid,
template = "-pkg-:Mod:T",
argument = V.ValueUnit,
signatories = parties,
observers = Seq(),
key = None,
)
(cid, node)
}
def exercise(create: Node.NodeCreate[ContractId], consuming: Boolean) =
builder.exercise(
contract = create,
choice = "C",
actingParties = parties.toSet,
consuming = consuming,
argument = V.ValueUnit,
byKey = false,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps it's possible to share these utilities between test cases? That would also make them shorter and so more readable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Factored out in 60a00a5. Probably could do some more aggressive factoring but I’ll leave that for a future PR.

changelog_begin
changelog_end
// Add contract state entries to mark contract activeness (checked by 'validateModelConformance').
for ((key, createNode) <- effects.createdContracts) {
localContracts.foreach { case (cid, (nid, createNode)) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use for comprehension for better readability?

Suggested change
localContracts.foreach { case (cid, (nid, createNode)) =>
for((cid, (nid, createNode)) <- localContracts) {

Copy link
Collaborator Author

@remyhaemmerle-da remyhaemmerle-da May 3, 2021

Choose a reason for hiding this comment

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

Let me expose the original motivations for the change I made here.

for {
  entry <- effects.createdContracts 
  (key, createNode) = entry 
} { ... }
  • I prefer avoiding for-comprehension for imperative code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct, and I wrote a mini-article about it on our forum. And I also agree with your motivation for avoiding the for without yield.

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
changelog_begin
changelog_end
changelog_begin
changelog_end
@cocreature cocreature merged commit adde90b into main Apr 20, 2021
@cocreature cocreature deleted the remy-lf-kv-effects branch April 20, 2021 17:08
azure-pipelines bot pushed a commit that referenced this pull request Apr 21, 2021
This PR has been created by a script, which is not very smart
and does not have all the context. Please do double-check that
the version prefix is correct before merging.

@remyhaemmerle-da is in charge of this release.

Commit log:
```
cf2be78 Support rollback nodes in BlindingInfo (#9445)
adde90b KV: do not use "Effects" part of InputsAndEffects (#9433)
75fa86a Additional metrics for mutable contract state cache (#9444)
d8c34a4 Rename normalization-related params in the integrity checker config (#9455)
e335244 Hash submitters in the deduplication key [DPP-347] (#9417)
43ffa42 Test for duplicate contracts when querying on behalf of multiple parties (#9443)
7644844 Document daml ledger export script (#9446)
3193027 DPP-334 Manually partition the event table (#9394)
14661a8 Clearer variable name for subtype evidence (#9442)
40c85d8 Release v1.13.0-snapshot.20210419.6730.0.8c3a8c04 (#9439)
1cb907c KV: do not use "Inputs" part of InputsAndEffects (#9429)
```
Changelog:
```
- [Integration Kit] - deduplication key will contain hashed submitters instead of concatenated submitters
* [Daml export] Refer to the "Ledger Export" chapter under the "Early
  Access Features" for a description of the new Daml ledger export
  command. This is an early access feature.
```

CHANGELOG_BEGIN
CHANGELOG_END
Copy link
Collaborator Author

@remyhaemmerle-da remyhaemmerle-da left a comment

Choose a reason for hiding this comment

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

Thanks @cocreature

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.

5 participants