update canton to 20240730.13802.vbf8b8021 (#19702)

* update canton to 20240730.13802.vbf8b8021

* Fix
---------

Co-authored-by: Azure Pipelines Daml Build <support@digitalasset.com>
Co-authored-by: Andreas Triantafyllos <andreas.triantafyllos@digitalasset.com>
This commit is contained in:
azure-pipelines[bot] 2024-07-31 18:52:00 +03:00 committed by GitHub
parent 1f282c8ec2
commit 7a8fc1298d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
206 changed files with 1312 additions and 1025 deletions

View File

@ -109,6 +109,8 @@ da_scala_library(
"@maven//:com_auth0_java_jwt",
"@maven//:com_auth0_jwks_rsa",
"@maven//:com_google_guava_guava",
"@maven//:io_spray_spray_json_2_13",
"@maven//:org_slf4j_slf4j_api",
],
)
@ -486,7 +488,10 @@ scala_library(
"-language:postfixOps",
],
unused_dependency_checker_mode = "error",
visibility = ["//daml-script:__subpackages__"],
visibility = [
"//daml-script:__subpackages__",
"//language-support:__subpackages__",
],
runtime_deps = [
# not used at compile time, but required by com.digitalasset.canton.util.PekkoUtil.createActorSystem
"@maven//:org_apache_pekko_pekko_slf4j_2_13",
@ -499,6 +504,7 @@ scala_library(
":community_lib_wartremover",
":community_util-logging",
":daml-common-staging_daml-errors",
":daml-common-staging_daml-jwt",
":daml-common-staging_daml-tls",
":daml-common-staging_util-external",
":ledger_api_proto_scala",
@ -516,6 +522,7 @@ scala_library(
"//libs-scala/rs-grpc-pekko",
"//libs-scala/scala-utils",
"//observability/metrics",
"//observability/tracing",
"@canton_maven//:org_flywaydb_flyway_core",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
@ -550,6 +557,7 @@ scala_library(
"@maven//:io_opentelemetry_opentelemetry_context",
"@maven//:io_opentelemetry_opentelemetry_sdk_metrics",
"@maven//:io_scalaland_chimney_2_13",
"@maven//:io_spray_spray_json_2_13",
"@maven//:junit_junit",
"@maven//:org_apache_pekko_pekko_actor_2_13",
"@maven//:org_bouncycastle_bcprov_jdk15on",

View File

@ -51,7 +51,6 @@ import com.daml.ledger.api.v2.admin.user_management_service.{
User,
UserManagementServiceGrpc,
}
import com.daml.ledger.api.v2.checkpoint.Checkpoint
import com.daml.ledger.api.v2.command_completion_service.CommandCompletionServiceGrpc.CommandCompletionServiceStub
import com.daml.ledger.api.v2.command_completion_service.{
CommandCompletionServiceGrpc,
@ -148,7 +147,7 @@ import com.digitalasset.canton.protocol.LfContractId
import com.digitalasset.canton.serialization.ProtoConverter
import com.digitalasset.canton.topology.{DomainId, PartyId}
import com.digitalasset.canton.util.BinaryFileUtil
import com.digitalasset.canton.{LfPackageId, LfPartyId, config}
import com.digitalasset.canton.{LfPackageId, LfPartyId}
import com.google.protobuf.empty.Empty
import com.google.protobuf.field_mask.FieldMask
import io.grpc.*
@ -1493,12 +1492,6 @@ object LedgerApiCommands {
}
}
final case class CompletionWrapper(
completion: Completion,
checkpoint: Checkpoint,
domainId: DomainId,
)
object CommandCompletionService {
abstract class BaseCommand[Req, Resp, Res] extends GrpcAdminCommand[Req, Resp, Res] {
override type Svc = CommandCompletionServiceStub
@ -1513,11 +1506,11 @@ object LedgerApiCommands {
expectedCompletions: Int,
timeout: java.time.Duration,
applicationId: String,
)(filter: CompletionWrapper => Boolean, scheduler: ScheduledExecutorService)
)(filter: Completion => Boolean, scheduler: ScheduledExecutorService)
extends BaseCommand[
CompletionStreamRequest,
Seq[CompletionWrapper],
Seq[CompletionWrapper],
Seq[Completion],
Seq[Completion],
] {
override def createRequest(): Either[String, CompletionStreamRequest] =
@ -1532,23 +1525,12 @@ object LedgerApiCommands {
override def submitRequest(
service: CommandCompletionServiceStub,
request: CompletionStreamRequest,
): Future[Seq[CompletionWrapper]] = {
): Future[Seq[Completion]] = {
import scala.jdk.DurationConverters.*
GrpcAdminCommand
.streamedResponse[CompletionStreamRequest, CompletionStreamResponse, CompletionWrapper](
.streamedResponse[CompletionStreamRequest, CompletionStreamResponse, Completion](
service.completionStream,
response =>
List(
CompletionWrapper(
completion = response.completion.getOrElse(
throw new IllegalStateException("Completion should be present.")
),
checkpoint = response.checkpoint.getOrElse(
throw new IllegalStateException("Checkpoint should be present.")
),
domainId = DomainId.tryFromString(response.domainId),
)
).filter(filter),
response => response.completionResponse.completion.toList.filter(filter),
request,
expectedCompletions,
timeout.toScala,
@ -1557,67 +1539,15 @@ object LedgerApiCommands {
}
override def handleResponse(
response: Seq[CompletionWrapper]
): Either[String, Seq[CompletionWrapper]] =
Right(response)
override def timeoutType: TimeoutType = ServerEnforcedTimeout
}
final case class CompletionCheckpointRequest(
partyId: LfPartyId,
beginExclusive: String,
expectedCompletions: Int,
timeout: config.NonNegativeDuration,
applicationId: String,
)(filter: Completion => Boolean, scheduler: ScheduledExecutorService)
extends BaseCommand[CompletionStreamRequest, Seq[(Completion, Option[Checkpoint])], Seq[
(Completion, Option[Checkpoint])
]] {
override def createRequest(): Either[String, CompletionStreamRequest] =
Right(
CompletionStreamRequest(
applicationId = applicationId,
parties = Seq(partyId),
beginExclusive = beginExclusive,
)
)
override def submitRequest(
service: CommandCompletionServiceStub,
request: CompletionStreamRequest,
): Future[Seq[(Completion, Option[Checkpoint])]] = {
def extract(response: CompletionStreamResponse): Seq[(Completion, Option[Checkpoint])] = {
val checkpoint = response.checkpoint
response.completion.filter(filter).map(_ -> checkpoint).toList
}
GrpcAdminCommand.streamedResponse[
CompletionStreamRequest,
CompletionStreamResponse,
(Completion, Option[Checkpoint]),
](
service.completionStream,
extract,
request,
expectedCompletions,
timeout.asFiniteApproximation,
scheduler,
)
}
override def handleResponse(
response: Seq[(Completion, Option[Checkpoint])]
): Either[String, Seq[(Completion, Option[Checkpoint])]] =
response: Seq[Completion]
): Either[String, Seq[Completion]] =
Right(response)
override def timeoutType: TimeoutType = ServerEnforcedTimeout
}
final case class Subscribe(
observer: StreamObserver[CompletionWrapper],
observer: StreamObserver[Completion],
parties: Seq[String],
offset: String,
applicationId: String,
@ -1638,20 +1568,9 @@ object LedgerApiCommands {
service: CommandCompletionServiceStub,
request: CompletionStreamRequest,
): Future[AutoCloseable] = {
val rawObserver = new ForwardingStreamObserver[CompletionStreamResponse, CompletionWrapper](
val rawObserver = new ForwardingStreamObserver[CompletionStreamResponse, Completion](
observer,
response =>
List(
CompletionWrapper(
completion = response.completion.getOrElse(
throw new IllegalStateException("Completion should be present.")
),
checkpoint = response.checkpoint.getOrElse(
throw new IllegalStateException("Checkpoint should be present.")
),
domainId = DomainId.tryFromString(response.domainId),
)
),
response => response.completionResponse.completion.toList,
)
val context = Context.current().withCancellation()
context.run(() => service.completionStream(request, rawObserver))

View File

@ -6,11 +6,10 @@ package com.digitalasset.canton.console.commands
import cats.syntax.foldable.*
import cats.syntax.functorFilter.*
import cats.syntax.traverse.*
import com.daml.jwt.{Jwt, JwtDecoder}
import com.daml.jwt.{AuthServiceJWTCodec, Jwt, JwtDecoder, StandardJWTPayload}
import com.daml.ledger.api.v2.admin.command_inspection_service.CommandState
import com.daml.ledger.api.v2.admin.package_management_service.PackageDetails
import com.daml.ledger.api.v2.admin.party_management_service.PartyDetails as ProtoPartyDetails
import com.daml.ledger.api.v2.checkpoint.Checkpoint
import com.daml.ledger.api.v2.commands.{Command, DisclosedContract}
import com.daml.ledger.api.v2.completion.Completion
import com.daml.ledger.api.v2.event.CreatedEvent
@ -42,7 +41,6 @@ import com.daml.ledger.javaapi as javab
import com.daml.metrics.api.MetricsContext
import com.daml.scalautil.Statement.discard
import com.digitalasset.canton.admin.api.client.commands.LedgerApiCommands
import com.digitalasset.canton.admin.api.client.commands.LedgerApiCommands.CompletionWrapper
import com.digitalasset.canton.admin.api.client.commands.LedgerApiCommands.UpdateService.*
import com.digitalasset.canton.admin.api.client.commands.LedgerApiTypeWrappers.{
WrappedContractEntry,
@ -68,7 +66,6 @@ import com.digitalasset.canton.console.{
RemoteParticipantReference,
}
import com.digitalasset.canton.data.{CantonTimestamp, DeduplicationPeriod}
import com.digitalasset.canton.ledger.api.auth.{AuthServiceJWTCodec, StandardJWTPayload}
import com.digitalasset.canton.ledger.api.domain
import com.digitalasset.canton.ledger.api.domain.{
IdentityProviderConfig,
@ -718,9 +715,8 @@ trait BaseLedgerApiAdministration extends NoTracing {
partyId = submitter,
atLeastNumCompletions = 1,
beginOffset = ledgerEndBefore,
filter = _.completion.commandId == commandId,
filter = _.commandId == commandId,
)(0)
.completion
.updateId
participants.foreach { case (participant, (queryingParty, from)) =>
discard(waitForUpdateId(participant, from, queryingParty, completionUpdateId, timeout))
@ -1293,8 +1289,8 @@ trait BaseLedgerApiAdministration extends NoTracing {
beginOffset: String,
applicationId: String = applicationId,
timeout: config.NonNegativeDuration = timeouts.ledgerCommand,
filter: CompletionWrapper => Boolean = _ => true,
): Seq[CompletionWrapper] =
filter: Completion => Boolean = _ => true,
): Seq[Completion] =
check(FeatureFlag.Testing)(consoleEnvironment.run {
ledgerApiCommand(
LedgerApiCommands.CommandCompletionService.CompletionRequest(
@ -1307,34 +1303,6 @@ trait BaseLedgerApiAdministration extends NoTracing {
)
})
@Help.Summary(
"Lists command completions following the specified offset along with the checkpoints included in the completions",
FeatureFlag.Testing,
)
@Help.Description(
"""If the participant has been pruned via `pruning.prune` and if `offset` is lower than
|the pruning offset, this command fails with a `NOT_FOUND` error."""
)
def list_with_checkpoint(
partyId: PartyId,
atLeastNumCompletions: Int,
beginExclusive: String,
applicationId: String = applicationId,
timeout: config.NonNegativeDuration = timeouts.ledgerCommand,
filter: Completion => Boolean = _ => true,
): Seq[(Completion, Option[Checkpoint])] =
check(FeatureFlag.Testing)(consoleEnvironment.run {
ledgerApiCommand(
LedgerApiCommands.CommandCompletionService.CompletionCheckpointRequest(
partyId.toLf,
beginExclusive,
atLeastNumCompletions,
timeout,
applicationId,
)(filter, consoleEnvironment.environment.scheduler)
)
})
@Help.Summary("Subscribe to the command completion stream", FeatureFlag.Testing)
@Help.Description(
"""This function connects to the command completion stream and passes command completions to `observer` until
@ -1345,7 +1313,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
|this command fails with a `NOT_FOUND` error."""
)
def subscribe(
observer: StreamObserver[CompletionWrapper],
observer: StreamObserver[Completion],
parties: Seq[PartyId],
beginOffset: String = "",
applicationId: String = applicationId,

View File

@ -1,5 +1,5 @@
<!--
~ Copyright 2020 Digital Asset (Switzerland) GmbH and/or its affiliates
~ Copyright 2024 Digital Asset (Switzerland) GmbH and/or its affiliates
~
~ SPDX-License-Identifier: Apache-2.0
-->
@ -123,7 +123,14 @@
<!-- # TODO(#13519): Suppress error in JSON API integration tests and remove this exception -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.ledger.api.auth.interceptor.AuthorizationInterceptor</logger>
<logger>com.digitalasset.canton.auth.AuthorizationInterceptor</logger>
<maxLevel>INFO</maxLevel>
<contains>Could not resolve is_deactivated status for user </contains>
<testing>true</testing>
</rewrite>
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.ledger.api.auth.interceptor.UserBasedAuthorizationInterceptor</logger>
<maxLevel>INFO</maxLevel>
<contains>Could not resolve is_deactivated status for user </contains>
<testing>true</testing>
@ -222,7 +229,7 @@
SecuredApisIntegrationTest: PERMISSION_DENIED(7,0): Claims do not authorize to act as party
-->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.ledger.api.auth.Authorizer</logger>
<logger>com.digitalasset.canton.auth.Authorizer</logger>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
@ -231,7 +238,7 @@
PERMISSION_DENIED(7,0): Claims were valid until 2023-04-27T11:47:43Z, current time is 2023-04-27T11:47:44.532146Z
-->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.ledger.api.auth.OngoingAuthorizationObserver</logger>
<logger>com.digitalasset.canton.ledger.api.auth.UserBasedOngoingAuthorization</logger>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
@ -480,5 +487,75 @@
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:LatestProtocolContinuityShard3ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:LatestProtocolContinuityShard4ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:LatestProtocolContinuityShard5ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:ProtocolContinuityShard0ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:ProtocolContinuityShard1ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:ProtocolContinuityShard2ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:ProtocolContinuityShard3ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:ProtocolContinuityShard4ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:ProtocolContinuityShard5ConformanceTestDomain</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
<!-- Suppress ACS commitment processor catch-up degradation warnings in tests that might throw -->
<rewrite class="com.digitalasset.canton.logging.Rewrite">
<logger>com.digitalasset.canton.participant.pruning.AcsCommitmentProcessor:MajorUpgradeIntegrationTest</logger>
<contains>ACS_COMMITMENT_DEGRADATION</contains>
<maxLevel>INFO</maxLevel>
<testing>true</testing>
</rewrite>
</appender>
</included>

View File

@ -1,7 +1,7 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.domain.sequencing.authentication.grpc
package com.digitalasset.canton.auth
import io.grpc.ServerCall
@ -13,11 +13,9 @@ import scala.concurrent.blocking
* From then on, all future messages are sent directly to the given listener.
*
* The target listener is usually created through `Contexts.interceptCall` or `ServerCallHandler.startCall`.
*
* Copied from upstream.
*/
@SuppressWarnings(Array("org.wartremover.warts.Var"))
private[grpc] abstract class AsyncForwardingListener[ReqT] extends ServerCall.Listener[ReqT] {
abstract class AsyncForwardingListener[ReqT] extends ServerCall.Listener[ReqT] {
protected type Listener = ServerCall.Listener[ReqT]
private[this] val lock = new Object
private[this] val stash: mutable.ListBuffer[Listener => Unit] = new mutable.ListBuffer

View File

@ -1,7 +1,7 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.ledger.api.auth
package com.digitalasset.canton.auth
import com.digitalasset.canton.tracing.TraceContext
import io.grpc.Metadata
@ -30,8 +30,8 @@ import java.util.concurrent.CompletionStage
*/
trait AuthService {
/** Return empty [[com.digitalasset.canton.ledger.api.auth.ClaimSet.Unauthenticated]] to reject requests with a UNAUTHENTICATED error status.
* Return [[com.digitalasset.canton.ledger.api.auth.ClaimSet.Claims]] with only a single [[com.digitalasset.canton.ledger.api.auth.ClaimPublic]] claim to reject all non-public requests with a PERMISSION_DENIED status.
/** Return empty [[com.digitalasset.canton.auth.ClaimSet.Unauthenticated]] to reject requests with a UNAUTHENTICATED error status.
* Return [[com.digitalasset.canton.auth.ClaimSet.Claims]] with only a single [[com.digitalasset.canton.auth.ClaimPublic]] claim to reject all non-public requests with a PERMISSION_DENIED status.
* Return a failed future to reject requests with an INTERNAL error status.
*/
def decodeMetadata(headers: io.grpc.Metadata)(implicit

View File

@ -1,11 +1,17 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.ledger.api.auth
package com.digitalasset.canton.auth
import com.daml.jwt.{Error, JwtFromBearerHeader, JwtVerifierBase}
import com.digitalasset.canton.ledger.api.auth.AuthService.AUTHORIZATION_KEY
import com.digitalasset.canton.ledger.api.domain.IdentityProviderId
import com.daml.jwt.{
AuthServiceJWTCodec,
AuthServiceJWTPayload,
Error,
JwtFromBearerHeader,
JwtVerifierBase,
StandardJWTPayload,
}
import com.digitalasset.canton.auth.AuthService.AUTHORIZATION_KEY
import com.digitalasset.canton.logging.{NamedLoggerFactory, NamedLogging}
import com.digitalasset.canton.tracing.TraceContext
import io.grpc.Metadata
@ -15,7 +21,7 @@ import java.util.concurrent.{CompletableFuture, CompletionStage}
import scala.util.Try
/** An AuthService that reads a JWT token from a `Authorization: Bearer` HTTP header.
* The token is expected to use the format as defined in [[AuthServiceJWTPayload]]:
* The token is expected to use the format as defined in [[com.daml.jwt.AuthServiceJWTPayload]]:
*/
abstract class AuthServiceJWTBase(
verifier: JwtVerifierBase,
@ -120,7 +126,7 @@ class AuthServiceJWT(
protected[this] def payloadToClaims: AuthServiceJWTPayload => ClaimSet = {
case payload: StandardJWTPayload =>
ClaimSet.AuthenticatedUser(
identityProviderId = IdentityProviderId.Default,
identityProviderId = None,
participantId = payload.participantId,
userId = payload.userId,
expiration = payload.exp,
@ -142,7 +148,7 @@ class AuthServicePrivilegedJWT(
case payload: StandardJWTPayload =>
ClaimSet.Claims(
claims = ClaimSet.Claims.Wildcard.claims,
identityProviderId = IdentityProviderId.Default,
identityProviderId = None,
participantId = payload.participantId,
applicationId = Option.when(payload.userId.nonEmpty)(payload.userId),
expiration = payload.exp,

View File

@ -1,7 +1,7 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.ledger.api.auth
package com.digitalasset.canton.auth
import com.digitalasset.canton.tracing.TraceContext
import io.grpc.Metadata

View File

@ -1,23 +1,15 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.ledger.error.groups
package com.digitalasset.canton.auth
import com.daml.error.{
ContextualizedErrorLogger,
DamlErrorWithDefiniteAnswer,
ErrorCategory,
ErrorCategoryRetry,
ErrorCode,
Explanation,
Resolution,
}
import com.digitalasset.canton.ledger.error.ParticipantErrorGroup.LedgerApiErrorGroup.AuthorizationChecksErrorGroup
import com.daml.error.*
import com.digitalasset.canton.error.CantonErrorGroups
import scala.concurrent.duration.*
@Explanation("Authentication and authorization errors.")
object AuthorizationChecksErrors extends AuthorizationChecksErrorGroup {
object AuthorizationChecksErrors extends CantonErrorGroups.AuthorizationChecksErrorGroup {
@Explanation("""The stream was aborted because the authenticated user's rights changed,
|and the user might thus no longer be authorized to this stream.
@ -111,4 +103,24 @@ object AuthorizationChecksErrors extends AuthorizationChecksErrorGroup {
s"The provided authorization token is not sufficient to authorize the intended command: $cause"
)
}
@Explanation(
"""This error is emitted when a submitted ledger API command contains an invalid token."""
)
@Resolution("Inspect the reason given and correct your application.")
object InvalidToken
extends ErrorCode(id = "INVALID_TOKEN", ErrorCategory.InvalidIndependentOfSystemState) {
final case class MissingUserId(reason: String)(implicit
loggingContext: ContextualizedErrorLogger
) extends DamlErrorWithDefiniteAnswer(
cause = s"The submitted request is missing a user-id: $reason"
)
final case class InvalidField(fieldName: String, message: String)(implicit
loggingContext: ContextualizedErrorLogger
) extends DamlErrorWithDefiniteAnswer(
cause =
s"The submitted token has a field with invalid value: Invalid field $fieldName: $message"
)
}
}

View File

@ -1,9 +1,7 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.ledger.api.auth
import com.digitalasset.canton.ledger.api.domain.IdentityProviderId
package com.digitalasset.canton.auth
import java.time.Instant
@ -52,11 +50,10 @@ object AuthorizationError {
override val reason = s"Claims do not authorize to act as party '$party'"
}
final case class InvalidIdentityProviderId(identityProviderId: IdentityProviderId)
final case class InvalidIdentityProviderId(identityProviderId: String)
extends AuthorizationError {
private val id = identityProviderId.toRequestString
override val reason =
s"identity_provider_id from the request `$id` does not match the one provided in the authorization claims"
s"identity_provider_id from the request `$identityProviderId` does not match the one provided in the authorization claims"
}
final case class InvalidField(fieldName: String, reason: String) extends AuthorizationError

View File

@ -0,0 +1,100 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.auth
import com.daml.tracing.Telemetry
import com.digitalasset.canton.logging.{
ErrorLoggingContext,
LoggingContextWithTrace,
NamedLoggerFactory,
NamedLogging,
}
import io.grpc.*
import scala.concurrent.{ExecutionContext, Future}
import scala.jdk.FutureConverters.CompletionStageOps
import scala.util.{Failure, Success, Try}
/** This interceptor uses the given [[AuthService]] to get [[ClaimSet.Claims]] for the current request,
* and then stores them in the current [[io.grpc.Context]].
*/
class AuthorizationInterceptor(
authService: AuthService,
telemetry: Telemetry,
val loggerFactory: NamedLoggerFactory,
implicit val ec: ExecutionContext,
) extends ServerInterceptor
with NamedLogging {
import LoggingContextWithTrace.implicitExtractTraceContext
override def interceptCall[ReqT, RespT](
call: ServerCall[ReqT, RespT],
headers: Metadata,
nextListener: ServerCallHandler[ReqT, RespT],
): ServerCall.Listener[ReqT] = {
// Note: Context uses ThreadLocal storage, we need to capture it outside of the async block below.
// Contexts are immutable and safe to pass around.
val prevCtx = Context.current
implicit val loggingContextWithTrace = LoggingContextWithTrace(loggerFactory, telemetry)
implicit val errorLoggingContext = ErrorLoggingContext(logger, loggingContextWithTrace)
// The method interceptCall() must return a Listener.
// The target listener is created by calling `Contexts.interceptCall()`.
// However, this is only done after we have asynchronously received the claims.
// Therefore, we need to return a listener that buffers all messages until the target listener is available.
new AsyncForwardingListener[ReqT] {
private def closeWithError(error: StatusRuntimeException) = {
call.close(error.getStatus, error.getTrailers)
new ServerCall.Listener[Nothing]() {}
}
headerToClaims(headers)
.onComplete {
case Failure(error: StatusRuntimeException) =>
closeWithError(error)
case Failure(exception: Throwable) =>
val error = AuthorizationChecksErrors.InternalAuthorizationError
.Reject(
message = "Failed to get claims from request metadata",
throwable = exception,
)
.asGrpcError
closeWithError(error)
case Success(claimSet) =>
val nextCtx = prevCtx.withValue(AuthorizationInterceptor.contextKeyClaimSet, claimSet)
// Contexts.interceptCall() creates a listener that wraps all methods of `nextListener`
// such that `Context.current` returns `nextCtx`.
val nextListenerWithContext =
Contexts.interceptCall(nextCtx, call, headers, nextListener)
setNextListener(nextListenerWithContext)
nextListenerWithContext
}
}
}
def headerToClaims(
headers: Metadata
)(implicit loggingContextWithTrace: LoggingContextWithTrace): Future[ClaimSet] =
authService
.decodeMetadata(headers)
.asScala
}
object AuthorizationInterceptor {
val contextKeyClaimSet: Context.Key[ClaimSet] = Context.key[ClaimSet]("AuthServiceDecodedClaim")
def extractClaimSetFromContext(): Try[ClaimSet] = {
val claimSet = AuthorizationInterceptor.contextKeyClaimSet.get()
if (claimSet == null)
Failure(
new RuntimeException(
"Thread local context unexpectedly does not store authorization claims. Perhaps a Future was used in some intermediate computation and changed the executing thread?"
)
)
else
Success(claimSet)
}
}

View File

@ -1,42 +1,30 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.ledger.api.auth
package com.digitalasset.canton.auth
import com.daml.jwt.JwtTimestampLeeway
import com.daml.ledger.api.v2.transaction_filter.Filters
import com.daml.tracing.Telemetry
import com.digitalasset.canton.ledger.api.auth.interceptor.AuthorizationInterceptor
import com.digitalasset.canton.ledger.api.domain.IdentityProviderId
import com.digitalasset.canton.ledger.api.validation.ValidationErrors
import com.digitalasset.canton.ledger.error.groups.{
AuthorizationChecksErrors,
RequestValidationErrors,
}
import com.digitalasset.canton.ledger.localstore.api.UserManagementStore
import com.digitalasset.canton.LfLedgerString
import com.digitalasset.canton.logging.{NamedLoggerFactory, NamedLogging}
import com.digitalasset.canton.tracing.{TelemetryTracing, TraceContext}
import com.digitalasset.canton.tracing.TelemetryTracing
import io.grpc.StatusRuntimeException
import io.grpc.stub.{ServerCallStreamObserver, StreamObserver}
import org.apache.pekko.actor.Scheduler
import scalapb.lenses.Lens
import java.time.{Duration, Instant}
import scala.concurrent.{ExecutionContext, Future}
import java.time.Instant
import scala.concurrent.Future
import scala.util.{Failure, Success, Try}
/** A simple helper that allows services to use authorization claims
* that have been stored by [[com.digitalasset.canton.ledger.api.auth.interceptor.AuthorizationInterceptor]].
* that have been stored by [[AuthorizationInterceptor]].
*/
final class Authorizer(
now: () => Instant,
participantId: String,
userManagementStore: UserManagementStore,
ec: ExecutionContext,
userRightsCheckIntervalInSeconds: Int,
pekkoScheduler: Scheduler,
ongoingAuthorizationFactory: OngoingAuthorizationFactory = NoOpOngoingAuthorizationFactory(),
jwtTimestampLeeway: Option[JwtTimestampLeeway] = None,
tokenExpiryGracePeriodForStreams: Option[Duration] = None,
protected val telemetry: Telemetry,
val loggerFactory: NamedLoggerFactory,
) extends NamedLogging
@ -57,18 +45,6 @@ final class Authorizer(
()
}
def requirePublicClaimsOnStream[Req, Res](
call: (Req, StreamObserver[Res]) => Unit
): (Req, StreamObserver[Res]) => Unit =
authorize(call) { claims =>
for {
_ <- valid(claims)
_ <- claims.isPublic
} yield {
()
}
}
def requirePublicClaims[Req, Res](call: Req => Future[Res]): Req => Future[Res] =
authorize(call) { (claims, req) =>
for {
@ -101,7 +77,7 @@ final class Authorizer(
_ <- valid(claims)
_ <- if (mustBeParticipantAdmin) claims.isAdmin else claims.isAdminOrIDPAdmin
modifiedRequest = implyIdentityProviderIdFromClaims(identityProviderIdL, claims, req)
requestIdentityProviderId <- requireIdentityProviderId(
requestIdentityProviderId <- sanitizeIdentityProviderId(
identityProviderIdL.get(modifiedRequest)
)
_ <- validateRequestIdentityProviderId(requestIdentityProviderId, claims)
@ -114,7 +90,7 @@ final class Authorizer(
req: Req,
): Req =
if (identityProviderIdL.get(req) == "" && !claims.claims.contains(ClaimAdmin)) {
val impliedIdpId = identityProviderIdFromClaims.fold("")(_.toRequestString)
val impliedIdpId = identityProviderIdFromClaims.getOrElse(ClaimSet.DefaultIdentityProviderId)
identityProviderIdL.set(impliedIdpId)(req)
} else req
@ -126,7 +102,7 @@ final class Authorizer(
for {
_ <- valid(claims)
modifiedRequest = implyIdentityProviderIdFromClaims(identityProviderIdL, claims, req)
requestIdentityProviderId <- requireIdentityProviderId(
requestIdentityProviderId <- sanitizeIdentityProviderId(
identityProviderIdL.get(modifiedRequest)
)
_ <- validateRequestIdentityProviderId(requestIdentityProviderId, claims)
@ -143,21 +119,26 @@ final class Authorizer(
} yield req
}
private def requireIdentityProviderId(
private def sanitizeIdentityProviderId(
identityProviderId: String
): Either[AuthorizationError, IdentityProviderId] =
IdentityProviderId.fromString(identityProviderId).left.map { reason =>
): Either[AuthorizationError, Option[LfLedgerString]] =
(Some(identityProviderId).filter(_.nonEmpty) match {
case Some(id) => LfLedgerString.fromString(id).map(Some(_))
case None => Right(None)
}).left.map { reason =>
AuthorizationError.InvalidField("identity_provider_id", reason)
}
private def validateRequestIdentityProviderId(
requestIdentityProviderId: IdentityProviderId,
requestIdentityProviderId: Option[LfLedgerString],
claims: ClaimSet.Claims,
): Either[AuthorizationError, Unit] = claims.identityProviderId match {
case id: IdentityProviderId.Id if requestIdentityProviderId != id =>
case Some(_) if requestIdentityProviderId != claims.identityProviderId =>
// Claim is valid only for the specific Identity Provider,
// and identity_provider_id in the request matches the one provided in the claim.
Left(AuthorizationError.InvalidIdentityProviderId(requestIdentityProviderId))
Left(
AuthorizationError.InvalidIdentityProviderId(requestIdentityProviderId.getOrElse("<empty>"))
)
case _ =>
Right(())
}
@ -257,8 +238,8 @@ final class Authorizer(
call,
)
def identityProviderIdFromClaims: Option[IdentityProviderId] =
authenticatedClaimsFromContext().map(_.identityProviderId).toOption
def identityProviderIdFromClaims: Option[LfLedgerString] =
authenticatedClaimsFromContext().toOption.flatMap(_.identityProviderId)
def authenticatedUserId(): Try[Option[String]] =
authenticatedClaimsFromContext()
@ -292,9 +273,11 @@ final class Authorizer(
case Some(applicationId) if applicationId.nonEmpty => Right(applicationId)
case _ =>
Left(
ValidationErrors.invalidArgument(
"Cannot default application_id field because claims do not specify an application-id or user-id. Is authentication turned on?"
)
AuthorizationChecksErrors.InvalidToken
.MissingUserId(
"Cannot default application_id field because claims do not specify an application-id or user-id. Is authentication turned on?"
)
.asGrpcError
)
}
else Right(reqApplicationId)
@ -306,8 +289,8 @@ final class Authorizer(
{
case AuthorizationError.InvalidField(fieldName, reason) =>
Left(
RequestValidationErrors.InvalidField
.Reject(fieldName = fieldName, message = reason)
AuthorizationChecksErrors.InvalidToken
.InvalidField(fieldName = fieldName, message = reason)
.asGrpcError
)
case err =>
@ -329,21 +312,6 @@ final class Authorizer(
)
}
private def ongoingAuthorization[Res](
observer: ServerCallStreamObserver[Res],
claims: ClaimSet.Claims,
) = OngoingAuthorizationObserver[Res](
observer = observer,
originalClaims = claims,
nowF = now,
userManagementStore = userManagementStore,
userRightsCheckIntervalInSeconds = userRightsCheckIntervalInSeconds,
pekkoScheduler = pekkoScheduler,
jwtTimestampLeeway = jwtTimestampLeeway,
tokenExpiryGracePeriodForStreams = tokenExpiryGracePeriodForStreams,
loggerFactory = loggerFactory,
)(ec, TraceContext.empty)
/** Directly access the authenticated claims from the thread-local context.
*
* Prefer to use the more specialized methods of [[Authorizer]] instead of this
@ -388,7 +356,7 @@ final class Authorizer(
call(
modifiedRequest,
if (claims.expiration.isDefined || claims.resolvedFromUser)
ongoingAuthorization(serverCallStreamObserver, claims)
ongoingAuthorizationFactory(serverCallStreamObserver, claims)
else
serverCallStreamObserver,
)

View File

@ -1,10 +1,10 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.ledger.api.auth
package com.digitalasset.canton.auth
import com.daml.jwt.JwtTimestampLeeway
import com.digitalasset.canton.ledger.api.domain.IdentityProviderId
import com.digitalasset.canton.LfLedgerString
import com.digitalasset.daml.lf.data.Ref
import java.time.{Duration, Instant}
@ -57,11 +57,14 @@ final case class ClaimReadAsParty(name: Ref.Party) extends Claim
*
* Does NOT authorize to issue commands.
*/
final case object ClaimReadAsAnyParty extends Claim
case object ClaimReadAsAnyParty extends Claim
sealed trait ClaimSet
object ClaimSet {
val DefaultIdentityProviderId: String = ""
object Unauthenticated extends ClaimSet
/** [[Claims]] define what actions an authenticated user can perform on the Ledger API.
@ -78,14 +81,13 @@ object ClaimSet {
* @param expiration If set, the claims will cease to be valid at the given time.
* @param resolvedFromUser If set, then the claims were resolved from a user in the user management service.
* @param identityProviderId If set, the claims will only be valid on the given Identity Provider configuration.
* @param audience Claims which identifies the intended recipients.
*/
final case class Claims(
claims: Seq[Claim],
participantId: Option[String],
applicationId: Option[String],
expiration: Option[Instant],
identityProviderId: IdentityProviderId,
identityProviderId: Option[LfLedgerString],
resolvedFromUser: Boolean,
) extends ClaimSet {
@ -179,7 +181,7 @@ object ClaimSet {
/** The representation of a user that was authenticated, but whose [[Claims]] have not yet been resolved. */
final case class AuthenticatedUser(
identityProviderId: IdentityProviderId,
identityProviderId: Option[LfLedgerString],
userId: String,
participantId: Option[String],
expiration: Option[Instant],
@ -194,7 +196,7 @@ object ClaimSet {
applicationId = None,
expiration = None,
resolvedFromUser = false,
identityProviderId = IdentityProviderId.Default,
identityProviderId = None,
)
/** A set of [[Claims]] that has all possible authorizations */

View File

@ -0,0 +1,20 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.canton.auth
import io.grpc.stub.ServerCallStreamObserver
trait OngoingAuthorizationFactory {
def apply[A](
observer: ServerCallStreamObserver[A],
claims: ClaimSet.Claims,
): ServerCallStreamObserver[A]
}
final case class NoOpOngoingAuthorizationFactory() extends OngoingAuthorizationFactory {
def apply[A](
observer: ServerCallStreamObserver[A],
claims: ClaimSet.Claims,
): ServerCallStreamObserver[A] = observer
}

View File

@ -129,7 +129,7 @@ object CryptoKeyPair extends HasVersionedMessageCompanion[CryptoKeyPair[PublicKe
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.CryptoKeyPair)(fromProtoCryptoKeyPairV30),
_.toProtoCryptoKeyPairV30.toByteString,
)
@ -233,7 +233,7 @@ object PublicKeyWithName extends HasVersionedMessageCompanion[PublicKeyWithName]
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.PublicKeyWithName)(fromProto30),
_.toProtoV30.toByteString,
)

View File

@ -517,7 +517,7 @@ object SymmetricKey extends HasVersionedMessageCompanion[SymmetricKey] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.SymmetricKey)(fromProtoV30),
_.toProtoV30.toByteString,
)
@ -621,7 +621,7 @@ object EncryptionPublicKey
override def name: String = "encryption public key"
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.EncryptionPublicKey)(fromProtoV30),
_.toProtoV30.toByteString,
)
@ -709,7 +709,7 @@ final case class EncryptionPrivateKey private[crypto] (
object EncryptionPrivateKey extends HasVersionedMessageCompanion[EncryptionPrivateKey] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.EncryptionPrivateKey)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -47,7 +47,7 @@ object PasswordBasedEncrypted extends HasVersionedMessageCompanion[PasswordBased
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.PasswordBasedEncrypted)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -163,7 +163,7 @@ object Signature
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.Signature)(fromProtoV30),
_.toProtoV30.toByteString,
)
@ -351,7 +351,7 @@ object SigningPublicKey
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.SigningPublicKey)(fromProtoV30),
_.toProtoV30.toByteString,
)
@ -434,7 +434,7 @@ final case class SigningPrivateKey private[crypto] (
object SigningPrivateKey extends HasVersionedMessageCompanion[SigningPrivateKey] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.SigningPrivateKey)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -64,7 +64,7 @@ object ActionDescription extends HasProtocolVersionedCompanion[ActionDescription
override lazy val name: String = "ActionDescription"
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.ActionDescription)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.ActionDescription)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -63,7 +63,7 @@ object CommonMetadata
override val name: String = "CommonMetadata"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.CommonMetadata)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.CommonMetadata)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -68,7 +68,7 @@ object FullInformeeTree
override val name: String = "FullInformeeTree"
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.FullInformeeTree)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.FullInformeeTree)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -94,7 +94,7 @@ object LightTransactionViewTree
override val name: String = "LightTransactionViewTree"
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.LightTransactionViewTree)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.LightTransactionViewTree)(
supportedProtoVersion(_)((context, proto) => fromProtoV30(context)(proto)),
_.toProtoV30.toByteString,
)

View File

@ -160,7 +160,7 @@ object MerkleSeq
override def supportedProtoVersions: SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.MerkleSeq)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.MerkleSeq)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)
@ -406,7 +406,7 @@ object MerkleSeq
override def supportedProtoVersions: SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.MerkleSeqElement)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.MerkleSeqElement)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -62,7 +62,7 @@ object ParticipantMetadata
override val name: String = "ParticipantMetadata"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.ParticipantMetadata)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.ParticipantMetadata)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -77,7 +77,7 @@ object SubmitterMetadata
override val name: String = "SubmitterMetadata"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.SubmitterMetadata)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.SubmitterMetadata)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -299,7 +299,7 @@ object TransactionView
override def name: String = "TransactionView"
override def supportedProtoVersions: SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.ViewNode)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.ViewNode)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -94,7 +94,7 @@ object TransferInViewTree
override val name: String = "TransferInViewTree"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TransferViewTree)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TransferViewTree)(
supportedProtoVersion(_)((context, proto) => fromProtoV30(context)(proto)),
_.toProtoV30.toByteString,
)
@ -199,7 +199,7 @@ object TransferInCommonData
override val name: String = "TransferInCommonData"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TransferInCommonData)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TransferInCommonData)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)
@ -321,7 +321,7 @@ object TransferInView
override val name: String = "TransferInView"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TransferInView)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TransferInView)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -85,7 +85,7 @@ object TransferOutViewTree
override val name: String = "TransferOutViewTree"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TransferViewTree)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TransferViewTree)(
supportedProtoVersion(_)((context, proto) => fromProtoV30(context)(proto)),
_.toProtoV30.toByteString,
)
@ -196,7 +196,7 @@ object TransferOutCommonData
override val name: String = "TransferOutCommonData"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TransferOutCommonData)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TransferOutCommonData)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)
@ -331,7 +331,7 @@ object TransferOutView
override val name: String = "TransferOutView"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TransferOutView)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TransferOutView)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -99,7 +99,7 @@ object ViewCommonData
override val name: String = "ViewCommonData"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.ViewCommonData)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.ViewCommonData)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -333,7 +333,7 @@ object ViewParticipantData
override val name: String = "ViewParticipantData"
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.ViewParticipantData)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.ViewParticipantData)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -27,6 +27,8 @@ object CantonErrorGroups {
abstract class TrafficControlErrorGroup extends ErrorGroup()
abstract class AuthorizationChecksErrorGroup extends ErrorGroup()
object ParticipantErrorGroup extends ErrorGroup() {
abstract class DomainConnectivityErrorGroup extends ErrorGroup()

View File

@ -18,7 +18,7 @@ object CantonContractIdVersion {
def fromProtocolVersion(
protocolVersion: ProtocolVersion
): Either[String, CantonContractIdVersion] =
if (protocolVersion >= ProtocolVersion.v31) Right(AuthenticatedContractIdVersionV10)
if (protocolVersion >= ProtocolVersion.v32) Right(AuthenticatedContractIdVersionV10)
else Left(s"No contract ID scheme found for ${protocolVersion.v}")
def ensureCantonContractId(

View File

@ -76,7 +76,7 @@ object ContractMetadata
with HasVersionedMessageCompanionDbHelpers[ContractMetadata] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.SerializableContract.Metadata)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -102,7 +102,7 @@ object StaticDomainParameters
val supportedProtoVersions: protocol.StaticDomainParameters.SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.StaticDomainParameters
)(
supportedProtoVersion(_)(fromProtoV30),
@ -457,7 +457,7 @@ object DynamicDomainParameters extends HasProtocolVersionedCompanion[DynamicDoma
val supportedProtoVersions: canton.protocol.DynamicDomainParameters.SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.DynamicDomainParameters
)(
supportedProtoVersion(_)(fromProtoV30),

View File

@ -38,7 +38,7 @@ object DriverContractMetadata extends HasVersionedMessageCompanion[DriverContrac
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.DriverContractMetadata)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -54,7 +54,7 @@ object DynamicSequencingParameters
override val supportedProtoVersions
: canton.protocol.DynamicSequencingParameters.SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.DynamicSequencingParameters
)(
supportedProtoVersion(_)(fromProtoV30),

View File

@ -105,7 +105,7 @@ object SerializableContract
with HasVersionedMessageCompanionDbHelpers[SerializableContract] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(protocol.v30.SerializableContract)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -156,7 +156,7 @@ object AcsCommitment extends HasMemoizedProtocolVersionedWrapperCompanion[AcsCom
override val name: String = "AcsCommitment"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.AcsCommitment)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.AcsCommitment)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -144,7 +144,7 @@ object ConfirmationResponse
override val name: String = "ConfirmationResponse"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.ConfirmationResponse)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.ConfirmationResponse)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -99,7 +99,7 @@ object ConfirmationResultMessage
override val name: String = "ConfirmationResultMessage"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.ConfirmationResultMessage
)(
supportedProtoVersionMemoized(_)(fromProtoV30),

View File

@ -287,7 +287,7 @@ final case class EncryptedViewMessage[+VT <: ViewType](
object EncryptedViewMessage extends HasProtocolVersionedCompanion[EncryptedViewMessage[ViewType]] {
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.EncryptedViewMessage)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.EncryptedViewMessage)(
supportedProtoVersion(_)(EncryptedViewMessage.fromProto),
_.toByteString,
)

View File

@ -28,7 +28,7 @@ object EnvelopeContent
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(
ProtocolVersion.v31
ProtocolVersion.v32
)(v30.EnvelopeContent)(
supportedProtoVersion(_)(fromProtoV30),
_.toByteStringUnversioned,

View File

@ -91,7 +91,7 @@ object InformeeMessage
extends HasProtocolVersionedWithContextCompanion[InformeeMessage, (HashOps, ProtocolVersion)] {
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.InformeeMessage)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.InformeeMessage)(
supportedProtoVersion(_)((hashOps, proto) => fromProtoV30(hashOps)(proto)),
_.toProtoV30.toByteString,
)

View File

@ -46,7 +46,7 @@ object LocalVerdict extends HasProtocolVersionedCompanion[LocalVerdict] {
override def supportedProtoVersions: messages.LocalVerdict.SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.LocalVerdict)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.LocalVerdict)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -94,7 +94,7 @@ object RootHashMessage
], ByteString => ParsingResult[RootHashMessagePayload]] {
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.RootHashMessage)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.RootHashMessage)(
supportedProtoVersion(_)((deserializer, proto) => fromProtoV30(deserializer)(proto)),
_.toProtoV30.toByteString,
)

View File

@ -68,7 +68,7 @@ object SetTrafficPurchasedMessage
override val name: String = "SetTrafficPurchasedMessage"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(1) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(1) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.SetTrafficPurchasedMessage
)(
supportedProtoVersionMemoized(_)(fromProtoV30),

View File

@ -120,7 +120,7 @@ object SignedProtocolMessage
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(
ProtocolVersion.v31
ProtocolVersion.v32
)(v30.SignedProtocolMessage)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,

View File

@ -70,7 +70,7 @@ object TopologyTransactionsBroadcast
}
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.TopologyTransactionsBroadcast
)(
supportedProtoVersion(_)(fromProtoV30),

View File

@ -99,7 +99,7 @@ object TransferInMediatorMessage
] {
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TransferInMediatorMessage)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TransferInMediatorMessage)(
supportedProtoVersion(_)((context, proto) => fromProtoV30(context)(proto)),
_.toProtoV30.toByteString,
)

View File

@ -98,7 +98,7 @@ object TransferOutMediatorMessage
] {
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.TransferOutMediatorMessage
)(
supportedProtoVersion(_)((context, proto) => fromProtoV30(context)(proto)),

View File

@ -64,7 +64,7 @@ object TypedSignedProtocolMessageContent
override def supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(
ProtocolVersion.v31
ProtocolVersion.v32
)(v30.TypedSignedProtocolMessageContent)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,

View File

@ -50,7 +50,7 @@ object Verdict
val supportedProtoVersions: protocol.messages.Verdict.SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.Verdict)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.Verdict)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -209,7 +209,7 @@ object SequencerConnections
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.SequencerConnections)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -45,7 +45,7 @@ object AcknowledgeRequest extends HasMemoizedProtocolVersionedWrapperCompanion[A
override def supportedProtoVersions: SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.AcknowledgeRequest)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.AcknowledgeRequest)(
supportedProtoVersionMemoized(_) { req => bytes =>
fromProtoV30(req)(Some(bytes))
},

View File

@ -72,7 +72,7 @@ object AggregationRule
override def name: String = "AggregationRule"
override def supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.AggregationRule)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.AggregationRule)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -85,7 +85,7 @@ object Batch extends HasProtocolVersionedCompanion2[Batch[Envelope[?]], Batch[Cl
override val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(
ProtocolVersion.v31
ProtocolVersion.v32
)(v30.CompressedBatch)(
supportedProtoVersion(_)(
// TODO(i10428) Prevent zip bombing when decompressing the request

View File

@ -128,7 +128,7 @@ object ClosedEnvelope extends HasProtocolVersionedCompanion[ClosedEnvelope] {
override def supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(
ProtocolVersion.v31
ProtocolVersion.v32
)(v30.Envelope)(
protoCompanion =>
ProtoConverter.protoParser(protoCompanion.parseFrom)(_).flatMap(fromProtoV30),

View File

@ -34,7 +34,7 @@ object GetTrafficStateForMemberRequest
override val name: String = "GetTrafficStateForMemberRequest"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.GetTrafficStateForMemberRequest
)(
supportedProtoVersion(_)(fromProtoV30),

View File

@ -30,7 +30,7 @@ object GetTrafficStateForMemberResponse
override val name: String = "GetTrafficStateForMemberResponse"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.GetTrafficStateForMemberResponse
)(
supportedProtoVersion(_)(fromProtoV30),

View File

@ -78,7 +78,7 @@ object SequencedEvent
override def name: String = "SequencedEvent"
override val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.SequencedEvent)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.SequencedEvent)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -51,7 +51,7 @@ object SequencingSubmissionCost
override def name: String = "SequencingSubmissionCost"
override def supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.SequencingSubmissionCost)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.SequencingSubmissionCost)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -110,7 +110,7 @@ object SignedContent
override def name: String = "SignedContent"
override def supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.SignedContent)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.SignedContent)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -172,7 +172,7 @@ object SubmissionRequest
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(
ProtocolVersion.v31
ProtocolVersion.v32
)(v30.SubmissionRequest)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,

View File

@ -37,7 +37,7 @@ object SubscriptionRequest extends HasProtocolVersionedCompanion[SubscriptionReq
override val name: String = "SubscriptionRequest"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.SubscriptionRequest)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.SubscriptionRequest)(
supportedProtoVersion(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -30,7 +30,7 @@ object TopologyStateForInitRequest
override val name: String = "TopologyStateForInitRequest"
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.DownloadTopologyStateForInitRequest
)(
supportedProtoVersion(_)(fromProtoV30),

View File

@ -74,7 +74,7 @@ class EventCostCalculator(override val loggerFactory: NamedLoggerFactory) extend
)(implicit traceContext: TraceContext): EventCostDetails =
// If changing the cost computation, make sure to tie it to a protocol version
// For now there's only one version of cost computation
if (protocolVersion >= ProtocolVersion.v31) {
if (protocolVersion >= ProtocolVersion.v32) {
val envelopeCosts = event.envelopes.map(computeEnvelopeCost(costMultiplier, groupToMembers))
val eventCost = NonNegativeLong.tryCreate(envelopeCosts.map(_.finalCost).sum)
EventCostDetails(

View File

@ -130,7 +130,7 @@ object StoredTopologyTransactions
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.TopologyTransactions)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -138,7 +138,7 @@ object SignedTopologyTransaction
SignedTopologyTransaction[TopologyChangeOp.Replace, TopologyMapping]
val supportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(
v30.SignedTopologyTransaction
)(
supportedProtoVersion(_)(fromProtoV30),

View File

@ -189,7 +189,7 @@ object TopologyTransaction
val supportedProtoVersions: transaction.TopologyTransaction.SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v31)(v30.TopologyTransaction)(
ProtoVersion(30) -> VersionedProtoConverter(ProtocolVersion.v32)(v30.TopologyTransaction)(
supportedProtoVersionMemoized(_)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -47,7 +47,7 @@ object SerializableTraceContext
with HasVersionedMessageCompanionDbHelpers[SerializableTraceContext] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.TraceContext)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -232,10 +232,11 @@ object ProtocolVersion {
ProtocolVersion(5),
ProtocolVersion(6),
ProtocolVersion(30),
ProtocolVersion(31),
)
val alpha: NonEmpty[List[ProtocolVersionWithStatus[ProtocolVersionAnnotation.Alpha]]] =
NonEmpty.mk(List, ProtocolVersion.v31, ProtocolVersion.dev)
NonEmpty.mk(List, ProtocolVersion.v32, ProtocolVersion.dev)
val beta: List[ProtocolVersionWithStatus[ProtocolVersionAnnotation.Beta]] =
parseFromBuildInfo(BuildInfo.betaProtocolVersions.toSeq)
@ -257,11 +258,11 @@ object ProtocolVersion {
lazy val dev: ProtocolVersionWithStatus[ProtocolVersionAnnotation.Alpha] =
ProtocolVersion.createAlpha(Int.MaxValue)
lazy val v31: ProtocolVersionWithStatus[ProtocolVersionAnnotation.Alpha] =
ProtocolVersion.createAlpha(31)
lazy val v32: ProtocolVersionWithStatus[ProtocolVersionAnnotation.Alpha] =
ProtocolVersion.createAlpha(32)
// Minimum stable protocol version introduced
lazy val minimum: ProtocolVersion = v31
lazy val minimum: ProtocolVersion = v32
private def parseFromBuildInfo(pv: Seq[String]): List[ProtocolVersion] =
pv.map(parseUnchecked)

View File

@ -34,6 +34,10 @@ public final class Completion {
// model trace-context with its own class
private final TraceContextOuterClass.@NonNull TraceContext traceContext;
private final @NonNull String offset;
private final @NonNull DomainTime domainTime;
private Completion(
@NonNull String commandId,
@NonNull Status status,
@ -43,7 +47,9 @@ public final class Completion {
@NonNull String submissionId,
@NonNull Optional<String> deduplicationOffset,
@NonNull Optional<Duration> deduplicationDuration,
TraceContextOuterClass.@NonNull TraceContext traceContext) {
TraceContextOuterClass.@NonNull TraceContext traceContext,
@NonNull String offset,
@NonNull DomainTime domainTime) {
this.commandId = commandId;
this.status = status;
this.updateId = updateId;
@ -53,6 +59,8 @@ public final class Completion {
this.deduplicationOffset = deduplicationOffset;
this.deduplicationDuration = deduplicationDuration;
this.traceContext = traceContext;
this.offset = offset;
this.domainTime = domainTime;
}
public Completion(
@ -63,7 +71,9 @@ public final class Completion {
@NonNull List<@NonNull String> actAs,
@NonNull String submissionId,
@NonNull String deduplicationOffset,
TraceContextOuterClass.TraceContext traceContext) {
TraceContextOuterClass.TraceContext traceContext,
@NonNull String offset,
@NonNull DomainTime domainTime) {
this(
commandId,
status,
@ -73,7 +83,9 @@ public final class Completion {
submissionId,
Optional.of(deduplicationOffset),
Optional.empty(),
traceContext);
traceContext,
offset,
domainTime);
}
public Completion(
@ -84,7 +96,9 @@ public final class Completion {
@NonNull List<@NonNull String> actAs,
@NonNull String submissionId,
@NonNull Duration deduplicationDuration,
TraceContextOuterClass.TraceContext traceContext) {
TraceContextOuterClass.TraceContext traceContext,
@NonNull String offset,
@NonNull DomainTime domainTime) {
this(
commandId,
status,
@ -94,7 +108,9 @@ public final class Completion {
submissionId,
Optional.empty(),
Optional.of(deduplicationDuration),
traceContext);
traceContext,
offset,
domainTime);
}
@NonNull
@ -141,6 +157,16 @@ public final class Completion {
return traceContext;
}
@NonNull
public String getOffset() {
return offset;
}
@NonNull
public DomainTime getDomainTime() {
return domainTime;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -154,7 +180,9 @@ public final class Completion {
&& Objects.equals(submissionId, that.submissionId)
&& Objects.equals(deduplicationOffset, that.deduplicationOffset)
&& Objects.equals(deduplicationDuration, that.deduplicationDuration)
&& Objects.equals(traceContext, that.traceContext);
&& Objects.equals(traceContext, that.traceContext)
&& Objects.equals(offset, that.offset)
&& Objects.equals(domainTime, that.domainTime);
}
@Override
@ -168,7 +196,9 @@ public final class Completion {
submissionId,
deduplicationOffset,
deduplicationDuration,
traceContext);
traceContext,
offset,
domainTime);
}
@Override
@ -194,6 +224,11 @@ public final class Completion {
+ deduplicationDuration
+ ", traceContext="
+ traceContext
+ ", offset='"
+ offset
+ ", domainTime="
+ domainTime
+ '\''
+ '}';
}
@ -206,7 +241,9 @@ public final class Completion {
.setApplicationId(applicationId)
.addAllActAs(actAs)
.setSubmissionId(submissionId)
.setTraceContext(traceContext);
.setTraceContext(traceContext)
.setOffset(offset)
.setDomainTime(domainTime.toProto());
deduplicationOffset.ifPresent(builder::setDeduplicationOffset);
deduplicationDuration.ifPresent(
duration -> builder.setDeduplicationDuration(Utils.durationToProto(duration)));
@ -227,6 +264,8 @@ public final class Completion {
completion.hasDeduplicationDuration()
? Optional.of(Utils.durationFromProto(completion.getDeduplicationDuration()))
: Optional.empty(),
completion.getTraceContext());
completion.getTraceContext(),
completion.getOffset(),
DomainTime.fromProto(completion.getDomainTime()));
}
}

View File

@ -7,63 +7,64 @@ import com.daml.ledger.api.v2.CommandCompletionServiceOuterClass;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.Optional;
public final class CompletionStreamResponse {
@NonNull private final Checkpoint checkpoint;
@NonNull private final Optional<Completion> completion;
@NonNull private final Completion completion;
@NonNull private final String domainId;
@NonNull private final Optional<OffsetCheckpoint> offsetCheckpoint;
public CompletionStreamResponse(
@NonNull Checkpoint checkpoint, @NonNull Completion completion, @NonNull String domainId) {
this.checkpoint = checkpoint;
@NonNull Optional<Completion> completion,
@NonNull Optional<OffsetCheckpoint> offsetCheckpoint) {
this.completion = completion;
this.domainId = domainId;
this.offsetCheckpoint = offsetCheckpoint;
}
public CompletionStreamResponse(@NonNull Completion completion) {
this(Optional.of(completion), Optional.empty());
}
public CompletionStreamResponse(@NonNull OffsetCheckpoint offsetCheckpoint) {
this(Optional.empty(), Optional.of(offsetCheckpoint));
}
@NonNull
public Checkpoint getCheckpoint() {
return checkpoint;
}
@NonNull
public Completion getCompletion() {
public Optional<Completion> getCompletion() {
return completion;
}
@NonNull
public String getDomainId() {
return domainId;
public Optional<OffsetCheckpoint> getOffsetCheckpoint() {
return offsetCheckpoint;
}
public static CompletionStreamResponse fromProto(
CommandCompletionServiceOuterClass.CompletionStreamResponse response) {
return new CompletionStreamResponse(
Checkpoint.fromProto(response.getCheckpoint()),
Completion.fromProto(response.getCompletion()),
response.getDomainId());
response.hasCompletion()
? Optional.of(Completion.fromProto(response.getCompletion()))
: Optional.empty(),
response.hasOffsetCheckpoint()
? Optional.of(OffsetCheckpoint.fromProto(response.getOffsetCheckpoint()))
: Optional.empty());
}
public CommandCompletionServiceOuterClass.CompletionStreamResponse toProto() {
return CommandCompletionServiceOuterClass.CompletionStreamResponse.newBuilder()
.setCheckpoint(checkpoint.toProto())
.setCompletion(completion.toProto())
.setDomainId(domainId)
.build();
var builder = CommandCompletionServiceOuterClass.CompletionStreamResponse.newBuilder();
completion.ifPresent(c -> builder.setCompletion(c.toProto()));
offsetCheckpoint.ifPresent(c -> builder.setOffsetCheckpoint(c.toProto()));
return builder.build();
}
@Override
public String toString() {
return "CompletionStreamResponse{"
+ "checkpoint="
+ checkpoint
+ ", completion="
+ "completion="
+ completion
+ ", domainId='"
+ domainId
+ '\''
+ ", offsetCheckpoint="
+ offsetCheckpoint
+ '}';
}
@ -72,14 +73,13 @@ public final class CompletionStreamResponse {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CompletionStreamResponse that = (CompletionStreamResponse) o;
return Objects.equals(checkpoint, that.checkpoint)
&& Objects.equals(completion, that.completion)
&& Objects.equals(domainId, that.domainId);
return Objects.equals(completion, that.completion)
&& Objects.equals(offsetCheckpoint, that.offsetCheckpoint);
}
@Override
public int hashCode() {
return Objects.hash(checkpoint, completion, domainId);
return Objects.hash(completion, offsetCheckpoint);
}
}

View File

@ -3,67 +3,67 @@
package com.daml.ledger.javaapi.data;
import com.daml.ledger.api.v2.CheckpointOuterClass;
import com.daml.ledger.api.v2.OffsetCheckpointOuterClass;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.time.Instant;
import java.util.Objects;
public final class Checkpoint {
public final class DomainTime {
private final String domainId;
private final Instant recordTime;
private final String offset;
public Checkpoint(@NonNull Instant recordTime, @NonNull String offset) {
public DomainTime(@NonNull String domainId, @NonNull Instant recordTime) {
this.domainId = domainId;
this.recordTime = recordTime;
this.offset = offset;
}
public static Checkpoint fromProto(CheckpointOuterClass.Checkpoint checkpoint) {
public static DomainTime fromProto(OffsetCheckpointOuterClass.DomainTime domainTime) {
return new Checkpoint(
return new DomainTime(
domainTime.getDomainId(),
Instant.ofEpochSecond(
checkpoint.getRecordTime().getSeconds(), checkpoint.getRecordTime().getNanos()),
checkpoint.getOffset());
domainTime.getRecordTime().getSeconds(), domainTime.getRecordTime().getNanos()));
}
public CheckpointOuterClass.Checkpoint toProto() {
return CheckpointOuterClass.Checkpoint.newBuilder()
public OffsetCheckpointOuterClass.DomainTime toProto() {
return OffsetCheckpointOuterClass.DomainTime.newBuilder()
.setDomainId(this.domainId)
.setRecordTime(
com.google.protobuf.Timestamp.newBuilder()
.setSeconds(this.recordTime.getEpochSecond())
.setNanos(this.recordTime.getNano())
.build())
.setOffset(this.offset)
.build();
}
@NonNull
public String getDomainId() {
return domainId;
}
public @NonNull Instant getRecordTime() {
return recordTime;
}
@NonNull
public String getOffset() {
return offset;
}
@Override
public String toString() {
return "Checkpoint{" + "recordTime=" + recordTime + ", offset=" + offset + '}';
return "DomainTime{" + "domainId=" + domainId + ", recordTime=" + recordTime + '}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Checkpoint that = (Checkpoint) o;
return Objects.equals(recordTime, that.recordTime) && Objects.equals(offset, that.offset);
DomainTime that = (DomainTime) o;
return Objects.equals(domainId, that.domainId) && Objects.equals(recordTime, that.recordTime);
}
@Override
public int hashCode() {
return Objects.hash(recordTime, offset);
return Objects.hash(domainId, recordTime);
}
}

View File

@ -15,18 +15,27 @@ public final class GetUpdatesResponse {
@NonNull private final Optional<Reassignment> reassignment;
@NonNull private final Optional<OffsetCheckpoint> offsetCheckpoint;
private GetUpdatesResponse(
@NonNull Optional<Transaction> transaction, @NonNull Optional<Reassignment> reassignment) {
@NonNull Optional<Transaction> transaction,
@NonNull Optional<Reassignment> reassignment,
@NonNull Optional<OffsetCheckpoint> offsetCheckpoint) {
this.transaction = transaction;
this.reassignment = reassignment;
this.offsetCheckpoint = offsetCheckpoint;
}
public GetUpdatesResponse(@NonNull Transaction transaction) {
this(Optional.of(transaction), Optional.empty());
this(Optional.of(transaction), Optional.empty(), Optional.empty());
}
public GetUpdatesResponse(@NonNull Reassignment reassignment) {
this(Optional.empty(), Optional.of(reassignment));
this(Optional.empty(), Optional.of(reassignment), Optional.empty());
}
public GetUpdatesResponse(@NonNull OffsetCheckpoint offsetCheckpoint) {
this(Optional.empty(), Optional.empty(), Optional.of(offsetCheckpoint));
}
public Optional<Transaction> getTransaction() {
@ -38,6 +47,11 @@ public final class GetUpdatesResponse {
return reassignment;
}
@NonNull
public Optional<OffsetCheckpoint> getOffsetCheckpoint() {
return offsetCheckpoint;
}
public static GetUpdatesResponse fromProto(UpdateServiceOuterClass.GetUpdatesResponse response) {
return new GetUpdatesResponse(
response.hasTransaction()
@ -45,6 +59,9 @@ public final class GetUpdatesResponse {
: Optional.empty(),
response.hasReassignment()
? Optional.of(Reassignment.fromProto(response.getReassignment()))
: Optional.empty(),
response.hasOffsetCheckpoint()
? Optional.of(OffsetCheckpoint.fromProto(response.getOffsetCheckpoint()))
: Optional.empty());
}
@ -52,6 +69,7 @@ public final class GetUpdatesResponse {
var builder = UpdateServiceOuterClass.GetUpdatesResponse.newBuilder();
transaction.ifPresent(t -> builder.setTransaction(t.toProto()));
reassignment.ifPresent(r -> builder.setReassignment(r.toProto()));
offsetCheckpoint.ifPresent(c -> builder.setOffsetCheckpoint(c.toProto()));
return builder.build();
}
@ -62,6 +80,8 @@ public final class GetUpdatesResponse {
+ transaction
+ ", reassignment="
+ reassignment
+ ", offsetCheckpoint="
+ offsetCheckpoint
+ '}';
}
@ -71,11 +91,12 @@ public final class GetUpdatesResponse {
if (o == null || getClass() != o.getClass()) return false;
GetUpdatesResponse that = (GetUpdatesResponse) o;
return Objects.equals(transaction, that.transaction)
&& Objects.equals(reassignment, that.reassignment);
&& Objects.equals(reassignment, that.reassignment)
&& Objects.equals(offsetCheckpoint, that.offsetCheckpoint);
}
@Override
public int hashCode() {
return Objects.hash(transaction, reassignment);
return Objects.hash(transaction, reassignment, offsetCheckpoint);
}
}

View File

@ -0,0 +1,70 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates.
// Proprietary code. All rights reserved.
package com.daml.ledger.javaapi.data;
import com.daml.ledger.api.v2.OffsetCheckpointOuterClass;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public final class OffsetCheckpoint {
private final String offset;
private final List<DomainTime> domainTimes;
public OffsetCheckpoint(@NonNull String offset, @NonNull List<DomainTime> domainTimes) {
this.offset = offset;
this.domainTimes = domainTimes;
}
public static OffsetCheckpoint fromProto(
OffsetCheckpointOuterClass.OffsetCheckpoint offsetCheckpoint) {
return new OffsetCheckpoint(
offsetCheckpoint.getOffset(),
offsetCheckpoint.getDomainTimesList().stream()
.map(DomainTime::fromProto)
.collect(Collectors.toList()));
}
public OffsetCheckpointOuterClass.OffsetCheckpoint toProto() {
return OffsetCheckpointOuterClass.OffsetCheckpoint.newBuilder()
.setOffset(this.offset)
.addAllDomainTimes(
this.domainTimes.stream().map(DomainTime::toProto).collect(Collectors.toList()))
.build();
}
@NonNull
public String getOffset() {
return offset;
}
@NonNull
public List<@NonNull DomainTime> getDomainTimes() {
return domainTimes;
}
@Override
public String toString() {
return "OffsetCheckpoint{" + "offset=" + offset + ", domainTimes=" + domainTimes + '}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OffsetCheckpoint that = (OffsetCheckpoint) o;
return Objects.equals(offset, that.offset) && Objects.equals(domainTimes, that.domainTimes);
}
@Override
public int hashCode() {
return Objects.hash(offset, domainTimes);
}
}

View File

@ -658,6 +658,8 @@ object Generators {
),
)
traceContext <- Gen.const(Utils.newProtoTraceContext("parent", "state"))
offset <- Arbitrary.arbString.arbitrary
domainTime <- domainTimeGen
} yield Completion
.newBuilder()
.setCommandId(commandId)
@ -668,18 +670,20 @@ object Generators {
.setSubmissionId(submissionId)
.pipe(deduplication)
.setTraceContext(traceContext)
.setOffset(offset)
.setDomainTime(domainTime)
.build()
}
def checkpointGen: Gen[v2.CheckpointOuterClass.Checkpoint] = {
import v2.CheckpointOuterClass.Checkpoint
def domainTimeGen: Gen[v2.OffsetCheckpointOuterClass.DomainTime] = {
import v2.OffsetCheckpointOuterClass.DomainTime
for {
domainId <- Arbitrary.arbString.arbitrary
recordTime <- instantGen
offset <- Arbitrary.arbString.arbitrary
} yield Checkpoint
} yield DomainTime
.newBuilder()
.setDomainId(domainId)
.setRecordTime(Utils.instantToProto(recordTime))
.setOffset(offset)
.build()
}
@ -687,14 +691,15 @@ object Generators {
: Gen[v2.CommandCompletionServiceOuterClass.CompletionStreamResponse] = {
import v2.CommandCompletionServiceOuterClass.CompletionStreamResponse as Response
for {
checkpoint <- checkpointGen
completion <- completionGen
domainId <- Arbitrary.arbString.arbitrary
response <- Gen.oneOf(
completionGen.map(completion => (b: Response.Builder) => b.setCompletion(completion)),
offsetCheckpointGen.map(checkpoint =>
(b: Response.Builder) => b.setOffsetCheckpoint(checkpoint)
),
)
} yield Response
.newBuilder()
.setCheckpoint(checkpoint)
.setCompletion(completion)
.setDomainId(domainId)
.pipe(response)
.build()
}
@ -848,6 +853,18 @@ object Generators {
}
}
def offsetCheckpointGen: Gen[v2.OffsetCheckpointOuterClass.OffsetCheckpoint] = {
import v2.OffsetCheckpointOuterClass.OffsetCheckpoint
for {
offset <- Arbitrary.arbString.arbitrary
domainTimes <- Gen.listOf(domainTimeGen)
} yield OffsetCheckpoint
.newBuilder()
.setOffset(offset)
.addAllDomainTimes(domainTimes.asJava)
.build()
}
def getUpdatesResponseGen: Gen[v2.UpdateServiceOuterClass.GetUpdatesResponse] = {
import v2.UpdateServiceOuterClass.GetUpdatesResponse as Response
for {
@ -856,6 +873,9 @@ object Generators {
reassignmentGen.map(reassingment =>
(b: Response.Builder) => b.setReassignment(reassingment)
),
offsetCheckpointGen.map(checkpoint =>
(b: Response.Builder) => b.setOffsetCheckpoint(checkpoint)
),
)
} yield Response
.newBuilder()
@ -873,6 +893,9 @@ object Generators {
reassignmentGen.map(reassingment =>
(b: Response.Builder) => b.setReassignment(reassingment)
),
offsetCheckpointGen.map(checkpoint =>
(b: Response.Builder) => b.setOffsetCheckpoint(checkpoint)
),
)
} yield Response
.newBuilder()

View File

@ -3,7 +3,7 @@ build-options:
- --target=2.1
name: CantonExamples
source: .
version: 3.1.0
version: 3.2.0
dependencies:
- daml-prim
- daml-stdlib

View File

@ -31,7 +31,7 @@ object StoredParties
with HasVersionedMessageCompanionDbHelpers[StoredParties] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(v30.StoredParties)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -14,7 +14,7 @@ object DamlLfVersionToProtocolVersions {
/** This Map links the Daml Lf-version to the minimum protocol version that supports it. */
val damlLfVersionToMinimumProtocolVersions: SortedMap[TransactionVersion, ProtocolVersion] =
SortedMap(
TransactionVersion.V31 -> ProtocolVersion.v31,
TransactionVersion.V31 -> ProtocolVersion.v32,
TransactionVersion.VDev -> ProtocolVersion.dev,
)

View File

@ -12,6 +12,7 @@ object ReleaseVersionToProtocolVersions {
private val v5 = ProtocolVersion(5)
private val v6 = ProtocolVersion(6)
private val v30 = ProtocolVersion(30)
private val v31 = ProtocolVersion(31)
import ProtocolVersion.*
@ -30,7 +31,8 @@ object ReleaseVersionToProtocolVersions {
ReleaseVersions.v2_8_0 -> List(v3, v4, v5),
ReleaseVersions.v2_9_0 -> List(v5),
ReleaseVersions.v3_0_0 -> List(v30),
ReleaseVersions.v3_1_0_snapshot -> List(v31),
ReleaseVersions.v3_1_0 -> List(v31),
ReleaseVersions.v3_2_0 -> List(v32),
).map { case (release, pvs) => (release.majorMinor, NonEmptyUtil.fromUnsafe(pvs)) }
val majorMinorToBetaProtocolVersions: Map[(Int, Int), NonEmpty[List[ProtocolVersion]]] = Map(

View File

@ -15,5 +15,6 @@ object ReleaseVersions {
lazy val v2_8_0: ReleaseVersion = ReleaseVersion(2, 8, 0)
lazy val v2_9_0: ReleaseVersion = ReleaseVersion(2, 9, 0)
lazy val v3_0_0: ReleaseVersion = ReleaseVersion(3, 0, 0)
lazy val v3_1_0_snapshot: ReleaseVersion = ReleaseVersion(3, 1, 0, Some("SNAPSHOT"))
lazy val v3_1_0: ReleaseVersion = ReleaseVersion(3, 1, 0)
lazy val v3_2_0: ReleaseVersion = ReleaseVersion(3, 2, 0)
}

View File

@ -209,7 +209,7 @@ object MerkleTreeTest {
override def supportedProtoVersions: data.MerkleTreeTest.AbstractLeaf.SupportedProtoVersions =
SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter.raw(
ProtocolVersion.v31,
ProtocolVersion.v32,
fromProto(30),
_.getCryptographicEvidence,
)

View File

@ -78,7 +78,7 @@ object UntypedVersionedMessageTest {
object Message extends HasVersionedMessageCompanion[Message] {
val supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> ProtoCodec(
ProtocolVersion.v31,
ProtocolVersion.v32,
supportedProtoVersion(DummyMessage)(fromProtoV30),
_.toProtoV30.toByteString,
)

View File

@ -42,7 +42,7 @@ class SubmissionRequestTest extends BaseTestWordSpec {
"aggregation id" should {
"authenticate the relevant fields" in {
if (testedProtocolVersion >= ProtocolVersion.v31) {
if (testedProtocolVersion >= ProtocolVersion.v32) {
val envelope1 = ClosedEnvelope.create(
ByteString.copyFromUtf8("Content1"),
@ -102,7 +102,7 @@ class SubmissionRequestTest extends BaseTestWordSpec {
}
"ignore sender-specific fields" in {
if (testedProtocolVersion >= ProtocolVersion.v31) {
if (testedProtocolVersion >= ProtocolVersion.v32) {
val envelope1 = ClosedEnvelope.create(
ByteString.copyFromUtf8("some-content"),
Recipients.cc(DefaultTestIdentities.participant1, DefaultTestIdentities.participant3),

View File

@ -115,7 +115,7 @@ object MemoizedEvidenceSUT
val name: String = "MemoizedEvidenceSUT"
val supportedProtoVersions: MemoizedEvidenceSUT.SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> UnsupportedProtoCodec(ProtocolVersion.v31)
ProtoVersion(30) -> UnsupportedProtoCodec(ProtocolVersion.v32)
)
private val defaultProtocolVersionRepresentative = protocolVersionRepresentativeFor(

View File

@ -34,7 +34,7 @@ trait DbTest
/** Flag to define the migration mode for the schemas */
def migrationMode: MigrationMode =
// TODO(i15561): Revert back to `== ProtocolVersion.dev` once v30 is a stable Daml 3 protocol version
if (BaseTest.testedProtocolVersion >= ProtocolVersion.v31) MigrationMode.DevVersion
if (BaseTest.testedProtocolVersion >= ProtocolVersion.v32) MigrationMode.DevVersion
else MigrationMode.Standard
protected def mkDbConfig(basicConfig: DbBasicConfig): DbConfig

View File

@ -170,7 +170,7 @@ trait TopologyStoreTest extends AsyncWordSpec with TopologyStoreTestBase {
txProtocolVersion <- store.findStoredForVersion(
CantonTimestamp.MaxValue,
tx1_NSD_Proposal.transaction,
ProtocolVersion.v31,
ProtocolVersion.v32,
)
proposalTransactions <- inspect(

View File

@ -33,14 +33,14 @@ class TopologyStoreTestData(
op,
serial,
mapping,
ProtocolVersion.v31,
ProtocolVersion.v32,
),
signatures = NonEmpty(Set, Signature.noSignature),
isProposal = isProposal,
)(
SignedTopologyTransaction.supportedProtoVersions
.protocolVersionRepresentativeFor(
ProtocolVersion.v31
ProtocolVersion.v32
)
)

View File

@ -12,7 +12,7 @@ class ProtocolVersionCompatibilityTest extends AnyWordSpec with BaseTest {
"version check" should {
"be successful for matching versions" in {
canClientConnectToServer(
clientSupportedVersions = Seq(ProtocolVersion.v31, ProtocolVersion.dev),
clientSupportedVersions = Seq(ProtocolVersion.v32, ProtocolVersion.dev),
server = ProtocolVersion.dev,
None,
) shouldBe Right(())
@ -20,12 +20,12 @@ class ProtocolVersionCompatibilityTest extends AnyWordSpec with BaseTest {
"fail with a nice message if incompatible" in {
canClientConnectToServer(
clientSupportedVersions = Seq(ProtocolVersion.v31),
clientSupportedVersions = Seq(ProtocolVersion.v32),
server = ProtocolVersion.dev,
None,
).left.value shouldBe (VersionNotSupportedError(
ProtocolVersion.dev,
Seq(ProtocolVersion.v31),
Seq(ProtocolVersion.v32),
))
}
}

View File

@ -21,7 +21,9 @@ class ProtocolVersionTest extends AnyWordSpec with BaseTest {
"parse version string if valid" in {
// New format
ProtocolVersion.create("31").value shouldBe ProtocolVersion.v31
ProtocolVersion
.create(ProtocolVersion.v32.toProtoPrimitiveS)
.value shouldBe ProtocolVersion.v32
ProtocolVersion
.create(Int.MaxValue.toString)
@ -31,19 +33,19 @@ class ProtocolVersionTest extends AnyWordSpec with BaseTest {
}
"be comparable" in {
ProtocolVersion.v31 < ProtocolVersion.dev shouldBe true
ProtocolVersion.v31 <= ProtocolVersion.dev shouldBe true
ProtocolVersion.v32 < ProtocolVersion.dev shouldBe true
ProtocolVersion.v32 <= ProtocolVersion.dev shouldBe true
ProtocolVersion.dev <= ProtocolVersion.dev shouldBe true
ProtocolVersion.dev < ProtocolVersion.v31 shouldBe false
ProtocolVersion.dev <= ProtocolVersion.v31 shouldBe false
ProtocolVersion.dev < ProtocolVersion.v32 shouldBe false
ProtocolVersion.dev <= ProtocolVersion.v32 shouldBe false
ProtocolVersion.dev <= ProtocolVersion.dev shouldBe true
ProtocolVersion.v31 < ProtocolVersion.dev shouldBe true
ProtocolVersion.dev <= ProtocolVersion.v31 shouldBe false
ProtocolVersion.v32 < ProtocolVersion.dev shouldBe true
ProtocolVersion.dev <= ProtocolVersion.v32 shouldBe false
ProtocolVersion.dev == ProtocolVersion.dev shouldBe true
ProtocolVersion.dev == ProtocolVersion.v31 shouldBe false
ProtocolVersion.dev == ProtocolVersion.v32 shouldBe false
}
val invalidProtocolVersionNumber = Int.MinValue

View File

@ -4,7 +4,7 @@ build-options:
name: ai-analysis
source: AIAnalysis.daml
init-script: AIAnalysis:setup
version: 3.1.0
version: 3.2.0
dependencies:
- daml-prim
- daml-stdlib

View File

@ -4,7 +4,7 @@ build-options:
name: bank
source: Bank.daml
init-script: Bank:setup
version: 3.1.0
version: 3.2.0
dependencies:
- daml-prim
- daml-stdlib

View File

@ -4,7 +4,7 @@ build-options:
name: doctor
source: Doctor.daml
init-script: Doctor:setup
version: 3.1.0
version: 3.2.0
dependencies:
- daml-prim
- daml-stdlib

View File

@ -4,7 +4,7 @@ build-options:
name: health-insurance
source: HealthInsurance.daml
init-script: HealthInsurance:setup
version: 3.1.0
version: 3.2.0
dependencies:
- daml-prim
- daml-stdlib

View File

@ -4,7 +4,7 @@ build-options:
name: medical-records
source: MedicalRecord.daml
init-script: MedicalRecord:setup
version: 3.1.0
version: 3.2.0
dependencies:
- daml-prim
- daml-stdlib

View File

@ -778,11 +778,8 @@ class SequencerNodeBootstrap(
): EitherT[Future, String, DynamicDomainGrpcServer] = {
runtime.registerAdminGrpcServices(service => adminServerRegistry.addServiceU(service))
for {
maxRequestSize <- EitherTUtil
.fromFuture(
domainParamsLookup.getApproximate(),
error => s"Unable to retrieve the domain parameters: ${error.getMessage}",
)
maxRequestSize <- EitherT
.right(domainParamsLookup.getApproximate())
.map(paramsO =>
paramsO.map(_.maxRequestSize).getOrElse(MaxRequestSize(NonNegativeInt.maxValue))
)

View File

@ -5,6 +5,7 @@ package com.digitalasset.canton.domain.sequencing.authentication.grpc
import cats.data.EitherT
import cats.implicits.*
import com.digitalasset.canton.auth.AsyncForwardingListener
import com.digitalasset.canton.domain.sequencing.authentication.grpc.SequencerAuthenticationServerInterceptor.VerifyTokenError
import com.digitalasset.canton.domain.sequencing.authentication.{
MemberAuthenticationService,

View File

@ -4,6 +4,7 @@
package com.digitalasset.canton.domain.sequencing.authentication.grpc
import cats.implicits.*
import com.digitalasset.canton.auth.AsyncForwardingListener
import com.digitalasset.canton.logging.{NamedLoggerFactory, NamedLogging}
import com.digitalasset.canton.sequencing.authentication.grpc.Constant
import com.digitalasset.canton.topology.Member

View File

@ -743,7 +743,7 @@ object DbSequencerStateManagerStore {
override def supportedProtoVersions: SupportedProtoVersions = SupportedProtoVersions(
ProtoVersion(30) -> VersionedProtoConverter.storage(
ReleaseProtocolVersion(ProtocolVersion.v31),
ReleaseProtocolVersion(ProtocolVersion.v32),
v30.AggregatedSignaturesOfSender,
)(
supportedProtoVersion(_)(fromProtoV30),

Some files were not shown because too many files have changed in this diff Show More