Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update canton to 20241020.14357.va37ef963 #20137

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ object LedgerApiCommands {
parties: Set[LfPartyId],
limit: PositiveInt,
templateFilter: Seq[TemplateId] = Seq.empty,
activeAtOffset: String = "",
activeAtOffset: String,
verbose: Boolean = true,
timeout: FiniteDuration,
includeCreatedEventBlob: Boolean = false,
Expand Down Expand Up @@ -1635,7 +1635,7 @@ object LedgerApiCommands {
GetActiveContractsRequest(
filter = Some(TransactionFilter(parties.map((_, filter)).toMap)),
verbose = verbose,
activeAtOffset = activeAtOffset,
activeAtOffset = ApiOffset.assertFromStringToLong(activeAtOffset),
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,9 @@ trait BaseLedgerApiAdministration extends NoTracing {
|- limit: limit (default set via canton.parameter.console)
|- verbose: whether the resulting events should contain detailed type information
|- filterTemplate: list of templates ids to filter for, empty sequence acts as a wildcard
|- activeAtOffsetO: the offset at which the snapshot of the active contracts will be computed, it
| must be no greater than the current ledger end offset and must be greater than or equal to the
| last pruning offset. If no offset is specified then the current participant end will be used.
|- timeout: the maximum wait time for the complete acs to arrive
|- includeCreatedEventBlob: whether the result should contain the createdEventBlobs, it works only
| if the filterTemplate is non-empty
Expand All @@ -962,13 +965,23 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit: PositiveInt = defaultLimit,
verbose: Boolean = true,
filterTemplates: Seq[TemplateId] = Seq.empty,
activeAtOffset: String = "",
activeAtOffsetO: Option[String] = None,
timeout: config.NonNegativeDuration = timeouts.unbounded,
includeCreatedEventBlob: Boolean = false,
resultFilter: GetActiveContractsResponse => Boolean = _.contractEntry.isDefined,
): Seq[WrappedContractEntry] = {
val observer =
new RecordingStreamObserver[GetActiveContractsResponse](limit.value, resultFilter)
val activeAt =
activeAtOffsetO match {
case None =>
consoleEnvironment.run {
ledgerApiCommand(
LedgerApiCommands.StateService.LedgerEnd()
)
}
case Some(offset) => offset
}
mkResult(
consoleEnvironment.run {
ledgerApiCommand(
Expand All @@ -977,7 +990,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
Set(party.toLf),
limit,
filterTemplates,
activeAtOffset,
activeAt,
verbose,
timeout.asFiniteApproximation,
includeCreatedEventBlob,
Expand All @@ -999,6 +1012,9 @@ trait BaseLedgerApiAdministration extends NoTracing {
|- limit: limit (default set via canton.parameter.console)
|- verbose: whether the resulting events should contain detailed type information
|- filterTemplate: list of templates ids to filter for, empty sequence acts as a wildcard
|- activeAtOffsetO: the offset at which the snapshot of the active contracts will be computed, it
| must be no greater than the current ledger end offset and must be greater than or equal to the
| last pruning offset. If no offset is specified then the current participant end will be used.
|- timeout: the maximum wait time for the complete acs to arrive
|- includeCreatedEventBlob: whether the result should contain the createdEventBlobs, it works only
| if the filterTemplate is non-empty"""
Expand All @@ -1008,7 +1024,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit: PositiveInt = defaultLimit,
verbose: Boolean = true,
filterTemplates: Seq[TemplateId] = Seq.empty,
activeAtOffset: String = "",
activeAtOffsetO: Option[String] = None,
timeout: config.NonNegativeDuration = timeouts.unbounded,
includeCreatedEventBlob: Boolean = false,
): Seq[ActiveContract] =
Expand All @@ -1017,7 +1033,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit,
verbose,
filterTemplates,
activeAtOffset,
activeAtOffsetO,
timeout,
includeCreatedEventBlob,
_.contractEntry.isActiveContract,
Expand All @@ -1033,6 +1049,9 @@ trait BaseLedgerApiAdministration extends NoTracing {
|- limit: limit (default set via canton.parameter.console)
|- verbose: whether the resulting events should contain detailed type information
|- filterTemplate: list of templates ids to filter for, empty sequence acts as a wildcard
|- activeAtOffsetO: the offset at which the snapshot of the events will be computed, it
| must be no greater than the current ledger end offset and must be greater than or equal to the
| last pruning offset. If no offset is specified then the current participant end will be used.
|- timeout: the maximum wait time for the complete acs to arrive
|- includeCreatedEventBlob: whether the result should contain the createdEventBlobs, it works only
| if the filterTemplate is non-empty"""
Expand All @@ -1042,7 +1061,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit: PositiveInt = defaultLimit,
verbose: Boolean = true,
filterTemplates: Seq[TemplateId] = Seq.empty,
activeAtOffset: String = "",
activeAtOffsetO: Option[String] = None,
timeout: config.NonNegativeDuration = timeouts.unbounded,
includeCreatedEventBlob: Boolean = false,
): Seq[WrappedIncompleteUnassigned] =
Expand All @@ -1051,7 +1070,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit,
verbose,
filterTemplates,
activeAtOffset,
activeAtOffsetO,
timeout,
includeCreatedEventBlob,
_.contractEntry.isIncompleteUnassigned,
Expand All @@ -1068,6 +1087,9 @@ trait BaseLedgerApiAdministration extends NoTracing {
|- limit: limit (default set via canton.parameter.console)
|- verbose: whether the resulting events should contain detailed type information
|- filterTemplate: list of templates ids to filter for, empty sequence acts as a wildcard
|- activeAtOffsetO: the offset at which the snapshot of the events will be computed, it must be no
| greater than the current ledger end offset and must be greater than or equal to the last
| pruning offset. If no offset is specified then the current participant end will be used.
|- timeout: the maximum wait time for the complete acs to arrive
|- includeCreatedEventBlob: whether the result should contain the createdEventBlobs, it works only
| if the filterTemplate is non-empty"""
Expand All @@ -1077,7 +1099,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit: PositiveInt = defaultLimit,
verbose: Boolean = true,
filterTemplates: Seq[TemplateId] = Seq.empty,
activeAtOffset: String = "",
activeAtOffsetO: Option[String] = None,
timeout: config.NonNegativeDuration = timeouts.unbounded,
includeCreatedEventBlob: Boolean = false,
): Seq[WrappedIncompleteAssigned] =
Expand All @@ -1086,7 +1108,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit,
verbose,
filterTemplates,
activeAtOffset,
activeAtOffsetO,
timeout,
includeCreatedEventBlob,
_.contractEntry.isIncompleteAssigned,
Expand All @@ -1104,6 +1126,9 @@ trait BaseLedgerApiAdministration extends NoTracing {
- limit: limit (default set via canton.parameter.console)
- verbose: whether the resulting events should contain detailed type information
- filterTemplate: list of templates ids to filter for, empty sequence acts as a wildcard
- activeAtOffsetO: the offset at which the snapshot of the active contracts will be computed, it
must be no greater than the current ledger end offset and must be greater than or equal to the
last pruning offset. If no offset is specified then the current participant end will be used.
- timeout: the maximum wait time for the complete acs to arrive
- identityProviderId: limit the response to parties governed by the given identity provider
- includeCreatedEventBlob: whether the result should contain the createdEventBlobs, it works only
Expand All @@ -1115,7 +1140,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
limit: PositiveInt = defaultLimit,
verbose: Boolean = true,
filterTemplates: Seq[TemplateId] = Seq.empty,
activeAtOffset: String = "",
activeAtOffsetO: Option[String] = None,
timeout: config.NonNegativeDuration = timeouts.unbounded,
identityProviderId: String = "",
includeCreatedEventBlob: Boolean = false,
Expand Down Expand Up @@ -1145,7 +1170,7 @@ trait BaseLedgerApiAdministration extends NoTracing {
localParties.toSet,
limit,
filterTemplates,
activeAtOffset,
activeAtOffsetO.getOrElse(end()),
verbose,
timeout.asFiniteApproximation,
includeCreatedEventBlob,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ trait Environment extends NamedLogging with AutoCloseable with NoTracing {
clock.advanceTo(parent.now)
clock
case ClockConfig.RemoteClock(clientConfig) =>
new RemoteClock(
RemoteClock(
clientConfig,
config.parameters.timeouts.processing,
clockLoggerFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ message AggregationRule {
}

message Stakeholders {
repeated string stakeholders = 1; // stakeholders of the contract
repeated string all = 1; // all stakeholders of the contract
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ syntax = "proto3";
package com.digitalasset.canton.topology.admin.v30;

import "com/digitalasset/canton/topology/admin/v30/topology_ext.proto";
import "google/protobuf/timestamp.proto";

/**
* The node identity initialization service
Expand Down Expand Up @@ -62,5 +61,5 @@ message GetIdRequest {}
message CurrentTimeRequest {}

message CurrentTimeResponse {
google.protobuf.Timestamp current_time = 1;
int64 current_time = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ final case class AssignmentCommonData private (
override def hashPurpose: HashPurpose = HashPurpose.AssignmentCommonData

def confirmingParties: Map[LfPartyId, PositiveInt] =
stakeholders.stakeholders.map(_ -> PositiveInt.one).toMap
stakeholders.all.map(_ -> PositiveInt.one).toMap

override protected def pretty: Pretty[AssignmentCommonData] = prettyOfClass(
param("submitter metadata", _.submitterMetadata),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ final case class UnassignmentCommonData private (
override def hashPurpose: HashPurpose = HashPurpose.UnassignmentCommonData

def confirmingParties: Map[LfPartyId, PositiveInt] =
stakeholders.stakeholders.map(_ -> PositiveInt.one).toMap
stakeholders.all.map(_ -> PositiveInt.one).toMap

override protected def pretty: Pretty[UnassignmentCommonData] = prettyOfClass(
param("submitter metadata", _.submitterMetadata),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.digitalasset.canton.networking.grpc

import cats.data.EitherT
import cats.implicits.*
import com.daml.error.{ErrorCategory, ErrorCode, Explanation, Resolution}
import com.daml.error.{ErrorCategory, ErrorCategoryRetry, ErrorCode, Explanation, Resolution}
import com.daml.grpc.AuthCallCredentials
import com.digitalasset.canton.concurrent.DirectExecutionContext
import com.digitalasset.canton.connection.v30.{ApiInfoServiceGrpc, GetApiInfoRequest}
Expand Down Expand Up @@ -263,10 +263,16 @@ object CantonGrpcUtil {
object AbortedDueToShutdown
extends ErrorCode(
id = "ABORTED_DUE_TO_SHUTDOWN",
ErrorCategory.CancelledOperation,
ErrorCategory.TransientServerFailure,
) {
final case class Error()(implicit val loggingContext: ErrorLoggingContext)
extends CantonError.Impl("request aborted due to shutdown")
extends CantonError.Impl("request aborted due to shutdown") {
import scala.concurrent.duration.*
// Processing may have been cancelled due to a transient error, e.g., server restarting
// The transient errors might be solved by the application retrying with a higher timeout than
// The non-transient errors will require operator intervention
override def retryable = Some(ErrorCategoryRetry(1.minute))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import com.digitalasset.canton.serialization.ProtoConverter.ParsingResult
import com.digitalasset.canton.version.*

// Invariant: signatories is a subset of stakeholders
final case class Stakeholders private (stakeholders: Set[LfPartyId])
final case class Stakeholders private (all: Set[LfPartyId])
extends HasVersionedWrapper[Stakeholders]
with PrettyPrinting {

override protected def companionObj: HasVersionedMessageCompanionCommon[Stakeholders] =
Stakeholders

override protected def pretty: Pretty[Stakeholders.this.type] = prettyOfClass(
param("stakeholders", _.stakeholders)
param("all", _.all)
)

def toProtoV30: v30.Stakeholders = v30.Stakeholders(
stakeholders = stakeholders.toSeq
all = all.toSeq
)
}

Expand All @@ -38,17 +38,17 @@ object Stakeholders extends HasVersionedMessageCompanion[Stakeholders] {
)

def tryCreate(stakeholders: Set[LfPartyId]): Stakeholders =
new Stakeholders(stakeholders = stakeholders)
new Stakeholders(all = stakeholders)

def apply(metadata: ContractMetadata): Stakeholders =
Stakeholders(stakeholders = metadata.stakeholders)
Stakeholders(all = metadata.stakeholders)

def fromProtoV30(stakeholdersP: v30.Stakeholders): ParsingResult[Stakeholders] =
for {
stakeholders <- stakeholdersP.stakeholders
stakeholders <- stakeholdersP.all
.traverse(ProtoConverter.parseLfPartyId(_, "stakeholders"))
.map(_.toSet)

} yield Stakeholders(stakeholders = stakeholders)
} yield Stakeholders(all = stakeholders)

}
Loading
Loading