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

Update ModelConformanceValidator comments and prevent them from getting outdated easily #11924

Merged
merged 2 commits into from
Nov 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ private[transaction] class ModelConformanceValidator(engine: Engine, metrics: Me
}
}

// Helper to lookup contract instances. Since we look up every contract that was
// an input to a transaction, we do not need to verify the inputs separately.
//
// Note that for an honest participant, a contract may not be in the state only if it was archived and pruned
// on the committer. Then, an honest participant is able to produce such a transaction only by using
// a divulged contract that appeared as active, because it didn't learn about the archival.
// On the other hand, using divulged contracts for interpretation is deprecated so we turn it into Inconsistent.
/** Helper to lookup contract instances. Since we look up every contract that was
* an input to a transaction, we do not need to verify the inputs separately.
*
* Note that for an honest participant, a contract may not be in the state only if it was archived and pruned
* on the committer. Then, an honest participant is able to produce such a transaction only by using
* a divulged contract that appeared as active, because it didn't learn about the archival.
* On the other hand, using divulged contracts for interpretation is deprecated so we turn it into [[Rejection.MissingInputState]].
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Inconsistent -> Rejection.MissingInputState

*/
@throws[Err.MissingInputState]
private[validation] def lookupContract(
commitContext: CommitContext
Expand All @@ -150,11 +151,13 @@ private[transaction] class ModelConformanceValidator(engine: Engine, metrics: Me
.map(_.getContractInstance)
.map(Conversions.decodeContractInstance)

// Helper to lookup package from the state. The package contents are stored in the [[DamlLogEntry]],
// which we find by looking up the Daml state entry at `DamlStateKey(packageId = pkgId)`.
//
// Note that there is no committer pruning of packages, so MissingInputState can only arise from a malicious
// or buggy participant.
/** Helper to lookup package from the state. The package contents are stored
* in the [[com.daml.ledger.participant.state.kvutils.store.DamlLogEntry]],
* which we find by looking up the Daml state entry at `DamlStateKey(packageId = pkgId)`.
hubert-da marked this conversation as resolved.
Show resolved Hide resolved
*
* Note that there is no committer pruning of packages, so [[Rejection.MissingInputState]]
* can only arise from a malicious or buggy participant.
*/
@throws[Err.MissingInputState]
@throws[Err.ArchiveDecodingFailed]
private[validation] def lookupPackage(
Expand Down