Skip to content

Commit a65edf0

Browse files
Update 2023-09-26.23 (#113)
Reference commit: ceb4c77515 Co-authored-by: Canton <canton@digitalasset.com>
1 parent ab92e8b commit a65edf0

File tree

217 files changed

+3316
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+3316
-844
lines changed

community/app-base/src/main/scala/com/digitalasset/canton/admin/api/client/commands/ParticipantAdminCommands.scala

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ import com.digitalasset.canton.participant.admin.v0.PingServiceGrpc.PingServiceS
2929
import com.digitalasset.canton.participant.admin.v0.PruningServiceGrpc.PruningServiceStub
3030
import com.digitalasset.canton.participant.admin.v0.ResourceManagementServiceGrpc.ResourceManagementServiceStub
3131
import com.digitalasset.canton.participant.admin.v0.TransferServiceGrpc.TransferServiceStub
32-
import com.digitalasset.canton.participant.admin.v0.{ResourceLimits as _, *}
32+
import com.digitalasset.canton.participant.admin.v0.{
33+
PurgeContractsRequest,
34+
PurgeContractsResponse,
35+
ResourceLimits as _,
36+
*,
37+
}
3338
import com.digitalasset.canton.participant.admin.{ResourceLimits, v0}
3439
import com.digitalasset.canton.participant.domain.DomainConnectionConfig as CDomainConnectionConfig
3540
import com.digitalasset.canton.participant.sync.UpstreamOffsetConvert
@@ -162,7 +167,7 @@ object ParticipantAdminCommands {
162167
): Either[String, Unit] = {
163168
response.success match {
164169
case None => Left("unexpected empty response")
165-
case Some(success) => Right(())
170+
case Some(_success) => Right(())
166171
}
167172
}
168173

@@ -534,6 +539,36 @@ object ParticipantAdminCommands {
534539
}
535540
}
536541

542+
final case class PurgeContracts(
543+
domain: DomainAlias,
544+
contracts: Seq[LfContractId],
545+
ignoreAlreadyPurged: Boolean,
546+
) extends GrpcAdminCommand[PurgeContractsRequest, PurgeContractsResponse, Unit] {
547+
548+
override type Svc = ParticipantRepairServiceStub
549+
550+
override def createService(channel: ManagedChannel): ParticipantRepairServiceStub =
551+
ParticipantRepairServiceGrpc.stub(channel)
552+
553+
override def createRequest(): Either[String, PurgeContractsRequest] = {
554+
Right(
555+
PurgeContractsRequest(
556+
domain = domain.toProtoPrimitive,
557+
contractIds = contracts.map(_.coid),
558+
ignoreAlreadyPurged = ignoreAlreadyPurged,
559+
)
560+
)
561+
}
562+
563+
override def submitRequest(
564+
service: ParticipantRepairServiceStub,
565+
request: PurgeContractsRequest,
566+
): Future[PurgeContractsResponse] = service.purgeContracts(request)
567+
568+
override def handleResponse(response: PurgeContractsResponse): Either[String, Unit] =
569+
Right(())
570+
}
571+
537572
final case class MigrateDomain(
538573
sourceDomainAlias: DomainAlias,
539574
targetDomainConfig: CDomainConnectionConfig,

community/app-base/src/main/scala/com/digitalasset/canton/admin/api/client/commands/TopologyAdminCommands.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,13 @@ object TopologyAdminCommands {
154154
namespace: Fingerprint,
155155
authorizedKey: Fingerprint,
156156
isRootDelegation: Boolean,
157+
force: Boolean,
157158
) extends BaseCommand[v0.NamespaceDelegationAuthorization] {
158159

159160
override def createRequest(): Either[String, v0.NamespaceDelegationAuthorization] =
160161
Right(
161162
v0.NamespaceDelegationAuthorization(
162-
authData(ops, signedBy, replaceExisting = false, force = false),
163+
authData(ops, signedBy, replaceExisting = false, force = force),
163164
namespace.toProtoPrimitive,
164165
authorizedKey.toProtoPrimitive,
165166
isRootDelegation,

community/app-base/src/main/scala/com/digitalasset/canton/admin/api/client/commands/TopologyAdminCommandsX.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ object TopologyAdminCommandsX {
668668
store: String,
669669
serial: Option[PositiveInt] = None,
670670
change: TopologyChangeOpX = TopologyChangeOpX.Replace,
671-
mustFullyAuthorize: Boolean = true,
671+
mustFullyAuthorize: Boolean = false,
672672
): Propose[M] =
673673
Propose(Right(mapping), signedBy, change, serial, mustFullyAuthorize, store)
674674

community/app-base/src/main/scala/com/digitalasset/canton/console/InstanceReference.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ object ParticipantReference {
456456
val InstanceType = "Participant"
457457
}
458458

459-
trait ParticipantReferenceCommon
459+
sealed trait ParticipantReferenceCommon
460460
extends ConsoleCommandGroup
461461
with ParticipantAdministration
462462
with LedgerApiAdministration
@@ -493,6 +493,9 @@ trait ParticipantReferenceCommon
493493
lazy private val replicationGroup =
494494
new ParticipantReplicationAdministrationGroup(this, consoleEnvironment)
495495

496+
@Help.Summary("Commands to repair the participant contract state", FeatureFlag.Repair)
497+
@Help.Group("Repair")
498+
def repair: ParticipantRepairAdministration
496499
}
497500

498501
abstract class ParticipantReference(
@@ -542,7 +545,7 @@ abstract class ParticipantReference(
542545
): Boolean = topology.participant_domain_states.active(domainId, participantId)
543546
}
544547

545-
trait RemoteParticipantReferenceCommon
548+
sealed trait RemoteParticipantReferenceCommon
546549
extends LedgerApiCommandRunner
547550
with ParticipantReferenceCommon {
548551

community/app-base/src/main/scala/com/digitalasset/canton/console/commands/ParticipantRepairAdministration.scala

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,35 @@ class ParticipantRepairAdministration(
5252
with NoTracing
5353
with Helpful {
5454

55+
@Help.Summary("Purge contracts with specified Contract IDs from local participant.")
56+
@Help.Description(
57+
"""This is a last resort command to recover from data corruption, e.g. in scenarios in which participant
58+
|contracts have somehow gotten out of sync and need to be manually purged, or in situations in which
59+
|stakeholders are no longer available to agree to their archival. The participant needs to be disconnected from
60+
|the domain on which the contracts with "contractIds" reside at the time of the call, and as of now the domain
61+
|cannot have had any inflight requests.
62+
|The "ignoreAlreadyPurged" flag makes it possible to invoke the command multiple times with the same
63+
|parameters in case an earlier command invocation has failed.
64+
|As repair commands are powerful tools to recover from unforeseen data corruption, but dangerous under normal
65+
|operation, use of this command requires (temporarily) enabling the "features.enable-repair-commands"
66+
|configuration. In addition repair commands can run for an unbounded time depending on the number of
67+
|contract ids passed in. Be sure to not connect the participant to the domain until the call returns."""
68+
)
69+
def purge(
70+
domain: DomainAlias,
71+
contractIds: Seq[LfContractId],
72+
ignoreAlreadyPurged: Boolean = true,
73+
): Unit =
74+
consoleEnvironment.run {
75+
runner.adminCommand(
76+
ParticipantAdminCommands.ParticipantRepairManagement.PurgeContracts(
77+
domain = domain,
78+
contracts = contractIds,
79+
ignoreAlreadyPurged = ignoreAlreadyPurged,
80+
)
81+
)
82+
}
83+
5584
@Help.Summary("Migrate contracts from one domain to another one.")
5685
@Help.Description(
5786
"""This method can be used to migrate all the contracts associated with a domain to a new domain connection.
@@ -320,29 +349,6 @@ abstract class LocalParticipantRepairAdministration(
320349
}
321350
}
322351

323-
@Help.Summary("Purge contracts with specified Contract IDs from local participant.")
324-
@Help.Description(
325-
"""This is a last resort command to recover from data corruption, e.g. in scenarios in which participant
326-
|contracts have somehow gotten out of sync and need to be manually purged, or in situations in which
327-
|stakeholders are no longer available to agree to their archival. The participant needs to be disconnected from
328-
|the domain on which the contracts with "contractIds" reside at the time of the call, and as of now the domain
329-
|cannot have had any inflight requests.
330-
|The "ignoreAlreadyPurged" flag makes it possible to invoke the command multiple times with the same
331-
|parameters in case an earlier command invocation has failed.
332-
|As repair commands are powerful tools to recover from unforeseen data corruption, but dangerous under normal
333-
|operation, use of this command requires (temporarily) enabling the "features.enable-repair-commands"
334-
|configuration. In addition repair commands can run for an unbounded time depending on the number of
335-
|contract ids passed in. Be sure to not connect the participant to the domain until the call returns."""
336-
)
337-
def purge(
338-
domain: DomainAlias,
339-
contractIds: Seq[LfContractId],
340-
ignoreAlreadyPurged: Boolean = true,
341-
): Unit =
342-
runRepairCommand(tc =>
343-
access(_.sync.repairService.purgeContracts(domain, contractIds, ignoreAlreadyPurged)(tc))
344-
)
345-
346352
@Help.Summary("Move contracts with specified Contract IDs from one domain to another.")
347353
@Help.Description(
348354
"""This is a last resort command to recover from data corruption in scenarios in which a domain is

community/app-base/src/main/scala/com/digitalasset/canton/console/commands/TopologyAdministration.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,20 @@ class TopologyAdministrationGroup(
231231
synchronize: Option[NonNegativeDuration] = Some(
232232
consoleEnvironment.commandTimeouts.bounded
233233
),
234+
// intentionally not documented force flag, as it is dangerous
235+
force: Boolean = false,
234236
): ByteString =
235237
synchronisation.run(synchronize)(consoleEnvironment.run {
236238
adminCommand(
237239
TopologyAdminCommands.Write
238-
.AuthorizeNamespaceDelegation(ops, signedBy, namespace, authorizedKey, isRootDelegation)
240+
.AuthorizeNamespaceDelegation(
241+
ops,
242+
signedBy,
243+
namespace,
244+
authorizedKey,
245+
isRootDelegation,
246+
force,
247+
)
239248
)
240249
})
241250

community/app-base/src/main/scala/com/digitalasset/canton/console/commands/TopologyAdministrationX.scala

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ class TopologyAdministrationGroupX(
324324
signedBy = signedBy.toList,
325325
serial = serial,
326326
change = TopologyChangeOpX.Replace,
327-
// TODO(#12390): change to false when activating topology transaction validation
328-
mustFullyAuthorize = true,
327+
mustFullyAuthorize = false,
329328
store = store,
330329
)
331330
}
@@ -521,8 +520,7 @@ class TopologyAdministrationGroupX(
521520
domainId: Option[DomainId] = None,
522521
serial: Option[PositiveInt] = None,
523522
groupAddressing: Boolean = false,
524-
// TODO(#12390): change to false when activating topology transaction validation
525-
mustFullyAuthorize: Boolean = true,
523+
mustFullyAuthorize: Boolean = false,
526524
store: String = AuthorizedStore.filterName,
527525
): SignedTopologyTransactionX[TopologyChangeOpX, PartyToParticipantX] = {
528526
val op = NonEmpty.from(newParticipants) match {
@@ -908,8 +906,7 @@ class TopologyAdministrationGroupX(
908906
signedBy = signedBy.toList,
909907
serial = serial,
910908
change = TopologyChangeOpX.Replace,
911-
// TODO(#12390): change to false when activating topology transaction validation
912-
mustFullyAuthorize = true,
909+
mustFullyAuthorize = false,
913910
store = store.getOrElse(domainId.filterString),
914911
)
915912
)
@@ -961,8 +958,7 @@ class TopologyAdministrationGroupX(
961958
signedBy = signedBy.toList,
962959
serial = serial,
963960
change = TopologyChangeOpX.Replace,
964-
// TODO(#12390): change to false when activating topology transaction validation
965-
mustFullyAuthorize = true,
961+
mustFullyAuthorize = false,
966962
store = store.getOrElse(domainId.filterString),
967963
)
968964
)
@@ -1015,8 +1011,7 @@ class TopologyAdministrationGroupX(
10151011
),
10161012
signedBy.toList,
10171013
serial = serial,
1018-
// TODO(#12390): change to false when activating topology transaction validation
1019-
mustFullyAuthorize = true,
1014+
mustFullyAuthorize = false,
10201015
store = store.getOrElse(domain.filterString),
10211016
)
10221017
)

community/app-base/src/main/scala/com/digitalasset/canton/environment/Environment.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,16 @@ trait Environment extends NamedLogging with AutoCloseable with NoTracing {
164164
logger.debug(config.portDescription)
165165

166166
implicit val scheduler: ScheduledExecutorService =
167-
Threading.singleThreadScheduledExecutor(loggerFactory.threadName + "-env-scheduler", logger)
167+
Threading.singleThreadScheduledExecutor(
168+
loggerFactory.threadName + "-env-scheduler",
169+
noTracingLogger,
170+
)
168171

169-
private val numThreads = Threading.detectNumberOfThreads(logger)
172+
private val numThreads = Threading.detectNumberOfThreads(noTracingLogger)
170173
implicit val executionContext: ExecutionContextIdlenessExecutorService =
171174
Threading.newExecutionContext(
172175
loggerFactory.threadName + "-env-execution-context",
173-
logger,
176+
noTracingLogger,
174177
metricsFactory.executionServiceMetrics,
175178
numThreads,
176179
)
@@ -200,7 +203,7 @@ trait Environment extends NamedLogging with AutoCloseable with NoTracing {
200203
AkkaUtil.createExecutionSequencerFactory(
201204
loggerFactory.threadName + "-admin-workflow-services",
202205
// don't log the number of threads twice, as we log it already when creating the first pool
203-
NamedLogging.noopLogger,
206+
NamedLogging.noopNoTracingLogger,
204207
)
205208

206209
// additional closeables
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_shared {
2+
ledger-api {
3+
max-transactions-in-memory-fan-out-buffer-size = 10000 // default 1000
4+
}
5+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_shared {
2+
ledger-api {
3+
max-contract-state-cache-size = 100000 // default 1e4
4+
max-contract-key-state-cache-size = 100000 // default 1e4
5+
}
6+
}

0 commit comments

Comments
 (0)