Skip to content

Commit

Permalink
Revert "Upgrade dependencies to their latest stable release (digital-…
Browse files Browse the repository at this point in the history
…asset#15216)" (digital-asset#15309)

This reverts commit 1454497

changelog_begin
changelog_end
  • Loading branch information
tudor-da authored Oct 24, 2022
1 parent 322de04 commit 1a4ef5b
Show file tree
Hide file tree
Showing 26 changed files with 6,363 additions and 10,766 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ proto_library(
visibility = ["//visibility:public"],
)
""",
sha256 = "f965f0a06aec9ce8c8a9f596025d90bf8cf08f99c5d81b705079f0c932171a52",
sha256 = "2ddce4c5927fa8dd80069fba2fb60199f5b2b95e81e8da69b132665fae6c638c",
strip_prefix = "ScalaPB-{}".format(scalapb_version),
urls = ["https://github.com/scalapb/ScalaPB/archive/refs/tags/v{}.tar.gz".format(scalapb_version)],
)
Expand Down
183 changes: 87 additions & 96 deletions bazel-java-deps.bzl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bazel_tools/scalapb.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

scalapb_version = "0.11.11"
scalapb_version = "0.11.8"
scalapb_protoc_version = "0.9.5"
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class CodegenConfigReaderSpec extends AnyFlatSpec with Matchers with ScalaCheckP
|version: 1.2.3""".stripMargin

codegenConf(badConfigStr, Java) shouldBe Left(
ConfigParseError("Missing required field: DownField(codegen)")
ConfigParseError("Attempt to decode value on failed cursor: DownField(codegen)")
)
}

Expand All @@ -145,7 +145,7 @@ class CodegenConfigReaderSpec extends AnyFlatSpec with Matchers with ScalaCheckP

codegenConf(badConfigStr, Java) shouldBe Left(
ConfigParseError(
"Missing required field: DownField(java),DownField(codegen)"
"[A]Option[A]: DownField(java),DownField(codegen)"
)
)
}
Expand Down Expand Up @@ -231,7 +231,7 @@ class CodegenConfigReaderSpec extends AnyFlatSpec with Matchers with ScalaCheckP
| a: a""".stripMargin

codegenConf(badConfigStr, Java) shouldBe Left(
ConfigParseError("Couldn't decode key.: DownField(a),DownField(module-prefixes)")
ConfigParseError("[K, V]Map[K, V]: DownField(a),DownField(module-prefixes)")
)
}

Expand All @@ -248,7 +248,7 @@ class CodegenConfigReaderSpec extends AnyFlatSpec with Matchers with ScalaCheckP
| a-: a""".stripMargin

codegenConf(badConfigStr, Java) shouldBe Left(
ConfigParseError("Couldn't decode key.: DownField(a-),DownField(module-prefixes)")
ConfigParseError("[K, V]Map[K, V]: DownField(a-),DownField(module-prefixes)")
)
}

Expand All @@ -265,7 +265,7 @@ class CodegenConfigReaderSpec extends AnyFlatSpec with Matchers with ScalaCheckP
| -1.2.3: a""".stripMargin

codegenConf(badConfigStr, Java) shouldBe Left(
ConfigParseError("Couldn't decode key.: DownField(-1.2.3),DownField(module-prefixes)")
ConfigParseError("[K, V]Map[K, V]: DownField(-1.2.3),DownField(module-prefixes)")
)
}

Expand All @@ -282,7 +282,7 @@ class CodegenConfigReaderSpec extends AnyFlatSpec with Matchers with ScalaCheckP
| -: a""".stripMargin

codegenConf(badConfigStr, Java) shouldBe Left(
ConfigParseError("Couldn't decode key.: DownField(-),DownField(module-prefixes)")
ConfigParseError("[K, V]Map[K, V]: DownField(-),DownField(module-prefixes)")
)
}

Expand Down
2 changes: 1 addition & 1 deletion language-support/java/bindings-rxjava/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ da_java_library(
"@maven//:io_grpc_grpc_stub",
"@maven//:io_netty_netty_handler",
"@maven//:io_reactivex_rxjava2_rxjava",
"@maven//:org_checkerframework_checker_qual",
"@maven//:org_checkerframework_checker",
"@maven//:org_pcollections_pcollections",
"@maven//:org_slf4j_slf4j_api",
],
Expand Down
2 changes: 1 addition & 1 deletion language-support/java/bindings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ da_java_library(
"@maven//:io_grpc_grpc_protobuf",
"@maven//:io_grpc_grpc_stub",
"@maven//:javax_annotation_javax_annotation_api",
"@maven//:org_checkerframework_checker_qual",
"@maven//:org_checkerframework_checker",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package com.daml.ledger.api.perf.util

import com.daml.ledger.api.perf.util.reporter.JMeterReporter
import org.scalameter.KeyValue
import org.scalameter.api._
import org.scalameter.execution.{LocalExecutor, SeparateJvmsExecutor}
import org.scalameter.picklers.Implicits._
Expand Down Expand Up @@ -52,11 +51,11 @@ abstract class PerformanceTest extends Bench[Double] {

protected def daConfig: Seq[org.scalameter.KeyValue] =
Seq[org.scalameter.KeyValue](
KeyValue(exec.independentSamples -> 1),
KeyValue(exec.minWarmupRuns -> 5),
KeyValue(exec.benchRuns -> 20),
KeyValue(exec.jvmflags -> List("-Xmx4096m", "-Xms4096m")),
KeyValue(verbose -> true),
exec.independentSamples -> 1,
exec.minWarmupRuns -> 5,
exec.benchRuns -> 20,
exec.jvmflags -> List("-Xmx4096m", "-Xms4096m"),
verbose -> true,
)

protected def await[T](f: => Future[T]): T = {
Expand Down
1 change: 0 additions & 1 deletion ledger-service/http-json-cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ da_scala_library(
"@maven//:com_chuusai_shapeless",
"@maven//:com_github_pureconfig_pureconfig_core",
"@maven//:com_github_pureconfig_pureconfig_generic",
"@maven//:com_github_pureconfig_pureconfig_generic_base",
"@maven//:com_github_scopt_scopt",
"@maven//:org_scalaz_scalaz_core",
"@maven//:com_typesafe_akka_akka_stream",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.daml.http.perf.scenario

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.http.check.ws.WsFrameCheck
import io.gatling.http.check.ws.WsTextFrameCheck

import scala.concurrent.duration._

Expand All @@ -25,7 +25,7 @@ class AsyncQueryConstantAcs
private val queryRequest =
"""{"templateIds": ["Iou:Iou"], "query": {"amount": {"%gt": 1.0}}}"""

val messageCheck: WsFrameCheck.Text = ws
val messageCheck: WsTextFrameCheck = ws
.checkTextMessage("messageCheck")
.check(jsonPath("$.offset").find.notExists)
.check(jsonPath("$.events[*].created").findAll)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@
package com.daml.http.perf.scenario

import io.gatling.commons.validation
import io.gatling.core.Predef._
import io.gatling.core.check.{Check, CheckResult}

object Checks {

/* Useful for debugging */
def printResponseCheck[R]: Check[R] = Check.Simple[R](
f = (response, _, _) => {
def printResponseCheck[R]: Check[R] = new PrintResponseCheck[R]

/** Useful for debugging.
*
* @tparam R response type
*/
private class PrintResponseCheck[R] extends Check[R] {
override def check(
response: R,
session: Session,
preparedCache: java.util.Map[Any, Any],
): validation.Validation[CheckResult] = {
println(s"Response: $response")
validation.Success(CheckResult(None, None))
},
condition = None,
)
}
}
}
4 changes: 2 additions & 2 deletions ledger-service/http-json/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ test_suite(
"//libs-scala/resources-grpc",
"//libs-scala/scala-utils",
"//libs-scala/timer-utils",
"@maven//:eu_rekawek_toxiproxy_toxiproxy_java_2_1_7",
"@maven//:eu_rekawek_toxiproxy_toxiproxy_java_2_1_3",
"@maven//:org_scalatest_scalatest_compatible",
],
)
Expand Down Expand Up @@ -627,7 +627,7 @@ test_suite(
"//libs-scala/resources",
"//libs-scala/scala-utils",
"//libs-scala/timer-utils",
"@maven//:eu_rekawek_toxiproxy_toxiproxy_java_2_1_7",
"@maven//:eu_rekawek_toxiproxy_toxiproxy_java_2_1_3",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:org_scalatest_scalatest_compatible",
],
Expand Down
2 changes: 0 additions & 2 deletions ledger-service/pureconfig-utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ da_scala_library(
"@maven//:com_chuusai_shapeless",
"@maven//:com_github_pureconfig_pureconfig_core",
"@maven//:com_github_pureconfig_pureconfig_generic",
"@maven//:com_github_pureconfig_pureconfig_generic_base",
"@maven//:com_typesafe_akka_akka_http_core",
"@maven//:com_typesafe_akka_akka_parsing",
"@maven//:com_typesafe_scala_logging_scala_logging",
Expand Down Expand Up @@ -48,7 +47,6 @@ da_scala_test(
"@maven//:com_chuusai_shapeless",
"@maven//:com_github_pureconfig_pureconfig_core",
"@maven//:com_github_pureconfig_pureconfig_generic",
"@maven//:com_github_pureconfig_pureconfig_generic_base",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_matchers_core",
"@maven//:org_scalatest_scalatest_shouldmatchers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import akka.stream.scaladsl.Sink
import akka.stream.testkit.scaladsl.TestSink
import com.daml.ledger.api.testing.utils.AkkaBeforeAndAfterAll
import org.awaitility.Awaitility.await
import org.awaitility.Durations
import org.awaitility.Duration
import org.scalatest.FutureOutcome
import org.scalatest.concurrent.{AsyncTimeLimitedTests, ScaledTimeSpans}
import org.scalatest.matchers.should.Matchers
Expand Down Expand Up @@ -58,7 +58,7 @@ class SignalDispatcherTest
sut.getRunningState should have size 1L
s.cancel()
await("Cancellation handling")
.atMost(Durations.TEN_SECONDS)
.atMost(Duration.TEN_SECONDS)
.until(() => lang.Boolean.valueOf(sut.getRunningState.isEmpty))
sut.getRunningState shouldBe empty
}
Expand Down
2 changes: 0 additions & 2 deletions ledger/ledger-runner-common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ da_scala_library(
"@maven//:com_github_scopt_scopt",
"@maven//:com_github_pureconfig_pureconfig_core",
"@maven//:com_github_pureconfig_pureconfig_generic",
"@maven//:com_github_pureconfig_pureconfig_generic_base",
"@maven//:com_chuusai_shapeless",
],
tags = ["maven_coordinates=com.daml:ledger-runner-common:__VERSION__"],
Expand Down Expand Up @@ -85,7 +84,6 @@ da_scala_test_suite(
"@maven//:org_scalatest_scalatest_shouldmatchers",
"@maven//:com_github_pureconfig_pureconfig_core",
"@maven//:com_github_pureconfig_pureconfig_generic",
"@maven//:com_github_pureconfig_pureconfig_generic_base",
"@maven//:org_scalacheck_scalacheck",
"@maven//:org_scalatestplus_scalacheck_1_15",
"@maven//:com_chuusai_shapeless",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package com.daml.ledger.runner.common

import pureconfig.{ConfigReader, ConfigSource}
import pureconfig.{ConfigReader, ConfigSource, Derivation}
import com.typesafe.config.{ConfigFactory, Config => TypesafeConfig}
import pureconfig.error.ConfigReaderFailures

Expand All @@ -25,7 +25,7 @@ trait ConfigLoader {
}

def loadConfig[T](config: TypesafeConfig)(implicit
reader: ConfigReader[T]
reader: Derivation[ConfigReader[T]]
): Either[String, T] =
ConfigSource.fromConfig(config).load[T].left.map(toError)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package com.daml.platform.indexer.ha

import java.util.concurrent.Executors

import akka.stream.Materializer
import com.codahale.metrics.MetricRegistry
import com.daml.ledger.api.health.ReportsHealth
import com.daml.ledger.resources.{Resource, ResourceContext, ResourceOwner}
import com.daml.logging.ContextualizedLogger
Expand Down Expand Up @@ -79,6 +79,7 @@ object IndexerStabilityTestFixture {

// Start N indexers that all compete for the same database
_ = logger.info(s"Starting $indexerCount indexers for database $jdbcUrl")
metrics = Metrics.ForTesting
indexers <- Resource
.sequence(
(1 to indexerCount).toList
Expand All @@ -93,10 +94,6 @@ object IndexerStabilityTestFixture {
}
)
.acquire()
// create a new MetricRegistry for each indexer, so they don't step on each other toes:
// Gauges can only be registered once. A subsequent attempt results in an exception for the
// call MetricRegistry#register or MetricRegistry#registerGauge
metrics = new Metrics(new MetricRegistry)
(inMemoryState, inMemoryStateUpdaterFlow) <-
LedgerApiServer
.createInMemoryStateAndUpdater(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,43 +35,38 @@ class BufferedTransactionByIdReaderSpec extends AsyncFlatSpec with MockitoSugar
private val bufferedTransaction1 = tx(bufferedTransactionId1)
private val bufferedTransaction2 = tx(bufferedTransactionId2)

class Fixture {
val inMemoryFanout = mock[InMemoryFanoutBuffer]
when(inMemoryFanout.lookup(bufferedTransactionId1)).thenReturn(Some(bufferedTransaction1))
when(inMemoryFanout.lookup(bufferedTransactionId2)).thenReturn(Some(bufferedTransaction2))
when(inMemoryFanout.lookup(notBufferedTransactionId)).thenReturn(None)
when(inMemoryFanout.lookup(unknownTransactionId)).thenReturn(None)

val toApiResponse = mock[ToApiResponse[String]]
when(toApiResponse.apply(bufferedTransaction1, requestingParties, loggingContext))
.thenReturn(Future.successful(Some(bufferedTransactionId1)))
when(toApiResponse.apply(bufferedTransaction2, requestingParties, loggingContext))
.thenReturn(Future.successful(None))

val fetchFromPersistence = new FetchTransactionByIdFromPersistence[String] {
override def apply(
transactionId: String,
requestingParties: Set[Party],
loggingContext: LoggingContext,
): Future[Option[String]] =
transactionId match {
case `notBufferedTransactionId` => Future.successful(Some(notBufferedTransactionId))
case `unknownTransactionId` => Future.successful(None)
case other => fail(s"Unexpected $other transactionId")
}
}

val bufferedTransactionByIdReader = new BufferedTransactionByIdReader[String](
inMemoryFanoutBuffer = inMemoryFanout,
fetchFromPersistence = fetchFromPersistence,
toApiResponse = toApiResponse,
)
private val inMemoryFanout = mock[InMemoryFanoutBuffer]
when(inMemoryFanout.lookup(bufferedTransactionId1)).thenReturn(Some(bufferedTransaction1))
when(inMemoryFanout.lookup(bufferedTransactionId2)).thenReturn(Some(bufferedTransaction2))
when(inMemoryFanout.lookup(notBufferedTransactionId)).thenReturn(None)
when(inMemoryFanout.lookup(unknownTransactionId)).thenReturn(None)

private val toApiResponse = mock[ToApiResponse[String]]
when(toApiResponse.apply(bufferedTransaction1, requestingParties, loggingContext))
.thenReturn(Future.successful(Some(bufferedTransactionId1)))
when(toApiResponse.apply(bufferedTransaction2, requestingParties, loggingContext))
.thenReturn(Future.successful(None))

private val fetchFromPersistence = new FetchTransactionByIdFromPersistence[String] {
override def apply(
transactionId: String,
requestingParties: Set[Party],
loggingContext: LoggingContext,
): Future[Option[String]] =
transactionId match {
case `notBufferedTransactionId` => Future.successful(Some(notBufferedTransactionId))
case `unknownTransactionId` => Future.successful(None)
case other => fail(s"Unexpected $other transactionId")
}
}

s"$className.fetch" should "convert to API response and return if transaction buffered" in {
val fixture = new Fixture
import fixture._
private val bufferedTransactionByIdReader = new BufferedTransactionByIdReader[String](
inMemoryFanoutBuffer = inMemoryFanout,
fetchFromPersistence = fetchFromPersistence,
toApiResponse = toApiResponse,
)

s"$className.fetch" should "convert to API response and return if transaction buffered" in {
for {
response1 <- bufferedTransactionByIdReader.fetch(bufferedTransactionId1, requestingParties)
response2 <- bufferedTransactionByIdReader.fetch(bufferedTransactionId2, requestingParties)
Expand All @@ -85,9 +80,6 @@ class BufferedTransactionByIdReaderSpec extends AsyncFlatSpec with MockitoSugar
}

s"$className.fetch" should "delegate to persistence fetch if transaction not buffered" in {
val fixture = new Fixture
import fixture._

for {
response1 <- bufferedTransactionByIdReader.fetch(notBufferedTransactionId, requestingParties)
response2 <- bufferedTransactionByIdReader.fetch(unknownTransactionId, requestingParties)
Expand Down
1 change: 0 additions & 1 deletion ledger/sandbox-on-x/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ da_scala_library(
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:com_github_pureconfig_pureconfig_core",
"@maven//:com_github_pureconfig_pureconfig_generic",
"@maven//:com_github_pureconfig_pureconfig_generic_base",
"@maven//:com_chuusai_shapeless",
"@maven//:org_typelevel_cats_core",
],
Expand Down
1 change: 0 additions & 1 deletion libs-scala/gatling-utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ da_scala_library(
deps = [
"//libs-scala/scala-utils",
"@maven//:io_gatling_gatling_app",
"@maven//:io_gatling_gatling_commons_shared",
"@maven//:io_gatling_gatling_core",
"@maven//:io_netty_netty_common",
"@maven//:io_netty_netty_transport",
Expand Down
Loading

0 comments on commit 1a4ef5b

Please sign in to comment.