kvutils: Log a missing input state warning without the stack trace. (#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
This commit is contained in:
Samir Talwar 2021-04-27 15:26:38 +02:00 committed by GitHub
parent 4e712a01a0
commit c4cf3c93bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -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"
}
}

View File

@ -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)),