Skip to content

Commit

Permalink
kvutils: Log a missing input state warning without the stack trace. (#…
Browse files Browse the repository at this point in the history
…9513)

Missing input state is the fault of the participant, not the ledger.
Logging it as a warning, with a stack trace, makes it look like the
ledger itself failed, when actually the participant failed to provide
the correct keys (potentially due to data corruption, but it could also
be malicious).

This drops the stack trace to make the error less scary. We still log at
WARN level because this sort of thing shouldn't happen very often, and
at the very least, the participant operator should be informed, and the
participant should be refreshed with the correct data somehow.

CHANGELOG_BEGIN
CHANGELOG_END
  • Loading branch information
SamirTalwar authored Apr 27, 2021
1 parent 4e712a0 commit c4cf3c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,25 @@ object Err {
final case class InvalidSubmission(message: String) extends Err {
override def getMessage: String = s"Invalid submission: $message"
}

final case class MissingInputState(key: DamlStateKey) extends Err {
override def getMessage: String =
s"Missing input state for key $key. Hint: the referenced contract might have been archived."
}

final case class ArchiveDecodingFailed(packageId: PackageId, reason: String) extends Err {
override def getMessage: String = s"Decoding of DAML-LF archive $packageId failed: $reason"
}

final case class DecodeError(kind: String, message: String) extends Err {
override def getMessage: String = s"Decoding $kind failed: $message"
}

final case class EncodeError(kind: String, message: String) extends Err {
override def getMessage: String = s"Encoding $kind failed: $message"
}

final case class InternalError(message: String) extends Err {
override def getMessage: String = s"Internal error: $message"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ private[kvutils] class TransactionCommitter(
)
} catch {
case err: Err.MissingInputState =>
logger.warn("Exception during model conformance validation.", err)
logger.warn(
s"Model conformance validation failed due to a missing input state (most likely due to invalid state on the partcipant), correlationId=${transactionEntry.commandId}"
)
reject(
commitContext.recordTime,
buildRejectionLogEntry(transactionEntry, RejectionReason.Disputed(err.getMessage)),
Expand Down

0 comments on commit c4cf3c9

Please sign in to comment.