Skip to content

Commit

Permalink
Remove cats from kvutils (#11537)
Browse files Browse the repository at this point in the history
CHANGELOG_BEGIN

CHANGELOG_END
  • Loading branch information
nicu-da authored Nov 3, 2021
1 parent b83af37 commit 2091f59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion ledger/participant-state/kvutils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ da_scala_library(
"@maven//:org_scala_lang_modules_scala_java8_compat",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_typelevel_cats_core",
],
tags = ["maven_coordinates=com.daml:participant-state-kvutils:__VERSION__"],
visibility = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

package com.daml.ledger.participant.state.kvutils.committer.transaction.validation

import cats.syntax.contravariantSemigroupal._
import com.daml.ledger.configuration.Configuration
import com.daml.ledger.participant.state.kvutils.Err
import com.daml.ledger.participant.state.kvutils.committer.Committer.getCurrentConfiguration
Expand Down Expand Up @@ -46,8 +45,8 @@ private[transaction] class LedgerTimeValidator(defaultConfig: Configuration)
_ => StepContinue(transactionEntry),
)
case None => // Pre-execution: propagate the time bounds and defer the checks to post-execution.
(commitContext.minimumRecordTime, commitContext.maximumRecordTime)
.mapN((minimumRecordTime, maximumRecordTime) => {
(commitContext.minimumRecordTime, commitContext.maximumRecordTime) match {
case (Some(minimumRecordTime), Some(maximumRecordTime)) =>
val outOfTimeBoundsLogEntry = DamlLogEntry.newBuilder
.setTransactionRejectionEntry(
rejections.preExecutionOutOfTimeBoundsRejectionEntry(
Expand All @@ -59,12 +58,11 @@ private[transaction] class LedgerTimeValidator(defaultConfig: Configuration)
.build
commitContext.outOfTimeBoundsLogEntry = Some(outOfTimeBoundsLogEntry)
StepContinue(transactionEntry)
})
.getOrElse(
case _ =>
throw Err.InternalError(
"Minimum and maximum record times were not set in the committer context"
)
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class LedgerTimeValidatorSpec extends AnyWordSpec with Matchers {
List("aSubmitter")
)
private val aTransactionEntrySummary = DamlTransactionEntrySummary(aDamlTransactionEntry)
val emptyConfigurationStateValue: DamlStateValue =
private val emptyConfigurationStateValue: DamlStateValue =
defaultConfigurationStateValueBuilder().build

"LedgerTimeValidator" can {
"when the record time is not available" should {
"compute and correctly out-of-time-bounds log entry with min/max record time available in the committer context" in {
"compute and correctly set out-of-time-bounds log entry with min/max record time available in the committer context" in {
val context = createCommitContext(recordTime = None)
context.minimumRecordTime = Some(Timestamp.now())
context.maximumRecordTime = Some(Timestamp.now())
Expand Down

0 comments on commit 2091f59

Please sign in to comment.