Increase time model skew limits (#11273)

* Increase time model skew limits

changelog_begin
changelog_end

* Only override time model for sandbox
This commit is contained in:
Robert Autenrieth 2021-10-18 21:27:53 +02:00 committed by GitHub
parent 8f94cffdd1
commit 46f6877ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -85,8 +85,12 @@ class LedgerTimeValidatorSpec extends AnyWordSpec with Matchers {
aDamlTransactionEntrySummaryWithSubmissionAndLedgerEffectiveTimes,
)
context.minimumRecordTime shouldEqual Some(Instant.ofEpochSecond(-28))
context.maximumRecordTime shouldEqual Some(Instant.ofEpochSecond(31))
context.minimumRecordTime shouldEqual Some(
Instant.ofEpochSecond(2).minus(theDefaultConfig.timeModel.minSkew)
)
context.maximumRecordTime shouldEqual Some(
Instant.ofEpochSecond(1).plus(theDefaultConfig.timeModel.maxSkew)
)
context.deduplicateUntil shouldBe empty
context.outOfTimeBoundsLogEntry should not be empty
context.outOfTimeBoundsLogEntry.foreach { actualOutOfTimeBoundsLogEntry =>
@ -106,7 +110,9 @@ class LedgerTimeValidatorSpec extends AnyWordSpec with Matchers {
context.minimumRecordTime shouldEqual Some(
Instant.ofEpochSecond(3).plus(Timestamp.Resolution)
)
context.maximumRecordTime shouldEqual Some(Instant.ofEpochSecond(31))
context.maximumRecordTime shouldEqual Some(
Instant.ofEpochSecond(1).plus(theDefaultConfig.timeModel.maxSkew)
)
context.deduplicateUntil shouldEqual Some(
Instant.ofEpochSecond(aDeduplicateUntil.getSeconds)
)

View File

@ -11,7 +11,6 @@ import com.daml.ledger.api.auth.AuthServiceJWT
import com.daml.ledger.api.domain.LedgerId
import com.daml.ledger.api.tls.TlsVersion.TlsVersion
import com.daml.ledger.api.tls.{SecretsUrl, TlsConfiguration}
import com.daml.ledger.configuration.LedgerTimeModel
import com.daml.lf.data.Ref
import com.daml.platform.apiserver.SeedService.Seeding
import com.daml.platform.common.LedgerIdMode
@ -312,7 +311,7 @@ class CommonCliBase(name: LedgerName) {
config.copy(timeModel = config.timeModel.copy(minSkew = duration, maxSkew = duration))
}
.text(
s"Maximum skew (in seconds) between the ledger time and the record time. Default is ${LedgerTimeModel.reasonableDefault.maxSkew.getSeconds}."
s"Maximum skew (in seconds) between the ledger time and the record time. Default is ${SandboxConfig.defaultConfig.timeModel.maxSkew.getSeconds}."
)
opt[Duration]("management-service-timeout")

View File

@ -119,7 +119,14 @@ object SandboxConfig {
configurationLoadTimeout = Duration.ofSeconds(10),
maxDeduplicationDuration = None,
delayBeforeSubmittingLedgerConfiguration = Duration.ofSeconds(1),
timeModel = LedgerTimeModel.reasonableDefault,
// Sandbox is a slow ledger, use a big skew to avoid failing commands under load.
// If sandbox ever gets fast enough not to cause flakes in our tests,
// this can be reverted to LedgerTimeModel.reasonableDefault.
timeModel = LedgerTimeModel(
avgTransactionLatency = Duration.ofSeconds(0L),
minSkew = Duration.ofSeconds(120L),
maxSkew = Duration.ofSeconds(120L),
).get,
commandConfig = CommandConfiguration.default,
submissionConfig = SubmissionConfiguration.default,
tlsConfig = None,