-
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
Changes from all commits
07b8e24
0f07599
10a2cad
ac6a5cb
96f2d82
0aad1bf
0667cc7
b57a817
7ace682
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,6 +384,27 @@ sealed abstract class HasTxNodes[Nid, +Cid] { | |
case (acc, _) => acc | ||
} -- localContracts.keySet | ||
|
||
/** Return all the contract keys referenced by this transaction. | ||
* This includes the keys created, exercised, fetched, or looked up, even those | ||
* that refer transient contracts or that appear under a rollback node. | ||
*/ | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. I'd find this a little prettier with some kind of There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
case (acc, (_, node: Node.NodeCreate[Value.ContractId])) => | ||
node.key.fold(acc)(key => acc + GlobalKey.assertBuild(node.templateId, key.key)) | ||
case (acc, (_, node: Node.NodeExercises[_, Value.ContractId])) => | ||
node.key.fold(acc)(key => acc + GlobalKey.assertBuild(node.templateId, key.key)) | ||
case (acc, (_, node: Node.NodeFetch[Value.ContractId])) => | ||
node.key.fold(acc)(key => acc + GlobalKey.assertBuild(node.templateId, key.key)) | ||
case (acc, (_, node: Node.NodeLookupByKey[Value.ContractId])) => | ||
acc + GlobalKey.assertBuild(node.templateId, node.key.key) | ||
case (acc, (_, _: Node.NodeRollback[_])) => | ||
acc | ||
} | ||
} | ||
|
||
// This method visits to all nodes of the transaction in execution order. | ||
// Exercise/rollback nodes are visited twice: when execution reaches them and when execution leaves their body. | ||
// On the first visit of an execution/rollback node, the caller can prevent traversal of the children | ||
|
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.
#9442
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)