-
Notifications
You must be signed in to change notification settings - Fork 204
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 "Inputs" part of InputsAndEffects #9429
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remyhaemmerle-da If you merge #9361 you won't need this PR. Am I missing something?
I think it is better to go this way. Review #9361 and make it only about Effect and make this PR about Inputs only. In the concrete case we do not need a special computation of Input because almost everything (expect contract key) is already in GenTransaction. I tried to address some of the comment you make in #9361, here. |
daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Transaction.scala
Outdated
Show resolved
Hide resolved
daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Transaction.scala
Outdated
Show resolved
Hide resolved
(tx.informees ++ submitterInfo.actAs).toList.map(Conversions.partyStateKey) | ||
val contractIdStates = | ||
tx.inputContracts[ContractId].map(Conversions.contractIdToStateKey) | ||
val contractKeyStates = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we treat contract keys created with the transaction as inputs but don’t do the same for contract ids? That seems a bit inconsistent. I assume it has something to do with duplicate key detection or something along those lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far I understand, for validation, KV has to collect beforehand all the info needed to replay the transaction. For created contract, it need to know the contract key does not exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright so the input is the “non-existence of the key” or something like that, makes sense 👍
The PR is based #9429. CHANGELOG_BEGIN CHANGELOG_END
The PR is based #9429. CHANGELOG_BEGIN CHANGELOG_END
CHANGELOG_BEGIN CHANGELOG_END
6f17c71
to
96f2d82
Compare
daml-lf/transaction-test-lib/src/main/scala/lf/transaction/test/TransactionBuilder.scala
Outdated
Show resolved
Hide resolved
final def contractKeys(implicit | ||
ev: HasTxNodes[Nid, Cid] <:< HasTxNodes[_, Value.ContractId] | ||
): Set[GlobalKey] = { | ||
ev(this).fold(Set.empty[GlobalKey]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd find this a little prettier with some kind of foldMap
. Is it worth implementing that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be sensible but I’d prefer keeping it for a separate PR.
daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/transaction/TransactionSpec.scala
Outdated
Show resolved
Hide resolved
…ansaction/TransactionSpec.scala Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
changelog_begin changelog_end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy but if I were you, I'd wait for @miklos-da or @fabiotudone-da to verify. I am not too familiar with this part of the code.
The PR is based #9429. CHANGELOG_BEGIN CHANGELOG_END
daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Transaction.scala
Outdated
Show resolved
Hide resolved
daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Transaction.scala
Outdated
Show resolved
Hide resolved
daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Transaction.scala
Outdated
Show resolved
Hide resolved
daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/transaction/TransactionSpec.scala
Show resolved
Hide resolved
...te/kvutils/src/main/scala/com/daml/ledger/participant/state/kvutils/KeyValueSubmission.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: fabiotudone-da <fabio.tudone@digitalasset.com>
changelog_begin changelog_end
The PR is based #9429. CHANGELOG_BEGIN CHANGELOG_END . changelog_begin changelog_end . changelog_begin changelog_end . changelog_begin changelog_end
The PR is based #9429. changelog_begin changelog_end
The PR is based #9429. changelog_begin changelog_end
* that refer transient contracts or that appear under a rollback node. | ||
*/ | ||
final def contractKeys(implicit | ||
ev: HasTxNodes[Nid, Cid] <:< HasTxNodes[_, Value.ContractId] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is an ev
? Can you use meaningful parameter names, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ev
is pretty conventional in Scala-ese for "evidence".
I prefer the latter, but I think it's quite common (kind of like "i" for an iterator or "e" for an exception).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, @SamirTalwar-DA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method Iterable#toMap is the standard example of method using such implicit (and syntax)
* KV: do not use "Effects" part of InputsAndEffects The PR is based #9429. changelog_begin changelog_end * Factor out helpers changelog_begin changelog_end * Apply suggestions from code review Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com> * review comments changelog_begin changelog_end * fmt changelog_begin changelog_end Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org> Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
CHANGELOG_BEGIN
CHANGELOG_END
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.